Commit 25c2f10ad0ade998657caffeccf4b881ee2feed3

Authored by 房远帅
1 parent ebc47a90

采购报价、计划、合同:开票品名功能变更

Showing 21 changed files with 372 additions and 47 deletions
@@ -1756,6 +1756,7 @@ CREATE TABLE `procurement_salesman_quotation_line` @@ -1756,6 +1756,7 @@ CREATE TABLE `procurement_salesman_quotation_line`
1756 `estimated_loss` decimal(18, 10) DEFAULT NULL COMMENT '买断料预计损耗', 1756 `estimated_loss` decimal(18, 10) DEFAULT NULL COMMENT '买断料预计损耗',
1757 `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)', 1757 `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',
1758 `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)', 1758 `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',
  1759 + `invoice_product_name` varchar(200) NOT NULL COMMENT '开票品名',
1759 `item_id` varchar(32) NOT NULL COMMENT '前端行标识', 1760 `item_id` varchar(32) NOT NULL COMMENT '前端行标识',
1760 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', 1761 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
1761 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', 1762 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
@@ -1964,26 +1965,29 @@ CREATE TABLE `procurement_plan` @@ -1964,26 +1965,29 @@ CREATE TABLE `procurement_plan`
1964 1965
1965 CREATE TABLE `procurement_plan_line` 1966 CREATE TABLE `procurement_plan_line`
1966 ( 1967 (
1967 - `id` varchar(32) NOT NULL COMMENT 'ID',  
1968 - `procurement_plan_id` varchar(32) NOT NULL COMMENT '采购计划ID',  
1969 - `product_id` varchar(32) NOT NULL COMMENT '品种ID',  
1970 - `material_type` varchar(200) DEFAULT NULL COMMENT '料型',  
1971 - `quantity` decimal(18, 5) NOT NULL COMMENT '数量',  
1972 - `actual_purchase_price` decimal(18, 10) DEFAULT NULL COMMENT '实际采购价',  
1973 - `including_shipping_price` decimal(18, 10) DEFAULT NULL COMMENT '含运到厂价',  
1974 - `price_list_prices` decimal(18, 10) DEFAULT NULL COMMENT '价格表价格',  
1975 - `coordination_range` decimal(18, 10) DEFAULT NULL COMMENT '协调幅度',  
1976 - `estimated_loss` decimal(18, 10) DEFAULT NULL COMMENT '买断料预计损耗',  
1977 - `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',  
1978 - `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',  
1979 - `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂',  
1980 - `item_id` varchar(32) NOT NULL COMMENT '前端行标识',  
1981 - `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',  
1982 - `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',  
1983 - `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID',  
1984 - `update_by` varchar(64) DEFAULT NULL COMMENT '更新人',  
1985 - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',  
1986 - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 1968 + `id` varchar(32) NOT NULL COMMENT 'ID',
  1969 + `procurement_plan_id` varchar(32) NOT NULL COMMENT '采购计划ID',
  1970 + `product_id` varchar(32) NOT NULL COMMENT '品种ID',
  1971 + `material_type` varchar(200) DEFAULT NULL COMMENT '料型',
  1972 + `quantity` decimal(18, 5) NOT NULL COMMENT '数量',
  1973 + `actual_purchase_price` decimal(18, 10) DEFAULT NULL COMMENT '实际采购价',
  1974 + `including_shipping_price` decimal(18, 10) DEFAULT NULL COMMENT '含运到厂价',
  1975 + `price_list_prices` decimal(18, 10) DEFAULT NULL COMMENT '价格表价格',
  1976 + `coordination_range` decimal(18, 10) DEFAULT NULL COMMENT '协调幅度',
  1977 + `estimated_loss` decimal(18, 10) DEFAULT NULL COMMENT '买断料预计损耗',
  1978 + `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',
  1979 + `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',
  1980 + `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂',
  1981 + `invoice_product_name` varchar(200) NOT NULL COMMENT '开票品名',
  1982 + `procurement_plan_line_id` VARCHAR(32) DEFAULT NULL COMMENT '采购主计划明细表ID',
  1983 + `salesman_quotation_line_id` VARCHAR(32) DEFAULT NULL COMMENT '业务员报价明细行ID',
  1984 + `item_id` varchar(32) NOT NULL COMMENT '前端行标识',
  1985 + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
  1986 + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
  1987 + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID',
  1988 + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人',
  1989 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1990 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
1987 PRIMARY KEY (`id`), 1991 PRIMARY KEY (`id`),
1988 KEY `idx_ppl_procurement_plan_id` (`procurement_plan_id`), 1992 KEY `idx_ppl_procurement_plan_id` (`procurement_plan_id`),
1989 KEY `idx_ppl_product_id` (`product_id`), 1993 KEY `idx_ppl_product_id` (`product_id`),
@@ -2134,6 +2138,8 @@ CREATE TABLE `procurement_plan_change_line` @@ -2134,6 +2138,8 @@ CREATE TABLE `procurement_plan_change_line`
2134 `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)', 2138 `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',
2135 `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)', 2139 `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',
2136 `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂', 2140 `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂',
  2141 + `invoice_product_name` varchar(200) NOT NULL COMMENT '开票品名',
  2142 + `procurement_plan_line_id` VARCHAR(32) DEFAULT NULL COMMENT '采购主计划明细表ID',
2137 `item_id` varchar(32) NOT NULL COMMENT '前端行标识', 2143 `item_id` varchar(32) NOT NULL COMMENT '前端行标识',
2138 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', 2144 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
2139 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', 2145 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
@@ -2227,6 +2233,7 @@ CREATE TABLE `procurement_plan_replenish_line` @@ -2227,6 +2233,7 @@ CREATE TABLE `procurement_plan_replenish_line`
2227 `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)', 2233 `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',
2228 `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)', 2234 `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',
2229 `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂', 2235 `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂',
  2236 + `invoice_product_name` varchar(200) NOT NULL COMMENT '开票品名',
2230 `item_id` varchar(32) NOT NULL COMMENT '前端行标识', 2237 `item_id` varchar(32) NOT NULL COMMENT '前端行标识',
2231 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', 2238 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
2232 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', 2239 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
@@ -2385,7 +2392,7 @@ CREATE TABLE `procurement_contract_line` @@ -2385,7 +2392,7 @@ CREATE TABLE `procurement_contract_line`
2385 `id` VARCHAR(32) NOT NULL COMMENT '主键ID', 2392 `id` VARCHAR(32) NOT NULL COMMENT '主键ID',
2386 `contract_id` VARCHAR(32) NOT NULL COMMENT '采购合同主表ID', 2393 `contract_id` VARCHAR(32) NOT NULL COMMENT '采购合同主表ID',
2387 `plan_line_id` VARCHAR(32) DEFAULT NULL COMMENT '原采购计划明细行ID', 2394 `plan_line_id` VARCHAR(32) DEFAULT NULL COMMENT '原采购计划明细行ID',
2388 - `invoice_product_name` VARCHAR(200) NOT NULL COMMENT '名称', 2395 + `invoice_product_name` VARCHAR(200) NOT NULL COMMENT '名称(开票品名)',
2389 `product_id` VARCHAR(32) NOT NULL COMMENT '规格型号ID', 2396 `product_id` VARCHAR(32) NOT NULL COMMENT '规格型号ID',
2390 `quantity` DECIMAL(18, 4) NOT NULL DEFAULT 0 COMMENT '数量', 2397 `quantity` DECIMAL(18, 4) NOT NULL DEFAULT 0 COMMENT '数量',
2391 `unit_price` DECIMAL(18, 4) NOT NULL DEFAULT 0 COMMENT '单价', 2398 `unit_price` DECIMAL(18, 4) NOT NULL DEFAULT 0 COMMENT '单价',
@@ -2404,3 +2411,11 @@ CREATE TABLE `procurement_contract_line` @@ -2404,3 +2411,11 @@ CREATE TABLE `procurement_contract_line`
2404 KEY `idx_pcl_contract_id` (`contract_id`), 2411 KEY `idx_pcl_contract_id` (`contract_id`),
2405 KEY `idx_pcl_product_id` (`product_id`) 2412 KEY `idx_pcl_product_id` (`product_id`)
2406 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='采购合同明细表'; 2413 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='采购合同明细表';
  2414 +
  2415 +ALTER TABLE procurement_salesman_quotation_line ADD COLUMN invoice_product_name VARCHAR(200) NOT NULL COMMENT '开票品名';
  2416 +ALTER TABLE procurement_plan_line ADD COLUMN invoice_product_name VARCHAR(200) NOT NULL COMMENT '开票品名';
  2417 +ALTER TABLE procurement_plan_line ADD COLUMN procurement_plan_line_id VARCHAR(32) DEFAULT NULL COMMENT '采购主计划明细表ID';
  2418 +ALTER TABLE procurement_plan_line ADD COLUMN salesman_quotation_line_id VARCHAR(32) DEFAULT NULL COMMENT '业务员报价明细行ID';
  2419 +ALTER TABLE procurement_plan_change_line ADD COLUMN invoice_product_name VARCHAR(200) NOT NULL COMMENT '开票品名';
  2420 +ALTER TABLE procurement_plan_change_line ADD COLUMN procurement_plan_line_id VARCHAR(32) DEFAULT NULL COMMENT '采购主计划明细表ID';
  2421 +ALTER TABLE procurement_plan_replenish_line ADD COLUMN invoice_product_name VARCHAR(200) NOT NULL COMMENT '开票品名';
@@ -533,6 +533,18 @@ public class GetProcurementPlanBo extends BaseBo<ProcurementPlan> { @@ -533,6 +533,18 @@ public class GetProcurementPlanBo extends BaseBo<ProcurementPlan> {
533 private String procurementPlanId; 533 private String procurementPlanId;
534 534
535 /** 535 /**
  536 + * 采购主计划明细表ID
  537 + */
  538 + @ApiModelProperty("采购主计划明细表ID")
  539 + private String procurementPlanLineId;
  540 +
  541 + /**
  542 + * 业务员报价明细行ID
  543 + */
  544 + @ApiModelProperty("业务员报价明细行ID")
  545 + private String salesmanQuotationLineId;
  546 +
  547 + /**
536 * 品种ID 548 * 品种ID
537 */ 549 */
538 @ApiModelProperty("品种ID") 550 @ApiModelProperty("品种ID")
@@ -551,6 +563,12 @@ public class GetProcurementPlanBo extends BaseBo<ProcurementPlan> { @@ -551,6 +563,12 @@ public class GetProcurementPlanBo extends BaseBo<ProcurementPlan> {
551 private String materialType; 563 private String materialType;
552 564
553 /** 565 /**
  566 + * 开票品名
  567 + */
  568 + @ApiModelProperty("开票品名")
  569 + private String invoiceProductName;
  570 +
  571 + /**
554 * 数量 572 * 数量
555 */ 573 */
556 @ApiModelProperty("数量") 574 @ApiModelProperty("数量")
@@ -25,6 +25,12 @@ public class GetProcurementPlanChangeLineBo extends BaseBo<ProcurementPlanChange @@ -25,6 +25,12 @@ public class GetProcurementPlanChangeLineBo extends BaseBo<ProcurementPlanChange
25 private String procurementPlanChangeId; 25 private String procurementPlanChangeId;
26 26
27 /** 27 /**
  28 + * 采购主计划明细表ID
  29 + */
  30 + @ApiModelProperty("采购主计划明细表ID")
  31 + private String procurementPlanLineId;
  32 +
  33 + /**
28 * 品种ID 34 * 品种ID
29 */ 35 */
30 @ApiModelProperty("品种ID") 36 @ApiModelProperty("品种ID")
@@ -37,6 +43,12 @@ public class GetProcurementPlanChangeLineBo extends BaseBo<ProcurementPlanChange @@ -37,6 +43,12 @@ public class GetProcurementPlanChangeLineBo extends BaseBo<ProcurementPlanChange
37 private String materialType; 43 private String materialType;
38 44
39 /** 45 /**
  46 + * 开票品名
  47 + */
  48 + @ApiModelProperty("开票品名")
  49 + private String invoiceProductName;
  50 +
  51 + /**
40 * 数量 52 * 数量
41 */ 53 */
42 @ApiModelProperty("数量") 54 @ApiModelProperty("数量")
@@ -43,6 +43,12 @@ public class GetProcurementPlanReplenishLineBo extends BaseBo<ProcurementPlanRep @@ -43,6 +43,12 @@ public class GetProcurementPlanReplenishLineBo extends BaseBo<ProcurementPlanRep
43 private String materialType; 43 private String materialType;
44 44
45 /** 45 /**
  46 + * 开票品名
  47 + */
  48 + @ApiModelProperty("开票品名")
  49 + private String invoiceProductName;
  50 +
  51 + /**
46 * 数量 52 * 数量
47 */ 53 */
48 @ApiModelProperty("数量") 54 @ApiModelProperty("数量")
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
5 import com.baomidou.mybatisplus.annotation.TableName; 5 import com.baomidou.mybatisplus.annotation.TableName;
6 import com.lframework.starter.web.core.dto.BaseDto; 6 import com.lframework.starter.web.core.dto.BaseDto;
7 import com.lframework.starter.web.core.entity.BaseEntity; 7 import com.lframework.starter.web.core.entity.BaseEntity;
  8 +import io.swagger.annotations.ApiModelProperty;
8 import lombok.Data; 9 import lombok.Data;
9 import java.math.BigDecimal; 10 import java.math.BigDecimal;
10 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
@@ -26,6 +27,11 @@ public class ProcurementPlanChangeLine extends BaseEntity implements BaseDto { @@ -26,6 +27,11 @@ public class ProcurementPlanChangeLine extends BaseEntity implements BaseDto {
26 private String procurementPlanChangeId; 27 private String procurementPlanChangeId;
27 28
28 /** 29 /**
  30 + * 采购主计划明细表ID
  31 + */
  32 + private String procurementPlanLineId;
  33 +
  34 + /**
29 * 品种ID 35 * 品种ID
30 */ 36 */
31 private String productId; 37 private String productId;
@@ -76,6 +82,11 @@ public class ProcurementPlanChangeLine extends BaseEntity implements BaseDto { @@ -76,6 +82,11 @@ public class ProcurementPlanChangeLine extends BaseEntity implements BaseDto {
76 private BigDecimal paintDamageRatio; 82 private BigDecimal paintDamageRatio;
77 83
78 /** 84 /**
  85 + * 开票品名
  86 + */
  87 + private String invoiceProductName;
  88 +
  89 + /**
79 * 分厂 90 * 分厂
80 */ 91 */
81 private String workshopId; 92 private String workshopId;
@@ -28,6 +28,16 @@ public class ProcurementPlanLine extends BaseEntity implements BaseDto { @@ -28,6 +28,16 @@ public class ProcurementPlanLine extends BaseEntity implements BaseDto {
28 private String procurementPlanId; 28 private String procurementPlanId;
29 29
30 /** 30 /**
  31 + * 采购主计划明细表ID
  32 + */
  33 + private String procurementPlanLineId;
  34 +
  35 + /**
  36 + * 业务员报价明细行ID
  37 + */
  38 + private String salesmanQuotationLineId;
  39 +
  40 + /**
31 * 品种ID 41 * 品种ID
32 */ 42 */
33 private String productId; 43 private String productId;
@@ -84,6 +94,11 @@ public class ProcurementPlanLine extends BaseEntity implements BaseDto { @@ -84,6 +94,11 @@ public class ProcurementPlanLine extends BaseEntity implements BaseDto {
84 private BigDecimal paintDamageRatio; 94 private BigDecimal paintDamageRatio;
85 95
86 /** 96 /**
  97 + * 开票品名
  98 + */
  99 + private String invoiceProductName;
  100 +
  101 + /**
87 * 分厂 102 * 分厂
88 */ 103 */
89 private String workshopId; 104 private String workshopId;
@@ -90,6 +90,11 @@ public class SalesmanQuotationLine extends BaseEntity implements BaseDto { @@ -90,6 +90,11 @@ public class SalesmanQuotationLine extends BaseEntity implements BaseDto {
90 private BigDecimal paintDamageRatio; 90 private BigDecimal paintDamageRatio;
91 91
92 /** 92 /**
  93 + * 开票品名
  94 + */
  95 + private String invoiceProductName;
  96 +
  97 + /**
93 * 前端行标识 98 * 前端行标识
94 */ 99 */
95 private String itemId; 100 private String itemId;
@@ -77,6 +77,11 @@ public class ProcurementPlanReplenishLine extends BaseEntity implements BaseDto @@ -77,6 +77,11 @@ public class ProcurementPlanReplenishLine extends BaseEntity implements BaseDto
77 private BigDecimal paintDamageRatio; 77 private BigDecimal paintDamageRatio;
78 78
79 /** 79 /**
  80 + * 开票品名
  81 + */
  82 + private String invoiceProductName;
  83 +
  84 + /**
80 * 分厂 85 * 分厂
81 */ 86 */
82 private String workshopId; 87 private String workshopId;
@@ -122,15 +122,23 @@ public class ProcurementPlanChangeServiceImpl extends @@ -122,15 +122,23 @@ public class ProcurementPlanChangeServiceImpl extends
122 planChange.setId(IdUtil.getId()); 122 planChange.setId(IdUtil.getId());
123 planChange.setCode("K" + vo.getCode()); 123 planChange.setCode("K" + vo.getCode());
124 planChange.setApprovalStatus("PASS"); 124 planChange.setApprovalStatus("PASS");
  125 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getLines());
  126 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  127 + mergedInvoiceProductName = vo.getInvoiceProductName();
  128 + }
  129 + planChange.setInvoiceProductName(mergedInvoiceProductName);
125 this.save(planChange); 130 this.save(planChange);
126 131
127 List<ProcurementPlanChangeLine> lines = new ArrayList<>(); 132 List<ProcurementPlanChangeLine> lines = new ArrayList<>();
  133 + Map<String, String> invoiceProductNameMap = new HashMap<>();
128 if (!CollectionUtil.isEmpty(vo.getLines())) { 134 if (!CollectionUtil.isEmpty(vo.getLines())) {
129 for (CreateProcurementPlanChangeLineVo lineVo : vo.getLines()) { 135 for (CreateProcurementPlanChangeLineVo lineVo : vo.getLines()) {
130 ProcurementPlanChangeLine line = new ProcurementPlanChangeLine(); 136 ProcurementPlanChangeLine line = new ProcurementPlanChangeLine();
131 BeanUtil.copyProperties(lineVo, line); 137 BeanUtil.copyProperties(lineVo, line);
132 line.setId(IdUtil.getId()); 138 line.setId(IdUtil.getId());
133 line.setProcurementPlanChangeId(planChange.getId()); 139 line.setProcurementPlanChangeId(planChange.getId());
  140 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
  141 + invoiceProductNameMap.put(lineVo.getProcurementPlanLineId(), lineVo.getInvoiceProductName());
134 lines.add(line); 142 lines.add(line);
135 } 143 }
136 } 144 }
@@ -161,7 +169,6 @@ public class ProcurementPlanChangeServiceImpl extends @@ -161,7 +169,6 @@ public class ProcurementPlanChangeServiceImpl extends
161 vo1.setProcurementPlanId(vo.getProcurementPlanId()); 169 vo1.setProcurementPlanId(vo.getProcurementPlanId());
162 procurementBuyoutApplyService.create(vo1); 170 procurementBuyoutApplyService.create(vo1);
163 } else { 171 } else {
164 - //todo 开票品名变更会改到  
165 //变更的是主计划(开票品名 公司名称 另付运费) 直接修改主计划的数据、合同数据、子计划数据(含运到厂价),子计划买断操作申请单(如果只有主计划就只生成主计划的买断操作申请单) 172 //变更的是主计划(开票品名 公司名称 另付运费) 直接修改主计划的数据、合同数据、子计划数据(含运到厂价),子计划买断操作申请单(如果只有主计划就只生成主计划的买断操作申请单)
166 Wrapper<ProcurementPlan> queryWrapper = Wrappers.lambdaQuery(ProcurementPlan.class) 173 Wrapper<ProcurementPlan> queryWrapper = Wrappers.lambdaQuery(ProcurementPlan.class)
167 .eq(ProcurementPlan::getFrozen, false) 174 .eq(ProcurementPlan::getFrozen, false)
@@ -178,7 +185,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -178,7 +185,7 @@ public class ProcurementPlanChangeServiceImpl extends
178 planType = "变 补"; 185 planType = "变 补";
179 } 186 }
180 Wrapper<ProcurementPlan> parentWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class) 187 Wrapper<ProcurementPlan> parentWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
181 - .set(ProcurementPlan::getInvoiceProductName, vo.getInvoiceProductName()) 188 + .set(ProcurementPlan::getInvoiceProductName, mergedInvoiceProductName)
182 .set(ProcurementPlan::getCompanyShortId, vo.getCompanyShortId()) 189 .set(ProcurementPlan::getCompanyShortId, vo.getCompanyShortId())
183 .set(ProcurementPlan::getShippingCost, vo.getShippingCost()) 190 .set(ProcurementPlan::getShippingCost, vo.getShippingCost())
184 .set(ProcurementPlan::getProcessStatus, "COMPLETED") 191 .set(ProcurementPlan::getProcessStatus, "COMPLETED")
@@ -186,7 +193,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -186,7 +193,7 @@ public class ProcurementPlanChangeServiceImpl extends
186 .set(ProcurementPlan::getPlanType, planType) 193 .set(ProcurementPlan::getPlanType, planType)
187 .eq(ProcurementPlan::getId, vo.getProcurementPlanId()); 194 .eq(ProcurementPlan::getId, vo.getProcurementPlanId());
188 procurementPlanService.update(parentWrapper); 195 procurementPlanService.update(parentWrapper);
189 - //修改含运到厂价 196 + //修改含运到厂价、修改主计划明细表开票品名
190 List<ProcurementPlanLine> lineList = procurementPlanLineService.list( 197 List<ProcurementPlanLine> lineList = procurementPlanLineService.list(
191 Wrappers.lambdaQuery(ProcurementPlanLine.class) 198 Wrappers.lambdaQuery(ProcurementPlanLine.class)
192 .eq(ProcurementPlanLine::getProcurementPlanId, vo.getProcurementPlanId()) 199 .eq(ProcurementPlanLine::getProcurementPlanId, vo.getProcurementPlanId())
@@ -198,14 +205,14 @@ public class ProcurementPlanChangeServiceImpl extends @@ -198,14 +205,14 @@ public class ProcurementPlanChangeServiceImpl extends
198 205
199 Wrapper<ProcurementPlanLine> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanLine.class) 206 Wrapper<ProcurementPlanLine> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanLine.class)
200 .set(ProcurementPlanLine::getIncludingShippingPrice, newPrice) 207 .set(ProcurementPlanLine::getIncludingShippingPrice, newPrice)
  208 + .set(ProcurementPlanLine::getInvoiceProductName, invoiceProductNameMap.get(line.getId()))
201 .eq(ProcurementPlanLine::getId, line.getId()); 209 .eq(ProcurementPlanLine::getId, line.getId());
202 procurementPlanLineService.update(updateWrapper); 210 procurementPlanLineService.update(updateWrapper);
203 } 211 }
204 } 212 }
205 213
206 - //修改子计划 开票品名 公司名称 另付运费 214 + //修改子计划 公司名称 另付运费
207 Wrapper<ProcurementPlan> sonWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class) 215 Wrapper<ProcurementPlan> sonWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
208 - .set(ProcurementPlan::getInvoiceProductName, vo.getInvoiceProductName())  
209 .set(ProcurementPlan::getCompanyShortId, vo.getCompanyShortId()) 216 .set(ProcurementPlan::getCompanyShortId, vo.getCompanyShortId())
210 .set(ProcurementPlan::getShippingCost, vo.getShippingCost()) 217 .set(ProcurementPlan::getShippingCost, vo.getShippingCost())
211 .set(ProcurementPlan::getProcessStatus, "COMPLETED") 218 .set(ProcurementPlan::getProcessStatus, "COMPLETED")
@@ -215,6 +222,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -215,6 +222,7 @@ public class ProcurementPlanChangeServiceImpl extends
215 .eq(ProcurementPlan::getParentId, vo.getProcurementPlanId()); 222 .eq(ProcurementPlan::getParentId, vo.getProcurementPlanId());
216 procurementPlanService.update(sonWrapper); 223 procurementPlanService.update(sonWrapper);
217 224
  225 + //先修改子计划中明细表开票品名数据
218 for (ProcurementPlan procurementPlan : list) { 226 for (ProcurementPlan procurementPlan : list) {
219 //修改含运到厂价 227 //修改含运到厂价
220 List<ProcurementPlanLine> lineList1 = procurementPlanLineService.list( 228 List<ProcurementPlanLine> lineList1 = procurementPlanLineService.list(
@@ -228,10 +236,20 @@ public class ProcurementPlanChangeServiceImpl extends @@ -228,10 +236,20 @@ public class ProcurementPlanChangeServiceImpl extends
228 236
229 Wrapper<ProcurementPlanLine> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanLine.class) 237 Wrapper<ProcurementPlanLine> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanLine.class)
230 .set(ProcurementPlanLine::getIncludingShippingPrice, newPrice) 238 .set(ProcurementPlanLine::getIncludingShippingPrice, newPrice)
  239 + .set(ProcurementPlanLine::getInvoiceProductName, invoiceProductNameMap.get(line.getProcurementPlanLineId()))
231 .eq(ProcurementPlanLine::getId, line.getId()); 240 .eq(ProcurementPlanLine::getId, line.getId());
232 procurementPlanLineService.update(updateWrapper); 241 procurementPlanLineService.update(updateWrapper);
233 } 242 }
234 } 243 }
  244 + List<ProcurementPlanLine> byProcurementPlanId = procurementPlanLineService.getByProcurementPlanId(procurementPlan.getId());
  245 + String invoiceProductNames1 = joinDistinctInvoiceProductNames1(byProcurementPlanId);
  246 + //更新子计划开票品名(重新汇总子计划的开票品名)
  247 + Wrapper<ProcurementPlan> sonWrapper1 = Wrappers.lambdaUpdate(ProcurementPlan.class)
  248 + .set(ProcurementPlan::getInvoiceProductName, invoiceProductNames1)
  249 + .eq(ProcurementPlan::getFrozen, false)
  250 + .eq(ProcurementPlan::getId, procurementPlan.getId());
  251 + procurementPlanService.update(sonWrapper1);
  252 +
235 //先删除子计划买断操作申请单 253 //先删除子计划买断操作申请单
236 procurementBuyoutApplyService.deleteByPlanId(procurementPlan.getId()); 254 procurementBuyoutApplyService.deleteByPlanId(procurementPlan.getId());
237 //重新生成子计划买断操作申请单 255 //重新生成子计划买断操作申请单
@@ -243,7 +261,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -243,7 +261,7 @@ public class ProcurementPlanChangeServiceImpl extends
243 //没有子计划 261 //没有子计划
244 //修改 开票品名 公司名称 另付运费 262 //修改 开票品名 公司名称 另付运费
245 Wrapper<ProcurementPlan> parentWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class) 263 Wrapper<ProcurementPlan> parentWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
246 - .set(ProcurementPlan::getInvoiceProductName, vo.getInvoiceProductName()) 264 + .set(ProcurementPlan::getInvoiceProductName, mergedInvoiceProductName)
247 .set(ProcurementPlan::getCompanyShortId, vo.getCompanyShortId()) 265 .set(ProcurementPlan::getCompanyShortId, vo.getCompanyShortId())
248 .set(ProcurementPlan::getShippingCost, vo.getShippingCost()) 266 .set(ProcurementPlan::getShippingCost, vo.getShippingCost())
249 .set(ProcurementPlan::getWorkshopId, vo.getLines().get(0).getWorkshopId()) 267 .set(ProcurementPlan::getWorkshopId, vo.getLines().get(0).getWorkshopId())
@@ -251,7 +269,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -251,7 +269,7 @@ public class ProcurementPlanChangeServiceImpl extends
251 .set(ProcurementPlan::getProcessNode, null) 269 .set(ProcurementPlan::getProcessNode, null)
252 .eq(ProcurementPlan::getId, vo.getProcurementPlanId()); 270 .eq(ProcurementPlan::getId, vo.getProcurementPlanId());
253 procurementPlanService.update(parentWrapper); 271 procurementPlanService.update(parentWrapper);
254 - //修改含运到厂价 272 + //修改含运到厂价、开票品名
255 List<ProcurementPlanLine> lineList = procurementPlanLineService.list( 273 List<ProcurementPlanLine> lineList = procurementPlanLineService.list(
256 Wrappers.lambdaQuery(ProcurementPlanLine.class) 274 Wrappers.lambdaQuery(ProcurementPlanLine.class)
257 .eq(ProcurementPlanLine::getProcurementPlanId, vo.getProcurementPlanId()) 275 .eq(ProcurementPlanLine::getProcurementPlanId, vo.getProcurementPlanId())
@@ -263,6 +281,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -263,6 +281,7 @@ public class ProcurementPlanChangeServiceImpl extends
263 281
264 Wrapper<ProcurementPlanLine> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanLine.class) 282 Wrapper<ProcurementPlanLine> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanLine.class)
265 .set(ProcurementPlanLine::getIncludingShippingPrice, newPrice) 283 .set(ProcurementPlanLine::getIncludingShippingPrice, newPrice)
  284 + .set(ProcurementPlanLine::getInvoiceProductName, invoiceProductNameMap.get(line.getId()))
266 .eq(ProcurementPlanLine::getId, line.getId()); 285 .eq(ProcurementPlanLine::getId, line.getId());
267 procurementPlanLineService.update(updateWrapper); 286 procurementPlanLineService.update(updateWrapper);
268 } 287 }
@@ -297,8 +316,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -297,8 +316,7 @@ public class ProcurementPlanChangeServiceImpl extends
297 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo(); 316 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo();
298 lineVo.setPlanLineId(line.getId()); 317 lineVo.setPlanLineId(line.getId());
299 lineVo.setItemId(IdUtil.getId()); 318 lineVo.setItemId(IdUtil.getId());
300 - //todo 开票品名逻辑需要修改  
301 - lineVo.setInvoiceProductName(procurementPlan.getInvoiceProductName()); 319 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
302 lineVo.setProductId(line.getProductId()); 320 lineVo.setProductId(line.getProductId());
303 lineVo.setQuantity(line.getQuantity()); 321 lineVo.setQuantity(line.getQuantity());
304 lineVo.setUnitPrice(line.getActualPurchasePrice()); 322 lineVo.setUnitPrice(line.getActualPurchasePrice());
@@ -317,6 +335,11 @@ public class ProcurementPlanChangeServiceImpl extends @@ -317,6 +335,11 @@ public class ProcurementPlanChangeServiceImpl extends
317 ProcurementPlanChange planChange = new ProcurementPlanChange(); 335 ProcurementPlanChange planChange = new ProcurementPlanChange();
318 BeanUtil.copyProperties(vo, planChange); 336 BeanUtil.copyProperties(vo, planChange);
319 planChange.setId(IdUtil.getId()); 337 planChange.setId(IdUtil.getId());
  338 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getLines());
  339 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  340 + mergedInvoiceProductName = vo.getInvoiceProductName();
  341 + }
  342 + planChange.setInvoiceProductName(mergedInvoiceProductName);
