1. 回库扫码器触发时,不分配库位,任务状态为暂存。
This commit is contained in:
parent
bf7e90bdf1
commit
9238cd419b
|
|
@ -2225,7 +2225,7 @@ public class TaskController {
|
|||
String allowEmptyBack = configMap.get(ConfigMapKeyEnum.ALLOW_EMPTY_BACK.getConfigKey());
|
||||
if (StringUtils.isEmpty(allowEmptyBack) || !allowEmptyBack.equals("1")) {
|
||||
logger.error("当前配置不允许新空箱回库。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("当前配置不允许新空箱回库。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
|
|
@ -2241,83 +2241,27 @@ public class TaskController {
|
|||
.eq(Task::getVehicleId, requestBackQuery.getVehicleId())
|
||||
.eq(Task::getTaskType, TaskType.IN.getCode())
|
||||
.likeRight(Task::getTaskId, "RK_"));
|
||||
if (inTasks != null && !inTasks.isEmpty()) {
|
||||
if (StringUtils.isEmpty(inTasks.get(0).getDestination())) {
|
||||
// 寻找库位
|
||||
String nextLocationId = requestALocation(requestBackQuery.getVehicleId());
|
||||
if (Objects.equals(nextLocationId, "")) {
|
||||
logger.error("暂无可用库位");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("暂无可用库位!");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
if (!taskService.update(new LambdaUpdateWrapper<Task>()
|
||||
.set(Task::getTaskStatus, WmsTaskStatus.NEW.getCode())
|
||||
.set(Task::getDestination, nextLocationId)
|
||||
.eq(Task::getVehicleId, requestBackQuery.getVehicleId())
|
||||
.eq(Task::getTaskType, TaskType.IN.getCode())
|
||||
.eq(Task::getTaskStatus, WmsTaskStatus.TEMP.getCode())
|
||||
.likeRight(Task::getTaskId, "RK_"))) {
|
||||
// 回退库位锁定
|
||||
locationService.update(new LambdaUpdateWrapper<Location>()
|
||||
.set(Location::getLocationStatus, LocationStatus.EMPTY.getCode())
|
||||
.set(Location::getVehicleId, "")
|
||||
.eq(Location::getLocationId, nextLocationId)
|
||||
.eq(Location::getLocationStatus, LocationStatus.OCCUPY.getCode()));
|
||||
logger.error("更新入库任务失败,箱号:{}", requestBackQuery.getVehicleId());
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("更新入库任务失败。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
} else {
|
||||
taskService.update(new LambdaUpdateWrapper<Task>()
|
||||
.set(Task::getTaskStatus, WmsTaskStatus.NEW.getCode())
|
||||
.eq(Task::getVehicleId, requestBackQuery.getVehicleId())
|
||||
.eq(Task::getTaskType, TaskType.IN.getCode())
|
||||
.eq(Task::getTaskStatus, WmsTaskStatus.TEMP.getCode())
|
||||
.likeRight(Task::getTaskId, "RK_"));
|
||||
}
|
||||
} else {
|
||||
// 寻找库位
|
||||
String nextLocationId = requestALocation(requestBackQuery.getVehicleId());
|
||||
if (Objects.equals(nextLocationId, "")) {
|
||||
logger.error("暂无可用库位");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("暂无可用库位!");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
if (inTasks == null || inTasks.isEmpty()) {
|
||||
// 生成回库任务
|
||||
Task backTask = new Task();
|
||||
backTask.setTaskId(generateId("HK_"));
|
||||
backTask.setTaskGroup(generateId(""));
|
||||
backTask.setTaskType(TaskType.IN.getCode());
|
||||
backTask.setTaskStatus(WmsTaskStatus.NEW.getCode());
|
||||
backTask.setTaskStatus(WmsTaskStatus.TEMP.getCode());
|
||||
backTask.setVehicleId(requestBackQuery.getVehicleId());
|
||||
backTask.setDestination(nextLocationId);
|
||||
backTask.setVehicleSize(1);
|
||||
backTask.setWeight(BigDecimal.ZERO);
|
||||
backTask.setTaskPriority(1);
|
||||
backTask.setUserName("WMS");
|
||||
backTask.setCreateTime(LocalDateTime.now());
|
||||
if (taskService.save(backTask)) {
|
||||
// 保存任务
|
||||
taskService.save(backTask);
|
||||
// 删除outsideVehicle表
|
||||
outsideVehiclesService.remove(new LambdaQueryWrapper<OutsideVehicles>().eq(OutsideVehicles::getVehicleId, requestBackQuery.getVehicleId()));
|
||||
// 设置库存状态为回库中
|
||||
stockService.update(new LambdaUpdateWrapper<Stock>()
|
||||
.set(Stock::getStockStatus, StockStatus.BACK.getCode())
|
||||
.eq(Stock::getVehicleId, requestBackQuery.getVehicleId()));
|
||||
} else {
|
||||
// 回退库位锁定
|
||||
locationService.update(new LambdaUpdateWrapper<Location>()
|
||||
.set(Location::getLocationStatus, LocationStatus.EMPTY.getCode())
|
||||
.set(Location::getVehicleId, "")
|
||||
.eq(Location::getLocationId, nextLocationId)
|
||||
.eq(Location::getLocationStatus, LocationStatus.OCCUPY.getCode()));
|
||||
logger.error("生成回库任务失败,箱号:{}", requestBackQuery.getVehicleId());
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("生成回库任务失败。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
|
|
@ -2337,33 +2281,6 @@ public class TaskController {
|
|||
}
|
||||
}
|
||||
|
||||
public String requestALocation(String vehicleId) {
|
||||
String nextLocationId = "";
|
||||
int emptyLocationSize = (int) locationService.count(new LambdaQueryWrapper<Location>().eq(Location::getLocationStatus, LocationStatus.EMPTY.getCode()));
|
||||
for (int i = 0; i < emptyLocationSize; i++) {
|
||||
Map<String, String> resultMap = locationService.getOneLocation("", vehicleId, "");
|
||||
if (resultMap.isEmpty() || !resultMap.containsKey("nextLocationId")) {
|
||||
return "";
|
||||
} else {
|
||||
Location nextLocation = locationService.getOne(new LambdaQueryWrapper<Location>().eq(Location::getLocationId, resultMap.get("nextLocationId")).last("limit 1"));
|
||||
if (Objects.equals(nextLocation.getLocationStatus(), LocationStatus.OCCUPY.getCode()) && nextLocation.getVehicleId().equals(vehicleId)) {
|
||||
nextLocationId = resultMap.get("nextLocationId");
|
||||
break;
|
||||
}
|
||||
LambdaUpdateWrapper<Location> updateLocationWrapper = new LambdaUpdateWrapper<Location>()
|
||||
.set(Location::getLocationStatus, LocationStatus.OCCUPY.getCode())
|
||||
.set(Location::getVehicleId, vehicleId)
|
||||
.eq(Location::getLocationId, nextLocation.getLocationId())
|
||||
.eq(Location::getLocationStatus, LocationStatus.EMPTY.getCode());
|
||||
if (locationService.update(updateLocationWrapper)) {
|
||||
nextLocationId = resultMap.get("nextLocationId");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nextLocationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求打印标签的数据
|
||||
*
|
||||
|
|
@ -3252,17 +3169,18 @@ public class TaskController {
|
|||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/statisticsBoxNumByStation")
|
||||
@ResponseBody
|
||||
@MyLog(logTitle = "打印大盒子标签", logMethod = "statisticsBoxNumByStation")
|
||||
public String statisticsBoxNumByStation(@RequestBody SortBoxRequest sortBoxRequest) {
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
if(StringUtils.isEmpty(sortBoxRequest.getStandId())) {
|
||||
if (StringUtils.isEmpty(sortBoxRequest.getStandId())) {
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("打印标签大盒子请求的站台号不能为空!");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
logger.info("接收打印大盒子标签,当前站台:{}",sortBoxRequest.getStandId());
|
||||
logger.info("接收打印大盒子标签,当前站台:{}", sortBoxRequest.getStandId());
|
||||
//查询出大盒子信息列表,根据工作站配置
|
||||
//转换为Table对象
|
||||
WorkStationConfig workStationConfig = new WorkStationConfig();
|
||||
|
|
@ -3273,6 +3191,7 @@ public class TaskController {
|
|||
response.setMessage("查询大盒子数量成功!");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求整理盒子
|
||||
*
|
||||
|
|
@ -3323,12 +3242,8 @@ public class TaskController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO 以下是盘点待做
|
||||
|
||||
/**
|
||||
* 盘点请求
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user