From 0a6532305b842185c85afd4e8c670f64700f2a6d Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 28 八月 2024 17:03:54 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java |   56 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 7 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 d99c407..d2125de 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
@@ -99,6 +99,11 @@
                 BasConveyor basConveyor = basConveyorService.getOne(new LambdaQueryWrapper<BasConveyor>().eq(BasConveyor::getDeviceId, devp.getId()).eq(BasConveyor::getHostId, devp.getHostId()));
                 // 閬嶅巻鍏ュ簱鍙�
                 for (StaDto inSta : JSON.parseArray(basConveyor.getInSta(), StaDto.class)) {
+                    BasConveyorSta basConveyorSta = basConveyorStaService.selectBySiteNo(inSta.getStaNo().toString());
+                    if(basConveyorSta == null) {
+                        continue;
+                    }
+
                     // 鑾峰彇鍏ュ簱绔欎俊鎭�
                     DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, devp.getId().intValue());
                     StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
@@ -156,7 +161,7 @@
                     ) {
 
                         // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                        BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
+                        BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, basConveyorSta.getBarcodeId().intValue());
                         if (barcodeThread == null) {
                             continue;
                         }
@@ -306,6 +311,17 @@
                         mapNode.setNo(object.getString("row") + "-" + object.getString("bay"));
                         mapNode.setXBase(object.getInteger("refx"));
                         mapNode.setYBase(object.getInteger("refy"));
+
+                        if(mapNode.getValue() == MapNodeType.CONVEYOR.id) {
+                            //杈撻�佺嚎,鍒ゆ柇灏忚溅鏄惁鍙蛋
+                            if (object.containsKey("conveyorHasGo")) {
+                                if(object.getBoolean("conveyorHasGo")) {
+                                    //灏忚溅鍙蛋
+                                    mapNode.setValue(MapNodeType.CONVEYOR_CAR_GO.id);
+                                }
+                            }
+                        }
+
                         nodes.add(mapNode);
                     }
 
@@ -328,7 +344,7 @@
                         //瀛樺湪绌虹己鑺傜偣锛岃嚜鍔ㄨˉ瓒�
                         for (int i = defaultBay; i < node.getBay(); i++) {
                             MapNode mapNode = new MapNode();
-                            mapNode.setValue(-1);
+                            mapNode.setValue(MapNodeType.DISABLE.id);
                             mapNode.setTop(1000);
                             mapNode.setBottom(1000);
                             mapNode.setLeft(1000);
@@ -355,7 +371,7 @@
                 ArrayList<ArrayList<MapNode>> lists = entry.getValue();//鑾峰彇鍦板浘
 
                 MapNode mapNode = new MapNode();
-                mapNode.setValue(-1);
+                mapNode.setValue(MapNodeType.DISABLE.id);
                 mapNode.setTop(1000);
                 mapNode.setBottom(1000);
                 mapNode.setLeft(1000);
@@ -420,10 +436,14 @@
     // 瑙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;
-//            }
+            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;
@@ -432,6 +452,28 @@
 //            if (barcodeThread == null) {
 //                continue;
 //            }
+//            if (!barcodeThread.getBarcode().equals(task.getZpallet())) {
+//                continue;
+//            }
+            if (Cools.isEmpty(basConveyorSta.getTaskNo())){
+                continue;
+            }
+            if (!basConveyorSta.getTaskNo().toString().equals(task.getTaskNo())){
+                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())) {

--
Gitblit v1.9.1