From d498cfd64f2dcc3117802eea755b57f87289ad22 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期一, 06 一月 2025 15:05:11 +0800
Subject: [PATCH] #平库入库单功能完成

---
 zy-asrs-wms/src/main/resources/application.yml                                     |    4 +-
 zy-asrs-admin/src/components/order/order/orderIn.vue                               |    6 +-
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/MobileController.java    |    6 +-
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java               |    6 +-
 zy-asrs-admin/src/views/in/waitPakin/index.vue                                     |    4 +-
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java |   43 ++++++++++++++++++++-
 6 files changed, 54 insertions(+), 15 deletions(-)

diff --git a/zy-asrs-admin/src/components/order/order/orderIn.vue b/zy-asrs-admin/src/components/order/order/orderIn.vue
index 073524a..a314487 100644
--- a/zy-asrs-admin/src/components/order/order/orderIn.vue
+++ b/zy-asrs-admin/src/components/order/order/orderIn.vue
@@ -57,7 +57,7 @@
   {
     title: formatMessage('db.man_order.order_time', '鍗曟嵁鏃ユ湡'),
     dataIndex: 'orderTime',
-    width: 160,
+    width: 180,
     ellipsis: true,
     ...getColumnSearchProps('orderTime'),
   },
@@ -92,7 +92,7 @@
   {
     title: formatMessage('db.man_order.create_time', '娣诲姞鏃堕棿'),
     dataIndex: 'createTime$',
-    width: 140,
+    width: 180,
     ellipsis: true,
     ...getColumnSearchProps('createTime$'),
   },
@@ -106,7 +106,7 @@
   {
     title: formatMessage('db.man_order.update_time', '淇敼鏃堕棿'),
     dataIndex: 'updateTime$',
-    width: 140,
+    width: 180,
     ellipsis: true,
     ...getColumnSearchProps('updateTime$'),
   },
diff --git a/zy-asrs-admin/src/views/in/waitPakin/index.vue b/zy-asrs-admin/src/views/in/waitPakin/index.vue
index 6ef6c9a..3e2ade2 100644
--- a/zy-asrs-admin/src/views/in/waitPakin/index.vue
+++ b/zy-asrs-admin/src/views/in/waitPakin/index.vue
@@ -105,7 +105,7 @@
   {
     title: formatMessage('db.man_wait_pakin.create_time', '娣诲姞鏃堕棿'),
     dataIndex: 'createTime$',
-    width: 140,
+    width: 180,
     ellipsis: true,
     ...getColumnSearchProps('createTime$'),
   },
@@ -119,7 +119,7 @@
   {
     title: formatMessage('db.man_wait_pakin.update_time', '淇敼鏃堕棿'),
     dataIndex: 'updateTime$',
-    width: 140,
+    width: 180,
     ellipsis: true,
     ...getColumnSearchProps('updateTime$'),
   },
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/MobileController.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/MobileController.java
index 41533b7..cc07a96 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/MobileController.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/MobileController.java
@@ -81,7 +81,7 @@
      * 2. 搴撲綅缃负鍦ㄥ簱鐘舵��
      * @return
      */
