From 425e9e1f5413fdd46368e5486d582a25473f7476 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期四, 12 十二月 2024 14:14:36 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject

---
 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java |   46 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
index 487d00e..a22ff3c 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
@@ -3,6 +3,8 @@
 import cn.hutool.json.JSONObject;
 import cn.smallbun.screw.core.util.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.kangaroohy.milo.model.ReadWriteEntity;
+import com.kangaroohy.milo.service.MiloService;
 import com.mes.bigstorage.entity.BigStorageCageDetails;
 import com.mes.bigstorage.service.BigStorageCageDetailsService;
 import com.mes.bigstorage.service.BigStorageCageService;
@@ -48,6 +50,9 @@
     @Resource
     private BigStorageCageTaskService bigStorageCageTaskService;
 
+    @Autowired(required = false)
+    MiloService miloService;
+
     @Value("${mes.scan.ip}")
     private String scanIp;
 
@@ -56,28 +61,38 @@
 
     private JSONObject jsonObject = new JSONObject();
 
-    public void queryDataSource1() throws InterruptedException {
+    public void queryDataSource1() throws Exception {
         List<Double> carPostion = new ArrayList<>();
         carPostion.add(0.25);
         carPostion.add(0.5);
         jsonObject.append("carPostion", carPostion);
         //鐣岄潰灞曠ず绗煎瓙淇℃伅
-//        jsonObject.append("bigStorageCageInfos", bigStorageCageService.querybigStorageCageDetail());
+        jsonObject.append("bigStorageCageInfos", bigStorageCageService.querybigStorageCageDetail());
 
         //杩涚墖浠诲姟鏁版嵁
-        List<BigStorageCageTask> inTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_in_one_task");
+        List<BigStorageCageTask> inTaskList = new ArrayList();
+        ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP1A.DLP1A.FROM1");
+        for (int i = 1; i <= 6; i++) {
+            ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP1A.DLP1A.DI" + i);
+            ReadWriteEntity targetSlotWord = miloService.readFromOpcUa("DLP1A.DLP1A.TO" + i);
+            ReadWriteEntity stateWord = miloService.readFromOpcUa("DLP1A.DLP1A.STATE" + i);
+            if (null != requestWord.getValue()) {
+                BigStorageCageTask task = new BigStorageCageTask();
+                task.setGlassId(requestWord.getValue() + "");
+                task.setStartSlot(Integer.parseInt(fromOpcUa.getValue() + ""));
+                task.setTargetSlot(Integer.parseInt(targetSlotWord.getValue() + ""));
+                task.setTaskState(Integer.parseInt(stateWord.getValue() + ""));
+                inTaskList.add(task);
+                continue;
+            }
+        }
         jsonObject.append("bigStorageCageDetailsFeedTask", inTaskList);
-
         //鍑虹墖浠诲姟鏁版嵁
         List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task");
         jsonObject.append("bigStorageCageDetailsOutTask", outTaskList);
 
-        //鐞嗙墖绗间娇鐢ㄦ儏鍐�
-        List<Map<String, Object>> bigStorageCageUsage = bigStorageCageService.selectBigStorageCageUsage();
-//        jsonObject.append("bigStorageCageUsage", bigStorageCageUsage);
-
         //鐞嗙墖绗艰〃鏍间俊鎭�
-//        jsonObject.append("bigStorageCageInfo", bigStorageCageService.querybigStorageCageDetailAll());
+        jsonObject.append("bigStorageCageInfo", bigStorageCageService.querybigStorageCageDetailAll());
 
         //閽㈠寲寮�鍏�
         boolean temperingSwitch = false;
@@ -87,6 +102,7 @@
             temperingSwitch = redisUtil.getCacheObject("temperingSwitch");
         }
         jsonObject.append("temperingSwitch", temperingSwitch);
+
         //璋冨害寮�鍏�
         boolean dispatchSwitch = false;
         if (redisUtil.getCacheObject("dispatchSwitch") == null) {
@@ -95,6 +111,14 @@
             dispatchSwitch = redisUtil.getCacheObject("dispatchSwitch");
         }
         jsonObject.append("dispatchSwitch", dispatchSwitch);
+
+        //鐞嗙墖绗间娇鐢ㄦ儏鍐�
+        List<Map<String, Object>> bigStorageCageUsage = bigStorageCageService.selectBigStorageCageUsage();
+        jsonObject.append("bigStorageCageUsage", bigStorageCageUsage);
+
+        //鐞嗙墖绗艰〃鏍间俊鎭�
+        jsonObject.append("bigStorageCageInfo", bigStorageCageService.querybigStorageCageDetailAll());
+
         //鎵撳嵃寮�鍏�
         boolean autoPrint = false;
         if (redisUtil.getCacheObject("autoPrint") == null) {
@@ -130,7 +154,7 @@
      * fixedRate : 涓婁竴涓皟鐢ㄥ紑濮嬪悗鍐嶆璋冪敤鐨勫欢鏃讹紙涓嶇敤绛夊緟涓婁竴娆¤皟鐢ㄥ畬鎴愶級
      * fixedDelay : 涓婁竴涓皟鐢ㄧ粨鏉熷悗鍐嶆璋冪敤鐨勫欢鏃�
      */
-    @Scheduled(fixedDelay = 1000)
+    @Scheduled(fixedDelay = 3000)
     public void plcStorageCageTask() throws InterruptedException {
         jsonObject = new JSONObject();
         try {
@@ -159,7 +183,7 @@
         }
     }
 
-    //        @Scheduled(fixedDelay = 1000)
+//    @Scheduled(fixedDelay = 1000)
     public void temperingIsRun() {
         JSONObject jsonObject = new JSONObject();
         //杩涚墖浠诲姟鏁版嵁

--
Gitblit v1.8.0