From e0fac38b26845f25de479783e0c76cf12a5311e0 Mon Sep 17 00:00:00 2001
From: cl <418351270@qq.com>
Date: 星期五, 19 一月 2024 10:31:28 +0800
Subject: [PATCH] 修改数据采集

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCComm.java |   79 ++++++++++++++++++++++++++++++---------
 1 files changed, 60 insertions(+), 19 deletions(-)

diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCComm.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCComm.java
index b49549b..e5f6862 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCComm.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCComm.java
@@ -8,7 +8,10 @@
 import cn.stylefeng.guns.modular.dq.materialTraceability.service.MaterialTraceabilityService;
 import cn.stylefeng.guns.modular.em.equipmentAlarm.service.EquipmentAlarmService;
 import cn.stylefeng.guns.modular.em.equipmentStatus.service.EquipmentStatusService;
+import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
 import cn.stylefeng.guns.modular.om.productionOrdeInfo.service.ProductionOrdeInfoService;
+import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.service.ProductionOrderBatchInfoService;
+import cn.stylefeng.guns.modular.om.productionOrderRecords.service.ProductionOrderRecordsService;
 import cn.stylefeng.guns.modular.sc.repairManageInfo.service.RepairManageInfoService;
 import cn.stylefeng.guns.modular.sc.serialNumbersConf.service.SerialNumbersConfService;
 import cn.stylefeng.guns.plcserver.server.BOP010.callback.*;
@@ -103,6 +106,14 @@
 
     @Autowired
     public LocationInfoService locationInfoService;
+    @Autowired
+    public GreaseManageService greaseManageService;
+
+    @Autowired
+    public ProductionOrderRecordsService productionOrderRecordsService;
+
+    @Autowired
+    public ProductionOrderBatchInfoService productionOrderBatchInfoService;
 
     //OP010
     private Item OP010_F_HEART_BEAT;//蹇冭烦
@@ -181,7 +192,7 @@
 
     private Item OP050_S_PRODUCT_STATE_CODE;//浜у搧鐘舵�佺紪鐮�
 
-
+    private Item OP050_OIL_STATE;//娌硅剛鐘舵��
     //OP070
     private Item OP070_F_HEART_BEAT;//蹇冭烦
     private Item OP070_J_PLC_START;//PLC寮�濮�
@@ -461,6 +472,7 @@
 
     private Item BOP030_S_PRODUCT_STATE_CODE;//浜у搧鐘舵�佺紪鐮�
 
+    private Item BOP030_OIL_STATE;//娌硅剛鐘舵��
     //BOP030B
     private Item BOP030B_F_HEART_BEAT;//蹇冭烦
     private Item BOP030B_J_PLC_START;//PLC寮�濮�
@@ -698,6 +710,7 @@
 
     private Item DOP020_S_PRODUCT_STATE_CODE;//浜у搧鐘舵�佺紪鐮�
 
+    private Item DOP020_OIL_STATE;//娌硅剛鐘舵��
 
     /**
      * 鍗曚緥妯″紡
@@ -721,7 +734,10 @@
                      MaterialTraceabilityService materialTraceabilityService,
                      EquipmentInfoService equipmentInfoService,
                      RepairManageInfoService repairManageInfoService,
-                     LocationInfoService locationInfoService
+                     LocationInfoService locationInfoService,
+                     GreaseManageService greaseManageService,
+                     ProductionOrderRecordsService productionOrderRecordsService,
+                     ProductionOrderBatchInfoService productionOrderBatchInfoService
                     ) throws Exception {
         this.productionOrdeInfoService = productionOrdeInfoService;
         this.passingStationCollectionService = passingStationCollectionService;
@@ -734,6 +750,9 @@
         this.equipmentInfoService = equipmentInfoService;
         this.repairManageInfoService = repairManageInfoService;
         this.locationInfoService = locationInfoService;
+        this.greaseManageService = greaseManageService;
+        this.productionOrderRecordsService = productionOrderRecordsService;
+        this.productionOrderBatchInfoService = productionOrderBatchInfoService;
 
         // 鍔犺浇閰嶇疆鏂囦欢
         final ConnectionInformation ci = getCLSIDConnectionInfomation();
@@ -746,13 +765,11 @@
             logger.info("This is {} message.", "OPCserver connect success");
             this.server = server;
             // 鍚屾璇诲彇锛�500ms涓�娆�
-            final AccessBase access = new SyncAccess(server, 1000);
-
-            //final AccessBase access = new Async20Access(server, 1000,false);
+            final AccessBase access = new SyncAccess(server, 500);
 
             //OP010鍥炶皟
             access.addItem(OPCElement.OP010_F_HEART_BEAT, new DataCallBack_OP010_F_HEART_BEAT());//蹇冭烦
-           /* access.addItem(OPCElement.OP010_E_STATE, new DataCallBack_OP010_E_STATE());//璁惧鐘舵��*/
+            /* access.addItem(OPCElement.OP010_E_STATE, new DataCallBack_OP010_E_STATE());//璁惧鐘舵��*/
 
             //OP020鍥炶皟
             access.addItem(OPCElement.OP020_F_HEART_BEAT, new DataCallBack_OP020_F_HEART_BEAT());//蹇冭烦