320 if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg") 343 if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg")
321 || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) { 344 || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) {
322 planChange.setProcessNode("CGCZG"); 345 planChange.setProcessNode("CGCZG");
@@ -336,6 +359,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -336,6 +359,7 @@ public class ProcurementPlanChangeServiceImpl extends
336 BeanUtil.copyProperties(lineVo, line); 359 BeanUtil.copyProperties(lineVo, line);
337 line.setId(IdUtil.getId()); 360 line.setId(IdUtil.getId());
338 line.setProcurementPlanChangeId(planChange.getId()); 361 line.setProcurementPlanChangeId(planChange.getId());
  362 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
339 lines.add(line); 363 lines.add(line);
340 } 364 }
341 } 365 }
@@ -367,6 +391,11 @@ public class ProcurementPlanChangeServiceImpl extends @@ -367,6 +391,11 @@ public class ProcurementPlanChangeServiceImpl extends
367 } 391 }
368 ProcurementPlanChange planChange = new ProcurementPlanChange(); 392 ProcurementPlanChange planChange = new ProcurementPlanChange();
369 BeanUtil.copyProperties(vo, planChange); 393 BeanUtil.copyProperties(vo, planChange);
  394 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getLines());
  395 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  396 + mergedInvoiceProductName = vo.getInvoiceProductName();
  397 + }
  398 + planChange.setInvoiceProductName(mergedInvoiceProductName);
