Browse Source

Merge remote-tracking branch 'origin/dev' into pre-production

pre-production
zhenghaoyu 1 week ago
parent
commit
444b8cd68d
  1. 227
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java

227
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java

@ -843,116 +843,117 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}", 45); log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}", 45);
Long taskID; try{
if (ObjectUtils.isNotNull(i.getId())) { Long taskID;
taskID = i.getId(); if (ObjectUtils.isNotNull(i.getId())) {
} else { taskID = i.getId();
taskID = getTaskID();
}
if (i.getIsNew().equals(1)) {
//新增数据
Integer questTarget = i.getQuestTarget();
QuestDetailEntity questDetail = new QuestDetailEntity();
BeanUtil.copyProperties(i, questDetail);
questDetail.setTenantId(user.getTenantId());
questDetail.setCreateDept(getDeptByMaxDept(user.getDeptId()));
questDetail.setCreateTime(new Date());
questDetail.setIsDeleted(0);
questDetail.setStatus(1);
questDetail.setIsChange(1);
if (questTarget.equals(2)) {
questDetail.setHasData(0);
} else { } else {
String orderPackageCode = i.getOrderPackageCode(); taskID = getTaskID();
if (StringUtil.isBlank(orderPackageCode)) { }
if (i.getIsNew().equals(1)) {
//新增数据
Integer questTarget = i.getQuestTarget();
QuestDetailEntity questDetail = new QuestDetailEntity();
BeanUtil.copyProperties(i, questDetail);
questDetail.setTenantId(user.getTenantId());
questDetail.setCreateDept(getDeptByMaxDept(user.getDeptId()));
questDetail.setCreateTime(new Date());
questDetail.setIsDeleted(0);
questDetail.setStatus(1);
questDetail.setIsChange(1);
if (questTarget.equals(2)) {
questDetail.setHasData(0); questDetail.setHasData(0);
} else { } else {
questDetail.setHasData(1); String orderPackageCode = i.getOrderPackageCode();
if (StringUtil.isBlank(orderPackageCode)) {
questDetail.setHasData(0);
} else {
questDetail.setHasData(1);
}
} }
questDetail.setCreateUser(user.getUserId());
questDetail.setUpdateUser(user.getUserId());
questDetail.setUpdateTime(new Date());
questDetail.setInventoryTime(new Date());
questDetail.setInventoryUser(user.getUserId());
questDetail.setId(taskID);
questDetail.setWarehouseId(warehouseId);
questDetail.setQuestStatus(1);
List<QuestDetailEntity> entityList = new ArrayList<>();
entityList.add(questDetail);
baseMapper.insertQuestDetail(questNum, entityList);
} }
questDetail.setCreateUser(user.getUserId()); Integer stockNum = i.getStockNum();
questDetail.setUpdateUser(user.getUserId()); Integer lossNum = i.getLossNum();
questDetail.setUpdateTime(new Date()); Integer deliveNum = i.getDeliveNum();
questDetail.setInventoryTime(new Date()); Integer wornNum = i.getWornNum();
questDetail.setInventoryUser(user.getUserId()); Integer noReceivedNum = i.getNoReceivedNum();
Integer noRepairNum = i.getNoRepairNum();
questDetail.setId(taskID); if (stockNum > 0 || lossNum > 0 || deliveNum > 0 || wornNum > 0 || noReceivedNum > 0 || noRepairNum > 0) {
questDetail.setWarehouseId(warehouseId);
questDetail.setQuestStatus(1); //查询盘点包件信息
List<QuestDetailEntity> entityList = new ArrayList<>(); if (ObjectUtils.isNotNull(i.getOrderPackageCode())) {
entityList.add(questDetail); QuestDetailEntity questDetail = new QuestDetailEntity();
baseMapper.insertQuestDetail(questNum, entityList); questDetail.setOrderPackageCode(i.getOrderPackageCode());
} QuestDetailEntity questDetail1 = baseMapper.selectOneTaskInfo(taskSearchDTO.getQuestNum(), questDetail);
Integer stockNum = i.getStockNum(); if (ObjectUtils.isNotNull(questDetail1)) {
Integer lossNum = i.getLossNum(); i.setId(questDetail1.getId());
Integer deliveNum = i.getDeliveNum(); taskID = questDetail1.getId();
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());
taskID = 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));
boolean b = childList.stream().anyMatch(ii -> ObjectUtils.isNull(ii.getId()));
if (b) {
//添加 //添加
baseMapper.insertQuestDetailChildList(taskSearchDTO.getQuestNum() + "_child", childList); List<QuestDetailChildEntity> childList = new ArrayList<>();
//修改盘点数据 childList.add(addQuestDetailChild(stockNum, "10", taskID, warehouseId, questNum));
List<QuestDetailEntity> list = new ArrayList<>(); childList.add(addQuestDetailChild(wornNum, "20", taskID, warehouseId, questNum));
QuestDetailEntity questDetail = new QuestDetailEntity(); childList.add(addQuestDetailChild(lossNum, "30", taskID, warehouseId, questNum));
questDetail.setId(i.getId()); childList.add(addQuestDetailChild(noRepairNum, "40", taskID, warehouseId, questNum));
questDetail.setQuestStatus(1); //已盘 childList.add(addQuestDetailChild(deliveNum, "50", taskID, warehouseId, questNum));
questDetail.setUpdateUser(user.getUserId()); childList.add(addQuestDetailChild(noReceivedNum, "60", taskID, warehouseId, questNum));
QuestDetailEntity detailEntity = baseMapper.findEntityById(questNum, taskID); boolean b = childList.stream().anyMatch(ii -> ObjectUtils.isNull(ii.getId()));
if (!Objects.isNull(detailEntity)) { if (b) {
Integer isNew = detailEntity.getIsNew(); //添加
Integer questTarget = detailEntity.getQuestTarget(); baseMapper.insertQuestDetailChildList(taskSearchDTO.getQuestNum() + "_child", childList);
Integer stockNum1 = detailEntity.getStockNum(); //修改盘点数据
List<QuestDetailEntity> list = new ArrayList<>();
if (isNew.equals(1)) { QuestDetailEntity questDetail = new QuestDetailEntity();
questDetail.setIsChange(1); questDetail.setId(i.getId());
} else { questDetail.setQuestStatus(1); //已盘
if (!stockNum1.equals(stockNum)) { questDetail.setUpdateUser(user.getUserId());
QuestDetailEntity detailEntity = baseMapper.findEntityById(questNum, taskID);
if (!Objects.isNull(detailEntity)) {
Integer isNew = detailEntity.getIsNew();
Integer questTarget = detailEntity.getQuestTarget();
Integer stockNum1 = detailEntity.getStockNum();
if (isNew.equals(1)) {
questDetail.setIsChange(1); questDetail.setIsChange(1);
} else {
if (!stockNum1.equals(stockNum)) {
questDetail.setIsChange(1);
}
} }
} }
} questDetail.setUpdateTime(new Date());
questDetail.setUpdateTime(new Date()); if (ObjectUtils.isNotNull(i.getTrayId())) {
if (ObjectUtils.isNotNull(i.getTrayId())) { questDetail.setTrayId(i.getTrayId());
questDetail.setTrayId(i.getTrayId()); questDetail.setTrayCode(i.getTrayCode());
questDetail.setTrayCode(i.getTrayCode()); }
} list.add(questDetail);
list.add(questDetail); baseMapper.updatePositionCodeList(taskSearchDTO.getQuestNum(), list);
baseMapper.updatePositionCodeList(taskSearchDTO.getQuestNum(), list); } else {
} else { //修改
//修改
// List<QuestDetailChildEntity> collect = childList.stream().filter(ii -> ObjectUtils.isNotNull(ii.getQuestNum()) && ii.getQuestNum() > 0).collect(Collectors.toList()); // List<QuestDetailChildEntity> collect = childList.stream().filter(ii -> ObjectUtils.isNotNull(ii.getQuestNum()) && ii.getQuestNum() > 0).collect(Collectors.toList());
baseMapper.updetaQuestDetailChildList(questNum + "_child", childList); baseMapper.updetaQuestDetailChildList(questNum + "_child", childList);
}
} }
}
//是否修改库位 //是否修改库位
QuestDetailEntity questDetail = new QuestDetailEntity(); QuestDetailEntity questDetail = new QuestDetailEntity();
if (ObjectUtils.isNotNull(i.getGroundingAllocationId()) || ObjectUtils.isNotNull(i.getNewTrayId())) { if (ObjectUtils.isNotNull(i.getGroundingAllocationId()) || ObjectUtils.isNotNull(i.getNewTrayId())) {
//查询当前待更新货位是否包含已更新货位数据 //查询当前待更新货位是否包含已更新货位数据
QuestDetailEntity questDetail1 = new QuestDetailEntity(); QuestDetailEntity questDetail1 = new QuestDetailEntity();
questDetail1.setGroundingAllocationId(i.getGroundingAllocationId()); questDetail1.setGroundingAllocationId(i.getGroundingAllocationId());
// List<QuestDetailEntity> questDetailEntities = baseMapper.selectTaskInfo(taskSearchDTO.getQuestNum(), questDetail1); // List<QuestDetailEntity> questDetailEntities = baseMapper.selectTaskInfo(taskSearchDTO.getQuestNum(), questDetail1);
// if (!questDetailEntities.isEmpty()) { // if (!questDetailEntities.isEmpty()) {
// boolean b = questDetailEntities.stream().anyMatch(q -> ObjectUtils.isNotNull(q.getTrayId())); // boolean b = questDetailEntities.stream().anyMatch(q -> ObjectUtils.isNotNull(q.getTrayId()));
@ -960,23 +961,27 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
// return Resp.scanFail("更新的货位,已有数据,无法上架更新!", "更新的货位,已有数据,无法上架更新!"); // return Resp.scanFail("更新的货位,已有数据,无法上架更新!", "更新的货位,已有数据,无法上架更新!");
// } // }
// } // }
questDetail.setId(i.getId()); questDetail.setId(i.getId());
questDetail.setIsChangeAt(1); questDetail.setIsChangeAt(1);
questDetail.setNewTrayId(i.getNewTrayId()); questDetail.setNewTrayId(i.getNewTrayId());
questDetail.setNewTrayCode(i.getNewTrayCode()); questDetail.setNewTrayCode(i.getNewTrayCode());
// 通过托盘ID 查询托盘名称 // 通过托盘ID 查询托盘名称
if (ObjectUtils.isNotNull(i.getNewTrayCode())) { if (ObjectUtils.isNotNull(i.getNewTrayCode())) {
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(i.getNewTrayCode()); BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(i.getNewTrayCode());
questDetail.setNewTrayName(trayEntity.getPalletName()); questDetail.setNewTrayName(trayEntity.getPalletName());
}
questDetail.setGroundingAllocationId(i.getGroundingAllocationId());
questDetail.setGroundingPositionCode(i.getGroundingPositionCode());
questDetail.setInventoryTime(new Date());
questDetail.setInventoryUser(user.getUserId());
detailEntityList.add(questDetail);
} }
questDetail.setGroundingAllocationId(i.getGroundingAllocationId()); }catch (Exception e){
questDetail.setGroundingPositionCode(i.getGroundingPositionCode()); log.error("######系统异常",e);
questDetail.setInventoryTime(new Date()); throw new CustomerException(405,e.getMessage());
questDetail.setInventoryUser(user.getUserId());
detailEntityList.add(questDetail);
} }
} }

Loading…
Cancel
Save