|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
*/ |
|
|
|
|
package com.logpm.warehouse.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
@ -305,6 +306,8 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
if (ObjectUtils.isNotNull(stockArticleEntity)) { |
|
|
|
|
detailEntity.setMarketName(stockArticleEntity.getMallName()); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
detailEntity.setMarketName(i.getMallName()); |
|
|
|
|
} |
|
|
|
|
detailEntity.setIncomingBatch(i.getOrderCode()); |
|
|
|
|
return detailEntity; |
|
|
|
@ -843,116 +846,117 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tag {}", 45); |
|
|
|
|
|
|
|
|
|
Long taskID; |
|
|
|
|
if (ObjectUtils.isNotNull(i.getId())) { |
|
|
|
|
taskID = i.getId(); |
|
|
|
|
} else { |
|
|
|
|
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); |
|
|
|
|
try{ |
|
|
|
|
Long taskID; |
|
|
|
|
if (ObjectUtils.isNotNull(i.getId())) { |
|
|
|
|
taskID = i.getId(); |
|
|
|
|
} else { |
|
|
|
|
String orderPackageCode = i.getOrderPackageCode(); |
|
|
|
|
if (StringUtil.isBlank(orderPackageCode)) { |
|
|
|
|
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 { |
|
|
|
|
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()); |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
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()); |
|
|
|
|
taskID = questDetail1.getId(); |
|
|
|
|
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()); |
|
|
|
|
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<QuestDetailEntity> list = new ArrayList<>(); |
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
questDetail.setId(i.getId()); |
|
|
|
|
questDetail.setQuestStatus(1); //已盘
|
|
|
|
|
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); |
|
|
|
|
} else { |
|
|
|
|
if (!stockNum1.equals(stockNum)) { |
|
|
|
|
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<QuestDetailEntity> list = new ArrayList<>(); |
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
questDetail.setId(i.getId()); |
|
|
|
|
questDetail.setQuestStatus(1); //已盘
|
|
|
|
|
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); |
|
|
|
|
} else { |
|
|
|
|
if (!stockNum1.equals(stockNum)) { |
|
|
|
|
questDetail.setIsChange(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
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 { |
|
|
|
|
//修改
|
|
|
|
|
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", childList); |
|
|
|
|
baseMapper.updetaQuestDetailChildList(questNum + "_child", childList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//是否修改库位
|
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
if (ObjectUtils.isNotNull(i.getGroundingAllocationId()) || ObjectUtils.isNotNull(i.getNewTrayId())) { |
|
|
|
|
//查询当前待更新货位是否包含已更新货位数据
|
|
|
|
|
QuestDetailEntity questDetail1 = new QuestDetailEntity(); |
|
|
|
|
questDetail1.setGroundingAllocationId(i.getGroundingAllocationId()); |
|
|
|
|
//是否修改库位
|
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
if (ObjectUtils.isNotNull(i.getGroundingAllocationId()) || ObjectUtils.isNotNull(i.getNewTrayId())) { |
|
|
|
|
//查询当前待更新货位是否包含已更新货位数据
|
|
|
|
|
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()));
|
|
|
|
@ -960,23 +964,27 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
// return Resp.scanFail("更新的货位,已有数据,无法上架更新!", "更新的货位,已有数据,无法上架更新!");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
questDetail.setId(i.getId()); |
|
|
|
|
questDetail.setIsChangeAt(1); |
|
|
|
|
questDetail.setNewTrayId(i.getNewTrayId()); |
|
|
|
|
questDetail.setNewTrayCode(i.getNewTrayCode()); |
|
|
|
|
// 通过托盘ID 查询托盘名称
|
|
|
|
|
if (ObjectUtils.isNotNull(i.getNewTrayCode())) { |
|
|
|
|
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(i.getNewTrayCode()); |
|
|
|
|
questDetail.setNewTrayName(trayEntity.getPalletName()); |
|
|
|
|
questDetail.setId(i.getId()); |
|
|
|
|
questDetail.setIsChangeAt(1); |
|
|
|
|
questDetail.setNewTrayId(i.getNewTrayId()); |
|
|
|
|
questDetail.setNewTrayCode(i.getNewTrayCode()); |
|
|
|
|
// 通过托盘ID 查询托盘名称
|
|
|
|
|
if (ObjectUtils.isNotNull(i.getNewTrayCode())) { |
|
|
|
|
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(i.getNewTrayCode()); |
|
|
|
|
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()); |
|
|
|
|
questDetail.setGroundingPositionCode(i.getGroundingPositionCode()); |
|
|
|
|
questDetail.setInventoryTime(new Date()); |
|
|
|
|
questDetail.setInventoryUser(user.getUserId()); |
|
|
|
|
detailEntityList.add(questDetail); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("######系统异常",e); |
|
|
|
|
throw new CustomerException(405,e.getMessage()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2940,7 +2948,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
questDetail.setMarketNames(marketNames); |
|
|
|
|
|
|
|
|
|
List<QuestDetailEntity> questDetailEntityList = baseMapper.selectQuestDetailList(taskSearchDTO.getQuestNum(), questDetail); |
|
|
|
|
if (questDetailEntityList.isEmpty() || ObjectUtils.isNull(questDetailEntityList) || ObjectUtils.isNull(questDetailEntityList.get(0).getQuestId())) { |
|
|
|
|
if (CollUtil.isEmpty(questDetailEntityList)) { |
|
|
|
|
|
|
|
|
|
// 需要判读这个盘点任务 是否存在绑定的商场
|
|
|
|
|
R<Object> extracted = extracted(questId, questDetail); |
|
|
|
@ -2950,8 +2958,8 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
// 需要去业务系统上进行查询信息
|
|
|
|
|
List<DistributionParcelListEntity> byPacketBarCode = distributionParcelListClient.findByPacketBarCode(questDetail.getOrderPackageCode()); |
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(byPacketBarCode)) { |
|
|
|
|
// DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(questDetail.getOrderPackageCode(), warehouseId);
|
|
|
|
|
if (CollUtil.isEmpty(byPacketBarCode)) { |
|
|
|
|
return R.fail(5000, "包件信息不存在!!"); |
|
|
|
|
} else { |
|
|
|
|
for (DistributionParcelListEntity distributionParcelListEntity : byPacketBarCode) { |
|
|
|
|