From 7182f72ba4781c620eebdf501ca46b3f69f5585d Mon Sep 17 00:00:00 2001
From: wang..123 <brook_w@163.com>
Date: 星期二, 15 二月 2022 11:11:09 +0800
Subject: [PATCH] 字段添加完成,测试完成

---
 src/main/java/com/zy/common/web/WcsController.java |   42 +++++++++++++++++++++++++++++++-----------
 1 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/zy/common/web/WcsController.java b/src/main/java/com/zy/common/web/WcsController.java
index eb0a9a9..d8fcf6a 100644
--- a/src/main/java/com/zy/common/web/WcsController.java
+++ b/src/main/java/com/zy/common/web/WcsController.java
@@ -1,6 +1,7 @@
 package com.zy.common.web;
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.core.common.Cools;
 import com.core.common.R;
 import com.core.exception.CoolException;
@@ -10,6 +11,7 @@
 import com.zy.common.model.StartupDto;
 import com.zy.common.service.CommonService;
 import com.zy.common.web.param.SearchLocParam;
+import lombok.Synchronized;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -42,6 +44,8 @@
     private WaitPakinService waitPakinService;
     @Autowired
     private  LocDetlService locDetlService;
+    @Autowired
+    private PltBarcodeService pltBarcodeService;
 
     @PostMapping("/pakin/loc/v1")
     @ResponseBody
@@ -52,13 +56,13 @@
         if (Cools.isEmpty(param.getSourceStaNo())) {
             return R.error("婧愮珯缂栧彿涓嶈兘涓虹┖");
         }
-        List<WaitPakin> waitPakins = null;
+        List<PltBarcode> pltBarcodes = null;
         if (param.getIoType() == 1) {
             if (Cools.isEmpty(param.getBarcode())) {
                 return R.error("鏉$爜涓嶈兘涓虹┖");
             }
-            waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
-            if (Cools.isEmpty(waitPakins)) {
+            pltBarcodes = pltBarcodeService.selectList(new EntityWrapper<PltBarcode>().eq("barcode", param.getBarcode()));
+            if (Cools.isEmpty(pltBarcodes)) {
                 return R.error("鏉$爜鏁版嵁閿欒");
             }
             int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode()));
@@ -71,13 +75,20 @@
             return R.error("楂樹綆妫�娴嬩俊鍙蜂笉鑳戒负绌�");
         }
 
-        LocTypeDto locTypeDto = new LocTypeDto();
+
+        // 婧愮珯鐐圭姸鎬佹娴�
+        BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), true);
+        if (Cools.isEmpty(sourceStaNo)){
+            return R.error("鍏ュ簱绔欑偣涓嶅瓨鍦�");
+        }
+        sourceStaNo.setLocType1(param.getLocType1());
+        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
         locTypeDto.setLocType1(param.getLocType1());
 
         StartupDto dto = null;
         switch (param.getIoType()) {
             case 1:
-                dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, waitPakins);
+                dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, pltBarcodes);
                 break;
             case 10:
                 dto = emptyPlateIn(param.getSourceStaNo(), locTypeDto);
@@ -93,12 +104,12 @@
      * 鍏ㄦ澘鍏ュ簱 todo:luxiaotao 1.鐣欏嚭涓浆搴撲綅
      */
     @Transactional
-    public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<WaitPakin> waitPakins) {
+    public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<PltBarcode> pltBarcodes) {
         // 婧愮珯鐐圭姸鎬佹娴�
         BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
         // 妫�绱㈠簱浣�
-        List<String> matNos = waitPakins.stream().map(WaitPakin::getMatNo).distinct().collect(Collectors.toList());
-        StartupDto dto = commonService.getLocNo(null, 1, devpNo, matNos, locTypeDto);
+        List<String> matNos = pltBarcodes.stream().map(PltBarcode::getMatNo).distinct().collect(Collectors.toList());
+        StartupDto dto = commonService.getLocNo(1, 1, devpNo, false, matNos, locTypeDto,0);
         int workNo = dto.getWorkNo();
 
         // 鐢熸垚宸ヤ綔妗�
@@ -128,8 +139,16 @@
         }
         // 鐢熸垚宸ヤ綔妗f槑缁�
         List<MatCodeCountDto> matDtos = new ArrayList<>();
-        waitPakins.forEach(elem -> {
-            matDtos.add(new MatCodeCountDto(elem.getMatnr(), elem.getAnfme(),elem.getColor()));
+        pltBarcodes.forEach(elem -> {
+            matDtos.add(new MatCodeCountDto(elem.getBillNo(), elem.getSeqNo(), elem.getMatNo(), null, elem.getQty(),elem.getSource(),elem.getVendor()));
+
+            //鏇存柊缁勬墭鏁版嵁鐘舵�佷负鍏ュ簱涓�
+            Wrapper<PltBarcode> wrapper = new EntityWrapper<PltBarcode>().eq("barcode", elem.getBarcode())
+                    .eq("bill_no", elem.getBillNo()).eq("seq_no", elem.getSeqNo()).eq("mat_no", elem.getMatNo());
+            PltBarcode pltBarcode = pltBarcodeService.selectOne(wrapper);
+            pltBarcode.setLocNo(dto.getLocNo());
+            pltBarcode.setIoStatus(1);//鍏ュ簱涓�
+            pltBarcodeService.update(pltBarcode,wrapper);
         });
         wrkDetlService.createWorkDetail(workNo, matDtos, barcode, null);
         // 鏇存柊婧愮珯鐐逛俊鎭�
@@ -152,12 +171,13 @@
         return dto;
     }
 
+    @Synchronized
     @Transactional
     public StartupDto emptyPlateIn(Integer devpNo, LocTypeDto locTypeDto) {
         // 婧愮珯鐐圭姸鎬佹娴�
         BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
         // 妫�绱㈠簱浣�
-        StartupDto dto = commonService.getLocNo(null, 10, devpNo, null, locTypeDto);
+        StartupDto dto = commonService.getLocNo(1, 10, devpNo, true, null, locTypeDto,0);
         int workNo = dto.getWorkNo();
         // 鐢熸垚宸ヤ綔妗�
         WrkMast wrkMast = new WrkMast();

--
Gitblit v1.9.1