@@ -784,13 +801,11 @@
             access.addItem(OPCElement.OP110_F_HEART_BEAT, new DataCallBack_OP110_F_HEART_BEAT());//蹇冭烦
 
 
-/*
             //OP120鍥炶皟
             access.addItem(OPCElement.OP120_F_HEART_BEAT, new DataCallBack_OP120_F_HEART_BEAT());//蹇冭烦
 
             //OP120B鍥炶皟
             access.addItem(OPCElement.OP120B_F_HEART_BEAT, new DataCallBack_OP120B_F_HEART_BEAT());//蹇冭烦
-      */
 
 
             //OP130鍥炶皟
@@ -802,9 +817,11 @@
             //OP140鍥炶皟
             access.addItem(OPCElement.OP140_F_HEART_BEAT, new DataCallBack_OP140_F_HEART_BEAT());//蹇冭烦
 
-         /*   //OP150鍥炶皟
+            //OP150鍥炶皟
+/*
             access.addItem(OPCElement.OP150_F_HEART_BEAT, new DataCallBack_OP150_F_HEART_BEAT());//蹇冭烦
-  */
+*/
+
             //OP160鍥炶皟
             access.addItem(OPCElement.OP160_F_HEART_BEAT, new DataCallBack_OP160_F_HEART_BEAT());//蹇冭烦
 
@@ -843,7 +860,7 @@
             access.addItem(OPCElement.DOP010_F_HEART_BEAT, new DataCallBack_DOP010_F_HEART_BEAT());//蹇冭烦
 
             //DOP020鍥炶皟
-            access.addItem(OPCElement.DOP020_F_HEART_BEAT, new DataCallBack_DOP020_F_HEART_BEAT());//蹇冭烦
+            /* access.addItem(OPCElement.DOP020_F_HEART_BEAT, new DataCallBack_DOP020_F_HEART_BEAT());//蹇冭烦*/
 
             //EOP010鍥炶皟
             access.addItem(OPCElement.EOP010_F_HEART_BEAT, new DataCallBack_EOP010_F_HEART_BEAT());//蹇冭烦
@@ -854,7 +871,7 @@
             //EOP030鍥炶皟
             access.addItem(OPCElement.EOP030_F_HEART_BEAT, new DataCallBack_EOP030_F_HEART_BEAT());//蹇冭烦
 
-             //EOP040鍥炶皟
+            //EOP040鍥炶皟
             access.addItem(OPCElement.EOP040_F_HEART_BEAT, new DataCallBack_EOP040_F_HEART_BEAT());//蹇冭烦
 
             //EOP050鍥炶皟
@@ -961,7 +978,7 @@
 
             OP050_S_PRODUCT_STATE_CODE = OP050_GROUP.addItem((OPCElement.OP050_S_PRODUCT_STATE_CODE));//浜у搧鐘舵�佺紪鐮�
 
-
+            OP050_OIL_STATE = OP050_GROUP.addItem((OPCElement.OP050_OIL_STATE));//娌硅剛鐘舵��
 
             //OP070缁�
             final Group OP070_GROUP = server.addGroup("OP070");
@@ -1038,7 +1055,7 @@
             OP110_S_PRODUCT_STATE_CODE = OP110_GROUP.addItem((OPCElement.OP110_S_PRODUCT_STATE_CODE));//浜у搧鐘舵�佺紪鐮�
 
             //OP120缁�
-         /*   final Group OP120_GROUP = server.addGroup("OP120");
+            final Group OP120_GROUP = server.addGroup("OP120");
             OP120_F_HEART_BEAT = OP120_GROUP.addItem((OPCElement.OP120_F_HEART_BEAT));//蹇冭烦
             OP120_J_PLC_START = OP120_GROUP.addItem((OPCElement.OP120_J_PLC_START));//PLC寮�濮�
             OP120_J_PC_WRITE_ORDER = OP120_GROUP.addItem((OPCElement.OP120_J_PC_WRITE_ORDER));//PC璇绘暟鎹畬鎴�
@@ -1063,7 +1080,7 @@
             OP120B_S_PRODUCT_CODE = OP120B_GROUP.addItem((OPCElement.OP120B_S_PRODUCT_CODE));//浜у搧缂栧彿
             OP120B_S_SFC_CODE = OP120B_GROUP.addItem((OPCElement.OP120B_S_SFC_CODE));//鎬绘垚缂栫爜
 
-            OP120B_S_PRODUCT_STATE_CODE = OP120B_GROUP.addItem((OPCElement.OP120B_S_PRODUCT_STATE_CODE));//浜у搧鐘舵�佺紪鐮�*/
+            OP120B_S_PRODUCT_STATE_CODE = OP120B_GROUP.addItem((OPCElement.OP120B_S_PRODUCT_STATE_CODE));//浜у搧鐘舵�佺紪鐮�
 
             //OP130缁�
             final Group OP130_GROUP = server.addGroup("OP130");
