Commit 99109b3640049cd8ba665a31641cde6d6dc2772c

Authored by 房远帅
1 parent 033bb139

采购计划:采购计划补单

Showing 25 changed files with 2687 additions and 3 deletions
@@ -2137,3 +2137,90 @@ CREATE TABLE `procurement_plan_change_line` @@ -2137,3 +2137,90 @@ CREATE TABLE `procurement_plan_change_line`
2137 KEY `idx_ppcl_product_id` (`product_id`), 2137 KEY `idx_ppcl_product_id` (`product_id`),
2138 KEY `idx_ppcl_create_time` (`create_time`) 2138 KEY `idx_ppcl_create_time` (`create_time`)
2139 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='采购计划变更单明细表'; 2139 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='采购计划变更单明细表';
  2140 +
  2141 +CREATE TABLE `procurement_plan_replenish`
  2142 +(
  2143 + `id` VARCHAR(32) NOT NULL COMMENT '主键ID',
  2144 + `procurement_plan_id` VARCHAR(32) NOT NULL COMMENT '补单关联的原采购计划ID',
  2145 + `code` VARCHAR(64) NOT NULL COMMENT '补单编号(计划编号)',
  2146 + `company_short_id` VARCHAR(32) NOT NULL COMMENT '公司简称ID',
  2147 + `supplier_id` VARCHAR(32) NOT NULL COMMENT '供应商ID',
  2148 + `purchase_department` VARCHAR(32) NOT NULL COMMENT '采购处ID',
  2149 + `region` VARCHAR(32) DEFAULT NULL COMMENT '区域ID',
  2150 + `date` DATE NOT NULL COMMENT '日期',
  2151 + `validity_period` VARCHAR(200) DEFAULT NULL COMMENT '报价时效',
  2152 + `quoter_id` VARCHAR(32) DEFAULT NULL COMMENT '报价人ID',
  2153 + `quoter_name` VARCHAR(50) DEFAULT NULL COMMENT '报价人ID',
  2154 + `long_term_operation` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否长单操作 0否 1是',
  2155 + `terminal_customer` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否终端客户 0否 1是',
  2156 + `priced` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否未点价 0否 1是',
  2157 + `temporary_price` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否暂定价 0否 1是',
  2158 + `pricing_deadline` DATE DEFAULT NULL COMMENT '点价截止日期',
  2159 + `other_expense_settlement` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '其他费用凭票到厂另行结算 0否 1是',
  2160 + `delivery_mode` VARCHAR(32) DEFAULT NULL COMMENT '交提货方式',
  2161 + `commodity_buyout` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否通货买断 0否 1是',
  2162 + `quality_buyout` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否质量买断 0否 1是',
  2163 + `quantity_buyout` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否数量买断 0否 1是',
  2164 + `door_delivery` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否送货上门 0否 1是',
  2165 + `shipping_cost` DECIMAL(18, 4) NOT NULL DEFAULT 0 COMMENT '另付运费',
  2166 + `loading_fee` DECIMAL(18, 4) NOT NULL DEFAULT 0 COMMENT '装车费',
  2167 + `invoice_product_name` VARCHAR(32) DEFAULT NULL COMMENT '开票品名',
  2168 + `delivery_date` VARCHAR(32) DEFAULT NULL COMMENT '交货日期',
  2169 + `settlement_method` VARCHAR(32) DEFAULT NULL COMMENT '结算方式',
  2170 + `settlement_ratio` DECIMAL(18, 4) DEFAULT NULL COMMENT '结算比例(%)',
  2171 + `price_id` VARCHAR(32) DEFAULT NULL COMMENT '价格表ID',
  2172 + `coordination_reason` VARCHAR(200) DEFAULT NULL COMMENT '协调事由',
  2173 + `invoice_type_status` VARCHAR(32) DEFAULT NULL COMMENT '票类状况',
  2174 + `total_quantity` DECIMAL(18, 4) NOT NULL DEFAULT 0 COMMENT '合计数量',
  2175 + `remark` VARCHAR(500) DEFAULT NULL COMMENT '备注',
  2176 + `material_condition_enabled` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '料质状况是否启用 0否 1是',
  2177 + `material_condition_copper_rice` VARCHAR(500) DEFAULT NULL COMMENT '料质状况-铜米',
  2178 + `material_condition_bright_copper` VARCHAR(500) DEFAULT NULL COMMENT '料质状况-光亮铜',
  2179 + `material_condition_first_class` VARCHAR(500) DEFAULT NULL COMMENT '料质状况-一特',
  2180 + `material_condition_second_class` VARCHAR(500) DEFAULT NULL COMMENT '料质状况-二特',
  2181 + `material_condition_tin_coated` VARCHAR(500) DEFAULT NULL COMMENT '料质状况-镀锡紫',
  2182 + `material_condition_scrap` VARCHAR(500) DEFAULT NULL COMMENT '料质状况-角料',
  2183 + `material_condition_white_yellow` VARCHAR(500) DEFAULT NULL COMMENT '料质状况-镀白黄',
  2184 + `material_condition_phosphor_copper` VARCHAR(500) DEFAULT NULL COMMENT '料质状况-磷铜',
  2185 + `approval_status` VARCHAR(32) DEFAULT NULL COMMENT '审核状态',
  2186 + `process_node` VARCHAR(32) DEFAULT NULL COMMENT '流程节点',
  2187 + `workshop_id` VARCHAR(32) DEFAULT NULL COMMENT '流程节点',
  2188 + `create_by_id` VARCHAR(32) NOT NULL COMMENT '创建人ID',
  2189 + `create_by` VARCHAR(64) NOT NULL COMMENT '创建人(仅展示字段)',
  2190 + `create_time` DATETIME NOT NULL COMMENT '创建时间',
  2191 + `update_by_id` VARCHAR(32) DEFAULT NULL COMMENT '修改人ID',
  2192 + `update_by` VARCHAR(64) DEFAULT NULL COMMENT '修改人(仅展示字段)',
  2193 + `update_time` DATETIME DEFAULT NULL COMMENT '修改时间',
  2194 + PRIMARY KEY (`id`),
  2195 + UNIQUE KEY `uk_pp_replenish_code` (`code`),
  2196 + KEY `idx_pp_replenish_plan_id` (`procurement_plan_id`),
  2197 + KEY `idx_pp_replenish_status` (`approval_status`,`process_node`),
  2198 + KEY `idx_pp_replenish_create_time` (`create_time`)
  2199 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='采购计划补单主表';
  2200 +
  2201 +
  2202 +CREATE TABLE `procurement_plan_replenish_line`
  2203 +(
  2204 + `id` VARCHAR(32) NOT NULL COMMENT '主键ID',
  2205 + `procurement_plan_replenish_id` VARCHAR(32) NOT NULL COMMENT '补单主表ID',
  2206 + `product_id` varchar(32) NOT NULL COMMENT '品种ID',
  2207 + `material_type` varchar(200) DEFAULT NULL COMMENT '料型',
  2208 + `quantity` decimal(18, 5) NOT NULL COMMENT '数量',
  2209 + `actual_purchase_price` decimal(18, 10) DEFAULT NULL COMMENT '实际采购价',
  2210 + `including_shipping_price` decimal(18, 10) DEFAULT NULL COMMENT '含运到厂价',
  2211 + `price_list_prices` decimal(18, 10) DEFAULT NULL COMMENT '价格表价格',
  2212 + `coordination_range` decimal(18, 10) DEFAULT NULL COMMENT '协调幅度',
  2213 + `estimated_loss` decimal(18, 10) DEFAULT NULL COMMENT '买断料预计损耗',
  2214 + `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',
  2215 + `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',
  2216 + `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂',
  2217 + `item_id` varchar(32) NOT NULL COMMENT '前端行标识',
  2218 + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
  2219 + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
  2220 + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID',
  2221 + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人',
  2222 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2223 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  2224 + PRIMARY KEY (`id`),
  2225 + KEY `idx_pp_replenish_line_main` (`procurement_plan_replenish_id`)
  2226 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='采购计划补单明细表';
@@ -339,6 +339,18 @@ public class GetProcurementPlanChangeBo extends BaseBo<ProcurementPlanChange> { @@ -339,6 +339,18 @@ public class GetProcurementPlanChangeBo extends BaseBo<ProcurementPlanChange> {
339 private String workshopId; 339 private String workshopId;
340 340
341 /** 341 /**
  342 + * 是否展示审核按钮(非持久化字段)
  343 + */
  344 + @ApiModelProperty("是否展示审核按钮")
  345 + private Boolean showExamine = false;
  346 +
  347 + /**
  348 + * 是否展示审核详情按钮(非持久化字段)
  349 + */
  350 + @ApiModelProperty("是否展示审核详情按钮")
  351 + private Boolean showExamineDetail;
  352 +
  353 + /**
342 * 创建人ID 354 * 创建人ID
343 */ 355 */
344 @ApiModelProperty("创建人ID") 356 @ApiModelProperty("创建人ID")
  1 +package com.lframework.xingyun.sc.bo.procurement;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.TableField;
  4 +import com.fasterxml.jackson.annotation.JsonFormat;
  5 +import com.lframework.starter.common.constants.StringPool;
  6 +import com.lframework.starter.common.utils.CollectionUtil;
  7 +import com.lframework.starter.web.core.bo.BaseBo;
  8 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish;
  9 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenishLine;
  10 +import io.swagger.annotations.ApiModelProperty;
  11 +import lombok.Data;
  12 +import java.math.BigDecimal;
  13 +import java.time.LocalDate;
  14 +import java.time.LocalDateTime;
  15 +import java.util.List;
  16 +import java.util.stream.Collectors;
  17 +
  18 +@Data
  19 +public class GetProcurementPlanReplenishBo extends BaseBo<ProcurementPlanReplenish> {
  20 +
  21 + /**
  22 + * ID
  23 + */
  24 + @ApiModelProperty("ID")
  25 + private String id;
  26 +
  27 + /**
  28 + * 原采购计划ID
  29 + */
  30 + @ApiModelProperty("原采购计划ID")
  31 + private String procurementPlanId;
  32 +
  33 + /**
  34 + * 补单编号
  35 + */
  36 + @ApiModelProperty("补单编号")
  37 + private String code;
  38 +
  39 + /**
  40 + * 公司简称ID
  41 + */
  42 + @ApiModelProperty("公司简称ID")
  43 + private String companyShortId;
  44 +
  45 + /**
  46 + * 公司简称名称
  47 + */
  48 + @ApiModelProperty("公司简称名称")
  49 + private String companyShortName;
  50 +
  51 + /**
  52 + * 公司全称
  53 + */
  54 + @ApiModelProperty("公司全称")
  55 + private String companyFullName;
  56 +
  57 + /**
  58 + * 供应商ID
  59 + */
  60 + @ApiModelProperty("供应商ID")
  61 + private String supplierId;
  62 +
  63 + /**
  64 + * 供应商名称
  65 + */
  66 + @ApiModelProperty("供应商名称")
  67 + private String supplierName;
  68 +
  69 + /**
  70 + * 采购处
  71 + */
  72 + @ApiModelProperty("采购处")
  73 + private String purchaseDepartment;
  74 +
  75 + /**
  76 + * 采购处名称
  77 + */
  78 + @ApiModelProperty("采购处名称")
  79 + private String purchaseDepartmentName;
  80 +
  81 + /**
  82 + * 采购处编码
  83 + */
  84 + @ApiModelProperty("采购处编码")
  85 + private String purchaseDepartmentCode;
  86 +
  87 + /**
  88 + * 区域
  89 + */
  90 + @ApiModelProperty("区域")
  91 + private String region;
  92 +
  93 + /**
  94 + * 区域名称
  95 + */
  96 + @ApiModelProperty("区域名称")
  97 + private String regionName;
  98 +
  99 + /**
  100 + * 日期
  101 + */
  102 + @ApiModelProperty("日期")
  103 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  104 + private LocalDate date;
  105 +
  106 + /**
  107 + * 报价时效
  108 + */
  109 + @ApiModelProperty("报价时效")
  110 + private String validityPeriod;
  111 +
  112 + /**
  113 + * 报价人ID
  114 + */
  115 + @ApiModelProperty("报价人ID")
  116 + private String quoterId;
  117 +
  118 + /**
  119 + * 报价人
  120 + */
  121 + @ApiModelProperty("报价人")
  122 + private String quoterName;
  123 +
  124 + /**
  125 + * 是否长单操作
  126 + */
  127 + @ApiModelProperty("是否长单操作")
  128 + private Boolean longTermOperation;
  129 +
  130 + /**
  131 + * 是否终端客户
  132 + */
  133 + @ApiModelProperty("是否终端客户")
  134 + private Boolean terminalCustomer;
  135 +
  136 + /**
  137 + * 是否未点价
  138 + */
  139 + @ApiModelProperty("是否未点价")
  140 + private Boolean priced;
  141 +
  142 + /**
  143 + * 点价截止日期
  144 + */
  145 + @ApiModelProperty("点价截止日期")
  146 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  147 + private LocalDate pricingDeadline;
  148 +
  149 + /**
  150 + * 是否暂定价
  151 + */
  152 + @ApiModelProperty("是否暂定价")
  153 + private Boolean temporaryPrice;
  154 +
  155 + /**
  156 + * 其他费用凭票到厂另行结算
  157 + */
  158 + @ApiModelProperty("其他费用凭票到厂另行结算")
  159 + private Boolean otherExpenseSettlement;
  160 +
  161 + /**
  162 + * 交提货方式
  163 + */
  164 + @ApiModelProperty("交提货方式")
  165 + private String deliveryMode;
  166 +
  167 + /**
  168 + * 是否通货买断
  169 + */
  170 + @ApiModelProperty("是否通货买断")
  171 + private Boolean commodityBuyout;
  172 +
  173 + /**
  174 + * 是否质量买断
  175 + */
  176 + @ApiModelProperty("是否质量买断")
  177 + private Boolean qualityBuyout;
  178 +
  179 + /**
  180 + * 是否数量买断
  181 + */
  182 + @ApiModelProperty("是否数量买断")
  183 + private Boolean quantityBuyout;
  184 +
  185 + /**
  186 + * 是否送货上门
  187 + */
  188 + @ApiModelProperty("是否送货上门")
  189 + private Boolean doorDelivery;
  190 +
  191 + /**
  192 + * 另付运费
  193 + */
  194 + @ApiModelProperty("另付运费")
  195 + private BigDecimal shippingCost;
  196 +
  197 + /**
  198 + * 装车费
  199 + */
  200 + @ApiModelProperty("装车费")
  201 + private BigDecimal loadingFee;
  202 +
  203 + /**
  204 + * 开票品名
  205 + */
  206 + @ApiModelProperty("开票品名")
  207 + private String invoiceProductName;
  208 +
  209 + /**
  210 + * 交货日期
  211 + */
  212 + @ApiModelProperty("交货日期")
  213 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  214 + private LocalDate deliveryDate;
  215 +
  216 + /**
  217 + * 结算方式
  218 + */
  219 + @ApiModelProperty("结算方式")
  220 + private String settlementMethod;
  221 +
  222 + /**
  223 + * 结算比例(%)
  224 + */
  225 + @ApiModelProperty("结算比例(%)")
  226 + private BigDecimal settlementRatio;
  227 +
  228 + /**
  229 + * 价格表ID
  230 + */
  231 + @ApiModelProperty("价格表ID")
  232 + private String priceId;
  233 +
  234 + /**
  235 + * 价格表编号
  236 + */
  237 + @ApiModelProperty("价格表编号")
  238 + private String priceCode;
  239 +
  240 + /**
  241 + * 协调事由
  242 + */
  243 + @ApiModelProperty("协调事由")
  244 + private String coordinationReason;
  245 +
  246 + /**
  247 + * 票类状况
  248 + */
  249 + @ApiModelProperty("票类状况")
  250 + private String invoiceTypeStatus;
  251 +
  252 + /**
  253 + * 数量合计
  254 + */
  255 + @ApiModelProperty("数量合计")
  256 + private BigDecimal totalQuantity;
  257 +
  258 + /**
  259 + * 备注
  260 + */
  261 + @ApiModelProperty("备注")
  262 + private String remark;
  263 +
  264 + /**
  265 + * 是否启用料质状况
  266 + */
  267 + @ApiModelProperty("是否启用料质状况")
  268 + private Boolean materialConditionEnabled;
  269 +
  270 + /**
  271 + * 铜米
  272 + */
  273 + @ApiModelProperty("铜米")
  274 + private String materialConditionCopperRice;
  275 +
  276 + /**
  277 + * 光亮铜
  278 + */
  279 + @ApiModelProperty("光亮铜")
  280 + private String materialConditionBrightCopper;
  281 +
  282 + /**
  283 + * 一特
  284 + */
  285 + @ApiModelProperty("一特")
  286 + private String materialConditionFirstClass;
  287 +
  288 + /**
  289 + * 二特
  290 + */
  291 + @ApiModelProperty("二特")
  292 + private String materialConditionSecondClass;
  293 +
  294 + /**
  295 + * 镀锡紫
  296 + */
  297 + @ApiModelProperty("镀锡紫")
  298 + private String materialConditionTinCoated;
  299 +
  300 + /**
  301 + * 角料
  302 + */
  303 + @ApiModelProperty("角料")
  304 + private String materialConditionScrap;
  305 +
  306 + /**
  307 + * 镀白黄
  308 + */
  309 + @ApiModelProperty("镀白黄")
  310 + private String materialConditionWhiteYellow;
  311 +
  312 + /**
  313 + * 磷铜
  314 + */
  315 + @ApiModelProperty("磷铜")
  316 + private String materialConditionPhosphorCopper;
  317 +
  318 + /**
  319 + * 审核状态
  320 + */
  321 + @ApiModelProperty("审核状态")
  322 + private String approvalStatus;
  323 +
  324 + /**
  325 + * 流程节点
  326 + */
  327 + @ApiModelProperty("流程节点")
  328 + private String processNode;
  329 +
  330 + /**
  331 + * 分厂ID
  332 + */
  333 + @ApiModelProperty("分厂ID")
  334 + private String workshopId;
  335 +
  336 + /**
  337 + * 分厂名称
  338 + */
  339 + @ApiModelProperty("分厂名称")
  340 + private String workshopName;
  341 +
  342 + /**
  343 + * 是否展示审核按钮(非持久化字段)
  344 + */
  345 + @ApiModelProperty("是否展示审核按钮")
  346 + private Boolean showExamine = false;
  347 +
  348 + /**
  349 + * 是否展示审核详情按钮(非持久化字段)
  350 + */
  351 + @ApiModelProperty("是否展示审核详情按钮")
  352 + private Boolean showExamineDetail;
  353 +
  354 + /**
  355 + * 创建人ID
  356 + */
  357 + @ApiModelProperty("创建人ID")
  358 + private String createById;
  359 +
  360 + /**
  361 + * 创建人
  362 + */
  363 + @ApiModelProperty("创建人")
  364 + private String createBy;
  365 +
  366 + /**
  367 + * 更新人ID
  368 + */
  369 + @ApiModelProperty("更新人ID")
  370 + private String updateById;
  371 +
  372 + /**
  373 + * 更新人
  374 + */
  375 + @ApiModelProperty("更新人")
  376 + private String updateBy;
  377 +
  378 + /**
  379 + * 创建时间
  380 + */
  381 + @ApiModelProperty("创建时间")
  382 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  383 + private LocalDateTime createTime;
  384 +
  385 + /**
  386 + * 更新时间
  387 + */
  388 + @ApiModelProperty("更新时间")
  389 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  390 + private LocalDateTime updateTime;
  391 +
  392 + /**
  393 + * 明细信息
  394 + */
  395 + @ApiModelProperty("明细信息")
  396 + private List<GetProcurementPlanReplenishLineBo> procurementPlanReplenishLineList;
  397 +
  398 + public GetProcurementPlanReplenishBo() {
  399 + }
  400 +
  401 + public GetProcurementPlanReplenishBo(ProcurementPlanReplenish dto) {
  402 + super(dto);
  403 + }
  404 +
  405 + public GetProcurementPlanReplenishBo(ProcurementPlanReplenish dto, List<ProcurementPlanReplenishLine> lineList) {
  406 + super(dto);
  407 + if (!CollectionUtil.isEmpty(lineList)) {
  408 + this.procurementPlanReplenishLineList = lineList.stream().map(GetProcurementPlanReplenishLineBo::new).collect(Collectors.toList());
  409 + }
  410 + }
  411 +
  412 + @Override
  413 + public BaseBo<ProcurementPlanReplenish> convert(ProcurementPlanReplenish dto) {
  414 + return super.convert(dto);
  415 + }
  416 +
  417 + @Override
  418 + protected void afterInit(ProcurementPlanReplenish dto) {
  419 +
  420 + }
  421 +}
  1 +package com.lframework.xingyun.sc.bo.procurement;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.starter.common.constants.StringPool;
  5 +import com.lframework.starter.web.core.bo.BaseBo;
  6 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenishLine;
  7 +import io.swagger.annotations.ApiModelProperty;
  8 +import lombok.Data;
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDateTime;
  11 +
  12 +@Data
  13 +public class GetProcurementPlanReplenishLineBo extends BaseBo<ProcurementPlanReplenishLine> {
  14 +
  15 + /**
  16 + * ID
  17 + */
  18 + @ApiModelProperty("ID")
  19 + private String id;
  20 +
  21 + /**
  22 + * 采购计划补单ID
  23 + */
  24 + @ApiModelProperty("采购计划补单ID")
  25 + private String procurementPlanReplenishId;
  26 +
  27 + /**
  28 + * 品种ID
  29 + */
  30 + @ApiModelProperty("品种ID")
  31 + private String productId;
  32 +
  33 + /**
  34 + * 产品名称
  35 + */
  36 + @ApiModelProperty("产品名称")
  37 + private String productName;
  38 +
  39 + /**
  40 + * 料型
  41 + */
  42 + @ApiModelProperty("料型")
  43 + private String materialType;
  44 +
  45 + /**
  46 + * 数量
  47 + */
  48 + @ApiModelProperty("数量")
  49 + private BigDecimal quantity;
  50 +
  51 + /**
  52 + * 实际采购价
  53 + */
  54 + @ApiModelProperty("实际采购价")
  55 + private BigDecimal actualPurchasePrice;
  56 +
  57 + /**
  58 + * 含运到厂价
  59 + */
  60 + @ApiModelProperty("含运到厂价")
  61 + private BigDecimal includingShippingPrice;
  62 +
  63 + /**
  64 + * 价格表价格
  65 + */
  66 + @ApiModelProperty("价格表价格")
  67 + private BigDecimal priceListPrices;
  68 +
  69 + /**
  70 + * 协调幅度
  71 + */
  72 + @ApiModelProperty("协调幅度")
  73 + private BigDecimal coordinationRange;
  74 +
  75 + /**
  76 + * 买断料预计损耗
  77 + */
  78 + @ApiModelProperty("买断料预计损耗")
  79 + private BigDecimal estimatedLoss;
  80 +
  81 + /**
  82 + * 申请损耗(%)
  83 + */
  84 + @ApiModelProperty("申请损耗(%)")
  85 + private BigDecimal applicationAttrition;
  86 +
  87 + /**
  88 + * 漆损率(%)
  89 + */
  90 + @ApiModelProperty("漆损率(%)")
  91 + private BigDecimal paintDamageRatio;
  92 +
  93 + /**
  94 + * 分厂ID
  95 + */
  96 + @ApiModelProperty("分厂ID")
  97 + private String workshopId;
  98 +
  99 + /**
  100 + * 分厂名称
  101 + */
  102 + @ApiModelProperty("分厂名称")
  103 + private String workshopName;
  104 +
  105 + /**
  106 + * 备注
  107 + */
  108 + @ApiModelProperty("备注")
  109 + private String remark;
  110 +
  111 + /**
  112 + * 前端行标识
  113 + */
  114 + @ApiModelProperty("前端行标识")
  115 + private String itemId;
  116 +
  117 + /**
  118 + * 创建人ID
  119 + */
  120 + @ApiModelProperty("创建人ID")
  121 + private String createById;
  122 +
  123 + /**
  124 + * 创建人
  125 + */
  126 + @ApiModelProperty("创建人")
  127 + private String createBy;
  128 +
  129 + /**
  130 + * 更新人ID
  131 + */
  132 + @ApiModelProperty("更新人ID")
  133 + private String updateById;
  134 +
  135 + /**
  136 + * 更新人
  137 + */
  138 + @ApiModelProperty("更新人")
  139 + private String updateBy;
  140 +
  141 + /**
  142 + * 创建时间
  143 + */
  144 + @ApiModelProperty("创建时间")
  145 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  146 + private LocalDateTime createTime;
  147 +
  148 + /**
  149 + * 更新时间
  150 + */
  151 + @ApiModelProperty("更新时间")
  152 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  153 + private LocalDateTime updateTime;
  154 +
  155 + public GetProcurementPlanReplenishLineBo() {
  156 + }
  157 +
  158 + public GetProcurementPlanReplenishLineBo(ProcurementPlanReplenishLine dto) {
  159 + super(dto);
  160 + }
  161 +
  162 + @Override
  163 + public BaseBo<ProcurementPlanReplenishLine> convert(ProcurementPlanReplenishLine dto) {
  164 + return super.convert(dto);
  165 + }
  166 +}
@@ -20,12 +20,12 @@ import com.lframework.xingyun.sc.entity.*; @@ -20,12 +20,12 @@ import com.lframework.xingyun.sc.entity.*;
20 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; 20 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
21 import com.lframework.xingyun.sc.procurement.entity.ProcurementDomesticCustomerCredit; 21 import com.lframework.xingyun.sc.procurement.entity.ProcurementDomesticCustomerCredit;
22 import com.lframework.xingyun.sc.procurement.entity.ProcurementForeignTradeCredit; 22 import com.lframework.xingyun.sc.procurement.entity.ProcurementForeignTradeCredit;
23 -import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;  
24 import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService; 23 import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService;
25 import com.lframework.xingyun.sc.procurement.service.credit.ProcurementDomesticCustomerCreditService; 24 import com.lframework.xingyun.sc.procurement.service.credit.ProcurementDomesticCustomerCreditService;
26 import com.lframework.xingyun.sc.procurement.service.credit.ProcurementForeignTradeCreditService; 25 import com.lframework.xingyun.sc.procurement.service.credit.ProcurementForeignTradeCreditService;
27 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; 26 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService;
28 import com.lframework.xingyun.sc.procurement.service.quotation.SalesmanQuotationService; 27 import com.lframework.xingyun.sc.procurement.service.quotation.SalesmanQuotationService;
  28 +import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService;
29 import com.lframework.xingyun.sc.service.contract.ContractDistributorLineService; 29 import com.lframework.xingyun.sc.service.contract.ContractDistributorLineService;
30 import com.lframework.xingyun.sc.service.contract.ContractChangeApplicationService; 30 import com.lframework.xingyun.sc.service.contract.ContractChangeApplicationService;
31 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; 31 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
@@ -57,7 +57,6 @@ import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; @@ -57,7 +57,6 @@ import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo;
57 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderRevokeLineVo; 57 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderRevokeLineVo;
58 import com.lframework.xingyun.sc.vo.sample.confirm.CreateProductSampleConfirmationSlipDetailVo; 58 import com.lframework.xingyun.sc.vo.sample.confirm.CreateProductSampleConfirmationSlipDetailVo;
59 import com.lframework.xingyun.sc.vo.sample.confirm.CreateProductSampleConfirmationSlipVo; 59 import com.lframework.xingyun.sc.vo.sample.confirm.CreateProductSampleConfirmationSlipVo;
60 -import com.lframework.xingyun.sc.vo.shipments.car.CreateCarRequestPlanVo;  
61 import com.lframework.xingyun.sc.vo.shipments.car.CreateRequestCarTicketVo; 60 import com.lframework.xingyun.sc.vo.shipments.car.CreateRequestCarTicketVo;
62 import com.lframework.xingyun.sc.vo.shipments.car.QueryRequestCarTicketVo; 61 import com.lframework.xingyun.sc.vo.shipments.car.QueryRequestCarTicketVo;
63 import com.lframework.xingyun.sc.vo.shipments.delay.QueryDelayedShipmentDetailVo; 62 import com.lframework.xingyun.sc.vo.shipments.delay.QueryDelayedShipmentDetailVo;
@@ -164,6 +163,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -164,6 +163,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
164 private ProcurementPlanService procurementPlanService; 163 private ProcurementPlanService procurementPlanService;
165 @Resource 164 @Resource
166 private ProcurementPlanChangeService procurementPlanChangeService; 165 private ProcurementPlanChangeService procurementPlanChangeService;
  166 + @Resource
  167 + private ProcurementPlanReplenishService procurementPlanReplenishService;
167 168
168 169
169 170
@@ -260,6 +261,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -260,6 +261,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
260 case "PLAN_CHANGE": 261 case "PLAN_CHANGE":
261 handleProcurementPlanChangeData(flowStatus, businessId); 262 handleProcurementPlanChangeData(flowStatus, businessId);
262 break; 263 break;
  264 + case "PLAN_REPLENISH":
  265 + handleProcurementPlanReplenishData(flowStatus, businessId);
  266 + break;
263 default: 267 default:
264 break; 268 break;
265 } 269 }
@@ -1171,4 +1175,21 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -1171,4 +1175,21 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
1171 } 1175 }
1172 } 1176 }
1173 1177
  1178 + /**
  1179 + * 采购计划补单审核业务数据处理
  1180 + *
  1181 + * @param flowStatus 审核结果
  1182 + * @param businessId 业务ID
  1183 + */
  1184 + private void handleProcurementPlanReplenishData(String flowStatus, String businessId) {
  1185 + if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)
  1186 + || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) {
  1187 + procurementPlanReplenishService.updateApprovalStatus(businessId, "PASS");
  1188 + } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)
  1189 + || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus)
  1190 + || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) {
  1191 + procurementPlanReplenishService.updateApprovalStatus(businessId, "REFUSE");
  1192 + }
  1193 + }
  1194 +
1174 } 1195 }
@@ -20,6 +20,7 @@ import com.lframework.xingyun.sc.handlers.TransactorHandler; @@ -20,6 +20,7 @@ import com.lframework.xingyun.sc.handlers.TransactorHandler;
20 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange; 20 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;
21 import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService; 21 import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService;
22 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; 22 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService;
  23 +import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService;
23 import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo; 24 import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo;
24 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; 25 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
25 import com.lframework.xingyun.sc.service.customer.CustomerCreditService; 26 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
@@ -67,6 +68,8 @@ public class FlowTaskServiceImpl implements FlowTaskService { @@ -67,6 +68,8 @@ public class FlowTaskServiceImpl implements FlowTaskService {
67 private ProcurementPlanService procurementPlanService; 68 private ProcurementPlanService procurementPlanService;
68 @Resource 69 @Resource
69 private ProcurementPlanChangeService procurementPlanChangeService; 70 private ProcurementPlanChangeService procurementPlanChangeService;
  71 + @Resource
  72 + private ProcurementPlanReplenishService procurementPlanReplenishService;
70 73
71 74
72 @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"}) 75 @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"})
@@ -460,6 +463,12 @@ public class FlowTaskServiceImpl implements FlowTaskService { @@ -460,6 +463,12 @@ public class FlowTaskServiceImpl implements FlowTaskService {
460 procurementPlanChangeService.updateNoFlowInstance(map); 463 procurementPlanChangeService.updateNoFlowInstance(map);
461 } 464 }
462 465
  466 + @Transactional(rollbackFor = Exception.class)
  467 + @Override
  468 + public void updateProcurementPlanReplenishMap(Map<String, Object> map) {
  469 + procurementPlanReplenishService.updateNoFlowInstance(map);
  470 + }
  471 +
463 @Override 472 @Override
464 public Map<String, Object> findById(String s) { 473 public Map<String, Object> findById(String s) {
465 ProductSampleConfirmationSlip slip = productSampleConfirmationSlipService.findById(s); 474 ProductSampleConfirmationSlip slip = productSampleConfirmationSlipService.findById(s);
@@ -61,7 +61,7 @@ public class ProcurementPlanChangeController extends DefaultBaseController { @@ -61,7 +61,7 @@ public class ProcurementPlanChangeController extends DefaultBaseController {
61 * 新增 61 * 新增
62 */ 62 */
63 @ApiOperation("新增采购计划变更单") 63 @ApiOperation("新增采购计划变更单")
64 - @HasPermission({"plan-manage:schedule-plan:add"}) 64 + @HasPermission({"plan-manage:schedule-plan:add", "plan-manage:schedule-plan:change"})
65 @PostMapping("/create") 65 @PostMapping("/create")
66 public InvokeResult<String> create(@RequestBody @Valid CreateProcurementPlanChangeVo vo) { 66 public InvokeResult<String> create(@RequestBody @Valid CreateProcurementPlanChangeVo vo) {
67 vo.validate(); 67 vo.validate();
  1 +package com.lframework.xingyun.sc.procurement.controller.replenish;
  2 +
  3 +import com.lframework.starter.web.core.annotations.security.HasPermission;
  4 +import com.lframework.starter.web.core.controller.DefaultBaseController;
  5 +import com.lframework.starter.web.core.components.resp.InvokeResult;
  6 +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
  7 +import com.lframework.starter.web.core.components.resp.PageResult;
  8 +import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanReplenishBo;
  9 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish;
  10 +import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService;
  11 +import com.lframework.xingyun.sc.procurement.vo.replenish.CreateProcurementPlanReplenishVo;
  12 +import com.lframework.xingyun.sc.procurement.vo.replenish.QueryProcurementPlanReplenishVo;
  13 +import com.lframework.xingyun.sc.procurement.vo.replenish.UpdateProcurementPlanReplenishVo;
  14 +import io.swagger.annotations.Api;
  15 +import io.swagger.annotations.ApiImplicitParam;
  16 +import io.swagger.annotations.ApiOperation;
  17 +import javax.validation.Valid;
  18 +import javax.validation.constraints.NotBlank;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.validation.annotation.Validated;
  21 +import org.springframework.web.bind.annotation.DeleteMapping;
  22 +import org.springframework.web.bind.annotation.GetMapping;
  23 +import org.springframework.web.bind.annotation.PostMapping;
  24 +import org.springframework.web.bind.annotation.PutMapping;
  25 +import org.springframework.web.bind.annotation.RequestBody;
  26 +import org.springframework.web.bind.annotation.RequestMapping;
  27 +import org.springframework.web.bind.annotation.RestController;
  28 +
  29 +@Api(tags = "采购计划补单管理")
  30 +@Validated
  31 +@RestController
  32 +@RequestMapping("/procurement/plan/replenish")
  33 +public class ProcurementPlanReplenishController extends DefaultBaseController {
  34 +
  35 + @Autowired
  36 + private ProcurementPlanReplenishService procurementPlanReplenishService;
  37 +
  38 + /**
  39 + * 分页查询采购计划补单列表
  40 + */
  41 + @ApiOperation("分页查询采购计划补单列表")
  42 + @HasPermission({"plan-manage:supple-plan:query"})
  43 + @GetMapping("/query")
  44 + public InvokeResult<PageResult<ProcurementPlanReplenish>> query(
  45 + @Valid QueryProcurementPlanReplenishVo vo) {
  46 + PageResult<ProcurementPlanReplenish> result =
  47 + procurementPlanReplenishService.query(getPageIndex(vo), getPageSize(vo), vo);
  48 + return InvokeResultBuilder.success(result);
  49 + }
  50 +
  51 + /**
  52 + * 查询采购计划补单详情
  53 + */
  54 + @ApiOperation("查询采购计划补单详情")
  55 + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true)
  56 + @HasPermission({"plan-manage:supple-plan:query","plan-manage:supple-plan:view"})
  57 + @GetMapping("")
  58 + public InvokeResult<GetProcurementPlanReplenishBo> findById(@NotBlank(message = "ID不能为空!") String id) {
  59 + GetProcurementPlanReplenishBo result = procurementPlanReplenishService.findDetail(id);
  60 + return InvokeResultBuilder.success(result);
  61 + }
  62 +
  63 + /**
  64 + * 新增采购计划补单
  65 + */
  66 + @ApiOperation("新增采购计划补单")
  67 + @HasPermission({"plan-manage:supple-plan:add"})
  68 + @PostMapping
  69 + public InvokeResult<String> create(@RequestBody @Valid CreateProcurementPlanReplenishVo vo) {
  70 + vo.validate();
  71 + String id = procurementPlanReplenishService.create(vo);
  72 + return InvokeResultBuilder.success(id);
  73 + }
  74 +
  75 + /**
  76 + * 修改采购计划补单
  77 + */
  78 + @ApiOperation("修改采购计划补单")
  79 + @HasPermission({"plan-manage:supple-plan:modify","plan-manage:supple-plan:approve"})
  80 + @PutMapping
  81 + public InvokeResult<Void> update(@RequestBody @Valid UpdateProcurementPlanReplenishVo vo) {
  82 + vo.validate();
  83 + procurementPlanReplenishService.update(vo);
  84 + return InvokeResultBuilder.success();
  85 + }
  86 +
  87 + /**
  88 + * 采购计划补单提交审核
  89 + */
  90 + @ApiOperation("采购计划补单提交审核")
  91 + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true)
  92 + @HasPermission({"plan-manage:supple-plan:initiate"})
  93 + @PostMapping("/submit")
  94 + public InvokeResult<Void> submit(@NotBlank(message = "ID不能为空!") String id) {
  95 + procurementPlanReplenishService.submit(id);
  96 + return InvokeResultBuilder.success();
  97 + }
  98 +
  99 + /**
  100 + * 取消采购计划补单
  101 + */
  102 + @ApiOperation("取消采购计划补单")
  103 + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true)
  104 + @HasPermission({"plan-manage:supple-plan:cancel"})
  105 + @PostMapping("/cancel")
  106 + public InvokeResult<Void> cancel(@NotBlank(message = "ID不能为空!") String id) {
  107 + procurementPlanReplenishService.cancel(id);
  108 + return InvokeResultBuilder.success();
  109 + }
  110 +
  111 +}
@@ -288,6 +288,18 @@ public class ProcurementPlanChange extends BaseEntity implements BaseDto { @@ -288,6 +288,18 @@ public class ProcurementPlanChange extends BaseEntity implements BaseDto {
288 private String roleCode; 288 private String roleCode;
289 289
290 /** 290 /**
  291 + * 是否展示审核按钮(非持久化字段)
  292 + */
  293 + @TableField(exist = false)
  294 + private Boolean showExamine = false;
  295 +
  296 + /**
  297 + * 是否展示审核详情按钮(非持久化字段)
  298 + */
  299 + @TableField(exist = false)
  300 + private Boolean showExamineDetail;
  301 +
  302 + /**
291 * 创建人ID 303 * 创建人ID
292 */ 304 */
293 @TableField(fill = FieldFill.INSERT) 305 @TableField(fill = FieldFill.INSERT)
  1 +package com.lframework.xingyun.sc.procurement.entity.replenish;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.FieldFill;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableName;
  6 +import com.lframework.starter.web.core.dto.BaseDto;
  7 +import com.lframework.starter.web.core.entity.BaseEntity;
  8 +import lombok.Data;
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDate;
  11 +import java.time.LocalDateTime;
  12 +
  13 +@Data
  14 +@TableName("procurement_plan_replenish")
  15 +public class ProcurementPlanReplenish extends BaseEntity implements BaseDto {
  16 +
  17 + private static final long serialVersionUID = 1L;
  18 +
  19 + private String id;
  20 +
  21 + private String procurementPlanId;
  22 +
  23 + private String code;
  24 +
  25 + private String companyShortId;
  26 +
  27 + @TableField(exist = false)
  28 + private String companyShortName;
  29 +
  30 + @TableField(exist = false)
  31 + private String companyFullName;
  32 +
  33 + private String supplierId;
  34 +
  35 + @TableField(exist = false)
  36 + private String supplierName;
  37 +
  38 + private String purchaseDepartment;
  39 +
  40 + @TableField(exist = false)
  41 + private String purchaseDepartmentName;
  42 +
  43 + @TableField(exist = false)
  44 + private String purchaseDepartmentCode;
  45 +
  46 + private String region;
  47 +
  48 + @TableField(exist = false)
  49 + private String regionName;
  50 +
  51 + private LocalDate date;
  52 +
  53 + private String validityPeriod;
  54 +
  55 + private String quoterId;
  56 +
  57 + private String quoterName;
  58 +
  59 + private Boolean longTermOperation;
  60 +
  61 + private Boolean terminalCustomer;
  62 +
  63 + private Boolean priced;
  64 +
  65 + private LocalDate pricingDeadline;
  66 +
  67 + private Boolean temporaryPrice;
  68 +
  69 + private Boolean otherExpenseSettlement;
  70 +
  71 + private String deliveryMode;
  72 +
  73 + private Boolean commodityBuyout;
  74 +
  75 + private Boolean qualityBuyout;
  76 +
  77 + private Boolean quantityBuyout;
  78 +
  79 + private Boolean doorDelivery;
  80 +
  81 + private BigDecimal shippingCost;
  82 +
  83 + private BigDecimal loadingFee;
  84 +
  85 + private String invoiceProductName;
  86 +
  87 + private LocalDate deliveryDate;
  88 +
  89 + private String settlementMethod;
  90 +
  91 + private BigDecimal settlementRatio;
  92 +
  93 + private String priceId;
  94 +
  95 + @TableField(exist = false)
  96 + private String priceCode;
  97 +
  98 + private String coordinationReason;
  99 +
  100 + private String invoiceTypeStatus;
  101 +
  102 + private BigDecimal totalQuantity;
  103 +
  104 + private String remark;
  105 +
  106 + private Boolean materialConditionEnabled;
  107 +
  108 + private String materialConditionCopperRice;
  109 +
  110 + private String materialConditionBrightCopper;
  111 +
  112 + private String materialConditionFirstClass;
  113 +
  114 + private String materialConditionSecondClass;
  115 +
  116 + private String materialConditionTinCoated;
  117 +
  118 + private String materialConditionScrap;
  119 +
  120 + private String materialConditionWhiteYellow;
  121 +
  122 + private String materialConditionPhosphorCopper;
  123 +
  124 + private String approvalStatus;
  125 +
  126 + private String processNode;
  127 +
  128 + private String workshopId;
  129 +
  130 + /**
  131 + * 是否展示审核按钮(非持久化字段)
  132 + */
  133 + @TableField(exist = false)
  134 + private Boolean showExamine = false;
  135 +
  136 + /**
  137 + * 是否展示审核详情按钮(非持久化字段)
  138 + */
  139 + @TableField(exist = false)
  140 + private Boolean showExamineDetail;
  141 +
  142 + @TableField(exist = false)
  143 + private String roleCode;
  144 +
  145 + @TableField(fill = FieldFill.INSERT)
  146 + private String createById;
  147 +
  148 + @TableField(fill = FieldFill.INSERT)
  149 + private String createBy;
  150 +
  151 + @TableField(fill = FieldFill.INSERT_UPDATE)
  152 + private String updateById;
  153 +
  154 + @TableField(fill = FieldFill.INSERT_UPDATE)
  155 + private String updateBy;
  156 +
  157 + @TableField(fill = FieldFill.INSERT)
  158 + private LocalDateTime createTime;
  159 +
  160 + @TableField(fill = FieldFill.INSERT_UPDATE)
  161 + private LocalDateTime updateTime;
  162 +}
  1 +package com.lframework.xingyun.sc.procurement.entity.replenish;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.FieldFill;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableName;
  6 +import com.lframework.starter.web.core.dto.BaseDto;
  7 +import com.lframework.starter.web.core.entity.BaseEntity;
  8 +import io.swagger.annotations.ApiModelProperty;
  9 +import lombok.Data;
  10 +import java.math.BigDecimal;
  11 +import java.time.LocalDateTime;
  12 +
  13 +@Data
  14 +@TableName("procurement_plan_replenish_line")
  15 +public class ProcurementPlanReplenishLine extends BaseEntity implements BaseDto {
  16 +
  17 + private static final long serialVersionUID = 1L;
  18 +
  19 + private String id;
  20 +
  21 + private String procurementPlanReplenishId;
  22 +
  23 + /**
  24 + * 品种ID
  25 + */
  26 + private String productId;
  27 +
  28 + /**
  29 + * 产品名称
  30 + */
  31 + @TableField(exist = false)
  32 + private String productName;
  33 +
  34 + /**
  35 + * 料型
  36 + */
  37 + private String materialType;
  38 +
  39 + /**
  40 + * 数量
  41 + */
  42 + private BigDecimal quantity;
  43 +
  44 + /**
  45 + * 实际采购价
  46 + */
  47 + private BigDecimal actualPurchasePrice;
  48 +
  49 + /**
  50 + * 含运到厂价
  51 + */
  52 + private BigDecimal includingShippingPrice;
  53 +
  54 + /**
  55 + * 价格表价格
  56 + */
  57 + private BigDecimal priceListPrices;
  58 +
  59 + /**
  60 + * 协调幅度
  61 + */
  62 + private BigDecimal coordinationRange;
  63 +
  64 + /**
  65 + * 买断料预计损耗
  66 + */
  67 + private BigDecimal estimatedLoss;
  68 +
  69 + /**
  70 + * 申请损耗(%)
  71 + */
  72 + private BigDecimal applicationAttrition;
  73 +
  74 + /**
  75 + * 漆损率(%)
  76 + */
  77 + private BigDecimal paintDamageRatio;
  78 +
  79 + /**
  80 + * 分厂
  81 + */
  82 + private String workshopId;
  83 +
  84 + /**
  85 + * 分厂名称
  86 + */
  87 + private String workshopName;
  88 +
  89 + /**
  90 + * 前端行标识
  91 + */
  92 + private String itemId;
  93 +
  94 + /**
  95 + * 创建人ID
  96 + */
  97 + @TableField(fill = FieldFill.INSERT)
  98 + private String createById;
  99 +
  100 + /**
  101 + * 创建人
  102 + */
  103 + @TableField(fill = FieldFill.INSERT)
  104 + private String createBy;
  105 +
  106 + /**
  107 + * 更新人ID
  108 + */
  109 + @TableField(fill = FieldFill.INSERT_UPDATE)
  110 + private String updateById;
  111 +
  112 + /**
  113 + * 更新人
  114 + */
  115 + @TableField(fill = FieldFill.INSERT_UPDATE)
  116 + private String updateBy;
  117 +
  118 + /**
  119 + * 创建时间
  120 + */
  121 + @TableField(fill = FieldFill.INSERT)
  122 + private LocalDateTime createTime;
  123 +
  124 + /**
  125 + * 更新时间
  126 + */
  127 + @TableField(fill = FieldFill.INSERT_UPDATE)
  128 + private LocalDateTime updateTime;
  129 +}
@@ -25,6 +25,7 @@ import com.lframework.xingyun.basedata.entity.Workshop; @@ -25,6 +25,7 @@ import com.lframework.xingyun.basedata.entity.Workshop;
25 import com.lframework.xingyun.basedata.service.workshop.WorkshopService; 25 import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
26 import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanChangeBo; 26 import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanChangeBo;
27 import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanChangeLineBo; 27 import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanChangeLineBo;
  28 +import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
28 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; 29 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan;
29 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange; 30 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;
30 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine; 31 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine;
@@ -284,6 +285,7 @@ public class ProcurementPlanChangeServiceImpl extends @@ -284,6 +285,7 @@ public class ProcurementPlanChangeServiceImpl extends
284 285
285 PageHelperUtil.startPage(pageIndex, pageSize); 286 PageHelperUtil.startPage(pageIndex, pageSize);
286 List<ProcurementPlanChange> datas = this.query(vo); 287 List<ProcurementPlanChange> datas = this.query(vo);
  288 + fillShowExamineInfo(datas);
287 289
288 return PageResultUtil.convert(new PageInfo<>(datas)); 290 return PageResultUtil.convert(new PageInfo<>(datas));
289 } 291 }
@@ -304,6 +306,8 @@ public class ProcurementPlanChangeServiceImpl extends @@ -304,6 +306,8 @@ public class ProcurementPlanChangeServiceImpl extends
304 throw new DefaultClientException("采购计划变更单不存在!"); 306 throw new DefaultClientException("采购计划变更单不存在!");
305 } 307 }
306 308
  309 + fillShowExamineInfo(Collections.singletonList(entity));
  310 +
307 GetProcurementPlanChangeBo bo = new GetProcurementPlanChangeBo(entity); 311 GetProcurementPlanChangeBo bo = new GetProcurementPlanChangeBo(entity);
308 312
309 List<ProcurementPlanChangeLine> lines = procurementPlanChangeLineMapper.selectList( 313 List<ProcurementPlanChangeLine> lines = procurementPlanChangeLineMapper.selectList(
@@ -718,4 +722,50 @@ public class ProcurementPlanChangeServiceImpl extends @@ -718,4 +722,50 @@ public class ProcurementPlanChangeServiceImpl extends
718 procurementPlanChangeLineService.removeByIds(needDeleteIdList); 722 procurementPlanChangeLineService.removeByIds(needDeleteIdList);
719 } 723 }
720 } 724 }
  725 +
  726 + /**
  727 + * 回填审核按钮展示信息
  728 + *
  729 + * @param datas 数据列表
  730 + */
  731 + private void fillShowExamineInfo(List<ProcurementPlanChange> datas) {
  732 + if (CollectionUtil.isEmpty(datas)) {
  733 + return;
  734 + }
  735 +
  736 + List<ProcurementPlanChange> validDatas = datas.stream()
  737 + .filter(Objects::nonNull)
  738 + .collect(Collectors.toList());
  739 + if (CollectionUtil.isEmpty(validDatas)) {
  740 + return;
  741 + }
  742 +
  743 + List<String> businessIds = validDatas.stream()
  744 + .map(ProcurementPlanChange::getId)
  745 + .collect(Collectors.toList());
  746 +
  747 + // 查询已发起的流程
  748 + List<?> flowByConditionList =
  749 + flowInstanceWrapperService.getFlowByBusinessIdList(businessIds);
  750 + Set<String> flowBusinessIdSet = CollectionUtil.isNotEmpty(flowByConditionList)
  751 + ? flowByConditionList.stream()
  752 + .map(obj -> {
  753 + try {
  754 + return BeanUtil.getProperty(obj, "businessId");
  755 + } catch (Exception e) {
  756 + return null;
  757 + }
  758 + })
  759 + .filter(Objects::nonNull)
  760 + .map(String::valueOf)
  761 + .collect(Collectors.toSet())
  762 + : new HashSet<>();
  763 +
  764 + for (ProcurementPlanChange planChange : validDatas) {
  765 + boolean hasFlow = flowBusinessIdSet.contains(planChange.getId());
  766 + planChange.setShowExamineDetail(hasFlow && StringUtil.isNotBlank(planChange.getApprovalStatus()));
  767 + planChange.setShowExamine(hasFlow && CustomerDevelopStatus.AUDIT.name().equals(planChange.getApprovalStatus()));
  768 + }
  769 + }
  770 +
721 } 771 }
  1 +package com.lframework.xingyun.sc.procurement.impl.replenish;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.Wrapper;
  4 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  5 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenishLine;
  6 +import com.lframework.xingyun.sc.procurement.mappers.replenish.ProcurementPlanReplenishLineMapper;
  7 +import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishLineService;
  8 +import org.springframework.stereotype.Service;
  9 +import java.util.List;
  10 +
  11 +@Service
  12 +public class ProcurementPlanReplenishLineServiceImpl extends
  13 + ServiceImpl<ProcurementPlanReplenishLineMapper, ProcurementPlanReplenishLine> implements
  14 + ProcurementPlanReplenishLineService {
  15 +
  16 + @Override
  17 + public List<ProcurementPlanReplenishLine> getByProcurementPlanReplenishId(String mainId) {
  18 + return getBaseMapper().getByProcurementPlanReplenishId(mainId);
  19 + }
  20 +
  21 + @Override
  22 + public boolean saveBatch(List<ProcurementPlanReplenishLine> list) {
  23 + return super.saveBatch(list);
  24 + }
  25 +
  26 + @Override
  27 + public boolean removeByWrapper(Wrapper<ProcurementPlanReplenishLine> wrapper) {
  28 + return super.remove(wrapper);
  29 + }
  30 +}
  1 +package com.lframework.xingyun.sc.procurement.impl.replenish;
  2 +
  3 +import cn.hutool.core.bean.BeanUtil;
  4 +import com.baomidou.mybatisplus.core.conditions.Wrapper;
  5 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  6 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  7 +import com.github.pagehelper.PageInfo;
  8 +import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
  9 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  10 +import com.lframework.starter.common.exceptions.impl.InputErrorException;
  11 +import com.lframework.starter.common.utils.Assert;
  12 +import com.lframework.starter.common.utils.CollectionUtil;
  13 +import com.lframework.starter.common.utils.StringUtil;
  14 +import com.lframework.starter.web.core.annotations.oplog.OpLog;
  15 +import com.lframework.starter.web.core.components.resp.PageResult;
  16 +import com.lframework.starter.web.core.components.security.SecurityUtil;
  17 +import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
  18 +import com.lframework.starter.web.core.utils.*;
  19 +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  20 +import com.lframework.starter.web.inner.entity.SysRole;
  21 +import com.lframework.starter.web.inner.entity.SysUser;
  22 +import com.lframework.starter.web.inner.service.system.SysRoleService;
  23 +import com.lframework.starter.web.inner.service.system.SysUserService;
  24 +import com.lframework.xingyun.basedata.entity.Workshop;
  25 +import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
  26 +import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanReplenishBo;
  27 +import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanReplenishLineBo;
  28 +import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
  29 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan;
  30 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine;
  31 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish;
  32 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenishLine;
  33 +import com.lframework.xingyun.sc.procurement.mappers.replenish.ProcurementPlanReplenishMapper;
  34 +import com.lframework.xingyun.sc.procurement.service.buyout.ProcurementBuyoutApplyService;
  35 +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanLineService;
  36 +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService;
  37 +import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishLineService;
  38 +import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService;
  39 +import com.lframework.xingyun.sc.procurement.vo.buyout.CreateProcurementBuyoutApplyVo;
  40 +import com.lframework.xingyun.sc.procurement.vo.plan.CreateProcurementPlanVo;
  41 +import com.lframework.xingyun.sc.procurement.vo.plan.ProcurementPlanLineVo;
  42 +import com.lframework.xingyun.sc.procurement.vo.replenish.CreateProcurementPlanReplenishLineVo;
  43 +import com.lframework.xingyun.sc.procurement.vo.replenish.CreateProcurementPlanReplenishVo;
  44 +import com.lframework.xingyun.sc.procurement.vo.replenish.QueryProcurementPlanReplenishVo;
  45 +import com.lframework.xingyun.sc.procurement.vo.replenish.UpdateProcurementPlanReplenishLineVo;
  46 +import com.lframework.xingyun.sc.procurement.vo.replenish.UpdateProcurementPlanReplenishVo;
  47 +import java.util.*;
  48 +import java.util.stream.Collectors;
  49 +import javax.annotation.Resource;
  50 +import org.springframework.stereotype.Service;
  51 +import org.springframework.transaction.annotation.Transactional;
  52 +
  53 +@Service
  54 +public class ProcurementPlanReplenishServiceImpl
  55 + extends BaseMpServiceImpl<ProcurementPlanReplenishMapper, ProcurementPlanReplenish>
  56 + implements ProcurementPlanReplenishService {
  57 +
  58 + private static final String BPM_FLAG = "PLAN_REPLENISH";
  59 + /**
  60 + * 允许创建补单的原计划流程状态
  61 + */
  62 + private static final List<String> PROCESS_STATUSES = Arrays.asList("COMPLETED", "ABORTED");
  63 +
  64 + @Resource
  65 + private ProcurementPlanReplenishLineService procurementPlanReplenishLineService;
  66 + @Resource
  67 + private ProcurementPlanService procurementPlanService;
  68 + @Resource
  69 + private SysUserService sysUserService;
  70 + @Resource
  71 + private FlowInstanceWrapperService flowInstanceWrapperService;
  72 + @Resource
  73 + private SysRoleService sysRoleService;
  74 + @Resource
  75 + private ProcurementPlanLineService procurementPlanLineService;
  76 + @Resource
  77 + private WorkshopService workshopService;
  78 + @Resource
  79 + private ProcurementBuyoutApplyService procurementBuyoutApplyService;
  80 +
  81 +
  82 + @Override
  83 + public PageResult<ProcurementPlanReplenish> query(Integer pageIndex, Integer pageSize,
  84 + QueryProcurementPlanReplenishVo vo) {
  85 + Assert.greaterThanZero(pageIndex);
  86 + Assert.greaterThanZero(pageSize);
  87 +
  88 + PageHelperUtil.startPage(pageIndex, pageSize);
  89 + List<ProcurementPlanReplenish> datas = this.query(vo);
  90 + if (CollectionUtil.isNotEmpty(datas)) {
  91 + fillShowExamineInfo(datas);
  92 + }
  93 + return PageResultUtil.convert(new PageInfo<>(datas));
  94 + }
  95 +
  96 + @Override
  97 + public List<ProcurementPlanReplenish> query(QueryProcurementPlanReplenishVo vo) {
  98 + return this.getBaseMapper().query(vo);
  99 + }
  100 +
  101 + @Override
  102 + public GetProcurementPlanReplenishBo findDetail(String id) {
  103 + if (StringUtil.isBlank(id)) {
  104 + throw new InputErrorException("ID不能为空!");
  105 + }
  106 +
  107 + // 查询主表数据
  108 + ProcurementPlanReplenish entity = this.getBaseMapper().findById(id);
  109 + if (entity == null) {
  110 + throw new DefaultClientException("采购计划补单不存在!");
  111 + }
  112 + fillShowExamineInfo(Collections.singletonList(entity));
  113 +
  114 + // 转换为 BO
  115 + GetProcurementPlanReplenishBo bo = new GetProcurementPlanReplenishBo(entity);
  116 +
  117 + // 查询明细数据并赋值
  118 + List<ProcurementPlanReplenishLine> lines =
  119 + procurementPlanReplenishLineService.getByProcurementPlanReplenishId(id);
  120 + if (!CollectionUtil.isEmpty(lines)) {
  121 + bo.setProcurementPlanReplenishLineList(
  122 + lines.stream().map(GetProcurementPlanReplenishLineBo::new).collect(Collectors.toList()));
  123 + }
  124 +
  125 + return bo;
  126 + }
  127 +
  128 + @Override
  129 + public ProcurementPlanReplenish getById(String id) {
  130 + return super.getById(id);
  131 + }
  132 +
  133 + @Override
  134 + @Transactional(rollbackFor = Exception.class)
  135 + @OpLog(type = OtherOpLogType.class, name = "创建采购计划补单,原计划ID:{},补单ID:{}", params = {"#vo.procurementPlanId", "#result"})
  136 + public String create(CreateProcurementPlanReplenishVo vo) {
  137 + // 校验原采购计划ID不能为空
  138 + if (StringUtil.isBlank(vo.getProcurementPlanId())) {
  139 + throw new InputErrorException("原采购计划ID不能为空!");
  140 + }
  141 + // 查询原采购计划
  142 + ProcurementPlan plan = procurementPlanService.getById(vo.getProcurementPlanId());
  143 + if (plan == null) {
  144 + throw new DefaultClientException("原采购计划不存在!");
  145 + }
  146 + // 校验原计划流程状态必须为 COMPLETED 或 ABORTED
  147 + if (StringUtil.isBlank(plan.getProcessStatus())
  148 + || !PROCESS_STATUSES.contains(plan.getProcessStatus())) {
  149 + throw new DefaultClientException("原采购计划状态不允许补单,请确认计划已中止/完成!");
  150 + }
  151 + // 主计划,检查自身是否在变更中
  152 + if ("CHANGING".equals(plan.getChangeStatus())
  153 + || "REPLENISHING".equals(plan.getReplenishmentStatus())) {
  154 + throw new DefaultClientException("主计划正在变更/补单中,不允许操作!");
  155 + }
  156 + // 检查所有子计划是否在变更中
  157 + Wrapper<ProcurementPlan> subWrapper = Wrappers.lambdaQuery(ProcurementPlan.class)
  158 + .eq(ProcurementPlan::getParentId, vo.getProcurementPlanId())
  159 + .and(w -> w.eq(ProcurementPlan::getChangeStatus, "CHANGING")
  160 + .or().eq(ProcurementPlan::getReplenishmentStatus, "REPLENISHING"));
  161 + long subChangingCount = procurementPlanService.count(subWrapper);
  162 + if (subChangingCount > 0) {
  163 + throw new DefaultClientException("存在子计划正在变更/补单中,不允许操作!");
  164 + }
  165 + String currentUserId = SecurityUtil.getCurrentUser().getId();
  166 + List<SysRole> roles = sysRoleService.getByUserId(currentUserId);
  167 + List<String> roleCodes = CollectionUtil.isEmpty(roles) ? new java.util.ArrayList<>()
  168 + : roles.stream().map(SysRole::getCode).collect(Collectors.toList());
  169 + // 生成新补单
  170 + ProcurementPlanReplenish replenish = new ProcurementPlanReplenish();
  171 + BeanUtil.copyProperties(vo, replenish);
  172 + // 设置ID
  173 + replenish.setId(IdUtil.getId());
  174 + if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg")
  175 + || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) {
  176 + replenish.setProcessNode("CGCZG");
  177 + } else if (roleCodes.contains("qyjl")) {
  178 + replenish.setProcessNode("QYJL");
  179 + } else if (roleCodes.contains("nmcgkywy")) {
  180 + replenish.setProcessNode("YWY");
  181 + }
  182 + this.save(replenish);
  183 +
  184 + // 保存补单明细
  185 + List<ProcurementPlanReplenishLine> lines = new ArrayList<>();
  186 + if (!CollectionUtil.isEmpty(vo.getProcurementPlanReplenishLineList())) {
  187 + for (CreateProcurementPlanReplenishLineVo lineVo : vo.getProcurementPlanReplenishLineList()) {
  188 + ProcurementPlanReplenishLine line = new ProcurementPlanReplenishLine();
  189 + BeanUtil.copyProperties(lineVo, line);
  190 + line.setId(IdUtil.getId());
  191 + line.setProcurementPlanReplenishId(replenish.getId());
  192 + lines.add(line);
  193 + }
  194 + }
  195 + if (!CollectionUtil.isEmpty(lines)) {
  196 + procurementPlanReplenishLineService.saveBatch(lines);
  197 + }
  198 +
  199 + // 更新原计划的 replenishment_status = REPLENISHING
  200 + Wrapper<ProcurementPlan> planWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
  201 + .set(ProcurementPlan::getReplenishmentStatus, "REPLENISHING")
  202 + .eq(ProcurementPlan::getId, vo.getProcurementPlanId());
  203 + procurementPlanService.update(planWrapper);
  204 +
  205 + // 回填操作日志
  206 + OpLogUtil.setVariable("id", replenish.getId());
  207 + OpLogUtil.setExtra(replenish);
  208 +
  209 + return replenish.getId();
  210 + }
  211 +
  212 + @Override
  213 + @Transactional(rollbackFor = Exception.class)
  214 + @OpLog(type = OtherOpLogType.class, name = "修改采购计划补单,ID:{}", params = {"#vo.id"})
  215 + public void update(UpdateProcurementPlanReplenishVo vo) {
  216 + // 校验ID不能为空
  217 + if (StringUtil.isBlank(vo.getId())) {
  218 + throw new InputErrorException("ID不能为空!");
  219 + }
  220 + // 查询补单
  221 + ProcurementPlanReplenish entity = this.getById(vo.getId());
  222 + if (entity == null) {
  223 + throw new DefaultClientException("采购计划补单不存在!");
  224 + }
  225 + // 更新主表
  226 + ProcurementPlanReplenish replenish = new ProcurementPlanReplenish();
  227 + BeanUtil.copyProperties(vo, replenish);
  228 + replenish.setId(vo.getId());
  229 + this.updateById(replenish);
  230 +
  231 + // 先删除明细后插入
  232 + procurementPlanReplenishLineService.removeByWrapper(
  233 + Wrappers.lambdaQuery(ProcurementPlanReplenishLine.class)
  234 + .eq(ProcurementPlanReplenishLine::getProcurementPlanReplenishId, vo.getId()));
  235 +
  236 + // 重新插入明细
  237 + if (!CollectionUtil.isEmpty(vo.getProcurementPlanReplenishLineList())) {
  238 + List<ProcurementPlanReplenishLine> lines = new ArrayList<>();
  239 + for (CreateProcurementPlanReplenishLineVo lineVo : vo.getProcurementPlanReplenishLineList()) {
  240 + ProcurementPlanReplenishLine line = new ProcurementPlanReplenishLine();
  241 + BeanUtil.copyProperties(lineVo, line);
  242 + line.setId(IdUtil.getId());
  243 + line.setProcurementPlanReplenishId(vo.getId());
  244 + lines.add(line);
  245 + }
  246 + procurementPlanReplenishLineService.saveBatch(lines);
  247 + }
  248 +
  249 + // 回填操作日志
  250 + OpLogUtil.setVariable("id", vo.getId());
  251 + OpLogUtil.setExtra(entity);
  252 + }
  253 +
  254 + @Override
  255 + @Transactional(rollbackFor = Exception.class)
  256 + @OpLog(type = OtherOpLogType.class, name = "取消采购计划补单,ID:{}", params = {"#id"})
  257 + public void cancel(String id) {
  258 + // 校验ID不能为空
  259 + if (StringUtil.isBlank(id)) {
  260 + throw new InputErrorException("ID不能为空!");
  261 + }
  262 + // 查询补单
  263 + ProcurementPlanReplenish entity = this.getById(id);
  264 + if (entity == null) {
  265 + throw new DefaultClientException("采购计划补单不存在!");
  266 + }
  267 +
  268 + LambdaUpdateWrapper<ProcurementPlanReplenish> updateWrapper =
  269 + Wrappers.lambdaUpdate(ProcurementPlanReplenish.class)
  270 + .set(ProcurementPlanReplenish::getApprovalStatus, "CANCEL")
  271 + .set(ProcurementPlanReplenish::getProcessNode, null)
  272 + .eq(ProcurementPlanReplenish::getId, id);
  273 + this.getBaseMapper().update(updateWrapper);
  274 +
  275 + // 更新原计划的 replenishment_status = REPLENISHED
  276 + Wrapper<ProcurementPlan> planWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
  277 + .set(ProcurementPlan::getReplenishmentStatus, "REPLENISHED")
  278 + .eq(ProcurementPlan::getId, entity.getProcurementPlanId());
  279 + procurementPlanService.update(planWrapper);
  280 +
  281 + // 回填操作日志
  282 + OpLogUtil.setVariable("id", id);
  283 + OpLogUtil.setExtra(entity);
  284 + }
  285 +
  286 + @Override
  287 + @Transactional(rollbackFor = Exception.class)
  288 + @OpLog(type = OtherOpLogType.class, name = "采购计划补单提交审核,ID:{}", params = {"#id"})
  289 + public void submit(String id) {
  290 + // 校验ID不能为空
  291 + if (StringUtil.isBlank(id)) {
  292 + throw new InputErrorException("ID不能为空!");
  293 + }
  294 + // 查询补单
  295 + ProcurementPlanReplenish entity = this.getBaseMapper().findById(id);
  296 + if (entity == null) {
  297 + throw new DefaultClientException("采购计划补单不存在!");
  298 + }
  299 + // 获取当前用户
  300 + String currentUserId = SecurityUtil.getCurrentUser().getId();
  301 + SysUser currentUser = sysUserService.findById(currentUserId);
  302 + if (currentUser == null) {
  303 + throw new DefaultClientException("当前用户不存在!");
  304 + }
  305 + String processNode = null;
  306 + String node = entity.getProcessNode();
  307 + if ("YWY".equals(node)) {
  308 + processNode = "QYJL";
  309 + } else if ("QYJL".equals(node)) {
  310 + processNode = "CGCZG";
  311 + } else if ("CGCZG".equals(node)) {
  312 + processNode = "GYGLKJHGLY";
  313 + }
  314 +
  315 + // 更新审核状态为审核中
  316 + LambdaUpdateWrapper<ProcurementPlanReplenish> updateWrapper =
  317 + Wrappers.lambdaUpdate(ProcurementPlanReplenish.class)
  318 + .set(ProcurementPlanReplenish::getApprovalStatus, "AUDIT")
  319 + .set(ProcurementPlanReplenish::getProcessNode, processNode)
  320 + .eq(ProcurementPlanReplenish::getId, id);
  321 + this.getBaseMapper().update(updateWrapper);
  322 +
  323 + // 发起BPM审核流程
  324 + List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId());
  325 + String roleCode = null;
  326 + if (CollectionUtil.isNotEmpty(sysRoleList)) {
  327 + // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率
  328 + Set<String> roleCodeSet = sysRoleList.stream()
  329 + .map(SysRole::getCode)
  330 + .collect(Collectors.toSet());
  331 +
  332 + // 2. 判断是否包含采购主管相关的角色
  333 + if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg")
  334 + || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) {
  335 + roleCode = "cgczg";
  336 + } else if (roleCodeSet.contains("qyjl")) {
  337 + // 3. 如果没有,继续判断是否包含区域经理
  338 + roleCode = "qyjl";
  339 + } else if (roleCodeSet.contains("nmcgkywy")) {
  340 + // 4. 如果还没有,继续判断是否包含内贸采购科业务员
  341 + roleCode = "nmcgkywy";
  342 + }
  343 + }
  344 + entity.setRoleCode(roleCode);
  345 + flowInstanceWrapperService.startInstance(BPM_FLAG, entity.getId(), BPM_FLAG, entity);
  346 +
  347 + // 回填操作日志
  348 + OpLogUtil.setVariable("id", id);
  349 + OpLogUtil.setExtra(entity);
  350 + }
  351 +
  352 + @Override
  353 + @Transactional(rollbackFor = Exception.class)
  354 + @OpLog(type = OtherOpLogType.class, name = "更新采购计划补单审核状态,ID:{}", params = {"#id"})
  355 + public void updateApprovalStatus(String id, String approvalStatus) {
  356 + // 校验ID和审核状态不能为空
  357 + if (StringUtil.isBlank(id) || StringUtil.isBlank(approvalStatus)) {
  358 + throw new InputErrorException("ID、审核状态不能为空!");
  359 + }
  360 +
  361 + // 查询补单
  362 + ProcurementPlanReplenish entity = this.getById(id);
  363 + if (entity == null) {
  364 + throw new DefaultClientException("采购计划补单不存在!");
  365 + }
  366 +
  367 + if ("PASS".equals(approvalStatus)) {
  368 + // 审核通过
  369 + LambdaUpdateWrapper<ProcurementPlanReplenish> updateWrapper =
  370 + Wrappers.lambdaUpdate(ProcurementPlanReplenish.class)
  371 + .set(ProcurementPlanReplenish::getApprovalStatus, "PASS")
  372 + .set(ProcurementPlanReplenish::getProcessNode, null)
  373 + .eq(ProcurementPlanReplenish::getId, id);
  374 + this.getBaseMapper().update(updateWrapper);
  375 +
  376 + // 更新原计划的 replenishment_status = REPLENISHED
  377 + Wrapper<ProcurementPlan> planWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
  378 + .set(ProcurementPlan::getReplenishmentStatus, "REPLENISHED")
  379 + .eq(ProcurementPlan::getId, entity.getProcurementPlanId());
  380 + procurementPlanService.update(planWrapper);
  381 + //todo 生成新的合同
  382 + //生成一个补的主计划
  383 + // 归档主计划(ID新生成,保持原code以区分,添加补单标识)
  384 + List<ProcurementPlanReplenishLine> mainLines =
  385 + procurementPlanReplenishLineService.getByProcurementPlanReplenishId(id);
  386 + List<String> allWorkshopIds = mainLines.stream()
  387 + .map(ProcurementPlanReplenishLine::getWorkshopId)
  388 + .filter(StringUtil::isNotBlank)
  389 + .distinct()
  390 + .collect(Collectors.toList());
  391 +
  392 + ProcurementPlan archivedMain = BeanUtil.copyProperties(entity, ProcurementPlan.class);
  393 + archivedMain.setId(IdUtil.getId());
  394 + archivedMain.setParentId(null);
  395 + archivedMain.setCode(entity.getCode());
  396 + archivedMain.setDeleted(Boolean.FALSE);
  397 + archivedMain.setProcessNode(null);
  398 + archivedMain.setProcessStatus(null);
  399 + archivedMain.setApprovalStatus(null);
  400 + if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() > 1) {
  401 + archivedMain.setFrozen(Boolean.TRUE);
  402 + archivedMain.setWorkshopId(null);
  403 + } else {
  404 + archivedMain.setFrozen(Boolean.FALSE);
  405 + archivedMain.setWorkshopId(mainLines.get(0).getWorkshopId());
  406 + }
  407 + archivedMain.setPlanType("补");
  408 + archivedMain.setChangeStatus(null);
  409 + archivedMain.setReplenishmentStatus(null);
  410 + procurementPlanService.save(archivedMain);
  411 +
  412 + //生成买断操作申请单
  413 + if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() == 1) {
  414 + CreateProcurementBuyoutApplyVo vo = new CreateProcurementBuyoutApplyVo();
  415 + vo.setProcurementPlanId(archivedMain.getId());
  416 + procurementBuyoutApplyService.create(vo);
  417 + }
  418 + // 主计划子表也复制一份
  419 + List<ProcurementPlanLine> archivedMainLines = new ArrayList<>();
  420 + if (CollectionUtil.isNotEmpty(mainLines)) {
  421 + for (ProcurementPlanReplenishLine line : mainLines) {
  422 + ProcurementPlanLine nLine = BeanUtil.copyProperties(line, ProcurementPlanLine.class);
  423 + nLine.setId(IdUtil.getId());
  424 + nLine.setProcurementPlanId(archivedMain.getId());
  425 + archivedMainLines.add(nLine);
  426 + }
  427 + procurementPlanLineService.saveBatch(archivedMainLines);
  428 + }
  429 + //拆分了分厂
  430 + if (CollectionUtil.isNotEmpty(allWorkshopIds) && allWorkshopIds.size() > 1) {
  431 + Map<String, String> deptId2CodeMap = new HashMap<>();
  432 + List<Workshop> workshopList = workshopService.listByIds(allWorkshopIds);
  433 + if (CollectionUtil.isNotEmpty(workshopList)) {
  434 + deptId2CodeMap = workshopList.stream()
  435 + .filter(d -> StringUtil.isNotBlank(d.getCode()))
  436 + .collect(Collectors.toMap(Workshop::getId, Workshop::getCode, (v1, v2) -> v1));
  437 + }
  438 +
  439 + // 分厂顺序:yfc(01) / efc(02) / sfc(03) / ztfc(04)
  440 + Map<String, Integer> workOrderMap = new LinkedHashMap<>();
  441 + workOrderMap.put("yfc", 1);
  442 + workOrderMap.put("efc", 2);
  443 + workOrderMap.put("sfc", 3);
  444 + workOrderMap.put("ztfc", 4);
  445 +
  446 + // 按分厂code分组明细(非法/缺失code的明细都提示)
  447 + Map<String, List<ProcurementPlanLine>> code2LinesMap = new LinkedHashMap<>();
  448 + for (ProcurementPlanLine line : archivedMainLines) {
  449 + String code = deptId2CodeMap.get(line.getWorkshopId());
  450 + code2LinesMap.computeIfAbsent(code, k -> new ArrayList<>()).add(line);
  451 + }
  452 +
  453 + // 2. 多分厂:按 yfc/efc/sfc/ztfc 的顺序生成子计划
  454 + List<Map.Entry<String, List<ProcurementPlanLine>>> sortedEntries = code2LinesMap.entrySet().stream()
  455 + .sorted(Comparator.comparingInt(e -> workOrderMap.getOrDefault(e.getKey(), Integer.MAX_VALUE)))
  456 + .collect(Collectors.toList());
  457 +
  458 + int subSeq = 0;
  459 + for (Map.Entry<String, List<ProcurementPlanLine>> entry : sortedEntries) {
  460 + List<ProcurementPlanLine> factoryLines = entry.getValue();
  461 + if (CollectionUtil.isEmpty(factoryLines)) {
  462 + continue;
  463 + }
  464 + subSeq++;
  465 + String suffix = String.format("%02d", subSeq);
  466 + String subCode = archivedMain.getCode() + "_" + suffix;
  467 +
  468 + // 3. 子计划主表:除明细/编号/parentId/流程状态节点外,其余同主计划
  469 + CreateProcurementPlanVo subVo = BeanUtil.copyProperties(archivedMain, CreateProcurementPlanVo.class);
  470 + subVo.setCode(subCode);
  471 + subVo.setParentId(archivedMain.getId());
  472 + subVo.setProcessStatus(null);
  473 + subVo.setProcessNode(null);
  474 + subVo.setApprovalStatus(null);
  475 + subVo.setFrozen(Boolean.FALSE);
  476 + archivedMain.setPlanType("补");
  477 + // 子计划的分厂就是当前组的明细分厂(同组内 workshopId 一样),直接赋值
  478 + subVo.setWorkshopId(CollectionUtil.isNotEmpty(factoryLines) ? factoryLines.get(0).getWorkshopId() : null);
  479 +
  480 + // 子明细:只保留当前分厂,workshopId 保持原明细的,其它字段按原明细 copy
  481 + List<ProcurementPlanLineVo> subLineVoList = new ArrayList<>();
  482 + for (ProcurementPlanLine line : factoryLines) {
  483 + ProcurementPlanLineVo lineVo = BeanUtil.copyProperties(line, ProcurementPlanLineVo.class);
  484 + lineVo.setWorkshopId(line.getWorkshopId());
  485 + subLineVoList.add(lineVo);
  486 + }
  487 + subVo.setProcurementPlanLineList(subLineVoList);
  488 + // 子计划创建(不重新生成编号,因为使用父code+后缀)
  489 + procurementPlanService.createSubPlan(subVo);
  490 + }
  491 + }
  492 + } else if ("REFUSE".equals(approvalStatus)) {
  493 + List<SysRole> roles = sysRoleService.getByUserId(entity.getCreateById());
  494 + List<String> roleCodes = CollectionUtil.isEmpty(roles) ? new java.util.ArrayList<>()
  495 + : roles.stream().map(SysRole::getCode).collect(Collectors.toList());
  496 + String processNode = null;
  497 + if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg")
  498 + || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) {
  499 + processNode = "CGCZG";
  500 + } else if (roleCodes.contains("qyjl")) {
  501 + processNode = "QYJL";
  502 + } else if (roleCodes.contains("nmcgkywy")) {
  503 + processNode = "YWY";
  504 + }
  505 + // 审核拒绝
  506 + LambdaUpdateWrapper<ProcurementPlanReplenish> updateWrapper =
  507 + Wrappers.lambdaUpdate(ProcurementPlanReplenish.class)
  508 + .set(ProcurementPlanReplenish::getApprovalStatus, "REFUSE")
  509 + .set(ProcurementPlanReplenish::getProcessNode, processNode)
  510 + .eq(ProcurementPlanReplenish::getId, id);
  511 + this.getBaseMapper().update(updateWrapper);
  512 + }
  513 +
  514 + // 回填操作日志
  515 + OpLogUtil.setVariable("id", id);
  516 + OpLogUtil.setExtra(entity);
  517 + }
  518 +
  519 + @Override
  520 + @Transactional(rollbackFor = Exception.class)
  521 + @OpLog(type = OtherOpLogType.class, name = "采购计划补单流程数据修改,ID:{}", params = {"#id"})
  522 + public void updateNoFlowInstance(Map<String, Object> map) {
  523 + try {
  524 + // 流程节点编码
  525 + Object nodeCodeObj = map.get("nodeCode");
  526 + String nodeCode = nodeCodeObj == null ? null : String.valueOf(nodeCodeObj);
  527 +
  528 + // 审核状态
  529 + Object examStatusObj = map.get("examStatus");
  530 + String examStatus = examStatusObj == null ? null : String.valueOf(examStatusObj);
  531 +
  532 + // 业务ID
  533 + Object bizIdObj = map.get("bizId");
  534 + String bizId = bizIdObj == null ? null : String.valueOf(bizIdObj);
  535 +
  536 + if (StringUtil.isBlank(bizId)) {
  537 + // 将 Map 转换为 Vo,尝试获取 ID
  538 + String json = JsonUtil.toJsonString(map);
  539 + UpdateProcurementPlanReplenishVo vo = JsonUtil.parseObject(json, UpdateProcurementPlanReplenishVo.class);
  540 + bizId = vo == null ? null : vo.getId();
  541 + if (vo != null && StringUtil.isNotBlank(vo.getId())) {
  542 + // 更新主表字段
  543 + ProcurementPlanReplenish replenish = new ProcurementPlanReplenish();
  544 + BeanUtil.copyProperties(vo, replenish);
  545 + this.updateById(replenish);
  546 +
  547 + // 保存或更新明细
  548 + saveOrUpdateLines(vo.getId(), vo.getProcurementPlanReplenishLineList());
  549 + }
  550 + }
  551 +
  552 + if ("PASS".equals(examStatus)) {
  553 + // 根据节点编码设置下一个流程节点
  554 + String processNode = null;
  555 + if ("plan_replenish_qyjl".equals(nodeCode)) {
  556 + processNode = "CGCZG";
  557 + } else if ("plan_replenish_ztcgczg".equals(nodeCode) || "plan_replenish_ltcgczg".equals(nodeCode)
  558 + || "plan_replenish_htcgyczg".equals(nodeCode) || "plan_replenish_htcgeczg".equals(nodeCode)) {
  559 + processNode = "GYGLKJHGLY";
  560 + } else if ("plan_replenish_gyglkjhgly".equals(nodeCode)) {
  561 + processNode = "GYGLKZLGLG";
  562 + } else if ("plan_replenish_gyglkzlglg".equals(nodeCode)) {
  563 + processNode = "GYGLKZG";
  564 + } else if ("plan_replenish_gyglkzg".equals(nodeCode)) {
  565 + processNode = "GYBZG";
  566 + } else if ("plan_replenish_gybzg".equals(nodeCode)) {
  567 + processNode = "YSFG";
  568 + }
  569 +
  570 + if (StringUtil.isNotBlank(bizId) && StringUtil.isNotBlank(processNode)) {
  571 + LambdaUpdateWrapper<ProcurementPlanReplenish> updateWrapper =
  572 + Wrappers.lambdaUpdate(ProcurementPlanReplenish.class)
  573 + .set(ProcurementPlanReplenish::getProcessNode, processNode)
  574 + .eq(ProcurementPlanReplenish::getId, bizId);
  575 + this.getBaseMapper().update(updateWrapper);
  576 + }
  577 + }
  578 +
  579 + // 回填操作日志
  580 + if (StringUtil.isNotBlank(bizId)) {
  581 + OpLogUtil.setVariable("id", bizId);
  582 + }
  583 + } catch (Exception e) {
  584 + e.printStackTrace();
  585 + }
  586 + }
  587 +
  588 + /**
  589 + * 保存或更新采购计划补单明细
  590 + *
  591 + * @param replenishId 补单ID
  592 + * @param lineList 明细列表
  593 + */
  594 + private void saveOrUpdateLines(String replenishId,
  595 + List<? extends CreateProcurementPlanReplenishLineVo> lineList) {
  596 + // 查询旧明细
  597 + List<ProcurementPlanReplenishLine> oldLineList =
  598 + procurementPlanReplenishLineService.getByProcurementPlanReplenishId(replenishId);
  599 + Map<String, ProcurementPlanReplenishLine> oldLineMap = CollectionUtil.isEmpty(oldLineList)
  600 + ? Collections.emptyMap()
  601 + : oldLineList.stream()
  602 + .collect(Collectors.toMap(ProcurementPlanReplenishLine::getId, v -> v));
  603 +
  604 + List<String> existIdList = new ArrayList<>();
  605 + if (!CollectionUtil.isEmpty(lineList)) {
  606 + for (CreateProcurementPlanReplenishLineVo lineVo : lineList) {
  607 + UpdateProcurementPlanReplenishLineVo updateLineVo = (UpdateProcurementPlanReplenishLineVo) lineVo;
  608 + if (StringUtil.isNotBlank(updateLineVo.getId())) {
  609 + // 更新已有明细
  610 + ProcurementPlanReplenishLine oldLine = oldLineMap.get(updateLineVo.getId());
  611 + if (oldLine == null) {
  612 + throw new DefaultClientException("采购计划补单明细不存在或不属于当前补单!");
  613 + }
  614 +
  615 + existIdList.add(updateLineVo.getId());
  616 + updateLineVo.setProcurementPlanReplenishId(replenishId);
  617 + if (StringUtil.isBlank(updateLineVo.getItemId())) {
  618 + updateLineVo.setItemId(oldLine.getItemId());
  619 + }
  620 + ProcurementPlanReplenishLine updateLine =
  621 + BeanUtil.copyProperties(updateLineVo, ProcurementPlanReplenishLine.class);
  622 + updateLine.setId(updateLineVo.getId());
  623 + procurementPlanReplenishLineService.updateById(updateLine);
  624 + } else {
  625 + // 新增明细
  626 + ProcurementPlanReplenishLine createLine =
  627 + BeanUtil.copyProperties(lineVo, ProcurementPlanReplenishLine.class);
  628 + createLine.setId(IdUtil.getId());
  629 + createLine.setProcurementPlanReplenishId(replenishId);
  630 + procurementPlanReplenishLineService.save(createLine);
  631 + existIdList.add(createLine.getId());
  632 + }
  633 + }
  634 + }
  635 +
  636 + // 删除不在新列表中的旧明细
  637 + List<ProcurementPlanReplenishLine> safeOldLineList =
  638 + oldLineList == null ? Collections.emptyList() : oldLineList;
  639 + List<String> needDeleteIdList = safeOldLineList.stream()
  640 + .map(ProcurementPlanReplenishLine::getId)
  641 + .filter(oldLineId -> !existIdList.contains(oldLineId))
  642 + .collect(Collectors.toList());
  643 + if (CollectionUtil.isNotEmpty(needDeleteIdList)) {
  644 + procurementPlanReplenishLineService.removeByIds(needDeleteIdList);
  645 + }
  646 + }
  647 +
  648 + /**
  649 + * 回填审核按钮展示信息
  650 + *
  651 + * @param datas 数据列表
  652 + */
  653 + private void fillShowExamineInfo(List<ProcurementPlanReplenish> datas) {
  654 + if (CollectionUtil.isEmpty(datas)) {
  655 + return;
  656 + }
  657 +
  658 + List<ProcurementPlanReplenish> validDatas = datas.stream()
  659 + .filter(Objects::nonNull)
  660 + .collect(Collectors.toList());
  661 + if (CollectionUtil.isEmpty(validDatas)) {
  662 + return;
  663 + }
  664 +
  665 + List<String> businessIds = validDatas.stream()
  666 + .map(ProcurementPlanReplenish::getId)
  667 + .collect(Collectors.toList());
  668 +
  669 + // 查询已发起的流程
  670 + List<?> flowByConditionList =
  671 + flowInstanceWrapperService.getFlowByBusinessIdList(businessIds);
  672 + Set<String> flowBusinessIdSet = CollectionUtil.isNotEmpty(flowByConditionList)
  673 + ? flowByConditionList.stream()
  674 + .map(obj -> {
  675 + try {
  676 + return BeanUtil.getProperty(obj, "businessId");
  677 + } catch (Exception e) {
  678 + return null;
  679 + }
  680 + })
  681 + .filter(Objects::nonNull)
  682 + .map(String::valueOf)
  683 + .collect(Collectors.toSet())
  684 + : new HashSet<>();
  685 +
  686 + for (ProcurementPlanReplenish replenish : validDatas) {
  687 + boolean hasFlow = flowBusinessIdSet.contains(replenish.getId());
  688 + replenish.setShowExamineDetail(hasFlow && StringUtil.isNotBlank(replenish.getApprovalStatus()));
  689 + replenish.setShowExamine(hasFlow && CustomerDevelopStatus.AUDIT.name().equals(replenish.getApprovalStatus()));
  690 + }
  691 + }
  692 +}
  1 +package com.lframework.xingyun.sc.procurement.mappers.replenish;
  2 +
  3 +import com.lframework.starter.web.core.mapper.BaseMapper;
  4 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenishLine;
  5 +import org.apache.ibatis.annotations.Param;
  6 +import java.util.List;
  7 +
  8 +public interface ProcurementPlanReplenishLineMapper extends BaseMapper<ProcurementPlanReplenishLine> {
  9 +
  10 + /**
  11 + * 根据补单ID查询明细
  12 + *
  13 + * @param mainId
  14 + * @return
  15 + */
  16 + List<ProcurementPlanReplenishLine> getByProcurementPlanReplenishId(@Param("mainId") String mainId);
  17 +
  18 + /**
  19 + * 根据补单ID删除明细(物理删除)
  20 + *
  21 + * @param mainId
  22 + */
  23 + void delByProcurementPlanReplenishId(@Param("mainId") String mainId);
  24 +}
  1 +package com.lframework.xingyun.sc.procurement.mappers.replenish;
  2 +
  3 +import com.lframework.starter.web.core.mapper.BaseMapper;
  4 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish;
  5 +import com.lframework.xingyun.sc.procurement.vo.replenish.QueryProcurementPlanReplenishVo;
  6 +import java.util.List;
  7 +import org.apache.ibatis.annotations.Param;
  8 +
  9 +public interface ProcurementPlanReplenishMapper extends BaseMapper<ProcurementPlanReplenish> {
  10 +
  11 + /**
  12 + * 根据ID查询
  13 + *
  14 + * @param id
  15 + * @return
  16 + */
  17 + ProcurementPlanReplenish findById(@Param("id") String id);
  18 +
  19 + /**
  20 + * 根据采购计划ID查询补单列表
  21 + *
  22 + * @param procurementPlanId
  23 + * @return
  24 + */
  25 + List<ProcurementPlanReplenish> getByProcurementPlanId(@Param("procurementPlanId") String procurementPlanId);
  26 +
  27 + /**
  28 + * 查询补单列表
  29 + *
  30 + * @param vo
  31 + * @return
  32 + */
  33 + List<ProcurementPlanReplenish> query(@Param("vo") QueryProcurementPlanReplenishVo vo);
  34 +}
  1 +package com.lframework.xingyun.sc.procurement.service.replenish;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenishLine;
  5 +import java.util.List;
  6 +
  7 +public interface ProcurementPlanReplenishLineService extends IService<ProcurementPlanReplenishLine> {
  8 +
  9 + /**
  10 + * 根据补单ID查询明细
  11 + *
  12 + * @param mainId
  13 + * @return
  14 + */
  15 + List<ProcurementPlanReplenishLine> getByProcurementPlanReplenishId(String mainId);
  16 +
  17 + /**
  18 + * 批量保存
  19 + *
  20 + * @param list
  21 + * @return
  22 + */
  23 + boolean saveBatch(List<ProcurementPlanReplenishLine> list);
  24 +
  25 + /**
  26 + * 根据条件删除
  27 + *
  28 + * @param wrapper
  29 + * @return
  30 + */
  31 + boolean removeByWrapper(com.baomidou.mybatisplus.core.conditions.Wrapper<ProcurementPlanReplenishLine> wrapper);
  32 +}
  1 +package com.lframework.xingyun.sc.procurement.service.replenish;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.lframework.starter.web.core.components.resp.PageResult;
  5 +import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanReplenishBo;
  6 +import com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish;
  7 +import com.lframework.xingyun.sc.procurement.vo.replenish.CreateProcurementPlanReplenishVo;
  8 +import com.lframework.xingyun.sc.procurement.vo.replenish.QueryProcurementPlanReplenishVo;
  9 +import com.lframework.xingyun.sc.procurement.vo.replenish.UpdateProcurementPlanReplenishVo;
  10 +import java.util.List;
  11 +import java.util.Map;
  12 +
  13 +public interface ProcurementPlanReplenishService extends IService<ProcurementPlanReplenish> {
  14 +
  15 + /**
  16 + * 分页查询补单列表
  17 + *
  18 + * @param pageIndex 页码
  19 + * @param pageSize 页大小
  20 + * @param vo 查询条件
  21 + * @return 分页结果
  22 + */
  23 + PageResult<ProcurementPlanReplenish> query(Integer pageIndex, Integer pageSize,
  24 + QueryProcurementPlanReplenishVo vo);
  25 +
  26 + /**
  27 + * 查询补单列表(不分页)
  28 + *
  29 + * @param vo 查询条件
  30 + * @return 数据列表
  31 + */
  32 + List<ProcurementPlanReplenish> query(QueryProcurementPlanReplenishVo vo);
  33 +
  34 + /**
  35 + * 根据ID查询详情
  36 + *
  37 + * @param id
  38 + * @return
  39 + */
  40 + GetProcurementPlanReplenishBo findDetail(String id);
  41 +
  42 + /**
  43 + * 根据ID查询
  44 + *
  45 + * @param id
  46 + * @return
  47 + */
  48 + ProcurementPlanReplenish getById(String id);
  49 +
  50 + /**
  51 + * 创建
  52 + *
  53 + * @param vo
  54 + * @return
  55 + */
  56 + String create(CreateProcurementPlanReplenishVo vo);
  57 +
  58 + /**
  59 + * 修改
  60 + *
  61 + * @param vo
  62 + */
  63 + void update(UpdateProcurementPlanReplenishVo vo);
  64 +
  65 + /**
  66 + * 取消
  67 + *
  68 + * @param id
  69 + */
  70 + void cancel(String id);
  71 +
  72 + /**
  73 + * 提交审核
  74 + *
  75 + * @param id
  76 + */
  77 + void submit(String id);
  78 +
  79 + /**
  80 + * 修改审核状态
  81 + *
  82 + * @param id 主键
  83 + * @param approvalStatus 审核状态
  84 + */
  85 + void updateApprovalStatus(String id, String approvalStatus);
  86 +
  87 + /**
  88 + * 更新审核流程数据
  89 + *
  90 + * @param map 更新数据
  91 + */
  92 + void updateNoFlowInstance(Map<String, Object> map);
  93 +
  94 +}
  1 +package com.lframework.xingyun.sc.procurement.vo.replenish;
  2 +
  3 +import com.lframework.starter.web.core.vo.BaseVo;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import java.io.Serializable;
  7 +import java.math.BigDecimal;
  8 +import javax.validation.constraints.Digits;
  9 +import javax.validation.constraints.NotBlank;
  10 +import javax.validation.constraints.NotNull;
  11 +import lombok.Data;
  12 +import org.hibernate.validator.constraints.Length;
  13 +
  14 +@Data
  15 +@ApiModel("新增采购计划补单行Vo")
  16 +public class CreateProcurementPlanReplenishLineVo implements BaseVo, Serializable {
  17 +
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + @ApiModelProperty(value = "品种ID", required = true)
  21 + @NotBlank(message = "品种ID不能为空!")
  22 + private String productId;
  23 +
  24 + @ApiModelProperty("料型")
  25 + @Length(max = 200, message = "料型最多允许200个字符!")
  26 + private String materialType;
  27 +
  28 + @ApiModelProperty(value = "数量", required = true)
  29 + @NotNull(message = "数量不能为空!")
  30 + @Digits(integer = 14, fraction = 5, message = "数量最多支持14位整数和5位小数!")
  31 + private BigDecimal quantity;
  32 +
  33 + @ApiModelProperty("实际采购价")
  34 + @Digits(integer = 14, fraction = 10, message = "实际采购价最多支持14位整数和10位小数!")
  35 + private BigDecimal actualPurchasePrice;
  36 +
  37 + @ApiModelProperty("含运到厂价")
  38 + @Digits(integer = 14, fraction = 10, message = "含运到厂价最多支持14位整数和10位小数!")
  39 + private BigDecimal includingShippingPrice;
  40 +
  41 + @ApiModelProperty("价格表价格")
  42 + @Digits(integer = 14, fraction = 10, message = "价格表价格最多支持14位整数和10位小数!")
  43 + private BigDecimal priceListPrices;
  44 +
  45 + @ApiModelProperty("协调幅度")
  46 + @Digits(integer = 14, fraction = 10, message = "协调幅度最多支持14位整数和10位小数!")
  47 + private BigDecimal coordinationRange;
  48 +
  49 + @ApiModelProperty("买断料预计损耗")
  50 + @Digits(integer = 8, fraction = 10, message = "买断料预计损耗最多支持8位整数和10位小数!")
  51 + private BigDecimal estimatedLoss;
  52 +
  53 + @ApiModelProperty("申请损耗(%)")
  54 + @Digits(integer = 8, fraction = 10, message = "申请损耗最多支持8位整数和10位小数!")
  55 + private BigDecimal applicationAttrition;
  56 +
  57 + @ApiModelProperty("漆损率(%)")
  58 + @Digits(integer = 8, fraction = 10, message = "漆损率最多支持8位整数和10位小数!")
  59 + private BigDecimal paintDamageRatio;
  60 +
  61 + @ApiModelProperty("分厂")
  62 + @Length(max = 50, message = "分厂最多允许50个字符!")
  63 + private String workshopId;
  64 +
  65 + @ApiModelProperty(value = "前端行标识", required = true)
  66 + @NotBlank(message = "前端行标识不能为空!")
  67 + private String itemId;
  68 +}
  1 +package com.lframework.xingyun.sc.procurement.vo.replenish;
  2 +
  3 +import com.lframework.starter.web.core.vo.BaseVo;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import java.io.Serializable;
  7 +import java.math.BigDecimal;
  8 +import java.time.LocalDate;
  9 +import java.util.List;
  10 +import javax.validation.Valid;
  11 +import javax.validation.constraints.Digits;
  12 +import javax.validation.constraints.NotBlank;
  13 +import javax.validation.constraints.NotEmpty;
  14 +import javax.validation.constraints.NotNull;
  15 +import lombok.Data;
  16 +import org.hibernate.validator.constraints.Length;
  17 +
  18 +@Data
  19 +@ApiModel("新增采购计划补单Vo")
  20 +public class CreateProcurementPlanReplenishVo implements BaseVo, Serializable {
  21 +
  22 + private static final long serialVersionUID = 1L;
  23 +
  24 + @ApiModelProperty(value = "原采购计划ID", required = true)
  25 + @NotBlank(message = "原采购计划ID不能为空!")
  26 + private String procurementPlanId;
  27 +
  28 + @ApiModelProperty("补单编号")
  29 + @Length(max = 50, message = "补单编号最多允许50个字符!")
  30 + private String code;
  31 +
  32 + @ApiModelProperty("公司简称ID")
  33 + @Length(max = 50, message = "公司简称ID最多允许50个字符!")
  34 + private String companyShortId;
  35 +
  36 + @ApiModelProperty("供应商ID")
  37 + @Length(max = 50, message = "供应商ID最多允许50个字符!")
  38 + private String supplierId;
  39 +
  40 + @ApiModelProperty("采购处")
  41 + @Length(max = 50, message = "采购处最多允许50个字符!")
  42 + private String purchaseDepartment;
  43 +
  44 + @ApiModelProperty("区域")
  45 + @Length(max = 50, message = "区域最多允许50个字符!")
  46 + private String region;
  47 +
  48 + @ApiModelProperty("日期")
  49 + private LocalDate date;
  50 +
  51 + @ApiModelProperty("报价时效")
  52 + @Length(max = 200, message = "报价时效最多允许200个字符!")
  53 + private String validityPeriod;
  54 +
  55 + @ApiModelProperty("报价人ID")
  56 + @Length(max = 50, message = "报价人ID最多允许50个字符!")
  57 + private String quoterId;
  58 +
  59 + @ApiModelProperty("报价人")
  60 + @Length(max = 100, message = "报价人最多允许100个字符!")
  61 + private String quoterName;
  62 +
  63 + @ApiModelProperty("是否长单操作")
  64 + private Boolean longTermOperation;
  65 +
  66 + @ApiModelProperty("是否终端客户")
  67 + private Boolean terminalCustomer;
  68 +
  69 + @ApiModelProperty("是否未点价")
  70 + private Boolean priced;
  71 +
  72 + @ApiModelProperty("点价截止日期")
  73 + private LocalDate pricingDeadline;
  74 +
  75 + @ApiModelProperty("是否暂定价")
  76 + private Boolean temporaryPrice;
  77 +
  78 + @ApiModelProperty("其他费用凭票到厂另行结算")
  79 + private Boolean otherExpenseSettlement;
  80 +
  81 + @ApiModelProperty("交提货方式")
  82 + @Length(max = 50, message = "交提货方式最多允许50个字符!")
  83 + private String deliveryMode;
  84 +
  85 + @ApiModelProperty("是否通货买断")
  86 + private Boolean commodityBuyout;
  87 +
  88 + @ApiModelProperty("是否质量买断")
  89 + private Boolean qualityBuyout;
  90 +
  91 + @ApiModelProperty("是否数量买断")
  92 + private Boolean quantityBuyout;
  93 +
  94 + @ApiModelProperty("是否送货上门")
  95 + private Boolean doorDelivery;
  96 +
  97 + @ApiModelProperty("另付运费")
  98 + @Digits(integer = 14, fraction = 5, message = "另付运费最多支持14位整数和5位小数!")
  99 + private BigDecimal shippingCost;
  100 +
  101 + @ApiModelProperty("装车费")
  102 + @Digits(integer = 14, fraction = 5, message = "装车费最多支持14位整数和5位小数!")
  103 + private BigDecimal loadingFee;
  104 +
  105 + @ApiModelProperty("开票品名")
  106 + @Length(max = 200, message = "开票品名最多允许200个字符!")
  107 + private String invoiceProductName;
  108 +
  109 + @ApiModelProperty("交货日期")
  110 + private LocalDate deliveryDate;
  111 +
  112 + @ApiModelProperty("结算方式")
  113 + @Length(max = 200, message = "结算方式最多允许200个字符!")
  114 + private String settlementMethod;
  115 +
  116 + @ApiModelProperty("结算比例(%)")
  117 + @Digits(integer = 8, fraction = 5, message = "结算比例最多支持8位整数和5位小数!")
  118 + private BigDecimal settlementRatio;
  119 +
  120 + @ApiModelProperty("价格表ID")
  121 + @Length(max = 50, message = "价格表ID最多允许50个字符!")
  122 + private String priceId;
  123 +
  124 + @ApiModelProperty("协调事由")
  125 + @Length(max = 1000, message = "协调事由最多允许1000个字符!")
  126 + private String coordinationReason;
  127 +
  128 + @ApiModelProperty("票类状况")
  129 + @Length(max = 200, message = "票类状况最多允许200个字符!")
  130 + private String invoiceTypeStatus;
  131 +
  132 + @ApiModelProperty("数量合计")
  133 + @Digits(integer = 14, fraction = 5, message = "数量合计最多支持14位整数和5位小数!")
  134 + private BigDecimal totalQuantity;
  135 +
  136 + @ApiModelProperty("备注")
  137 + @Length(max = 1000, message = "备注最多允许1000个字符!")
  138 + private String remark;
  139 +
  140 + @ApiModelProperty("是否启用料质状况")
  141 + private Boolean materialConditionEnabled;
  142 +
  143 + @ApiModelProperty("铜米")
  144 + @Length(max = 500, message = "铜米内容最多允许500个字符!")
  145 + private String materialConditionCopperRice;
  146 +
  147 + @ApiModelProperty("光亮铜")
  148 + @Length(max = 500, message = "光亮铜内容最多允许500个字符!")
  149 + private String materialConditionBrightCopper;
  150 +
  151 + @ApiModelProperty("一特")
  152 + @Length(max = 500, message = "一特内容最多允许500个字符!")
  153 + private String materialConditionFirstClass;
  154 +
  155 + @ApiModelProperty("二特")
  156 + @Length(max = 500, message = "二特内容最多允许500个字符!")
  157 + private String materialConditionSecondClass;
  158 +
  159 + @ApiModelProperty("镀锡紫")
  160 + @Length(max = 500, message = "镀锡紫内容最多允许500个字符!")
  161 + private String materialConditionTinCoated;
  162 +
  163 + @ApiModelProperty("角料")
  164 + @Length(max = 500, message = "角料内容最多允许500个字符!")
  165 + private String materialConditionScrap;
  166 +
  167 + @ApiModelProperty("镀白黄")
  168 + @Length(max = 500, message = "镀白黄内容最多允许500个字符!")
  169 + private String materialConditionWhiteYellow;
  170 +
  171 + @ApiModelProperty("磷铜")
  172 + @Length(max = 500, message = "磷铜内容最多允许500个字符!")
  173 + private String materialConditionPhosphorCopper;
  174 +
  175 + @ApiModelProperty("分厂ID")
  176 + @Length(max = 50, message = "分厂ID最多允许50个字符!")
  177 + private String workshopId;
  178 +
  179 + @ApiModelProperty(value = "明细信息", required = true)
  180 + @Valid
  181 + @NotEmpty(message = "明细不能为空!")
  182 + private List<CreateProcurementPlanReplenishLineVo> procurementPlanReplenishLineList;
  183 +
  184 + public void validate() {
  185 + }
  186 +}
  1 +package com.lframework.xingyun.sc.procurement.vo.replenish;
  2 +
  3 +import com.lframework.starter.web.core.vo.SortPageVo;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import java.time.LocalDate;
  7 +import lombok.Data;
  8 +
  9 +@Data
  10 +@ApiModel("查询采购计划补单Vo")
  11 +public class QueryProcurementPlanReplenishVo extends SortPageVo {
  12 +
  13 + private static final long serialVersionUID = 1L;
  14 +
  15 + @ApiModelProperty("补单编号")
  16 + private String code;
  17 +
  18 + @ApiModelProperty("公司简称ID")
  19 + private String companyShortId;
  20 +
  21 + @ApiModelProperty("公司简称名称")
  22 + private String companyName;
  23 +
  24 + @ApiModelProperty("采购处")
  25 + private String purchaseDepartment;
  26 +
  27 + @ApiModelProperty("日期起始")
  28 + private LocalDate startDate;
  29 +
  30 + @ApiModelProperty("日期截止")
  31 + private LocalDate endDate;
  32 +
  33 + @ApiModelProperty("供应商ID")
  34 + private String supplierId;
  35 +
  36 + @ApiModelProperty("供应商名称")
  37 + private String supplierName;
  38 +
  39 + @ApiModelProperty("分厂ID")
  40 + private String workshopId;
  41 +
  42 + @ApiModelProperty("审核状态")
  43 + private String approvalStatus;
  44 +
  45 + @ApiModelProperty("流程节点")
  46 + private String processNode;
  47 +}
  1 +package com.lframework.xingyun.sc.procurement.vo.replenish;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ApiModel("修改采购计划补单行Vo")
  11 +public class UpdateProcurementPlanReplenishLineVo extends CreateProcurementPlanReplenishLineVo {
  12 +
  13 + private static final long serialVersionUID = 1L;
  14 +
  15 + @ApiModelProperty("ID")
  16 + private String id;
  17 +
  18 + @ApiModelProperty("采购计划补单ID")
  19 + private String procurementPlanReplenishId;
  20 +}
  1 +package com.lframework.xingyun.sc.procurement.vo.replenish;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import javax.validation.constraints.NotBlank;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ApiModel("修改采购计划补单Vo")
  12 +public class UpdateProcurementPlanReplenishVo extends CreateProcurementPlanReplenishVo {
  13 +
  14 + private static final long serialVersionUID = 1L;
  15 +
  16 + @ApiModelProperty(value = "ID", required = true)
  17 + @NotBlank(message = "ID不能为空!")
  18 + private String id;
  19 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.lframework.xingyun.sc.procurement.mappers.replenish.ProcurementPlanReplenishLineMapper">
  4 +
  5 + <resultMap id="ProcurementPlanReplenishLine" type="com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenishLine">
  6 + <id column="id" property="id"/>
  7 + <result column="procurement_plan_replenish_id" property="procurementPlanReplenishId"/>
  8 + <result column="product_id" property="productId"/>
  9 + <result column="product_name" property="productName"/>
  10 + <result column="material_type" property="materialType"/>
  11 + <result column="quantity" property="quantity"/>
  12 + <result column="actual_purchase_price" property="actualPurchasePrice"/>
  13 + <result column="including_shipping_price" property="includingShippingPrice"/>
  14 + <result column="price_list_prices" property="priceListPrices"/>
  15 + <result column="coordination_range" property="coordinationRange"/>
  16 + <result column="estimated_loss" property="estimatedLoss"/>
  17 + <result column="application_attrition" property="applicationAttrition"/>
  18 + <result column="paint_damage_ratio" property="paintDamageRatio"/>
  19 + <result column="workshop_id" property="workshopId"/>
  20 + <result column="workshop_name" property="workshopName"/>
  21 + <result column="item_id" property="itemId"/>
  22 + <result column="create_by_id" property="createById"/>
  23 + <result column="create_by" property="createBy"/>
  24 + <result column="update_by_id" property="updateById"/>
  25 + <result column="update_by" property="updateBy"/>
  26 + <result column="create_time" property="createTime"/>
  27 + <result column="update_time" property="updateTime"/>
  28 + </resultMap>
  29 +
  30 + <sql id="ProcurementPlanReplenishLine_sql">
  31 + SELECT
  32 + pprl.id,
  33 + pprl.procurement_plan_replenish_id,
  34 + pprl.product_id,
  35 + br.product_name,
  36 + pprl.material_type,
  37 + pprl.quantity,
  38 + pprl.actual_purchase_price,
  39 + pprl.including_shipping_price,
  40 + pprl.price_list_prices,
  41 + pprl.coordination_range,
  42 + pprl.estimated_loss,
  43 + pprl.application_attrition,
  44 + pprl.paint_damage_ratio,
  45 + pprl.workshop_id,
  46 + ws.name AS workshop_name,
  47 + pprl.item_id,
  48 + pprl.create_by_id,
  49 + pprl.create_by,
  50 + pprl.update_by_id,
  51 + pprl.update_by,
  52 + pprl.create_time,
  53 + pprl.update_time
  54 + FROM procurement_plan_replenish_line AS pprl
  55 + LEFT JOIN base_data_breed_relationship br ON br.id = pprl.product_id
  56 + LEFT JOIN base_data_workshop AS ws ON ws.id = pprl.workshop_id
  57 + </sql>
  58 +
  59 + <select id="getByProcurementPlanReplenishId" resultMap="ProcurementPlanReplenishLine">
  60 + <include refid="ProcurementPlanReplenishLine_sql"/>
  61 + WHERE pprl.procurement_plan_replenish_id = #{mainId}
  62 + ORDER BY pprl.create_time ASC
  63 + </select>
  64 +
  65 + <delete id="delByProcurementPlanReplenishId">
  66 + DELETE FROM procurement_plan_replenish_line WHERE procurement_plan_replenish_id = #{mainId}
  67 + </delete>
  68 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.lframework.xingyun.sc.procurement.mappers.replenish.ProcurementPlanReplenishMapper">
  4 +
  5 + <resultMap id="ProcurementPlanReplenish" type="com.lframework.xingyun.sc.procurement.entity.replenish.ProcurementPlanReplenish">
  6 + <id column="id" property="id"/>
  7 + <result column="procurement_plan_id" property="procurementPlanId"/>
  8 + <result column="code" property="code"/>
  9 + <result column="company_short_id" property="companyShortId"/>
  10 + <result column="company_short_name" property="companyShortName"/>
  11 + <result column="company_full_name" property="companyFullName"/>
  12 + <result column="supplier_id" property="supplierId"/>
  13 + <result column="supplier_name" property="supplierName"/>
  14 + <result column="purchase_department" property="purchaseDepartment"/>
  15 + <result column="purchase_department_name" property="purchaseDepartmentName"/>
  16 + <result column="purchase_department_code" property="purchaseDepartmentCode"/>
  17 + <result column="region" property="region"/>
  18 + <result column="region_name" property="regionName"/>
  19 + <result column="date" property="date"/>
  20 + <result column="validity_period" property="validityPeriod"/>
  21 + <result column="quoter_id" property="quoterId"/>
  22 + <result column="quoter_name" property="quoterName"/>
  23 + <result column="long_term_operation" property="longTermOperation"/>
  24 + <result column="terminal_customer" property="terminalCustomer"/>
  25 + <result column="priced" property="priced"/>
  26 + <result column="pricing_deadline" property="pricingDeadline"/>
  27 + <result column="temporary_price" property="temporaryPrice"/>
  28 + <result column="other_expense_settlement" property="otherExpenseSettlement"/>
  29 + <result column="delivery_mode" property="deliveryMode"/>
  30 + <result column="commodity_buyout" property="commodityBuyout"/>
  31 + <result column="quality_buyout" property="qualityBuyout"/>
  32 + <result column="quantity_buyout" property="quantityBuyout"/>
  33 + <result column="door_delivery" property="doorDelivery"/>
  34 + <result column="shipping_cost" property="shippingCost"/>
  35 + <result column="loading_fee" property="loadingFee"/>
  36 + <result column="invoice_product_name" property="invoiceProductName"/>
  37 + <result column="delivery_date" property="deliveryDate"/>
  38 + <result column="settlement_method" property="settlementMethod"/>
  39 + <result column="settlement_ratio" property="settlementRatio"/>
  40 + <result column="price_id" property="priceId"/>
  41 + <result column="price_code" property="priceCode"/>
  42 + <result column="coordination_reason" property="coordinationReason"/>
  43 + <result column="invoice_type_status" property="invoiceTypeStatus"/>
  44 + <result column="total_quantity" property="totalQuantity"/>
  45 + <result column="remark" property="remark"/>
  46 + <result column="material_condition_enabled" property="materialConditionEnabled"/>
  47 + <result column="material_condition_copper_rice" property="materialConditionCopperRice"/>
  48 + <result column="material_condition_bright_copper" property="materialConditionBrightCopper"/>
  49 + <result column="material_condition_first_class" property="materialConditionFirstClass"/>
  50 + <result column="material_condition_second_class" property="materialConditionSecondClass"/>
  51 + <result column="material_condition_tin_coated" property="materialConditionTinCoated"/>
  52 + <result column="material_condition_scrap" property="materialConditionScrap"/>
  53 + <result column="material_condition_white_yellow" property="materialConditionWhiteYellow"/>
  54 + <result column="material_condition_phosphor_copper" property="materialConditionPhosphorCopper"/>
  55 + <result column="approval_status" property="approvalStatus"/>
  56 + <result column="process_node" property="processNode"/>
  57 + <result column="workshop_id" property="workshopId"/>
  58 + <result column="workshop_name" property="workshopName"/>
  59 + <result column="create_by_id" property="createById"/>
  60 + <result column="create_by" property="createBy"/>
  61 + <result column="update_by_id" property="updateById"/>
  62 + <result column="update_by" property="updateBy"/>
  63 + <result column="create_time" property="createTime"/>
  64 + <result column="update_time" property="updateTime"/>
  65 + </resultMap>
  66 +
  67 + <sql id="ProcurementPlanReplenish_sql">
  68 + SELECT
  69 + ppr.id,
  70 + ppr.procurement_plan_id,
  71 + ppr.code,
  72 + ppr.company_short_id,
  73 + bdcs.short_name AS company_short_name,
  74 + bdcs.company_name AS company_full_name,
  75 + ppr.supplier_id,
  76 + pdc.unit_name AS supplier_name,
  77 + ppr.purchase_department,
  78 + sd.name AS purchase_department_name,
  79 + sd.code AS purchase_department_code,
  80 + ppr.region,
  81 + sd1.name AS region_name,
  82 + ppr.date,
  83 + ppr.validity_period,
  84 + ppr.quoter_id,
  85 + ppr.quoter_name,
  86 + ppr.long_term_operation,
  87 + ppr.terminal_customer,
  88 + ppr.priced,
  89 + ppr.pricing_deadline,
  90 + ppr.temporary_price,
  91 + ppr.other_expense_settlement,
  92 + ppr.delivery_mode,
  93 + ppr.commodity_buyout,
  94 + ppr.quality_buyout,
  95 + ppr.quantity_buyout,
  96 + ppr.door_delivery,
  97 + ppr.shipping_cost,
  98 + ppr.loading_fee,
  99 + ppr.invoice_product_name,
  100 + ppr.delivery_date,
  101 + ppr.settlement_method,
  102 + ppr.settlement_ratio,
  103 + ppr.price_id,
  104 + bdp.code AS price_code,
  105 + ppr.coordination_reason,
  106 + ppr.invoice_type_status,
  107 + ppr.total_quantity,
  108 + ppr.remark,
  109 + ppr.material_condition_enabled,
  110 + ppr.material_condition_copper_rice,
  111 + ppr.material_condition_bright_copper,
  112 + ppr.material_condition_first_class,
  113 + ppr.material_condition_second_class,
  114 + ppr.material_condition_tin_coated,
  115 + ppr.material_condition_scrap,
  116 + ppr.material_condition_white_yellow,
  117 + ppr.material_condition_phosphor_copper,
  118 + ppr.approval_status,
  119 + ppr.process_node,
  120 + ppr.workshop_id,
  121 + ws.name AS workshop_name,
  122 + ppr.create_by_id,
  123 + ppr.create_by,
  124 + ppr.update_by_id,
  125 + ppr.update_by,
  126 + ppr.create_time,
  127 + ppr.update_time
  128 + FROM procurement_plan_replenish AS ppr
  129 + LEFT JOIN base_data_company_short AS bdcs ON bdcs.id = ppr.company_short_id
  130 + LEFT JOIN procurement_domestic_customer_credit pdc ON pdc.id = ppr.supplier_id
  131 + LEFT JOIN sys_dept sd ON sd.id = ppr.purchase_department
  132 + LEFT JOIN sys_dept sd1 ON sd1.id = ppr.region
  133 + LEFT JOIN base_data_workshop AS ws ON ws.id = ppr.workshop_id
  134 + LEFT JOIN base_data_price AS bdp ON bdp.id = ppr.price_id
  135 + </sql>
  136 +
  137 + <select id="findById" resultMap="ProcurementPlanReplenish">
  138 + <include refid="ProcurementPlanReplenish_sql"/>
  139 + WHERE ppr.id = #{id}
  140 + </select>
  141 +
  142 + <select id="getByProcurementPlanId" resultMap="ProcurementPlanReplenish">
  143 + <include refid="ProcurementPlanReplenish_sql"/>
  144 + WHERE ppr.procurement_plan_id = #{procurementPlanId}
  145 + ORDER BY ppr.create_time DESC
  146 + </select>
  147 +
  148 + <select id="query" resultMap="ProcurementPlanReplenish">
  149 + <include refid="ProcurementPlanReplenish_sql"/>
  150 + <where>
  151 + <if test="vo.code != null and vo.code != ''">
  152 + AND ppr.code LIKE CONCAT('%', #{vo.code}, '%')
  153 + </if>
  154 + <if test="vo.companyShortId != null and vo.companyShortId != ''">
  155 + AND ppr.company_short_id = #{vo.companyShortId}
  156 + </if>
  157 + <if test="vo.companyName != null and vo.companyName != ''">
  158 + AND (
  159 + bdcs.company_name LIKE CONCAT('%', #{vo.companyName}, '%')
  160 + OR bdcs.short_name LIKE CONCAT('%', #{vo.companyName}, '%')
  161 + )
  162 + </if>
  163 + <if test="vo.purchaseDepartment != null and vo.purchaseDepartment != ''">
  164 + AND ppr.purchase_department = #{vo.purchaseDepartment}
  165 + </if>
  166 + <if test="vo.startDate != null">
  167 + AND ppr.date &gt;= #{vo.startDate}
  168 + </if>
  169 + <if test="vo.endDate != null">
  170 + AND ppr.date &lt;= #{vo.endDate}
  171 + </if>
  172 + <if test="vo.supplierId != null and vo.supplierId != ''">
  173 + AND ppr.supplier_id = #{vo.supplierId}
  174 + </if>
  175 + <if test="vo.supplierName != null and vo.supplierName != ''">
  176 + AND pdc.unit_name LIKE CONCAT('%', #{vo.supplierName}, '%')
  177 + </if>
  178 + <if test="vo.workshopId != null and vo.workshopId != ''">
  179 + AND ppr.workshop_id = #{vo.workshopId}
  180 + </if>
  181 + <if test="vo.approvalStatus != null and vo.approvalStatus != ''">
  182 + AND ppr.approval_status = #{vo.approvalStatus}
  183 + </if>
  184 + <if test="vo.processNode != null and vo.processNode != ''">
  185 + AND ppr.process_node = #{vo.processNode}
  186 + </if>
  187 + </where>
  188 + ORDER BY ppr.create_time DESC
  189 + </select>
  190 +</mapper>