代码更新:
1.修复入库和出库的问题
This commit is contained in:
parent
f596f46b72
commit
8b658cd2c0
|
|
@ -232,7 +232,7 @@ public class TaskController {
|
|||
TaskDetailInfo goodsRelatedInfo = new TaskDetailInfo();
|
||||
// TODO 物料信息需要完善
|
||||
goodsRelatedInfo.setGoodsId(goodsInRequest.getGoodsId());
|
||||
goodsRelatedInfo.setGoodsName("");
|
||||
goodsRelatedInfo.setGoodsName(goodsInRequest.getGoodsName());
|
||||
goodsRelatedInfo.setOpNum(goodsInRequest.getGoodsNum());
|
||||
goodsRelatedInfo.setOriginNum(BigDecimal.ZERO);
|
||||
tempInTask.setGoodsRelated(goodsRelatedInfo);
|
||||
|
|
@ -308,11 +308,12 @@ public class TaskController {
|
|||
// 验证物料编号
|
||||
if (StringUtils.isEmpty(goodsInRequest.getGoodsId())) {
|
||||
return TaskInValidationEnum.NO_GOODS_ID.getErrorMessage();
|
||||
} else {
|
||||
if (!goodsService.validateGoodsId(goodsInRequest.getGoodsId())) {
|
||||
return TaskInValidationEnum.ERROR_GOODS_ID.getErrorMessage();
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// if (!goodsService.validateGoodsId(goodsInRequest.getGoodsId())) {
|
||||
// return TaskInValidationEnum.ERROR_GOODS_ID.getErrorMessage();
|
||||
// }
|
||||
// }
|
||||
// 验证数量
|
||||
if (goodsInRequest.getGoodsNum() == null || goodsInRequest.getGoodsNum().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return TaskInValidationEnum.ERROR_GOODS_NUM.getErrorMessage();
|
||||
|
|
@ -483,7 +484,7 @@ public class TaskController {
|
|||
boolean lockVehicleFlag = vehicleService.update(new LambdaUpdateWrapper<Vehicle>()
|
||||
.set(Vehicle::getVehicleStatus, VehicleStatus.OUT.getCode())
|
||||
.eq(Vehicle::getVehicleId, stock.getVehicleId())
|
||||
.eq(Vehicle::getVehicleStatus, VehicleStatus.ON));
|
||||
.eq(Vehicle::getVehicleStatus, VehicleStatus.ON.getCode()));
|
||||
if (!lockStocksFlag || !lockVehicleFlag) {
|
||||
// 释放锁
|
||||
stockService.update(new LambdaUpdateWrapper<Stock>()
|
||||
|
|
@ -603,21 +604,21 @@ public class TaskController {
|
|||
}
|
||||
// 验证载具号
|
||||
if (StringUtils.isNotEmpty(taskOutRequest.getVehicleId())
|
||||
&& vehicleService.exists(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, taskOutRequest.getVehicleId()))) {
|
||||
&& !vehicleService.exists(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getAreaId, taskOutRequest.getAreaId()).eq(Vehicle::getVehicleId, taskOutRequest.getVehicleId()))) {
|
||||
return TaskOutValidationEnum.ERROR_VEHICLE_ID.getErrorMessage();
|
||||
}
|
||||
// 验证库位
|
||||
if (StringUtils.isNotEmpty(taskOutRequest.getOriginPoint())
|
||||
&& locationService.exists(new LambdaQueryWrapper<Location>().eq(Location::getLocationId, taskOutRequest.getOriginPoint()))) {
|
||||
&& !locationService.exists(new LambdaQueryWrapper<Location>().eq(Location::getAreaId, taskOutRequest.getAreaId()).eq(Location::getLocationId, taskOutRequest.getOriginPoint()))) {
|
||||
return TaskOutValidationEnum.ERROR_ORIGIN_POINT.getErrorMessage();
|
||||
}
|
||||
// 验证终点站台
|
||||
if (taskOutRequest.getIsPicking() == 0) {// 出库
|
||||
if (!standService.validateStand(taskOutRequest.getDestinationPoint(), 2)) {
|
||||
if (!standService.validateStand(taskOutRequest.getDestinationPoint(), TaskType.OUT.getCode())) {
|
||||
return TaskOutValidationEnum.ERROR_DESTINATION_POINT.getErrorMessage();
|
||||
}
|
||||
} else {// 拣选出库
|
||||
if (!standService.validateStand(taskOutRequest.getDestinationPoint(), 3)) {
|
||||
if (!standService.validateStand(taskOutRequest.getDestinationPoint(), TaskType.INVENTORY.getCode())) {
|
||||
return TaskOutValidationEnum.ERROR_PICK_STAND.getErrorMessage();
|
||||
}
|
||||
}
|
||||
|
|
@ -628,6 +629,7 @@ public class TaskController {
|
|||
}
|
||||
// 查询库存信息
|
||||
LambdaQueryWrapper<Stock> stockQueryWrapper = new LambdaQueryWrapper<Stock>()
|
||||
.eq(Stock::getAreaId, taskOutRequest.getAreaId())
|
||||
.apply("goods_related -> '$.goodsId' = {0}", taskOutRequest.getGoodsId())
|
||||
.apply("goods_related -> '$.remainNum' > 0")
|
||||
.eq(StringUtils.isNotEmpty(taskOutRequest.getVehicleId()), Stock::getVehicleId, taskOutRequest.getVehicleId())
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@ public class TaskServiceImplements extends ServiceImpl<TaskMapper, Task> impleme
|
|||
// 生成当前深度-1的库位的移库任务
|
||||
TaskDto depthMinus1MoveTask = new TaskDto();
|
||||
Location depthMinus1Location = locationMapper.selectOne(new LambdaQueryWrapper<Location>()
|
||||
.eq(Location::getAreaId, outLocation.getAreaId())
|
||||
.eq(Location::getWRow, outLocation.getWRow())
|
||||
.eq(Location::getWCol, outLocation.getWCol())
|
||||
.eq(Location::getWLayer, outLocation.getWLayer())
|
||||
.eq(Location::getWDepth, outLocation.getWDepth() - 1));
|
||||
.eq(Location::getAreaId, outLocation.getAreaId())
|
||||
.eq(Location::getWRow, outLocation.getWRow())
|
||||
.eq(Location::getWCol, outLocation.getWCol())
|
||||
.eq(Location::getWLayer, outLocation.getWLayer())
|
||||
.eq(Location::getWDepth, outLocation.getWDepth() - 1));
|
||||
if (depthMinus1Location.getIsLock() == 1) {// 外层库位锁定
|
||||
depthMinus1MoveTask.setTaskId("LOCKED");
|
||||
return depthMinus1MoveTask;
|
||||
|
|
@ -71,7 +71,7 @@ public class TaskServiceImplements extends ServiceImpl<TaskMapper, Task> impleme
|
|||
// 查看这个库位是否有入库任务
|
||||
Task depthMinusIn1Task = taskMapper.selectOne(new LambdaQueryWrapper<Task>()
|
||||
.eq(Task::getTaskType, TaskType.IN.getCode())
|
||||
.eq(Task::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Task::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Task::getDestination, depthMinus1Location.getLocationId()));
|
||||
if (depthMinusIn1Task != null) {
|
||||
// 生成移库任务,并把移库任务的前置任务设置为该入库任务
|
||||
|
|
@ -81,19 +81,19 @@ public class TaskServiceImplements extends ServiceImpl<TaskMapper, Task> impleme
|
|||
// 对应载具所有库存上锁
|
||||
stockMapper.update(new LambdaUpdateWrapper<Stock>()
|
||||
.set(Stock::getStockStatus, StockStatus.MOVE.getCode())
|
||||
.eq(Stock::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Stock::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Stock::getLocationId, depthMinus1Location.getLocationId()));
|
||||
// 对应载具状态设置
|
||||
vehicleMapper.update(new LambdaUpdateWrapper<Vehicle>()
|
||||
.set(Vehicle::getVehicleStatus, VehicleStatus.MOVE.getCode())
|
||||
.eq(Vehicle::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Vehicle::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Vehicle::getCurrentLocation, depthMinus1Location.getLocationId()));
|
||||
depthMinus1MoveTask.setTaskId(moveTask.getTaskId());
|
||||
return depthMinus1MoveTask;
|
||||
} else {
|
||||
// 判断是否有出库、移库、盘点、拣选等任务
|
||||
Task depthMinusOut1Task = taskMapper.selectOne(new LambdaQueryWrapper<Task>()
|
||||
.eq(Task::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Task::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Task::getOrigin, depthMinus1Location.getLocationId()));
|
||||
if (depthMinusOut1Task != null) {
|
||||
depthMinus1MoveTask.setTaskId(depthMinusOut1Task.getTaskId());
|
||||
|
|
@ -111,12 +111,12 @@ public class TaskServiceImplements extends ServiceImpl<TaskMapper, Task> impleme
|
|||
// 对应载具所有库存上锁
|
||||
stockMapper.update(new LambdaUpdateWrapper<Stock>()
|
||||
.set(Stock::getStockStatus, StockStatus.MOVE.getCode())
|
||||
.eq(Stock::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Stock::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Stock::getLocationId, depthMinus1Location.getLocationId()));
|
||||
// 对应载具状态设置
|
||||
vehicleMapper.update(new LambdaUpdateWrapper<Vehicle>()
|
||||
.set(Vehicle::getVehicleStatus, VehicleStatus.MOVE.getCode())
|
||||
.eq(Vehicle::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Vehicle::getAreaId, depthMinus1Location.getAreaId())
|
||||
.eq(Vehicle::getCurrentLocation, depthMinus1Location.getLocationId()));
|
||||
depthMinus1MoveTask.setTaskId(moveTask.getTaskId());
|
||||
}
|
||||
|
|
@ -134,6 +134,7 @@ public class TaskServiceImplements extends ServiceImpl<TaskMapper, Task> impleme
|
|||
|
||||
/**
|
||||
* 生成一个移库任务
|
||||
*
|
||||
* @param originLocation 原库位
|
||||
* @return 生成的移库任务
|
||||
*/
|
||||
|
|
@ -142,7 +143,7 @@ public class TaskServiceImplements extends ServiceImpl<TaskMapper, Task> impleme
|
|||
// 先找一个新库位,同一个设备号,但是不同的排列层
|
||||
Location newLocation = new Location();
|
||||
List<Location> availableLocations = locationMapper.selectList(new LambdaQueryWrapper<Location>()
|
||||
.eq(Location::getAreaId, originLocation.getAreaId())
|
||||
.eq(Location::getAreaId, originLocation.getAreaId())
|
||||
.eq(Location::getEquipmentId, originLocation.getEquipmentId())
|
||||
.eq(Location::getLocationType, originLocation.getLocationType())
|
||||
.eq(Location::getIsLock, 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user