cl
2024-01-19 e0fac38b26845f25de479783e0c76cf12a5311e0
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/server/OP040/impl/OP040ServerInterfaceImpl.java
@@ -77,8 +77,8 @@
        String ecpStr = "";//异常记录标记
        try{
            String isHeartBeat = OPCUnit.read(opc.getOP040_F_HEART_BEAT());
            setHeartbeat(isHeartBeat);
           /* String isHeartBeat = OPCUnit.read(opc.getOP040_F_HEART_BEAT());
            setHeartbeat(isHeartBeat);*/
            if(GlobalVariable.OP040_F_HEART_BEAT) {
@@ -97,9 +97,15 @@
                if(isPLCFinish.equals("true")){
                    String isFinish = OPCUnit.read(opc.getOP040_J_PC_FINISH());//PC操作完成
                    if(isFinish.equals("false")){
                        handleMaterial();
                        handleInfo();
                        logger.info("handleFinsh开始时间:"+new Date());
                        handleFinsh();
                        logger.info("handleFinsh完成时间:"+new Date());
                        logger.info("handleInfo开始时间:"+new Date());
                        handleInfo();
                        logger.info("handleInfo完成时间:"+new Date());
                        logger.info("handleMaterial开始时间:"+new Date());
                        handleMaterial();
                        logger.info("handleMaterial完成时间:"+new Date());
                    }
                }
@@ -128,13 +134,7 @@
    }
    public void handleMaterial() {
        if("".equals(S_ORDER_CODE)){
            IN_TIME = DateTool.getLocalTimeForDate();
            S_ORDER_CODE = OPCUnit.read(opc.getOP040_S_ORDER_CODE());//工单编号
            S_PRODUCT_TYPE = OPCUnit.read(opc.getOP040_S_PRODUCT_CODE());//产品编号
            S_PRODUCT_CODE = GlobalVariable.PRODUCT_CODE_MAP.get(S_PRODUCT_TYPE);
            S_SFC_CODE = OPCUnit.read(opc.getOP040_S_SFC_CODE());//总成编码
        }
        //查询批次上料信息
        ProductionOrderBatchInfoParam productionOrderBatchInfoParam = new ProductionOrderBatchInfoParam();
        productionOrderBatchInfoParam.setWorkOrderNo(S_ORDER_CODE);
@@ -144,22 +144,8 @@
        for(int i=0;i<list1.size();i++){
            ProductionOrderBatchInfoResult productionOrderBatchInfoResult = list1.get(i);
            //判断是否有该工位
            String[] locationCodes = productionOrderBatchInfoResult.getLocationCode().split("/");
            logger.info("当前工位:"+locationCodes.toString());
            boolean isLocationCode = false;
            if(locationCodes.length>0)
            {
                for (int j=0;j<locationCodes.length;j++){
                    String location = locationCodes[j];
                    if(location.equals(LOCATION_CODE)){
                        isLocationCode = true;
                    }
                }
            }
            int remainingQuantity =  productionOrderBatchInfoResult.getResidueQuantity();//剩余数量
            if(remainingQuantity>0 && isLocationCode){
            if(remainingQuantity>0){
                //新增物料追溯
                MaterialTraceabilityParam materialTraceabilityParam = new MaterialTraceabilityParam();
                materialTraceabilityParam.setWorkOrderNo(S_ORDER_CODE);