春风项目四线(合箱线、总装线)
yyt
2024-05-05 1a444b1dc206297ed3d7199c3c5fb557f580c9af
更新过站
已修改6个文件
120 ■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/mapper/BsOrderSchedulingMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/service/IBsOrderSchedulingService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/service/impl/BsOrderSchedulingServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/resources/mapper/bs/orderScheduling/BsOrderSchedulingMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-quartz/src/main/java/com/jcdm/quartz/task/RyTask.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/mapper/BsOrderSchedulingMapper.java
@@ -22,6 +22,14 @@
    public BsOrderScheduling selectBsOrderSchedulingById(Long id);
    /**
     * 查询订单排产
     *
     * @param sncode 订单排产发动机号
     * @return 订单排产
     */
    public BsOrderScheduling selectBsOrderSchedulingSNCode(String sncode);
    /**
     * 查询订单排产列表
     * 
     * @param bsOrderScheduling 订单排产
jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/service/IBsOrderSchedulingService.java
@@ -22,6 +22,14 @@
    public BsOrderScheduling selectBsOrderSchedulingById(Long id);
    /**
     * 查询订单排产
     *
     * @param sncode 订单排产发动机号
     * @return 订单排产
     */
    public BsOrderScheduling selectBsOrderSchedulingSNCode(String sncode);
    /**
     * 查询订单排产列表
     * 
     * @param bsOrderScheduling 订单排产
jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/service/impl/BsOrderSchedulingServiceImpl.java
@@ -61,6 +61,20 @@
    }
    /**
     * 查询订单排产
     *
     * @param sncode 订单排产发动机号
     * @return 订单排产
     */
    @Override
    public BsOrderScheduling selectBsOrderSchedulingSNCode(String sncode)
    {
        return bsOrderSchedulingMapper.selectBsOrderSchedulingSNCode(sncode);
    }
    /**
     * 查询订单排产列表
     * 
     * @param bsOrderScheduling 订单排产
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -1,6 +1,5 @@
package com.jcdm.main.plcserver.sub;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -22,6 +21,8 @@
import com.kangaroohy.milo.runner.subscription.SubscriptionCallback;
import com.kangaroohy.milo.service.MiloService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@@ -36,6 +37,7 @@
@Component
public class OPCUaSubscription implements SubscriptionCallback {
    private static final Logger logger = LoggerFactory.getLogger("sys-user");
    public static MiloService miloService;
    public IDaCollectionParamConfService collectionParamConfService;
@@ -80,9 +82,6 @@
        String ecpStr = "";//异常记录标记
        try {
            if(null != value && "1".equals(value.toString())) {
//                if (OPCElement.OP121_ZZ_CODE_CHECK.equals(identifier)){
//                    rework("2V91Y RD25D080",identifier);
//                }
                //1、检索SN号
                //2、过站参数采集
                //3、扫码枪数据回传
@@ -91,26 +90,23 @@
                List<String> collect2 = lists.stream().filter(x -> OPCElement.SAVE_DATA.equals(x.getrFunction()))
                        .map(DaOpcuaConfig::getNode).collect(Collectors.toList());
                if (collect1.contains(identifier)){
                    log.info("-------监听到,{}的CODE_CHECK的信号",identifier);
                    log.info("-------time--------------,{}",LocalDateTime.now());
                    logger.info("-------监听到,{}的CODE_CHECK的信号",identifier);
                    //logger.info("-------time--------------,{}",LocalDateTime.now());
                    //sn
                    this.SNRetrieval(identifier,value.toString());
                    if (identifier.equals(OPCElement.OP120_ZZ_CODE_CHECK) && "1".equals(value.toString())){
                        //总装上线扫码传输数据
                        log.info("-------监听到,{}的扫码枪扫码的CODE_CHECK的信号",identifier);
                        logger.info("-------监听到,{}的扫码枪扫码的CODE_CHECK的信号",identifier);
                        scannerGunMessage();
                    }
                }
                if (collect2.contains(identifier)){
                    if ("1".equals(value.toString())){
                        log.info("-------监听到,{}的SAVE_REQUEST_LAST的信号",identifier);
                        log.info("-------time--------------,{}",LocalDateTime.now());
                        //save
                        logger.info("-------监听到,{}的SAVE_REQUEST_LAST的信号",identifier);
                        //logger.info("-------time--------------,{}",LocalDateTime.now());
                        this.SaveData(identifier);
                    }
                }
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
@@ -174,17 +170,16 @@
                    if (CollUtil.isNotEmpty(rmRepairRecords)){
                        a = "1";
                    }
                }
                log.info("-----返回codeCheckFeed-----,{}",a);
                logger.info("-----返回codeCheckFeed-----,{}",a);
//                String a="1";
                // 1:OK可生产 2:NG不可生产 3:NG可返工 4:PC检索失败(无记录)5:PC检索失败(软件)
                if (StrUtil.isNotBlank(a)){
                    int input = Integer.parseInt(a);
                    ReadWriteEntity entity = new ReadWriteEntity(parts[0]+"."+parts[1]+".CodeCheckFeed", input);
                    log.info("-------监听到,{}的CodeCheck的信号",Node);
                    logger.info("-------监听到,{}的CodeCheck的信号",Node);
                    miloService.writeToOpcByte(entity);
                    log.info("监听到返回codecheckfeed信号,{}",entity);
                    logger.info("监听到返回codecheckfeed信号,{}",entity);
                    //首站传输订单号
                    if (OPCElement.OP050_HX_CODE_CHECK.equals(Node)){
                        //查询订单号
@@ -196,14 +191,12 @@
                            BsOrderScheduling bsOrderScheduling1 = tempList.get(0);
                            orderNum = bsOrderScheduling1.getOrderNo();
                        }
                        ReadWriteEntity entity2 = new ReadWriteEntity(parts[0]+"."+parts[1]+".OrderNumber", orderNum);
                        miloService.writeToOpcUa(entity2);
                    }
                    //如果是返修工位需要传输返修工位号
                    if (OPCElement.OP465_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP355_ZZ_CODE_CHECK.equals(Node)
                    || OPCElement.OP695_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){
                        rework(SNCode,Node,daPassingStationCollections,rmRepairRecords);
                    }
                    System.out.println(entity);
@@ -238,7 +231,7 @@
        //过站记录
//        List<DaPassingStationCollection> daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection);
        //所有反工工位
        //所有返工工位
        List<String> collect1 = rmRepairRecords.stream().map(RmRepairRecord::getProcessesCode).collect(Collectors.toList());
        if (CollUtil.isNotEmpty(collect1)){
            //查询出所有需要返修工位的最小op块
@@ -271,8 +264,6 @@
                }
            }
            //所有放行工位
            List<String> passStation = new ArrayList<>();
            //所有生产工位
@@ -350,7 +341,7 @@
            readWriteEntity.setValue(minOP);
            miloService.writeToOpcShort(readWriteEntity);
            miloService.writeToOpcByte(writeList);
            log.info("返修写入:,{}",writeList);
            logger.info("{}返修写入:,{}",SNCode,writeList);
            if (CollUtil.isNotEmpty(OP755List)){
                miloService.writeToOpcByte(OP755List);
            }
@@ -392,10 +383,10 @@
            List<ReadWriteEntity> readWriteEntityList = new ArrayList<>();
            if(CollUtil.isNotEmpty(nodeIdList)){
                long time1 = new Date().getTime();
                //long time1 = new Date().getTime();
                readWriteEntityList = miloService.readFromOpcUa(nodeIdList);
                long time2 = new Date().getTime();
                log.info("读取点位花费时间:{},",time2-time1);
                //long time2 = new Date().getTime();
                //logger.info("读取点位花费时间:{},",time2-time1);
            }
                //返回plc保存成功
                if (parts.length==3){
@@ -406,9 +397,12 @@
                        ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeedLast", 1);
                                miloService.writeToOpcByte(entity);
                    }
                    log.info("-------请求返回,{}的SaveFeedLast的信号",Node);
                    log.info("-------请求返回-----,{}",LocalDateTime.now());
                    logger.info("{}保存请求信号返回,MES->PLC的SaveFeedLast信号",Node);
                    //logger.info("-------请求返回-----,{}",LocalDateTime.now());
                }
                BsOrderScheduling bsOrderScheduling=bsOrderSchedulingService.selectBsOrderSchedulingSNCode(SNCode);
                List<DaParamCollection> daParamCollectionlist = new ArrayList<>();
                if (CollUtil.isNotEmpty(nodeIdList)){
                    for(int i=0;i<nodeIdList.size();i++){
@@ -429,23 +423,20 @@
                            ParamCollection.setState("合格");
                            ParamCollection.setType(list.get(i).getCollectParameterType());
                            ParamCollection.setCollectionTime(new Date());
                            ParamCollection.setWorkOrderNo(bsOrderScheduling.getOrderNo());
                            daParamCollectionlist.add(ParamCollection);
                        }
                    }
                    daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist);
                    log.info("-------保存数据完成---------");
                    logger.info("{}发动机({})采集数据保存完成",SNCode,Node);
                }
            Long beatTime = 0L;
            if (ObjectUtil.isNotEmpty(object)){
                String str = object.toString();
                beatTime = Float.valueOf(str).longValue();
            }
            Object ProductStatus = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".ProductStatus").getValue();
            log.info("ProductStatus,{}",ProductStatus.toString());
            logger.info("ProductStatus,{}",ProductStatus.toString());
            String str1="合格" ;
            if (ObjectUtil.isNotEmpty(ProductStatus)){
                String productStatusString = ProductStatus.toString();
@@ -464,9 +455,26 @@
            PassingStationCollection.setCreateTime(new Date());
            PassingStationCollection.setBeatTime(beatTime.toString());
            PassingStationCollection.setOutRsSign(str1);
            PassingStationCollection.setWorkOrderNo(bsOrderScheduling.getOrderNo());
            passingStationCollectionServiceImpl.insertDaPassingStationCollection(PassingStationCollection);
            log.info("-------保存过站记录数据完成---------");
            logger.info("{}发动机({})过站数据保存完成",SNCode,Node);
            //更新工单状态
            if ("OP790".equals(parts[1])) {
                bsOrderScheduling.setReport20("1");
                bsOrderScheduling.setProductionStatus("3");
                bsOrderScheduling.setFinalAssemblyOfflineTime(new Date());
            }else if("OP050".equals(parts[1])){
                bsOrderScheduling.setReport10("1");
                bsOrderScheduling.setProductionStatus("2");
                bsOrderScheduling.setBoxClosingOnlineTime(new Date());
            }else if("OP120".equals(parts[1])){
                bsOrderScheduling.setFinalAssemblyLaunchTime(new Date());
                bsOrderScheduling.setClosingBoxOfflineTime(new Date());
            }
            bsOrderScheduling.setQualityStatus(str1);
            bsOrderScheduling.setCurrentWorkstation(parts[1]);
            bsOrderSchedulingService.updateBsOrderScheduling(bsOrderScheduling);
        }
    }
}
jcdm-main/src/main/resources/mapper/bs/orderScheduling/BsOrderSchedulingMapper.xml
@@ -99,6 +99,12 @@
        <include refid="selectBsOrderSchedulingVo"/>
        where id = #{id}
    </select>
    <select id="selectBsOrderSchedulingSNCode" parameterType="String" resultMap="BsOrderSchedulingResult">
        <include refid="selectBsOrderSchedulingVo"/>
        where engine_no = #{sncode}
    </select>
    <select id="getPrepareOnlineList" resultType="com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling">
        select bos.* from bs_order_scheduling bos
        <where>
jcdm-quartz/src/main/java/com/jcdm/quartz/task/RyTask.java
@@ -6,6 +6,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.jcdm.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@@ -17,6 +19,7 @@
@Component("ryTask")
public class RyTask
{
    private static final Logger logger = LoggerFactory.getLogger("sys-user");
    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
    {
        System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
@@ -46,6 +49,7 @@
        List<BsOrderScheduling> bsOrderSchedulings = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
        for (BsOrderScheduling orderScheduling : bsOrderSchedulings) {
            String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(), "0010"));
            logger.info("{}",xmlResult);
            String status = ReceivingServices.xmlToJSON3(xmlResult);
            if(status.equals("1")){
                orderScheduling.setReport10("1");
@@ -61,9 +65,10 @@
        List<BsOrderScheduling> bsOrderSchedulings = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
        for (BsOrderScheduling orderScheduling : bsOrderSchedulings) {
            String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(), "0790"));
            logger.info("{}",xmlResult);
            String status = ReceivingServices.xmlToJSON3(xmlResult);
            if(status.equals("1")){
                orderScheduling.setReport10("1");
                orderScheduling.setReport20("1");
                int i = bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling);
                System.out.println("更新状态成功");
            }
@@ -83,6 +88,7 @@
                "      </urn:ZPP_BC_001>\n" +
                "   </soapenv:Body>\n" +
                "</soapenv:Envelope>";
        return content;
    }
}