-    @PostMapping("matnr/in/barcode")
+    @PostMapping("/matnr/in/barcode")
     public R pakinToStock(@RequestBody PakinOnShelvesParams shelvesParams) {
         if (StringUtil.isNullOrEmpty(shelvesParams.getBarcode())) {
             return R.error("鎷栫洏鐮佷笉鑳戒负绌猴紒锛�");
@@ -102,9 +102,9 @@
      * 鑾峰彇鎷栫爜鐩樼粦瀹氬晢鍝�
      * @return
      */
-    @GetMapping("barcode/matnr/{code}")
+    @GetMapping("/barcode/matnr/{code}")
     public R getAllGoods(@PathVariable String code) {
-        if (!StringUtil.isNullOrEmpty(code)) {
+        if (StringUtil.isNullOrEmpty(code)) {
             return R.error("鎵樼洏鐮佷笉鑳戒负绌猴紒锛�");
         }
         List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, code).eq(WaitPakin::getIoStatus, 0));
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java
index 5a132a0..e15ee67 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java
@@ -66,7 +66,7 @@
     /**
      * 鍑哄簱
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public void out(OutParam outParam) {
         if (outParam.getOperationPort() == null) {
             throw new CoolException("浣滀笟鍙d笉瀛樺湪");
@@ -943,8 +943,8 @@
 
                 //TODO 纭鍚庯紝闇�灏嗘敞閲婃墦寮�
                 String matUniqueKey = Utils.getMatUniqueKey(taskDetl.getMatnr(), taskDetl.getBatch(), taskDetl.getUniqueField());
-//                WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, waveId));
-                WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getWaveId, wave.getId()), false);
+                WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, waveId));
+//                WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getWaveId, wave.getId()), false);
                 if (waveDetl == null) {
                     throw new CoolException("娉㈡鏁版嵁涓嶅瓨鍦�");
                 }
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java
index 31cee62..9641bd7 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java
@@ -11,6 +11,7 @@
 import com.zy.asrs.wms.asrs.service.*;
 import com.zy.asrs.wms.system.entity.Host;
 import com.zy.asrs.wms.system.service.HostService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -19,6 +20,7 @@
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 @Service
 public class MobileServiceImpl implements MobileService {
@@ -26,11 +28,15 @@
     @Autowired
     private WaitPakinService waitPakinService;
     @Autowired
+    private WaitPakinLogService waitPakinLogService;
+    @Autowired
     private WorkService workService;
     @Autowired
     private HostService hostService;
     @Autowired
     private OrderService orderService;
+    @Autowired
+    private OrderLogService orderLogService;
     @Autowired
     private LocService locService;
     @Autowired
@@ -104,6 +110,9 @@
 
         //鍒ゆ柇褰撳墠浠撳簱鏄惁涓哄钩搴撲綅
         List<LocArea> locAreas = locAreaService.list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getLocId, loc.getId()));
+        if (locAreas.isEmpty()) {
+            throw new CoolException("搴撲綅娌℃湁鍒嗛厤鎵�灞炰粨搴撳尯鍩燂紒锛�");
+        }
         locAreas.forEach(locArea -> {
             LocAreaType typeServiceOne = locAreaTypeService.getOne(new LambdaQueryWrapper<LocAreaType>().eq(LocAreaType::getId, locArea.getTypeId()), false);
             if (typeServiceOne.getParentId() != LocAreaTypeSts.LOC_AREA_TYPE_FLAT.id && typeServiceOne.getId() != LocAreaTypeSts.LOC_AREA_TYPE_FLAT.id) {
@@ -115,7 +124,7 @@
         loc.setUpdateTime(new Date());
         //搴撳瓨鐘舵�佷慨鏀逛负鍦ㄥ簱鐘舵��
         loc.setLocStsId(LocStsType.F.val());
-        if (!locService.save(loc)) {
+        if (!locService.updateById(loc)) {
             throw new CoolException("搴撲綅鏇存柊澶辫触锛侊紒");
         }
 
@@ -132,11 +141,41 @@
             locDetl.setMatnr(pakin.getMatnr());
             locDetl.setMemo(pakin.getMemo());
             locDetl.setUpdateTime(new Date());
-            if (!locDetlService.save(locDetl)) {
+            if (!locDetlService.saveOrUpdate(locDetl)) {
                 throw new CoolException("搴撳瓨鏄庣粏鏇存柊澶辫触锛侊紒");
             }
+            //淇敼鐘舵�佷负鍏ュ簱涓�
+            pakin.setIoStatus(1);
         });
 
+        //鍒犻櫎缁勬嫋妗o紝鍔犲叆鍘嗗彶缁勬嫋妗�
+        List<WaitPakinLog> waitPakinLogs = new ArrayList<>();
+        waitPakins.forEach(waitPakin -> {
+            WaitPakinLog pakinLog = new WaitPakinLog();
+            BeanUtils.copyProperties(waitPakin, pakinLog);
+            if (!waitPakinLogService.saveOrUpdate(pakinLog)) {
+                throw new CoolException("缁勬嫋鍘嗗彶妗f洿鏂板け璐�");
+            }
+        });
+
+        if (!waitPakinService.removeBatchByIds(waitPakins)) {
+            throw new CoolException("缁勬嫋妗e垹闄ゅけ璐ワ紒锛�");
+        }
+        //閫氳繃缁勬嫋璁㈠崟ID鑾峰彇璁㈠崟锛屽苟鍒犻櫎鍘熷崟鎹紝鍔犲叆鍗曟嵁鍘嗗彶妗�
+        List<Long> list = waitPakins.stream().map(WaitPakin::getOrderId).collect(Collectors.toList());
+        List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getId, list));
+        orders.forEach(order -> {
+            OrderLog orderLog = new OrderLog();
+            BeanUtils.copyProperties(order, orderLog);
+            if (!orderLogService.save(orderLog)) {
+                throw new CoolException("鍘嗗彶鍗曟嵁鏇存柊澶辫触锛侊紒");
+            }
+        });
+
+        if (!orderService.removeBatchByIds(orders)) {
+            throw new CoolException("璁㈠崟鍒犻櫎澶辫触锛侊紒");
+        }
+
         return true;
     }
 
diff --git a/zy-asrs-wms/src/main/resources/application.yml b/zy-asrs-wms/src/main/resources/application.yml
index 9d1a596..156e996 100644
--- a/zy-asrs-wms/src/main/resources/application.yml
+++ b/zy-asrs-wms/src/main/resources/application.yml
@@ -13,8 +13,8 @@
       validation-timeout: 3000
       connection-test-query: select 1
     driver-class-name: com.mysql.cj.jdbc.Driver
-#    url: jdbc:mysql://127.0.0.1:3306/wms_dev_test?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
-    url: jdbc:mysql://127.0.0.1:3306/wms_dev?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
+    url: jdbc:mysql://127.0.0.1:3306/wms_dev_test?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
+#    url: jdbc:mysql://127.0.0.1:3306/wms_dev?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
     username: root
     password: 34821015
 #    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver

--
Gitblit v1.9.1