From e72f4946b1696a570022d6ae715fa07656ab89f7 Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期三, 27 九月 2023 13:07:43 +0800
Subject: [PATCH] Merge branch 'tzskasrs' of http://47.97.1.152:5880/r/zy-asrs into tzskasrs
---
src/main/java/com/zy/common/web/WcsController.java | 88 +++++++++++++++++++++++++++----------------
1 files changed, 55 insertions(+), 33 deletions(-)
diff --git a/src/main/java/com/zy/common/web/WcsController.java b/src/main/java/com/zy/common/web/WcsController.java
index c73aa69..c14495a 100644
--- a/src/main/java/com/zy/common/web/WcsController.java
+++ b/src/main/java/com/zy/common/web/WcsController.java
@@ -1,5 +1,6 @@
package com.zy.common.web;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.R;
import com.core.exception.CoolException;
@@ -9,12 +10,15 @@
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.StartupDto;
import com.zy.common.service.CommonService;
+import com.zy.common.service.erp.ErpService;
+import com.zy.common.service.erp.entity.Goods;
import com.zy.common.web.param.SearchLocParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -44,6 +48,8 @@
private LocDetlService locDetlService;
@Autowired
private MatService matService;
+ @Autowired
+ private ErpService erpService;
@PostMapping("/pakin/loc/v1")
@ResponseBody
@@ -54,29 +60,43 @@
if (Cools.isEmpty(param.getSourceStaNo())) {
return R.error("婧愮珯缂栧彿涓嶈兘涓虹┖");
}
-// List<WaitPakin> waitPakins = null;
- Mat mat = null;
+ List<WaitPakin> waitPakins = null;
+ ArrayList<Mat> mats = new ArrayList<>();
if (param.getIoType() == 1) {
if (Cools.isEmpty(param.getBarcode())) {
return R.error("鏉$爜涓嶈兘涓虹┖");
}
- mat = matService.selectByMatnr(param.getBarcode());
- if (Cools.isEmpty(mat)) {
- return R.error(param.getBarcode() + "缂栫爜鍟嗗搧璧勬枡涓嶅瓨鍦紝璇峰厛娣诲姞");
+// Goods goods = erpService.selectGoodsOne(param.getBarcode());
+// if (Cools.isEmpty(goods)) {
+// return R.error(param.getBarcode() + "鏉$爜涓嶅瓨鍦紝璇锋鏌RP鏁版嵁锛�");
+// } else {
+// erpService.updateStateForGoods(param.getBarcode(), 2);
+// }
+// mat = matService.selectByMatnr(goods.getMaterialNO());
+// if (Cools.isEmpty(mat)) {
+// return R.error(goods.getMaterialNO() + "鏉$爜鍟嗗搧璧勬枡涓嶅瓨鍦紝璇峰厛娣诲姞锛�");
+// }
+ waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
+
+ if (Cools.isEmpty(waitPakins)) {
+ WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
+ if (wrkMast != null && (wrkMast.getIoType() == 103 || wrkMast.getIoType() == 104 || wrkMast.getIoType() == 107)) {
+ return R.parse(CodeRes.PICK_600);
+ }
+ return R.parse(CodeRes.NO_COMB_700);
}
-// waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
-// if (Cools.isEmpty(waitPakins)) {
-// WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
-// if (wrkMast != null && (wrkMast.getIoType() == 103 || wrkMast.getIoType() == 104 || wrkMast.getIoType() == 107)) {
-// return R.parse(CodeRes.PICK_600);
-// }
-// return R.parse(CodeRes.NO_COMB_700);
-// }
-// int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode()));
-// int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode()));
-// if (countLoc > 0 || countWrk > 0) {
-// return R.error("宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�");
-// }
+
+ for (WaitPakin waitPakin : waitPakins) {
+ Mat mat = matService.selectByMatnr(waitPakin.getMatnr());
+ mat.setWeight(waitPakin.getAnfme());
+ mats.add(mat);
+ }
+
+ int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode()));
+ int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode()));
+ if (countLoc > 0 || countWrk > 0) {
+ return R.error("宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�");
+ }
}
// if (Cools.isEmpty(param.getLocType1())){
// return R.error("楂樹綆妫�娴嬩俊鍙蜂笉鑳戒负绌�");
@@ -89,8 +109,7 @@
StartupDto dto = null;
switch (param.getIoType()) {
case 1://婊℃墭鐩樺叆搴�
- assert mat != null;
- dto = startupFullPutStore(param.getSourceStaNo(), null, locTypeDto, mat);
+ dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, mats);
break;
case 10://绌烘墭鐩樺叆搴�
dto = emptyPlateIn(param.getSourceStaNo(), locTypeDto, null);
@@ -112,11 +131,10 @@
* 鍏ㄦ澘鍏ュ簱
*/
@Transactional
- public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, Mat mat) {
+ public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<Mat> mats) {
// 婧愮珯鐐圭姸鎬佹娴�
BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
// 妫�绱㈠簱浣�
- List<Mat> mats = Collections.singletonList(mat);
List<String> matnrList = mats.stream().map(Mat::getMatnr).distinct().collect(Collectors.toList());
StartupDto dto = commonService.getLocNo(1, 1, devpNo, matnrList, locTypeDto,0);
int workNo = dto.getWorkNo();
@@ -148,17 +166,21 @@
if (!res) {
throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
}
- // 鐢熸垚宸ヤ綔妗f槑缁�
- WrkDetl wrkDetl = new WrkDetl();
- wrkDetl.sync(mat);
- wrkDetl.setAnfme(1.0D);
- wrkDetl.setWrkNo(wrkMast.getWrkNo());
- wrkDetl.setIoTime(wrkMast.getIoTime());
- wrkDetl.setAppeTime(now);
- wrkDetl.setModiTime(now);
- if (!wrkDetlService.insert(wrkDetl)) {
- throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
+ for (Mat mat : mats) {
+ // 鐢熸垚宸ヤ綔妗f槑缁�
+ WrkDetl wrkDetl = new WrkDetl();
+ wrkDetl.sync(mat);
+ wrkDetl.setAnfme(mat.getWeight());
+ wrkDetl.setZpallet(barcode);
+ wrkDetl.setWrkNo(wrkMast.getWrkNo());
+ wrkDetl.setIoTime(wrkMast.getIoTime());
+ wrkDetl.setAppeTime(now);
+ wrkDetl.setModiTime(now);
+ if (!wrkDetlService.insert(wrkDetl)) {
+ throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
+ }
}
+
// // 鏇存柊鍏ュ簱閫氱煡妗� ioStatus ===>> Y
// Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
// .eq("zpallet", barcode);
@@ -255,7 +277,7 @@
throw new CoolException(CodeRes.NONE_DETL_900);
}
// 妫�绱㈠簱浣�
- List<String> matnrList = wrkDetls.stream().map(WrkDetl::getMatnr).distinct().collect(Collectors.toList());
+ List<String> matnrList = wrkDetls.stream().map(WrkDetl::getMaktx).distinct().collect(Collectors.toList());
return commonService.getLocNo(1, ioType - 50, devpNo, matnrList, locTypeDto,0); // 搴撲綅鍙凤紝 鍫嗗灈鏈猴紝鐩爣绔�
}
--
Gitblit v1.9.1