370 this.updateById(planChange); 399 this.updateById(planChange);
371 //保存或更新采购计划变更单明细 400 //保存或更新采购计划变更单明细
372 saveOrUpdateLines(vo.getId(), vo.getLines()); 401 saveOrUpdateLines(vo.getId(), vo.getLines());
@@ -593,18 +622,26 @@ public class ProcurementPlanChangeServiceImpl extends @@ -593,18 +622,26 @@ public class ProcurementPlanChangeServiceImpl extends
593 .setEntity(updatedMain) 622 .setEntity(updatedMain)
594 .eq(ProcurementPlan::getId, planId)); 623 .eq(ProcurementPlan::getId, planId));
595 624
596 - // 3.2 主计划明细:先删后插(保留历史deleted=true的不管)  
597 - procurementPlanLineService.remove(Wrappers.lambdaQuery(ProcurementPlanLine.class)  
598 - .eq(ProcurementPlanLine::getProcurementPlanId, planId)); 625 + // 3.2 主计划明细:更新(保留历史deleted=true的不管)
599 if (CollectionUtil.isNotEmpty(changeLines)) { 626 if (CollectionUtil.isNotEmpty(changeLines)) {
600 - List<ProcurementPlanLine> newLines = new ArrayList<>();  
601 for (ProcurementPlanChangeLine cl : changeLines) { 627 for (ProcurementPlanChangeLine cl : changeLines) {
602 - ProcurementPlanLine nl = BeanUtil.copyProperties(cl, ProcurementPlanLine.class);  
603 - nl.setId(IdUtil.getId());  
604 - nl.setProcurementPlanId(planId);  
605 - newLines.add(nl); 628 + LambdaUpdateWrapper<ProcurementPlanLine> updateWrapperLine = new LambdaUpdateWrapper<>(ProcurementPlanLine.class);
  629 + updateWrapperLine.eq(ProcurementPlanLine::getId, cl.getProcurementPlanLineId())
  630 + .set(ProcurementPlanLine::getProductId, cl.getProductId())
  631 + .set(ProcurementPlanLine::getMaterialType, cl.getMaterialType())
  632 + .set(ProcurementPlanLine::getQuantity, cl.getQuantity())
  633 + .set(ProcurementPlanLine::getActualPurchasePrice, cl.getActualPurchasePrice())
  634 + .set(ProcurementPlanLine::getIncludingShippingPrice, cl.getIncludingShippingPrice())
  635 + .set(ProcurementPlanLine::getPriceListPrices, cl.getPriceListPrices())
  636 + .set(ProcurementPlanLine::getCoordinationRange, cl.getCoordinationRange())
  637 + .set(ProcurementPlanLine::getEstimatedLoss, cl.getEstimatedLoss())
  638 + .set(ProcurementPlanLine::getApplicationAttrition, cl.getApplicationAttrition())
  639 + .set(ProcurementPlanLine::getPaintDamageRatio, cl.getPaintDamageRatio())
  640 + .set(ProcurementPlanLine::getInvoiceProductName, cl.getInvoiceProductName())
  641 + .set(ProcurementPlanLine::getWorkshopId, cl.getWorkshopId())
  642 + .set(ProcurementPlanLine::getItemId, cl.getItemId());
  643 + procurementPlanLineService.update(updateWrapperLine);
606 } 644 }
607 - procurementPlanLineService.saveBatch(newLines);  
608 } 645 }
609 646
610 // 4) 根据变更后明细的分厂分组,从_(N+1)开始生成新子计划 647 // 4) 根据变更后明细的分厂分组,从_(N+1)开始生成新子计划
@@ -738,8 +775,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -738,8 +775,7 @@ public class ProcurementPlanChangeServiceImpl extends
738 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo(); 775 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo();
739 lineVo.setPlanLineId(line.getId()); 776 lineVo.setPlanLineId(line.getId());
740 lineVo.setItemId(IdUtil.getId()); 777 lineVo.setItemId(IdUtil.getId());
741 - //todo 开票品名逻辑需要修改  
742 - lineVo.setInvoiceProductName(procurementPlan.getInvoiceProductName()); 778 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
743 lineVo.setProductId(line.getProductId()); 779 lineVo.setProductId(line.getProductId());
744 lineVo.setQuantity(line.getQuantity()); 780 lineVo.setQuantity(line.getQuantity());
745 lineVo.setUnitPrice(line.getActualPurchasePrice()); 781 lineVo.setUnitPrice(line.getActualPurchasePrice());
@@ -839,6 +875,11 @@ public class ProcurementPlanChangeServiceImpl extends @@ -839,6 +875,11 @@ public class ProcurementPlanChangeServiceImpl extends
839 // 更新主表字段 875 // 更新主表字段
840 ProcurementPlanChange planChange = new ProcurementPlanChange(); 876 ProcurementPlanChange planChange = new ProcurementPlanChange();
841 BeanUtil.copyProperties(vo, planChange); 877 BeanUtil.copyProperties(vo, planChange);
  878 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getLines());
  879 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  880 + mergedInvoiceProductName = vo.getInvoiceProductName();
  881 + }
  882 + planChange.setInvoiceProductName(mergedInvoiceProductName);
