Showing
10 changed files
with
208 additions
and
151 deletions
| @@ -1950,7 +1950,6 @@ CREATE TABLE `procurement_plan` | @@ -1950,7 +1950,6 @@ CREATE TABLE `procurement_plan` | ||
| 1950 | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | 1950 | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| 1951 | `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 1951 | `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 1952 | PRIMARY KEY (`id`), | 1952 | PRIMARY KEY (`id`), |
| 1953 | - UNIQUE KEY `uk_pp_code` (`code`), | ||
| 1954 | KEY `idx_pp_company_short_id` (`company_short_id`), | 1953 | KEY `idx_pp_company_short_id` (`company_short_id`), |
| 1955 | KEY `idx_pp_supplier_id` (`supplier_id`), | 1954 | KEY `idx_pp_supplier_id` (`supplier_id`), |
| 1956 | KEY `idx_pp_date` (`date`), | 1955 | KEY `idx_pp_date` (`date`), |
| @@ -2018,7 +2017,6 @@ CREATE TABLE `procurement_buyout_apply` | @@ -2018,7 +2017,6 @@ CREATE TABLE `procurement_buyout_apply` | ||
| 2018 | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | 2017 | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| 2019 | `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 2018 | `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 2020 | PRIMARY KEY (`id`), | 2019 | PRIMARY KEY (`id`), |
| 2021 | - UNIQUE KEY `uk_pba_code` (`code`), | ||
| 2022 | KEY `idx_pba_plan_id` (`procurement_plan_id`), | 2020 | KEY `idx_pba_plan_id` (`procurement_plan_id`), |
| 2023 | KEY `idx_pba_supplier_id` (`supplier_id`), | 2021 | KEY `idx_pba_supplier_id` (`supplier_id`), |
| 2024 | KEY `idx_pba_date` (`date`), | 2022 | KEY `idx_pba_date` (`date`), |
| @@ -374,13 +374,13 @@ public class ProcurementPlan extends BaseEntity implements BaseDto { | @@ -374,13 +374,13 @@ public class ProcurementPlan extends BaseEntity implements BaseDto { | ||
| 374 | /** | 374 | /** |
| 375 | * 创建人ID | 375 | * 创建人ID |
| 376 | */ | 376 | */ |
| 377 | - @TableField(fill = FieldFill.INSERT) | 377 | + @TableField(fill = FieldFill.DEFAULT) |
| 378 | private String createById; | 378 | private String createById; |
| 379 | 379 | ||
| 380 | /** | 380 | /** |
| 381 | * 创建人 | 381 | * 创建人 |
| 382 | */ | 382 | */ |
| 383 | - @TableField(fill = FieldFill.INSERT) | 383 | + @TableField(fill = FieldFill.DEFAULT) |
| 384 | private String createBy; | 384 | private String createBy; |
| 385 | 385 | ||
| 386 | /** | 386 | /** |
| @@ -84,6 +84,7 @@ public class ProcurementPlanReplenishLine extends BaseEntity implements BaseDto | @@ -84,6 +84,7 @@ public class ProcurementPlanReplenishLine extends BaseEntity implements BaseDto | ||
| 84 | /** | 84 | /** |
| 85 | * 分厂名称 | 85 | * 分厂名称 |
| 86 | */ | 86 | */ |
| 87 | + @TableField(exist = false) | ||
| 87 | private String workshopName; | 88 | private String workshopName; |
| 88 | 89 | ||
| 89 | /** | 90 | /** |
| @@ -455,6 +455,8 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -455,6 +455,8 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 455 | archivedMain.setId(IdUtil.getId()); | 455 | archivedMain.setId(IdUtil.getId()); |
| 456 | archivedMain.setCode(mainPlan.getCode() + "_HIST"); | 456 | archivedMain.setCode(mainPlan.getCode() + "_HIST"); |
| 457 | archivedMain.setDeleted(Boolean.TRUE); | 457 | archivedMain.setDeleted(Boolean.TRUE); |
| 458 | + archivedMain.setCreateBy(mainPlan.getCreateBy()); | ||
| 459 | + archivedMain.setCreateById(mainPlan.getCreateById()); | ||
| 458 | procurementPlanService.save(archivedMain); | 460 | procurementPlanService.save(archivedMain); |
| 459 | // 原主计划子表也复制一份 | 461 | // 原主计划子表也复制一份 |
| 460 | List<ProcurementPlanLine> mainLines = procurementPlanLineService.getByProcurementPlanId(planId); | 462 | List<ProcurementPlanLine> mainLines = procurementPlanLineService.getByProcurementPlanId(planId); |
| @@ -538,67 +540,70 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -538,67 +540,70 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 538 | } | 540 | } |
| 539 | ProcurementPlanChange procurementPlanChange = this.getById(id); | 541 | ProcurementPlanChange procurementPlanChange = this.getById(id); |
| 540 | // 按分厂分组明细 | 542 | // 按分厂分组明细 |
| 543 | + List<String> allWorkshopIds = new ArrayList<>(); | ||
| 541 | if (CollectionUtil.isNotEmpty(changeLines)) { | 544 | if (CollectionUtil.isNotEmpty(changeLines)) { |
| 542 | // workshopId -> workshop code | 545 | // workshopId -> workshop code |
| 543 | - List<String> allWorkshopIds = changeLines.stream() | 546 | + allWorkshopIds = changeLines.stream() |
| 544 | .map(ProcurementPlanChangeLine::getWorkshopId) | 547 | .map(ProcurementPlanChangeLine::getWorkshopId) |
| 545 | .filter(StringUtil::isNotBlank) | 548 | .filter(StringUtil::isNotBlank) |
| 546 | .distinct() | 549 | .distinct() |
| 547 | .collect(Collectors.toList()); | 550 | .collect(Collectors.toList()); |
| 548 | Map<String, String> workshop2Code = new HashMap<>(); | 551 | Map<String, String> workshop2Code = new HashMap<>(); |
| 549 | - if (CollectionUtil.isNotEmpty(allWorkshopIds)) { | 552 | + if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() > 1) { |
| 550 | List<Workshop> workshopList = workshopService.listByIds(allWorkshopIds); | 553 | List<Workshop> workshopList = workshopService.listByIds(allWorkshopIds); |
| 551 | if (CollectionUtil.isNotEmpty(workshopList)) { | 554 | if (CollectionUtil.isNotEmpty(workshopList)) { |
| 552 | workshop2Code = workshopList.stream() | 555 | workshop2Code = workshopList.stream() |
| 553 | .filter(w -> StringUtil.isNotBlank(w.getCode())) | 556 | .filter(w -> StringUtil.isNotBlank(w.getCode())) |
| 554 | .collect(Collectors.toMap(Workshop::getId, Workshop::getCode, (v1, v2) -> v1)); | 557 | .collect(Collectors.toMap(Workshop::getId, Workshop::getCode, (v1, v2) -> v1)); |
| 555 | } | 558 | } |
| 556 | - } | ||
| 557 | - // 分厂顺序 | ||
| 558 | - Map<String, Integer> workOrderMap = new LinkedHashMap<>(); | ||
| 559 | - workOrderMap.put("yfc", 1); | ||
| 560 | - workOrderMap.put("efc", 2); | ||
| 561 | - workOrderMap.put("sfc", 3); | ||
| 562 | - workOrderMap.put("ztfc", 4); | ||
| 563 | - Map<String, List<ProcurementPlanChangeLine>> workshopLines = new LinkedHashMap<>(); | ||
| 564 | - for (ProcurementPlanChangeLine cl : changeLines) { | ||
| 565 | - String code = workshop2Code.getOrDefault(cl.getWorkshopId(), ""); | ||
| 566 | - workshopLines.computeIfAbsent(code, k -> new ArrayList<>()).add(cl); | ||
| 567 | - } | ||
| 568 | - List<Map.Entry<String, List<ProcurementPlanChangeLine>>> sortedEntries = workshopLines.entrySet().stream() | ||
| 569 | - .sorted(Comparator.comparingInt(e -> workOrderMap.getOrDefault(e.getKey(), Integer.MAX_VALUE))) | ||
| 570 | - .collect(Collectors.toList()); | ||
| 571 | - | ||
| 572 | - for (Map.Entry<String, List<ProcurementPlanChangeLine>> entry : sortedEntries) { | ||
| 573 | - List<ProcurementPlanChangeLine> wLines = entry.getValue(); | ||
| 574 | - if (CollectionUtil.isEmpty(wLines)) { | ||
| 575 | - continue; | 559 | + // 分厂顺序 |
| 560 | + Map<String, Integer> workOrderMap = new LinkedHashMap<>(); | ||
| 561 | + workOrderMap.put("yfc", 1); | ||
| 562 | + workOrderMap.put("efc", 2); | ||
| 563 | + workOrderMap.put("sfc", 3); | ||
| 564 | + workOrderMap.put("ztfc", 4); | ||
| 565 | + Map<String, List<ProcurementPlanChangeLine>> workshopLines = new LinkedHashMap<>(); | ||
| 566 | + for (ProcurementPlanChangeLine cl : changeLines) { | ||
| 567 | + String code = workshop2Code.getOrDefault(cl.getWorkshopId(), ""); | ||
| 568 | + workshopLines.computeIfAbsent(code, k -> new ArrayList<>()).add(cl); | ||
| 576 | } | 569 | } |
| 577 | - String suffixStr = String.format("%02d", nextSuffix); | ||
| 578 | - String subCode = mainPlan.getCode() + "_" + suffixStr; | ||
| 579 | - nextSuffix++; | ||
| 580 | - | ||
| 581 | - CreateProcurementPlanVo subVo = BeanUtil.copyProperties(entity, CreateProcurementPlanVo.class); | ||
| 582 | - subVo.setCode(subCode); | ||
| 583 | - subVo.setParentId(planId); | ||
| 584 | - subVo.setProcessStatus("COMPLETED"); | ||
| 585 | - subVo.setProcessNode(null); | ||
| 586 | - subVo.setWorkshopId(CollectionUtil.isNotEmpty(wLines) ? wLines.get(0).getWorkshopId() : null); | ||
| 587 | - subVo.setPlanType("变"); | ||
| 588 | - subVo.setPurchaseDeptName(procurementPlanChange.getPurchaseDeptName()); | ||
| 589 | - subVo.setManagementDeptName(procurementPlanChange.getManagementDeptName()); | ||
| 590 | - subVo.setSupplyManagerName(procurementPlanChange.getSupplyManagerName()); | ||
| 591 | - subVo.setMarketingManagerName(procurementPlanChange.getMarketingManagerName()); | ||
| 592 | - subVo.setApprovalPassTime(LocalDateTime.now()); | ||
| 593 | - | ||
| 594 | - List<ProcurementPlanLineVo> subLineVos = new ArrayList<>(); | ||
| 595 | - for (ProcurementPlanChangeLine cl : wLines) { | ||
| 596 | - ProcurementPlanLineVo lv = BeanUtil.copyProperties(cl, ProcurementPlanLineVo.class); | ||
| 597 | - subLineVos.add(lv); | 570 | + List<Map.Entry<String, List<ProcurementPlanChangeLine>>> sortedEntries = workshopLines.entrySet().stream() |
| 571 | + .sorted(Comparator.comparingInt(e -> workOrderMap.getOrDefault(e.getKey(), Integer.MAX_VALUE))) | ||
| 572 | + .collect(Collectors.toList()); | ||
| 573 | + | ||
| 574 | + for (Map.Entry<String, List<ProcurementPlanChangeLine>> entry : sortedEntries) { | ||
| 575 | + List<ProcurementPlanChangeLine> wLines = entry.getValue(); | ||
| 576 | + if (CollectionUtil.isEmpty(wLines)) { | ||
| 577 | + continue; | ||
| 578 | + } | ||
| 579 | + String suffixStr = String.format("%02d", nextSuffix); | ||
| 580 | + String subCode = mainPlan.getCode() + "_" + suffixStr; | ||
| 581 | + nextSuffix++; | ||
| 582 | + | ||
| 583 | + CreateProcurementPlanVo subVo = BeanUtil.copyProperties(entity, CreateProcurementPlanVo.class); | ||
| 584 | + subVo.setCode(subCode); | ||
| 585 | + subVo.setParentId(planId); | ||
| 586 | + subVo.setProcessStatus("COMPLETED"); | ||
| 587 | + subVo.setProcessNode(null); | ||
| 588 | + subVo.setWorkshopId(CollectionUtil.isNotEmpty(wLines) ? wLines.get(0).getWorkshopId() : null); | ||
| 589 | + subVo.setPlanType("变"); | ||
| 590 | + subVo.setPurchaseDeptName(procurementPlanChange.getPurchaseDeptName()); | ||
| 591 | + subVo.setManagementDeptName(procurementPlanChange.getManagementDeptName()); | ||
| 592 | + subVo.setSupplyManagerName(procurementPlanChange.getSupplyManagerName()); | ||
| 593 | + subVo.setMarketingManagerName(procurementPlanChange.getMarketingManagerName()); | ||
| 594 | + subVo.setApprovalPassTime(LocalDateTime.now()); | ||
| 595 | + | ||
| 596 | + List<ProcurementPlanLineVo> subLineVos = new ArrayList<>(); | ||
| 597 | + for (ProcurementPlanChangeLine cl : wLines) { | ||
| 598 | + ProcurementPlanLineVo lv = BeanUtil.copyProperties(cl, ProcurementPlanLineVo.class); | ||
| 599 | + subLineVos.add(lv); | ||
| 600 | + } | ||
| 601 | + subVo.setProcurementPlanLineList(subLineVos); | ||
| 602 | + subVo.setCreateBy(mainPlan.getCreateBy()); | ||
| 603 | + subVo.setCreateById(mainPlan.getCreateById()); | ||
| 604 | + // createSubPlan 内部会保存主表+明细+自动生成买断申请单 | ||
| 605 | + procurementPlanService.createSubPlan(subVo); | ||
| 598 | } | 606 | } |
| 599 | - subVo.setProcurementPlanLineList(subLineVos); | ||
| 600 | - // createSubPlan 内部会保存主表+明细+自动生成买断申请单 | ||
| 601 | - procurementPlanService.createSubPlan(subVo); | ||
| 602 | } | 607 | } |
| 603 | } | 608 | } |
| 604 | 609 | ||
| @@ -611,7 +616,7 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -611,7 +616,7 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 611 | planType = "变 补"; | 616 | planType = "变 补"; |
| 612 | } | 617 | } |
| 613 | procurementPlanService.update(Wrappers.lambdaUpdate(ProcurementPlan.class) | 618 | procurementPlanService.update(Wrappers.lambdaUpdate(ProcurementPlan.class) |
| 614 | - .set(ProcurementPlan::getFrozen, Boolean.TRUE) | 619 | + .set(ProcurementPlan::getFrozen, allWorkshopIds.size() > 1 ? Boolean.TRUE : Boolean.FALSE) |
| 615 | .set(ProcurementPlan::getChangeStatus, "CHANGED") | 620 | .set(ProcurementPlan::getChangeStatus, "CHANGED") |
| 616 | .set(ProcurementPlan::getProcessStatus, "COMPLETED") | 621 | .set(ProcurementPlan::getProcessStatus, "COMPLETED") |
| 617 | .set(ProcurementPlan::getProcessNode, null) | 622 | .set(ProcurementPlan::getProcessNode, null) |
| @@ -794,10 +799,23 @@ public class ProcurementPlanChangeServiceImpl extends | @@ -794,10 +799,23 @@ public class ProcurementPlanChangeServiceImpl extends | ||
| 794 | if (StringUtil.isBlank(lineVo.getItemId())) { | 799 | if (StringUtil.isBlank(lineVo.getItemId())) { |
| 795 | lineVo.setItemId(oldLine.getItemId()); | 800 | lineVo.setItemId(oldLine.getItemId()); |
| 796 | } | 801 | } |
| 797 | - ProcurementPlanChangeLine updateLine = BeanUtil.copyProperties(lineVo, ProcurementPlanChangeLine.class); | ||
| 798 | - updateLine.setId(lineVo.getId()); | ||
| 799 | - updateLine.setProcurementPlanChangeId(finalChangeId); | ||
| 800 | - procurementPlanChangeLineService.updateById(updateLine); | 802 | + log.error("workshopId====" + lineVo.getWorkshopId()); |
| 803 | + LambdaUpdateWrapper<ProcurementPlanChangeLine> updateWrapper = new LambdaUpdateWrapper<>(ProcurementPlanChangeLine.class); | ||
| 804 | + updateWrapper.eq(ProcurementPlanChangeLine::getId, lineVo.getId()) | ||
| 805 | + .set(ProcurementPlanChangeLine::getProcurementPlanChangeId, finalChangeId) | ||
| 806 | + .set(ProcurementPlanChangeLine::getProductId, lineVo.getProductId()) | ||
| 807 | + .set(ProcurementPlanChangeLine::getMaterialType, lineVo.getMaterialType()) | ||
| 808 | + .set(ProcurementPlanChangeLine::getQuantity, lineVo.getQuantity()) | ||
| 809 | + .set(ProcurementPlanChangeLine::getActualPurchasePrice, lineVo.getActualPurchasePrice()) | ||
| 810 | + .set(ProcurementPlanChangeLine::getIncludingShippingPrice, lineVo.getIncludingShippingPrice()) | ||
| 811 | + .set(ProcurementPlanChangeLine::getPriceListPrices, lineVo.getPriceListPrices()) | ||
| 812 | + .set(ProcurementPlanChangeLine::getCoordinationRange, lineVo.getCoordinationRange()) | ||
| 813 | + .set(ProcurementPlanChangeLine::getEstimatedLoss, lineVo.getEstimatedLoss()) | ||
| 814 | + .set(ProcurementPlanChangeLine::getApplicationAttrition, lineVo.getApplicationAttrition()) | ||
| 815 | + .set(ProcurementPlanChangeLine::getPaintDamageRatio, lineVo.getPaintDamageRatio()) | ||
| 816 | + .set(ProcurementPlanChangeLine::getWorkshopId, lineVo.getWorkshopId()) | ||
| 817 | + .set(ProcurementPlanChangeLine::getItemId, lineVo.getItemId()); | ||
| 818 | + procurementPlanChangeLineService.update(updateWrapper); | ||
| 801 | } else { | 819 | } else { |
| 802 | ProcurementPlanChangeLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanChangeLine.class); | 820 | ProcurementPlanChangeLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanChangeLine.class); |
| 803 | createLine.setId(IdUtil.getId()); | 821 | createLine.setId(IdUtil.getId()); |
| @@ -34,7 +34,6 @@ import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanBo; | @@ -34,7 +34,6 @@ import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanBo; | ||
| 34 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | 34 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; |
| 35 | import com.lframework.xingyun.sc.procurement.dto.DomesticReviewerDto; | 35 | import com.lframework.xingyun.sc.procurement.dto.DomesticReviewerDto; |
| 36 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | 36 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; |
| 37 | -import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange; | ||
| 38 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | 37 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; |
| 39 | import com.lframework.xingyun.sc.procurement.mappers.plan.ProcurementPlanMapper; | 38 | import com.lframework.xingyun.sc.procurement.mappers.plan.ProcurementPlanMapper; |
| 40 | import com.lframework.xingyun.sc.procurement.service.buyout.ProcurementBuyoutApplyService; | 39 | import com.lframework.xingyun.sc.procurement.service.buyout.ProcurementBuyoutApplyService; |
| @@ -196,6 +195,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla | @@ -196,6 +195,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla | ||
| 196 | plan.setPurchaseDeptName(reviewer.getProcurementOffice()); | 195 | plan.setPurchaseDeptName(reviewer.getProcurementOffice()); |
| 197 | } | 196 | } |
| 198 | } | 197 | } |
| 198 | + if (StringUtils.isEmpty(plan.getCreateBy())) { | ||
| 199 | + plan.setCreateBy(SecurityUtil.getCurrentUser().getName()); | ||
| 200 | + } | ||
| 201 | + if (StringUtils.isEmpty(plan.getCreateById())) { | ||
| 202 | + plan.setCreateBy(SecurityUtil.getCurrentUser().getId()); | ||
| 203 | + } | ||
| 199 | getBaseMapper().insert(plan); | 204 | getBaseMapper().insert(plan); |
| 200 | 205 | ||
| 201 | if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) { | 206 | if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) { |
| @@ -267,9 +272,22 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla | @@ -267,9 +272,22 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla | ||
| 267 | if (StringUtil.isBlank(lineVo.getItemId())) { | 272 | if (StringUtil.isBlank(lineVo.getItemId())) { |
| 268 | lineVo.setItemId(oldLine.getItemId()); | 273 | lineVo.setItemId(oldLine.getItemId()); |
| 269 | } | 274 | } |
| 270 | - ProcurementPlanLine updateLine = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class); | ||
| 271 | - updateLine.setId(lineVo.getId()); | ||
| 272 | - procurementPlanLineService.updateById(updateLine); | 275 | + LambdaUpdateWrapper<ProcurementPlanLine> updateWrapper = new LambdaUpdateWrapper<>(ProcurementPlanLine.class); |
| 276 | + updateWrapper.eq(ProcurementPlanLine::getId, lineVo.getId()) | ||
| 277 | + .set(ProcurementPlanLine::getProcurementPlanId, lineVo.getProcurementPlanId()) | ||
| 278 | + .set(ProcurementPlanLine::getProductId, lineVo.getProductId()) | ||
| 279 | + .set(ProcurementPlanLine::getMaterialType, lineVo.getMaterialType()) | ||
| 280 | + .set(ProcurementPlanLine::getQuantity, lineVo.getQuantity()) | ||
| 281 | + .set(ProcurementPlanLine::getActualPurchasePrice, lineVo.getActualPurchasePrice()) | ||
| 282 | + .set(ProcurementPlanLine::getIncludingShippingPrice, lineVo.getIncludingShippingPrice()) | ||
| 283 | + .set(ProcurementPlanLine::getPriceListPrices, lineVo.getPriceListPrices()) | ||
| 284 | + .set(ProcurementPlanLine::getCoordinationRange, lineVo.getCoordinationRange()) | ||
| 285 | + .set(ProcurementPlanLine::getEstimatedLoss, lineVo.getEstimatedLoss()) | ||
| 286 | + .set(ProcurementPlanLine::getApplicationAttrition, lineVo.getApplicationAttrition()) | ||
| 287 | + .set(ProcurementPlanLine::getPaintDamageRatio, lineVo.getPaintDamageRatio()) | ||
| 288 | + .set(ProcurementPlanLine::getWorkshopId, lineVo.getWorkshopId()) | ||
| 289 | + .set(ProcurementPlanLine::getItemId, lineVo.getItemId()); | ||
| 290 | + procurementPlanLineService.update(updateWrapper); | ||
| 273 | } else { | 291 | } else { |
| 274 | ProcurementPlanLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class); | 292 | ProcurementPlanLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class); |
| 275 | createLine.setId(IdUtil.getId()); | 293 | createLine.setId(IdUtil.getId()); |
| @@ -424,7 +442,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla | @@ -424,7 +442,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla | ||
| 424 | subLineVoList.add(lineVo); | 442 | subLineVoList.add(lineVo); |
| 425 | } | 443 | } |
| 426 | subVo.setProcurementPlanLineList(subLineVoList); | 444 | subVo.setProcurementPlanLineList(subLineVoList); |
| 427 | - | 445 | + subVo.setCreateBy(mainPlan.getCreateBy()); |
| 446 | + subVo.setCreateById(mainPlan.getCreateById()); | ||
| 428 | // 子计划创建(不重新生成编号,因为使用父code+后缀) | 447 | // 子计划创建(不重新生成编号,因为使用父code+后缀) |
| 429 | createSubPlan(subVo); | 448 | createSubPlan(subVo); |
| 430 | } | 449 | } |
| @@ -674,7 +693,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla | @@ -674,7 +693,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla | ||
| 674 | } | 693 | } |
| 675 | } | 694 | } |
| 676 | plan.setTotalQuantity(totalQuantity); | 695 | plan.setTotalQuantity(totalQuantity); |
| 677 | - | 696 | + if (StringUtils.isEmpty(plan.getCreateBy())) { |
| 697 | + plan.setCreateBy(SecurityUtil.getCurrentUser().getName()); | ||
| 698 | + } | ||
| 699 | + if (StringUtils.isEmpty(plan.getCreateById())) { | ||
| 700 | + plan.setCreateBy(SecurityUtil.getCurrentUser().getId()); | ||
| 701 | + } | ||
| 678 | getBaseMapper().insert(plan); | 702 | getBaseMapper().insert(plan); |
| 679 | 703 | ||
| 680 | if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) { | 704 | if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) { |
| @@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; | @@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||
| 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 7 | import com.github.pagehelper.PageInfo; | 7 | import com.github.pagehelper.PageInfo; |
| 8 | +import com.lframework.starter.bpm.dto.FlowTaskDto; | ||
| 9 | +import com.lframework.starter.bpm.entity.FlowInstanceWrapper; | ||
| 10 | +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper; | ||
| 8 | import com.lframework.starter.bpm.service.FlowInstanceWrapperService; | 11 | import com.lframework.starter.bpm.service.FlowInstanceWrapperService; |
| 12 | +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; | ||
| 9 | import com.lframework.starter.common.exceptions.impl.DefaultClientException; | 13 | import com.lframework.starter.common.exceptions.impl.DefaultClientException; |
| 10 | import com.lframework.starter.common.exceptions.impl.InputErrorException; | 14 | import com.lframework.starter.common.exceptions.impl.InputErrorException; |
| 11 | import com.lframework.starter.common.utils.Assert; | 15 | import com.lframework.starter.common.utils.Assert; |
| @@ -27,6 +31,8 @@ import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanReplenishBo; | @@ -27,6 +31,8 @@ import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanReplenishBo; | ||
| 27 | import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanReplenishLineBo; | 31 | import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanReplenishLineBo; |
| 28 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; | 32 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; |
| 29 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | 33 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; |
| 34 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange; | ||
| 35 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine; | ||
| 30 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | 36 | import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; |
| 31 | import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish; | 37 | import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish; |
| 32 | import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenishLine; | 38 | import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenishLine; |
| @@ -49,6 +55,8 @@ import java.time.LocalDateTime; | @@ -49,6 +55,8 @@ import java.time.LocalDateTime; | ||
| 49 | import java.util.*; | 55 | import java.util.*; |
| 50 | import java.util.stream.Collectors; | 56 | import java.util.stream.Collectors; |
| 51 | import javax.annotation.Resource; | 57 | import javax.annotation.Resource; |
| 58 | + | ||
| 59 | +import org.apache.commons.lang3.StringUtils; | ||
| 52 | import org.springframework.stereotype.Service; | 60 | import org.springframework.stereotype.Service; |
| 53 | import org.springframework.transaction.annotation.Transactional; | 61 | import org.springframework.transaction.annotation.Transactional; |
| 54 | 62 | ||
| @@ -79,6 +87,8 @@ public class ProcurementPlanReplenishServiceImpl | @@ -79,6 +87,8 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 79 | private WorkshopService workshopService; | 87 | private WorkshopService workshopService; |
| 80 | @Resource | 88 | @Resource |
| 81 | private ProcurementBuyoutApplyService procurementBuyoutApplyService; | 89 | private ProcurementBuyoutApplyService procurementBuyoutApplyService; |
| 90 | + @Resource | ||
| 91 | + private FlowTaskWrapperMapper flowTaskWrapperMapper; | ||
| 82 | 92 | ||
| 83 | 93 | ||
| 84 | @Override | 94 | @Override |
| @@ -403,7 +413,7 @@ public class ProcurementPlanReplenishServiceImpl | @@ -403,7 +413,7 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 403 | archivedMain.setCode(entity.getCode()); | 413 | archivedMain.setCode(entity.getCode()); |
| 404 | archivedMain.setDeleted(Boolean.FALSE); | 414 | archivedMain.setDeleted(Boolean.FALSE); |
| 405 | archivedMain.setProcessNode(null); | 415 | archivedMain.setProcessNode(null); |
| 406 | - archivedMain.setProcessStatus(null); | 416 | + archivedMain.setProcessStatus("COMPLETED"); |
| 407 | archivedMain.setApprovalStatus(null); | 417 | archivedMain.setApprovalStatus(null); |
| 408 | if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() > 1) { | 418 | if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() > 1) { |
| 409 | archivedMain.setFrozen(Boolean.TRUE); | 419 | archivedMain.setFrozen(Boolean.TRUE); |
| @@ -422,12 +432,6 @@ public class ProcurementPlanReplenishServiceImpl | @@ -422,12 +432,6 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 422 | archivedMain.setApprovalPassTime(LocalDateTime.now()); | 432 | archivedMain.setApprovalPassTime(LocalDateTime.now()); |
| 423 | procurementPlanService.save(archivedMain); | 433 | procurementPlanService.save(archivedMain); |
| 424 | 434 | ||
| 425 | - //生成买断操作申请单 | ||
| 426 | - if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() == 1) { | ||
| 427 | - CreateProcurementBuyoutApplyVo vo = new CreateProcurementBuyoutApplyVo(); | ||
| 428 | - vo.setProcurementPlanId(archivedMain.getId()); | ||
| 429 | - procurementBuyoutApplyService.create(vo); | ||
| 430 | - } | ||
| 431 | // 主计划子表也复制一份 | 435 | // 主计划子表也复制一份 |
| 432 | List<ProcurementPlanLine> archivedMainLines = new ArrayList<>(); | 436 | List<ProcurementPlanLine> archivedMainLines = new ArrayList<>(); |
| 433 | if (CollectionUtil.isNotEmpty(mainLines)) { | 437 | if (CollectionUtil.isNotEmpty(mainLines)) { |
| @@ -439,6 +443,14 @@ public class ProcurementPlanReplenishServiceImpl | @@ -439,6 +443,14 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 439 | } | 443 | } |
| 440 | procurementPlanLineService.saveBatch(archivedMainLines); | 444 | procurementPlanLineService.saveBatch(archivedMainLines); |
| 441 | } | 445 | } |
| 446 | + | ||
| 447 | + //生成买断操作申请单 | ||
| 448 | + if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() == 1) { | ||
| 449 | + CreateProcurementBuyoutApplyVo vo = new CreateProcurementBuyoutApplyVo(); | ||
| 450 | + vo.setProcurementPlanId(archivedMain.getId()); | ||
| 451 | + procurementBuyoutApplyService.create(vo); | ||
| 452 | + } | ||
| 453 | + | ||
| 442 | //拆分了分厂 | 454 | //拆分了分厂 |
| 443 | if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() > 1) { | 455 | if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() > 1) { |
| 444 | Map<String, String> deptId2CodeMap = new HashMap<>(); | 456 | Map<String, String> deptId2CodeMap = new HashMap<>(); |
| @@ -482,7 +494,7 @@ public class ProcurementPlanReplenishServiceImpl | @@ -482,7 +494,7 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 482 | CreateProcurementPlanVo subVo = BeanUtil.copyProperties(archivedMain, CreateProcurementPlanVo.class); | 494 | CreateProcurementPlanVo subVo = BeanUtil.copyProperties(archivedMain, CreateProcurementPlanVo.class); |
| 483 | subVo.setCode(subCode); | 495 | subVo.setCode(subCode); |
| 484 | subVo.setParentId(archivedMain.getId()); | 496 | subVo.setParentId(archivedMain.getId()); |
| 485 | - subVo.setProcessStatus(null); | 497 | + subVo.setProcessStatus("COMPLETED"); |
| 486 | subVo.setProcessNode(null); | 498 | subVo.setProcessNode(null); |
| 487 | subVo.setApprovalStatus(null); | 499 | subVo.setApprovalStatus(null); |
| 488 | subVo.setFrozen(Boolean.FALSE); | 500 | subVo.setFrozen(Boolean.FALSE); |
| @@ -503,6 +515,8 @@ public class ProcurementPlanReplenishServiceImpl | @@ -503,6 +515,8 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 503 | subLineVoList.add(lineVo); | 515 | subLineVoList.add(lineVo); |
| 504 | } | 516 | } |
| 505 | subVo.setProcurementPlanLineList(subLineVoList); | 517 | subVo.setProcurementPlanLineList(subLineVoList); |
| 518 | + subVo.setCreateBy(entity.getCreateBy()); | ||
| 519 | + subVo.setCreateById(entity.getCreateById()); | ||
| 506 | // 子计划创建(不重新生成编号,因为使用父code+后缀) | 520 | // 子计划创建(不重新生成编号,因为使用父code+后缀) |
| 507 | procurementPlanService.createSubPlan(subVo); | 521 | procurementPlanService.createSubPlan(subVo); |
| 508 | } | 522 | } |
| @@ -555,20 +569,20 @@ public class ProcurementPlanReplenishServiceImpl | @@ -555,20 +569,20 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 555 | Object bizIdObj = map.get("bizId"); | 569 | Object bizIdObj = map.get("bizId"); |
| 556 | String bizId = bizIdObj == null ? null : String.valueOf(bizIdObj); | 570 | String bizId = bizIdObj == null ? null : String.valueOf(bizIdObj); |
| 557 | 571 | ||
| 572 | + // 将 Map 转换为 Vo,尝试获取 ID | ||
| 573 | + String json = JsonUtil.toJsonString(map); | ||
| 574 | + UpdateProcurementPlanReplenishVo vo = JsonUtil.parseObject(json, UpdateProcurementPlanReplenishVo.class); | ||
| 558 | if (StringUtil.isBlank(bizId)) { | 575 | if (StringUtil.isBlank(bizId)) { |
| 559 | - // 将 Map 转换为 Vo,尝试获取 ID | ||
| 560 | - String json = JsonUtil.toJsonString(map); | ||
| 561 | - UpdateProcurementPlanReplenishVo vo = JsonUtil.parseObject(json, UpdateProcurementPlanReplenishVo.class); | ||
| 562 | - bizId = vo == null ? null : vo.getId(); | ||
| 563 | - if (vo != null && StringUtil.isNotBlank(vo.getId())) { | ||
| 564 | - // 更新主表字段 | ||
| 565 | - ProcurementPlanReplenish replenish = new ProcurementPlanReplenish(); | ||
| 566 | - BeanUtil.copyProperties(vo, replenish); | ||
| 567 | - this.updateById(replenish); | ||
| 568 | - | ||
| 569 | - // 保存或更新明细 | ||
| 570 | - saveOrUpdateLines(vo.getId(), vo.getProcurementPlanReplenishLineList()); | ||
| 571 | - } | 576 | + bizId = vo.getId(); |
| 577 | + } | ||
| 578 | + if (vo != null && StringUtil.isNotBlank(vo.getId())) { | ||
| 579 | + // 更新主表字段 | ||
| 580 | + ProcurementPlanReplenish replenish = new ProcurementPlanReplenish(); | ||
| 581 | + BeanUtil.copyProperties(vo, replenish); | ||
| 582 | + this.updateById(replenish); | ||
| 583 | + | ||
| 584 | + // 保存或更新明细 | ||
| 585 | + saveOrUpdateLines(vo.getId(), vo.getProcurementPlanReplenishLineList()); | ||
| 572 | } | 586 | } |
| 573 | 587 | ||
| 574 | if ("PASS".equals(examStatus)) { | 588 | if ("PASS".equals(examStatus)) { |
| @@ -617,7 +631,7 @@ public class ProcurementPlanReplenishServiceImpl | @@ -617,7 +631,7 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 617 | * @param lineList 明细列表 | 631 | * @param lineList 明细列表 |
| 618 | */ | 632 | */ |
| 619 | private void saveOrUpdateLines(String replenishId, | 633 | private void saveOrUpdateLines(String replenishId, |
| 620 | - List<? extends CreateProcurementPlanReplenishLineVo> lineList) { | 634 | + List<? extends UpdateProcurementPlanReplenishLineVo> lineList) { |
| 621 | // 查询旧明细 | 635 | // 查询旧明细 |
| 622 | List<ProcurementPlanReplenishLine> oldLineList = | 636 | List<ProcurementPlanReplenishLine> oldLineList = |
| 623 | procurementPlanReplenishLineService.getByProcurementPlanReplenishId(replenishId); | 637 | procurementPlanReplenishLineService.getByProcurementPlanReplenishId(replenishId); |
| @@ -628,24 +642,34 @@ public class ProcurementPlanReplenishServiceImpl | @@ -628,24 +642,34 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 628 | 642 | ||
| 629 | List<String> existIdList = new ArrayList<>(); | 643 | List<String> existIdList = new ArrayList<>(); |
| 630 | if (!CollectionUtil.isEmpty(lineList)) { | 644 | if (!CollectionUtil.isEmpty(lineList)) { |
| 631 | - for (CreateProcurementPlanReplenishLineVo lineVo : lineList) { | ||
| 632 | - UpdateProcurementPlanReplenishLineVo updateLineVo = (UpdateProcurementPlanReplenishLineVo) lineVo; | ||
| 633 | - if (StringUtil.isNotBlank(updateLineVo.getId())) { | 645 | + for (UpdateProcurementPlanReplenishLineVo lineVo : lineList) { |
| 646 | + if (StringUtil.isNotBlank(lineVo.getId())) { | ||
| 634 | // 更新已有明细 | 647 | // 更新已有明细 |
| 635 | - ProcurementPlanReplenishLine oldLine = oldLineMap.get(updateLineVo.getId()); | 648 | + ProcurementPlanReplenishLine oldLine = oldLineMap.get(lineVo.getId()); |
| 636 | if (oldLine == null) { | 649 | if (oldLine == null) { |
| 637 | throw new DefaultClientException("采购计划补单明细不存在或不属于当前补单!"); | 650 | throw new DefaultClientException("采购计划补单明细不存在或不属于当前补单!"); |
| 638 | } | 651 | } |
| 639 | 652 | ||
| 640 | - existIdList.add(updateLineVo.getId()); | ||
| 641 | - updateLineVo.setProcurementPlanReplenishId(replenishId); | ||
| 642 | - if (StringUtil.isBlank(updateLineVo.getItemId())) { | ||
| 643 | - updateLineVo.setItemId(oldLine.getItemId()); | 653 | + existIdList.add(lineVo.getId()); |
| 654 | + if (StringUtil.isBlank(lineVo.getItemId())) { | ||
| 655 | + lineVo.setItemId(oldLine.getItemId()); | ||
| 644 | } | 656 | } |
| 645 | - ProcurementPlanReplenishLine updateLine = | ||
| 646 | - BeanUtil.copyProperties(updateLineVo, ProcurementPlanReplenishLine.class); | ||
| 647 | - updateLine.setId(updateLineVo.getId()); | ||
| 648 | - procurementPlanReplenishLineService.updateById(updateLine); | 657 | + LambdaUpdateWrapper<ProcurementPlanReplenishLine> updateWrapper = new LambdaUpdateWrapper<>(ProcurementPlanReplenishLine.class); |
| 658 | + updateWrapper.eq(ProcurementPlanReplenishLine::getId, lineVo.getId()) | ||
| 659 | + .set(ProcurementPlanReplenishLine::getProcurementPlanReplenishId, replenishId) | ||
| 660 | + .set(ProcurementPlanReplenishLine::getProductId, lineVo.getProductId()) | ||
| 661 | + .set(ProcurementPlanReplenishLine::getMaterialType, lineVo.getMaterialType()) | ||
| 662 | + .set(ProcurementPlanReplenishLine::getQuantity, lineVo.getQuantity()) | ||
| 663 | + .set(ProcurementPlanReplenishLine::getActualPurchasePrice, lineVo.getActualPurchasePrice()) | ||
| 664 | + .set(ProcurementPlanReplenishLine::getIncludingShippingPrice, lineVo.getIncludingShippingPrice()) | ||
| 665 | + .set(ProcurementPlanReplenishLine::getPriceListPrices, lineVo.getPriceListPrices()) | ||
| 666 | + .set(ProcurementPlanReplenishLine::getCoordinationRange, lineVo.getCoordinationRange()) | ||
| 667 | + .set(ProcurementPlanReplenishLine::getEstimatedLoss, lineVo.getEstimatedLoss()) | ||
| 668 | + .set(ProcurementPlanReplenishLine::getApplicationAttrition, lineVo.getApplicationAttrition()) | ||
| 669 | + .set(ProcurementPlanReplenishLine::getPaintDamageRatio, lineVo.getPaintDamageRatio()) | ||
| 670 | + .set(ProcurementPlanReplenishLine::getWorkshopId, lineVo.getWorkshopId()) | ||
| 671 | + .set(ProcurementPlanReplenishLine::getItemId, lineVo.getItemId()); | ||
| 672 | + procurementPlanReplenishLineService.update(updateWrapper); | ||
| 649 | } else { | 673 | } else { |
| 650 | // 新增明细 | 674 | // 新增明细 |
| 651 | ProcurementPlanReplenishLine createLine = | 675 | ProcurementPlanReplenishLine createLine = |
| @@ -687,31 +711,24 @@ public class ProcurementPlanReplenishServiceImpl | @@ -687,31 +711,24 @@ public class ProcurementPlanReplenishServiceImpl | ||
| 687 | return; | 711 | return; |
| 688 | } | 712 | } |
| 689 | 713 | ||
| 690 | - List<String> businessIds = validDatas.stream() | ||
| 691 | - .map(ProcurementPlanReplenish::getId) | ||
| 692 | - .collect(Collectors.toList()); | ||
| 693 | - | ||
| 694 | // 查询已发起的流程 | 714 | // 查询已发起的流程 |
| 695 | - List<?> flowByConditionList = | ||
| 696 | - flowInstanceWrapperService.getFlowByBusinessIdList(businessIds); | ||
| 697 | - Set<String> flowBusinessIdSet = CollectionUtil.isNotEmpty(flowByConditionList) | ||
| 698 | - ? flowByConditionList.stream() | ||
| 699 | - .map(obj -> { | ||
| 700 | - try { | ||
| 701 | - return BeanUtil.getProperty(obj, "businessId"); | ||
| 702 | - } catch (Exception e) { | ||
| 703 | - return null; | ||
| 704 | - } | ||
| 705 | - }) | ||
| 706 | - .filter(Objects::nonNull) | ||
| 707 | - .map(String::valueOf) | ||
| 708 | - .collect(Collectors.toSet()) | ||
| 709 | - : new HashSet<>(); | 715 | + List<String> businessIds = validDatas.stream().map(ProcurementPlanReplenish::getId).collect(Collectors.toList()); |
| 716 | + List<FlowInstanceWrapper> flowList = flowInstanceWrapperService.getFlowByBusinessIdList(businessIds); | ||
| 717 | + Set<String> flowBusinessIdSet = CollectionUtil.isNotEmpty(flowList) | ||
| 718 | + ? flowList.stream().map(FlowInstanceWrapper::getBusinessId).collect(Collectors.toSet()) | ||
| 719 | + : new HashSet<>(); | ||
| 720 | + | ||
| 721 | + List<FlowTaskDto> todoFlowTaskList = flowTaskWrapperMapper.queryTodoList( | ||
| 722 | + new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId()); | ||
| 723 | + Set<String> todoBusinessIdSet = CollectionUtil.isNotEmpty(todoFlowTaskList) | ||
| 724 | + ? todoFlowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toSet()) | ||
| 725 | + : new HashSet<>(); | ||
| 710 | 726 | ||
| 711 | for (ProcurementPlanReplenish replenish : validDatas) { | 727 | for (ProcurementPlanReplenish replenish : validDatas) { |
| 712 | boolean hasFlow = flowBusinessIdSet.contains(replenish.getId()); | 728 | boolean hasFlow = flowBusinessIdSet.contains(replenish.getId()); |
| 713 | - replenish.setShowExamineDetail(hasFlow && StringUtil.isNotBlank(replenish.getApprovalStatus())); | ||
| 714 | - replenish.setShowExamine(hasFlow && CustomerDevelopStatus.AUDIT.name().equals(replenish.getApprovalStatus())); | 729 | + boolean hasTodo = todoBusinessIdSet.contains(replenish.getId()); |
| 730 | + replenish.setShowExamineDetail(hasFlow && StringUtils.isNotBlank(replenish.getApprovalStatus())); | ||
| 731 | + replenish.setShowExamine(hasTodo && CustomerDevelopStatus.AUDIT.name().equals(replenish.getApprovalStatus())); | ||
| 715 | } | 732 | } |
| 716 | } | 733 | } |
| 717 | } | 734 | } |
| @@ -12,13 +12,12 @@ import com.lframework.starter.web.core.utils.PageHelperUtil; | @@ -12,13 +12,12 @@ import com.lframework.starter.web.core.utils.PageHelperUtil; | ||
| 12 | import com.lframework.starter.web.core.utils.PageResultUtil; | 12 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| 13 | import com.lframework.xingyun.sc.bo.procurement.GetDomesticPlanSummaryBo; | 13 | import com.lframework.xingyun.sc.bo.procurement.GetDomesticPlanSummaryBo; |
| 14 | import com.lframework.xingyun.sc.bo.procurement.GetDomesticPlanSummaryDetailBo; | 14 | import com.lframework.xingyun.sc.bo.procurement.GetDomesticPlanSummaryDetailBo; |
| 15 | -import com.lframework.xingyun.sc.procurement.entity.ProcurementBuyoutApply; | ||
| 16 | -import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish; | 15 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; |
| 17 | import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummary; | 16 | import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummary; |
| 18 | import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummaryDetail; | 17 | import com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummaryDetail; |
| 19 | import com.lframework.xingyun.sc.procurement.mappers.summary.DomesticPlanSummaryDetailMapper; | 18 | import com.lframework.xingyun.sc.procurement.mappers.summary.DomesticPlanSummaryDetailMapper; |
| 20 | import com.lframework.xingyun.sc.procurement.mappers.summary.DomesticPlanSummaryMapper; | 19 | import com.lframework.xingyun.sc.procurement.mappers.summary.DomesticPlanSummaryMapper; |
| 21 | -import com.lframework.xingyun.sc.procurement.service.buyout.ProcurementBuyoutApplyService; | 20 | +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; |
| 22 | import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService; | 21 | import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService; |
| 23 | import com.lframework.xingyun.sc.procurement.service.summary.DomesticPlanSummaryDetailService; | 22 | import com.lframework.xingyun.sc.procurement.service.summary.DomesticPlanSummaryDetailService; |
| 24 | import com.lframework.xingyun.sc.procurement.service.summary.DomesticPlanSummaryService; | 23 | import com.lframework.xingyun.sc.procurement.service.summary.DomesticPlanSummaryService; |
| @@ -34,6 +33,7 @@ import java.util.List; | @@ -34,6 +33,7 @@ import java.util.List; | ||
| 34 | import java.util.Map; | 33 | import java.util.Map; |
| 35 | import java.util.Objects; | 34 | import java.util.Objects; |
| 36 | import java.util.Set; | 35 | import java.util.Set; |
| 36 | +import java.util.function.Function; | ||
| 37 | import java.util.stream.Collectors; | 37 | import java.util.stream.Collectors; |
| 38 | import javax.annotation.Resource; | 38 | import javax.annotation.Resource; |
| 39 | import org.springframework.stereotype.Service; | 39 | import org.springframework.stereotype.Service; |
| @@ -51,9 +51,7 @@ public class DomesticPlanSummaryServiceImpl extends | @@ -51,9 +51,7 @@ public class DomesticPlanSummaryServiceImpl extends | ||
| 51 | @Resource | 51 | @Resource |
| 52 | private DomesticPlanSummaryDetailService domesticPlanSummaryDetailService; | 52 | private DomesticPlanSummaryDetailService domesticPlanSummaryDetailService; |
| 53 | @Resource | 53 | @Resource |
| 54 | - private ProcurementBuyoutApplyService procurementBuyoutApplyService; | ||
| 55 | - @Resource | ||
| 56 | - private ProcurementPlanReplenishService procurementPlanReplenishService; | 54 | + private ProcurementPlanService procurementPlanService; |
| 57 | 55 | ||
| 58 | @Override | 56 | @Override |
| 59 | public PageResult<DomesticPlanSummary> query(Integer pageIndex, Integer pageSize, | 57 | public PageResult<DomesticPlanSummary> query(Integer pageIndex, Integer pageSize, |
| @@ -138,27 +136,14 @@ public class DomesticPlanSummaryServiceImpl extends | @@ -138,27 +136,14 @@ public class DomesticPlanSummaryServiceImpl extends | ||
| 138 | .filter(Objects::nonNull) | 136 | .filter(Objects::nonNull) |
| 139 | .collect(Collectors.toSet()); | 137 | .collect(Collectors.toSet()); |
| 140 | 138 | ||
| 141 | - Set<String> buyoutPlanIds = Collections.emptySet(); | 139 | + Map<String, ProcurementPlan> procurementPlanMap = Collections.emptyMap(); |
| 142 | if (CollectionUtil.isNotEmpty(planIds)) { | 140 | if (CollectionUtil.isNotEmpty(planIds)) { |
| 143 | - buyoutPlanIds = procurementBuyoutApplyService.list( | ||
| 144 | - Wrappers.lambdaQuery(ProcurementBuyoutApply.class) | ||
| 145 | - .in(ProcurementBuyoutApply::getProcurementPlanId, planIds) | ||
| 146 | - .select(ProcurementBuyoutApply::getProcurementPlanId)) | ||
| 147 | - .stream() | ||
| 148 | - .map(ProcurementBuyoutApply::getProcurementPlanId) | ||
| 149 | - .collect(Collectors.toSet()); | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - Set<String> replenishPlanIds = Collections.emptySet(); | ||
| 153 | - if (CollectionUtil.isNotEmpty(planIds)) { | ||
| 154 | - replenishPlanIds = procurementPlanReplenishService.list( | ||
| 155 | - Wrappers.lambdaQuery(ProcurementPlanReplenish.class) | ||
| 156 | - .in(ProcurementPlanReplenish::getProcurementPlanId, planIds) | ||
| 157 | - .eq(ProcurementPlanReplenish::getApprovalStatus, "PASS") | ||
| 158 | - .select(ProcurementPlanReplenish::getProcurementPlanId)) | ||
| 159 | - .stream() | ||
| 160 | - .map(ProcurementPlanReplenish::getProcurementPlanId) | ||
| 161 | - .collect(Collectors.toSet()); | 141 | + procurementPlanMap = procurementPlanService.list( |
| 142 | + Wrappers.lambdaQuery(ProcurementPlan.class) | ||
| 143 | + .in(ProcurementPlan::getId, planIds)) | ||
| 144 | + .stream() | ||
| 145 | + // 以 ID 为 Key,ProcurementPlan 对象为 Value 收集到 Map 中 | ||
| 146 | + .collect(Collectors.toMap(ProcurementPlan::getId, Function.identity())); | ||
| 162 | } | 147 | } |
| 163 | 148 | ||
| 164 | DomesticPlanSummary summary = new DomesticPlanSummary(); | 149 | DomesticPlanSummary summary = new DomesticPlanSummary(); |
| @@ -222,14 +207,18 @@ public class DomesticPlanSummaryServiceImpl extends | @@ -222,14 +207,18 @@ public class DomesticPlanSummaryServiceImpl extends | ||
| 222 | d.setUpdateById("1"); | 207 | d.setUpdateById("1"); |
| 223 | d.setUpdateBy("系统管理员"); | 208 | d.setUpdateBy("系统管理员"); |
| 224 | 209 | ||
| 225 | - boolean hasBuyout = buyoutPlanIds.contains(d.getPlanId()); | ||
| 226 | - boolean hasReplenish = replenishPlanIds.contains(d.getPlanId()); | ||
| 227 | - if (hasBuyout && hasReplenish) { | ||
| 228 | - d.setRemarkFlag("买断 补单"); | ||
| 229 | - } else if (hasBuyout) { | ||
| 230 | - d.setRemarkFlag("买断"); | ||
| 231 | - } else if (hasReplenish) { | ||
| 232 | - d.setRemarkFlag("补单"); | 210 | + ProcurementPlan plan = procurementPlanMap.get(d.getPlanId()); |
| 211 | + if (plan != null) { | ||
| 212 | + if ((plan.getCommodityBuyout() || plan.getQuantityBuyout() || plan.getQualityBuyout()) | ||
| 213 | + && plan.getPlanType() != null && plan.getPlanType().contains("补")) { | ||
| 214 | + d.setRemarkFlag("买断 补单"); | ||
| 215 | + } else if (plan.getCommodityBuyout() || plan.getQuantityBuyout() || plan.getQualityBuyout()) { | ||
| 216 | + d.setRemarkFlag("买断"); | ||
| 217 | + } else if (plan.getPlanType() != null && plan.getPlanType().contains("补")) { | ||
| 218 | + d.setRemarkFlag("补单"); | ||
| 219 | + } else { | ||
| 220 | + d.setRemarkFlag(null); | ||
| 221 | + } | ||
| 233 | } else { | 222 | } else { |
| 234 | d.setRemarkFlag(null); | 223 | d.setRemarkFlag(null); |
| 235 | } | 224 | } |
| 1 | package com.lframework.xingyun.sc.procurement.vo.plan; | 1 | package com.lframework.xingyun.sc.procurement.vo.plan; |
| 2 | 2 | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 3 | import com.fasterxml.jackson.annotation.JsonFormat; | 5 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | import com.lframework.starter.common.constants.StringPool; | 6 | import com.lframework.starter.common.constants.StringPool; |
| 5 | import com.lframework.starter.common.exceptions.impl.InputErrorException; | 7 | import com.lframework.starter.common.exceptions.impl.InputErrorException; |
| @@ -370,6 +372,12 @@ public class CreateProcurementPlanVo implements BaseVo, Serializable { | @@ -370,6 +372,12 @@ public class CreateProcurementPlanVo implements BaseVo, Serializable { | ||
| 370 | @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | 372 | @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) |
| 371 | private LocalDateTime approvalPassTime; | 373 | private LocalDateTime approvalPassTime; |
| 372 | 374 | ||
| 375 | + @ApiModelProperty("创建人ID") | ||
| 376 | + private String createById; | ||
| 377 | + | ||
| 378 | + @ApiModelProperty("创建人") | ||
| 379 | + private String createBy; | ||
| 380 | + | ||
| 373 | /** | 381 | /** |
| 374 | * 明细信息 | 382 | * 明细信息 |
| 375 | */ | 383 | */ |
| @@ -13,6 +13,7 @@ import javax.validation.constraints.NotBlank; | @@ -13,6 +13,7 @@ import javax.validation.constraints.NotBlank; | ||
| 13 | import javax.validation.constraints.NotEmpty; | 13 | import javax.validation.constraints.NotEmpty; |
| 14 | import javax.validation.constraints.NotNull; | 14 | import javax.validation.constraints.NotNull; |
| 15 | import lombok.Data; | 15 | import lombok.Data; |
| 16 | +import org.apache.ibatis.annotations.Update; | ||
| 16 | import org.hibernate.validator.constraints.Length; | 17 | import org.hibernate.validator.constraints.Length; |
| 17 | 18 | ||
| 18 | @Data | 19 | @Data |
| @@ -179,7 +180,7 @@ public class CreateProcurementPlanReplenishVo implements BaseVo, Serializable { | @@ -179,7 +180,7 @@ public class CreateProcurementPlanReplenishVo implements BaseVo, Serializable { | ||
| 179 | @ApiModelProperty(value = "明细信息", required = true) | 180 | @ApiModelProperty(value = "明细信息", required = true) |
| 180 | @Valid | 181 | @Valid |
| 181 | @NotEmpty(message = "明细不能为空!") | 182 | @NotEmpty(message = "明细不能为空!") |
| 182 | - private List<CreateProcurementPlanReplenishLineVo> procurementPlanReplenishLineList; | 183 | + private List<UpdateProcurementPlanReplenishLineVo> procurementPlanReplenishLineList; |
| 183 | 184 | ||
| 184 | public void validate() { | 185 | public void validate() { |
| 185 | } | 186 | } |
| @@ -273,6 +273,7 @@ | @@ -273,6 +273,7 @@ | ||
| 273 | </when> | 273 | </when> |
| 274 | <when test="vo.queryType == 'REPLENISHMENT'"> | 274 | <when test="vo.queryType == 'REPLENISHMENT'"> |
| 275 | AND pp.process_status IN ('COMPLETED', 'ABORTED') | 275 | AND pp.process_status IN ('COMPLETED', 'ABORTED') |
| 276 | + AND pp.plan_type NOT LIKE '%补%' | ||
| 276 | AND (pp.replenishment_status = '' OR pp.replenishment_status IS NULL OR pp.replenishment_status | 277 | AND (pp.replenishment_status = '' OR pp.replenishment_status IS NULL OR pp.replenishment_status |
| 277 | = 'REPLENISHED') | 278 | = 'REPLENISHED') |
| 278 | AND (pp.change_status = '' OR pp.change_status IS NULL OR pp.change_status = 'CHANGED') | 279 | AND (pp.change_status = '' OR pp.change_status IS NULL OR pp.change_status = 'CHANGED') |