库存查询新增按未使用时长筛选
This commit is contained in:
parent
c102f16720
commit
2f3fe17f52
|
|
@ -31,6 +31,7 @@ import com.wms_main.service.controller.ITaskControllerService;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -136,69 +137,35 @@ public class TaskController {
|
|||
/**
|
||||
* test
|
||||
*/
|
||||
@PostMapping("/status")
|
||||
public EwmApiBackResponse test(@RequestBody StockConfirmEntity stockConfirm) {
|
||||
//return taskControllerService.ewmInformationBack(wcsVehicleInRequest);
|
||||
// return ewmApiService.getEwmStock(request);
|
||||
//return ewmApiService.sendWarehouseOutCompleted(request);
|
||||
//return ewmApiService.sendWarehouseInCompleted(new SendWarehouseInCompletedRequest());
|
||||
// 查询对应的库存信息
|
||||
List<TAppStock> stockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, stockConfirm.getVehicleId())
|
||||
.eq(TAppStock::getGoodsId, stockConfirm.getGoodsId())
|
||||
// 特殊库存字段精确匹配 - 根据传入值决定匹配条件
|
||||
.and(wrapper -> {
|
||||
if (StringUtils.isEmpty(stockConfirm.getSpecialStock())) {
|
||||
// 如果传入null或空字符串,匹配数据库中为null或空字符串的记录
|
||||
wrapper.isNull(TAppStock::getSpecialStock)
|
||||
.or()
|
||||
.eq(TAppStock::getSpecialStock, "");
|
||||
} else {
|
||||
// 如果传入有值,精确匹配该值
|
||||
wrapper.eq(TAppStock::getSpecialStock, stockConfirm.getSpecialStock());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
if (StringUtils.isEmpty(stockConfirm.getSpecialStockNo())) {
|
||||
// 如果传入null或空字符串,匹配数据库中为null或空字符串的记录
|
||||
wrapper.isNull(TAppStock::getSpecialStockNo)
|
||||
.or()
|
||||
.eq(TAppStock::getSpecialStockNo, "");
|
||||
} else {
|
||||
// 如果传入有值,精确匹配该值
|
||||
wrapper.eq(TAppStock::getSpecialStockNo, stockConfirm.getSpecialStockNo());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
if (StringUtils.isEmpty(stockConfirm.getSpecialStockItemNo())) {
|
||||
// 如果传入null或空字符串,匹配数据库中为null或空字符串的记录
|
||||
wrapper.isNull(TAppStock::getSpecialStockItemNo)
|
||||
.or()
|
||||
.eq(TAppStock::getSpecialStockItemNo, "");
|
||||
} else {
|
||||
// 如果传入有值,精确匹配该值
|
||||
wrapper.eq(TAppStock::getSpecialStockItemNo, stockConfirm.getSpecialStockItemNo());
|
||||
}
|
||||
})
|
||||
.and(wrapper -> {
|
||||
if (StringUtils.isEmpty(stockConfirm.getBatchNo())) {
|
||||
// 如果传入null或空字符串,匹配数据库中为null或空字符串的记录
|
||||
wrapper.isNull(TAppStock::getBatchNo)
|
||||
.or()
|
||||
.eq(TAppStock::getBatchNo, "");
|
||||
} else {
|
||||
// 如果传入有值,精确匹配该值
|
||||
wrapper.eq(TAppStock::getBatchNo, stockConfirm.getBatchNo());
|
||||
}
|
||||
})
|
||||
.orderByDesc(TAppStock::getFirstInTime)
|
||||
);
|
||||
|
||||
return EwmApiBackResponse.success(
|
||||
"查询成功",
|
||||
stockList
|
||||
);
|
||||
}
|
||||
// @PostMapping("/status")
|
||||
// public EwmApiBackResponse test(@RequestBody StockConfirmEntity stockConfirm) {
|
||||
// //return taskControllerService.ewmInformationBack(wcsVehicleInRequest);
|
||||
// // return ewmApiService.getEwmStock(request);
|
||||
// //return ewmApiService.sendWarehouseOutCompleted(request);
|
||||
// //return ewmApiService.sendWarehouseInCompleted(new SendWarehouseInCompletedRequest());
|
||||
// // 查询对应的库存信息
|
||||
//
|
||||
// }
|
||||
// private boolean test(String stand1, String stand2) {
|
||||
//
|
||||
// stand1 = "P22";
|
||||
// stand2 = "P18";
|
||||
//
|
||||
// // P11-P19为一组
|
||||
// boolean isStand1InP11ToP19 = stand1.compareTo("P11") >= 0 && stand1.compareTo("P19") <= 0;
|
||||
// boolean isStand2InP11ToP19 = stand2.compareTo("P11") >= 0 && stand2.compareTo("P19") <= 0;
|
||||
// if (isStand1InP11ToP19 && isStand2InP11ToP19) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// // P21-P23为一组
|
||||
// List<String> p21ToP23 = Arrays.asList("P21", "P22", "P23");
|
||||
// if (p21ToP23.contains(stand1) && p21ToP23.contains(stand2)) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
|
||||
/**
|
||||
* wcs请求载具入库
|
||||
|
|
@ -290,6 +257,17 @@ public class TaskController {
|
|||
return taskControllerService.requestInventory(inventoryRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量下发盘点请求
|
||||
* @param batchInventoryRequest 批量盘点请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
@PostMapping("/batchRequestInventory")
|
||||
public BaseWmsApiResponse batchRequestInventory(@RequestBody BatchInventoryRequest batchInventoryRequest) {
|
||||
return taskControllerService.batchRequestInventory(batchInventoryRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询盘点任务确认信息
|
||||
* @param inventoryConfirmRequest 请求
|
||||
|
|
|
|||
|
|
@ -57,4 +57,10 @@ public class StockQuery extends PageQuery{
|
|||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate toDate;
|
||||
|
||||
/**
|
||||
* 未使用天数
|
||||
*/
|
||||
@JsonProperty("noUseDays")
|
||||
private Integer noUseDays;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,14 @@ public class StockVo {
|
|||
*/
|
||||
@JsonProperty("firstInUser")
|
||||
private String firstInUser;
|
||||
/**
|
||||
* 上次盘点时间
|
||||
*/
|
||||
@JsonProperty("lastInventoryTime")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastInventoryTime;
|
||||
|
||||
/**
|
||||
* 上次更新时间
|
||||
*/
|
||||
|
|
@ -150,6 +158,7 @@ public class StockVo {
|
|||
stockPo.getSled(),
|
||||
stockPo.getFirstInTime(),
|
||||
stockPo.getFirstInUser(),
|
||||
stockPo.getLastInventoryTime(),
|
||||
stockPo.getLastUpdateTime(),
|
||||
stockPo.getLastUpdateUser(),
|
||||
stockPo.getSpecialStock(),
|
||||
|
|
|
|||
|
|
@ -351,6 +351,35 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断两个站台是否属于同一组
|
||||
* @param stand1 站台1
|
||||
* @param stand2 站台2
|
||||
* @return 是否属于同一组
|
||||
*/
|
||||
private boolean isSameStandGroup(String stand1, String stand2) {
|
||||
if (stand1 == null || stand2 == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// P11-P19为一组
|
||||
boolean isStand1InP11ToP19 = stand1.compareTo("P11") >= 0 && stand1.compareTo("P19") <= 0;
|
||||
boolean isStand2InP11ToP19 = stand2.compareTo("P11") >= 0 && stand2.compareTo("P19") <= 0;
|
||||
if (isStand1InP11ToP19 && isStand2InP11ToP19) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// P21-P23为一组
|
||||
List<String> p21ToP23 = Arrays.asList("P21", "P22", "P23");
|
||||
if (p21ToP23.contains(stand1) && p21ToP23.contains(stand2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 处理紧急出库任务
|
||||
*
|
||||
|
|
@ -403,6 +432,25 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
// 当前堆垛机已经无法生成新的出库任务了
|
||||
continue;
|
||||
}
|
||||
if (!Objects.equals(stock.getStockStatus(), WmsStockStatusEnums.OK.getCode())) {
|
||||
// 需要判断对应的pickTask的终点
|
||||
List<TAppPickTask> pickTasksByJudge = appPickTaskService.list(
|
||||
new LambdaQueryWrapper<TAppPickTask>()
|
||||
.eq(TAppPickTask::getVehicleId, stock.getVehicleId())
|
||||
);
|
||||
|
||||
// 如果有拣选任务,检查是否为同一组站台
|
||||
if (!pickTasksByJudge.isEmpty()) {
|
||||
TAppPickTask firstPickTask = pickTasksByJudge.getFirst();
|
||||
String pickTaskDestination = firstPickTask.getPickStand();
|
||||
|
||||
// 如果不是同一组站台,则跳过
|
||||
if (!isSameStandGroup(pickTaskDestination, optimalDestination)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 如果没有拣选任务或为同一组站台,继续执行后续逻辑
|
||||
}
|
||||
// 判断当前的这条库存,当前站台是否需要
|
||||
int stockIsEmpty;
|
||||
int originNum = stock.getRemainNum();
|
||||
|
|
@ -1142,9 +1190,9 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
List<TAppPickTask> pickTasks = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
||||
.in(TAppPickTask::getVehicleId, vehicleIds));
|
||||
// 需要保存的信息
|
||||
List<TAppTask> newOutWmsTasks = new ArrayList<>();// 新的出库任务
|
||||
List<TAppPickTask> newPickTasks = new ArrayList<>();// 新的拣选任务
|
||||
List<String> thisTimeOutVehicleIds = new ArrayList<>();// 本次出库载具
|
||||
List<TAppTask> newOutWmsTasks = new ArrayList<>(); // 新的出库任务
|
||||
List<TAppPickTask> newPickTasks = new ArrayList<>(); // 新的拣选任务
|
||||
List<String> thisTimeOutVehicleIds = new ArrayList<>();// 本次出库载具
|
||||
// 获取可用堆垛机
|
||||
List<TAppEquipment> usableStackers = appEquipmentService.list(new LambdaQueryWrapper<TAppEquipment>()
|
||||
.eq(TAppEquipment::getEquipmentType, 1)
|
||||
|
|
@ -1192,6 +1240,25 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
// 当前堆垛机已经无法生成新的出库任务了
|
||||
continue;
|
||||
}
|
||||
if (!Objects.equals(stock.getStockStatus(), WmsStockStatusEnums.OK.getCode())) {
|
||||
// 需要判断对应的pickTask的终点
|
||||
List<TAppPickTask> pickTasksByJudge = appPickTaskService.list(
|
||||
new LambdaQueryWrapper<TAppPickTask>()
|
||||
.eq(TAppPickTask::getVehicleId, stock.getVehicleId())
|
||||
);
|
||||
|
||||
// 如果有拣选任务,检查是否为同一组站台
|
||||
if (!pickTasksByJudge.isEmpty()) {
|
||||
TAppPickTask firstPickTask = pickTasksByJudge.getFirst();
|
||||
String pickTaskDestination = firstPickTask.getPickStand();
|
||||
|
||||
// 如果不是同一组站台,则跳过
|
||||
if (!isSameStandGroup(pickTaskDestination, getOptimalSubStand(inventory.getInvStand()))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 如果没有拣选任务或为同一组站台,继续执行后续逻辑
|
||||
}
|
||||
// 拣选任务状态
|
||||
int pickTaskStatus = WmsPickTaskStatusEnum.TEMP.getCode();
|
||||
// 库存正常
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user