Переглянути джерело

任务管理-完成按钮修改

k 1 рік тому
батько
коміт
892dfeea54

+ 6 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/WcsTaskController.java

@@ -112,10 +112,13 @@ public class WcsTaskController extends BaseController {
     public AjaxResult taskComplete(@PathVariable("taskNo") String taskNo) {
         WcsTask wcsTask = wcsTaskService.selectWcsTaskByTaskNo(taskNo);
         if (wcsTask == null) {
-            AjaxResult.error("任务回调失败");
+           return AjaxResult.error("任务回调失败");
         }
-        wcsTaskService.callBackTaskComplete(wcsTask);
-        return AjaxResult.success("任务回调完成");
+        if (!wcsTask.getState().equals("4")) {
+           return AjaxResult.error("任务未取货,不能直接完成!");
+        }
+        wcsTaskService.callBack(wcsTask.getTaskNo(),2,Integer.parseInt(wcsTask.getAgvNo()));
+        return AjaxResult.success("执行成功");
     }
 
     @Log(title = "任务取消", businessType = BusinessType.INSERT)

+ 8 - 5
ruoyi-ui/src/views/ams/task/index.vue

@@ -721,11 +721,14 @@ export default {
     handleComplete (row) {
       const taskNos = row.taskNo
       this.$modal.confirm('是否确认要完成"' + taskNos + '"的任务?').then(function() {
-        return completeWcsTask(taskNos);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("执行成功");
-      }).catch(() => {});
+        completeWcsTask(taskNos).then(response => {
+          if (response.code === 200) {
+            this.$modal.msgSuccess(response.msg);
+          } else {
+            this.$modal.msgError(response.msg);
+          }
+        });
+      });
     },
     handleCancel (row) {
       const taskNos = row.taskNo