From c13fe87d70e81d7dcb604f8f1227de8f313cbefc Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 10 七月 2024 09:26:51 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java |   72 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
index c8e4bfd..38df235 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -82,6 +82,8 @@
     private BasConveyorPathService basConveyorPathService;
     @Autowired
     private BasLedService basLedService;
+    @Autowired
+    private DeviceBarcodeService deviceBarcodeService;
 
     /**
      * 缁勬墭
@@ -418,6 +420,40 @@
     // 瑙f瀽鍏ュ簱宸ヤ綔妗�
     public synchronized void analyzeInBoundTask() {
         for (Task task : taskService.selectWaitAnalyzeInBoundTask()) {
+            BasConveyorSta basConveyorSta = basConveyorStaService.getOne(new LambdaQueryWrapper<BasConveyorSta>().eq(BasConveyorSta::getSiteNo, task.getDestSite()));
+            if (basConveyorSta == null) {
+                continue;
+            }
+            BasConveyor basConveyor = basConveyorService.getById(basConveyorSta.getConveyorId());
+            if (basConveyor == null) {
+                continue;
+            }
+            DeviceBarcode deviceBarcode = deviceBarcodeService.getById(basConveyorSta.getBarcodeId());
+            if (deviceBarcode == null) {
+                continue;
+            }
+            BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, Integer.parseInt(deviceBarcode.getDeviceId()));
+            if (barcodeThread == null) {
+                continue;
+            }
+            if (!barcodeThread.getBarcode().equals(task.getZpallet())) {
+                continue;
+            }
+            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, basConveyor.getDeviceId().intValue());
+            if (devpThread == null) {
+                continue;
+            }
+            StaProtocol staProtocol = devpThread.getStation().get(basConveyorSta.getSiteNo());
+            if (staProtocol == null) {
+                continue;
+            }
+            if (!(staProtocol.isAutoing()
+                    && staProtocol.isLoading()
+                    && staProtocol.isInEnable())) {
+                continue;
+            }
+
+
             if (Cools.isEmpty(task.getShuttleNo())) {
                 //鍒嗛厤灏忚溅
                 //鎼滅储绌洪棽杞�
@@ -567,6 +603,42 @@
         }
     }
 
+    // 瑙f瀽灏忚溅杞借揣绉诲姩宸ヤ綔妗�
+    public synchronized void analyzeLadenMoveTask() {
+        for (Task task : taskService.selectWaitAnalyzeLadenMoveTask()) {
+            if (Cools.isEmpty(task.getShuttleNo())) {
+                //鍒嗛厤灏忚溅
+                //鎼滅储绌洪棽杞�
+                ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task);
+                if (shuttleThread == null) {
+                    News.info("{}浠诲姟鏈壘鍒扮┖闂茬┛姊溅", task.getTaskNo());
+                    continue;
+                }
+
+                task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//淇濆瓨绌挎杞﹀彿
+                task.setUpdateTime(new Date());
+                if (!taskService.updateById(task)) {
+                    News.info("{}浠诲姟鏇存柊绌挎杞﹀彿澶辫触", task.getTaskNo());
+                }
+                continue;
+            }
+
+            // generate motion list
+            List<Motion> motionList = analyzeService.generateShuttleLadenMoveMotion(task);
+            if (motionList.isEmpty()) {
+                continue;
+            }
+            motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId());
+
+            // 鏇存柊宸ヤ綔涓绘。
+            task.setTaskSts(TaskStsType.ANALYZE_LADEN_MOVE.sts); // 宸ヤ綔鐘舵��
+            task.setUpdateTime(new Date());
+            if (!taskService.updateById(task)) {
+                News.error("鏇存柊宸ヤ綔妗eけ璐ワ紒锛侊紒 [宸ヤ綔鍙凤細{}]", task.getTaskNo());
+            }
+        }
+    }
+
     /**
      * 鍥涘悜绌挎杞︾數閲忔娴� ===>> 鍙戣捣鍏呯數
      */

--
Gitblit v1.9.1