Quellcode durchsuchen

任务列表-增加取卸货完成按钮

k vor 1 Jahr
Ursprung
Commit
5ba3d3d652

+ 13 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/WcsTaskController.java

@@ -107,16 +107,25 @@ 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("执行成功");
     }

+ 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

@@ -233,11 +233,17 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <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"
@@ -718,9 +724,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);

+ 45 - 43
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -167,9 +167,10 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
 
     /**
      * 增加充电任务(TS触发触发任务反馈)
-     * @param agvNo 车号
+     *
+     * @param agvNo        车号
      * @param chargingSite 充电桩号
-     * @param index TS任务号
+     * @param index        TS任务号
      * @return
      */
     @Override
@@ -359,11 +360,11 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
             wcsTask.setAgvNo(carNo + "");
         }
 
-        if (wcsTask.getState() == 2 || wcsTask.getState() == 7) {
+        if (wcsTask.getState() == 2) {
             log.info("已完成的任务无需反馈");
             return;
         }
-        //todo 转发类型任务才回调
+        //转发类型任务才回调
         if (wcsTask.getTaskType().equals(Constant.TASK_TYPE.FORWARD.getValue())) {
             try {
                 switch (state) {
@@ -371,23 +372,26 @@ 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);
-                            // 修改库存标识标识 因为接驳位可以出库也可以入库 所以需要标识当前接驳位的库存是入库还是出库
-                            updateInvAsnSoMarking(wcsTask);
-                            //释放redis锁
-                            if (!StringUtils.isEmpty(wcsTask.getExt8())) {
-                                redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
-                            }
+                        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()));
                         }
                         break;
                     case 3:
@@ -397,11 +401,6 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
                             log.info("不能重复取货," + taskNo);
                             return;
                         }
-                        // 如果是接驳位(模具-东)的点位取货完成 反馈关闭靠墙第二层自动门
-                        if (wcsTask.getLocationFrom().equals(Constant.LOC_MJ_EAST.toString())) {
-                            Thread.sleep(3000);
-                            autoDoorClient.sendClose(AutoDoorClient.AUTO_DOOR_NO.C);
-                        }
                         // 解锁起始库位
                         baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom())
                                 , Constant.WAREHOUSE_ID, updateBy);
@@ -416,23 +415,26 @@ 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);
-                            // 修改库存标识标识 因为接驳位可以出库也可以入库 所以需要标识当前接驳位的库存是入库还是出库
-                            updateInvAsnSoMarking(wcsTask);
-                            //释放redis锁
-                            if (!StringUtils.isEmpty(wcsTask.getExt8())) {
-                                redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
-                            }
+                        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()));
                         }
                         break;
                     case 7://取消