From afa02e3d8dea1b6536b067f732496051ab725eed Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 25 Mar 2025 14:40:10 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=9B=98=E7=82=B9bug=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TaskQuestServiceImpl.java | 227 +++++++++--------- 1 file changed, 116 insertions(+), 111 deletions(-) diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java index 5aac3c7e9..2c8501401 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java @@ -843,116 +843,117 @@ public class TaskQuestServiceImpl extends BaseServiceImpl>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 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 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 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 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 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 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 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 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 questDetailEntities = baseMapper.selectTaskInfo(taskSearchDTO.getQuestNum(), questDetail1); // if (!questDetailEntities.isEmpty()) { // boolean b = questDetailEntities.stream().anyMatch(q -> ObjectUtils.isNotNull(q.getTrayId())); @@ -960,23 +961,27 @@ public class TaskQuestServiceImpl extends BaseServiceImpl