From f049bb4a433b3fba1859b78e097689628f72af45 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期三, 14 一月 2026 16:00:03 +0800
Subject: [PATCH] lsh#
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 90 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 81 insertions(+), 9 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
index d19b6b7..2f3fb15 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -154,6 +154,7 @@
.setTaskType(TaskType.TASK_TYPE_IN.type)
.setWarehType(WarehType.WAREHOUSE_TYPE_AGV.val)
.setTargLoc(targetLoc)
+ .setTargSite(orgSta)
.setOrgSite(orgSta)
.setBarcode(pakin.getBarcode())
.setCreateBy(loginUserId)
@@ -340,7 +341,7 @@
// }
//楠岃瘉鍩虹淇℃伅
- BasStation basStation = checkStaStatus(pakin.getBarcode(), deviceSite.getSite());
+ checkStaStatus(pakin.getBarcode(), deviceSite.getSite(),warehouseArea.getId().toString());
/**鑾峰彇搴撲綅*/
String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), null);
if (Cools.isEmpty(targetLoc)) {
@@ -448,6 +449,76 @@
return R.ok("浠诲姟鐢熸垚瀹屾瘯锛�");
}
+ private BasStation checkStaStatus(String barcode, String sta,String area) {
+ if (Cools.isEmpty(barcode)) {
+ throw new CoolException("瀹瑰櫒鐮佷笉鑳戒负绌�");
+ }
+ if (Cools.isEmpty(sta)) {
+ throw new CoolException("鎺ラ┏浣嶆潯鐮佷笉鑳戒负绌�");
+ }
+ WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
+ .eq(WaitPakin::getBarcode, barcode)
+ .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val)
+ );
+ if (Cools.isEmpty(waitPakin)) {
+ 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<String> areaList2 = JSONObject.parseArray(container.getAreas(), String.class);
+ if (!areaList2.contains(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;
+ }
private BasStation checkStaStatus(String barcode, String sta) {
if (Cools.isEmpty(barcode)) {
@@ -492,6 +563,8 @@
if (!matches) {
throw new CoolException("鏉$爜涓庣珯鐐逛笉鍖归厤");
}
+ } else {
+ throw new CoolException("鏁版嵁寮傚父锛氶獙璇佸熀纭�淇℃伅");
}
return basStation;
@@ -509,11 +582,11 @@
throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
}
- DeviceSite deviceSite = deviceSiteService.getById(waitPakin.getSiteId());
- if (Objects.isNull(deviceSite)) {
+ BasStation basStation = basStationService.getById(waitPakin.getSiteId());
+ if (Objects.isNull(basStation)) {
throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
}
- DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(deviceSite.getSite()));
+ DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(basStation.getStationName()));
if (Cools.isEmpty(deviceBind)) {
throw new CoolException("搴撲綅瑙勫垯鏈煡");
}
@@ -534,8 +607,7 @@
//楠岃瘉鍩虹淇℃伅
- BasStation basStation = checkStaStatus(pakin.getBarcode(), deviceSite.getSite());
-
+ checkStaStatus(pakin.getBarcode(),basStation.getStationName(),warehouseArea.getId().toString());
// BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
// .eq(BasContainer::getCode, pakin.getBarcode()));
// if (Objects.isNull(container)) {
@@ -559,8 +631,8 @@
.setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val)
.setTargLoc(targetLoc)
.setBarcode(pakin.getBarcode())
- .setOrgSite(deviceSite.getSite())
- .setTargSite(deviceSite.getDeviceSite())
+ .setOrgSite(basStation.getStationName())
+ .setTargSite(basStation.getStationName())
.setCreateBy(loginUserId)
.setUpdateBy(loginUserId);
@@ -711,7 +783,7 @@
*/
private Task modiftyTaskSort(Task task, Long loginUserId) {
String curLoc;
- if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) {
+ if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
curLoc = task.getTargLoc();
} else {
curLoc = task.getOrgLoc();
--
Gitblit v1.9.1