cl
2024-01-23 ff13e6159eab48d53bb528a10d0ab8850fdf7ad5
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP050Callback.java
@@ -194,10 +194,18 @@
    }
    public void handleFinsh() throws Exception{
        logger.info("handleFinsh PC处理开始!");
        String S_PRODUCT_STATE_CODE = miloService.
        Object object = miloService.
                readFromOpcUa(OPCElement.OP050_S_PRODUCT_STATE_CODE)
                .getValue().toString();
                .getValue();
        String S_PRODUCT_STATE_CODE = "";
        if(null != object){
            S_PRODUCT_STATE_CODE = object.toString();
        }
        PassingStationCollectionParam param = new PassingStationCollectionParam();
        param.setWorkOrderNo(S_ORDER_CODE);
@@ -211,26 +219,27 @@
        passingStationCollectionService.add(param);
        String copSfcCode = miloService.
        Object copSfcCode = miloService.
                readFromOpcUa(OPCElement.OP050_S_SFC_CODE_COP)
                .getValue().toString();
        String bopSfcCode = miloService.
                .getValue();
        Object bopSfcCode = miloService.
                readFromOpcUa(OPCElement.OP050_S_SFC_CODE_BOP)
                .getValue().toString();
                .getValue();
        if(null != copSfcCode && null != bopSfcCode){
        //根据分总成编码,将EOP物料数据绑定关系修改为总成编码
        materialTraceabilityService.updateSFC(S_SFC_CODE,copSfcCode);
        materialTraceabilityService.updateSFC(S_SFC_CODE,bopSfcCode);
            materialTraceabilityService.updateSFC(S_SFC_CODE,copSfcCode.toString());
            materialTraceabilityService.updateSFC(S_SFC_CODE,bopSfcCode.toString());
        //根据分总成编码,将EOP过站数据绑定关系修改为总成编码
        passingStationCollectionService.updateSFC(S_SFC_CODE,copSfcCode);
        passingStationCollectionService.updateSFC(S_SFC_CODE,bopSfcCode);
            //根据分总成编码,将EOP过站数据绑定关系修改为总成编码
            passingStationCollectionService.updateSFC(S_SFC_CODE,copSfcCode.toString());
            passingStationCollectionService.updateSFC(S_SFC_CODE,bopSfcCode.toString());
        //根据分总成编码,将EOP采集数据绑定关系修改为总成编码
        paramCollectionService.updateSFC(S_SFC_CODE,copSfcCode);
        paramCollectionService.updateSFC(S_SFC_CODE,bopSfcCode);
            //根据分总成编码,将EOP采集数据绑定关系修改为总成编码
            paramCollectionService.updateSFC(S_SFC_CODE,copSfcCode.toString());
            paramCollectionService.updateSFC(S_SFC_CODE,bopSfcCode.toString());
        }
        logger.info("S_SFC_CODE:"+S_SFC_CODE);
        logger.info("copSfcCode:"+copSfcCode);
        logger.info("bopSfcCode:"+bopSfcCode);
@@ -244,13 +253,13 @@
        String isProductState = "true";
        for(int i=0;i<passingStationCollectionResultList.size();i++){
            PassingStationCollectionResult passingStationCollectionResult = passingStationCollectionResultList.get(i);
            if("false".equals(passingStationCollectionResult.getOutRsSign())){
            if("2".equals(passingStationCollectionResult.getOutRsSign())){
                isProductState = "false";
                break;
            }
        }
        //修改报工记录
        if("false".equals(S_PRODUCT_STATE_CODE) || "false".equals(isProductState)){
        if("2".equals(S_PRODUCT_STATE_CODE) || "false".equals(isProductState)){
            ProductionOrderRecordsParam productionOrderRecordsParam = new ProductionOrderRecordsParam();
            productionOrderRecordsParam.setWorkOrderNo(S_ORDER_CODE);
            productionOrderRecordsParam.setProductNo(S_SFC_CODE);
@@ -258,7 +267,7 @@
            if(list.size()>0){
                ProductionOrderRecordsResult productionOrderRecordsResult = list.get(0);
                productionOrderRecordsParam.setId(productionOrderRecordsResult.getId());
                productionOrderRecordsParam.setWhetherPass("false");
                productionOrderRecordsParam.setWhetherPass("2");
                productionOrderRecordsService.update(productionOrderRecordsParam);
            }
        }
@@ -311,24 +320,26 @@
        if(null != list && !list.isEmpty()) {
            for (int i = 0; i < list.size(); i++) {
                CollectionParamConfResult result = (CollectionParamConfResult) list.get(i);
                String value = miloService.
                Object value = miloService.
                        readFromOpcUa(result.getGatherAddress())
                        .getValue().toString();//读参数值
                ParamCollectionParam paramCollectionParam = new ParamCollectionParam();
                paramCollectionParam.setParamCode(result.getParamCode());
                paramCollectionParam.setParamName(result.getParamName());
                paramCollectionParam.setWorkOrderNo(S_ORDER_CODE);
                paramCollectionParam.setSfcCode(S_SFC_CODE);
                paramCollectionParam.setProductCode(S_PRODUCT_CODE);
                paramCollectionParam.setProductionLine(result.getProductionLine());
                paramCollectionParam.setLocationCode(result.getLocationCode());
                paramCollectionParam.setParamValue(value);
                paramCollectionParam.setParamLower(result.getParamLower());
                paramCollectionParam.setParamUpper(result.getParamUpper());
                paramCollectionParam.setParamStandard(result.getParamCentral());
                paramCollectionParam.setCollectionTime(DateTool.getLocalTimeForDate());
                paramCollectionParam.setUnit(result.getUnit());
                paramCollectionService.add(paramCollectionParam);
                        .getValue();//读参数值
                if(null != value) {
                    ParamCollectionParam paramCollectionParam = new ParamCollectionParam();
                    paramCollectionParam.setParamCode(result.getParamCode());
                    paramCollectionParam.setParamName(result.getParamName());
                    paramCollectionParam.setWorkOrderNo(S_ORDER_CODE);
                    paramCollectionParam.setSfcCode(S_SFC_CODE);
                    paramCollectionParam.setProductCode(S_PRODUCT_CODE);
                    paramCollectionParam.setProductionLine(result.getProductionLine());
                    paramCollectionParam.setLocationCode(result.getLocationCode());
                    paramCollectionParam.setParamValue(value.toString());
                    paramCollectionParam.setParamLower(result.getParamLower());
                    paramCollectionParam.setParamUpper(result.getParamUpper());
                    paramCollectionParam.setParamStandard(result.getParamCentral());
                    paramCollectionParam.setCollectionTime(DateTool.getLocalTimeForDate());
                    paramCollectionParam.setUnit(result.getUnit());
                    paramCollectionService.add(paramCollectionParam);
                }
            }
        }