From e2e5cea7617ce0632750b3123dd600db95410919 Mon Sep 17 00:00:00 2001
From: DESKTOP-LMJ82IJ\Eno <creaycat@gmail.com>
Date: 星期日, 05 一月 2025 17:57:53 +0800
Subject: [PATCH] #平库入库功能

---
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java |   84 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 75 insertions(+), 9 deletions(-)

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 d01778e..31cee62 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
@@ -2,17 +2,13 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.framework.exception.CoolException;
-import com.zy.asrs.wms.asrs.entity.Order;
-import com.zy.asrs.wms.asrs.entity.WaitPakin;
-import com.zy.asrs.wms.asrs.entity.enums.LocTypeHeightType;
+import com.zy.asrs.wms.asrs.entity.*;
+import com.zy.asrs.wms.asrs.entity.enums.*;
 import com.zy.asrs.wms.asrs.entity.enums.OrderType;
-import com.zy.asrs.wms.asrs.entity.enums.TaskStsType;
 import com.zy.asrs.wms.asrs.entity.param.BatchMergeOrdersParam;
 import com.zy.asrs.wms.asrs.entity.param.GeneratePakInParam;
-import com.zy.asrs.wms.asrs.service.MobileService;
-import com.zy.asrs.wms.asrs.service.OrderService;
-import com.zy.asrs.wms.asrs.service.WaitPakinService;
-import com.zy.asrs.wms.asrs.service.WorkService;
+import com.zy.asrs.wms.asrs.entity.param.PakinOnShelvesParams;
+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.factory.annotation.Autowired;
@@ -20,6 +16,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 
@@ -32,9 +29,16 @@
     private WorkService workService;
     @Autowired
     private HostService hostService;
-
     @Autowired
     private OrderService orderService;
+    @Autowired
+    private LocService locService;
+    @Autowired
+    private LocDetlService locDetlService;
+    @Autowired
+    private LocAreaService locAreaService;
+    @Autowired
+    private LocAreaTypeService locAreaTypeService;
 
 
     @Override
@@ -85,4 +89,66 @@
     public List<Host> getHosts() {
         return hostService.list();
     }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean pakinToStock(PakinOnShelvesParams shelvesParams) {
+        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, shelvesParams.getLoc()));
+        if (Objects.isNull(loc)) {
+            throw new CoolException("搴撲綅涓嶅瓨鍦紒锛�");
+        }
+        if (loc.getLocStsId() != LocStsType.O.val()) {
+            throw new CoolException("褰撳墠搴撲綅鐘舵�佷笉鏄┖搴撶姸鎬�." + LocStsType.O.val());
+        }
+
+        //鍒ゆ柇褰撳墠浠撳簱鏄惁涓哄钩搴撲綅
+        List<LocArea> locAreas = locAreaService.list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getLocId, loc.getId()));
+        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) {
+                throw new CoolException("璇烽�夋嫨骞冲簱鍖哄簱浣嶏紝鍐嶆搷浣滐紒锛�");
+            }
+        });
+
+        loc.setBarcode(shelvesParams.getBarcode());
+        loc.setUpdateTime(new Date());
+        //搴撳瓨鐘舵�佷慨鏀逛负鍦ㄥ簱鐘舵��
+        loc.setLocStsId(LocStsType.F.val());
+        if (!locService.save(loc)) {
+            throw new CoolException("搴撲綅鏇存柊澶辫触锛侊紒");
+        }
+
+        List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, shelvesParams.getBarcode()));
+        waitPakins.forEach(pakin -> {
+            LocDetl locDetl = new LocDetl();
+            locDetl.setAnfme(pakin.getAnfme());
+            locDetl.setBatch(pakin.getBatch());
+            locDetl.setMatnr(pakin.getMatnr());
+            locDetl.setCreateTime(new Date());
+            locDetl.setOrderNo(pakin.getOrderNo());
+            locDetl.setLocNo(loc.getLocNo());
+            locDetl.setLocId(loc.getLocStsId());
+            locDetl.setMatnr(pakin.getMatnr());
+            locDetl.setMemo(pakin.getMemo());
+            locDetl.setUpdateTime(new Date());
+            if (!locDetlService.save(locDetl)) {
+                throw new CoolException("搴撳瓨鏄庣粏鏇存柊澶辫触锛侊紒");
+            }
+        });
+
+        return true;
+    }
+
+//    /**
+//     * 鑾峰彇褰撳墠搴撲綅鏄惁瀛樺湪
+//     * @param shelvesParams
+//     * @return
+//     */
+//    @Override
+//    public Loc selectPakinLocs(PakinOnShelvesParams shelvesParams) {
+//        return locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, shelvesParams.getLoc()));
+//    }
+
+
 }

--
Gitblit v1.9.1