From cf73a80b2d981a22b1d22f209ecef0ad2e673a56 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 31 七月 2020 08:24:14 +0800
Subject: [PATCH] #当前本版十分完美、冻结
---
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 134 +++++++++++++++-----------------------------
1 files changed, 46 insertions(+), 88 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
index 449f616..6865d44 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -11,6 +11,7 @@
import com.zy.asrs.entity.param.LocDetlAdjustParam;
import com.zy.asrs.entity.param.StockOutParam;
import com.zy.asrs.service.*;
+import com.zy.asrs.utils.VersionUtils;
import com.zy.common.model.LocDetlDto;
import com.zy.common.model.OutLocDto;
import com.zy.common.model.StartupDto;
@@ -20,6 +21,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
+import java.util.stream.Collectors;
/**
* Created by vincent on 2020/6/11
@@ -52,8 +54,6 @@
private AdjDetlService adjDetlService;
@Autowired
private WrkMastLogService wrkMastLogService;
- @Autowired
- private WrkDetlLogService wrkDetlLogService;
@Override
@Transactional
@@ -63,11 +63,12 @@
throw new CoolException(BaseRes.PARAM);
}
// 婧愮珯鐐圭姸鎬佹娴�
- BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getDevpNo());
+ BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getDevpNo(), true);
// 鐢熸垚宸ヤ綔鍙�
int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
// 妫�绱㈠簱浣�
- StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo());
+ List<String> matNos = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatNo).distinct().collect(Collectors.toList());
+ StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matNos);
// 鐢熸垚宸ヤ綔妗�
WrkMast wrkMast = new WrkMast();
wrkMast.setWrkNo(workNo);
@@ -110,8 +111,8 @@
}
// 鏇存柊鐩爣搴撲綅鐘舵��
LocMast locMast = locMastService.selectById(dto.getLocNo());
- if (locMast.getLocType().equals("O")){
- locMast.setLocType("S"); // S.鍏ュ簱棰勭害
+ if (locMast.getLocSts().equals("O")){
+ locMast.setLocSts("S"); // S.鍏ュ簱棰勭害
locMast.setModiUser(userId);
locMast.setModiTime(new Date());
if (!locMastService.updateById(locMast)){
@@ -141,7 +142,7 @@
}
if (!locDetlDtos.isEmpty()) {
// 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
- stockOut(staNo, locDetlDtos, 101, userId);
+ stockOut(staNo, locDetlDtos, null, userId);
} else {
throw new CoolException("搴撲綅鐗╂枡涓嶅瓨鍦�");
}
@@ -169,7 +170,9 @@
// 鐢熸垚宸ヤ綔妗�
for (OutLocDto dto : dtos) {
// 鍒ゆ柇鍏ュ嚭搴撶被鍨嬶細101.鍏ㄦ澘鍑哄簱 or 103.鎷f枡鍑哄簱
- ioType = (dto.isAll() && (ioType==101||ioType==103))?101:103;
+ if (ioType == null) {
+ ioType = dto.isAll() ? 101 : 103;
+ }
// 鑾峰彇搴撲綅
LocMast locMast = locMastService.selectById(dto.getLocNo());
// 鑾峰彇璺緞
@@ -213,16 +216,9 @@
WrkDetl wrkDetl = new WrkDetl();
wrkDetl.setWrkNo(workNo);
wrkDetl.setIoTime(new Date());
- wrkDetl.setMatnr(detlDto.getLocDetl().getMatnr());
- Double anfme = ioType==101?detlDto.getCount():detlDto.getLocDetl().getAnfme();
+ Double anfme = ioType==101?detlDto.getLocDetl().getAnfme():detlDto.getCount();
wrkDetl.setAnfme(anfme); // 鏁伴噺
- wrkDetl.setZmatid(detlDto.getLocDetl().getZmatid());
- wrkDetl.setTbpos(detlDto.getLocDetl().getTbpos());
- wrkDetl.setTbnum(detlDto.getLocDetl().getTbnum());
- wrkDetl.setLgnum(detlDto.getLocDetl().getLgnum());
- wrkDetl.setAltme(detlDto.getLocDetl().getAltme());
- wrkDetl.setBname(detlDto.getLocDetl().getBname());
- wrkDetl.setMaktx(detlDto.getLocDetl().getMaktx());
+ VersionUtils.setWrkDetl(wrkDetl, detlDto.getLocDetl()); // 鐗堟湰鎺у埗
wrkDetl.setAppeTime(new Date());
wrkDetl.setAppeUser(userId);
wrkDetl.setModiTime(new Date());
@@ -233,8 +229,8 @@
}
// 淇敼搴撲綅鐘舵��: F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓�
locMast = locMastService.selectById(dto.getLocNo());
- if (locMast.getLocType().equals("F")) {
- locMast.setLocType(ioType==101?"R":"P");
+ if (locMast.getLocSts().equals("F")) {
+ locMast.setLocSts(ioType==101?"R":"P");
locMast.setModiUser(userId);
locMast.setModiTime(new Date());
if (!locMastService.updateById(locMast)) {
@@ -250,11 +246,11 @@
@Transactional
public String emptyPlateIn(Integer devpNo, Long userId) {
// 婧愮珯鐐圭姸鎬佹娴�
- BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo);
+ BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
// 鐢熸垚宸ヤ綔鍙�
int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
// 妫�绱㈠簱浣�
- StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo);
+ StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null);
// 鐢熸垚宸ヤ綔妗�
WrkMast wrkMast = new WrkMast();
wrkMast.setWrkNo(workNo);
@@ -290,8 +286,8 @@
}
// 鏇存柊鐩爣搴撲綅鐘舵��
LocMast locMast = locMastService.selectById(dto.getLocNo());
- if (locMast.getLocType().equals("O")){
- locMast.setLocType("S"); // S.鍏ュ簱棰勭害
+ if (locMast.getLocSts().equals("O")){
+ locMast.setLocSts("S"); // S.鍏ュ簱棰勭害
locMast.setModiUser(userId);
locMast.setModiTime(new Date());
if (!locMastService.updateById(locMast)){
@@ -352,8 +348,8 @@
throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
}
// 鏇存柊搴撲綅鐘舵�� D.绌烘澘 -> R.鍑哄簱棰勭害
- if (locMast.getLocType().equals("D")){
- locMast.setLocType("R");
+ if (locMast.getLocSts().equals("D")){
+ locMast.setLocSts("R");
locMast.setModiUser(userId);
locMast.setModiTime(new Date());
if (!locMastService.updateById(locMast)) {
@@ -417,7 +413,8 @@
wrkMast.setFullPlt("N"); // 婊℃澘锛歒
wrkMast.setPicking("N"); // 鎷f枡
wrkMast.setExitMk("N"); // 閫�鍑�
- wrkMast.setEmptyMk(sourceLoc.getLocType().equals("D")?"Y":"N"); // 绌烘澘
+ wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D")?"Y":"N"); // 绌烘澘
+ wrkMast.setBarcode(sourceLoc.getBarcode()); // 鎵樼洏鐮�
wrkMast.setLinkMis("N");
wrkMast.setAppeUser(userId);
wrkMast.setAppeTime(new Date());
@@ -433,15 +430,8 @@
WrkDetl wrkDetl = new WrkDetl();
wrkDetl.setWrkNo(workNo);
wrkDetl.setIoTime(new Date());
- wrkDetl.setMatnr(locDetl.getMatnr());
wrkDetl.setAnfme(locDetl.getAnfme());
- wrkDetl.setZmatid(locDetl.getZmatid());
- wrkDetl.setTbpos(locDetl.getTbpos());
- wrkDetl.setTbnum(locDetl.getTbnum());
- wrkDetl.setLgnum(locDetl.getLgnum());
- wrkDetl.setAltme(locDetl.getAltme());
- wrkDetl.setBname(locDetl.getBname());
- wrkDetl.setMaktx(locDetl.getMaktx());
+ VersionUtils.setWrkDetl(wrkDetl, locDetl); // 鐗堟湰鎺у埗
wrkDetl.setAppeTime(new Date());
wrkDetl.setAppeUser(userId);
wrkDetl.setModiTime(new Date());
@@ -451,26 +441,26 @@
}
}
// 淇敼婧愬簱浣嶇姸鎬�
- if (sourceLoc.getLocType().equals("D") || sourceLoc.getLocType().equals("F")) {
- sourceLoc.setLocType("R"); // R.鍑哄簱棰勭害
+ if (sourceLoc.getLocSts().equals("D") || sourceLoc.getLocSts().equals("F")) {
+ sourceLoc.setLocSts("R"); // R.鍑哄簱棰勭害
sourceLoc.setModiUser(userId);
sourceLoc.setModiTime(new Date());
if (!locMastService.updateById(sourceLoc)){
throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
}
} else {
- throw new CoolException("婧愬簱浣嶅嚭搴撳け璐ワ紝鐘舵�侊細"+sourceLoc.getLocType$());
+ throw new CoolException("婧愬簱浣嶅嚭搴撳け璐ワ紝鐘舵�侊細"+sourceLoc.getLocSts$());
}
// 淇敼鐩爣搴撲綅鐘舵��
- if (loc.getLocType().equals("O")) {
- loc.setLocType("S"); // S.鍏ュ簱棰勭害
+ if (loc.getLocSts().equals("O")) {
+ loc.setLocSts("S"); // S.鍏ュ簱棰勭害
loc.setModiTime(new Date());
loc.setModiUser(userId);
if (!locMastService.updateById(loc)) {
throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
}
} else {
- throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細"+loc.getLocType$());
+ throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細"+loc.getLocSts$());
}
}
@@ -521,17 +511,8 @@
MatCode matCode = matCodeService.selectById(adjust.getMatnr());
LocDetl locDetl = new LocDetl();
locDetl.setLocNo(locMast.getLocNo());
- locDetl.setMatnr(matCode.getMatNo());
- locDetl.setMaktx(matCode.getMatName()); // 鐗╂枡鎻忚堪
locDetl.setAnfme(adjust.getCount()); // 鏁伴噺
- locDetl.setAltme(matCode.getStr1()); // 鍗曚綅
- // todo:luxiaoao
- locDetl.setLgnum("寰呭畾"); // 浠撳簱鍙�
- locDetl.setTbnum(0); // 杞偍璇锋眰缂栧彿
- locDetl.setTbpos(0); // 琛岄」鐩�
- locDetl.setZmatid("寰呭畾"); // 鐗╂枡鏍囩ID
- locDetl.setZpallet("寰呭畾"); // 鎵樼洏鏉$爜
-
+ VersionUtils.setLocDetl(locDetl, matCode); // 鐗堟湰鎺у埗
locDetl.setModiUser(userId); // 鎿嶄綔浜哄憳淇℃伅
locDetl.setModiTime(new Date());
locDetl.setAppeUser(userId);
@@ -586,11 +567,11 @@
throw new CoolException(workNo+"宸ヤ綔妗d笉瀛樺湪");
}
String locNo = ""; // 寰呬慨鏀圭洰鏍囧簱浣�
- String locType = ""; // 寰呬慨鏀圭洰鏍囧簱浣嶇姸鎬�
+ String locSts = ""; // 寰呬慨鏀圭洰鏍囧簱浣嶇姸鎬�
// 鍏ュ簱鍙栨秷锛堜慨鏀圭洰鏍囧簱浣嶏級
if (wrkMast.getWrkSts() < 4) {
locNo = wrkMast.getLocNo();
- locType = "O";
+ locSts = "O";
/**
* 搴撲綅杞Щ
* 鍙栨秷鍚� 婧愬簱浣� ==>> F.鍦ㄥ簱
@@ -602,7 +583,7 @@
if (Cools.isEmpty(locMast)) {
throw new CoolException("鍙栨秷搴撲綅杞Щ澶辫触锛屾簮搴撲綅涓嶅瓨鍦�:"+ wrkMast.getSourceLocNo());
}
- locMast.setLocType("F");
+ locMast.setLocSts("F");
locMast.setModiTime(new Date());
locMast.setModiUser(userId);
locMastService.updateById(locMast);
@@ -612,19 +593,19 @@
locNo = wrkMast.getSourceLocNo();
// 鍑哄簱 ===>> F.鍦ㄥ簱
if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) {
- locType = "F";
+ locSts = "F";
// 绌烘澘鍑哄簱 ===>> D.绌烘《/绌烘爤鏉�
} else if (wrkMast.getIoType() == 110) {
- locType = "D";
+ locSts = "D";
// 搴撲綅杞Щ ===>> D.绌烘《/绌烘爤鏉�
} else if (wrkMast.getIoType() == 11) {
- locType = "F";
+ locSts = "F";
// 搴撲綅杞Щ锛氱洰鏍囧簱浣�
LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
if (Cools.isEmpty(locMast)) {
throw new CoolException("鍙栨秷搴撲綅杞Щ澶辫触锛岀洰鏍囧簱浣嶄笉瀛樺湪:"+ wrkMast.getSourceLocNo());
}
- locMast.setLocType("O");
+ locMast.setLocSts("O");
locMast.setModiTime(new Date());
locMast.setModiUser(userId);
locMastService.updateById(locMast);
@@ -641,7 +622,7 @@
if (Cools.isEmpty(locMast)) {
throw new CoolException("鍙栨秷宸ヤ綔妗eけ璐ワ紝搴撲綅涓嶅瓨鍦�:"+ locNo);
}
- locMast.setLocType(locType);
+ locMast.setLocSts(locSts);
locMast.setModiTime(new Date());
locMast.setModiUser(userId);
boolean locMastRes = locMastService.updateById(locMast);
@@ -657,23 +638,17 @@
if (Cools.isEmpty(wrkMast)){
throw new CoolException(workNo+"宸ヤ綔妗d笉瀛樺湪");
}
- List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
- String locNo = wrkMast.getSourceLocNo();
- // 鎷f枡浣滀笟鍒ゆ柇
- if (wrkMast.getIoType() != 103) {
- throw new CoolException("鍏ュ嚭搴撶被鍨嬩笉鏄�103.鎷f枡鍑哄簱");
+ // 鍏ュ嚭搴撶被鍨嬪垽鏂�
+ if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) {
+ throw new CoolException("褰撳墠鍏ュ嚭搴撶被鍨嬫棤娉曡繘琛屾搷浣�");
}
// 宸ヤ綔鐘舵�佸垽鏂�
if (wrkMast.getWrkSts() < 11 || wrkMast.getWrkSts() == 15) {
- throw new CoolException("褰撳墠宸ヤ綔鐘舵�佷笉鑳芥嫞鏂欏叆搴�");
+ throw new CoolException("褰撳墠宸ヤ綔鐘舵�佹棤娉曡繘琛屾搷浣�");
}
// 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
// if (!wrkDetlLogService.save(wrkMast.getWrkNo())) {
// throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
-// }
- // 鍒犻櫎宸ヤ綔鏄庣粏妗�
-// if (!wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()))) {
-// throw new CoolException("鍒犻櫎宸ヤ綔鏄庣粏妗f。鍘嗗彶妗eけ璐�");
// }
// 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
if (!wrkMastLogService.save(wrkMast.getWrkNo())) {
@@ -681,7 +656,7 @@
}
// 鑾峰彇鐩爣绔�
Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
- .eq("type_no", 53) // type_no: 53.鎷f枡鍐嶅叆搴�
+ .eq("type_no", wrkMast.getIoType() - 50)
.eq("stn_no", wrkMast.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
.eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
StaDesc staDesc = staDescService.selectOne(wrapper);
@@ -691,7 +666,7 @@
// 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
Integer staNo = staDesc.getCrnStn();
// 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
- wrkMast.setIoType(53); // 鍏ュ嚭搴撶被鍨�: 53.鎷f枡鍐嶅叆搴�
+ wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯
wrkMast.setStaNo(staNo); // 鐩爣绔�
@@ -702,26 +677,9 @@
if (!wrkMastService.updateById(wrkMast)) {
throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
}
-// // 鏇存柊/鍒犻櫎鎷f枡搴撳瓨鏄庣粏
-// for (WrkDetl wrkDetl : wrkDetls) {
-// LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locNo).eq("matnr", wrkDetl.getMatnr()));
-// // 搴撳瓨鏁伴噺璁$畻
-// locDetl.setAnfme(locDetl.getAnfme() - wrkDetl.getAnfme());
-// if (locDetl.getAnfme() > 0) {
-// locDetl.setModiTime(new Date());
-// locDetl.setModiUser(userId);
-// if (!locDetlService.updateById(locDetl)) {
-// throw new CoolException("鏇存柊搴撳瓨鏄庣粏澶辫触");
-// }
-// } else {
-// if (!locDetlService.delete(new EntityWrapper<>(locDetl))) {
-// throw new CoolException("鍒犻櫎搴撳瓨鏄庣粏澶辫触");
-// }
-// }
-// }
// 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
- locMast.setLocType("Q");
+ locMast.setLocSts("Q");
locMast.setModiTime(new Date());
locMast.setModiUser(userId);
if (!locMastService.updateById(locMast)) {
--
Gitblit v1.9.1