Преглед изворни кода

yonghu 目标库位未分配bug

zhangxin пре 1 година
родитељ
комит
6e71a4fd5e

+ 4 - 6
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -449,23 +449,21 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
                     case 7://取消
                         wcsTask.setEndTime(new Date());
                         //如果取到货就只解锁终点库位
+                        boolean flag = "待分配".equals(wcsTask.getLocationTo());
                         if (wcsTask.getState() == 4 || wcsTask.getState() == 5) {
                             // 解锁终点库位
                             baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationTo())
                                     , Constant.WAREHOUSE_ID, updateBy);
                         } else {
-                            // 解锁终点和起始库位
-                            if (!"待分配".equals(wcsTask.getLocationTo())) {
-                                baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom()), Long.parseLong(wcsTask.getLocationTo())
-                                        , Constant.WAREHOUSE_ID, updateBy);
-                            }
+                            boolean unlock = flag ?  baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom()), Constant.WAREHOUSE_ID, updateBy)
+                                    : baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom()), Long.parseLong(wcsTask.getLocationTo()), Constant.WAREHOUSE_ID, updateBy);
                         }
                         //释放redis锁
                         if (!StringUtils.isEmpty(wcsTask.getExt8())) {
                             redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
                         }
                         // 如果是入库任务,任务结束,减去当前AGV任务数量
-                        if (!"待分配".equals(wcsTask.getLocationTo())) {
+                        if (!flag) {
                             subtractTheNumberOfTasks(wcsTask.getLocationTo());
                         }
                         // 取消任务删除中间缓存库存