From 8dfd55ef1c0eccf3adf105f0d4f5828bdbc3f86d Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期五, 23 一月 2026 18:52:47 +0800
Subject: [PATCH] lsh#自动组托
---
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java | 103 +++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 91 insertions(+), 12 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java
index 929447f..065379f 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java
@@ -94,6 +94,73 @@
if (!matches) {
throw new CoolException("鏉$爜涓庣珯鐐逛笉鍖归厤");
}
+ } else {
+ throw new CoolException("鏁版嵁寮傚父锛氶獙璇佸熀纭�淇℃伅");
+ }
+
+ return basStation;
+ }
+
+
+ private BasStation checkStaStatus(String barcode, String sta,String area) {
+ if (Cools.isEmpty(barcode)) {
+ throw new CoolException("瀹瑰櫒鐮佷笉鑳戒负绌�");
+ }
+ if (Cools.isEmpty(sta)) {
+ throw new CoolException("鎺ラ┏浣嶄笉鑳戒负绌�");
+ }
+ BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+ .eq(BasStation::getBarcode, barcode)
+ , false
+ );
+ if (!Cools.isEmpty(isBarcodeSta)) {
+ throw new CoolException("璇ユ潯鐮佸凡琚�" + isBarcodeSta.getStationName() + "绔欑粦瀹�");
+ }
+ BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+ .eq(BasStation::getStationName, sta)
+ );
+ if (Cools.isEmpty(basStation)) {
+ throw new CoolException("鏈壘鍒扮珯鐐逛俊鎭�");
+ }
+ if (!basStation.getUseStatus().equals("O")) {
+ throw new CoolException("绔欑偣鐘舵�佷笉涓虹┖闂�");
+ }
+
+ List<String> areaList = JSONObject.parseArray(basStation.getCrossZoneArea(), String.class);
+ if (!areaList.contains(area)) {
+ throw new CoolException("褰撳墠绔欑偣涓嶆敮鎸佺洰鏍囧簱鍖�");
+ }
+ if (!Cools.isEmpty(basStation.getContainerType())) {
+ List<Long> longs1 = JSONObject.parseArray(basStation.getContainerType(), Long.class);
+ List<BasContainer> containers = basContainerService.list(
+ new LambdaQueryWrapper<BasContainer>()
+ .in(BasContainer::getContainerType, longs1)
+ );
+ boolean matches = false;
+ boolean matches2 = true;
+ for (BasContainer container : containers) {
+ String codeType = container.getCodeType(); // 鑾峰彇姝e垯琛ㄨ揪寮�
+ if (barcode.matches(codeType)) { // 鍒ゆ柇鏉$爜鏄惁绗﹀悎杩欎釜姝e垯
+ List<Integer> areaList2 = container.getAreas();
+ if (!areaList2.contains(Integer.parseInt(area))) {
+ matches2 = false;
+ continue;
+ }
+ matches = true;
+ break; // 鎵惧埌鍖归厤鐨勫氨閫�鍑哄惊鐜�
+ }
+ }
+// boolean matches = containers.stream()
+// .map(BasContainer::getCodeType)
+// .anyMatch(codeType -> barcode.matches(codeType));
+ if (!matches2) {
+ throw new CoolException("鏌ヨ鍒扮殑瀹瑰櫒涓嶆敮鎸佺洰鏍囧簱鍖�");
+ }
+ if (!matches) {
+ throw new CoolException("鏉$爜涓庣珯鐐逛笉鍖归厤");
+ }
+ } else {
+ throw new CoolException("鏁版嵁寮傚父锛氶獙璇佸熀纭�淇℃伅");
}
return basStation;
@@ -103,11 +170,16 @@
@Transactional(rollbackFor = Exception.class)
public synchronized R generateTasks(PdaGeneralParam param, Long loginUserId) {
- DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>().eq(DeviceSite::getSite,param.getTransferStationNo()).orderByDesc(DeviceSite::getId),false);
- if (Objects.isNull(deviceSite)) {
- throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
+// DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>().eq(DeviceSite::getSite,param.getTransferStationNo()).orderByDesc(DeviceSite::getId),false);
+// if (Objects.isNull(deviceSite)) {
+// throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
+// }
+ BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+ .eq(BasStation::getStationName, param.getTransferStationNo()));
+ if (Objects.isNull(station) || !station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
+ throw new CoolException("绔欑偣涓嶅瓨鍦ㄦ垨绔欑偣涓嶅浜庣┖搴撶姸鎬侊紒锛�");
}
- DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(deviceSite.getSite()));
+ DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(station.getStationName()));
if (Cools.isEmpty(deviceBind)) {
throw new CoolException("搴撲綅瑙勫垯鏈煡");
}
@@ -122,7 +194,7 @@
// throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
// }
//楠岃瘉鍩虹淇℃伅
- BasStation basStation = checkStaStatus(param.getContainerNo(), param.getTransferStationNo());
+ checkStaStatus(param.getContainerNo(), param.getTransferStationNo());
/**鑾峰彇搴撲綅*/
String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), null);
if (Cools.isEmpty(targetLoc)) {
@@ -139,18 +211,13 @@
.setTaskType(TaskType.TASK_TYPE_EMPITY_IN.type)
.setWarehType(WarehType.WAREHOUSE_TYPE_AGV.val)//lsh寰呬慨鏀�
.setTargLoc(targetLoc)
- .setOrgSite(deviceSite.getSite())
+ .setOrgSite(station.getStationName())
.setBarcode(param.getContainerNo())
- .setTargSite(deviceSite.getDeviceSite())
+ .setTargSite(station.getStationName())
.setCreateBy(loginUserId)
.setUpdateBy(loginUserId);
if (!taskService.save(task)) {
throw new CoolException("浠诲姟淇濆瓨澶辫触锛侊紒");
- }
- BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
- .eq(BasStation::getStationName, deviceSite.getSite()));
- if (Objects.isNull(station) || !station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
- throw new CoolException("绔欑偣涓嶅瓨鍦ㄦ垨绔欑偣涓嶅浜庣┖搴撶姸鎬侊紒锛�");
}
station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type);
@@ -164,4 +231,16 @@
return R.ok("浠诲姟鐢熸垚瀹屾瘯锛�");
}
+ @Override
+ public R checkAgvStation(PdaGeneralParam param, Long loginUserId) {
+ if (Cools.isEmpty(param.getTransferStationNo())) {
+ return R.error("鏃犲弬鏁�");
+ }
+ BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationId, param.getTransferStationNo()));
+ if (Cools.isEmpty(basStation)) {
+ return R.error("鏈壘鍒板尮閰嶇珯鐐�");
+ }
+ return R.ok(basStation);
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.1