842 this.updateById(planChange); 883 this.updateById(planChange);
843 884
844 //保存或更新采购计划变更单明细 885 //保存或更新采购计划变更单明细
@@ -918,7 +959,6 @@ public class ProcurementPlanChangeServiceImpl extends @@ -918,7 +959,6 @@ public class ProcurementPlanChangeServiceImpl extends
918 if (StringUtil.isBlank(lineVo.getItemId())) { 959 if (StringUtil.isBlank(lineVo.getItemId())) {
919 lineVo.setItemId(oldLine.getItemId()); 960 lineVo.setItemId(oldLine.getItemId());
920 } 961 }
921 - log.error("workshopId====" + lineVo.getWorkshopId());  
922 LambdaUpdateWrapper<ProcurementPlanChangeLine> updateWrapper = new LambdaUpdateWrapper<>(ProcurementPlanChangeLine.class); 962 LambdaUpdateWrapper<ProcurementPlanChangeLine> updateWrapper = new LambdaUpdateWrapper<>(ProcurementPlanChangeLine.class);
923 updateWrapper.eq(ProcurementPlanChangeLine::getId, lineVo.getId()) 963 updateWrapper.eq(ProcurementPlanChangeLine::getId, lineVo.getId())
924 .set(ProcurementPlanChangeLine::getProcurementPlanChangeId, finalChangeId) 964 .set(ProcurementPlanChangeLine::getProcurementPlanChangeId, finalChangeId)
@@ -932,6 +972,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -932,6 +972,7 @@ public class ProcurementPlanChangeServiceImpl extends
932 .set(ProcurementPlanChangeLine::getEstimatedLoss, lineVo.getEstimatedLoss()) 972 .set(ProcurementPlanChangeLine::getEstimatedLoss, lineVo.getEstimatedLoss())
933 .set(ProcurementPlanChangeLine::getApplicationAttrition, lineVo.getApplicationAttrition()) 973 .set(ProcurementPlanChangeLine::getApplicationAttrition, lineVo.getApplicationAttrition())
934 .set(ProcurementPlanChangeLine::getPaintDamageRatio, lineVo.getPaintDamageRatio()) 974 .set(ProcurementPlanChangeLine::getPaintDamageRatio, lineVo.getPaintDamageRatio())
  975 + .set(ProcurementPlanChangeLine::getInvoiceProductName, lineVo.getInvoiceProductName())
935 .set(ProcurementPlanChangeLine::getWorkshopId, lineVo.getWorkshopId()) 976 .set(ProcurementPlanChangeLine::getWorkshopId, lineVo.getWorkshopId())
936 .set(ProcurementPlanChangeLine::getItemId, lineVo.getItemId()); 977 .set(ProcurementPlanChangeLine::getItemId, lineVo.getItemId());
937 procurementPlanChangeLineService.update(updateWrapper); 978 procurementPlanChangeLineService.update(updateWrapper);
@@ -939,6 +980,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -939,6 +980,7 @@ public class ProcurementPlanChangeServiceImpl extends
939 ProcurementPlanChangeLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanChangeLine.class); 980 ProcurementPlanChangeLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanChangeLine.class);
940 createLine.setId(IdUtil.getId()); 981 createLine.setId(IdUtil.getId());
941 createLine.setProcurementPlanChangeId(finalChangeId); 982 createLine.setProcurementPlanChangeId(finalChangeId);
  983 + createLine.setInvoiceProductName(lineVo.getInvoiceProductName());