@@ -1109,7 +1126,7 @@
             OP140_S_PRODUCT_STATE_CODE = OP140_GROUP.addItem((OPCElement.OP140_S_PRODUCT_STATE_CODE));//浜у搧鐘舵�佺紪鐮�
 
             //OP150缁�
-        /*    final Group OP150_GROUP = server.addGroup("OP150");
+         /*   final Group OP150_GROUP = server.addGroup("OP150");
             OP150_F_HEART_BEAT = OP150_GROUP.addItem((OPCElement.OP150_F_HEART_BEAT));//蹇冭烦
             OP150_J_PLC_START = OP150_GROUP.addItem((OPCElement.OP150_J_PLC_START));//PLC寮�濮�
             OP150_J_PC_WRITE_ORDER = OP150_GROUP.addItem((OPCElement.OP150_J_PC_WRITE_ORDER));//PC涓嬪彂宸ュ崟
@@ -1120,8 +1137,8 @@
             OP150_S_PRODUCT_CODE = OP150_GROUP.addItem((OPCElement.OP150_S_PRODUCT_CODE));//浜у搧缂栧彿
             OP150_S_SFC_CODE = OP150_GROUP.addItem((OPCElement.OP150_S_SFC_CODE));//鎬绘垚缂栫爜
 
-            OP150_S_PRODUCT_STATE_CODE = OP150_GROUP.addItem((OPCElement.OP150_S_PRODUCT_STATE_CODE));//浜у搧鐘舵�佺紪鐮�
-*/
+            OP150_S_PRODUCT_STATE_CODE = OP150_GROUP.addItem((OPCElement.OP150_S_PRODUCT_STATE_CODE));//浜у搧鐘舵�佺紪鐮�*/
+
             //OP160缁�
             final Group OP160_GROUP = server.addGroup("OP160");
             OP160_F_HEART_BEAT = OP160_GROUP.addItem((OPCElement.OP160_F_HEART_BEAT));//蹇冭烦
@@ -1242,6 +1259,10 @@
             BOP030_S_SFC_CODE = BOP030_GROUP.addItem((OPCElement.BOP030_S_SFC_CODE));//鎬绘垚缂栫爜
 
             BOP030_S_PRODUCT_STATE_CODE = BOP030_GROUP.addItem((OPCElement.BOP030_S_PRODUCT_STATE_CODE));//浜у搧鐘舵�佺紪鐮�
+
+            BOP030_OIL_STATE = BOP030_GROUP.addItem((OPCElement.BOP030_OIL_STATE));//娌硅剛鐘舵��
+
+
 
             //BOP030B缁�
             final Group BOP030B_GROUP = server.addGroup("BOP030B");
@@ -1465,7 +1486,7 @@
             DOP010_P_REPAIR_LOCATION = DOP010_GROUP.addItem((OPCElement.DOP010_P_REPAIR_LOCATION));//杩斾慨宸ヤ綅
 
             //DOP020缁�
-            final Group DOP020_GROUP = server.addGroup("DOP020");
+            /*final Group DOP020_GROUP = server.addGroup("DOP020");
             DOP020_F_HEART_BEAT = DOP020_GROUP.addItem((OPCElement.DOP020_F_HEART_BEAT));//蹇冭烦
             DOP020_J_PLC_START = DOP020_GROUP.addItem((OPCElement.DOP020_J_PLC_START));//PLC寮�濮�
             DOP020_J_PC_WRITE_ORDER = DOP020_GROUP.addItem((OPCElement.DOP020_J_PC_WRITE_ORDER));//PC涓嬪彂宸ュ崟
@@ -1477,6 +1498,10 @@
             DOP020_S_SFC_CODE = DOP020_GROUP.addItem((OPCElement.DOP020_S_SFC_CODE));//鎬绘垚缂栫爜
 
             DOP020_S_PRODUCT_STATE_CODE = DOP020_GROUP.addItem((OPCElement.DOP020_S_PRODUCT_STATE_CODE));//浜у搧鐘舵�佺紪鐮�
+
+            DOP020_OIL_STATE = DOP020_GROUP.addItem((OPCElement.DOP020_OIL_STATE));//娌硅剛鐘舵��*/
+
+
             // start reading
             access.bind();
         } catch (final JIException e) {
@@ -3175,4 +3200,20 @@
     public Item getDOP010_P_REPAIR_LOCATION() {
         return DOP010_P_REPAIR_LOCATION;
     }
+
+    public GreaseManageService getGreaseManageService() {
+        return greaseManageService;
+    }
+
+    public Item getOP050_OIL_STATE() {
+        return OP050_OIL_STATE;
+    }
+
+    public Item getBOP030_OIL_STATE() {
+        return BOP030_OIL_STATE;
+    }
+
+    public Item getDOP020_OIL_STATE() {
+        return DOP020_OIL_STATE;
+    }
 }

--
Gitblit v1.9.3