From 5b655229cdb052858e80c6f5ae55077354187c4a Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 08 八月 2023 09:37:09 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/utils/CommandUtils.java |   34 ++++++++++++++++++++++------------
 1 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/CommandUtils.java b/src/main/java/com/zy/asrs/utils/CommandUtils.java
index b483ad2..2fad65c 100644
--- a/src/main/java/com/zy/asrs/utils/CommandUtils.java
+++ b/src/main/java/com/zy/asrs/utils/CommandUtils.java
@@ -29,16 +29,20 @@
 
         CommandInfo commandInfo = null;
         WrkMast wrkMast = null;
-        int taskNo = 0;
+        int wrkNo = 0;
+        String taskNo = null;
         switch (type) {
             case Crn:
                 CrnCommand command = (CrnCommand) task.getData();
-                taskNo = command.getTaskNo();
-                wrkMast = wrkMastService.selectById(taskNo);
+                wrkNo = command.getTaskNo();
+                if (wrkNo != 0) {
+                    wrkMast = wrkMastService.selectById(wrkNo);
+                    taskNo = wrkMast.getTaskNo();
+                }
 
                 commandInfo = new CommandInfo();
-                commandInfo.setWrkNo(taskNo);
-                commandInfo.setWmsWrkNo(wrkMast.getWmsWrkNo());
+                commandInfo.setWrkNo(wrkNo);
+                commandInfo.setTaskNo(taskNo);
                 commandInfo.setCommandStatus(1);
                 commandInfo.setStartTime(new Date());
                 commandInfo.setDevice("crn");
@@ -49,12 +53,15 @@
                 break;
             case Devp:
                 StaProtocol staProtocol = (StaProtocol) task.getData();
-                taskNo = staProtocol.getWorkNo();
-                wrkMast = wrkMastService.selectById(taskNo);
+                wrkNo = staProtocol.getWorkNo();
+                if (wrkNo != 0) {
+                    wrkMast = wrkMastService.selectById(wrkNo);
+                    taskNo = wrkMast.getTaskNo();
+                }
 
                 commandInfo = new CommandInfo();
-                commandInfo.setWrkNo(taskNo);
-                commandInfo.setWmsWrkNo(wrkMast.getWmsWrkNo());
+                commandInfo.setWrkNo(wrkNo);
+                commandInfo.setTaskNo(taskNo);
                 commandInfo.setCommandStatus(1);
                 commandInfo.setStartTime(new Date());
                 commandInfo.setDevice("devp");
@@ -66,12 +73,15 @@
             case Led:
                 List<LedCommand> data = (List<LedCommand>) task.getData();
                 for (LedCommand ledCommand : data) {
-                    taskNo = ledCommand.getWorkNo();
-                    wrkMast = wrkMastService.selectById(taskNo);
+                    wrkNo = ledCommand.getWorkNo();
+                    if (wrkNo != 0) {
+                        wrkMast = wrkMastService.selectById(wrkNo);
+                        taskNo = wrkMast.getTaskNo();
+                    }
 
                     commandInfo = new CommandInfo();
                     commandInfo.setWrkNo(ledCommand.getWorkNo());
-                    commandInfo.setWmsWrkNo(wrkMast.getWmsWrkNo());
+                    commandInfo.setTaskNo(taskNo);
                     commandInfo.setCommandStatus(1);
                     commandInfo.setStartTime(new Date());
                     commandInfo.setDevice("led");

--
Gitblit v1.9.1