From 9906e6b188bf2c36dddc0d5adadbf02e69ea3e4b Mon Sep 17 00:00:00 2001
From: wujian <14790700720@163.com>
Date: 星期五, 25 十月 2024 09:17:29 +0800
Subject: [PATCH] add -sap

---
 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java |  100 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 85 insertions(+), 15 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
index 73087f6..3b3b98f 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -88,7 +88,7 @@
     public void onSubscribe(String identifier, Object value) {
         String ecpStr = "";//寮傚父璁板綍鏍囪
         try {
-            if(null != value && "1".equals(value.toString())) {
+                 if(null != value && "1".equals(value.toString())) {
                 //1銆佹绱N鍙�
                 //2銆佽繃绔欏弬鏁伴噰闆�
                 //3銆佹壂鐮佹灙鏁版嵁鍥炰紶
@@ -169,27 +169,54 @@
                             Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP020.Code").getValue();
                             if (ObjectUtil.isNotEmpty(SNCodeObject)){
                                 String snCode = SNCodeObject.toString();
-                                if (snCode.startsWith("380")){
-                                    String[] split = snCode.split(StrUtil.SPACE);
-                                    if (split.length>1){
-                                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]);
+                                DaPassingStationCollection passingStationCollectionCheck = new DaPassingStationCollection();
+                                passingStationCollectionCheck.setLocationCode("OP020");
+                                passingStationCollectionCheck.setSfcCode(snCode);
+                                List<DaPassingStationCollection> checkList = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(passingStationCollectionCheck);
+                                if (CollUtil.isNotEmpty(checkList)){
+                                    if (snCode.startsWith("380")){
+                                        log.info("enter-380");
+                                        String[] split = snCode.split(StrUtil.SPACE);
+                                        if (split.length>1){
+                                            ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]);
+                                            OPCUaSubscription.miloService.writeToOpcUa(entity);//鍐欏畬鎴�
+                                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", "鈽�"+split[1]+"鈽�");
+                                            OPCUaSubscription.miloService.writeToOpcUa(entity2);//鍐欏畬鎴�
+                                            ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 2);
+                                            OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
+                                        }
+                                    } else {
+                                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode);
                                         OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
-                                        ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", split[1]);
-                                        OPCUaSubscription.miloService.writeToOpcByte(entity2);//鍐欏畬鎴�
-                                        ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
+                                        ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 2);
                                         OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
                                     }
                                 } else {
-                                    ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode);
-                                    OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
-                                    ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
-                                    OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
+                                    if (snCode.startsWith("380")){
+                                        log.info("enter-380");
+                                        String[] split = snCode.split(StrUtil.SPACE);
+                                        if (split.length>1){
+                                            ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]);
+                                            OPCUaSubscription.miloService.writeToOpcUa(entity);//鍐欏畬鎴�
+                                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", "鈽�"+split[1]+"鈽�");
+                                            OPCUaSubscription.miloService.writeToOpcUa(entity2);//鍐欏畬鎴�
+                                            ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
+                                            OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
+                                        }
+                                    } else {
+                                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode);
+                                        OPCUaSubscription.miloService.writeToOpcByte(entity);//鍐欏畬鎴�
+                                        ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
+                                        OPCUaSubscription.miloService.writeToOpcByte(entity3);//鍐欏畬鎴�
+                                    }
                                 }
+
                             }
                         } else if (OPCElement.OP030_SAVE_REQUEST.equals(identifier)) {
+                            cleanForm("CFL4HX.OP030.SaveFeed");
                             ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP030.SaveFeed", 1);
                             OPCUaSubscription.miloService.writeToOpcByte(entity2);//鍐欏畬鎴�
-                            cleanForm("CFL4HX.OP030.SaveFeed");
+
                         } else if (OPCElement.OP040_SAVE_REQUEST.equals(identifier)) {
                             cleanForm040(OPCElement.OP040_SAVE_REQUEST);
                             ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP040.SaveFeed", 1);
@@ -236,6 +263,27 @@
                 List<BsOrderScheduling> queryOrderList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderSchedulingQuery);
                 if (CollUtil.isNotEmpty(queryOrderList)){
                     a = "1";
+                    //濡傛灉鏄�佽溅鍨嬶紝鍒ゆ柇鏄惁閲嶅鎵爜
+                    if (OPCElement.OP050_CODE_CHECK.equals(Node)){
+                        String type = productNewFlag(SNCode);
+                        if (!"280".equals(type) && !"380".equals(type)){
+                            DaPassingStationCollection passCheck = new DaPassingStationCollection();
+                            passCheck.setSfcCode(SNCode);
+                            passCheck.setLocationCode("OP060");
+                            List<DaPassingStationCollection> passCheckList = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(passCheck);
+                            if (CollUtil.isNotEmpty(passCheckList)){
+                                //鏄惁杩斾慨
+                                a = "5";
+//                                RmRepairRecord repairRecordCheck = new RmRepairRecord();
+//                                repairRecordCheck.setBoxCode(SNCode);
+//                                repairRecordCheck.setProcessesCode("OP050");
+//                                List<RmRepairRecord> repairCheckList = rmRepairRecordService.selectRmRepairRecordList(repairRecordCheck);
+//                                if (CollUtil.isEmpty(repairCheckList)){
+//
+//                                }
+                            }
+                        }
+                    }
                 }else {
                     a = "4";
                 }
