报工补充代码及入库不查对应库区库存问题

This commit is contained in:
Ledo 2025-03-05 23:33:15 +08:00
parent 254ab45896
commit 111b101e4c
3 changed files with 23 additions and 17 deletions

View File

@ -48,6 +48,7 @@ public interface StorageMaterialMapper extends BaseMapperX<StorageMaterialDO> {
query.selectAll(StorageMaterialDO.class)
.select("ifnull(sum(t.storage_ok_qty),0) mat_rest")
.select("count(t.id) num")
.orderByDesc(StorageMaterialDO::getId);
query.like(!StringUtils.isEmpty(reqVO.getMatType()),StorageMaterialDO::getMatType, reqVO.getMatType())
@ -55,8 +56,9 @@ public interface StorageMaterialMapper extends BaseMapperX<StorageMaterialDO> {
.like(!StringUtils.isEmpty(reqVO.getMatName()), StorageMaterialDO::getMatName, reqVO.getMatName())
.like(!StringUtils.isEmpty(reqVO.getMatCode()), StorageMaterialDO::getMatCode, reqVO.getMatCode())
.like(!StringUtils.isEmpty(reqVO.getLotNo()),StorageMaterialDO::getLotNo, reqVO.getLotNo())
.eq(reqVO.getWhId()!=null,StorageMaterialDO::getWhId,reqVO.getWhId())
.groupBy(StorageMaterialDO::getId).orderByDesc(StorageMaterialDO::getId);
return selectPage(reqVO,query);
}
}
}

View File

@ -82,13 +82,14 @@ public interface TaskDispatchDetailMapper extends BaseMapperX<TaskDispatchDetail
.eq(TaskDispatchDetailDO::getProcedureStatus, 2);
return selectOne(query);
}
default TaskDispatchDetailDO selectNoReportBeforeDo(TaskDispatchDetailDO taskDispatchDetailDO){
default List<TaskDispatchDetailDO> selectNoReportBeforeDo(TaskDispatchDetailDO taskDispatchDetailDO){
MPJLambdaWrapper<TaskDispatchDetailDO> query = new MPJLambdaWrapper<>();
query.selectAll(TaskDispatchDetailDO.class).leftJoin(ProcedureDO.class,"a",ProcedureDO::getId,TaskDispatchDetailDO::getProcedureId)
.eq(TaskDispatchDetailDO::getSort, taskDispatchDetailDO.getSort() - 1)
.eq(TaskDispatchDetailDO::getDispatchId, taskDispatchDetailDO.getDispatchId())
.eq(ProcedureDO::getIsReport,0);
return selectOne(query);
query.selectAll(TaskDispatchDetailDO.class)
.select("a.is_report as isReport")
.leftJoin(ProcedureDO.class,"a",ProcedureDO::getId,TaskDispatchDetailDO::getProcedureId)
.lt(TaskDispatchDetailDO::getSort,taskDispatchDetailDO.getSort())
.eq(TaskDispatchDetailDO::getDispatchId, taskDispatchDetailDO.getDispatchId());
return selectList(query);
}
default PageResult<TaskDispatchDetailDO> selectPageGroup(YgjxPageReqVO pageReqVO) {
MPJLambdaWrapper<TaskDispatchDetailDO> query = new MPJLambdaWrapper<>();

View File

@ -363,22 +363,25 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
@Override
public TaskDispatchDetailDO getTaskDispatchDetail(TaskDispatchDetailPageReqVO pageReqVO){
TaskDispatchDetailDO taskDispatchDetailDO = taskDispatchDetailMapper.selectGet(pageReqVO);
if (taskDispatchDetailDO.getSort()!=null&&taskDispatchDetailDO.getSort() != 1){
// TaskDispatchDetailDO taskDispatchDetailDO1 = taskDispatchDetailMapper.selectOne(new LambdaQueryWrapperX<TaskDispatchDetailDO>()
// .eq(TaskDispatchDetailDO::getSort, taskDispatchDetailDO.getSort() - 1)
// .eq(TaskDispatchDetailDO::getDispatchId, taskDispatchDetailDO.getDispatchId())
// .eq(TaskDispatchDetailDO::getProcedureStatus, 2)
// );
TaskDispatchDetailDO taskDispatchDetailDO2 = taskDispatchDetailMapper.selectNoReportBeforeDo(taskDispatchDetailDO);
if (taskDispatchDetailDO2 != null){
taskDispatchDetailDO.setBeforeProcedureStatus(1);
}else{
TaskDispatchDetailDO taskDispatchDetailDO1 = taskDispatchDetailMapper.selectBeforeDo(taskDispatchDetailDO);
if (taskDispatchDetailDO1 == null){
//查不出来上一道工序已完工就代表它没完成
taskDispatchDetailDO.setBeforeProcedureStatus(0);
}else{
taskDispatchDetailDO.setBeforeProcedureStatus(1);
taskDispatchDetailDO.setBeforeProcedureStatus(1);
List<TaskDispatchDetailDO> taskDispatchDetailDO2 = taskDispatchDetailMapper.selectNoReportBeforeDo(taskDispatchDetailDO);
List<TaskDispatchDetailDO> filteredList = taskDispatchDetailDO2.stream()
.filter(task -> task.getProcedureStatus() != 2) // 筛选product不为"2"的记录
.collect(Collectors.toList());
if(CollUtil.isNotEmpty(filteredList)){
//如果他之前的数据有未完成的且是需要报工的
for (TaskDispatchDetailDO dispatchDetailDO : filteredList) {
if (dispatchDetailDO.getIsReport() != 0){
taskDispatchDetailDO.setBeforeProcedureStatus(0);
break;
}
}
}
}else{