From 8b3d5b19b746a808d447b67164ba86e673fd9822 Mon Sep 17 00:00:00 2001 From: pjb <pjb123456> Date: 星期日, 24 八月 2025 16:10:14 +0800 Subject: [PATCH] 订单出库,统一出库时间 --- src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 151 +++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 125 insertions(+), 26 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 627d74c..518c0f0 100644 --- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java @@ -24,6 +24,8 @@ import com.zy.common.properties.SlaveProperties; import com.zy.common.service.CommonService; import com.zy.common.web.WcsController; +import com.zy.system.entity.Config; +import com.zy.system.service.ConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -97,6 +99,9 @@ @Resource private OrderDetlPakoutMapper orderDetlPakoutMapper; + + @Resource + private ConfigService configService; @Override @Transactional @@ -184,6 +189,16 @@ public void startupFullTakeStore(StockOutParam param, Long userId) { // 鐩爣绔欑偣鐘舵�佹娴� BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); + // 鍒ゆ柇浠诲姟鐩爣绔欑偣鏄惁鏄嚭搴撴ā寮� + if (param.getOutSite() == 1016 || param.getOutSite() == 1043) { + Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "inOrOutBoundMode").eq("status", 1)); + if (config != null && !Cools.isEmpty(config.getValue())) { + int value = Integer.parseInt(config.getValue()); + if (value != 2) { + throw new CoolException("鐩爣绔欑偣" + param.getOutSite() + "涓嶆槸鍑哄簱妯″紡锛屽綋鍓嶆ā寮忎负锛�" + value); + } + } + } // 鑾峰彇搴撲綅鏄庣粏 List<LocDetlDto> locDetlDtos = new ArrayList<>(); for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { @@ -340,7 +355,7 @@ wrkMast.setIoTime(now); wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID wrkMast.setIoType(ioType); // 鍏ュ嚭搴撶姸鎬� - wrkMast.setIoPri(13D); // 浼樺厛绾э細13 + wrkMast.setIoPri(staDesc.getStnNo() == 1064 || staDesc.getStnNo() == 1031 ? 14D: 13D); // 绌烘《鍑哄簱鍒颁簩鍙风綈瑁呯嚎,鍘绘墦鍖咃紝浼樺厛绾ф彁楂� wrkMast.setCrnNo(locMast.getCrnNo()); wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 婧愮珯 wrkMast.setStaNo(staDesc.getStnNo()); // 鐩爣绔� @@ -394,8 +409,7 @@ @Override @Transactional - public void stockOut(BasDevp staNo, TaskDto taskDto, Long userId) { - Date now = new Date(); + public void stockOut(BasDevp staNo, TaskDto taskDto, Long userId,Date now) { List<LocDto> locDtos = taskDto.getLocDtos(); for (LocDto locDto : locDtos) { if (!taskDto.getLocNo().equals(locDto.getLocNo()) && !taskDto.getStaNo().equals(locDto.getStaNo())) { @@ -741,7 +755,7 @@ throw new CoolException(locDetl.getLocNo() + "," + locDetl.getMatnr() + "," + locDetl.getBatch() + "搴撳瓨鏄庣粏宸茶鍐荤粨!"); } - 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("M") && !sourceLoc.getLocSts().equals("Z"))){ throw new CoolException("搴撲綅鐘舵�佸凡鏀瑰彉"); } if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) { @@ -763,7 +777,7 @@ 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("M") ? "M" : sourceLoc.getLocSts().equals("Z") ? "Z" : "N"); // 绌烘澘 wrkMast.setBarcode(sourceLoc.getBarcode()); // 鎵樼洏鐮� wrkMast.setLinkMis("N"); wrkMast.setAppeUser(userId); @@ -790,7 +804,7 @@ } } // 淇敼婧愬簱浣嶇姸鎬� - if (sourceLoc.getLocSts().equals("D") || sourceLoc.getLocSts().equals("F")) { + if (sourceLoc.getLocSts().equals("F") || sourceLoc.getLocSts().equals("M") || sourceLoc.getLocSts().equals("Z")) { sourceLoc.setLocSts("R"); // R.鍑哄簱棰勭害 sourceLoc.setModiUser(userId); sourceLoc.setModiTime(now); @@ -823,7 +837,7 @@ if (wrkMast.getStaNo() == 1090 && wrkMast.getLocNo() == null) { throw new CoolException(workNo+"宸ヤ綔妗f棤娉曞畬鎴�,搴撲綅鍙蜂负绌猴紒"); } - if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 14) { + if (wrkMast.getWrkSts() == 4L || wrkMast.getWrkSts() == 14L || wrkMast.getWrkSts() == 54L) { throw new CoolException("褰撳墠宸ヤ綔妗e凡瀹屾垚"); } // 瀹屾垚绌烘《搴撳叆鍑哄簱浠诲姟鍙︿竴涓换鍔� @@ -844,6 +858,9 @@ } else if(wrkMast.getIoType() == 1 && wrkMast.getWrkSts() == 10) { wrkMast.setWrkSts(2L); wrkMast.setRgvFinishTime(new Date()); + } else if(wrkMast.getIoType() == 120) { + wrkMast.setWrkSts(54L); + wrkMast.setRgvFinishTime(new Date()); } Date now = new Date(); wrkMast.setCrnStrTime(DateUtils.calculate(now, 1L, TimeUnit.SECONDS, true)); @@ -857,13 +874,15 @@ } if(workNoOther != 0) { WrkMast wrkMast1 = wrkMastService.selectById(workNoOther); - wrkMast1.setWrkSts(wrkMast.getWrkSts()); - wrkMast1.setCrnStrTime(wrkMast.getCrnStrTime()); - wrkMast1.setCrnEndTime(now); - wrkMast1.setModiTime(now); - wrkMast1.setModiUser(userId); - wrkMast1.setManuType("鎵嬪姩瀹屾垚"); - wrkMastService.updateById(wrkMast1); + if (wrkMast1 != null) { + wrkMast1.setWrkSts(wrkMast.getWrkSts()); + wrkMast1.setCrnStrTime(wrkMast.getCrnStrTime()); + wrkMast1.setCrnEndTime(now); + wrkMast1.setModiTime(now); + wrkMast1.setModiUser(userId); + wrkMast1.setManuType("鎵嬪姩瀹屾垚"); + wrkMastService.updateById(wrkMast1); + } } } @@ -892,7 +911,7 @@ wrkMast.setCrnNo(locMast.getCrnNo()); wrkMast.setSourceLocNo(locMast.getLocNo()); wrkMast.setLocNo(locMast.getLocNo()); - wrkMast.setBarcode(locMast.getBarcode()); // 鎵樼洏鐮� + wrkMast.setBarcode(list.get(0).getZpallet()); // 鎵樼洏鐮� wrkMast.setFullPlt("Y"); // 婊℃澘锛歒 wrkMast.setPicking("N"); // 鎷f枡 wrkMast.setExitMk("N"); // 閫�鍑� @@ -909,6 +928,10 @@ boolean deleteFlag = true; boolean addFlag = true; + // 搴撲綅鐘舵�佹槸绌猴紝鍒欐坊鍔� + // 搴撲綅鐘舵�佸湪搴擄紝鏈夋彁浜ゆ暟鎹紝鍒欎慨鏀� + // 搴撲綅鐘舵�佸湪搴擄紝娌℃湁鎻愪氦鏁版嵁锛屽垯鍒犻櫎 + // 淇敼鏁伴噺 Iterator<LocDetl> iterator = locDetls.iterator(); while (iterator.hasNext()) { @@ -919,13 +942,20 @@ LocDetlAdjustParam.LocDetlAdjust adjust = iterator1.next(); 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(),locDetl.getBrand(), - locDetl.getStandby1(),locDetl.getStandby2(),locDetl.getStandby3(),locDetl.getBoxType1(),locDetl.getBoxType2(),locDetl.getBoxType3())) { - throw new CoolException(locDetl.getLocNo() + "搴撲綅锛�" + locDetl.getMatnr() + "鍟嗗搧锛�" + locDetl.getBatch() + "鎵瑰彿淇敼鏁伴噺澶辫触"); - } +// if (!locDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(),locDetl.getBrand(), +// locDetl.getStandby1(),locDetl.getStandby2(),locDetl.getStandby3(),locDetl.getBoxType1(),locDetl.getBoxType2(),locDetl.getBoxType3())) { +// throw new CoolException(locDetl.getLocNo() + "搴撲綅锛�" + locDetl.getMatnr() + "鍟嗗搧锛�" + locDetl.getBatch() + "鎵瑰彿淇敼鏁伴噺澶辫触"); +// } + locDetl.setAnfme(adjust.getCount()); + locDetl.setZpallet(adjust.getZpallet()); + locDetl.setModel(adjust.getModel()); + locDetl.setManuDate(adjust.getManuDate()); + locDetl.setWeight(adjust.getWeight()); + locDetl.setManLength(adjust.getManLength()); + locDetl.setVolume(adjust.getVolume()); + locDetlService.update(locDetl,new EntityWrapper<LocDetl>().eq("loc_no",locDetl.getLocNo()).eq("matnr",locDetl.getMatnr()).eq("batch",locDetl.getBatch())); // 淇濆瓨璋冩暣璁板綍 AdjDetl adjDetl = new AdjDetl(); adjDetl.setLocNo(locDetl.getLocNo()); @@ -955,6 +985,13 @@ wrkDetl.setWrkNo(wrkMast.getWrkNo()); wrkDetl.setIoTime(wrkMast.getIoTime()); wrkDetl.setAnfme(adjust.getCount()); + wrkDetl.setAnfme(adjust.getCount()); + wrkDetl.setZpallet(adjust.getZpallet()); + wrkDetl.setModel(adjust.getModel()); + wrkDetl.setManuDate(adjust.getManuDate()); + wrkDetl.setWeight(adjust.getWeight()); + wrkDetl.setManLength(adjust.getManLength()); + wrkDetl.setVolume(adjust.getVolume()); wrkDetl.setAppeTime(now); wrkDetl.setModiTime(now); wrkMast.setAppeUser(userId); @@ -962,7 +999,6 @@ if (!wrkDetlLogService.insert(wrkDetl)) { throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触"); } - } iterator.remove(); iterator1.remove(); } @@ -1022,8 +1058,13 @@ locDetl.sync(mat); locDetl.setBatch(adjust.getBatch()); locDetl.setLocNo(locMast.getLocNo()); - locDetl.setZpallet(locMast.getBarcode()); + locDetl.setZpallet(adjust.getZpallet()); locDetl.setAnfme(adjust.getCount()); // 鏁伴噺 + locDetl.setModel(adjust.getModel()); + locDetl.setManuDate(adjust.getManuDate()); + locDetl.setWeight(adjust.getWeight()); + locDetl.setManLength(adjust.getManLength()); + locDetl.setVolume(adjust.getVolume()); locDetl.setModiUser(userId); // 鎿嶄綔浜哄憳淇℃伅 locDetl.setModiTime(now); locDetl.setAppeUser(userId); @@ -1072,12 +1113,15 @@ int count = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo())); if (locMast.getLocSts().equals("F")) { if (count == 0) { - locMast.setLocSts("D"); + locMast.setLocSts("O"); + } else { + locMast.setBarcode(wrkMast.getBarcode()); } } if (locMast.getLocSts().equals("D") || locMast.getLocSts().equals("O")) { if (count > 0) { locMast.setLocSts("F"); + locMast.setBarcode(wrkMast.getBarcode()); } } locMast.setModiUser(userId); @@ -1098,8 +1142,53 @@ } String locNo = ""; // 寰呬慨鏀圭洰鏍囧簱浣� String locSts = ""; // 寰呬慨鏀圭洰鏍囧簱浣嶇姸鎬� + Long wrkSts = wrkMast.getWrkSts(); + Integer ioType = wrkMast.getIoType(); + + // 浠诲姟瀹屾垚锛屾棤娉曞彇娑� + if(wrkSts == 4 || wrkSts == 5 || wrkSts == 14 || wrkSts == 15 || wrkSts == 54) { + throw new CoolException(workNo+"浠诲姟宸插畬鎴愶紝鏃犳硶鍙栨秷"); + } + + if(ioType == 101 || ioType == 110) { + if(wrkSts == 11 || wrkSts == 12) { + + } else { + throw new CoolException(workNo+"搴撳瓨淇℃伅宸叉洿鏂帮紝鏃犳硶鍙栨秷"); + } + } // 鍏ュ簱鍙栨秷锛堜慨鏀圭洰鏍囧簱浣嶏級 - if (wrkMast.getWrkSts() <= 10) { +// if(ioType == 1 || ioType == 10) { +// if(wrkSts == 1 || wrkSts == 2|| wrkSts == 3 || wrkSts == 9 || wrkSts == 10) { +// locNo = wrkMast.getLocNo(); +// locSts = "O"; +// } else { +// throw new CoolException(workNo+"鍙栨秷澶辫触锛屽綋鍓嶇姸鎬侊細" + wrkSts); +// } +// } else if(ioType == 11){ +// if(wrkSts <= 10) { +// locNo = wrkMast.getLocNo(); +// locSts = "O"; +// // 搴撲綅杞Щ锛氭簮搴撲綅 +// LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo()); +// if (Cools.isEmpty(locMast)) { +// throw new CoolException("鍙栨秷搴撲綅杞Щ澶辫触锛屾簮搴撲綅涓嶅瓨鍦�:"+ wrkMast.getSourceLocNo()); +// } +// locMast.setLocSts(wrkMast.getFullPlt().equalsIgnoreCase("N")?wrkMast.getEmptyMk():"F"); +// locMast.setModiTime(now); +// locMast.setModiUser(userId); +// locMastService.updateById(locMast); +// } else { +// throw new CoolException(workNo+"鍙栨秷澶辫触锛屽綋鍓嶇姸鎬侊細" + wrkSts); +// } +// } else if(ioType == 3) { +// +// } else if(ioType == 101) { +// +// } else if(ioType == 110) { +// +// } + if (wrkMast.getWrkSts() <= 10 && wrkMast.getIoType()!=120) { locNo = wrkMast.getLocNo(); locSts = "O"; @@ -1116,7 +1205,7 @@ locMastService.updateById(locMast); } // 鍑哄簱鍙栨秷锛堜慨鏀规簮搴撲綅锛� - } else if (wrkMast.getWrkSts() > 10 && wrkMast.getWrkSts() != 14) { + } else if (wrkMast.getWrkSts() > 10 && wrkMast.getWrkSts() != 14 && wrkMast.getIoType()!=120) { locNo = wrkMast.getSourceLocNo(); if (wrkMast.getIoType() == 110) { if(wrkMast.getStaNo() == 1035) { // 瀛愭媶鐩樻満绔欑偣 @@ -1130,7 +1219,7 @@ locSts = "F"; // 绌烘澘鍑哄簱 ===>> D.绌烘《/绌烘爤鏉� } else if (wrkMast.getIoType() == 11) { - locSts = wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F"; + locSts = wrkMast.getFullPlt().equalsIgnoreCase("N")?wrkMast.getEmptyMk():"F"; // 搴撲綅杞Щ锛氱洰鏍囧簱浣� LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); if (Cools.isEmpty(locMast)) { @@ -1141,6 +1230,16 @@ locMast.setModiUser(userId); locMastService.updateById(locMast); } + } else if (wrkMast.getIoType()==120){ + // 鍙栨秷鎿嶄綔浜哄憳璁板綍 + wrkMast.setWrkSts(54L); + wrkMast.setManuType("鎵嬪姩鍙栨秷"); + wrkMast.setModiUser(userId); + wrkMast.setModiTime(now); + if (!wrkMastService.updateById(wrkMast)) { + throw new CoolException("鍙栨秷宸ヤ綔妗eけ璐�"); + } + return; } else { throw new CoolException("褰撳墠宸ヤ綔鐘舵�佹棤娉曞彇娑�"); } -- Gitblit v1.9.1