From a16d3fbdfd6f051ae471d01a874c528075407981 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期五, 28 二月 2025 08:10:17 +0800
Subject: [PATCH] #优化 绑定集货区后,数据刷新
---
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/WorkServiceImpl.java | 115 ++++++++++++++++++++++++++++++---------------------------
1 files changed, 60 insertions(+), 55 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 190b579..b801644 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
@@ -90,7 +90,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 +114,7 @@
}
List<ShelvesRuleDetl> ruleDetls = shelvesRule.getRuleDetl$();
- if(ruleDetls.isEmpty()) {
+ if (ruleDetls.isEmpty()) {
throw new CoolException("鏈厤缃笂鏋惰鍒欐槑缁�");
}
@@ -135,7 +135,7 @@
//鑾峰彇搴撲綅
if (!suggestLoc.isEmpty()) {
defaultLoc = locUtils.filterLoc(taskType, suggestLoc);
- if(defaultLoc != null) {
+ if (defaultLoc != null) {
return defaultLoc;
}
}
@@ -147,7 +147,7 @@
//鑾峰彇搴撲綅
if (!globalLoc.isEmpty()) {
defaultLoc = locUtils.filterAllLoc(globalLoc);
- if(defaultLoc != null) {
+ if (defaultLoc != null) {
return defaultLoc;
}
}
@@ -274,7 +274,7 @@
//鐢熸垚搴撲綅
Loc loc = this.generateLoc(param.getTaskType(), param.getBarcode(), param.getLocTypeHeight());
- if(loc == null) {
+ if (loc == null) {
throw new CoolException("娌℃湁绌哄簱浣�");
}
@@ -316,7 +316,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 +329,7 @@
taskDetlField.setDetlId(taskDetl.getId());
taskDetlField.setValue(orderDetlField.getValue());
boolean taskDetlFieldSave = taskDetlFieldService.save(taskDetlField);
- if(!taskDetlFieldSave){
+ if (!taskDetlFieldSave) {
throw new CoolException("鏄庣粏鎵╁睍鐢熸垚澶辫触");
}
}
@@ -338,26 +338,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 +375,7 @@
loc.setLocStsId(LocStsType.S.val());
loc.setUpdateTime(new Date());
boolean locUpdate = locService.updateById(loc);
- if(!locUpdate){
+ if (!locUpdate) {
throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�");
}
@@ -391,7 +391,7 @@
//鐢熸垚搴撲綅
Loc loc = this.generateEmptyLoc(param.getTaskType(), param.getLocTypeHeight());
- if(loc == null) {
+ if (loc == null) {
throw new CoolException("娌℃湁绌哄簱浣�");
}
@@ -414,7 +414,7 @@
loc.setLocStsId(LocStsType.S.val());
loc.setUpdateTime(new Date());
boolean locUpdate = locService.updateById(loc);
- if(!locUpdate){
+ if (!locUpdate) {
throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�");
}
@@ -424,7 +424,7 @@
@Override
public boolean completeTask(Long taskId) {
Task task = taskService.getById(taskId);
- if(task == null){
+ if (task == null) {
throw new CoolException("浠诲姟涓嶅瓨鍦�");
}
@@ -436,12 +436,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 +458,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 +471,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 +489,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 +509,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 +521,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 +529,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 +560,7 @@
//鍒犻櫎浠诲姟
boolean removeTask = taskService.removeById(taskId);
- if(!removeTask){
+ if (!removeTask) {
throw new CoolException("鍥炴粴浠诲姟澶辫触");
}
@@ -579,14 +579,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 +602,7 @@
//鍒犻櫎鏄庣粏
boolean removeDetl = taskDetlService.removeById(taskDetl.getId());
- if(!removeDetl){
+ if (!removeDetl) {
throw new CoolException("鍥炴粴鏄庣粏澶辫触");
}
@@ -619,7 +619,7 @@
//鍒犻櫎鏄庣粏鎵╁睍
boolean removeField = taskDetlFieldService.removeById(detlField.getId());
- if(!removeField){
+ if (!removeField) {
throw new CoolException("鍥炴粴鎵╁睍鏄庣粏澶辫触");
}
}
@@ -633,7 +633,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 +647,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,27 +674,30 @@
throw new CoolException("浠诲姟鏄庣粏涓嶅瓨鍦�");
}
TaskDetl taskDetl = taskDetls.get(0);
-
//鐢熸垚鏂扮殑搴撲綅 !important
- Loc loc = this.generateLoc(taskType, taskDetl.getMatId(), taskDetl.getBatch(), taskDetl.getUniqueField(), locTypeHeightType.id);
-
- if(loc == null) {
+// 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("搴撲綅鐘舵�佹洿鏂板け璐�");
}
@@ -700,7 +705,7 @@
}
@Override
- @Transactional
+ @Transactional(rollbackFor = Exception.class)
public boolean locAdjust(LocAdjustParam param) {
if (param == null) {
throw new CoolException("鍙傛暟涓嶈兘涓虹┖");
@@ -792,7 +797,7 @@
throw new CoolException("鐩爣搴撲綅涓嶅瓨鍦�");
}
- if(targetLoc.getLocStsId() != LocStsType.O.val()){
+ if (targetLoc.getLocStsId() != LocStsType.O.val()) {
throw new CoolException("鐩爣搴撲綅闈炵┖鐘舵��");
}
@@ -817,7 +822,7 @@
}
List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, sourceLoc.getId()));
- if(locDetls.isEmpty()){
+ if (locDetls.isEmpty()) {
throw new CoolException("婧愬簱浣嶆槑缁嗕笉瀛樺湪");
}
@@ -833,7 +838,7 @@
taskDetl.setMatId(locDetl.getMatId());
taskDetl.setMatnr(locDetl.getMatnr());
boolean taskDetlSave = taskDetlService.save(taskDetl);
- if(!taskDetlSave){
+ if (!taskDetlSave) {
throw new CoolException("浠诲姟鏄庣粏鐢熸垚澶辫触");
}
@@ -846,7 +851,7 @@
taskDetlField.setDetlId(taskDetl.getId());
taskDetlField.setValue(locDetlField.getValue());
boolean taskDetlFieldSave = taskDetlFieldService.save(taskDetlField);
- if(!taskDetlFieldSave){
+ if (!taskDetlFieldSave) {
throw new CoolException("鏄庣粏鎵╁睍鐢熸垚澶辫触");
}
}
@@ -856,7 +861,7 @@
sourceLoc.setLocStsId(LocStsType.R.val());
sourceLoc.setUpdateTime(new Date());
boolean sourceLocUpdate = locService.updateById(sourceLoc);
- if(!sourceLocUpdate){
+ if (!sourceLocUpdate) {
throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�");
}
@@ -864,7 +869,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