|
|
|
@ -765,98 +765,113 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
List<QuestDetailEntity> detailEntityList = new ArrayList<>(); |
|
|
|
|
//处理的包件
|
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}",4); |
|
|
|
|
for (QuestDetailDTO i : taskSearchDTO.getQuestDetailList()) { |
|
|
|
|
|
|
|
|
|
taskSearchDTO.getQuestDetailList().forEach(i ->{ |
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}",45); |
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}",45); |
|
|
|
|
|
|
|
|
|
Long taskID; |
|
|
|
|
if(ObjectUtils.isNotNull(i.getId())){ |
|
|
|
|
taskID = i.getId(); |
|
|
|
|
}else{ |
|
|
|
|
taskID = getTaskID(); |
|
|
|
|
} |
|
|
|
|
if(i.getIsNew().equals(1)){ |
|
|
|
|
//新增数据
|
|
|
|
|
Long taskID; |
|
|
|
|
if(ObjectUtils.isNotNull(i.getId())){ |
|
|
|
|
taskID = i.getId(); |
|
|
|
|
}else{ |
|
|
|
|
taskID = getTaskID(); |
|
|
|
|
} |
|
|
|
|
if(i.getIsNew().equals(1)){ |
|
|
|
|
//新增数据
|
|
|
|
|
|
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
BeanUtil.copyProperties(i,questDetail); |
|
|
|
|
questDetail.setTenantId(user.getTenantId()); |
|
|
|
|
questDetail.setCreateDept(Long.valueOf(user.getDeptId())); |
|
|
|
|
questDetail.setCreateTime(new Date()); |
|
|
|
|
questDetail.setIsDeleted(0); |
|
|
|
|
questDetail.setStatus(1); |
|
|
|
|
questDetail.setCreateUser(user.getUserId()); |
|
|
|
|
questDetail.setUpdateUser(user.getUserId()); |
|
|
|
|
questDetail.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
|
|
questDetail.setId(taskID); |
|
|
|
|
questDetail.setWarehouseId(warehouseId); |
|
|
|
|
questDetail.setQuestStatus(1); |
|
|
|
|
List<QuestDetailEntity> entityList = new ArrayList<>(); |
|
|
|
|
entityList.add(questDetail); |
|
|
|
|
baseMapper.insertQuestDetail( questNum,entityList); |
|
|
|
|
} |
|
|
|
|
Integer stockNum = i.getStockNum(); |
|
|
|
|
Integer lossNum = i.getLossNum(); |
|
|
|
|
Integer deliveNum = i.getDeliveNum(); |
|
|
|
|
Integer wornNum = i.getWornNum(); |
|
|
|
|
Integer noReceivedNum = i.getNoReceivedNum(); |
|
|
|
|
Integer noRepairNum = i.getNoRepairNum(); |
|
|
|
|
if(stockNum > 0 || lossNum > 0 || deliveNum > 0 || wornNum > 0 || noReceivedNum > 0 || noRepairNum > 0){ |
|
|
|
|
|
|
|
|
|
//查询盘点包件信息
|
|
|
|
|
if(ObjectUtils.isNotNull(i.getOrderPackageCode())){ |
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
questDetail.setOrderPackageCode(i.getOrderPackageCode()); |
|
|
|
|
QuestDetailEntity questDetail1 = baseMapper.selectOneTaskInfo(taskSearchDTO.getQuestNum(), questDetail); |
|
|
|
|
if(ObjectUtils.isNotNull(questDetail1)){ |
|
|
|
|
i.setId(questDetail1.getId()); |
|
|
|
|
} |
|
|
|
|
BeanUtil.copyProperties(i,questDetail); |
|
|
|
|
questDetail.setTenantId(user.getTenantId()); |
|
|
|
|
questDetail.setCreateDept(Long.valueOf(user.getDeptId())); |
|
|
|
|
questDetail.setCreateTime(new Date()); |
|
|
|
|
questDetail.setIsDeleted(0); |
|
|
|
|
questDetail.setStatus(1); |
|
|
|
|
questDetail.setCreateUser(user.getUserId()); |
|
|
|
|
questDetail.setUpdateUser(user.getUserId()); |
|
|
|
|
questDetail.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
|
|
questDetail.setId(taskID); |
|
|
|
|
questDetail.setWarehouseId(warehouseId); |
|
|
|
|
questDetail.setQuestStatus(1); |
|
|
|
|
List<QuestDetailEntity> entityList = new ArrayList<>(); |
|
|
|
|
entityList.add(questDetail); |
|
|
|
|
baseMapper.insertQuestDetail( questNum,entityList); |
|
|
|
|
} |
|
|
|
|
//添加
|
|
|
|
|
List<QuestDetailChildEntity> childList = new ArrayList<>(); |
|
|
|
|
childList.add(addQuestDetailChild(stockNum,"10",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(wornNum,"20",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(lossNum,"30",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(noRepairNum,"40",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(deliveNum,"50",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(noReceivedNum,"60",taskID,warehouseId,questNum)); |
|
|
|
|
if(!childList.isEmpty()){ |
|
|
|
|
boolean b = childList.stream().anyMatch(ii -> ObjectUtils.isNull(ii.getId())); |
|
|
|
|
if(b){ |
|
|
|
|
//添加
|
|
|
|
|
baseMapper.insertQuestDetailChildList(taskSearchDTO.getQuestNum()+"_child",childList); |
|
|
|
|
//修改盘点数据
|
|
|
|
|
List<QuestDetailEntity> list = new ArrayList<>(); |
|
|
|
|
Integer stockNum = i.getStockNum(); |
|
|
|
|
Integer lossNum = i.getLossNum(); |
|
|
|
|
Integer deliveNum = i.getDeliveNum(); |
|
|
|
|
Integer wornNum = i.getWornNum(); |
|
|
|
|
Integer noReceivedNum = i.getNoReceivedNum(); |
|
|
|
|
Integer noRepairNum = i.getNoRepairNum(); |
|
|
|
|
if(stockNum > 0 || lossNum > 0 || deliveNum > 0 || wornNum > 0 || noReceivedNum > 0 || noRepairNum > 0){ |
|
|
|
|
|
|
|
|
|
//查询盘点包件信息
|
|
|
|
|
if(ObjectUtils.isNotNull(i.getOrderPackageCode())){ |
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
questDetail.setId(i.getId()); |
|
|
|
|
questDetail.setQuestStatus(1); //已盘
|
|
|
|
|
questDetail.setUpdateUser(user.getUserId()); |
|
|
|
|
questDetail.setUpdateTime(new Date()); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getTrayId())){ |
|
|
|
|
questDetail.setTrayId(i.getTrayId()); |
|
|
|
|
questDetail.setTrayCode(i.getTrayCode()); |
|
|
|
|
questDetail.setOrderPackageCode(i.getOrderPackageCode()); |
|
|
|
|
QuestDetailEntity questDetail1 = baseMapper.selectOneTaskInfo(taskSearchDTO.getQuestNum(), questDetail); |
|
|
|
|
if(ObjectUtils.isNotNull(questDetail1)){ |
|
|
|
|
i.setId(questDetail1.getId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//添加
|
|
|
|
|
List<QuestDetailChildEntity> childList = new ArrayList<>(); |
|
|
|
|
childList.add(addQuestDetailChild(stockNum,"10",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(wornNum,"20",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(lossNum,"30",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(noRepairNum,"40",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(deliveNum,"50",taskID,warehouseId,questNum)); |
|
|
|
|
childList.add(addQuestDetailChild(noReceivedNum,"60",taskID,warehouseId,questNum)); |
|
|
|
|
if(!childList.isEmpty()){ |
|
|
|
|
boolean b = childList.stream().anyMatch(ii -> ObjectUtils.isNull(ii.getId())); |
|
|
|
|
if(b){ |
|
|
|
|
//添加
|
|
|
|
|
baseMapper.insertQuestDetailChildList(taskSearchDTO.getQuestNum()+"_child",childList); |
|
|
|
|
//修改盘点数据
|
|
|
|
|
List<QuestDetailEntity> list = new ArrayList<>(); |
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
questDetail.setId(i.getId()); |
|
|
|
|
questDetail.setQuestStatus(1); //已盘
|
|
|
|
|
questDetail.setUpdateUser(user.getUserId()); |
|
|
|
|
questDetail.setUpdateTime(new Date()); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getTrayId())){ |
|
|
|
|
questDetail.setTrayId(i.getTrayId()); |
|
|
|
|
questDetail.setTrayCode(i.getTrayCode()); |
|
|
|
|
} |
|
|
|
|
list.add(questDetail); |
|
|
|
|
baseMapper.updatePositionCodeList(taskSearchDTO.getQuestNum(),list); |
|
|
|
|
}else{ |
|
|
|
|
//修改
|
|
|
|
|
List<QuestDetailChildEntity> collect = childList.stream().filter( ii -> ObjectUtils.isNotNull(ii.getQuestNum()) && ii.getQuestNum() > 0).collect(Collectors.toList()); |
|
|
|
|
baseMapper.updetaQuestDetailChildList(questNum+"_child",collect); |
|
|
|
|
} |
|
|
|
|
list.add(questDetail); |
|
|
|
|
baseMapper.updatePositionCodeList(taskSearchDTO.getQuestNum(),list); |
|
|
|
|
}else{ |
|
|
|
|
//修改
|
|
|
|
|
List<QuestDetailChildEntity> collect = childList.stream().filter( ii -> ObjectUtils.isNotNull(ii.getQuestNum()) && ii.getQuestNum() > 0).collect(Collectors.toList()); |
|
|
|
|
baseMapper.updetaQuestDetailChildList(questNum+"_child",collect); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//是否修改库位
|
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getGroundingAllocationId())){ |
|
|
|
|
questDetail.setId(i.getId()); |
|
|
|
|
//是否修改库位
|
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getGroundingAllocationId())){ |
|
|
|
|
//查询当前待更新货位是否包含已更新货位数据
|
|
|
|
|
QuestDetailEntity questDetail1 = new QuestDetailEntity(); |
|
|
|
|
questDetail1.setGroundingAllocationId(i.getGroundingAllocationId()); |
|
|
|
|
List<QuestDetailEntity> questDetailEntities = baseMapper.selectTaskInfo(taskSearchDTO.getQuestNum(), questDetail1); |
|
|
|
|
if(!questDetailEntities.isEmpty()){ |
|
|
|
|
boolean b = questDetailEntities.stream().anyMatch(q -> ObjectUtils.isNotNull(q.getTrayId())); |
|
|
|
|
if(b){ |
|
|
|
|
return Resp.scanFail("更新的货位,已有数据,无法上架更新!","更新的货位,已有数据,无法上架更新!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
questDetail.setId(i.getId()); |
|
|
|
|
// questDetail.setGroundingAllocationId(Long.valueOf(i.getAllocationId()));
|
|
|
|
|
questDetail.setGroundingAllocationId(i.getGroundingAllocationId()); |
|
|
|
|
questDetail.setGroundingPositionCode(i.getGroundingPositionCode()); |
|
|
|
|
detailEntityList.add(questDetail); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
questDetail.setGroundingAllocationId(i.getGroundingAllocationId()); |
|
|
|
|
questDetail.setGroundingPositionCode(i.getGroundingPositionCode()); |
|
|
|
|
detailEntityList.add(questDetail); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}",5); |
|
|
|
|
|
|
|
|
|
//修改货位
|
|
|
|
|