From 1de6b39bfe3967916dcab8122be0d69fbaba8cca Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期五, 30 五月 2025 17:29:06 +0800
Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
index f5305e4..2b3e618 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -480,6 +480,7 @@
         }
         //娣卞簱浣嶅厛鍑烘儏鍐�
         if (!LocUtils.isShallowLoc(curLoc)) {
+            //娣卞簱浣�
             String shallowLoc = LocUtils.getShallowLoc(curLoc);
             if (StringUtils.isBlank(shallowLoc)) {
                 throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛橈紒");
@@ -500,6 +501,16 @@
                     task.setSort(i);
                 }
             }
+//            else if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) {
+//                //濡傛灉涓哄湪搴撶姸鎬侊紝鐢熸垚绉诲簱浠诲姟
+//                LocToTaskParams params = new LocToTaskParams();
+//                params.setOrgLoc(curLoc);
+//                //鐢熸垚绉绘繁搴撲綅浠诲姟
+//                Task moveTask = locItemService.genMoveTask(params, loginUserId);
+//                moveTask.setTaskType(task.getSort() + 1);
+//
+//                return moveTask;
+//            }
         } else {
             //娴呭簱浣嶏紝鍒ゆ柇娣卞搴旀繁搴撲綅鏄惁涓虹┖锛屽鏋滀负绌虹敓鎴愪竴涓Щ搴撲换鍔★紝灏嗘墭鐩橀�佸叆娣卞簱浣�
             String deepLoc = LocUtils.getDeepLoc(curLoc);
@@ -513,9 +524,9 @@
             //鍒ゆ柇娣卞簱浣嶆槸鍚︿负绌�
             if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
                 LocToTaskParams params = new LocToTaskParams();
-                params.setOrgLoc(loc.getCode()).setTarLoc(deepLoc);
-
-                Task task1 = locItemService.genMoveTask(params, loginUserId);
+                params.setOrgLoc(curLoc).setTarLoc(deepLoc);
+                //鐢熸垚绉绘繁搴撲綅浠诲姟
+                locItemService.genMoveTask(params, loginUserId);
             }
         }
 
@@ -697,7 +708,9 @@
     @Transactional(rollbackFor = Exception.class)
     public R removeTask(Long[] ids, Long loginUserId) {
         List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
-        List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type);
+        List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type,TaskType.TASK_TYPE_PICK_AGAIN_OUT.type,
+                TaskType.TASK_TYPE_CHECK_OUT.type,  TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_LOC_MOVE.type,
+                TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type);
         List<Task> tasks = this.list(new LambdaQueryWrapper<Task>()
                 .in(Task::getTaskType, list)
                 .in(Task::getId, ids).in(Task::getTaskStatus, longs));
@@ -705,6 +718,38 @@
             throw new CoolException("浠诲姟宸插鎵ц鐘舵�佷笉鍙彇娑堬紒锛�");
         }
         for (Task task : tasks) {
+            //鍙栨秷绉诲簱浠诲姟
+            if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type) && task.getTaskStatus().equals(TaskStsType.GENERATE_OUT.id)) {
+                if (!locService.update(new LambdaUpdateWrapper<Loc>()
+                        .eq(Loc::getCode, task.getOrgLoc())
+                        .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) {
+                    throw new CoolException("婧愬簱浣嶇姸鎬佷慨鏀瑰け璐ワ紒锛�");
+                }
+                if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()).set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) {
+                    throw new CoolException("绉诲簱鐩爣搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+                }
+
+                Task outTask = taskService.getById(task.getParentId());
+                if (!Objects.isNull(outTask)) {
+                    LocToTaskParams params = new LocToTaskParams();
+                    params.setOrgLoc(task.getOrgLoc()).setSiteNo(task.getOrgSite());
+                    //鐢熸垚绉绘繁搴撲綅浠诲姟
+                    Task moveTask = locItemService.genMoveTask(params, loginUserId);
+                    moveTask.setSort(task.getSort() + 1).setParentId(outTask.getId());
+                    if (!this.updateById(moveTask)) {
+                        throw new CoolException("浠诲姟淇℃伅淇敼澶辫触锛侊紒");
+                    }
+                    outTask.setParentId(moveTask.getId());
+                    if (!this.updateById(outTask)) {
+                        throw new CoolException("浠诲姟淇℃伅淇敼澶辫触锛侊紒");
+
+                    }
+
+                } else {
+                    throw new CoolException("鏃犳硶鐢熸垚鏂扮殑绉诲簱浠诲姟锛屽彇娑堝け璐ワ紒锛�");
+                }
+            }
+
             if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.val)) {
                 BasStation basStation = null;
                 if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
@@ -716,8 +761,7 @@
                         || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)
                         || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)
                         || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
-                        || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)
-                ) {
+                        || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)) {
                     basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                             .eq(BasStation::getStationName, task.getTargLoc())
                             .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type));

--
Gitblit v1.9.1