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 1756 `estimated_loss` decimal(18, 10) DEFAULT NULL COMMENT '买断料预计损耗',
1757 1757 `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',
1758 1758 `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',
  1759 + `invoice_product_name` varchar(200) NOT NULL COMMENT '开票品名',
1759 1760 `item_id` varchar(32) NOT NULL COMMENT '前端行标识',
1760 1761 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
1761 1762 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
... ... @@ -1964,26 +1965,29 @@ CREATE TABLE `procurement_plan`
1964 1965
1965 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 1991 PRIMARY KEY (`id`),
1988 1992 KEY `idx_ppl_procurement_plan_id` (`procurement_plan_id`),
1989 1993 KEY `idx_ppl_product_id` (`product_id`),
... ... @@ -2134,6 +2138,8 @@ CREATE TABLE `procurement_plan_change_line`
2134 2138 `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',
2135 2139 `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',
2136 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 2143 `item_id` varchar(32) NOT NULL COMMENT '前端行标识',
2138 2144 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
2139 2145 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
... ... @@ -2227,6 +2233,7 @@ CREATE TABLE `procurement_plan_replenish_line`
2227 2233 `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',
2228 2234 `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',
2229 2235 `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂',
  2236 + `invoice_product_name` varchar(200) NOT NULL COMMENT '开票品名',
2230 2237 `item_id` varchar(32) NOT NULL COMMENT '前端行标识',
2231 2238 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
2232 2239 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
... ... @@ -2385,7 +2392,7 @@ CREATE TABLE `procurement_contract_line`
2385 2392 `id` VARCHAR(32) NOT NULL COMMENT '主键ID',
2386 2393 `contract_id` VARCHAR(32) NOT NULL COMMENT '采购合同主表ID',
2387 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 2396 `product_id` VARCHAR(32) NOT NULL COMMENT '规格型号ID',
2390 2397 `quantity` DECIMAL(18, 4) NOT NULL DEFAULT 0 COMMENT '数量',
2391 2398 `unit_price` DECIMAL(18, 4) NOT NULL DEFAULT 0 COMMENT '单价',
... ... @@ -2404,3 +2411,11 @@ CREATE TABLE `procurement_contract_line`
2404 2411 KEY `idx_pcl_contract_id` (`contract_id`),
2405 2412 KEY `idx_pcl_product_id` (`product_id`)
2406 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 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 548 * 品种ID
537 549 */
538 550 @ApiModelProperty("品种ID")
... ... @@ -551,6 +563,12 @@ public class GetProcurementPlanBo extends BaseBo<ProcurementPlan> {
551 563 private String materialType;
552 564
553 565 /**
  566 + * 开票品名
  567 + */
  568 + @ApiModelProperty("开票品名")
  569 + private String invoiceProductName;
  570 +
  571 + /**
554 572 * 数量
555 573 */
556 574 @ApiModelProperty("数量")
... ...
... ... @@ -25,6 +25,12 @@ public class GetProcurementPlanChangeLineBo extends BaseBo<ProcurementPlanChange
25 25 private String procurementPlanChangeId;
26 26
27 27 /**
  28 + * 采购主计划明细表ID
  29 + */
  30 + @ApiModelProperty("采购主计划明细表ID")
  31 + private String procurementPlanLineId;
  32 +
  33 + /**
28 34 * 品种ID
29 35 */
30 36 @ApiModelProperty("品种ID")
... ... @@ -37,6 +43,12 @@ public class GetProcurementPlanChangeLineBo extends BaseBo<ProcurementPlanChange
37 43 private String materialType;
38 44
39 45 /**
  46 + * 开票品名
  47 + */
  48 + @ApiModelProperty("开票品名")
  49 + private String invoiceProductName;
  50 +
  51 + /**
40 52 * 数量
41 53 */
42 54 @ApiModelProperty("数量")
... ...
... ... @@ -43,6 +43,12 @@ public class GetProcurementPlanReplenishLineBo extends BaseBo<ProcurementPlanRep
43 43 private String materialType;
44 44
45 45 /**
  46 + * 开票品名
  47 + */
  48 + @ApiModelProperty("开票品名")
  49 + private String invoiceProductName;
  50 +
  51 + /**
46 52 * 数量
47 53 */
48 54 @ApiModelProperty("数量")
... ...
... ... @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
5 5 import com.baomidou.mybatisplus.annotation.TableName;
6 6 import com.lframework.starter.web.core.dto.BaseDto;
7 7 import com.lframework.starter.web.core.entity.BaseEntity;
  8 +import io.swagger.annotations.ApiModelProperty;
8 9 import lombok.Data;
9 10 import java.math.BigDecimal;
10 11 import java.time.LocalDateTime;
... ... @@ -26,6 +27,11 @@ public class ProcurementPlanChangeLine extends BaseEntity implements BaseDto {
26 27 private String procurementPlanChangeId;
27 28
28 29 /**
  30 + * 采购主计划明细表ID
  31 + */
  32 + private String procurementPlanLineId;
  33 +
  34 + /**
29 35 * 品种ID
30 36 */
31 37 private String productId;
... ... @@ -76,6 +82,11 @@ public class ProcurementPlanChangeLine extends BaseEntity implements BaseDto {
76 82 private BigDecimal paintDamageRatio;
77 83
78 84 /**
  85 + * 开票品名
  86 + */
  87 + private String invoiceProductName;
  88 +
  89 + /**
79 90 * 分厂
80 91 */
81 92 private String workshopId;
... ...
... ... @@ -28,6 +28,16 @@ public class ProcurementPlanLine extends BaseEntity implements BaseDto {
28 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 41 * 品种ID
32 42 */
33 43 private String productId;
... ... @@ -84,6 +94,11 @@ public class ProcurementPlanLine extends BaseEntity implements BaseDto {
84 94 private BigDecimal paintDamageRatio;
85 95
86 96 /**
  97 + * 开票品名
  98 + */
  99 + private String invoiceProductName;
  100 +
  101 + /**
87 102 * 分厂
88 103 */
89 104 private String workshopId;
... ...
... ... @@ -90,6 +90,11 @@ public class SalesmanQuotationLine extends BaseEntity implements BaseDto {
90 90 private BigDecimal paintDamageRatio;
91 91
92 92 /**
  93 + * 开票品名
  94 + */
  95 + private String invoiceProductName;
  96 +
  97 + /**
93 98 * 前端行标识
94 99 */
95 100 private String itemId;
... ...
... ... @@ -77,6 +77,11 @@ public class ProcurementPlanReplenishLine extends BaseEntity implements BaseDto
77 77 private BigDecimal paintDamageRatio;
78 78
79 79 /**
  80 + * 开票品名
  81 + */
  82 + private String invoiceProductName;
  83 +
  84 + /**
80 85 * 分厂
81 86 */
82 87 private String workshopId;
... ...
... ... @@ -122,15 +122,23 @@ public class ProcurementPlanChangeServiceImpl extends
122 122 planChange.setId(IdUtil.getId());
123 123 planChange.setCode("K" + vo.getCode());
124 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 130 this.save(planChange);
126 131
127 132 List<ProcurementPlanChangeLine> lines = new ArrayList<>();
  133 + Map<String, String> invoiceProductNameMap = new HashMap<>();
128 134 if (!CollectionUtil.isEmpty(vo.getLines())) {
129 135 for (CreateProcurementPlanChangeLineVo lineVo : vo.getLines()) {
130 136 ProcurementPlanChangeLine line = new ProcurementPlanChangeLine();
131 137 BeanUtil.copyProperties(lineVo, line);
132 138 line.setId(IdUtil.getId());
133 139 line.setProcurementPlanChangeId(planChange.getId());
  140 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
  141 + invoiceProductNameMap.put(lineVo.getProcurementPlanLineId(), lineVo.getInvoiceProductName());
134 142 lines.add(line);
135 143 }
136 144 }
... ... @@ -161,7 +169,6 @@ public class ProcurementPlanChangeServiceImpl extends
161 169 vo1.setProcurementPlanId(vo.getProcurementPlanId());
162 170 procurementBuyoutApplyService.create(vo1);
163 171 } else {
164   - //todo 开票品名变更会改到
165 172 //变更的是主计划(开票品名 公司名称 另付运费) 直接修改主计划的数据、合同数据、子计划数据(含运到厂价),子计划买断操作申请单(如果只有主计划就只生成主计划的买断操作申请单)
166 173 Wrapper<ProcurementPlan> queryWrapper = Wrappers.lambdaQuery(ProcurementPlan.class)
167 174 .eq(ProcurementPlan::getFrozen, false)
... ... @@ -178,7 +185,7 @@ public class ProcurementPlanChangeServiceImpl extends
178 185 planType = "变 补";
179 186 }
180 187 Wrapper<ProcurementPlan> parentWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
181   - .set(ProcurementPlan::getInvoiceProductName, vo.getInvoiceProductName())
  188 + .set(ProcurementPlan::getInvoiceProductName, mergedInvoiceProductName)
182 189 .set(ProcurementPlan::getCompanyShortId, vo.getCompanyShortId())
183 190 .set(ProcurementPlan::getShippingCost, vo.getShippingCost())
184 191 .set(ProcurementPlan::getProcessStatus, "COMPLETED")
... ... @@ -186,7 +193,7 @@ public class ProcurementPlanChangeServiceImpl extends
186 193 .set(ProcurementPlan::getPlanType, planType)
187 194 .eq(ProcurementPlan::getId, vo.getProcurementPlanId());
188 195 procurementPlanService.update(parentWrapper);
189   - //修改含运到厂价
  196 + //修改含运到厂价、修改主计划明细表开票品名
190 197 List<ProcurementPlanLine> lineList = procurementPlanLineService.list(
191 198 Wrappers.lambdaQuery(ProcurementPlanLine.class)
192 199 .eq(ProcurementPlanLine::getProcurementPlanId, vo.getProcurementPlanId())
... ... @@ -198,14 +205,14 @@ public class ProcurementPlanChangeServiceImpl extends
198 205
199 206 Wrapper<ProcurementPlanLine> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanLine.class)
200 207 .set(ProcurementPlanLine::getIncludingShippingPrice, newPrice)
  208 + .set(ProcurementPlanLine::getInvoiceProductName, invoiceProductNameMap.get(line.getId()))
201 209 .eq(ProcurementPlanLine::getId, line.getId());
202 210 procurementPlanLineService.update(updateWrapper);
203 211 }
204 212 }
205 213
206   - //修改子计划 开票品名 公司名称 另付运费
  214 + //修改子计划 公司名称 另付运费
207 215 Wrapper<ProcurementPlan> sonWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
208   - .set(ProcurementPlan::getInvoiceProductName, vo.getInvoiceProductName())
209 216 .set(ProcurementPlan::getCompanyShortId, vo.getCompanyShortId())
210 217 .set(ProcurementPlan::getShippingCost, vo.getShippingCost())
211 218 .set(ProcurementPlan::getProcessStatus, "COMPLETED")
... ... @@ -215,6 +222,7 @@ public class ProcurementPlanChangeServiceImpl extends
215 222 .eq(ProcurementPlan::getParentId, vo.getProcurementPlanId());
216 223 procurementPlanService.update(sonWrapper);
217 224
  225 + //先修改子计划中明细表开票品名数据
218 226 for (ProcurementPlan procurementPlan : list) {
219 227 //修改含运到厂价
220 228 List<ProcurementPlanLine> lineList1 = procurementPlanLineService.list(
... ... @@ -228,10 +236,20 @@ public class ProcurementPlanChangeServiceImpl extends
228 236
229 237 Wrapper<ProcurementPlanLine> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanLine.class)
230 238 .set(ProcurementPlanLine::getIncludingShippingPrice, newPrice)
  239 + .set(ProcurementPlanLine::getInvoiceProductName, invoiceProductNameMap.get(line.getProcurementPlanLineId()))
231 240 .eq(ProcurementPlanLine::getId, line.getId());
232 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 254 procurementBuyoutApplyService.deleteByPlanId(procurementPlan.getId());
237 255 //重新生成子计划买断操作申请单
... ... @@ -243,7 +261,7 @@ public class ProcurementPlanChangeServiceImpl extends
243 261 //没有子计划
244 262 //修改 开票品名 公司名称 另付运费
245 263 Wrapper<ProcurementPlan> parentWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
246   - .set(ProcurementPlan::getInvoiceProductName, vo.getInvoiceProductName())
  264 + .set(ProcurementPlan::getInvoiceProductName, mergedInvoiceProductName)
247 265 .set(ProcurementPlan::getCompanyShortId, vo.getCompanyShortId())
248 266 .set(ProcurementPlan::getShippingCost, vo.getShippingCost())
249 267 .set(ProcurementPlan::getWorkshopId, vo.getLines().get(0).getWorkshopId())
... ... @@ -251,7 +269,7 @@ public class ProcurementPlanChangeServiceImpl extends
251 269 .set(ProcurementPlan::getProcessNode, null)
252 270 .eq(ProcurementPlan::getId, vo.getProcurementPlanId());
253 271 procurementPlanService.update(parentWrapper);
254   - //修改含运到厂价
  272 + //修改含运到厂价、开票品名
255 273 List<ProcurementPlanLine> lineList = procurementPlanLineService.list(
256 274 Wrappers.lambdaQuery(ProcurementPlanLine.class)
257 275 .eq(ProcurementPlanLine::getProcurementPlanId, vo.getProcurementPlanId())
... ... @@ -263,6 +281,7 @@ public class ProcurementPlanChangeServiceImpl extends
263 281
264 282 Wrapper<ProcurementPlanLine> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlanLine.class)
265 283 .set(ProcurementPlanLine::getIncludingShippingPrice, newPrice)
  284 + .set(ProcurementPlanLine::getInvoiceProductName, invoiceProductNameMap.get(line.getId()))
266 285 .eq(ProcurementPlanLine::getId, line.getId());
267 286 procurementPlanLineService.update(updateWrapper);
268 287 }
... ... @@ -297,8 +316,7 @@ public class ProcurementPlanChangeServiceImpl extends
297 316 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo();
298 317 lineVo.setPlanLineId(line.getId());
299 318 lineVo.setItemId(IdUtil.getId());
300   - //todo 开票品名逻辑需要修改
301   - lineVo.setInvoiceProductName(procurementPlan.getInvoiceProductName());
  319 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
302 320 lineVo.setProductId(line.getProductId());
303 321 lineVo.setQuantity(line.getQuantity());
304 322 lineVo.setUnitPrice(line.getActualPurchasePrice());
... ... @@ -317,6 +335,11 @@ public class ProcurementPlanChangeServiceImpl extends
317 335 ProcurementPlanChange planChange = new ProcurementPlanChange();
318 336 BeanUtil.copyProperties(vo, planChange);
319 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 343 if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg")
321 344 || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) {
322 345 planChange.setProcessNode("CGCZG");
... ... @@ -336,6 +359,7 @@ public class ProcurementPlanChangeServiceImpl extends
336 359 BeanUtil.copyProperties(lineVo, line);
337 360 line.setId(IdUtil.getId());
338 361 line.setProcurementPlanChangeId(planChange.getId());
  362 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
339 363 lines.add(line);
340 364 }
341 365 }
... ... @@ -367,6 +391,11 @@ public class ProcurementPlanChangeServiceImpl extends
367 391 }
368 392 ProcurementPlanChange planChange = new ProcurementPlanChange();
369 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 399 this.updateById(planChange);
371 400 //保存或更新采购计划变更单明细
372 401 saveOrUpdateLines(vo.getId(), vo.getLines());
... ... @@ -593,18 +622,26 @@ public class ProcurementPlanChangeServiceImpl extends
593 622 .setEntity(updatedMain)
594 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 626 if (CollectionUtil.isNotEmpty(changeLines)) {
600   - List<ProcurementPlanLine> newLines = new ArrayList<>();
601 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 647 // 4) 根据变更后明细的分厂分组,从_(N+1)开始生成新子计划
... ... @@ -738,8 +775,7 @@ public class ProcurementPlanChangeServiceImpl extends
738 775 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo();
739 776 lineVo.setPlanLineId(line.getId());
740 777 lineVo.setItemId(IdUtil.getId());
741   - //todo 开票品名逻辑需要修改
742   - lineVo.setInvoiceProductName(procurementPlan.getInvoiceProductName());
  778 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
743 779 lineVo.setProductId(line.getProductId());
744 780 lineVo.setQuantity(line.getQuantity());
745 781 lineVo.setUnitPrice(line.getActualPurchasePrice());
... ... @@ -839,6 +875,11 @@ public class ProcurementPlanChangeServiceImpl extends
839 875 // 更新主表字段
840 876 ProcurementPlanChange planChange = new ProcurementPlanChange();
841 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 883 this.updateById(planChange);
843 884
844 885 //保存或更新采购计划变更单明细
... ... @@ -918,7 +959,6 @@ public class ProcurementPlanChangeServiceImpl extends
918 959 if (StringUtil.isBlank(lineVo.getItemId())) {
919 960 lineVo.setItemId(oldLine.getItemId());
920 961 }
921   - log.error("workshopId====" + lineVo.getWorkshopId());
922 962 LambdaUpdateWrapper<ProcurementPlanChangeLine> updateWrapper = new LambdaUpdateWrapper<>(ProcurementPlanChangeLine.class);
923 963 updateWrapper.eq(ProcurementPlanChangeLine::getId, lineVo.getId())
924 964 .set(ProcurementPlanChangeLine::getProcurementPlanChangeId, finalChangeId)
... ... @@ -932,6 +972,7 @@ public class ProcurementPlanChangeServiceImpl extends
932 972 .set(ProcurementPlanChangeLine::getEstimatedLoss, lineVo.getEstimatedLoss())
933 973 .set(ProcurementPlanChangeLine::getApplicationAttrition, lineVo.getApplicationAttrition())
934 974 .set(ProcurementPlanChangeLine::getPaintDamageRatio, lineVo.getPaintDamageRatio())
  975 + .set(ProcurementPlanChangeLine::getInvoiceProductName, lineVo.getInvoiceProductName())
935 976 .set(ProcurementPlanChangeLine::getWorkshopId, lineVo.getWorkshopId())
936 977 .set(ProcurementPlanChangeLine::getItemId, lineVo.getItemId());
937 978 procurementPlanChangeLineService.update(updateWrapper);
... ... @@ -939,6 +980,7 @@ public class ProcurementPlanChangeServiceImpl extends
939 980 ProcurementPlanChangeLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanChangeLine.class);
940 981 createLine.setId(IdUtil.getId());
941 982 createLine.setProcurementPlanChangeId(finalChangeId);
  983 + createLine.setInvoiceProductName(lineVo.getInvoiceProductName());
942 984 procurementPlanChangeLineService.save(createLine);
943 985 existIdList.add(createLine.getId());
944 986 }
... ... @@ -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 1026 * @param datas 数据列表
... ...
... ... @@ -186,6 +186,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
186 186 }
187 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 195 String currentUserId = SecurityUtil.getCurrentUser().getId();
190 196 List<SysRole> roles = sysRoleService.getByUserId(currentUserId);
191 197 List<String> roleCodes = CollectionUtil.isEmpty(roles) ? new java.util.ArrayList<>()
... ... @@ -213,6 +219,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
213 219 ProcurementPlanLine line = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class);
214 220 line.setId(IdUtil.getId());
215 221 line.setProcurementPlanId(plan.getId());
  222 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
  223 + line.setSalesmanQuotationLineId(lineVo.getSalesmanQuotationLineId());
216 224 procurementPlanLineService.save(line);
217 225 }
218 226 }
... ... @@ -243,6 +251,12 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
243 251 }
244 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 260 Wrapper<ProcurementPlan> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
247 261 .eq(ProcurementPlan::getId, vo.getId());
248 262
... ... @@ -280,6 +294,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
280 294 LambdaUpdateWrapper<ProcurementPlanLine> updateWrapper = new LambdaUpdateWrapper<>(ProcurementPlanLine.class);
281 295 updateWrapper.eq(ProcurementPlanLine::getId, lineVo.getId())
282 296 .set(ProcurementPlanLine::getProcurementPlanId, lineVo.getProcurementPlanId())
  297 + .set(ProcurementPlanLine::getSalesmanQuotationLineId, lineVo.getSalesmanQuotationLineId())
283 298 .set(ProcurementPlanLine::getProductId, lineVo.getProductId())
284 299 .set(ProcurementPlanLine::getMaterialType, lineVo.getMaterialType())
285 300 .set(ProcurementPlanLine::getQuantity, lineVo.getQuantity())
... ... @@ -290,6 +305,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
290 305 .set(ProcurementPlanLine::getEstimatedLoss, lineVo.getEstimatedLoss())
291 306 .set(ProcurementPlanLine::getApplicationAttrition, lineVo.getApplicationAttrition())
292 307 .set(ProcurementPlanLine::getPaintDamageRatio, lineVo.getPaintDamageRatio())
  308 + .set(ProcurementPlanLine::getInvoiceProductName, lineVo.getInvoiceProductName())
293 309 .set(ProcurementPlanLine::getWorkshopId, lineVo.getWorkshopId())
294 310 .set(ProcurementPlanLine::getItemId, lineVo.getItemId());
295 311 procurementPlanLineService.update(updateWrapper);
... ... @@ -297,6 +313,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
297 313 ProcurementPlanLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class);
298 314 createLine.setId(IdUtil.getId());
299 315 createLine.setProcurementPlanId(procurementPlanId);
  316 + createLine.setInvoiceProductName(lineVo.getInvoiceProductName());
  317 + createLine.setSalesmanQuotationLineId(lineVo.getSalesmanQuotationLineId());
300 318 procurementPlanLineService.save(createLine);
301 319 existIdList.add(createLine.getId());
302 320 }
... ... @@ -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 345 @Transactional(rollbackFor = Exception.class)
316 346 @Override
317 347 public void deleteById(String id) {
... ... @@ -359,8 +389,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
359 389 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo();
360 390 lineVo.setPlanLineId(line.getId());
361 391 lineVo.setItemId(IdUtil.getId());
362   - //todo 开票品名逻辑需要修改
363   - lineVo.setInvoiceProductName(procurementPlan.getInvoiceProductName());
  392 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
364 393 lineVo.setProductId(line.getProductId());
365 394 lineVo.setQuantity(line.getQuantity());
366 395 lineVo.setUnitPrice(line.getActualPurchasePrice());
... ... @@ -474,6 +503,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
474 503 for (ProcurementPlanLine line : factoryLines) {
475 504 ProcurementPlanLineVo lineVo = BeanUtil.copyProperties(line, ProcurementPlanLineVo.class);
476 505 lineVo.setWorkshopId(line.getWorkshopId());
  506 + lineVo.setProcurementPlanLineId(line.getId());
477 507 subLineVoList.add(lineVo);
478 508 }
479 509 subVo.setProcurementPlanLineList(subLineVoList);
... ... @@ -734,6 +764,11 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
734 764 if (StringUtils.isEmpty(plan.getCreateById())) {
735 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 772 getBaseMapper().insert(plan);
738 773
739 774 if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) {
... ...
... ... @@ -108,6 +108,7 @@ public class SalesmanQuotationLineServiceImpl
108 108 data.setEstimatedLoss(vo.getEstimatedLoss());
109 109 data.setPaintDamageRatio(vo.getPaintDamageRatio());
110 110 data.setItemId(vo.getItemId());
  111 + data.setInvoiceProductName(vo.getInvoiceProductName());
111 112
112 113 getBaseMapper().insert(data);
113 114
... ... @@ -140,6 +141,7 @@ public class SalesmanQuotationLineServiceImpl
140 141 .set(SalesmanQuotationLine::getEstimatedLoss, vo.getEstimatedLoss())
141 142 .set(SalesmanQuotationLine::getPaintDamageRatio, vo.getPaintDamageRatio())
142 143 .set(SalesmanQuotationLine::getItemId, StringUtils.defaultIfBlank(vo.getItemId(), data.getItemId()))
  144 + .set(SalesmanQuotationLine::getInvoiceProductName, vo.getInvoiceProductName())
143 145 .eq(SalesmanQuotationLine::getId, vo.getId());
144 146
145 147 getBaseMapper().update(updateWrapper);
... ...
... ... @@ -15,6 +15,7 @@ import com.lframework.starter.common.exceptions.impl.DefaultClientException;
15 15 import com.lframework.starter.common.utils.Assert;
16 16 import com.lframework.starter.common.utils.CollectionUtil;
17 17 import com.lframework.starter.common.utils.ObjectUtil;
  18 +import com.lframework.starter.common.utils.StringUtil;
18 19 import com.lframework.starter.web.core.annotations.oplog.OpLog;
19 20 import com.lframework.starter.web.core.components.resp.PageResult;
20 21 import com.lframework.starter.web.core.components.security.SecurityUtil;
... ... @@ -178,6 +179,11 @@ public class SalesmanQuotationServiceImpl
178 179 .map(CreateSalesmanQuotationLineVo::getProductId)
179 180 .collect(Collectors.toList()));
180 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 187 getBaseMapper().insert(data);
182 188
183 189 saveCreateLines(data.getId(), vo.getQuotationLineList(), quotationBreedMap, vo.getPriced());
... ... @@ -235,6 +241,11 @@ public class SalesmanQuotationServiceImpl
235 241 .map(UpdateSalesmanQuotationLineVo::getProductId)
236 242 .collect(Collectors.toList()));
237 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 249 getBaseMapper().updateById(data);
239 250
240 251 saveOrUpdateLines(data.getId(), vo.getQuotationLineList(), quotationBreedMap, vo.getPriced());
... ... @@ -523,6 +534,7 @@ public class SalesmanQuotationServiceImpl
523 534 createLineVo.setEstimatedLoss(lineVo.getEstimatedLoss());
524 535 createLineVo.setPaintDamageRatio(lineVo.getPaintDamageRatio());
525 536 createLineVo.setItemId(lineVo.getItemId());
  537 + createLineVo.setInvoiceProductName(lineVo.getInvoiceProductName());
526 538
527 539 salesmanQuotationLineService.create(createLineVo);
528 540 }
... ... @@ -558,6 +570,7 @@ public class SalesmanQuotationServiceImpl
558 570 if (StringUtils.isBlank(lineVo.getItemId())) {
559 571 lineVo.setItemId(oldLine.getItemId());
560 572 }
  573 + lineVo.setInvoiceProductName(lineVo.getInvoiceProductName());
561 574 salesmanQuotationLineService.update(lineVo);
562 575 } else {
563 576 CreateSalesmanQuotationLineVo createLineVo = new CreateSalesmanQuotationLineVo();
... ... @@ -570,6 +583,7 @@ public class SalesmanQuotationServiceImpl
570 583 createLineVo.setEstimatedLoss(lineVo.getEstimatedLoss());
571 584 createLineVo.setItemId(lineVo.getItemId());
572 585 createLineVo.setPaintDamageRatio(lineVo.getPaintDamageRatio());
  586 + createLineVo.setInvoiceProductName(lineVo.getInvoiceProductName());
573 587 String lineId = salesmanQuotationLineService.create(createLineVo);
574 588
575 589 existIdList.add(lineId);
... ... @@ -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 644 * @param productIds 品种ID集合
... ... @@ -738,7 +776,11 @@ public class SalesmanQuotationServiceImpl
738 776 vo.setQuantityBuyout(Boolean.TRUE.equals(salesmanQuotation.getQuantityBuyout()));
739 777 vo.setDoorDelivery(Boolean.TRUE.equals(salesmanQuotation.getDoorDelivery()));
740 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 784 vo.setDeliveryDate(salesmanQuotation.getDeliveryDate());
743 785 vo.setSettlementMethod(salesmanQuotation.getSettlementMethod());
744 786 vo.setSettlementRatio(salesmanQuotation.getSettlementRatio());
... ... @@ -769,6 +811,8 @@ public class SalesmanQuotationServiceImpl
769 811 for (SalesmanQuotationLine line : lineList) {
770 812 ProcurementPlanLineVo lineVo = new ProcurementPlanLineVo();
771 813 lineVo.setProductId(line.getProductId());
  814 + lineVo.setSalesmanQuotationLineId(line.getId());
  815 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
772 816 lineVo.setMaterialType(line.getMaterialType());
773 817 lineVo.setQuantity(line.getQuantity());
774 818 // 实际采购价 = 报价明细采购价
... ...
... ... @@ -186,6 +186,11 @@ public class ProcurementPlanReplenishServiceImpl
186 186 BeanUtil.copyProperties(vo, replenish);
187 187 // 设置ID
188 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 194 if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg")
190 195 || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) {
191 196 replenish.setProcessNode("CGCZG");
... ... @@ -204,6 +209,7 @@ public class ProcurementPlanReplenishServiceImpl
204 209 BeanUtil.copyProperties(lineVo, line);
205 210 line.setId(IdUtil.getId());
206 211 line.setProcurementPlanReplenishId(replenish.getId());
  212 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
207 213 lines.add(line);
208 214 }
209 215 }
... ... @@ -241,6 +247,11 @@ public class ProcurementPlanReplenishServiceImpl
241 247 ProcurementPlanReplenish replenish = new ProcurementPlanReplenish();
242 248 BeanUtil.copyProperties(vo, replenish);
243 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 255 this.updateById(replenish);
245 256
246 257 // 先删除明细后插入
... ... @@ -256,6 +267,7 @@ public class ProcurementPlanReplenishServiceImpl
256 267 BeanUtil.copyProperties(lineVo, line);
257 268 line.setId(IdUtil.getId());
258 269 line.setProcurementPlanReplenishId(vo.getId());
  270 + line.setInvoiceProductName(lineVo.getInvoiceProductName());
259 271 lines.add(line);
260 272 }
261 273 procurementPlanReplenishLineService.saveBatch(lines);
... ... @@ -441,6 +453,7 @@ public class ProcurementPlanReplenishServiceImpl
441 453 ProcurementPlanLine nLine = BeanUtil.copyProperties(line, ProcurementPlanLine.class);
442 454 nLine.setId(IdUtil.getId());
443 455 nLine.setProcurementPlanId(archivedMain.getId());
  456 + nLine.setInvoiceProductName(line.getInvoiceProductName());
444 457 archivedMainLines.add(nLine);
445 458 }
446 459 procurementPlanLineService.saveBatch(archivedMainLines);
... ... @@ -467,8 +480,7 @@ public class ProcurementPlanReplenishServiceImpl
467 480 CreateProcurementContractLineVo lineVo = new CreateProcurementContractLineVo();
468 481 lineVo.setPlanLineId(line.getId());
469 482 lineVo.setItemId(IdUtil.getId());
470   - //todo 开票品名逻辑需要修改
471   - lineVo.setInvoiceProductName(procurementPlan.getInvoiceProductName());
  483 + lineVo.setInvoiceProductName(line.getInvoiceProductName());
472 484 lineVo.setProductId(line.getProductId());
473 485 lineVo.setQuantity(line.getQuantity());
474 486 lineVo.setUnitPrice(line.getActualPurchasePrice());
... ... @@ -545,6 +557,7 @@ public class ProcurementPlanReplenishServiceImpl
545 557 for (ProcurementPlanLine line : factoryLines) {
546 558 ProcurementPlanLineVo lineVo = BeanUtil.copyProperties(line, ProcurementPlanLineVo.class);
547 559 lineVo.setWorkshopId(line.getWorkshopId());
  560 + lineVo.setProcurementPlanLineId(line.getId());
548 561 subLineVoList.add(lineVo);
549 562 }
550 563 subVo.setProcurementPlanLineList(subLineVoList);
... ... @@ -612,6 +625,11 @@ public class ProcurementPlanReplenishServiceImpl
612 625 // 更新主表字段
613 626 ProcurementPlanReplenish replenish = new ProcurementPlanReplenish();
614 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 633 this.updateById(replenish);
616 634
617 635 // 保存或更新明细
... ... @@ -700,6 +718,7 @@ public class ProcurementPlanReplenishServiceImpl
700 718 .set(ProcurementPlanReplenishLine::getEstimatedLoss, lineVo.getEstimatedLoss())
701 719 .set(ProcurementPlanReplenishLine::getApplicationAttrition, lineVo.getApplicationAttrition())
702 720 .set(ProcurementPlanReplenishLine::getPaintDamageRatio, lineVo.getPaintDamageRatio())
  721 + .set(ProcurementPlanReplenishLine::getInvoiceProductName, lineVo.getInvoiceProductName())
703 722 .set(ProcurementPlanReplenishLine::getWorkshopId, lineVo.getWorkshopId())
704 723 .set(ProcurementPlanReplenishLine::getItemId, lineVo.getItemId());
705 724 procurementPlanReplenishLineService.update(updateWrapper);
... ... @@ -709,6 +728,7 @@ public class ProcurementPlanReplenishServiceImpl
709 728 BeanUtil.copyProperties(lineVo, ProcurementPlanReplenishLine.class);
710 729 createLine.setId(IdUtil.getId());
711 730 createLine.setProcurementPlanReplenishId(replenishId);
  731 + createLine.setInvoiceProductName(lineVo.getInvoiceProductName());
712 732 procurementPlanReplenishLineService.save(createLine);
713 733 existIdList.add(createLine.getId());
714 734 }
... ... @@ -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 765 * @param datas 数据列表
... ...
... ... @@ -23,6 +23,12 @@ public class CreateProcurementPlanChangeLineVo implements BaseVo, Serializable {
23 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 34 @ApiModelProperty("料型")
... ... @@ -87,6 +93,13 @@ public class CreateProcurementPlanChangeLineVo implements BaseVo, Serializable {
87 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 105 @ApiModelProperty("分厂")
... ...
... ... @@ -26,6 +26,18 @@ public class ProcurementPlanLineVo implements BaseVo, Serializable {
26 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 41 * 品种ID
30 42 */
31 43 @ApiModelProperty(value = "品种ID", required = true)
... ... @@ -97,6 +109,13 @@ public class ProcurementPlanLineVo implements BaseVo, Serializable {
97 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 121 @ApiModelProperty("分厂")
... ...
... ... @@ -72,6 +72,13 @@ public class CreateSalesmanQuotationLineVo implements BaseVo, Serializable {
72 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 84 @ApiModelProperty("前端行标识")
... ...
... ... @@ -58,6 +58,10 @@ public class CreateProcurementPlanReplenishLineVo implements BaseVo, Serializabl
58 58 @Digits(integer = 8, fraction = 10, message = "漆损率最多支持8位整数和10位小数!")
59 59 private BigDecimal paintDamageRatio;
60 60
  61 + @ApiModelProperty("开票品名")
  62 + @Length(max = 200, message = "开票品名最多允许200个字符!")
  63 + private String invoiceProductName;
  64 +
61 65 @ApiModelProperty("分厂")
62 66 @Length(max = 50, message = "分厂最多允许50个字符!")
63 67 private String workshopId;
... ...
... ... @@ -5,8 +5,10 @@
5 5 <resultMap id="ProcurementPlanChangeLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine">
6 6 <id column="id" property="id"/>
7 7 <result column="procurement_plan_change_id" property="procurementPlanChangeId"/>
  8 + <result column="procurement_plan_line_id" property="procurementPlanLineId"/>
8 9 <result column="product_id" property="productId"/>
9 10 <result column="material_type" property="materialType"/>
  11 + <result column="invoice_product_name" property="invoiceProductName"/>
10 12 <result column="quantity" property="quantity"/>
11 13 <result column="actual_purchase_price" property="actualPurchasePrice"/>
12 14 <result column="including_shipping_price" property="includingShippingPrice"/>
... ... @@ -29,8 +31,10 @@
29 31 SELECT
30 32 ppcl.id,
31 33 ppcl.procurement_plan_change_id,
  34 + ppcl.procurement_plan_line_id,
32 35 ppcl.product_id,
33 36 ppcl.material_type,
  37 + ppcl.invoice_product_name,
34 38 ppcl.quantity,
35 39 ppcl.actual_purchase_price,
36 40 ppcl.including_shipping_price,
... ...
... ... @@ -5,6 +5,8 @@
5 5 <resultMap id="ProcurementPlanLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine">
6 6 <id column="id" property="id"/>
7 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 10 <result column="product_id" property="productId"/>
9 11 <result column="product_name" property="productName"/>
10 12 <result column="material_type" property="materialType"/>
... ... @@ -18,6 +20,7 @@
18 20 <result column="paint_damage_ratio" property="paintDamageRatio"/>
19 21 <result column="workshop_id" property="workshopId"/>
20 22 <result column="workshop_name" property="workshopName"/>
  23 + <result column="invoice_product_name" property="invoiceProductName"/>
21 24 <result column="item_id" property="itemId"/>
22 25 <result column="create_by_id" property="createById"/>
23 26 <result column="create_by" property="createBy"/>
... ... @@ -31,6 +34,8 @@
31 34 SELECT
32 35 ppl.id,
33 36 ppl.procurement_plan_id,
  37 + ppl.procurement_plan_line_id,
  38 + ppl.salesman_quotation_line_id,
34 39 ppl.product_id,
35 40 br.product_name,
36 41 ppl.material_type,
... ... @@ -44,6 +49,7 @@
44 49 ppl.paint_damage_ratio,
45 50 ppl.workshop_id,
46 51 ws.name AS workshop_name,
  52 + ppl.invoice_product_name,
47 53 ppl.item_id,
48 54 ppl.create_by_id,
49 55 ppl.create_by,
... ...
... ... @@ -11,6 +11,7 @@
11 11 <result column="product_type" property="productType"/>
12 12 <result column="fixed_attrition_rate" property="fixedAttritionRate"/>
13 13 <result column="material_type" property="materialType"/>
  14 + <result column="invoice_product_name" property="invoiceProductName"/>
14 15 <result column="quantity" property="quantity"/>
15 16 <result column="purchase_price" property="purchasePrice"/>
16 17 <result column="estimated_loss" property="estimatedLoss"/>
... ... @@ -38,6 +39,7 @@
38 39 br.type AS product_type,
39 40 br.attrition_rate AS fixed_attrition_rate,
40 41 tb.material_type,
  42 + tb.invoice_product_name,
41 43 tb.quantity,
42 44 tb.purchase_price,
43 45 tb.estimated_loss,
... ... @@ -72,6 +74,8 @@
72 74 sq.quoter_name,
73 75 pdc.unit_name AS supplier_name,
74 76 br.product_name,
  77 + tb.material_type,
  78 + tb.invoice_product_name,
75 79 tb.quantity,
76 80 tb.purchase_price,
77 81 tb.paint_damage_ratio,
... ...
... ... @@ -8,6 +8,7 @@
8 8 <result column="product_id" property="productId"/>
9 9 <result column="product_name" property="productName"/>
10 10 <result column="material_type" property="materialType"/>
  11 + <result column="invoice_product_name" property="invoiceProductName"/>
11 12 <result column="quantity" property="quantity"/>
12 13 <result column="actual_purchase_price" property="actualPurchasePrice"/>
13 14 <result column="including_shipping_price" property="includingShippingPrice"/>
... ... @@ -34,6 +35,7 @@
34 35 pprl.product_id,
35 36 br.product_name,
36 37 pprl.material_type,
  38 + pprl.invoice_product_name,
37 39 pprl.quantity,
38 40 pprl.actual_purchase_price,
39 41 pprl.including_shipping_price,
... ...