From 73bc0656dc15cd9cc95c6f4f51949ef0437088ce Mon Sep 17 00:00:00 2001 From: cl <418351270@qq.com> Date: 星期五, 23 二月 2024 09:28:13 +0800 Subject: [PATCH] 修改数据采集 --- guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP120Callback.java | 49 +++++++------------------------------------------ 1 files changed, 7 insertions(+), 42 deletions(-) diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP120Callback.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP120Callback.java index a88cab9..4bc1701 100644 --- a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP120Callback.java +++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/callback/OP120Callback.java @@ -41,7 +41,7 @@ import java.util.List; @Component -public class OP120Callback implements SubscriptionCallback { +public class OP120Callback{ public MiloService miloService; @@ -125,43 +125,6 @@ this.productionOrderBatchInfoService = productionOrderBatchInfoService; } - @Override - public void onSubscribe(String identifier, Object value) { - String ecpStr = "";//寮傚父璁板綍鏍囪 - try { - //蹇冭烦 - if(null != value && identifier.equals(OPCElement.OP120_F_HEART_BEAT)){ - if( "false".equals(value.toString())) - { - ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP120_F_HEART_BEAT,true); - miloService.writeToOpcUa(entity); - } - } - //PLC杩涚珯 - else if(null != value && identifier.equals(OPCElement.OP120_J_PLC_START)){ - if("true".equals(value.toString())){ - handleOrder(); - } - } - //PLC鍑虹珯 - else if(null != value && identifier.equals(OPCElement.OP120_J_PLC_FINISH)){ - if("true".equals(value.toString())){ - handleFinsh(); - handleInfo(); - handleMaterial(); - } - }else{ - System.out.println("鍊兼病鏈夊彉"); - } - } catch (Exception e) { - ecpStr ="鍑虹幇寮傚父锛�" + logUtil.getTrace(e); - }finally { - if(!"".equals(ecpStr)){ - logger.info(ecpStr+"\r\n"); - } - } - } - //PC璇诲伐鍗� public void handleOrder() throws Exception { logger.info("handleOrder PC澶勭悊寮�濮嬶紒"); @@ -198,7 +161,11 @@ readFromOpcUa(OPCElement.OP120_S_PRODUCT_STATE_CODE) .getValue().toString(); - if("2".equals(S_PRODUCT_STATE_CODE)){ + + ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP120_J_PC_FINISH,true); + miloService.writeToOpcUa(entity);//鍐橮C瀹屾垚 + + /* if("2".equals(S_PRODUCT_STATE_CODE)){ ProductionOrderRecordsParam productionOrderRecordsParam = new ProductionOrderRecordsParam(); productionOrderRecordsParam.setWorkOrderNo(S_ORDER_CODE); productionOrderRecordsParam.setProductNo(S_SFC_CODE); @@ -209,7 +176,7 @@ productionOrderRecordsParam.setWhetherPass(S_PRODUCT_STATE_CODE); productionOrderRecordsService.update(productionOrderRecordsParam); } - } + }*/ //澶勭悊杩囩珯淇℃伅 PassingStationCollectionParam param = new PassingStationCollectionParam(); param.setWorkOrderNo(S_ORDER_CODE); @@ -222,8 +189,6 @@ param.setOutRsSign(S_PRODUCT_STATE_CODE);//鍑虹珯鏄惁鍚堟牸 passingStationCollectionService.add(param); - ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP120_J_PC_FINISH,true); - miloService.writeToOpcUa(entity);//鍐橮C瀹屾垚 logger.info("handleFinsh PC澶勭悊瀹屾垚锛�"); } -- Gitblit v1.9.3