From e711c834aec2293c53b07efe53e81e3573c289b6 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期三, 01 四月 2026 11:42:44 +0800
Subject: [PATCH] lsh#
---
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java | 217 +++++++++++++++++++++++++++++++++++------------------
1 files changed, 143 insertions(+), 74 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
index 4e19cfd..6d3f168 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
@@ -27,8 +27,10 @@
import com.vincent.rsf.server.api.utils.LocUtils;
import com.vincent.rsf.server.api.utils.SlaveProperties;
import com.vincent.rsf.server.manager.entity.*;
+import com.vincent.rsf.server.manager.mapper.LocItemMapper;
import com.vincent.rsf.server.manager.service.*;
import com.vincent.rsf.server.manager.service.impl.LocServiceImpl;
+import com.vincent.rsf.server.manager.utils.WarehouseLocationRetrievalUtil;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.manager.enums.LocStsType;
import com.vincent.rsf.server.system.entity.*;
@@ -67,7 +69,7 @@
@Autowired
private LocServiceImpl locService;
@Autowired
- private LocItemService locItemService;
+ private LocItemMapper locItemMapper;
@Autowired
private SlaveProperties slaveProperties;
@Autowired
@@ -129,7 +131,7 @@
public InTaskMsgDto createInTask(TaskInParam param) {
// 楠岃瘉璁惧绔欑偣
- DeviceSite deviceSite = validateDeviceSite(param);
+// DeviceSite deviceSite = validateDeviceSite(param);
// 楠岃瘉缁勬嫋鐘舵��
WaitPakin waitPakin = validateWaitPakin(param.getBarcode());
@@ -147,7 +149,7 @@
// 鍒涘缓骞朵繚瀛樹换鍔�
Task task = createTask(ruleCode, locNo.getLocNo(), waitPakin.getBarcode(),
- deviceSite.getDeviceSite(), param.getSourceStaNo().toString(), param.getUser());
+ null, param.getSourceStaNo().toString(), param.getUser());
// 鏇存柊搴撲綅鐘舵��
updateLocStatus(task.getTargLoc(), waitPakin.getBarcode());
@@ -170,16 +172,16 @@
/**
* 楠岃瘉璁惧绔欑偣
*/
- private DeviceSite validateDeviceSite(TaskInParam param) {
- DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
- .eq(DeviceSite::getSite, param.getSourceStaNo())
- .eq(DeviceSite::getType, param.getIoType()));
-
- if (Objects.isNull(deviceSite)) {
- throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
- }
- return deviceSite;
- }
+// private DeviceSite validateDeviceSite(TaskInParam param) {
+// DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+// .eq(DeviceSite::getSite, param.getSourceStaNo())
+// .eq(DeviceSite::getType, param.getIoType()));
+//
+// if (Objects.isNull(deviceSite)) {
+// throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
+// }
+// return deviceSite;
+// }
/**
* 楠岃瘉缁勬嫋鐘舵��
@@ -233,10 +235,17 @@
* 鏇存柊搴撲綅鐘舵��
*/
private void updateLocStatus(String locCode, String barcode) {
- boolean updated = locService.update(new LambdaUpdateWrapper<Loc>()
- .eq(Loc::getCode, locCode)
- .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type)
- .set(Loc::getBarcode, barcode));
+ Loc current = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, locCode));
+ if (Objects.isNull(current)) {
+ throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
+ }
+ Loc update = new Loc();
+ update.setId(current.getId());
+ update.setVersion(current.getVersion());
+ update.setUseStatus(LocStsType.LOC_STS_TYPE_S.type);
+ update.setBarcode(barcode);
+ boolean updated = locService.update(update, new LambdaUpdateWrapper<Loc>()
+ .eq(Loc::getId, current.getId()));
if (!updated) {
throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
}
@@ -283,11 +292,19 @@
* 鏇存柊缁勬墭鐘舵��
*/
private void updateWaitPakinStatus(String barcode, Long loginUserId) {
- boolean updated = waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>()
- .eq(WaitPakin::getBarcode, barcode)
- .set(WaitPakin::getUpdateBy, loginUserId)
- .set(WaitPakin::getCreateBy, loginUserId)
- .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val));
+ WaitPakin current = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
+ .eq(WaitPakin::getBarcode, barcode));
+ if (Objects.isNull(current)) {
+ throw new CoolException("缁勬墭鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
+ WaitPakin update = new WaitPakin();
+ update.setId(current.getId());
+ update.setVersion(current.getVersion());
+ update.setUpdateBy(loginUserId);
+ update.setCreateBy(loginUserId);
+ update.setIoStatus(PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val);
+ boolean updated = waitPakinService.update(update, new LambdaUpdateWrapper<WaitPakin>()
+ .eq(WaitPakin::getId, current.getId()));
if (!updated) {
throw new CoolException("缁勬墭鐘舵�佷慨鏀瑰け璐ワ紒锛�");
@@ -377,6 +394,42 @@
// return locNo;
// }
@Override
+ public InTaskMsgDto getLocNoArea(TaskInParam param) throws Exception {
+ String matnr = null;
+ String batch = null;
+ List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, param.getBarcode()));
+ if (Cools.isEmpty(waitPakins) && param.getIoType().equals(TaskType.TASK_TYPE_IN.type)) {
+ throw new CoolException("鏈壘鍒扮粍鎵樹俊鎭紝璇风粍鎵�");
+ } else if (!Cools.isEmpty(waitPakins)) {
+ matnr = waitPakins.get(0).getCode();
+ batch = waitPakins.get(0).getCode();
+ }
+
+ DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(param.getSourceStaNo()));
+ if (Cools.isEmpty(deviceBind)) {
+ throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�===>搴撲綅瑙勫垯鏈煡");
+ }
+ WarehouseAreas warehouseArea = warehouseAreasService.getById(deviceBind.getTypeId());
+ if (Cools.isEmpty(warehouseArea)) {
+ throw new CoolException("鏈壘鍒版墍灞炲簱鍖轰俊鎭�");
+ }
+ LocTypeDto locTypeDto = new LocTypeDto(param);
+ InTaskMsgDto dto = null;
+ //鏍规嵁绔嬪簱绫诲瀷鑾峰彇鑾峰彇搴撲綅
+ if (warehouseArea.getType().equals(WarehType.WAREHOUSE_TYPE_CRN.val)) {
+ //鍫嗗灈鏈�
+ dto = getLocNoCrn(param.getOrgLoc(), deviceBind, warehouseArea.getId(), param.getSourceStaNo(), matnr, batch, locTypeDto, 0, param.getIoType());
+
+ } else if (warehouseArea.getType().equals(WarehType.WAREHOUSE_TYPE_FOUR_DIRECTIONS.val)) {
+ //鍥涘悜搴�
+ } else {
+ //CTU 搴撲互鍙婂叾瀹�
+ dto = getLocNoCtu(deviceBind, warehouseArea.getId(), param.getSourceStaNo(), matnr, batch, locTypeDto, 0, param.getIoType());
+ }
+ return dto;
+ }
+
+ @Override
public InTaskMsgDto getLocNo(TaskInParam param) throws Exception {
String matnr = null;
String batch = null;
@@ -387,13 +440,13 @@
matnr = waitPakins.get(0).getCode();
batch = waitPakins.get(0).getCode();
}
- List<DeviceSite> deviceSites = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>()
- .eq(DeviceSite::getSite, param.getSourceStaNo())
- .eq(DeviceSite::getType, param.getIoType())
- );
- if (Cools.isEmpty(deviceSites)) {
- throw new CoolException("鏈壘鍒扮珯鐐硅矾寰勪俊鎭�");
- }
+// List<DeviceSite> deviceSites = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>()
+// .eq(DeviceSite::getSite, param.getSourceStaNo())
+// .eq(DeviceSite::getType, param.getIoType())
+// );
+// if (Cools.isEmpty(deviceSites)) {
+// throw new CoolException("鏈壘鍒扮珯鐐硅矾寰勪俊鎭�");
+// }
DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(param.getSourceStaNo()));
if (Cools.isEmpty(deviceBind)) {
throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�===>搴撲綅瑙勫垯鏈煡");
@@ -694,7 +747,7 @@
//鍏ュ簱闈犺繎鎽嗘斁
if (ioType == 1 && deviceBind.getBeSimilar().equals("1") && !Cools.isEmpty(matnr) && Cools.isEmpty(orgLoc)) {
if (nearRow != curRow) {
- List<LocItem> locItems = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getMatnrCode, matnr));
+ List<LocItem> locItems = locItemMapper.selectList(new LambdaQueryWrapper<LocItem>().eq(LocItem::getMatnrCode, matnr));
for (LocItem locItem : locItems) {
Loc loc1 = locService.getById(locItem.getLocId());
if (LocUtils.isShallowLoc(loc1.getCode())) {
@@ -714,40 +767,22 @@
}
}
-// // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //浜掗�氱増
-// if (ioType == 10 && deviceBind.getEmptySimilar().equals("1")) {
-// List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
-// .eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow).eq("whs_type", rowLastnoType.getType().longValue()));
-// if (!locMasts.isEmpty()) {
-// for (LocMast loc : locMasts) {
-// if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
-// continue;
-// }
-// String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
-// // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
-// LocMast shallowLoc = locMastService.selectById(shallowLocNo);
-// if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
-// if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
-// if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
-// locMast = shallowLoc;
-// crnNo = locMast.getCrnNo();
-// break;
-// }
-// }
-// }
-// }
-// }
-// }
- //鏌ユ壘璺緞
- DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
- .eq(DeviceSite::getType, ioType)
- .eq(DeviceSite::getSite, sourceStaNo)
- .eq(DeviceSite::getChannel, channel).last("limit 1")
- );
- if (Cools.isEmpty(deviceSite)) {
- channel = 0;
- } else {
- inTaskMsgDto.setStaNo(deviceSite.getDeviceSite());
+
+
+ if (loc != null) {
+ //鏌ユ壘璺緞
+ boolean available = new WarehouseLocationRetrievalUtil().queryPathIsItAvailableInArea(sourceStaNo, loc.getAreaId().toString() ,loc.getBarcode(),"in");
+// DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+// .eq(DeviceSite::getType, ioType)
+// .eq(DeviceSite::getSite, sourceStaNo)
+// .eq(DeviceSite::getChannel, channel).last("limit 1")
+// );
+ if (!available) {
+ channel = 0;
+ loc = null;
+ } else {
+ inTaskMsgDto.setStaNo(sourceStaNo);
+ }
}
//鏇存柊褰撳墠鎺�
@@ -875,6 +910,23 @@
}
}
}
+
+ if (loc != null) {
+ //鏌ユ壘璺緞
+ boolean available = new WarehouseLocationRetrievalUtil().queryPathIsItAvailableInArea(sourceStaNo, loc.getAreaId().toString() ,loc.getBarcode(),"in");
+// DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+// .eq(DeviceSite::getType, ioType)
+// .eq(DeviceSite::getSite, sourceStaNo)
+// .eq(DeviceSite::getChannel, channel).last("limit 1")
+// );
+ if (!available) {
+ channel = 0;
+ loc = null;
+ } else {
+ inTaskMsgDto.setStaNo(sourceStaNo);
+ }
+ }
+
//鏌ヨ褰撳墠搴撲綅绫诲瀷绌哄簱浣� 灏忎簬5涓垯locmast = null
List<Loc> locTypeLocMasts = locService.list(new LambdaQueryWrapper<Loc>()
.eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
@@ -938,18 +990,34 @@
loc = loc2;
break;
}
+
//鏌ユ壘璺緞
- DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
- .eq(DeviceSite::getType, ioType)
- .eq(DeviceSite::getSite, sourceStaNo)
- .eq(!Objects.isNull(loc.getDeviceNo()), DeviceSite::getDeviceCode, loc.getDeviceNo())
- );
- if (Cools.isEmpty(deviceSite)) {
- deviceNo = 0;
- loc = null;
- } else {
- inTaskMsgDto.setStaNo(deviceSite.getDeviceSite());
+ if (loc != null) {
+ //鏌ユ壘璺緞
+ boolean available = new WarehouseLocationRetrievalUtil().queryPathIsItAvailableInArea(sourceStaNo, loc.getAreaId().toString() ,loc.getBarcode(),"in");
+// DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+// .eq(DeviceSite::getType, ioType)
+// .eq(DeviceSite::getSite, sourceStaNo)
+// .eq(DeviceSite::getChannel, channel).last("limit 1")
+// );
+ if (!available) {
+ deviceNo = 0;
+ loc = null;
+ } else {
+ inTaskMsgDto.setStaNo(sourceStaNo);
+ }
}
+// DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+// .eq(DeviceSite::getType, ioType)
+// .eq(DeviceSite::getSite, sourceStaNo)
+// .eq(!Objects.isNull(loc.getDeviceNo()), DeviceSite::getDeviceCode, loc.getDeviceNo())
+// );
+// if (Cools.isEmpty(deviceSite)) {
+// deviceNo = 0;
+// loc = null;
+// } else {
+// inTaskMsgDto.setStaNo(deviceSite.getDeviceSite());
+// }
// 閫掑綊鏌ヨ
if (Cools.isEmpty(loc) || !loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
// 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
@@ -1204,3 +1272,4 @@
// return R.ok(JSONObject.toJSONString(params));
}
}
+
--
Gitblit v1.9.1