942 procurementPlanChangeLineService.save(createLine); 984 procurementPlanChangeLineService.save(createLine);
943 existIdList.add(createLine.getId()); 985 existIdList.add(createLine.getId());
944 } 986 }
@@ -955,6 +997,30 @@ public class ProcurementPlanChangeServiceImpl extends @@ -955,6 +997,30 @@ public class ProcurementPlanChangeServiceImpl extends
955 } 997 }
956 998
957 /** 999 /**
  1000 + * 合并明细开票品名(去重、排序、顿号连接)
  1001 + *
  1002 + * @param lines 明细列表
  1003 + * @return 合并后的开票品名
  1004 + */
  1005 + private String joinDistinctInvoiceProductNames(List<? extends CreateProcurementPlanChangeLineVo> lines) {
  1006 + return lines.stream().map(CreateProcurementPlanChangeLineVo::getInvoiceProductName)
  1007 + .filter(StringUtil::isNotBlank).distinct().sorted()
  1008 + .collect(Collectors.joining("、"));
  1009 + }
  1010 +
  1011 + /**
  1012 + * 合并明细开票品名(去重、排序、顿号连接)
  1013 + *
  1014 + * @param lines 明细列表
  1015 + * @return 合并后的开票品名
  1016 + */
  1017 + private String joinDistinctInvoiceProductNames1(List<? extends ProcurementPlanLine> lines) {
  1018 + return lines.stream().map(ProcurementPlanLine::getInvoiceProductName)
  1019 + .filter(StringUtil::isNotBlank).distinct().sorted()
  1020 + .collect(Collectors.joining("、"));
  1021 + }
  1022 +
  1023 + /**
958 * 回填审核按钮展示信息 1024 * 回填审核按钮展示信息
959 * 1025 *
960 * @param datas 数据列表 1026 * @param datas 数据列表
@@ -186,6 +186,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -186,6 +186,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
186 } 186 }
187 plan.setTotalQuantity(totalQuantity); 187 plan.setTotalQuantity(totalQuantity);
188 188
  189 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getProcurementPlanLineList());
  190 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  191 + mergedInvoiceProductName = vo.getInvoiceProductName();
  192 + }
  193 + plan.setInvoiceProductName(mergedInvoiceProductName);
  194 +
189 String currentUserId = SecurityUtil.getCurrentUser().getId(); 195 String currentUserId = SecurityUtil.getCurrentUser().getId();
190 List<SysRole> roles = sysRoleService.getByUserId(currentUserId); 196 List<SysRole> roles = sysRoleService.getByUserId(currentUserId);
191 List<String> roleCodes = CollectionUtil.isEmpty(roles) ? new java.util.ArrayList<>() 197 List<String> roleCodes = CollectionUtil.isEmpty(roles) ? new java.util.ArrayList<>()
@@ -213,6 +219,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -213,6 +219,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
213 ProcurementPlanLine line = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class); 219 ProcurementPlanLine line = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class);
214 line.setId(IdUtil.getId()); 220 line.setId(IdUtil.getId());
215 line.setProcurementPlanId(plan.getId()); 221 line.setProcurementPlanId(plan.getId());
  222 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
  223 + line.setSalesmanQuotationLineId(lineVo.getSalesmanQuotationLineId());
216 procurementPlanLineService.save(line); 224 procurementPlanLineService.save(line);
217 } 225 }
218 } 226 }
@@ -243,6 +251,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -243,6 +251,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
243 } 251 }
244 updateEntity.setTotalQuantity(totalQuantity); 252 updateEntity.setTotalQuantity(totalQuantity);
245 253
  254 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getProcurementPlanLineList());
  255 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  256 + mergedInvoiceProductName = vo.getInvoiceProductName();
  257 + }
  258 + updateEntity.setInvoiceProductName(mergedInvoiceProductName);
  259 +
246 Wrapper<ProcurementPlan> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class) 260 Wrapper<ProcurementPlan> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
247 .eq(ProcurementPlan::getId, vo.getId()); 261 .eq(ProcurementPlan::getId, vo.getId());
248 262
@@ -280,6 +294,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -280,6 +294,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
280 LambdaUpdateWrapper<ProcurementPlanLine> updateWrapper = new LambdaUpdateWrapper<>(ProcurementPlanLine.class); 294 LambdaUpdateWrapper<ProcurementPlanLine> updateWrapper = new LambdaUpdateWrapper<>(ProcurementPlanLine.class);
281 updateWrapper.eq(ProcurementPlanLine::getId, lineVo.getId()) 295 updateWrapper.eq(ProcurementPlanLine::getId, lineVo.getId())
282 .set(ProcurementPlanLine::getProcurementPlanId, lineVo.getProcurementPlanId()) 296 .set(ProcurementPlanLine::getProcurementPlanId, lineVo.getProcurementPlanId())
  297 + .set(ProcurementPlanLine::getSalesmanQuotationLineId, lineVo.getSalesmanQuotationLineId())
283 .set(ProcurementPlanLine::getProductId, lineVo.getProductId()) 298 .set(ProcurementPlanLine::getProductId, lineVo.getProductId())
284 .set(ProcurementPlanLine::getMaterialType, lineVo.getMaterialType()) 299 .set(ProcurementPlanLine::getMaterialType, lineVo.getMaterialType())
285 .set(ProcurementPlanLine::getQuantity, lineVo.getQuantity()) 300 .set(ProcurementPlanLine::getQuantity, lineVo.getQuantity())
@@ -290,6 +305,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -290,6 +305,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
290 .set(ProcurementPlanLine::getEstimatedLoss, lineVo.getEstimatedLoss()) 305 .set(ProcurementPlanLine::getEstimatedLoss, lineVo.getEstimatedLoss())
291 .set(ProcurementPlanLine::getApplicationAttrition, lineVo.getApplicationAttrition()) 306 .set(ProcurementPlanLine::getApplicationAttrition, lineVo.getApplicationAttrition())
292 .set(ProcurementPlanLine::getPaintDamageRatio, lineVo.getPaintDamageRatio()) 307 .set(ProcurementPlanLine::getPaintDamageRatio, lineVo.getPaintDamageRatio())
  308 + .set(ProcurementPlanLine::getInvoiceProductName, lineVo.getInvoiceProductName())
293 .set(ProcurementPlanLine::getWorkshopId, lineVo.getWorkshopId()) 309 .set(ProcurementPlanLine::getWorkshopId, lineVo.getWorkshopId())
294 .set(ProcurementPlanLine::getItemId, lineVo.getItemId()); 310 .set(ProcurementPlanLine::getItemId, lineVo.getItemId());
295 procurementPlanLineService.update(updateWrapper); 311 procurementPlanLineService.update(updateWrapper);
@@ -297,6 +313,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -297,6 +313,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
297 ProcurementPlanLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class); 313 ProcurementPlanLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class);
298 createLine.setId(IdUtil.getId()); 314 createLine.setId(IdUtil.getId());
299 createLine.setProcurementPlanId(procurementPlanId); 315 createLine.setProcurementPlanId(procurementPlanId);
  316 + createLine.setInvoiceProductName(lineVo.getInvoiceProductName());
  317 + createLine.setSalesmanQuotationLineId(lineVo.getSalesmanQuotationLineId());
300 procurementPlanLineService.save(createLine); 318 procurementPlanLineService.save(createLine);
301 existIdList.add(createLine.getId()); 319 existIdList.add(createLine.getId());
302 } 320 }
@@ -312,6 +330,18 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -312,6 +330,18 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
312 } 330 }
313 } 331 }
314 332
  333 + /**
  334 + * 合并明细开票品名(去重、排序、顿号连接)
  335 + *
  336 + * @param lines 明细列表
  337 + * @return 合并后的开票品名
  338 + */
  339 + private String joinDistinctInvoiceProductNames(List<? extends ProcurementPlanLineVo> lines) {
  340 + return lines.stream().map(ProcurementPlanLineVo::getInvoiceProductName)
  341 + .filter(StringUtil::isNotBlank).distinct().sorted()
  342 + .collect(Collectors.joining("、"));
  343 + }
  344 +
315 @Transactional(rollbackFor = Exception.class) 345 @Transactional(rollbackFor = Exception.class)
316 @Override 346 @Override
317 public void deleteById(String id) { 347 public void deleteById(String id) {
@@ -359,8 +389,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -359,8 +389,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
359 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo(); 389 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo();
360 lineVo.setPlanLineId(line.getId()); 390 lineVo.setPlanLineId(line.getId());
361 lineVo.setItemId(IdUtil.getId()); 391 lineVo.setItemId(IdUtil.getId());
362 - //todo 开票品名逻辑需要修改  
363 - lineVo.setInvoiceProductName(procurementPlan.getInvoiceProductName()); 392 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
364 lineVo.setProductId(line.getProductId()); 393 lineVo.setProductId(line.getProductId());
365 lineVo.setQuantity(line.getQuantity()); 394 lineVo.setQuantity(line.getQuantity());
366 lineVo.setUnitPrice(line.getActualPurchasePrice()); 395 lineVo.setUnitPrice(line.getActualPurchasePrice());
@@ -474,6 +503,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -474,6 +503,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
474 for (ProcurementPlanLine line : factoryLines) { 503 for (ProcurementPlanLine line : factoryLines) {
475 ProcurementPlanLineVo lineVo = BeanUtil.copyProperties(line, ProcurementPlanLineVo.class); 504 ProcurementPlanLineVo lineVo = BeanUtil.copyProperties(line, ProcurementPlanLineVo.class);
476 lineVo.setWorkshopId(line.getWorkshopId()); 505 lineVo.setWorkshopId(line.getWorkshopId());
  506 + lineVo.setProcurementPlanLineId(line.getId());
477 subLineVoList.add(lineVo); 507 subLineVoList.add(lineVo);
478 } 508 }
479 subVo.setProcurementPlanLineList(subLineVoList); 509 subVo.setProcurementPlanLineList(subLineVoList);
@@ -734,6 +764,11 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -734,6 +764,11 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
734 if (StringUtils.isEmpty(plan.getCreateById())) { 764 if (StringUtils.isEmpty(plan.getCreateById())) {
735 plan.setCreateBy(SecurityUtil.getCurrentUser().getId()); 765 plan.setCreateBy(SecurityUtil.getCurrentUser().getId());
736 } 766 }
  767 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getProcurementPlanLineList());
  768 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  769 + mergedInvoiceProductName = vo.getInvoiceProductName();
  770 + }
  771 + plan.setInvoiceProductName(mergedInvoiceProductName);
737 getBaseMapper().insert(plan); 772 getBaseMapper().insert(plan);
738 773
739 if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) { 774 if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) {
@@ -108,6 +108,7 @@ public class SalesmanQuotationLineServiceImpl @@ -108,6 +108,7 @@ public class SalesmanQuotationLineServiceImpl
108 data.setEstimatedLoss(vo.getEstimatedLoss()); 108 data.setEstimatedLoss(vo.getEstimatedLoss());
109 data.setPaintDamageRatio(vo.getPaintDamageRatio()); 109 data.setPaintDamageRatio(vo.getPaintDamageRatio());
110 data.setItemId(vo.getItemId()); 110 data.setItemId(vo.getItemId());
  111 + data.setInvoiceProductName(vo.getInvoiceProductName());
111 112
112 getBaseMapper().insert(data); 113 getBaseMapper().insert(data);
113 114
@@ -140,6 +141,7 @@ public class SalesmanQuotationLineServiceImpl @@ -140,6 +141,7 @@ public class SalesmanQuotationLineServiceImpl
140 .set(SalesmanQuotationLine::getEstimatedLoss, vo.getEstimatedLoss()) 141 .set(SalesmanQuotationLine::getEstimatedLoss, vo.getEstimatedLoss())
141 .set(SalesmanQuotationLine::getPaintDamageRatio, vo.getPaintDamageRatio()) 142 .set(SalesmanQuotationLine::getPaintDamageRatio, vo.getPaintDamageRatio())
142 .set(SalesmanQuotationLine::getItemId, StringUtils.defaultIfBlank(vo.getItemId(), data.getItemId())) 143 .set(SalesmanQuotationLine::getItemId, StringUtils.defaultIfBlank(vo.getItemId(), data.getItemId()))
  144 + .set(SalesmanQuotationLine::getInvoiceProductName, vo.getInvoiceProductName())
143 .eq(SalesmanQuotationLine::getId, vo.getId()); 145 .eq(SalesmanQuotationLine::getId, vo.getId());
144 146
145 getBaseMapper().update(updateWrapper); 147 getBaseMapper().update(updateWrapper);
@@ -15,6 +15,7 @@ import com.lframework.starter.common.exceptions.impl.DefaultClientException; @@ -15,6 +15,7 @@ import com.lframework.starter.common.exceptions.impl.DefaultClientException;
15 import com.lframework.starter.common.utils.Assert; 15 import com.lframework.starter.common.utils.Assert;
16 import com.lframework.starter.common.utils.CollectionUtil; 16 import com.lframework.starter.common.utils.CollectionUtil;
17 import com.lframework.starter.common.utils.ObjectUtil; 17 import com.lframework.starter.common.utils.ObjectUtil;
  18 +import com.lframework.starter.common.utils.StringUtil;
18 import com.lframework.starter.web.core.annotations.oplog.OpLog; 19 import com.lframework.starter.web.core.annotations.oplog.OpLog;
19 import com.lframework.starter.web.core.components.resp.PageResult; 20 import com.lframework.starter.web.core.components.resp.PageResult;
20 import com.lframework.starter.web.core.components.security.SecurityUtil; 21 import com.lframework.starter.web.core.components.security.SecurityUtil;
@@ -178,6 +179,11 @@ public class SalesmanQuotationServiceImpl @@ -178,6 +179,11 @@ public class SalesmanQuotationServiceImpl
178 .map(CreateSalesmanQuotationLineVo::getProductId) 179 .map(CreateSalesmanQuotationLineVo::getProductId)
179 .collect(Collectors.toList())); 180 .collect(Collectors.toList()));
180 SalesmanQuotation data = buildCreateEntity(vo, supplier, currentUser); 181 SalesmanQuotation data = buildCreateEntity(vo, supplier, currentUser);
  182 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getQuotationLineList());
  183 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  184 + mergedInvoiceProductName = vo.getInvoiceProductName();
  185 + }
  186 + data.setInvoiceProductName(mergedInvoiceProductName);
