From a44f20b702bd4b9df09e7f8f01d5e47c9c3fe17e Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期二, 29 七月 2025 15:50:26 +0800
Subject: [PATCH] *

---
 src/main/java/com/zy/asrs/controller/MonitorController.java |   96 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 87 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MonitorController.java b/src/main/java/com/zy/asrs/controller/MonitorController.java
index 0a845fc..31e49a4 100644
--- a/src/main/java/com/zy/asrs/controller/MonitorController.java
+++ b/src/main/java/com/zy/asrs/controller/MonitorController.java
@@ -1,12 +1,17 @@
 package com.zy.asrs.controller;
 
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.common.Arith;
 import com.core.common.Cools;
 import com.core.common.R;
 import com.zy.asrs.domain.dto.AxisBean;
 import com.zy.asrs.domain.dto.WorkChartAxis;
 import com.zy.asrs.domain.vo.LocChartPie;
+import com.zy.asrs.entity.WaitPakin;
 import com.zy.asrs.mapper.ReportQueryMapper;
+import com.zy.asrs.mapper.WaitPakinMapper;
+import com.zy.asrs.service.ApiLogService;
 import com.zy.asrs.service.WrkDetlService;
 import com.zy.common.model.MatDto;
 import com.zy.common.service.CommonService;
@@ -17,9 +22,11 @@
 import com.zy.core.model.LedSlave;
 import com.zy.core.model.command.LedCommand;
 import com.zy.core.model.protocol.CrnProtocol;
+import com.zy.core.model.protocol.StaProtocol;
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.BarcodeThread;
 import com.zy.core.thread.LedThread;
+import com.zy.core.thread.SiemensDevpThread;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -41,18 +48,48 @@
     private SlaveProperties slaveProperties;
     @Autowired
     private WrkDetlService wrkDetlService;
+    @Autowired
+    private WaitPakinMapper waitPakinMapper;
+    @Autowired
+    private ApiLogService apiLogService;
 
     /**
      * 鑾峰彇褰撳墠鏃堕棿
      */
     @PostMapping("/barcode/two")
     public R barcodeTwo(@RequestParam Integer palletizingNo) {
+        Date now = new Date();
 
         String barcode = "";
         for (DevpSlave devp : slaveProperties.getDevp()) {
             // 閬嶅巻鍏ュ簱鍙�
             for (DevpSlave.Sta inSta : devp.getDriveSta()) {
                 if (inSta.getStaNo().equals(palletizingNo)){
+                    SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+                    StaProtocol staProtocolPall = devpThread.getStation().get(palletizingNo);
+                    if (staProtocolPall == null) {
+                        continue;
+                    } else {
+                        staProtocolPall = staProtocolPall.clone();
+                    }
+
+                    if (!staProtocolPall.isAutoing() || !staProtocolPall.isLoading() || staProtocolPall.getWorkNo() != 0 || !staProtocolPall.isPakMk()){
+                        try{
+                            // 淇濆瓨鎺ュ彛鏃ュ織
+                            apiLogService.save(
+                                    "涓帶鐢宠鑾峰彇"+palletizingNo+"绔欑偣褰撳墠鏉$爜淇℃伅",
+                                    "/monitor/barcode/two",
+                                    null,
+                                    null,
+                                    JSON.toJSONString(palletizingNo),
+                                    "鏈氨缁紒锛侊紒",
+                                    false
+                            );
+                        }catch (Exception e){
+                        }
+                        return R.error("鏈氨缁紒锛侊紒");
+                    }
+
                     // 鑾峰彇鏉$爜鎵弿浠俊鎭�
                     BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
                     if (barcodeThread == null) {
@@ -62,7 +99,7 @@
 
                     if (!Cools.isEmpty(barcode)) {
 //                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
+                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode) || "000000".equals(barcode)) {
                             barcode = "";
                         }
                     } else {
@@ -71,15 +108,55 @@
                 }
             }
         }
-
-
-
-        Date now = new Date();
 //        Calendar calendar = Calendar.getInstance();
 //        calendar.setTime(now);
-        return R.ok(
-                Cools.add("barcode", barcode).add("Date",now)
-        );
+        if (Cools.isEmpty(barcode) || barcode.equals("")){
+            try{
+                // 淇濆瓨鎺ュ彛鏃ュ織
+                apiLogService.save(
+                        "涓帶鐢宠鑾峰彇"+palletizingNo+"绔欑偣褰撳墠鏉$爜淇℃伅",
+                        "/monitor/barcode/two",
+                        null,
+                        null,
+                        JSON.toJSONString(palletizingNo),
+                        "鏈氨缁紒锛侊紒鎵樼洏鏉$爜涓虹┖锛侊紒锛佽妫�鏌ワ紒锛侊紒",
+                        false
+                );
+            }catch (Exception e){
+            }
+            return R.error("鏈氨缁紒锛侊紒鎵樼洏鏉$爜涓虹┖锛侊紒锛佽妫�鏌ワ紒锛侊紒");
+        }
+        if (waitPakinMapper.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", barcode))!=0){
+            try{
+                // 淇濆瓨鎺ュ彛鏃ュ織
+                apiLogService.save(
+                        "涓帶鐢宠鑾峰彇"+palletizingNo+"绔欑偣褰撳墠鏉$爜淇℃伅",
+                        "/monitor/barcode/two",
+                        null,
+                        null,
+                        JSON.toJSONString(palletizingNo),
+                        "鏈氨缁紒锛侊紒鎵樼洏鏉$爜涓嶄负绌轰絾鏄凡瀛樺湪鏁版嵁锛屼笉鍙噸澶嶄娇鐢紒锛侊紒璇锋鏌ワ紒锛侊紒",
+                        false
+                );
+            }catch (Exception e){
+            }
+            return R.error("鏈氨缁紒锛侊紒鎵樼洏鏉$爜涓嶄负绌轰絾鏄凡瀛樺湪鏁版嵁锛屼笉鍙噸澶嶄娇鐢紒锛侊紒璇锋鏌ワ紒锛侊紒");
+        }
+        Cools.CoolMap coolMap = Cools.add("barcode", barcode).add("Date", now);
+        try{
+            // 淇濆瓨鎺ュ彛鏃ュ織
+            apiLogService.save(
+                    "涓帶鐢宠鑾峰彇"+palletizingNo+"绔欑偣褰撳墠鏉$爜淇℃伅",
+                    "/monitor/barcode/two",
+                    null,
+                    null,
+                    JSON.toJSONString(palletizingNo),
+                    JSON.toJSONString(coolMap),
+                    true
+            );
+        }catch (Exception e){
+        }
+        return R.ok(coolMap);
     }
 
     /**
@@ -345,9 +422,10 @@
     @GetMapping("/led/useInfo")
     public R monitorLedUseInfo(@RequestParam("ledId") Integer ledId) {
         Integer count1 = wrkDetlService.count1();
+        Integer count11 = wrkDetlService.count11();
         Integer count3 = wrkDetlService.count3();
         Map<String, Object> map = new HashMap<>();
-        map.put("count1", count1);
+        map.put("count1", count1+count11);
         map.put("count2", count3);
         return R.ok().add(map);
     }

--
Gitblit v1.9.1