From 34ecb595b36765479e0acf770e6774a0f6a32cca Mon Sep 17 00:00:00 2001
From: zhangchao <zc857179121@qq.com>
Date: 星期四, 05 九月 2024 15:59:42 +0800
Subject: [PATCH] 批次显示
---
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 184 ++++++++++++++++++++++++++-------------------
1 files changed, 106 insertions(+), 78 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 f4a0121..04d1ad5 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -91,7 +91,8 @@
// 妫�绱㈠簱浣�
LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
List<String> matnrs = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatnr).distinct().collect(Collectors.toList());
- StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs, locTypeDto, 0);
+ List<String> batchs = param.getList().stream().map(FullStoreParam.MatCodeStore::getBatch).distinct().collect(Collectors.toList());
+ StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs.get(0), batchs.get(0), null, locTypeDto);
// 鐢熸垚宸ヤ綔鍙�
int workNo = dto.getWorkNo();
// 鐢熸垚宸ヤ綔妗�
@@ -136,20 +137,20 @@
sourceStaNo.setWrkNo(workNo);
sourceStaNo.setModiUser(userId);
sourceStaNo.setModiTime(now);
- if (!basDevpService.updateById(sourceStaNo)){
+ if (!basDevpService.updateById(sourceStaNo)) {
throw new CoolException("鏇存柊婧愮珯澶辫触");
}
// 鏇存柊鐩爣搴撲綅鐘舵��
LocMast locMast = locMastService.selectById(dto.getLocNo());
- if (locMast.getLocSts().equals("O")){
+ if (locMast.getLocSts().equals("O")) {
locMast.setLocSts("S"); // S.鍏ュ簱棰勭害
locMast.setModiUser(userId);
locMast.setModiTime(now);
- if (!locMastService.updateById(locMast)){
+ if (!locMastService.updateById(locMast)) {
throw new CoolException("鏀瑰彉搴撲綅鐘舵�佸け璐�");
}
} else {
- throw new CoolException(dto.getLocNo()+"鐩爣搴撲綅宸茶鍗犵敤");
+ throw new CoolException(dto.getLocNo() + "鐩爣搴撲綅宸茶鍗犵敤");
}
return dto.getLocNo();
}
@@ -169,11 +170,11 @@
}
if (!locDetlDtos.isEmpty()) {
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo()));
- if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") ){
+ if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D")) {
// 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
stockOut(staNo, locDetlDtos, null, userId);
- }else {
- throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎銆丏鐨勫簱浣嶏紝搴撲綅鍙凤細"+locMast.getLocNo()+" 銆佸綋鍓嶇姸鎬侊細"+locMast.getLocSts()+"-"+locMast.getLocSts$());
+ } else {
+ throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎銆丏鐨勫簱浣嶏紝搴撲綅鍙凤細" + locMast.getLocNo() + " 銆佸綋鍓嶇姸鎬侊細" + locMast.getLocSts() + "-" + locMast.getLocSts$());
}
} else {
throw new CoolException("搴撳瓨涓嶅瓨鍦�");
@@ -246,17 +247,19 @@
wrkMast.setModiUser(userId);
wrkMast.setModiTime(now);
if (!wrkMastService.insert(wrkMast)) {
- throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鍑哄簱搴撲綅鍙凤細"+dto.getLocNo());
+ throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鍑哄簱搴撲綅鍙凤細" + dto.getLocNo());
}
// 鐢熸垚宸ヤ綔妗f槑缁�
for (LocDetlDto detlDto : dto.getLocDetlDtos()) {
- if (detlDto.getCount()==null || detlDto.getCount() <= 0.0D) {continue;}
+ if (detlDto.getCount() == null || detlDto.getCount() <= 0.0D) {
+ continue;
+ }
WrkDetl wrkDetl = new WrkDetl();
wrkDetl.sync(detlDto.getLocDetl());
wrkDetl.setOrderNo(""); // 鎵嬪姩鍑哄簱涓嶉渶瑕佸甫鍑哄簱瀛樹腑鐨勫崟鎹紪鍙�
wrkDetl.setWrkNo(workNo);
wrkDetl.setIoTime(now);
- Double anfme = ioType==101?detlDto.getLocDetl().getAnfme():detlDto.getCount();
+ Double anfme = ioType == 101 ? detlDto.getLocDetl().getAnfme() : detlDto.getCount();
wrkDetl.setAnfme(anfme); // 鏁伴噺
wrkDetl.setAppeTime(now);
wrkDetl.setAppeUser(userId);
@@ -269,11 +272,11 @@
// 淇敼搴撲綅鐘舵��: F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓�
locMast = locMastService.selectById(dto.getLocNo());
if (locMast.getLocSts().equals("F")) {
- locMast.setLocSts(ioType==101?"R":"P");
+ locMast.setLocSts(ioType == 101 ? "R" : "P");
locMast.setModiUser(userId);
locMast.setModiTime(now);
if (!locMastService.updateById(locMast)) {
- throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細"+dto.getLocNo());
+ throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細" + dto.getLocNo());
}
} else {
throw new CoolException(dto.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
@@ -320,21 +323,24 @@
wrkMast.setModiUser(userId);
wrkMast.setModiTime(now);
if (!wrkMastService.insert(wrkMast)) {
- throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鍑哄簱搴撲綅鍙凤細"+taskDto.getLocNo());
+ throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鍑哄簱搴撲綅鍙凤細" + taskDto.getLocNo());
}
// 鐢熸垚宸ヤ綔妗f槑缁�
for (LocDto locDto : taskDto.getLocDtos()) {
- if (locDto.getAnfme()==null || locDto.getAnfme() <= 0.0D) { continue; }
- OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch());
+ if (locDto.getAnfme() == null || locDto.getAnfme() <= 0.0D) {
+ continue;
+ }
+ log.info("宸ヤ綔妗f槑缁嗭細{},{},{},{}", locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch(),locDto.getAnfme());
+ OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch(), locDto.getAnfme());
if (orderDetl == null) {
- orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null);
+ orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null, locDto.getAnfme());
}
WrkDetl wrkDetl = new WrkDetl();
wrkDetl.sync(orderDetl);
wrkDetl.setZpallet(wrkMast.getBarcode());
wrkDetl.setIoTime(now);
wrkDetl.setWrkNo(workNo);
- wrkDetl.setBatch(locDto.getBatch());
+ //wrkDetl.setBatch(locDto.getBatch());
wrkDetl.setOrderNo(locDto.getOrderNo());
wrkDetl.setAnfme(locDto.getAnfme()); // 鏁伴噺
wrkDetl.setAppeTime(now);
@@ -353,11 +359,11 @@
// 淇敼搴撲綅鐘舵��: F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓�
locMast = locMastService.selectById(taskDto.getLocNo());
if (locMast.getLocSts().equals("F")) {
- locMast.setLocSts(ioType==101?"R":"P");
+ locMast.setLocSts(ioType == 101 ? "R" : "P");
locMast.setModiUser(userId);
locMast.setModiTime(now);
if (!locMastService.updateById(locMast)) {
- throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細"+taskDto.getLocNo());
+ throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細" + taskDto.getLocNo());
}
} else {
throw new CoolException(taskDto.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
@@ -371,7 +377,7 @@
BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
// 妫�绱㈠簱浣�
LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
- StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, locTypeDto, 0);
+ StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, null, null, locTypeDto);
int workNo = dto.getWorkNo();
Date now = new Date();
// 鐢熸垚宸ヤ綔妗�
@@ -404,20 +410,20 @@
sourceStaNo.setWrkNo(workNo);
sourceStaNo.setModiUser(userId);
sourceStaNo.setModiTime(now);
- if (!basDevpService.updateById(sourceStaNo)){
+ if (!basDevpService.updateById(sourceStaNo)) {
throw new CoolException("鏇存柊婧愮珯澶辫触");
}
// 鏇存柊鐩爣搴撲綅鐘舵��
LocMast locMast = locMastService.selectById(dto.getLocNo());
- if (locMast.getLocSts().equals("O")){
+ if (locMast.getLocSts().equals("O")) {
locMast.setLocSts("S"); // S.鍏ュ簱棰勭害
locMast.setModiUser(userId);
locMast.setModiTime(now);
- if (!locMastService.updateById(locMast)){
+ if (!locMastService.updateById(locMast)) {
throw new CoolException("鏀瑰彉搴撲綅鐘舵�佸け璐�");
}
} else {
- throw new CoolException(dto.getLocNo()+"鐩爣搴撲綅宸茶鍗犵敤");
+ throw new CoolException(dto.getLocNo() + "鐩爣搴撲綅宸茶鍗犵敤");
}
return dto.getLocNo();
}
@@ -434,10 +440,10 @@
// 鑾峰彇搴撲綅
LocMast locMast = locMastService.selectById(locNo);
if (Cools.isEmpty(locMast)) {
- throw new CoolException(locNo+"搴撲綅涓嶅瓨鍦�");
+ throw new CoolException(locNo + "搴撲綅涓嶅瓨鍦�");
}
- if (!locMast.getLocSts().equals("D")){
- throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篋鐨勫簱浣嶏紝搴撲綅鍙凤細"+locMast.getLocNo()+" 銆佸綋鍓嶇姸鎬侊細"+locMast.getLocSts()+"-"+locMast.getLocSts$());
+ if (!locMast.getLocSts().equals("D")) {
+ throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篋鐨勫簱浣嶏紝搴撲綅鍙凤細" + locMast.getLocNo() + " 銆佸綋鍓嶇姸鎬侊細" + locMast.getLocSts() + "-" + locMast.getLocSts$());
}
// 鑾峰彇婧愮珯
Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
@@ -475,7 +481,7 @@
throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
}
// 鏇存柊搴撲綅鐘舵�� D.绌烘澘 -> R.鍑哄簱棰勭害
- if (locMast.getLocSts().equals("D")){
+ if (locMast.getLocSts().equals("D")) {
locMast.setLocSts("R");
locMast.setModiUser(userId);
locMast.setModiTime(now);
@@ -499,7 +505,7 @@
// 鑾峰彇搴撲綅
LocMast locMast = locMastService.selectById(locNo);
if (Cools.isEmpty(locMast)) {
- throw new CoolException(locNo+"搴撲綅涓嶅瓨鍦�");
+ throw new CoolException(locNo + "搴撲綅涓嶅瓨鍦�");
}
// 鑾峰彇婧愮珯
Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
@@ -538,7 +544,7 @@
throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
}
// 鏇存柊搴撲綅鐘舵�� D.绌烘澘 -> R.鍑哄簱棰勭害
- if (locMast.getLocSts().equals("D")){
+ if (locMast.getLocSts().equals("D")) {
locMast.setLocSts("R");
locMast.setModiUser(1L);
locMast.setModiTime(now);
@@ -565,11 +571,11 @@
}
if (!locDetlDtos.isEmpty()) {
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo()));
- if (locMast.getLocSts().equals("F")){
+ if (locMast.getLocSts().equals("F")) {
// 鍚姩鍑哄簱寮�濮� 107.鐩樼偣鍑哄簱
stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId);
- }else {
- throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎鐨勫簱浣嶏紝搴撲綅鍙凤細"+locMast.getLocNo()+" 銆佸綋鍓嶇姸鎬侊細"+locMast.getLocSts()+"-"+locMast.getLocSts$());
+ } else {
+ throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎鐨勫簱浣嶏紝搴撲綅鍙凤細" + locMast.getLocNo() + " 銆佸綋鍓嶇姸鎬侊細" + locMast.getLocSts() + "-" + locMast.getLocSts$());
}
} else {
throw new CoolException("搴撲綅鐗╂枡涓嶅瓨鍦�");
@@ -581,14 +587,14 @@
public void locMove(String sourceLocNo, String locNo, Long userId) {
LocMast sourceLoc = locMastService.selectById(sourceLocNo);
List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", sourceLocNo));
- if (Cools.isEmpty(sourceLoc)){
+ if (Cools.isEmpty(sourceLoc)) {
throw new CoolException("鏈壘鍒板簱浣�");
}
LocMast loc = locMastService.selectById(locNo);
- if (Cools.isEmpty(loc)){
+ if (Cools.isEmpty(loc)) {
throw new CoolException("鏈壘鍒板簱浣�");
}
- if (!loc.getLocSts().equals("O") || (!sourceLoc.getLocSts().equals("F") && !sourceLoc.getLocSts().equals("D"))){
+ if (!loc.getLocSts().equals("O") || (!sourceLoc.getLocSts().equals("F") && !sourceLoc.getLocSts().equals("D"))) {
throw new CoolException("搴撲綅鐘舵�佸凡鏀瑰彉");
}
if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) {
@@ -607,10 +613,10 @@
wrkMast.setCrnNo(sourceLoc.getCrnNo());
wrkMast.setSourceLocNo(sourceLocNo); // 婧愬簱浣�
wrkMast.setLocNo(locNo); // 鐩爣搴撲綅
- wrkMast.setFullPlt(Cools.isEmpty(locDetls)?"N":"Y"); // 婊℃澘锛歒
+ wrkMast.setFullPlt(Cools.isEmpty(locDetls) ? "N" : "Y"); // 婊℃澘锛歒
wrkMast.setPicking("N"); // 鎷f枡
wrkMast.setExitMk("N"); // 閫�鍑�
- wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D")?"Y":"N"); // 绌烘澘
+ wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D") ? "Y" : "N"); // 绌烘澘
wrkMast.setBarcode(sourceLoc.getBarcode()); // 鎵樼洏鐮�
wrkMast.setLinkMis("N");
wrkMast.setAppeUser(userId);
@@ -641,11 +647,11 @@
sourceLoc.setLocSts("R"); // R.鍑哄簱棰勭害
sourceLoc.setModiUser(userId);
sourceLoc.setModiTime(now);
- if (!locMastService.updateById(sourceLoc)){
+ if (!locMastService.updateById(sourceLoc)) {
throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
}
} else {
- throw new CoolException("婧愬簱浣嶅嚭搴撳け璐ワ紝鐘舵�侊細"+sourceLoc.getLocSts$());
+ throw new CoolException("婧愬簱浣嶅嚭搴撳け璐ワ紝鐘舵�侊細" + sourceLoc.getLocSts$());
}
// 淇敼鐩爣搴撲綅鐘舵��
if (loc.getLocSts().equals("O")) {
@@ -656,7 +662,7 @@
throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
}
} else {
- throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細"+loc.getLocSts$());
+ throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + loc.getLocSts$());
}
}
@@ -664,16 +670,16 @@
@Transactional
public void completeWrkMast(String workNo, Long userId) {
WrkMast wrkMast = wrkMastService.selectById(workNo);
- if (Cools.isEmpty(wrkMast)){
- throw new CoolException(workNo+"宸ヤ綔妗d笉瀛樺湪");
+ if (Cools.isEmpty(wrkMast)) {
+ throw new CoolException(workNo + "宸ヤ綔妗d笉瀛樺湪");
}
if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 14) {
throw new CoolException("褰撳墠宸ヤ綔妗e凡瀹屾垚");
}
// 鍏ュ簱 + 搴撲綅杞Щ
- if (wrkMast.getWrkSts() < 4 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType()==11)) {
+ if (wrkMast.getWrkSts() < 4 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType() == 11)) {
wrkMast.setWrkSts(4L);
- // 鍑哄簱
+ // 鍑哄簱
} else if (wrkMast.getWrkSts() > 10) {
wrkMast.setWrkSts(14L);
}
@@ -714,7 +720,9 @@
Iterator<LocDetlAdjustParam.LocDetlAdjust> iterator1 = list.iterator();
while (iterator1.hasNext()) {
LocDetlAdjustParam.LocDetlAdjust adjust = iterator1.next();
- if (adjust.getCount() == 0) { continue; }
+ if (adjust.getCount() == 0) {
+ continue;
+ }
if (locDetl.getMatnr().equals(adjust.getMatnr()) && Cools.eq(locDetl.getBatch(), adjust.getBatch())) {
if (!locDetl.getAnfme().equals(adjust.getCount())) {
// todo 鐩樼偣璁板綍
@@ -763,7 +771,9 @@
// 娣诲姞搴撳瓨
for (LocDetlAdjustParam.LocDetlAdjust adjust : list) {
- if (adjust.getCount() == 0.0D) { continue; }
+ if (adjust.getCount() == 0.0D) {
+ continue;
+ }
Mat mat = matService.selectByMatnr(adjust.getMatnr());
LocDetl locDetl = new LocDetl();
locDetl.sync(mat);
@@ -815,8 +825,8 @@
public void cancelWrkMast(String workNo, Long userId) {
Date now = new Date();
WrkMast wrkMast = wrkMastService.selectById(workNo);
- if (Cools.isEmpty(wrkMast)){
- throw new CoolException(workNo+"宸ヤ綔妗d笉瀛樺湪");
+ if (Cools.isEmpty(wrkMast)) {
+ throw new CoolException(workNo + "宸ヤ綔妗d笉瀛樺湪");
}
String locNo = ""; // 寰呬慨鏀圭洰鏍囧簱浣�
String locSts = ""; // 寰呬慨鏀圭洰鏍囧簱浣嶇姸鎬�
@@ -830,29 +840,29 @@
// 搴撲綅杞Щ锛氭簮搴撲綅
LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo());
if (Cools.isEmpty(locMast)) {
- throw new CoolException("鍙栨秷搴撲綅杞Щ澶辫触锛屾簮搴撲綅涓嶅瓨鍦�:"+ wrkMast.getSourceLocNo());
+ throw new CoolException("鍙栨秷搴撲綅杞Щ澶辫触锛屾簮搴撲綅涓嶅瓨鍦�:" + wrkMast.getSourceLocNo());
}
- locMast.setLocSts(wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F");
+ locMast.setLocSts(wrkMast.getFullPlt().equalsIgnoreCase("N") ? "D" : "F");
locMast.setModiTime(now);
locMast.setModiUser(userId);
locMastService.updateById(locMast);
}
- // 鍑哄簱鍙栨秷锛堜慨鏀规簮搴撲綅锛�
+ // 鍑哄簱鍙栨秷锛堜慨鏀规簮搴撲綅锛�
} else if (wrkMast.getWrkSts() > 10 && wrkMast.getWrkSts() != 14) {
locNo = wrkMast.getSourceLocNo();
// 鍑哄簱 ===>> F.鍦ㄥ簱
if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) {
locSts = "F";
- // 绌烘澘鍑哄簱 ===>> D.绌烘《/绌烘爤鏉�
+ // 绌烘澘鍑哄簱 ===>> D.绌烘《/绌烘爤鏉�
} else if (wrkMast.getIoType() == 110) {
locSts = "D";
- // 搴撲綅杞Щ ===>> D.绌烘《/绌烘爤鏉�
+ // 搴撲綅杞Щ ===>> D.绌烘《/绌烘爤鏉�
} else if (wrkMast.getIoType() == 11) {
- locSts = wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F";
+ locSts = wrkMast.getFullPlt().equalsIgnoreCase("N") ? "D" : "F";
// 搴撲綅杞Щ锛氱洰鏍囧簱浣�
LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
if (Cools.isEmpty(locMast)) {
- throw new CoolException("鍙栨秷搴撲綅杞Щ澶辫触锛岀洰鏍囧簱浣嶄笉瀛樺湪:"+ wrkMast.getSourceLocNo());
+ throw new CoolException("鍙栨秷搴撲綅杞Щ澶辫触锛岀洰鏍囧簱浣嶄笉瀛樺湪:" + wrkMast.getSourceLocNo());
}
locMast.setLocSts("O");
locMast.setModiTime(now);
@@ -864,14 +874,15 @@
}
//鍙栨秷鍏ュ簱宸ヤ綔妗f椂锛屾煡璇㈢粍鎵樿〃锛屽鏋滄湁灏嗙姸鎬佹敼涓哄緟澶勭悊
- if(wrkMast.getIoType() == 1) {
- List<WaitPakin> waitPakins=waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode()));
- for (WaitPakin waitPakin:waitPakins){
+ if (wrkMast.getIoType() == 1) {
+ List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode()));
+ for (WaitPakin waitPakin : waitPakins) {
if (!Cools.isEmpty(waitPakin)) {
waitPakin.setIoStatus("N");
waitPakin.setLocNo("");
waitPakinService.update(waitPakin, new EntityWrapper<WaitPakin>()
- .eq("order_no", waitPakin.getOrderNo())
+// .eq("order_no", waitPakin.getOrderNo())
+ .eq("zpallet", waitPakin.getZpallet())
.eq("matnr", waitPakin.getMatnr())
.eq("batch", waitPakin.getBatch()));
}
@@ -879,7 +890,7 @@
}
//鍙栨秷鍑哄簱宸ヤ綔妗f椂锛屾煡璇㈠崟鎹鐞嗚〃锛屽洖婊氫綔涓氫腑鏁伴噺
- if(wrkMast.getIoType() == 101 || wrkMast.getIoType() == 103) {
+ if (wrkMast.getIoType() == 101 || wrkMast.getIoType() == 103) {
List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
for (WrkDetl wrkDetl : wrkDetls) {
if (!Cools.isEmpty(wrkDetl.getOrderNo())) {
@@ -889,20 +900,20 @@
//淇敼璁㈠崟涓昏〃鐘舵��,娌℃湁浣滀笟鏁伴噺鏃舵墠鍙互淇敼
boolean flag = true;
- List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no",wrkDetl.getOrderNo()));
- for(OrderDetl orderDetl : orderDetls){
- if(orderDetl.getWorkQty() > 0){
+ List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", wrkDetl.getOrderNo()));
+ for (OrderDetl orderDetl : orderDetls) {
+ if (orderDetl.getWorkQty() > 0) {
flag = false;
}
}
- if(flag){
- Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no",wrkDetl.getOrderNo()));
- if(!Cools.isEmpty(order) && order.getSettle()==2){
+ if (flag) {
+ Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", wrkDetl.getOrderNo()));
+ if (!Cools.isEmpty(order) && order.getSettle() == 2) {
order.setSettle(1L);
order.setUpdateBy(userId);
order.setUpdateTime(now);
}
- if(!orderService.update(order,new EntityWrapper<Order>().eq("order_no",wrkDetl.getOrderNo()))){
+ if (!orderService.update(order, new EntityWrapper<Order>().eq("order_no", wrkDetl.getOrderNo()))) {
throw new CoolException("淇敼璁㈠崟鐘舵�佸け璐�");
}
}
@@ -949,7 +960,7 @@
// 淇敼搴撲綅鐘舵��
LocMast locMast = locMastService.selectById(locNo);
if (Cools.isEmpty(locMast)) {
- throw new CoolException("鍙栨秷宸ヤ綔妗eけ璐ワ紝搴撲綅涓嶅瓨鍦�:"+ locNo);
+ throw new CoolException("鍙栨秷宸ヤ綔妗eけ璐ワ紝搴撲綅涓嶅瓨鍦�:" + locNo);
}
locMast.setLocSts(locSts);
locMast.setModiTime(now);
@@ -964,8 +975,8 @@
@Transactional
public void pickWrkMast(String workNo, Long userId) {
WrkMast wrkMast = wrkMastService.selectById(workNo);
- if (Cools.isEmpty(wrkMast)){
- throw new CoolException(workNo+"宸ヤ綔妗d笉瀛樺湪");
+ if (Cools.isEmpty(wrkMast)) {
+ throw new CoolException(workNo + "宸ヤ綔妗d笉瀛樺湪");
}
// 鍏ュ嚭搴撶被鍨嬪垽鏂�
if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) {
@@ -1043,7 +1054,7 @@
// 鐩爣搴撲綅
LocMast targetLoc = null;
- for (int curRow = rowLastno.getsRow(); curRow<=rowLastno.geteRow(); curRow++) {
+ for (int curRow = rowLastno.getsRow(); curRow <= rowLastno.geteRow(); curRow++) {
if (Utils.isShallowLoc(slaveProperties, curRow)) {
Integer deepRow = Utils.getDeepRow(slaveProperties, curRow);
@@ -1102,15 +1113,15 @@
throw new CoolException("淇敼宸ヤ綔妗eけ璐�");
}
// 淇敼搴撲綅鐘舵�� O ===>>> S
- if (targetLoc.getLocSts().equals("O")){
+ if (targetLoc.getLocSts().equals("O")) {
targetLoc.setLocSts("S"); // S.鍏ュ簱棰勭害
targetLoc.setModiUser(userId);
targetLoc.setModiTime(now);
- if (!locMastService.updateById(targetLoc)){
+ if (!locMastService.updateById(targetLoc)) {
throw new CoolException("鏀瑰彉搴撲綅鐘舵�佸け璐�");
}
} else {
- throw new CoolException(targetLoc.getLocNo()+"鐩爣搴撲綅宸茶鍗犵敤");
+ throw new CoolException(targetLoc.getLocNo() + "鐩爣搴撲綅宸茶鍗犵敤");
}
// 绂佺敤寮傚父搴撲綅
// locMast.setLocSts("X"); // X.绂佺敤
@@ -1126,10 +1137,27 @@
@Transactional
public void turnMatLocDetl(EmptyPlateOutParam param, Long userId) {
Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("id", param.getMatId()));
- if (Cools.isEmpty(mat)){
+ if (Cools.isEmpty(mat)) {
throw new CoolException("鐩爣搴撲綅鍟嗗搧缂栫爜鏈夎锛�");
}
- locDetlService.updateMatTurn(param.getLocDetls().get(0).getMatnr(),mat.getMatnr());
+ List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", param.getLocDetls().get(0).getMatnr()));
+ if (Cools.isEmpty(locDetls) || locDetls.size() < 1) {
+ throw new CoolException("寰呬慨鏀瑰晢鍝佹棤搴撳瓨锛屾棤闇�淇敼锛� 鍝佸彿锛�" + param.getLocDetls().get(0).getMatnr());
+ }
+ try {
+ locDetlService.updateMatTurn(param.getLocDetls().get(0).getMatnr(), mat.getMatnr());
+ } catch (Exception e) {
+ throw new CoolException("瀵规暟鎹簱淇敼鍑洪敊锛�");
+ }
+ for (LocDetl locDetl : locDetls) {
+ // 淇濆瓨璋冩暣璁板綍
+ AdjDetl adjDetl = new AdjDetl();
+ adjDetl.setLocNo(locDetl.getLocNo());
+ adjDetl.setMatnr(mat.getMatnr());
+ adjDetl.setMatnrOld(param.getLocDetls().get(0).getMatnr());
+ adjDetl.setAdjQty(locDetl.getAnfme());
+ adjDetlService.save(adjDetl, userId);
+ }
}
}
--
Gitblit v1.9.1