181 getBaseMapper().insert(data); 187 getBaseMapper().insert(data);
182 188
183 saveCreateLines(data.getId(), vo.getQuotationLineList(), quotationBreedMap, vo.getPriced()); 189 saveCreateLines(data.getId(), vo.getQuotationLineList(), quotationBreedMap, vo.getPriced());
@@ -235,6 +241,11 @@ public class SalesmanQuotationServiceImpl @@ -235,6 +241,11 @@ public class SalesmanQuotationServiceImpl
235 .map(UpdateSalesmanQuotationLineVo::getProductId) 241 .map(UpdateSalesmanQuotationLineVo::getProductId)
236 .collect(Collectors.toList())); 242 .collect(Collectors.toList()));
237 fillUpdateEntity(data, vo, supplier); 243 fillUpdateEntity(data, vo, supplier);
  244 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getQuotationLineList());
  245 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  246 + mergedInvoiceProductName = vo.getInvoiceProductName();
  247 + }
  248 + data.setInvoiceProductName(mergedInvoiceProductName);
238 getBaseMapper().updateById(data); 249 getBaseMapper().updateById(data);
239 250
240 saveOrUpdateLines(data.getId(), vo.getQuotationLineList(), quotationBreedMap, vo.getPriced()); 251 saveOrUpdateLines(data.getId(), vo.getQuotationLineList(), quotationBreedMap, vo.getPriced());
@@ -523,6 +534,7 @@ public class SalesmanQuotationServiceImpl @@ -523,6 +534,7 @@ public class SalesmanQuotationServiceImpl
523 createLineVo.setEstimatedLoss(lineVo.getEstimatedLoss()); 534 createLineVo.setEstimatedLoss(lineVo.getEstimatedLoss());
524 createLineVo.setPaintDamageRatio(lineVo.getPaintDamageRatio()); 535 createLineVo.setPaintDamageRatio(lineVo.getPaintDamageRatio());
525 createLineVo.setItemId(lineVo.getItemId()); 536 createLineVo.setItemId(lineVo.getItemId());
  537 + createLineVo.setInvoiceProductName(lineVo.getInvoiceProductName());
526 538
527 salesmanQuotationLineService.create(createLineVo); 539 salesmanQuotationLineService.create(createLineVo);
528 } 540 }
@@ -558,6 +570,7 @@ public class SalesmanQuotationServiceImpl @@ -558,6 +570,7 @@ public class SalesmanQuotationServiceImpl
558 if (StringUtils.isBlank(lineVo.getItemId())) { 570 if (StringUtils.isBlank(lineVo.getItemId())) {
559 lineVo.setItemId(oldLine.getItemId()); 571 lineVo.setItemId(oldLine.getItemId());
560 } 572 }
  573 + lineVo.setInvoiceProductName(lineVo.getInvoiceProductName());
