From 83b51a5a0774ea8ecb9a06304af3b956a21307c8 Mon Sep 17 00:00:00 2001 From: pjb <123456> Date: 星期六, 08 三月 2025 09:06:55 +0800 Subject: [PATCH] CUT库条码T开头,截取后10位 --- zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/WorkServiceImpl.java | 151 ++++++++++++++++++++++++++------------------------ 1 files changed, 79 insertions(+), 72 deletions(-) diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/WorkServiceImpl.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/WorkServiceImpl.java index 0091d2c..6b9e1eb 100644 --- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/WorkServiceImpl.java +++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/WorkServiceImpl.java @@ -3,7 +3,6 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.framework.common.Cools; -import com.zy.asrs.framework.common.R; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.asrs.entity.*; import com.zy.asrs.wms.asrs.entity.enums.*; @@ -90,7 +89,7 @@ @Override public Loc generateEmptyLoc(Long taskType, Integer locTypeHeight) { List<ShelvesRule> shelvesRules = shelvesRuleService.list(new LambdaQueryWrapper<ShelvesRule>().eq(ShelvesRule::getStatus, 1).orderByDesc(ShelvesRule::getCreateTime)); - if(shelvesRules.isEmpty()) { + if (shelvesRules.isEmpty()) { throw new CoolException("鏈厤缃笂鏋惰鍒�"); } ShelvesRule shelvesRule = shelvesRules.get(0); @@ -114,7 +113,7 @@ } List<ShelvesRuleDetl> ruleDetls = shelvesRule.getRuleDetl$(); - if(ruleDetls.isEmpty()) { + if (ruleDetls.isEmpty()) { throw new CoolException("鏈厤缃笂鏋惰鍒欐槑缁�"); } @@ -135,22 +134,23 @@ //鑾峰彇搴撲綅 if (!suggestLoc.isEmpty()) { defaultLoc = locUtils.filterLoc(taskType, suggestLoc); - if(defaultLoc != null) { + if (defaultLoc != null) { return defaultLoc; } } } if (ruleDetl.getDetlType().equals(ShelvesRuleDetlType.COMPLETE.id)) { + return locUtils.getGlobalEmptyLocToCtu(locTypeHeight); //浠庡叏灞�搴撲綅涓幏鍙�(瀹屾暣宸烽亾) - List<Loc> globalLoc = locUtils.getGlobalEmptyLoc(taskType, locTypeHeight, laneRowList, currentLev); - //鑾峰彇搴撲綅 - if (!globalLoc.isEmpty()) { - defaultLoc = locUtils.filterAllLoc(globalLoc); - if(defaultLoc != null) { - return defaultLoc; - } - } +// List<Loc> globalLoc = locUtils.getGlobalEmptyLoc(taskType, locTypeHeight, laneRowList, currentLev); +// //鑾峰彇搴撲綅 +// if (!globalLoc.isEmpty()) { +// defaultLoc = locUtils.filterAllLoc(globalLoc); +// if (defaultLoc != null) { +// return defaultLoc; +// } +// } } } @@ -226,7 +226,7 @@ return defaultLoc; } } - //fixme 濡傛灉娌℃湁鐩搁偦搴撲綅鏄惁鑰冭檻鎺ㄨ崘搴撲綅 + if (ruleDetl.getDetlType().equals(ShelvesRuleDetlType.SUGGEST.id)) { //鑾峰彇鎺ㄨ崘搴撲綅 List<Loc> suggestLoc = locUtils.getSuggestLoc(taskType, mat.getId(), batch, locTypeHeight, laneRowList, currentLev); @@ -240,15 +240,16 @@ } if (ruleDetl.getDetlType().equals(ShelvesRuleDetlType.COMPLETE.id)) { + return locUtils.getGlobalEmptyLocToCtu(locTypeHeight); //浠庡叏灞�搴撲綅涓幏鍙�(瀹屾暣宸烽亾) - List<Loc> globalLoc = locUtils.getGlobalLoc(taskType, locTypeHeight, laneRowList, currentLev); - //鑾峰彇搴撲綅 - if (!globalLoc.isEmpty()) { - defaultLoc = locUtils.filterAllLoc(globalLoc); - if (defaultLoc != null) { - return defaultLoc; - } - } +// List<Loc> globalLoc = locUtils.getGlobalLoc(taskType, locTypeHeight, laneRowList, currentLev); +// //鑾峰彇搴撲綅 +// if (!globalLoc.isEmpty()) { +// defaultLoc = locUtils.filterAllLoc(globalLoc); +// if (defaultLoc != null) { +// return defaultLoc; +// } +// } } } return defaultLoc; @@ -274,7 +275,7 @@ //鐢熸垚搴撲綅 Loc loc = this.generateLoc(param.getTaskType(), param.getBarcode(), param.getLocTypeHeight()); - if(loc == null) { + if (loc == null) { throw new CoolException("娌℃湁绌哄簱浣�"); } @@ -316,7 +317,7 @@ taskDetl.setMatId(waitPakin.getDetl$().getMatId()); taskDetl.setMatnr(waitPakin.getDetl$().getMat$().getMatnr()); boolean taskDetlSave = taskDetlService.save(taskDetl); - if(!taskDetlSave){ + if (!taskDetlSave) { throw new CoolException("浠诲姟鏄庣粏鐢熸垚澶辫触"); } @@ -329,7 +330,7 @@ taskDetlField.setDetlId(taskDetl.getId()); taskDetlField.setValue(orderDetlField.getValue()); boolean taskDetlFieldSave = taskDetlFieldService.save(taskDetlField); - if(!taskDetlFieldSave){ + if (!taskDetlFieldSave) { throw new CoolException("鏄庣粏鎵╁睍鐢熸垚澶辫触"); } } @@ -338,26 +339,26 @@ waitPakin.setIoStatus(1); waitPakin.setUpdateTime(new Date()); boolean waitPakinUpdate = waitPakinService.updateById(waitPakin); - if(!waitPakinUpdate){ + if (!waitPakinUpdate) { throw new CoolException("缁勬墭閫氱煡妗f洿鏂板け璐�"); } //鏇存柊璁㈠崟鏄庣粏鏁版嵁 OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId()); - if(orderDetl == null){ + if (orderDetl == null) { throw new CoolException("璁㈠崟鏄庣粏涓嶅瓨鍦�"); } orderDetl.setWorkQty(orderDetl.getWorkQty() + taskDetl.getAnfme()); orderDetl.setUpdateTime(new Date()); boolean orderDetlUpdate = orderDetlService.updateById(orderDetl); - if(!orderDetlUpdate){ + if (!orderDetlUpdate) { throw new CoolException("璁㈠崟鏄庣粏鏇存柊澶辫触"); } //鑾峰彇璁㈠崟 Order order = orderService.getById(taskDetl.getOrderId()); - if(order == null){ + if (order == null) { throw new CoolException("璁㈠崟涓嶅瓨鍦�"); } @@ -375,7 +376,7 @@ loc.setLocStsId(LocStsType.S.val()); loc.setUpdateTime(new Date()); boolean locUpdate = locService.updateById(loc); - if(!locUpdate){ + if (!locUpdate) { throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�"); } @@ -391,7 +392,7 @@ //鐢熸垚搴撲綅 Loc loc = this.generateEmptyLoc(param.getTaskType(), param.getLocTypeHeight()); - if(loc == null) { + if (loc == null) { throw new CoolException("娌℃湁绌哄簱浣�"); } @@ -414,7 +415,7 @@ loc.setLocStsId(LocStsType.S.val()); loc.setUpdateTime(new Date()); boolean locUpdate = locService.updateById(loc); - if(!locUpdate){ + if (!locUpdate) { throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�"); } @@ -424,7 +425,7 @@ @Override public boolean completeTask(Long taskId) { Task task = taskService.getById(taskId); - if(task == null){ + if (task == null) { throw new CoolException("浠诲姟涓嶅瓨鍦�"); } @@ -436,12 +437,12 @@ if (task.getTaskType() < 100) { //鍏ュ簱 task.setTaskSts(TaskStsType.COMPLETE_IN.id);//99.鍏ュ簱瀹屾垚 - }else { + } else { //鍑哄簱 TaskDetl taskDetl = taskDetls.get(0); //TODO 鍑哄簱娴佺▼寰呯‘璁わ紝ESS鍙栬揣鍚庯紝杈撻�佺嚎娴佽浆鍒版壂鐮佸鐘舵�� if (taskDetl.getWaveId() == null) { task.setTaskSts(TaskStsType.COMPLETE_OUT.id);//199.鍑哄簱瀹屾垚 - }else { + } else { task.setTaskSts(TaskStsType.WAVE_SEED.id);//198.鎾涓� } } @@ -458,7 +459,7 @@ @Transactional(rollbackFor = Exception.class) public boolean cancelTask(Long taskId) { Task task = taskService.getById(taskId); - if(task == null){ + if (task == null) { throw new CoolException("浠诲姟涓嶅瓨鍦�"); } @@ -471,15 +472,15 @@ case 54://骞舵澘 case 57://鐩樼偣 loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc())); - if(loc == null){ + if (loc == null) { throw new CoolException("搴撲綅涓嶅瓨鍦�"); } - if(loc.getLocStsId() != LocStsType.S.val()){ + if (loc.getLocStsId() != LocStsType.S.val()) { throw new CoolException("搴撲綅鐘舵�佷笉澶勪簬S.鍏ュ簱棰勭害"); } loc.setLocStsId(LocStsType.O.val()); loc.setUpdateTime(new Date()); - if(!locService.updateById(loc)){ + if (!locService.updateById(loc)) { throw new CoolException("搴撲綅鐘舵�佸彉鏇村け璐�"); } break; @@ -489,15 +490,15 @@ case 107://鐩樼偣 case 110://绌烘澘 loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc())); - if(loc == null){ + if (loc == null) { throw new CoolException("搴撲綅涓嶅瓨鍦�"); } - if(loc.getLocStsId() != LocStsType.R.val()){ + if (loc.getLocStsId() != LocStsType.R.val()) { throw new CoolException("搴撲綅鐘舵�佷笉澶勪簬R.鍑哄簱棰勭害"); } loc.setLocStsId(LocStsType.F.val()); loc.setUpdateTime(new Date()); - if(!locService.updateById(loc)){ + if (!locService.updateById(loc)) { throw new CoolException("搴撲綅鐘舵�佸彉鏇村け璐�"); } @@ -509,7 +510,7 @@ String matUniqueKey = Utils.getMatUniqueKey(taskDetl.getMatnr(), taskDetl.getBatch(), taskDetl.getUniqueField()); WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, taskDetl.getWaveId())); - if(waveDetl == null){ + if (waveDetl == null) { continue; } waveDetl.setWorkQty(waveDetl.getWorkQty() - taskDetl.getAnfme()); @@ -521,7 +522,7 @@ break; case 11://搴撲綅绉昏浆 Loc originLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc())); - if(originLoc == null){ + if (originLoc == null) { throw new CoolException("婧愬簱浣嶄笉瀛樺湪"); } if (originLoc.getLocStsId() != LocStsType.R.val()) { @@ -529,22 +530,22 @@ } loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc())); - if(loc == null){ + if (loc == null) { throw new CoolException("鐩爣搴撲綅涓嶅瓨鍦�"); } - if(loc.getLocStsId() != LocStsType.S.val()){ + if (loc.getLocStsId() != LocStsType.S.val()) { throw new CoolException("鐩爣搴撲綅鐘舵�佷笉澶勪簬S.鍏ュ簱棰勭害"); } originLoc.setLocStsId(LocStsType.F.val()); originLoc.setUpdateTime(new Date()); - if(!locService.updateById(originLoc)){ + if (!locService.updateById(originLoc)) { throw new CoolException("搴撲綅鐘舵�佸彉鏇村け璐�"); } loc.setLocStsId(LocStsType.O.val()); loc.setUpdateTime(new Date()); - if(!locService.updateById(loc)){ + if (!locService.updateById(loc)) { throw new CoolException("搴撲綅鐘舵�佸彉鏇村け璐�"); } break; @@ -560,7 +561,7 @@ //鍒犻櫎浠诲姟 boolean removeTask = taskService.removeById(taskId); - if(!removeTask){ + if (!removeTask) { throw new CoolException("鍥炴粴浠诲姟澶辫触"); } @@ -579,14 +580,14 @@ //鍏ュ簱鍥炴粴缁勬墭閫氱煡妗� if (task.getTaskType() == 1) { WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getDetlId, taskDetl.getDetlId()).eq(WaitPakin::getBarcode, task.getBarcode())); - if(waitPakin == null){ + if (waitPakin == null) { throw new CoolException("缁勬墭閫氱煡妗d笉瀛樺湪"); } waitPakin.setIoStatus(0); waitPakin.setUpdateTime(new Date()); boolean updateWaitPakin = waitPakinService.updateById(waitPakin); - if(!updateWaitPakin){ + if (!updateWaitPakin) { throw new CoolException("缁勬墭閫氱煡妗e洖婊氬け璐�"); } } @@ -602,7 +603,7 @@ //鍒犻櫎鏄庣粏 boolean removeDetl = taskDetlService.removeById(taskDetl.getId()); - if(!removeDetl){ + if (!removeDetl) { throw new CoolException("鍥炴粴鏄庣粏澶辫触"); } @@ -619,7 +620,7 @@ //鍒犻櫎鏄庣粏鎵╁睍 boolean removeField = taskDetlFieldService.removeById(detlField.getId()); - if(!removeField){ + if (!removeField) { throw new CoolException("鍥炴粴鎵╁睍鏄庣粏澶辫触"); } } @@ -633,7 +634,7 @@ @Transactional(rollbackFor = Exception.class) public boolean pickTask(Long taskId) { Task task = taskService.getById(taskId); - if(task == null){ + if (task == null) { throw new CoolException("浠诲姟涓嶅瓨鍦�"); } @@ -647,21 +648,23 @@ //鑾峰彇婧愬簱浣� Loc originLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc())); - if(originLoc == null){ + if (originLoc == null) { throw new CoolException("婧愬簱浣嶄笉瀛樺湪"); } //鑾峰彇婧愬簱浣嶉珮搴� LocTypeBind locTypeBind = locTypeBindService.getOne(new LambdaQueryWrapper<LocTypeBind>().eq(LocTypeBind::getLocId, originLoc.getId()).in(LocTypeBind::getTypeId, LocBindType.HEIGHT.list())); - if(locTypeBind == null){ + if (locTypeBind == null) { throw new CoolException("搴撲綅绫诲瀷涓嶅瓨鍦�"); } LocType locType = locTypeService.getById(locTypeBind.getTypeId()); - if(locType == null){ + + if (locType == null) { throw new CoolException("搴撲綅绫诲瀷涓嶅瓨鍦�"); } LocTypeHeightType locTypeHeightType = LocTypeHeightType.get(locType.getFlag()); - if(locTypeHeightType == null){ + + if (locTypeHeightType == null) { throw new CoolException("楂樹綆搴撲綅绫诲瀷涓嶅瓨鍦�"); } @@ -672,26 +675,30 @@ throw new CoolException("浠诲姟鏄庣粏涓嶅瓨鍦�"); } TaskDetl taskDetl = taskDetls.get(0); - - //鐢熸垚搴撲綅 - Loc loc = this.generateLoc(taskType, taskDetl.getMatId(), taskDetl.getBatch(), taskDetl.getUniqueField(), locTypeHeightType.id); - if(loc == null) { + //鐢熸垚鏂扮殑搴撲綅 !important +// Loc loc = this.generateLoc(taskType, taskDetl.getMatId(), taskDetl.getBatch(), taskDetl.getUniqueField(), locTypeHeightType.id); +// if(loc == null) { +// throw new CoolException("娌℃湁绌哄簱浣�"); +// } + Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc())); + if (loc == null) { throw new CoolException("娌℃湁绌哄簱浣�"); } //102鎷f枡姝ゅ闇�淇敼涓篧CS_CONTAINER_RECEIVE,瀹氭椂浠诲姟鏌ヨ鍚庯紝鑷姩涓嬪彂鍏ュ簱浠诲姟鑷矱SS task.setTaskSts(TaskStsType.WCS_CONTAINER_RECEIVE.id);//1.鐢熸垚鍏ュ簱浠诲姟 task.setTaskType(taskType); - task.setTargetLoc(loc.getLocNo()); + //鍘熷簱浣嶅彉鐩爣搴撲綅, 鍘熺珯鐐瑰彉鐩爣绔欑偣 + //todo 闇�纭鍘熺珯鐐逛负绌猴紝璇ユ�庝箞澶勭悊 + task.setTargetLoc(task.getOriginLoc()); task.setUpdateTime(new Date()); if (!taskService.updateById(task)) { throw new CoolException("鎷f枡澶辫触"); } - - //搴撲綅O => S + //搴撲綅鐘舵�佹敼涓洪绾﹀叆搴� R => S loc.setLocStsId(LocStsType.S.val()); loc.setUpdateTime(new Date()); boolean locUpdate = locService.updateById(loc); - if(!locUpdate){ + if (!locUpdate) { throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�"); } @@ -699,7 +706,7 @@ } @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public boolean locAdjust(LocAdjustParam param) { if (param == null) { throw new CoolException("鍙傛暟涓嶈兘涓虹┖"); @@ -791,7 +798,7 @@ throw new CoolException("鐩爣搴撲綅涓嶅瓨鍦�"); } - if(targetLoc.getLocStsId() != LocStsType.O.val()){ + if (targetLoc.getLocStsId() != LocStsType.O.val()) { throw new CoolException("鐩爣搴撲綅闈炵┖鐘舵��"); } @@ -816,7 +823,7 @@ } List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, sourceLoc.getId())); - if(locDetls.isEmpty()){ + if (locDetls.isEmpty()) { throw new CoolException("婧愬簱浣嶆槑缁嗕笉瀛樺湪"); } @@ -832,7 +839,7 @@ taskDetl.setMatId(locDetl.getMatId()); taskDetl.setMatnr(locDetl.getMatnr()); boolean taskDetlSave = taskDetlService.save(taskDetl); - if(!taskDetlSave){ + if (!taskDetlSave) { throw new CoolException("浠诲姟鏄庣粏鐢熸垚澶辫触"); } @@ -845,7 +852,7 @@ taskDetlField.setDetlId(taskDetl.getId()); taskDetlField.setValue(locDetlField.getValue()); boolean taskDetlFieldSave = taskDetlFieldService.save(taskDetlField); - if(!taskDetlFieldSave){ + if (!taskDetlFieldSave) { throw new CoolException("鏄庣粏鎵╁睍鐢熸垚澶辫触"); } } @@ -855,7 +862,7 @@ sourceLoc.setLocStsId(LocStsType.R.val()); sourceLoc.setUpdateTime(new Date()); boolean sourceLocUpdate = locService.updateById(sourceLoc); - if(!sourceLocUpdate){ + if (!sourceLocUpdate) { throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�"); } @@ -863,7 +870,7 @@ targetLoc.setLocStsId(LocStsType.S.val()); targetLoc.setUpdateTime(new Date()); boolean targetLocUpdate = locService.updateById(targetLoc); - if(!targetLocUpdate){ + if (!targetLocUpdate) { throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�"); } -- Gitblit v1.9.1