From 1f60fac09ac094d67e04c5c781436608d6cd6e64 Mon Sep 17 00:00:00 2001 From: cl <418351270@qq.com> Date: 星期一, 21 十月 2024 15:19:50 +0800 Subject: [PATCH] 修改数据采集 --- guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/CustomRunner.java | 4 ++-- guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP010Callback.java | 18 +++++++++++++++++- guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/SubscriptionManage.java | 5 ++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP010Callback.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP010Callback.java index 7f0937c..d8c0d47 100644 --- a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP010Callback.java +++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP010Callback.java @@ -218,7 +218,23 @@ } public void handleFinsh() throws Exception { + + logger.info("handleFinsh PC澶勭悊寮�濮嬶紒"); + String snCode = miloService. + readFromOpcUa(OPCElement.OP010_S_SFC_CODE) + .getValue().toString(); + + if(!snCode.equals(S_SFC_CODE)){ + ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP010_S_SFC_CODE,S_SFC_CODE); + miloService.writeToOpcUa(entity);//鍐橮C瀹屾垚 + + ReadWriteEntity entity1 = new ReadWriteEntity(OPCElement.OP010_PLC_REQUST,3); + miloService.writeToOpcShort(entity1);//鍐橮C瀹屾垚 + return; + } + + String S_PRODUCT_STATE_CODE = miloService. readFromOpcUa(OPCElement.OP010_S_PRODUCT_STATE_CODE) .getValue().toString(); @@ -249,7 +265,7 @@ param.setOutRsSign(S_PRODUCT_STATE_CODE);//鍑虹珯鏄惁鍚堟牸 passingStationCollectionService.add(param); - + handleMaterial(); logger.info("handleFinsh PC澶勭悊瀹屾垚锛�"); } diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/CustomRunner.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/CustomRunner.java index 670608d..2b2231e 100644 --- a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/CustomRunner.java +++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/CustomRunner.java @@ -93,14 +93,14 @@ productionOrderBatchInfoService); - Calendar calendar = Calendar.getInstance(); + /*Calendar calendar = Calendar.getInstance(); String Months = StringUtils.leftPad(String.valueOf(calendar.get(Calendar.MONTH) + 1),2, "0"); if(Months.equals("04") ||Months.equals("07") ||Months.equals("08") || Months.equals("09") || Months.equals("10") || Months.equals("11") || Months.equals("12") || Months.equals("01") || Months.equals("02") || Months.equals("03") ){ GlobalVariable.IS_CLOCK = false; - } + }*/ /* ExecutorService cachedThreadPool = Executors.newCachedThreadPool(); cachedThreadPool.execute(new HeartBeatTaskThreadPool());*/ diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/SubscriptionManage.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/SubscriptionManage.java index 13ebf19..a7ac203 100644 --- a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/SubscriptionManage.java +++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/init/SubscriptionManage.java @@ -361,13 +361,13 @@ try { if(null != value) { - if(!GlobalVariable.IS_CLOCK){ + /* if(!GlobalVariable.IS_CLOCK){ System.out.println("----------------------绯荤粺宸茬粡杩囨湡锛岃鑱旂郴绠$悊鍛樿繘琛屽崌绾�----------------------"); System.out.println("----------------------绯荤粺宸茬粡杩囨湡锛岃鑱旂郴绠$悊鍛樿繘琛屽崌绾�----------------------"); System.out.println("----------------------绯荤粺宸茬粡杩囨湡锛岃鑱旂郴绠$悊鍛樿繘琛屽崌绾�----------------------"); System.out.println("----------------------绯荤粺宸茬粡杩囨湡锛岃鑱旂郴绠$悊鍛樿繘琛屽崌绾�----------------------"); return; - } + }*/ //OP010 //蹇冭烦 if (identifier.equals(OPCElement.OP010_F_HEART_BEAT) && "false".equals(value.toString())) { @@ -385,7 +385,6 @@ } if("2".equals(value.toString())){ OP010Callback.handleFinsh(); - OP010Callback.handleMaterial(); } } -- Gitblit v1.9.3