From 9bce06a741a01c2e8542e13a3e2efa0ff6ef766b Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 11 十二月 2025 20:31:29 +0800
Subject: [PATCH] no message

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java |   87 +++++++++++++++++++++++++------------------
 1 files changed, 50 insertions(+), 37 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 939f23e..d16e758 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
@@ -744,7 +744,10 @@
             }
             BeanUtils.copyProperties(locWorking, locItem);
             locItem.setWorkQty(0.0).setQty(0.0).setLocCode(loc.getCode()).setLocId(loc.getId()).setId(null).setUpdateBy(loginUserId).setUpdateTime(new Date());
-            items.add(locItem);
+            //鏁伴噺涓洪浂鐨勪笉鍏ュ簱
+            if (locItem.getAnfme().compareTo(0.0) > 0) {
+                items.add(locItem);
+            }
         }
 
         if (!locItemService.saveBatch(items)) {
@@ -1017,17 +1020,18 @@
                 .setBarcode(task.getBarcode())
                 .setTaskStatus(TaskStsType.GENERATE_IN.id);
 
-        TaskInParam param = new TaskInParam();
-        param.setSourceStaNo(task.getTargSite())
-                .setIoType(type)
-                .setLocType1(Integer.parseInt(loc.getType()));
+//        TaskInParam param = new TaskInParam();
+//        param.setSourceStaNo(task.getTargSite())
+//                .setIoType(type)
+//                .setLocType1(Integer.parseInt(loc.getType()));
         //鑾峰彇鏂板簱浣�
-        InTaskMsgDto locInfo = wcsService.getLocNo(param);
+//        InTaskMsgDto locInfo = wcsService.getLocNo(param);
 
-        if (Objects.isNull(locInfo)) {
-            throw new CoolException("鑾峰彇搴撲綅澶辫触锛侊紒");
-        }
-        task.setTargLoc(locInfo.getLocNo())
+//        if (Objects.isNull(locInfo)) {
+//            throw new CoolException("鑾峰彇搴撲綅澶辫触锛侊紒");
+//        }
+        //甯屾棩涓婃姤鐗╂湁鎯呭喌锛屼笉闇�瑕佽幏鍙栨柊搴撲綅
+        task.setTargLoc(task.getOrgLoc())
                 .setOrgSite(task.getTargSite());
 
         if (!this.updateById(task)) {
@@ -1096,26 +1100,25 @@
         List<LocItemWorking> workings = new ArrayList<>();
         List<TaskItem> items = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()));
         items.forEach(taskItem -> {
-            if (taskItem.getAnfme() > 0) {
-                LocItemWorking itemWorking = new LocItemWorking();
-                BeanUtils.copyProperties(taskItem, itemWorking);
-                itemWorking.setTaskId(task.getId())
-                        .setQty(0.0)
-                        .setLocId(loc1.getId())
-                        .setLocCode(loc1.getCode());
-                workings.add(itemWorking);
-            }
+            LocItemWorking itemWorking = new LocItemWorking();
+            BeanUtils.copyProperties(taskItem, itemWorking);
+            itemWorking.setTaskId(task.getId())
+                    .setQty(0.0)
+                    .setLocId(loc1.getId())
+                    .setLocCode(loc1.getCode());
+            workings.add(itemWorking);
         });
 
-        if (!locItemWorkingService.saveBatch(workings)) {
-            throw new CoolException("涓存椂搴撳瓨鏇存柊澶辫触锛侊紒");
+        if (!workings.isEmpty()) {
+            if (!locItemWorkingService.saveBatch(workings)) {
+                throw new CoolException("涓存椂搴撳瓨鏇存柊澶辫触锛侊紒");
+            }
         }
-
         loc1.setUseStatus(LocStsType.LOC_STS_TYPE_S.type);
-
-        if (!locService.updateById(loc1)) {
-            throw new CoolException("搴撲綅棰勭害鍏ュ簱澶辫触锛侊紒");
-        }
+        locService.updateById(loc1);
+//        if (!locService.updateById(loc1)) {
+//            throw new CoolException("搴撲綅棰勭害鍏ュ簱澶辫触锛侊紒");
+//        }
         return task;
     }
 
@@ -1127,7 +1130,7 @@
      */
     @Synchronized
     @Transactional(rollbackFor = Exception.class)
-    public void complateOutStock(Task task, Long loginUserId) throws Exception {
+    public void complateOutStock(Task task, Long loginUserId) {
         if (Objects.isNull(task)) {
             throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
         }
@@ -1224,15 +1227,26 @@
                 throw new CoolException(e.getMessage());
             }
         }
-
-        /**淇敼涓哄簱浣嶇姸鎬佷负O.绌哄簱*/
-        if (!locService.update(new LambdaUpdateWrapper<Loc>()
-                .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
-                .set(Loc::getBarcode, null)
-                .set(Loc::getUpdateBy, loginUserId)
-                .set(Loc::getUpdateTime, new Date())
-                .eq(Loc::getId, loc.getId()))) {
-            throw new CoolException("搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+        if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) {
+            /**淇敼涓哄簱浣嶇姸鎬佷负S.棰勭害鍏ュ簱锛屼繚鐣欏師鏈夊簱浣�*/
+            if (!locService.update(new LambdaUpdateWrapper<Loc>()
+                    .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type)
+                    .set(Loc::getBarcode, null)
+                    .set(Loc::getUpdateBy, loginUserId)
+                    .set(Loc::getUpdateTime, new Date())
+                    .eq(Loc::getId, loc.getId()))) {
+                throw new CoolException("搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+            }
+        } else {
+            /**淇敼涓哄簱浣嶇姸鎬佷负O.绌哄簱*/
+            if (!locService.update(new LambdaUpdateWrapper<Loc>()
+                    .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
+                    .set(Loc::getBarcode, null)
+                    .set(Loc::getUpdateBy, loginUserId)
+                    .set(Loc::getUpdateTime, new Date())
+                    .eq(Loc::getId, loc.getId()))) {
+                throw new CoolException("搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+            }
         }
 
         if (!this.update(new LambdaUpdateWrapper<Task>()
@@ -1481,7 +1495,6 @@
                 CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
                 if (result.getCode() == 200) {
                     tasks.forEach(task -> {
-
                         if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)
                                 || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)
                                 || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)

--
Gitblit v1.9.1