Bladeren bron

任务列表增加取卸货完成

k 1 jaar geleden
bovenliggende
commit
b14fc23d20

+ 14 - 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/WcsTaskController.java

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

+ 9 - 1
ruoyi-ui/src/api/ams/wcsTask.js

@@ -43,7 +43,15 @@ export function delWcsTask(taskNo) {
   })
 }
 
-//完成任务
+//取货完成任务
+export function pickupCompleteWcsTask(taskNo) {
+  return request({
+    url: '/ams/wcsTask/taskPickupComplete/' + taskNo,
+    method: 'put'
+  })
+}
+
+//卸货完成任务
 export function completeWcsTask(taskNo) {
   return request({
     url: '/ams/wcsTask/taskComplete/' + taskNo,

+ 21 - 3
ruoyi-ui/src/views/ams/task/index.vue

@@ -271,11 +271,17 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed = "right">
         <template slot-scope="scope">
           <el-button
-            v-if="scope.row.state !== 7 && scope.row.state !== 2 && scope.row.state !== 11 && scope.row.state !== 12"
+            v-if="scope.row.state !== 4 && scope.row.state !== 2 && scope.row.state !== 11 && scope.row.state !== 12"
             size="mini"
             type="text"
             icon="el-icon-edit"
-            @click="handleComplete(scope.row)">完成</el-button>
+            @click="handlePickupCompleted(scope.row)">取货完成</el-button>
+          <el-button
+            v-if="(scope.row.state == 4) || (scope.row.state !== 2 && scope.row.state !== 11 && scope.row.state !== 12)"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleComplete(scope.row)">卸货完成</el-button>
           <el-button
             v-if="scope.row.state !== 7 && scope.row.state !== 2 && scope.row.state !== 11 && scope.row.state !== 12"
             size="mini"
@@ -763,9 +769,21 @@ export default {
         ...this.queryParams
       }, `wcsTask_${new Date().getTime()}.xlsx`)
     },
+    handlePickupCompleted (row) {
+      const taskNos = row.taskNo
+      this.$modal.confirm('是否确认取货完成"' + taskNos + '"的任务?').then(function() {
+        pickupCompleteWcsTask(taskNos).then(response => {
+          if (response.code === 200) {
+            this.$modal.msgSuccess(response.msg);
+          } else {
+            this.$modal.msgError(response.msg);
+          }
+        });
+      });
+    },
     handleComplete (row) {
       const taskNos = row.taskNo
-      this.$modal.confirm('是否确认要完成"' + taskNos + '"的任务?').then(function() {
+      this.$modal.confirm('是否确认卸货完成"' + taskNos + '"的任务?').then(function() {
         completeWcsTask(taskNos).then(response => {
           if (response.code === 200) {
             this.$modal.msgSuccess(response.msg);

+ 50 - 44
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -346,15 +346,11 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
             wcsTask.setAgvNo(carNo + "");
         }
 
-        if (wcsTask.getState() == 2 || wcsTask.getState() == 7) {
+        if (wcsTask.getState() == 2) {
             log.info("已完成的任务无需反馈");
             return;
         }
-        if (wcsTask.getState() == 4 && state == 7) {
-            log.info("取货完成之后不用反馈取消状态!");
-            return;
-        }
-        //todo 转发类型任务才回调
+        //转发类型任务才回调
         if (wcsTask.getTaskType().equals(Constant.TASK_TYPE.FORWARD.getValue())) {
             try {
                 switch (state) {
@@ -362,26 +358,31 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
                         wcsTask.setStartTime(new Date());
                         break;
                     case 2://完成
-                        if (wcsTask.getState() != 6) {
-                            if (wcsTask.getState() == 2) {
-                                log.info("不能重复放货," + taskNo);
-                                return;
-                            }
-                            wcsTask.setEndTime(new Date());
-                            // 解锁终点库位
-                            baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationTo())
-                                    , Constant.WAREHOUSE_ID, updateBy);
-                            // 将中间缓存位库存移动到终点
-                            moveMiddleCacheToDestination(wcsTask);
-                            //释放redis锁
-                            if (!StringUtils.isEmpty(wcsTask.getExt8())) {
-                                redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
-                            }
-                            // 如果是入库任务,任务结束,减去当前AGV任务数量
-                            subtractTheNumberOfTasks(wcsTask.getLocationTo());
-                            // 任务完成回调
-                            callBackTaskComplete(wcsTask);
+                        if (wcsTask.getState() != 4 && wcsTask.getState() != 7) {
+                            log.info("任务未取货,不能直接完成!" + taskNo);
+                            return;
+                        }
+                        if (wcsTask.getState() == 2) {
+                            log.info("不能重复放货," + taskNo);
+                            return;
                         }
+                        if (wcsTask.getState() == 6) {
+                            return;
+                        }
+                        wcsTask.setEndTime(new Date());
+                        // 解锁终点库位
+                        baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationTo())
+                                , Constant.WAREHOUSE_ID, updateBy);
+                        // 将中间缓存位库存移动到终点
+                        moveMiddleCacheToDestination(wcsTask);
+                        //释放redis锁
+                        if (!StringUtils.isEmpty(wcsTask.getExt8())) {
+                            redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
+                        }
+                        // 如果是入库任务,任务结束,减去当前AGV任务数量
+                        subtractTheNumberOfTasks(wcsTask.getLocationTo());
+                        // 任务完成回调
+                        callBackTaskComplete(wcsTask);
                         break;
                     case 3:
                         break;
@@ -406,26 +407,31 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
                     case 5:
                         break;
                     case 6://卸货
-                        if (wcsTask.getState() != 2) {
-                            if (wcsTask.getState() == 6) {
-                                log.info("不能重复放货," + taskNo);
-                                return;
-                            }
-                            wcsTask.setEndTime(new Date());
-                            // 解锁终点库位
-                            baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationTo())
-                                    , Constant.WAREHOUSE_ID, updateBy);
-                            // 将中间缓存位库存移动到终点
-                            moveMiddleCacheToDestination(wcsTask);
-                            // 释放redis锁
-                            if (!StringUtils.isEmpty(wcsTask.getExt8())) {
-                                redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
-                            }
-                            // 如果是入库任务,任务结束,减去当前AGV任务数量
-                            subtractTheNumberOfTasks(wcsTask.getLocationTo());
-                            // 任务完成回调
-                            callBackTaskComplete(wcsTask);
+                        if (wcsTask.getState() != 4 && wcsTask.getState() != 7) {
+                            log.info("任务未取货,不能直接完成!");
+                            return;
+                        }
+                        if (wcsTask.getState() == 6) {
+                            log.info("不能重复放货," + taskNo);
+                            return;
+                        }
+                        if (wcsTask.getState() == 2) {
+                            return;
                         }
+                        wcsTask.setEndTime(new Date());
+                        // 解锁终点库位
+                        baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationTo())
+                                , Constant.WAREHOUSE_ID, updateBy);
+                        // 将中间缓存位库存移动到终点
+                        moveMiddleCacheToDestination(wcsTask);
+                        //释放redis锁
+                        if (!StringUtils.isEmpty(wcsTask.getExt8())) {
+                            redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
+                        }
+                        // 如果是入库任务,任务结束,减去当前AGV任务数量
+                        subtractTheNumberOfTasks(wcsTask.getLocationTo());
+                        // 任务完成回调
+                        callBackTaskComplete(wcsTask);
                         break;
                     case 7://取消
                         wcsTask.setEndTime(new Date());