561 salesmanQuotationLineService.update(lineVo); 574 salesmanQuotationLineService.update(lineVo);
562 } else { 575 } else {
563 CreateSalesmanQuotationLineVo createLineVo = new CreateSalesmanQuotationLineVo(); 576 CreateSalesmanQuotationLineVo createLineVo = new CreateSalesmanQuotationLineVo();
@@ -570,6 +583,7 @@ public class SalesmanQuotationServiceImpl @@ -570,6 +583,7 @@ public class SalesmanQuotationServiceImpl
570 createLineVo.setEstimatedLoss(lineVo.getEstimatedLoss()); 583 createLineVo.setEstimatedLoss(lineVo.getEstimatedLoss());
571 createLineVo.setItemId(lineVo.getItemId()); 584 createLineVo.setItemId(lineVo.getItemId());
572 createLineVo.setPaintDamageRatio(lineVo.getPaintDamageRatio()); 585 createLineVo.setPaintDamageRatio(lineVo.getPaintDamageRatio());
  586 + createLineVo.setInvoiceProductName(lineVo.getInvoiceProductName());
573 String lineId = salesmanQuotationLineService.create(createLineVo); 587 String lineId = salesmanQuotationLineService.create(createLineVo);
574 588
575 existIdList.add(lineId); 589 existIdList.add(lineId);
@@ -601,6 +615,30 @@ public class SalesmanQuotationServiceImpl @@ -601,6 +615,30 @@ public class SalesmanQuotationServiceImpl
601 } 615 }
602 616
603 /** 617 /**
  618 + * 合并明细开票品名(去重、排序、顿号连接)
  619 + *
  620 + * @param lines 明细列表
  621 + * @return 合并后的开票品名
  622 + */
  623 + private String joinDistinctInvoiceProductNames(List<? extends CreateSalesmanQuotationLineVo> lines) {
  624 + return lines.stream().map(CreateSalesmanQuotationLineVo::getInvoiceProductName)
  625 + .filter(StringUtil::isNotBlank).distinct().sorted()
  626 + .collect(Collectors.joining("、"));
  627 + }
  628 +
  629 + /**
  630 + * 合并明细开票品名(去重、排序、顿号连接)
  631 + *
  632 + * @param lines 明细列表
  633 + * @return 合并后的开票品名
  634 + */
  635 + private String joinDistinctInvoiceProductNames2(List<? extends SalesmanQuotationLine> lines) {
  636 + return lines.stream().map(SalesmanQuotationLine::getInvoiceProductName)
  637 + .filter(StringUtil::isNotBlank).distinct().sorted()
  638 + .collect(Collectors.joining("、"));
  639 + }
  640 +
  641 + /**
604 * 查询必填品种映射 642 * 查询必填品种映射
605 * 643 *
606 * @param productIds 品种ID集合 644 * @param productIds 品种ID集合
@@ -738,7 +776,11 @@ public class SalesmanQuotationServiceImpl @@ -738,7 +776,11 @@ public class SalesmanQuotationServiceImpl
738 vo.setQuantityBuyout(Boolean.TRUE.equals(salesmanQuotation.getQuantityBuyout())); 776 vo.setQuantityBuyout(Boolean.TRUE.equals(salesmanQuotation.getQuantityBuyout()));
739 vo.setDoorDelivery(Boolean.TRUE.equals(salesmanQuotation.getDoorDelivery())); 777 vo.setDoorDelivery(Boolean.TRUE.equals(salesmanQuotation.getDoorDelivery()));
740 vo.setLoadingFee(salesmanQuotation.getLoadingFee()); 778 vo.setLoadingFee(salesmanQuotation.getLoadingFee());
741 - vo.setInvoiceProductName(salesmanQuotation.getInvoiceProductName()); 779 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames2(lineList);
  780 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  781 + mergedInvoiceProductName = salesmanQuotation.getInvoiceProductName();
  782 + }
  783 + vo.setInvoiceProductName(mergedInvoiceProductName);
742 vo.setDeliveryDate(salesmanQuotation.getDeliveryDate()); 784 vo.setDeliveryDate(salesmanQuotation.getDeliveryDate());
743 vo.setSettlementMethod(salesmanQuotation.getSettlementMethod()); 785 vo.setSettlementMethod(salesmanQuotation.getSettlementMethod());
744 vo.setSettlementRatio(salesmanQuotation.getSettlementRatio()); 786 vo.setSettlementRatio(salesmanQuotation.getSettlementRatio());
@@ -769,6 +811,8 @@ public class SalesmanQuotationServiceImpl @@ -769,6 +811,8 @@ public class SalesmanQuotationServiceImpl
769 for (SalesmanQuotationLine line : lineList) { 811 for (SalesmanQuotationLine line : lineList) {
770 ProcurementPlanLineVo lineVo = new ProcurementPlanLineVo(); 812 ProcurementPlanLineVo lineVo = new ProcurementPlanLineVo();
771 lineVo.setProductId(line.getProductId()); 813 lineVo.setProductId(line.getProductId());
  814 + lineVo.setSalesmanQuotationLineId(line.getId());
  815 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
772 lineVo.setMaterialType(line.getMaterialType()); 816 lineVo.setMaterialType(line.getMaterialType());
773 lineVo.setQuantity(line.getQuantity()); 817 lineVo.setQuantity(line.getQuantity());
774 // 实际采购价 = 报价明细采购价 818 // 实际采购价 = 报价明细采购价
@@ -186,6 +186,11 @@ public class ProcurementPlanReplenishServiceImpl @@ -186,6 +186,11 @@ public class ProcurementPlanReplenishServiceImpl
186 BeanUtil.copyProperties(vo, replenish); 186 BeanUtil.copyProperties(vo, replenish);
187 // 设置ID 187 // 设置ID
188 replenish.setId(IdUtil.getId()); 188 replenish.setId(IdUtil.getId());
  189 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getProcurementPlanReplenishLineList());
  190 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  191 + mergedInvoiceProductName = vo.getInvoiceProductName();
  192 + }
  193 + replenish.setInvoiceProductName(mergedInvoiceProductName);
189 if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg") 194 if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg")
190 || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) { 195 || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) {
191 replenish.setProcessNode("CGCZG"); 196 replenish.setProcessNode("CGCZG");
@@ -204,6 +209,7 @@ public class ProcurementPlanReplenishServiceImpl @@ -204,6 +209,7 @@ public class ProcurementPlanReplenishServiceImpl
204 BeanUtil.copyProperties(lineVo, line); 209 BeanUtil.copyProperties(lineVo, line);
205 line.setId(IdUtil.getId()); 210 line.setId(IdUtil.getId());
206 line.setProcurementPlanReplenishId(replenish.getId()); 211 line.setProcurementPlanReplenishId(replenish.getId());
  212 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
207 lines.add(line); 213 lines.add(line);
208 } 214 }
209 } 215 }
@@ -241,6 +247,11 @@ public class ProcurementPlanReplenishServiceImpl @@ -241,6 +247,11 @@ public class ProcurementPlanReplenishServiceImpl
241 ProcurementPlanReplenish replenish = new ProcurementPlanReplenish(); 247 ProcurementPlanReplenish replenish = new ProcurementPlanReplenish();
242 BeanUtil.copyProperties(vo, replenish); 248 BeanUtil.copyProperties(vo, replenish);
243 replenish.setId(vo.getId()); 249 replenish.setId(vo.getId());
  250 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getProcurementPlanReplenishLineList());
  251 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  252 + mergedInvoiceProductName = vo.getInvoiceProductName();
  253 + }
  254 + replenish.setInvoiceProductName(mergedInvoiceProductName);
244 this.updateById(replenish); 255 this.updateById(replenish);
245 256
246 // 先删除明细后插入 257 // 先删除明细后插入
@@ -256,6 +267,7 @@ public class ProcurementPlanReplenishServiceImpl @@ -256,6 +267,7 @@ public class ProcurementPlanReplenishServiceImpl
256 BeanUtil.copyProperties(lineVo, line); 267 BeanUtil.copyProperties(lineVo, line);
257 line.setId(IdUtil.getId()); 268 line.setId(IdUtil.getId());
258 line.setProcurementPlanReplenishId(vo.getId()); 269 line.setProcurementPlanReplenishId(vo.getId());
  270 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
259 lines.add(line); 271 lines.add(line);
260 } 272 }
261 procurementPlanReplenishLineService.saveBatch(lines); 273 procurementPlanReplenishLineService.saveBatch(lines);
@@ -441,6 +453,7 @@ public class ProcurementPlanReplenishServiceImpl @@ -441,6 +453,7 @@ public class ProcurementPlanReplenishServiceImpl
441 ProcurementPlanLine nLine = BeanUtil.copyProperties(line, ProcurementPlanLine.class); 453 ProcurementPlanLine nLine = BeanUtil.copyProperties(line, ProcurementPlanLine.class);
442 nLine.setId(IdUtil.getId()); 454 nLine.setId(IdUtil.getId());
443 nLine.setProcurementPlanId(archivedMain.getId()); 455 nLine.setProcurementPlanId(archivedMain.getId());
  456 + nLine.setInvoiceProductName(line.getInvoiceProductName());
444 archivedMainLines.add(nLine); 457 archivedMainLines.add(nLine);
445 } 458 }
446 procurementPlanLineService.saveBatch(archivedMainLines); 459 procurementPlanLineService.saveBatch(archivedMainLines);
@@ -467,8 +480,7 @@ public class ProcurementPlanReplenishServiceImpl @@ -467,8 +480,7 @@ public class ProcurementPlanReplenishServiceImpl
467 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo(); 480 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo();
468 lineVo.setPlanLineId(line.getId()); 481 lineVo.setPlanLineId(line.getId());
469 lineVo.setItemId(IdUtil.getId()); 482 lineVo.setItemId(IdUtil.getId());
470 - //todo 开票品名逻辑需要修改  
471 - lineVo.setInvoiceProductName(procurementPlan.getInvoiceProductName()); 483 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
472 lineVo.setProductId(line.getProductId()); 484 lineVo.setProductId(line.getProductId());
473 lineVo.setQuantity(line.getQuantity()); 485 lineVo.setQuantity(line.getQuantity());
474 lineVo.setUnitPrice(line.getActualPurchasePrice()); 486 lineVo.setUnitPrice(line.getActualPurchasePrice());
@@ -545,6 +557,7 @@ public class ProcurementPlanReplenishServiceImpl @@ -545,6 +557,7 @@ public class ProcurementPlanReplenishServiceImpl
545 for (ProcurementPlanLine line : factoryLines) { 557 for (ProcurementPlanLine line : factoryLines) {
546 ProcurementPlanLineVo lineVo = BeanUtil.copyProperties(line, ProcurementPlanLineVo.class); 558 ProcurementPlanLineVo lineVo = BeanUtil.copyProperties(line, ProcurementPlanLineVo.class);
547 lineVo.setWorkshopId(line.getWorkshopId()); 559 lineVo.setWorkshopId(line.getWorkshopId());
  560 + lineVo.setProcurementPlanLineId(line.getId());
548 subLineVoList.add(lineVo); 561 subLineVoList.add(lineVo);
549 } 562 }
550 subVo.setProcurementPlanLineList(subLineVoList); 563 subVo.setProcurementPlanLineList(subLineVoList);
@@ -612,6 +625,11 @@ public class ProcurementPlanReplenishServiceImpl @@ -612,6 +625,11 @@ public class ProcurementPlanReplenishServiceImpl
612 // 更新主表字段 625 // 更新主表字段
613 ProcurementPlanReplenish replenish = new ProcurementPlanReplenish(); 626 ProcurementPlanReplenish replenish = new ProcurementPlanReplenish();
614 BeanUtil.copyProperties(vo, replenish); 627 BeanUtil.copyProperties(vo, replenish);
  628 + String mergedInvoiceProductName = joinDistinctInvoiceProductNames(vo.getProcurementPlanReplenishLineList());
  629 + if (StringUtil.isBlank(mergedInvoiceProductName)) {
  630 + mergedInvoiceProductName = vo.getInvoiceProductName();
  631 + }
  632 + replenish.setInvoiceProductName(mergedInvoiceProductName);
615 this.updateById(replenish); 633 this.updateById(replenish);
616 634
617 // 保存或更新明细 635 // 保存或更新明细
@@ -700,6 +718,7 @@ public class ProcurementPlanReplenishServiceImpl @@ -700,6 +718,7 @@ public class ProcurementPlanReplenishServiceImpl
700 .set(ProcurementPlanReplenishLine::getEstimatedLoss, lineVo.getEstimatedLoss()) 718 .set(ProcurementPlanReplenishLine::getEstimatedLoss, lineVo.getEstimatedLoss())
701 .set(ProcurementPlanReplenishLine::getApplicationAttrition, lineVo.getApplicationAttrition()) 719 .set(ProcurementPlanReplenishLine::getApplicationAttrition, lineVo.getApplicationAttrition())
702 .set(ProcurementPlanReplenishLine::getPaintDamageRatio, lineVo.getPaintDamageRatio()) 720 .set(ProcurementPlanReplenishLine::getPaintDamageRatio, lineVo.getPaintDamageRatio())
  721 + .set(ProcurementPlanReplenishLine::getInvoiceProductName, lineVo.getInvoiceProductName())
703 .set(ProcurementPlanReplenishLine::getWorkshopId, lineVo.getWorkshopId()) 722 .set(ProcurementPlanReplenishLine::getWorkshopId, lineVo.getWorkshopId())
704 .set(ProcurementPlanReplenishLine::getItemId, lineVo.getItemId()); 723 .set(ProcurementPlanReplenishLine::getItemId, lineVo.getItemId());
705 procurementPlanReplenishLineService.update(updateWrapper); 724 procurementPlanReplenishLineService.update(updateWrapper);
@@ -709,6 +728,7 @@ public class ProcurementPlanReplenishServiceImpl @@ -709,6 +728,7 @@ public class ProcurementPlanReplenishServiceImpl
709 BeanUtil.copyProperties(lineVo, ProcurementPlanReplenishLine.class); 728 BeanUtil.copyProperties(lineVo, ProcurementPlanReplenishLine.class);
710 createLine.setId(IdUtil.getId()); 729 createLine.setId(IdUtil.getId());
711 createLine.setProcurementPlanReplenishId(replenishId); 730 createLine.setProcurementPlanReplenishId(replenishId);
  731 + createLine.setInvoiceProductName(lineVo.getInvoiceProductName());
712 procurementPlanReplenishLineService.save(createLine); 732 procurementPlanReplenishLineService.save(createLine);
713 existIdList.add(createLine.getId()); 733 existIdList.add(createLine.getId());
714 } 734 }
@@ -728,6 +748,18 @@ public class ProcurementPlanReplenishServiceImpl @@ -728,6 +748,18 @@ public class ProcurementPlanReplenishServiceImpl
728 } 748 }
729 749
730 /** 750 /**
  751 + * 合并明细开票品名(去重、排序、顿号连接)
  752 + *
  753 + * @param lines 明细列表
  754 + * @return 合并后的开票品名
  755 + */
  756 + private String joinDistinctInvoiceProductNames(List<? extends CreateProcurementPlanReplenishLineVo> lines) {
  757 + return lines.stream().map(CreateProcurementPlanReplenishLineVo::getInvoiceProductName)
  758 + .filter(StringUtil::isNotBlank).distinct().sorted()
  759 + .collect(Collectors.joining("、"));
  760 + }
  761 +
  762 + /**
731 * 回填审核按钮展示信息 763 * 回填审核按钮展示信息
732 * 764 *
733 * @param datas 数据列表 765 * @param datas 数据列表
@@ -23,6 +23,12 @@ public class CreateProcurementPlanChangeLineVo implements BaseVo, Serializable { @@ -23,6 +23,12 @@ public class CreateProcurementPlanChangeLineVo implements BaseVo, Serializable {
23 private String productId; 23 private String productId;
24 24
25 /** 25 /**
  26 + * 采购主计划明细表ID
  27 + */
  28 + @ApiModelProperty(value = "采购主计划明细表ID", required = true)
  29 + private String procurementPlanLineId;
  30 +
  31 + /**
26 * 料型 32 * 料型
27 */ 33 */
28 @ApiModelProperty("料型") 34 @ApiModelProperty("料型")
@@ -87,6 +93,13 @@ public class CreateProcurementPlanChangeLineVo implements BaseVo, Serializable { @@ -87,6 +93,13 @@ public class CreateProcurementPlanChangeLineVo implements BaseVo, Serializable {
87 private BigDecimal paintDamageRatio; 93 private BigDecimal paintDamageRatio;
88 94
89 /** 95 /**
  96 + * 开票品名
  97 + */
  98 + @ApiModelProperty("开票品名")
  99 + @Length(max = 200, message = "开票品名最多允许200个字符!")
  100 + private String invoiceProductName;
  101 +
  102 + /**
90 * 分厂 103 * 分厂
91 */ 104 */
92 @ApiModelProperty("分厂") 105 @ApiModelProperty("分厂")
@@ -26,6 +26,18 @@ public class ProcurementPlanLineVo implements BaseVo, Serializable { @@ -26,6 +26,18 @@ public class ProcurementPlanLineVo implements BaseVo, Serializable {
26 private String procurementPlanId; 26 private String procurementPlanId;
27 27
28 /** 28 /**
  29 + * 业务员报价明细行ID
  30 + */
  31 + @ApiModelProperty("业务员报价明细行ID")
  32 + private String salesmanQuotationLineId;
  33 +
  34 + /**
  35 + * 采购主计划明细表ID
  36 + */
  37 + @ApiModelProperty("采购主计划明细表ID")
  38 + private String procurementPlanLineId;
  39 +
  40 + /**
29 * 品种ID 41 * 品种ID
30 */ 42 */
31 @ApiModelProperty(value = "品种ID", required = true) 43 @ApiModelProperty(value = "品种ID", required = true)
@@ -97,6 +109,13 @@ public class ProcurementPlanLineVo implements BaseVo, Serializable { @@ -97,6 +109,13 @@ public class ProcurementPlanLineVo implements BaseVo, Serializable {
97 private BigDecimal paintDamageRatio; 109 private BigDecimal paintDamageRatio;
98 110
99 /** 111 /**
  112 + * 开票品名
  113 + */
  114 + @ApiModelProperty("开票品名")
  115 + @Length(max = 200, message = "开票品名最多允许200个字符!")
  116 + private String invoiceProductName;
  117 +
  118 + /**
100 * 分厂 119 * 分厂
101 */ 120 */
102 @ApiModelProperty("分厂") 121 @ApiModelProperty("分厂")
@@ -72,6 +72,13 @@ public class CreateSalesmanQuotationLineVo implements BaseVo, Serializable { @@ -72,6 +72,13 @@ public class CreateSalesmanQuotationLineVo implements BaseVo, Serializable {
72 private BigDecimal paintDamageRatio; 72 private BigDecimal paintDamageRatio;
73 73
74 /** 74 /**
  75 + * 开票品名
  76 + */
  77 + @ApiModelProperty("开票品名")
  78 + @Length(max = 200, message = "开票品名最多允许200个字符!")
  79 + private String invoiceProductName;
  80 +
  81 + /**
75 * 前端行标识 82 * 前端行标识
76 */ 83 */
77 @ApiModelProperty("前端行标识") 84 @ApiModelProperty("前端行标识")
@@ -58,6 +58,10 @@ public class CreateProcurementPlanReplenishLineVo implements BaseVo, Serializabl @@ -58,6 +58,10 @@ public class CreateProcurementPlanReplenishLineVo implements BaseVo, Serializabl
58 @Digits(integer = 8, fraction = 10, message = "漆损率最多支持8位整数和10位小数!") 58 @Digits(integer = 8, fraction = 10, message = "漆损率最多支持8位整数和10位小数!")
59 private BigDecimal paintDamageRatio; 59 private BigDecimal paintDamageRatio;
60 60
  61 + @ApiModelProperty("开票品名")
  62 + @Length(max = 200, message = "开票品名最多允许200个字符!")
  63 + private String invoiceProductName;
  64 +
61 @ApiModelProperty("分厂") 65 @ApiModelProperty("分厂")
62 @Length(max = 50, message = "分厂最多允许50个字符!") 66 @Length(max = 50, message = "分厂最多允许50个字符!")
63 private String workshopId; 67 private String workshopId;
@@ -5,8 +5,10 @@ @@ -5,8 +5,10 @@
5 <resultMap id="ProcurementPlanChangeLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine"> 5 <resultMap id="ProcurementPlanChangeLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine">
6 <id column="id" property="id"/> 6 <id column="id" property="id"/>
7 <result column="procurement_plan_change_id" property="procurementPlanChangeId"/> 7 <result column="procurement_plan_change_id" property="procurementPlanChangeId"/>
  8 + <result column="procurement_plan_line_id" property="procurementPlanLineId"/>
8 <result column="product_id" property="productId"/> 9 <result column="product_id" property="productId"/>
9 <result column="material_type" property="materialType"/> 10 <result column="material_type" property="materialType"/>
  11 + <result column="invoice_product_name" property="invoiceProductName"/>
10 <result column="quantity" property="quantity"/> 12 <result column="quantity" property="quantity"/>
11 <result column="actual_purchase_price" property="actualPurchasePrice"/> 13 <result column="actual_purchase_price" property="actualPurchasePrice"/>
12 <result column="including_shipping_price" property="includingShippingPrice"/> 14 <result column="including_shipping_price" property="includingShippingPrice"/>
@@ -29,8 +31,10 @@ @@ -29,8 +31,10 @@
29 SELECT 31 SELECT
30 ppcl.id, 32 ppcl.id,
31 ppcl.procurement_plan_change_id, 33 ppcl.procurement_plan_change_id,
  34 + ppcl.procurement_plan_line_id,
32 ppcl.product_id, 35 ppcl.product_id,
33 ppcl.material_type, 36 ppcl.material_type,
  37 + ppcl.invoice_product_name,
34 ppcl.quantity, 38 ppcl.quantity,
35 ppcl.actual_purchase_price, 39 ppcl.actual_purchase_price,
36 ppcl.including_shipping_price, 40 ppcl.including_shipping_price,
@@ -5,6 +5,8 @@ @@ -5,6 +5,8 @@
5 <resultMap id="ProcurementPlanLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine"> 5 <resultMap id="ProcurementPlanLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine">
6 <id column="id" property="id"/> 6 <id column="id" property="id"/>
7 <result column="procurement_plan_id" property="procurementPlanId"/> 7 <result column="procurement_plan_id" property="procurementPlanId"/>
  8 + <result column="procurement_plan_line_id" property="procurementPlanLineId"/>
  9 + <result column="salesman_quotation_line_id" property="salesmanQuotationLineId"/>
8 <result column="product_id" property="productId"/> 10 <result column="product_id" property="productId"/>
9 <result column="product_name" property="productName"/> 11 <result column="product_name" property="productName"/>
10 <result column="material_type" property="materialType"/> 12 <result column="material_type" property="materialType"/>
@@ -18,6 +20,7 @@ @@ -18,6 +20,7 @@
18 <result column="paint_damage_ratio" property="paintDamageRatio"/> 20 <result column="paint_damage_ratio" property="paintDamageRatio"/>
19 <result column="workshop_id" property="workshopId"/> 21 <result column="workshop_id" property="workshopId"/>
20 <result column="workshop_name" property="workshopName"/> 22 <result column="workshop_name" property="workshopName"/>
  23 + <result column="invoice_product_name" property="invoiceProductName"/>
21 <result column="item_id" property="itemId"/> 24 <result column="item_id" property="itemId"/>
22 <result column="create_by_id" property="createById"/> 25 <result column="create_by_id" property="createById"/>
23 <result column="create_by" property="createBy"/> 26 <result column="create_by" property="createBy"/>
@@ -31,6 +34,8 @@ @@ -31,6 +34,8 @@
31 SELECT 34 SELECT
32 ppl.id, 35 ppl.id,
33 ppl.procurement_plan_id, 36 ppl.procurement_plan_id,
  37 + ppl.procurement_plan_line_id,
  38 + ppl.salesman_quotation_line_id,
34 ppl.product_id, 39 ppl.product_id,
35 br.product_name, 40 br.product_name,
36 ppl.material_type, 41 ppl.material_type,
@@ -44,6 +49,7 @@ @@ -44,6 +49,7 @@
44 ppl.paint_damage_ratio, 49 ppl.paint_damage_ratio,
45 ppl.workshop_id, 50 ppl.workshop_id,
46 ws.name AS workshop_name, 51 ws.name AS workshop_name,
  52 + ppl.invoice_product_name,
47 ppl.item_id, 53 ppl.item_id,
48 ppl.create_by_id, 54 ppl.create_by_id,
49 ppl.create_by, 55 ppl.create_by,
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 <result column="product_type" property="productType"/> 11 <result column="product_type" property="productType"/>
12 <result column="fixed_attrition_rate" property="fixedAttritionRate"/> 12 <result column="fixed_attrition_rate" property="fixedAttritionRate"/>
13 <result column="material_type" property="materialType"/> 13 <result column="material_type" property="materialType"/>
  14 + <result column="invoice_product_name" property="invoiceProductName"/>
14 <result column="quantity" property="quantity"/> 15 <result column="quantity" property="quantity"/>
15 <result column="purchase_price" property="purchasePrice"/> 16 <result column="purchase_price" property="purchasePrice"/>
16 <result column="estimated_loss" property="estimatedLoss"/> 17 <result column="estimated_loss" property="estimatedLoss"/>
@@ -38,6 +39,7 @@ @@ -38,6 +39,7 @@
38 br.type AS product_type, 39 br.type AS product_type,
39 br.attrition_rate AS fixed_attrition_rate, 40 br.attrition_rate AS fixed_attrition_rate,
40 tb.material_type, 41 tb.material_type,
  42 + tb.invoice_product_name,
41 tb.quantity, 43 tb.quantity,
42 tb.purchase_price, 44 tb.purchase_price,
43 tb.estimated_loss, 45 tb.estimated_loss,
@@ -72,6 +74,8 @@ @@ -72,6 +74,8 @@
72 sq.quoter_name, 74 sq.quoter_name,
73 pdc.unit_name AS supplier_name, 75 pdc.unit_name AS supplier_name,
74 br.product_name, 76 br.product_name,
  77 + tb.material_type,
  78 + tb.invoice_product_name,
75 tb.quantity, 79 tb.quantity,
76 tb.purchase_price, 80 tb.purchase_price,
77 tb.paint_damage_ratio, 81 tb.paint_damage_ratio,
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 <result column="product_id" property="productId"/> 8 <result column="product_id" property="productId"/>
9 <result column="product_name" property="productName"/> 9 <result column="product_name" property="productName"/>
10 <result column="material_type" property="materialType"/> 10 <result column="material_type" property="materialType"/>
  11 + <result column="invoice_product_name" property="invoiceProductName"/>
11 <result column="quantity" property="quantity"/> 12 <result column="quantity" property="quantity"/>
12 <result column="actual_purchase_price" property="actualPurchasePrice"/> 13 <result column="actual_purchase_price" property="actualPurchasePrice"/>
13 <result column="including_shipping_price" property="includingShippingPrice"/> 14 <result column="including_shipping_price" property="includingShippingPrice"/>
@@ -34,6 +35,7 @@ @@ -34,6 +35,7 @@
34 pprl.product_id, 35 pprl.product_id,
35 br.product_name, 36 br.product_name,
36 pprl.material_type, 37 pprl.material_type,
  38 + pprl.invoice_product_name,
37 pprl.quantity, 39 pprl.quantity,
38 pprl.actual_purchase_price, 40 pprl.actual_purchase_price,
39 pprl.including_shipping_price, 41 pprl.including_shipping_price,