From 6751d283289bd10d2ad97ddff65de64046d89c6b Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 26 五月 2023 14:39:28 +0800
Subject: [PATCH] 地图显示行号
---
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 355 ++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 231 insertions(+), 124 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 46dabea..3f02ed6 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,7 @@
// 妫�绱㈠簱浣�
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);
+ StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs, locTypeDto);
// 鐢熸垚宸ヤ綔鍙�
int workNo = dto.getWorkNo();
// 鐢熸垚宸ヤ綔妗�
@@ -102,7 +102,7 @@
wrkMast.setIoType(1); // 鍏ュ嚭搴撶姸鎬侊細1.鍏ュ簱
Double ioPri = wrkMastService.getIoPri(1, dto.getLocNo());
wrkMast.setIoPri(ioPri); // 浼樺厛绾э細13
- wrkMast.setOutMost(locMastService.isOutMost(dto.getLocNo(), true)?1:0);;
+ wrkMast.setOutMost(locMastService.isOutMost(dto.getLocNo(), true) ? 1 : 0);
wrkMast.setCrnNo(dto.getCrnNo());
wrkMast.setSourceStaNo(dto.getSourceStaNo());
wrkMast.setStaNo(dto.getStaNo());
@@ -138,20 +138,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();
}
@@ -159,6 +159,16 @@
@Override
@Transactional
public void startupFullTakeStore(StockOutParam param, Long userId) {
+ ArrayList<String> locNos = new ArrayList<>();
+ for (StockOutParam.LocDetl locDetl:param.getLocDetls()){
+ if (!locNos.contains(locDetl.getLocNo())){
+ locNos.add(locDetl.getLocNo());
+ }
+ }
+
+ //妫�娴嬫彁浜ょ殑鍑哄簱搴撲綅鏄惁鍚堟硶(娴呭簱浣嶆湁闈炵┖搴撲綅)
+ Utils.checkStockOutLocNo(locNos);
+
// 鐩爣绔欑偣鐘舵�佹娴�
BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite());
// 鑾峰彇搴撲綅鏄庣粏
@@ -170,8 +180,13 @@
}
}
if (!locDetlDtos.isEmpty()) {
- // 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
- stockOut(staNo, locDetlDtos, null, userId);
+ LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo()));
+ 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("搴撳瓨涓嶅瓨鍦�");
}
@@ -215,15 +230,19 @@
ioType = dto.isAll() ? 101 : 103;
} else if (ioWorkType.equals(IoWorkType.CHECK_OUT)) {
ioType = 107;
- if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) {
- throw new CoolException("鍙兘瀛樺湪涓�绗旂洏鐐逛换鍔�");
- }
+ // if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) {
+ // throw new CoolException("鍙兘瀛樺湪涓�绗旂洏鐐逛换鍔�");
+ // }
}
assert ioType != null;
// 鑾峰彇搴撲綅
LocMast locMast = locMastService.selectById(dto.getLocNo());
// 鑾峰彇璺緞
- StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), staNo.getDevNo());
+ StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), staNo.getDevNo(), locMast.getRow1());
+ if(staDesc == null){
+ throw new CoolException("鍑哄簱璺緞涓嶅瓨鍦�");
+ }
+
// 鐢熸垚宸ヤ綔鍙�
int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType));
// 鐢熸垚宸ヤ綔妗�
@@ -233,8 +252,8 @@
wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
wrkMast.setIoType(ioType); // 鍏ュ嚭搴撶姸鎬�
Double ioPri = wrkMastService.getIoPri(ioType, dto.getLocNo());
- wrkMast.setIoPri(ioPri); // 浼樺厛绾э細13
- wrkMast.setOutMost(locMastService.isOutMost(dto.getLocNo(), false)?1:0);;
+ wrkMast.setIoPri(15D); // 浼樺厛绾э細13
+ wrkMast.setOutMost(locMastService.isOutMost(dto.getLocNo(), false) ? 1 : 0);
wrkMast.setCrnNo(locMast.getCrnNo());
wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 婧愮珯
wrkMast.setStaNo(staDesc.getStnNo()); // 鐩爣绔�
@@ -250,22 +269,25 @@
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);
wrkDetl.setModiTime(now);
wrkDetl.setModiUser(userId);
+ wrkDetl.setSpecs(detlDto.getLocDetl().getSpecs());
if (!wrkDetlService.insert(wrkDetl)) {
throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
}
@@ -273,16 +295,16 @@
// 淇敼搴撲綅鐘舵��: 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() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
}
- locMastService.breakUp(dto.getLocNo(), excludeLocNos);
+// locMastService.breakUp(dto.getLocNo(), excludeLocNos);
}
}
@@ -311,7 +333,7 @@
wrkMast.setIoType(ioType); // 鍏ュ嚭搴撶姸鎬�
Double ioPri = wrkMastService.getIoPri(ioType, taskDto.getLocNo());
wrkMast.setIoPri(ioPri); // 浼樺厛绾э細13
- wrkMast.setOutMost(locMastService.isOutMost(taskDto.getLocNo(), false)?1:0);;
+ wrkMast.setOutMost(locMastService.isOutMost(taskDto.getLocNo(), false) ? 1 : 0);
wrkMast.setCrnNo(locMast.getCrnNo());
wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 婧愮珯
wrkMast.setStaNo(staDesc.getStnNo()); // 鐩爣绔�
@@ -327,11 +349,13 @@
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; }
+ if (locDto.getAnfme() == null || locDto.getAnfme() <= 0.0D) {
+ continue;
+ }
LocDetl locDetl = locDetlService.selectItem(locDto.getLocNo(), locDto.getMatnr(), locDto.getBatch());
if (locDetl == null || locDetl.getAnfme() < locDto.getAnfme()) {
throw new CoolException(locDto.getLocNo() + "搴撲綅涓�" + locDto.getMatnr() + "鍟嗗搧搴撳瓨涓嶈冻锛�");
@@ -354,29 +378,41 @@
throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
}
// 淇敼璁㈠崟鏄庣粏
- if (BaseController.isJSON(locDto.getOrderNo())) {
+ if (!BaseController.isJSON(locDto.getOrderNo())) {
String[] orderNos = GetOrderNo(locDto.getOrderNo());
- Double anfme = locDto.getAnfme();
- for (String orderNo:orderNos){
- OrderDetl orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), locDto.getBatch());
- if (orderDetl == null) {
- orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), null);
+ if (!Cools.isEmpty(orderNos)){
+ Double anfme = locDto.getAnfme();
+ for (String orderNo : orderNos) {
+ OrderDetl orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), locDto.getBatch());
+ if (orderDetl == null) {
+ orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), null);
+ }
+ if (orderDetl.getAnfme() <= anfme) {
+ if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme())) {
+ throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触");
+ }
+ anfme = anfme - orderDetl.getAnfme();
+ } else {
+ if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), anfme)) {
+ throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触");
+ }
+ }
+ orderService.updateSettle(orderDetl.getOrderId(), 2L, userId);
}
- if (orderDetl.getAnfme()<=anfme){
- if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(),orderDetl.getAnfme())) {
- throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触");
- }
- anfme=anfme-orderDetl.getAnfme();
- }else{
- if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(),anfme)) {
- throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触");
- }
+ }else {
+ OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch());
+ if (orderDetl == null) {
+ orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null);
+ }
+ if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), locDto.getAnfme())) {
+ throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触");
}
orderService.updateSettle(orderDetl.getOrderId(), 2L, userId);
}
} else {
// 璁㈠崟鍚堝苟鍑哄簱
List<OrderDto> orderDtoList = JSON.parseArray(locDto.getOrderNo(), OrderDto.class);
+
for (OrderDto orderDto : orderDtoList) {
OrderDetl orderDetl = orderDetlService.selectItem(orderDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch());
if (orderDetl == null) {
@@ -392,25 +428,46 @@
// 淇敼搴撲綅鐘舵��: 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() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
}
}
- private String[] GetOrderNo(String orderNo){
- String[] s3= orderNo.split("\"");
- String[] s =new String[(s3.length-1)/6];
- int i=0;
- int j=0;
- for (String ss:s3){
- if (ss.equals("orderNo")){
- s[i]=s3[j+2];
+ private String[] GetOrderNo(String orderNo) {
+ String[] s3 = orderNo.split("\"");
+ String[] s = new String[(s3.length - 1) / 6];
+ if (!Cools.isEmpty(s3)){
+ int i = 0;
+ int j = 0;
+ for (String ss : s3) {
+ if (ss.equals("orderNo")) {
+ s[i] = s3[j + 2];
+ i++;
+ }
+ j++;
+ }
+ }else {
+ s=null;
+ }
+ return s;
+ }
+
+ private String[] GetAnfme(String orderNo) {
+ String[] s3 = orderNo.split("\"");
+ String[] s = new String[(s3.length - 1) / 6];
+ int i = 0;
+ int j = 0;
+ for (String ss : s3) {
+ if (ss.equals("anfme")) {
+ String[] s4 = s3[j + 1].split(":");
+ String[] s5 = s4[1].split("\\.");
+ s[i] = s5[0];
i++;
}
j++;
@@ -425,7 +482,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, locTypeDto);
int workNo = dto.getWorkNo();
// 鐢熸垚宸ヤ綔妗�
WrkMast wrkMast = new WrkMast();
@@ -435,7 +492,7 @@
wrkMast.setIoType(10); // 鍏ュ嚭搴撶姸鎬侊細10.绌烘澘鍏ュ簱
Double ioPri = wrkMastService.getIoPri(10, dto.getLocNo());
wrkMast.setIoPri(ioPri); // 浼樺厛绾э細10
- wrkMast.setOutMost(locMastService.isOutMost(dto.getLocNo(), true)?1:0);;
+ wrkMast.setOutMost(locMastService.isOutMost(dto.getLocNo(), true) ? 1 : 0);
wrkMast.setCrnNo(dto.getCrnNo());
wrkMast.setSourceStaNo(dto.getSourceStaNo());
wrkMast.setStaNo(dto.getStaNo());
@@ -459,20 +516,20 @@
sourceStaNo.setWrkNo(workNo);
sourceStaNo.setModiUser(userId);
sourceStaNo.setModiTime(new Date());
- 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(new Date());
- 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();
}
@@ -496,7 +553,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$());
}
// 鑾峰彇婧愮珯
Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
@@ -521,7 +581,7 @@
wrkMast.setIoPri(ioPri);
wrkMast.setSourceStaNo(sourceStaNo); // 婧愮珯
wrkMast.setStaNo(param.getOutSite()); // 鐩爣绔�
- wrkMast.setOutMost(locMastService.isOutMost(locNo, false)?1:0);;
+ wrkMast.setOutMost(locMastService.isOutMost(locNo, false) ? 1 : 0);
wrkMast.setCrnNo(locMast.getCrnNo());
wrkMast.setSourceLocNo(locNo); // 婧愬簱浣�
wrkMast.setFullPlt("N"); // 婊℃澘锛歒
@@ -538,7 +598,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(new Date());
@@ -552,9 +612,9 @@
@Override
@Transactional
public void locCheckOut(StockOutParam param, Long userId) {
- if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) {
- throw new CoolException("鍙兘瀛樺湪涓�绗旂洏鐐逛换鍔�");
- }
+ // if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) {
+ // throw new CoolException("鍙兘瀛樺湪涓�绗旂洏鐐逛换鍔�");
+ // }
// 鐩爣绔欑偣鐘舵�佹娴�
BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite());
// 鑾峰彇搴撲綅鏄庣粏
@@ -566,8 +626,14 @@
}
}
if (!locDetlDtos.isEmpty()) {
- // 鍚姩鍑哄簱寮�濮� 107.鐩樼偣鍑哄簱
- stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId);
+ LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo()));
+ 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("搴撲綅鐗╂枡涓嶅瓨鍦�");
}
@@ -578,12 +644,15 @@
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"))){
+ throw new CoolException("搴撲綅鐘舵�佸凡鏀瑰彉");
}
if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) {
// throw new CoolException("绉昏浆搴撲綅灞炰簬涓嶅悓鍫嗗灈鏈�"); todo:luxiaotao
@@ -598,14 +667,14 @@
wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
wrkMast.setIoPri(10D);
- wrkMast.setOutMost(locMastService.isOutMost(locNo, false)?1:0);;
+ wrkMast.setOutMost(locMastService.isOutMost(locNo, false) ? 1 : 0);
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);
@@ -636,11 +705,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.getLocNo() + "婧愬簱浣嶅嚭搴撳け璐ワ紝鐘舵�侊細"+sourceLoc.getLocSts$());
+ throw new CoolException(sourceLoc.getLocNo() + "婧愬簱浣嶅嚭搴撳け璐ワ紝鐘舵�侊細" + sourceLoc.getLocSts$());
}
// 淇敼鐩爣搴撲綅鐘舵��
if (loc.getLocSts().equals("O")) {
@@ -651,7 +720,7 @@
throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
}
} else {
- throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細"+loc.getLocSts$());
+ throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + loc.getLocSts$());
}
}
@@ -659,17 +728,18 @@
@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() == 9 || wrkMast.getWrkSts() == 17) {
throw new CoolException("褰撳墠宸ヤ綔妗e凡瀹屾垚");
}
// 鍏ュ簱 + 搴撲綅杞Щ
- if (wrkMast.getWrkSts() < 9 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType()==11)) {
+ if (wrkMast.getWrkSts() < 9 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType() == 11)) {
wrkMast.setWrkSts(9L);
// 鍑哄簱
} else if (wrkMast.getWrkSts() > 10) {
+ wrkMast.setSteNo(0);
wrkMast.setWrkSts(17L);
}
Date now = new Date();
@@ -709,27 +779,30 @@
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 鐩樼偣璁板綍
- // 淇敼搴撳瓨
- if (!locDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch())) {
- throw new CoolException(locDetl.getLocNo() + "搴撲綅锛�" + locDetl.getMatnr() + "鍟嗗搧锛�" + locDetl.getBatch() + "搴忓垪鐮佷慨鏀规暟閲忓け璐�");
- }
- // 淇濆瓨璋冩暣璁板綍
- AdjDetl adjDetl = new AdjDetl();
- adjDetl.setLocNo(locDetl.getLocNo());
- adjDetl.setMatnr(locDetl.getMatnr());
- adjDetl.setBatch(locDetl.getBatch());
- adjDetl.setOriQty(locDetl.getAnfme());
- adjDetl.setAdjQty(adjust.getCount());
- adjDetl.setModiTime(now);
- adjDetl.setModiUser(userId);
- adjDetl.setAppeTime(now);
- adjDetl.setAppeUser(userId);
- adjDetlService.save(adjDetl, userId);
+ // todo 鐩樼偣璁板綍
+ // 淇敼搴撳瓨
+ if (!locDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), adjust.getManu(), adjust.getMemo())) {
+ throw new CoolException(locDetl.getLocNo() + "搴撲綅锛�" + locDetl.getMatnr() + "鍟嗗搧锛�" + locDetl.getBatch() + "搴忓垪鐮佷慨鏀规暟閲忓け璐�");
}
+ // 淇濆瓨璋冩暣璁板綍
+ AdjDetl adjDetl = new AdjDetl();
+ adjDetl.setLocNo(locDetl.getLocNo());
+ adjDetl.setMatnr(locDetl.getMatnr());
+ adjDetl.setBatch(locDetl.getBatch());
+ adjDetl.setOriQty(locDetl.getAnfme());
+ adjDetl.setAdjQty(adjust.getCount());
+ adjDetl.setMemo(adjust.getMemo());
+ adjDetl.setManu(adjust.getManu());
+ adjDetl.setModiTime(now);
+ adjDetl.setModiUser(userId);
+ adjDetl.setAppeTime(now);
+ adjDetl.setAppeUser(userId);
+ adjDetlService.save(adjDetl, userId);
+
iterator.remove();
iterator1.remove();
}
@@ -758,13 +831,17 @@
// 娣诲姞搴撳瓨
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);
locDetl.setBatch(adjust.getBatch());
locDetl.setLocNo(locMast.getLocNo());
locDetl.setAnfme(adjust.getCount()); // 鏁伴噺
+ locDetl.setMemo(adjust.getMemo());
+ locDetl.setManu(adjust.getManu());
locDetl.setModiUser(userId); // 鎿嶄綔浜哄憳淇℃伅
locDetl.setModiTime(now);
locDetl.setAppeUser(userId);
@@ -777,6 +854,8 @@
adjDetl.setLocNo(locMast.getLocNo());
adjDetl.setMatnr(adjust.getMatnr());
adjDetl.setBatch(adjust.getBatch());
+ adjDetl.setMemo(adjust.getMemo());
+ adjDetl.setManu(adjust.getManu());
adjDetl.setOriQty(0.0D);
adjDetl.setAdjQty(adjust.getCount());
adjDetl.setModiTime(now);
@@ -809,8 +888,8 @@
@Transactional
public void cancelWrkMast(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笉瀛樺湪");
}
String locNo = ""; // 寰呬慨鏀圭洰鏍囧簱浣�
String locSts = ""; // 寰呬慨鏀圭洰鏍囧簱浣嶇姸鎬�
@@ -824,29 +903,32 @@
// 搴撲綅杞Щ锛氭簮搴撲綅
LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo());
if (Cools.isEmpty(locMast)) {
- throw new CoolException("鍙栨秷搴撲綅杞Щ澶辫触锛屾簮搴撲綅涓嶅瓨鍦�:"+ wrkMast.getSourceLocNo());
+ throw new CoolException("鍙栨秷搴撲綅杞Щ澶辫触锛屾簮搴撲綅涓嶅瓨鍦�:" + wrkMast.getSourceLocNo());
}
locMast.setLocSts("F");
locMast.setModiTime(new Date());
locMast.setModiUser(userId);
locMastService.updateById(locMast);
}
- // 鍑哄簱鍙栨秷锛堜慨鏀规簮搴撲綅锛�
+ // 鍑哄簱鍙栨秷锛堜慨鏀规簮搴撲綅锛�
} else if (wrkMast.getWrkSts() > 10 && wrkMast.getWrkSts() != 19) {
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";
+ if (wrkMast.getWrkSts() > 11){
+ throw new CoolException("绉诲簱浠诲姟宸插湪鎵ц涓紝涓嶈兘鍙栨秷");
+ }
+ 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(new Date());
@@ -859,17 +941,42 @@
// 璁㈠崟鍏宠仈
List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
for (WrkDetl wrkDetl : wrkDetls) {
- if (!Cools.isEmpty(wrkDetl.getOrderNo())) {
- if (BaseController.isJSON(wrkDetl.getOrderNo())) {
- if (!orderDetlService.decrease(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())) {
- throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触");
+ if (!Cools.isEmpty(wrkDetl.getOrderNo())){
+ String[] orderNos = GetOrderNo(wrkDetl.getOrderNo());
+ if (!Cools.isEmpty(orderNos)){
+ String[] anfmes = GetAnfme(wrkDetl.getOrderNo());
+ int i = 0;
+ for (String orderNo : orderNos) {
+ if (!Cools.isEmpty(orderNo)) {
+ Double anfme = Integer.parseInt(anfmes[i]) + 0.0;
+ i++;
+ if (!BaseController.isJSON(wrkDetl.getOrderNo())) {
+ if (!orderDetlService.decrease(orderNo, wrkDetl.getMatnr(), wrkDetl.getBatch(), anfme)) {
+ throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触");
+ }
+ } else {
+ // 璁㈠崟鍚堝苟鍑哄簱
+ List<OrderDto> orderDtoList = JSON.parseArray(wrkDetl.getOrderNo(), OrderDto.class);
+ for (OrderDto orderDto : orderDtoList) {
+ if (!orderDetlService.decrease(orderDto.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), orderDto.getAnfme())) {
+ throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触");
+ }
+ }
+ }
+ }
}
- } else {
- // 璁㈠崟鍚堝苟鍑哄簱
- List<OrderDto> orderDtoList = JSON.parseArray(wrkDetl.getOrderNo(), OrderDto.class);
- for (OrderDto orderDto : orderDtoList) {
- if (!orderDetlService.decrease(orderDto.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), orderDto.getAnfme())) {
+ }else {
+ if (!BaseController.isJSON(wrkDetl.getOrderNo())) {
+ if (!orderDetlService.decrease(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())) {
throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触");
+ }
+ } else {
+ // 璁㈠崟鍚堝苟鍑哄簱
+ List<OrderDto> orderDtoList = JSON.parseArray(wrkDetl.getOrderNo(), OrderDto.class);
+ for (OrderDto orderDto : orderDtoList) {
+ if (!orderDetlService.decrease(orderDto.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), orderDto.getAnfme())) {
+ throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触");
+ }
}
}
}
@@ -901,7 +1008,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(new Date());
@@ -916,8 +1023,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) {
@@ -993,9 +1100,9 @@
if (Cools.isEmpty(locNos)) {
return;
}
- if (true && !Cools.isEmpty(locNos)) {
- throw new CoolException("鏆備笉鏀寔绉诲簱浠诲姟"); // todo:luxiaotao 绉诲簱寮�鍏�
- }
+// if (true && !Cools.isEmpty(locNos)) {
+// throw new CoolException("鏆備笉鏀寔绉诲簱浠诲姟"); // todo:luxiaotao 绉诲簱寮�鍏�
+// }
LocMast one = locMastService.selectById(locNos.get(0));
List<Integer> rows = Utils.getGroupLoc(Integer.parseInt(locNos.get(0).substring(0, 2)));
List<LocMast> locMasts = locMastService.queryFreeLocMast(rows, rows.size(), one.getLocType1());
@@ -1030,11 +1137,11 @@
while (iterator.hasNext()) {
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 = iterator.next();
- if (Cools.isEmpty(loc)){
+ if (Cools.isEmpty(loc)) {
throw new CoolException("鏈壘鍒板簱浣�");
}
if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) {
@@ -1049,14 +1156,14 @@
wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
wrkMast.setIoPri(15D);
- wrkMast.setOutMost(locMastService.isOutMost(loc.getLocNo(), false)?1:0);;
+ wrkMast.setOutMost(locMastService.isOutMost(loc.getLocNo(), false) ? 1 : 0);
wrkMast.setCrnNo(sourceLoc.getCrnNo());
wrkMast.setSourceLocNo(sourceLocNo); // 婧愬簱浣�
wrkMast.setLocNo(loc.getLocNo()); // 鐩爣搴撲綅
- 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(9527L);
@@ -1087,11 +1194,11 @@
sourceLoc.setLocSts("R"); // R.鍑哄簱棰勭害
sourceLoc.setModiUser(9527L);
sourceLoc.setModiTime(now);
- if (!locMastService.updateById(sourceLoc)){
+ if (!locMastService.updateById(sourceLoc)) {
throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
}
} else {
- throw new CoolException(sourceLoc.getLocNo() + "婧愬簱浣嶅嚭搴撳け璐ワ紝鐘舵�侊細"+sourceLoc.getLocSts$());
+ throw new CoolException(sourceLoc.getLocNo() + "婧愬簱浣嶅嚭搴撳け璐ワ紝鐘舵�侊細" + sourceLoc.getLocSts$());
}
// 淇敼鐩爣搴撲綅鐘舵��
if (loc.getLocSts().equals("O")) {
@@ -1102,7 +1209,7 @@
throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
}
} else {
- throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細"+loc.getLocSts$());
+ throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + loc.getLocSts$());
}
iterator.remove();
--
Gitblit v1.9.1