From 597c2680c8a4b233791db04f076afcb8570cf6e3 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 10 十月 2023 15:05:03 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   98 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 75 insertions(+), 23 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 293d0d1..2975a78 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1377,7 +1377,7 @@
                     continue;
                 }
 
-                boolean step4 = this.locToLocExecuteStep4(wrkMast);//璋冨害杞﹁締鍙栬揣骞惰繍閫佸埌鍑哄簱鍙�
+                boolean step4 = this.locToLocExecuteStep4(wrkMast);//璋冨害杞﹁締鍙栬揣骞惰繍閫佸埌鐩爣搴撲綅
                 if (!step4) {
                     continue;
                 }
@@ -2021,30 +2021,82 @@
             StaProtocol staProtocol317 = devpThread.getStation().get(317);
             if (staProtocol303.isAutoing() && staProtocol303.isLoading() && staProtocol303.getWorkNo() != 0) {
                 //璋冨害鏈烘鑷�
-//                //鏌ヨ鏄惁鏈夊伐浣滄。
-//                WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol303.getWorkNo().intValue());
-//                if (wrkMast == null) {
-//                    continue;
-//                }
-//                WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo());
-//                if (wrkDetl == null) {
-//                    continue;
-//                }
-//                RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "303");
-                RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), -1, "303");
+                //鏌ヨ鏄惁鏈夊伐浣滄。
+                WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol303.getWorkNo().intValue());
+                if (wrkMast == null) {
+                    continue;
+                }
+                WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo());
+                if (wrkDetl == null) {
+                    continue;
+                }
+
+                if (wrkMast.getInvWh() == null) {
+                    wrkMast.setInvWh("Y");//鏍囪宸茬粡涓嬪彂鏈烘鑷備换鍔�
+                    if (wrkMastMapper.updateById(wrkMast) > 0) {
+                        RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "303");
+                    }
+                }
             }else if (staProtocol317.isAutoing() && staProtocol317.isLoading() && staProtocol317.getWorkNo() != 0) {
                 //璋冨害鏈烘鑷�
-//                //鏌ヨ鏄惁鏈夊伐浣滄。
-//                WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol317.getWorkNo().intValue());
-//                if (wrkMast == null) {
-//                    continue;
-//                }
-//                WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo());
-//                if (wrkDetl == null) {
-//                    continue;
-//                }
-//                RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "317");
-                RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), -1, "317");
+                //鏌ヨ鏄惁鏈夊伐浣滄。
+                WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol317.getWorkNo().intValue());
+                if (wrkMast == null) {
+                    continue;
+                }
+                WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo());
+                if (wrkDetl == null) {
+                    continue;
+                }
+                if (wrkMast.getInvWh() == null) {
+                    wrkMast.setInvWh("Y");//鏍囪宸茬粡涓嬪彂鏈烘鑷備换鍔�
+                    if (wrkMastMapper.updateById(wrkMast) > 0) {
+                        RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "317");
+                    }
+                }
+            }
+        }
+    }
+
+    // 300绔欐嫞鏂�
+    public void pick300() {
+        //妫�娴�300绔欐槸鍚﹁嚜鍔ㄣ�佹湁鐗┿�佸伐浣滃彿
+        for (DevpSlave devp : slaveProperties.getDevp()) {
+            // 鑾峰彇鍏ュ簱绔欎俊鎭�
+            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+            StaProtocol staProtocol = devpThread.getStation().get(300);
+            if (staProtocol == null) {
+                continue;
+            }
+            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() != 0) {
+                //鏌ヨ鏄惁鏈夊伐浣滄。
+                WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol.getWorkNo().intValue());
+                if (wrkMast == null) {
+                    continue;
+                }
+
+                if (wrkMast.getWrkSts() != 25) {//25.鎻愬崌鏈烘惉杩愬畬鎴�
+                    continue;
+                }
+
+                if (wrkMast.getMk() == null) {
+                    Integer sourceStaNo = wrkMast.getSourceStaNo();//婧愮珯
+                    Integer staNo = wrkMast.getStaNo();//鐩爣绔�
+                    //瑕嗙洊宸ヤ綔妗g洰鏍囩珯
+                    wrkMast.setStaNo(sourceStaNo);
+                    wrkMast.setSourceStaNo(staNo);
+                    if (wrkMastMapper.updateById(wrkMast) > 0) {
+                        //鍚�300绔欏啓鍏ョ洰鏍囩珯
+                        staProtocol = staProtocol.clone();
+                        staProtocol.setStaNo(wrkMast.getStaNo().shortValue());//绉诲姩鍒扮洰鏍囩珯
+                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+                        try {
+                            Thread.sleep(500);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }
             }
         }
     }

--
Gitblit v1.9.1