@@ -268,6 +316,23 @@
                 }
                 logger.info("-----杩斿洖codeCheckFeed-----,{}",a);
 //                String a="1";
+                //zz涓婄嚎宸ヤ綅鏌ヨhx绾挎槸鍚﹁繃绔欏悎鏍�
+                if (OPCElement.OP120_ZZ_CODE_CHECK.equals(Node)){
+                    //杩囩珯璁板綍
+                    DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
+                    PassingStationCollection.setSfcCode(SNCode);
+                    PassingStationCollection.setLocationCode("OP160");
+                    List<DaPassingStationCollection> ZZOP120PassCheck = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection);
+                    if (CollUtil.isEmpty(ZZOP120PassCheck)){
+                        a = "";
+                    } else {
+                        DaPassingStationCollection passingStationCollection = ZZOP120PassCheck.get(0);
+                        String outRsSign = passingStationCollection.getOutRsSign();
+                        if (!OPCElement.QUALIFIED.equals(outRsSign)){
+                            a = "";
+                        }
+                    }
+                }
                 // 1:OK鍙敓浜� 2:NG涓嶅彲鐢熶骇 3:NG鍙繑宸� 4:PC妫�绱㈠け璐ワ紙鏃犺褰曪級5:PC妫�绱㈠け璐ワ紙杞欢锛�
                 if (StrUtil.isNotBlank(a)){
                     int input = Integer.parseInt(a);
@@ -417,7 +482,7 @@
                     Integer finalMaxCodeNum = maxCodeNum;
                     //鍕鹃�夌殑杩斾慨宸ヤ綅涓渶澶х殑宸ヤ綅涔嬪悗鐨勫伐浣�----1
                     List<BsTechnologyRouteChildInfo> collect3 = bsTechnologyRouteChildInfos.stream()
-                            .filter(x -> x.getStepNoNum() >= finalMaxCodeNum).collect(Collectors.toList());
+                            .filter(x -> x.getStepNoNum() > finalMaxCodeNum).collect(Collectors.toList());
                     if (CollUtil.isNotEmpty(collect3)){
                         //闇�瑕佺敓浜�
                         productStation.addAll(collect3.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList()));
@@ -573,7 +638,7 @@
                                 ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString());
                             }
                             ParamCollection.setSfcCode(SNCode);
-                            ParamCollection.setParamName(list.get(i).getCollectParameterName());
+                            ParamCollection.setParamName(list.get(i).getParameterSetName());
                             ParamCollection.setParamUpper(list.get(i).getParamUpper());
                             ParamCollection.setParamLower(list.get(i).getParamLower());
                             ParamCollection.setUnit(list.get(i).getCollectParameterUnit());
@@ -606,6 +671,7 @@
             }
             DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
             PassingStationCollection.setSfcCode(SNCode);
+            PassingStationCollection.setProductCode(bsOrderScheduling.getModel());
             PassingStationCollection.setLocationCode(parts[1]);
             PassingStationCollection.setOutboundTime(new Date());
             PassingStationCollection.setInboundTime(new Date(new Date().getTime()-beatTime*1000));
@@ -664,6 +730,8 @@
                     ProductNewPassStation productNewPassStation = productPassStationList.get(0);
                     String boxCode = productNewPassStation.getBoxCode();
                     String productType = productNewPassStation.getProductType();
+                    log.info("鍙戦�佸埌OP040鐨勯〉闈㈡暟鎹畃roductType,{}",productType);
+                    log.info("鍙戦�佸埌OP040鐨勯〉闈㈡暟鎹産oxCode,{}",boxCode);
                     passingStationCollectionServiceImpl.sendMessage(productType+"*"+boxCode, "OP040");
                 }
             } else if ("280".equals(productNewFlag)){
@@ -680,6 +748,7 @@
             String snCode = SNCodeObject.toString();
             String s = productNewFlag(snCode);
             if ("280".equals(s) || "380".equals(s)){
+                log.info("鍙戦�佸埌OP030鐨勬竻闄�");
                 passingStationCollectionServiceImpl.sendMessage("clean","OP030");
             }
         }
@@ -693,6 +762,7 @@
             String snCode = SNCodeObject.toString();
             String s = productNewFlag(snCode);
             if ("280".equals(s) || "380".equals(s)){
+                log.info("鍙戦�佸埌OP040鐨勯〉闈㈡竻闄�");
                 passingStationCollectionServiceImpl.sendMessage("clean*clean","OP040");
             }
         }

--
Gitblit v1.9.3