From c2ead3c7e7f1db81b6fc961e0f037abd0e8a4e2c Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期三, 14 一月 2026 17:19:30 +0800
Subject: [PATCH] lsh#
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 215 ++++++++++++++++++++++++++++++-----------------------
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WcsTaskReportParam.java | 3
2 files changed, 123 insertions(+), 95 deletions(-)
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WcsTaskReportParam.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WcsTaskReportParam.java
index 2f410e4..b479c23 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WcsTaskReportParam.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WcsTaskReportParam.java
@@ -37,4 +37,7 @@
@ApiModelProperty("娑堟伅鏁版嵁")
private String data;
+ @ApiModelProperty("绫诲埆")
+ private Integer type = 0;
+
}
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 7853ac6..c1ad222 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
@@ -586,112 +586,137 @@
if (Objects.isNull(basStation)) {
throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
}
- DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(basStation.getStationName()));
- if (Cools.isEmpty(deviceBind)) {
- throw new CoolException("搴撲綅瑙勫垯鏈煡");
+ List<WarehouseAreas> warehouseAreasList = new ArrayList<>();
+ if (basStation.getIsWcs() == 1){
+ DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(basStation.getStationName()));
+ if (Cools.isEmpty(deviceBind)) {
+ throw new CoolException("搴撲綅瑙勫垯鏈煡");
+ }
+ WarehouseAreas warehouseArea = warehouseAreasService.getById(deviceBind.getTypeId());
+ if (Cools.isEmpty(warehouseArea)) {
+ throw new CoolException("鏈壘鍒版墍灞炲簱鍖轰俊鎭�");
+ }
+ warehouseAreasList.add(warehouseArea);
+ } else {
+ List<String> areaList = JSONObject.parseArray(basStation.getCrossZoneArea(), String.class);
+ if (areaList.isEmpty()) {
+ throw new CoolException("褰撳墠绔欑偣搴撳尯鏈厤缃�");
+ }
+ warehouseAreasList = warehouseAreasService.list(new LambdaQueryWrapper<WarehouseAreas>().in(WarehouseAreas::getId,areaList));
}
- WarehouseAreas warehouseArea = warehouseAreasService.getById(deviceBind.getTypeId());
- if (Cools.isEmpty(warehouseArea)) {
+
+ if (Cools.isEmpty(warehouseAreasList) || warehouseAreasList.size() == 0) {
throw new CoolException("鏈壘鍒版墍灞炲簱鍖轰俊鎭�");
}
-
- /**鑾峰彇缁勬嫋*/
- List<Long> ids = waitPakin.getWaitPakins().stream().map(WaitPakin::getId).collect(Collectors.toList());
- List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
- .in(WaitPakin::getId, ids)
- .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
- if (waitPakins.isEmpty()) {
- throw new CoolException("璇锋鏌ョ粍鎷栫姸鎬佹槸鍚﹀畬鎴愶紒锛�");
- }
- waitPakins.forEach(pakin -> {
-
-
- //楠岃瘉鍩虹淇℃伅
- checkStaStatus(pakin.getBarcode(),basStation.getStationName(),warehouseArea.getId().toString());
+ final String[] errMsg = {""};
+ for (WarehouseAreas warehouseArea : warehouseAreasList) {
+ /**鑾峰彇缁勬嫋*/
+ List<Long> ids = waitPakin.getWaitPakins().stream().map(WaitPakin::getId).collect(Collectors.toList());
+ List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
+ .in(WaitPakin::getId, ids)
+ .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
+ if (waitPakins.isEmpty()) {
+ throw new CoolException("璇锋鏌ョ粍鎷栫姸鎬佹槸鍚﹀畬鎴愶紒锛�");
+ }
+ boolean sign = true;
+ for (WaitPakin pakin : waitPakins) {//楠岃瘉鍩虹淇℃伅
+ try {
+ checkStaStatus(pakin.getBarcode(), basStation.getStationName(), warehouseArea.getId().toString());
+ } catch (Exception e) {
+ errMsg[0] = errMsg[0] + e.getMessage();
+ sign = false;
+ break;
+ }
// BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
// .eq(BasContainer::getCode, pakin.getBarcode()));
// if (Objects.isNull(container)) {
// throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
// }
- /**鑾峰彇搴撲綅*/
- String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(),null,rowList);
- if (Cools.isEmpty(targetLoc)) {
- throw new CoolException("璇ョ珯鐐瑰搴斿簱鍖烘湭鎵惧埌搴撲綅");
- }
-
- List<TaskItem> taskItems = new ArrayList<>();
- String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null);
- if (StringUtils.isBlank(ruleCode)) {
- throw new CoolException("缂栫爜閿欒锛氳纭缂栫爜銆孲YS_TASK_CODE銆嶆槸鍚﹀凡鐢熸垚!!");
- }
-
- String staNoEnd = basStation.getStationName();
- if (basStation.getIsWcs()!=0){
- staNoEnd = "B102";
- }
- Task task = new Task();
- task.setTaskCode(ruleCode)
- .setTaskStatus(TaskStsType.WCS_EXECUTE_IN.id)
- .setTaskType(TaskType.TASK_TYPE_IN.type)
- .setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val)
- .setTargLoc(targetLoc)
- .setBarcode(pakin.getBarcode())
- .setOrgSite(basStation.getStationName())
- .setTargSite(staNoEnd)
- .setCreateBy(loginUserId)
- .setUpdateBy(loginUserId);
-
- if (!this.save(task)) {
- throw new CoolException("浠诲姟淇濆瓨澶辫触锛侊紒");
- }
-
- if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())
- .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) {
- throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
- }
- /**鑾峰彇缁勬嫋鏄庣粏**/
- List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, pakin.getId()));
- if (waitPakinItems.isEmpty()) {
- throw new CoolException("鏁版嵁閿欒锛氱粍鎷栨槑缁嗕笉瀛樺湪");
- }
- waitPakinItems.forEach(item -> {
- TaskItem taskItem = new TaskItem();
- BeanUtils.copyProperties(item, taskItem);
- taskItem.setTaskId(task.getId())
- .setOrderType(OrderType.ORDER_IN.type)
- .setSource(item.getId())
- .setTrackCode(item.getTrackCode())
- .setPlatItemId(item.getPlatItemId())
- .setPlatOrderCode(item.getPlatOrderCode())
- .setPlatWorkCode(item.getPlatWorkCode())
- .setProjectCode(item.getProjectCode())
- .setCreateBy(loginUserId)
- .setUpdateBy(loginUserId)
- .setExtendFields(item.getExtendFields())
- .setOrderId(item.getAsnId())
- .setOrderItemId(item.getAsnItemId());
- taskItems.add(taskItem);
- });
- if (!taskItemService.saveBatch(taskItems)) {
- throw new CoolException("浠诲姟鏄庣粏淇濆瓨澶辫触锛侊紒");
- }
- waitPakinItems.forEach(item -> {
- if (!waitPakinItemService.update(new LambdaUpdateWrapper<WaitPakinItem>()
- .set(WaitPakinItem::getWorkQty, item.getAnfme())
- .eq(WaitPakinItem::getId, item.getId()))) {
- throw new CoolException("缁勬墭鏄庣粏淇墽琛屾暟閲忎慨鏀瑰け璐ワ紒锛�");
+ /**鑾峰彇搴撲綅*/
+ String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), null, rowList);
+ if (Cools.isEmpty(targetLoc)) {
+ throw new CoolException("璇ョ珯鐐瑰搴斿簱鍖烘湭鎵惧埌搴撲綅");
}
- });
- });
- if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>()
- .in(WaitPakin::getId, ids)
- .set(WaitPakin::getUpdateBy, loginUserId)
- .set(WaitPakin::getCreateBy, loginUserId)
- .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val))) {
- throw new CoolException("缁勬嫋鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ List<TaskItem> taskItems = new ArrayList<>();
+ String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null);
+ if (StringUtils.isBlank(ruleCode)) {
+ throw new CoolException("缂栫爜閿欒锛氳纭缂栫爜銆孲YS_TASK_CODE銆嶆槸鍚﹀凡鐢熸垚!!");
+ }
+
+ String staNoEnd = basStation.getStationName();
+ if (basStation.getIsWcs() != 0) {
+ staNoEnd = "B102";
+ }
+ Task task = new Task();
+ task.setTaskCode(ruleCode)
+ .setTaskStatus(TaskStsType.WCS_EXECUTE_IN.id)
+ .setTaskType(TaskType.TASK_TYPE_IN.type)
+ .setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val)
+ .setTargLoc(targetLoc)
+ .setBarcode(pakin.getBarcode())
+ .setOrgSite(basStation.getStationName())
+ .setTargSite(staNoEnd)
+ .setCreateBy(loginUserId)
+ .setUpdateBy(loginUserId);
+
+ if (!this.save(task)) {
+ throw new CoolException("浠诲姟淇濆瓨澶辫触锛侊紒");
+ }
+
+ if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())
+ .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) {
+ throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
+ }
+ /**鑾峰彇缁勬嫋鏄庣粏**/
+ List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, pakin.getId()));
+ if (waitPakinItems.isEmpty()) {
+ throw new CoolException("鏁版嵁閿欒锛氱粍鎷栨槑缁嗕笉瀛樺湪");
+ }
+ waitPakinItems.forEach(item -> {
+ TaskItem taskItem = new TaskItem();
+ BeanUtils.copyProperties(item, taskItem);
+ taskItem.setTaskId(task.getId())
+ .setOrderType(OrderType.ORDER_IN.type)
+ .setSource(item.getId())
+ .setTrackCode(item.getTrackCode())
+ .setPlatItemId(item.getPlatItemId())
+ .setPlatOrderCode(item.getPlatOrderCode())
+ .setPlatWorkCode(item.getPlatWorkCode())
+ .setProjectCode(item.getProjectCode())
+ .setCreateBy(loginUserId)
+ .setUpdateBy(loginUserId)
+ .setExtendFields(item.getExtendFields())
+ .setOrderId(item.getAsnId())
+ .setOrderItemId(item.getAsnItemId());
+ taskItems.add(taskItem);
+ });
+ if (!taskItemService.saveBatch(taskItems)) {
+ throw new CoolException("浠诲姟鏄庣粏淇濆瓨澶辫触锛侊紒");
+ }
+ waitPakinItems.forEach(item -> {
+ if (!waitPakinItemService.update(new LambdaUpdateWrapper<WaitPakinItem>()
+ .set(WaitPakinItem::getWorkQty, item.getAnfme())
+ .eq(WaitPakinItem::getId, item.getId()))) {
+ throw new CoolException("缁勬墭鏄庣粏淇墽琛屾暟閲忎慨鏀瑰け璐ワ紒锛�");
+ }
+ });
+ }
+ if (!sign){
+ continue;
+ }
+
+ if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>()
+ .in(WaitPakin::getId, ids)
+ .set(WaitPakin::getUpdateBy, loginUserId)
+ .set(WaitPakin::getCreateBy, loginUserId)
+ .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val))) {
+ throw new CoolException("缁勬嫋鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
+ return R.ok("浠诲姟鐢熸垚瀹屾瘯锛�");
}
- return R.ok("浠诲姟鐢熸垚瀹屾瘯锛�");
+ String msg = "鏈壘搴撲綅" + Arrays.toString(errMsg);
+ throw new CoolException(msg);
}
/**
--
Gitblit v1.9.1