From 3094ce60a008b7c6c8175511a7dc28b5e526fa0f Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期四, 08 一月 2026 11:04:38 +0800
Subject: [PATCH] 空板入库 初始
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 33 +++++++++++
rsf-server/src/main/java/com/vincent/rsf/server/api/service/InBoundService.java | 3 +
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/InBoundController.java | 3
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java | 99 +++++++++++++++++++++++++++++++++
4 files changed, 136 insertions(+), 2 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/InBoundController.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/InBoundController.java
index d3a69e6..cf84220 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/InBoundController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/InBoundController.java
@@ -27,8 +27,7 @@
@PostMapping("/in/emptyContainer/warehousing")
@ApiOperation("绌哄鍣ㄥ叆搴�")
public R emptyContainerWarehousing(@RequestBody PdaGeneralParam param) {
-
- return R.ok();
+ return inBoundService.generateTasks(param,getLoginUserId());
}
}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/InBoundService.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/InBoundService.java
index 927631a..286fe44 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/InBoundService.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/InBoundService.java
@@ -1,10 +1,13 @@
package com.vincent.rsf.server.api.service;
import com.vincent.rsf.framework.common.R;
+import com.vincent.rsf.server.api.entity.params.PdaGeneralParam;
/**
* PDA鍏ュ簱鎿嶄綔Service鎺ュ彛
*/
public interface InBoundService {
+ R generateTasks(PdaGeneralParam param, Long loginUserId);
+
}
\ No newline at end of file
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 4ce52c2..4ab03d2 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
@@ -1,8 +1,31 @@
package com.vincent.rsf.server.api.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.vincent.rsf.framework.common.Cools;
+import com.vincent.rsf.framework.common.R;
+import com.vincent.rsf.framework.exception.CoolException;
+import com.vincent.rsf.server.api.entity.params.PdaGeneralParam;
import com.vincent.rsf.server.api.service.InBoundService;
+import com.vincent.rsf.server.api.utils.LocUtils;
+import com.vincent.rsf.server.manager.controller.params.GenerateTaskParams;
+import com.vincent.rsf.server.manager.entity.*;
+import com.vincent.rsf.server.manager.enums.*;
+import com.vincent.rsf.server.manager.service.*;
+import com.vincent.rsf.server.manager.utils.LocManageUtil;
+import com.vincent.rsf.server.system.constant.SerialRuleCode;
+import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
/**
* PDA鍏ュ簱鎿嶄綔Service瀹炵幇绫�
@@ -10,5 +33,81 @@
@Slf4j
@Service
public class InBoundServiceImpl implements InBoundService {
+ @Autowired
+ private DeviceSiteService deviceSiteService;
+ @Autowired
+ private DeviceBindService deviceBindService;
+ @Autowired
+ private WarehouseAreasService warehouseAreasService;
+ @Autowired
+ private BasContainerService basContainerService;
+ @Autowired
+ private BasStationService basStationService;
+ @Autowired
+ private LocService locService;
+ @Autowired
+ private TaskService taskService;
+
+ @Override
+ @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("绔欑偣涓嶅瓨鍦紒锛�");
+ }
+ DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(deviceSite.getSite()));
+ if (Cools.isEmpty(deviceBind)) {
+ throw new CoolException("搴撲綅瑙勫垯鏈煡");
+ }
+ WarehouseAreas warehouseArea = warehouseAreasService.getById(deviceBind.getTypeId());
+ if (Cools.isEmpty(warehouseArea)) {
+ throw new CoolException("鏈壘鍒版墍灞炲簱鍖轰俊鎭�");
+ }
+
+ BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
+ .eq(BasContainer::getCode, param.getContainerNo()));
+ if (Objects.isNull(container)) {
+ throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
+ }
+ /**鑾峰彇搴撲綅*/
+ String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), container.getContainerType());
+ if (Cools.isEmpty(targetLoc)) {
+ throw new CoolException("璇ョ珯鐐瑰搴斿簱鍖烘湭鎵惧埌搴撲綅");
+ }
+
+ String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null);
+ if (StringUtils.isBlank(ruleCode)) {
+ throw new CoolException("缂栫爜閿欒锛氳纭缂栫爜銆孲YS_TASK_CODE銆嶆槸鍚﹀凡鐢熸垚!!");
+ }
+ Task task = new Task();
+ task.setTaskCode(ruleCode)
+ .setTaskStatus(TaskStsType.GENERATE_IN.id)
+ .setTaskType(TaskType.TASK_TYPE_EMPITY_IN.type)
+ .setWarehType(WarehType.WAREHOUSE_TYPE_AGV.val)//lsh寰呬慨鏀�
+ .setTargLoc(targetLoc)
+ .setOrgSite(deviceSite.getSite())
+ .setBarcode(param.getContainerNo())
+ .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);
+
+ if (!basStationService.updateById(station)) {
+ 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, param.getContainerNo()))) {
+ throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
+ }
+ return R.ok("浠诲姟鐢熸垚瀹屾瘯锛�");
+ }
}
\ No newline at end of file
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 90e474e..251702c 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
@@ -468,6 +468,9 @@
} else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
//绉诲簱
moveInStock(task, loginUserId);
+ } else if (task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
+ //绉诲簱
+ complateInstockE(task, loginUserId);
}
}
}
@@ -1607,6 +1610,36 @@
}
/**
+ * @author Ryan
+ * @date 2025/5/20
+ * @description: 瀹屾垚鍏ュ簱浠诲姟
+ * @version 1.0
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public synchronized void complateInstockE(Task task, Long loginUserId) {
+ if (Objects.isNull(task)) {
+ return;
+ }
+
+ Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()));
+ if (Objects.isNull(loc)) {
+ throw new CoolException("鐩爣搴撲綅涓嶅瓨鍦紒");
+ }
+
+ if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type)) {
+ throw new CoolException("褰撳墠搴撲綅鐘舵�佷笉澶勪簬S.鍏ュ簱棰勭害锛屼笉鍙墽琛屽叆搴撴搷浣滐紒");
+ }
+
+ /**淇敼搴撲綅鐘舵�佷负"D", "绌烘澘"*/
+ if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type).eq(Loc::getCode, task.getTargLoc()))) {
+ throw new CoolException("搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
+ if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) {
+ throw new CoolException("浠诲姟鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
+ }
+
+ /**
* @param
* @param loginUserId
* @return
--
Gitblit v1.9.1