Commit 6e4259519a3f485a8bdf1c35b2d60cad7d5b6db0

Authored by 房远帅
1 parent 5fee6a29

采购计划:计划变更单

Showing 19 changed files with 2560 additions and 0 deletions
... ... @@ -2035,3 +2035,99 @@ CREATE TABLE `procurement_buyout_apply_line`
2035 2035 KEY `idx_pbal_apply_id` (`buyout_apply_id`),
2036 2036 KEY `idx_pbal_product_id` (`product_id`)
2037 2037 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='买断操作申请单明细表';
  2038 +
  2039 +CREATE TABLE `procurement_plan_change`
  2040 +(
  2041 + `id` varchar(32) NOT NULL COMMENT 'ID',
  2042 + `procurement_plan_id` varchar(32) NOT NULL COMMENT '原采购计划ID',
  2043 + `parent_id` varchar(32) DEFAULT NULL COMMENT '父ID,拆分使用',
  2044 + `code` varchar(20) NOT NULL COMMENT '变更单编号',
  2045 + `company_short_id` varchar(32) DEFAULT NULL COMMENT '公司简称ID',
  2046 + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID',
  2047 + `purchase_department` varchar(32) NOT NULL COMMENT '采购处',
  2048 + `region` varchar(32) NOT NULL COMMENT '区域',
  2049 + `date` date NOT NULL COMMENT '日期',
  2050 + `validity_period` varchar(200) NOT NULL COMMENT '报价时效',
  2051 + `quoter_id` varchar(32) NOT NULL COMMENT '报价人ID',
  2052 + `quoter_name` varchar(64) NOT NULL COMMENT '报价人',
  2053 + `long_term_operation` bool NOT NULL COMMENT '是否长单操作',
  2054 + `terminal_customer` bool NOT NULL COMMENT '是否终端客户',
  2055 + `priced` bool NOT NULL COMMENT '是否未点价',
  2056 + `pricing_deadline` date DEFAULT NULL COMMENT '点价截止日期',
  2057 + `temporary_price` bool DEFAULT NULL COMMENT '是否暂定价',
  2058 + `other_expense_settlement` bool NOT NULL COMMENT '其他费用凭票到厂另行结算',
  2059 + `delivery_mode` varchar(50) NOT NULL COMMENT '交提货方式',
  2060 + `commodity_buyout` bool NOT NULL COMMENT '是否通货买断',
  2061 + `quality_buyout` bool NOT NULL COMMENT '是否质量买断',
  2062 + `quantity_buyout` bool NOT NULL COMMENT '是否数量买断',
  2063 + `door_delivery` bool NOT NULL COMMENT '是否送货上门',
  2064 + `shipping_cost` decimal(18, 5) DEFAULT NULL COMMENT '另付运费',
  2065 + `loading_fee` decimal(18, 5) DEFAULT NULL COMMENT '装车费',
  2066 + `invoice_product_name` varchar(200) NOT NULL COMMENT '开票品名',
  2067 + `delivery_date` date NOT NULL COMMENT '交货日期',
  2068 + `settlement_method` varchar(200) NOT NULL COMMENT '结算方式',
  2069 + `settlement_ratio` decimal(10, 5) NOT NULL COMMENT '结算比例(%)',
  2070 + `price_id` varchar(32) NOT NULL COMMENT '价格表ID',
  2071 + `coordination_reason` varchar(200) NOT NULL COMMENT '协调事由',
  2072 + `invoice_type_status` varchar(50) NOT NULL COMMENT '票类状况',
  2073 + `total_quantity` decimal(18, 5) NOT NULL COMMENT '合计数量',
  2074 + `remark` varchar(1000) DEFAULT NULL COMMENT '备注',
  2075 + `material_condition_enabled` bool NOT NULL DEFAULT FALSE COMMENT '是否启用料质状况',
  2076 + `material_condition_copper_rice` varchar(500) DEFAULT NULL COMMENT '铜米',
  2077 + `material_condition_bright_copper` varchar(500) DEFAULT NULL COMMENT '光亮铜',
  2078 + `material_condition_first_class` varchar(500) DEFAULT NULL COMMENT '一特',
  2079 + `material_condition_second_class` varchar(500) DEFAULT NULL COMMENT '二特',
  2080 + `material_condition_tin_coated` varchar(500) DEFAULT NULL COMMENT '镀锡紫',
  2081 + `material_condition_scrap` varchar(500) DEFAULT NULL COMMENT '角料',
  2082 + `material_condition_white_yellow` varchar(500) DEFAULT NULL COMMENT '镀白黄',
  2083 + `material_condition_phosphor_copper` varchar(500) DEFAULT NULL COMMENT '磷铜',
  2084 + `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂ID',
  2085 + `change_reason` varchar(1000) NOT NULL COMMENT '变更事由',
  2086 + `approval_status` varchar(50) DEFAULT NULL COMMENT '审核状态(预留)',
  2087 + `process_status` varchar(50) DEFAULT NULL COMMENT '流程状态(预留)',
  2088 + `process_node` varchar(50) DEFAULT NULL COMMENT '流程节点(预留)',
  2089 + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
  2090 + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
  2091 + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID',
  2092 + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人',
  2093 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2094 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  2095 + PRIMARY KEY (`id`),
  2096 + UNIQUE KEY `uk_ppc_code` (`code`),
  2097 + KEY `idx_ppc_procurement_plan_id` (`procurement_plan_id`),
  2098 + KEY `idx_ppc_company_short_id` (`company_short_id`),
  2099 + KEY `idx_ppc_supplier_id` (`supplier_id`),
  2100 + KEY `idx_ppc_date` (`date`),
  2101 + KEY `idx_ppc_create_time` (`create_time`),
  2102 + KEY `idx_ppc_process_status` (`process_status`),
  2103 + KEY `idx_ppc_approval_status` (`approval_status`),
  2104 + KEY `idx_ppc_workshop_id` (`workshop_id`)
  2105 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='采购计划变更单主表';
  2106 +
  2107 +CREATE TABLE `procurement_plan_change_line`
  2108 +(
  2109 + `id` varchar(32) NOT NULL COMMENT 'ID',
  2110 + `procurement_plan_change_id` varchar(32) NOT NULL COMMENT '采购计划变更单ID',
  2111 + `product_id` varchar(32) NOT NULL COMMENT '品种ID',
  2112 + `material_type` varchar(200) DEFAULT NULL COMMENT '料型',
  2113 + `quantity` decimal(18, 5) NOT NULL COMMENT '数量',
  2114 + `actual_purchase_price` decimal(18, 10) DEFAULT NULL COMMENT '实际采购价',
  2115 + `including_shipping_price` decimal(18, 10) DEFAULT NULL COMMENT '含运到厂价',
  2116 + `price_list_prices` decimal(18, 10) DEFAULT NULL COMMENT '价格表价格',
  2117 + `coordination_range` decimal(18, 10) DEFAULT NULL COMMENT '协调幅度',
  2118 + `estimated_loss` decimal(18, 10) DEFAULT NULL COMMENT '买断料预计损耗',
  2119 + `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)',
  2120 + `paint_damage_ratio` decimal(18, 10) DEFAULT NULL COMMENT '漆损率(%)',
  2121 + `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂',
  2122 + `item_id` varchar(32) NOT NULL COMMENT '前端行标识',
  2123 + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
  2124 + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
  2125 + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID',
  2126 + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人',
  2127 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2128 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  2129 + PRIMARY KEY (`id`),
  2130 + KEY `idx_ppcl_change_id` (`procurement_plan_change_id`),
  2131 + KEY `idx_ppcl_product_id` (`product_id`),
  2132 + KEY `idx_ppcl_create_time` (`create_time`)
  2133 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='采购计划变更单明细表';
... ...
  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.common.utils.CollectionUtil;
  6 +import com.lframework.starter.web.core.bo.BaseBo;
  7 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;
  8 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine;
  9 +import io.swagger.annotations.ApiModelProperty;
  10 +import lombok.Data;
  11 +import java.math.BigDecimal;
  12 +import java.time.LocalDate;
  13 +import java.time.LocalDateTime;
  14 +import java.util.List;
  15 +import java.util.stream.Collectors;
  16 +
  17 +@Data
  18 +public class GetProcurementPlanChangeBo extends BaseBo<ProcurementPlanChange> {
  19 +
  20 + /**
  21 + * ID
  22 + */
  23 + @ApiModelProperty("ID")
  24 + private String id;
  25 +
  26 + /**
  27 + * 原采购计划ID
  28 + */
  29 + @ApiModelProperty("原采购计划ID")
  30 + private String procurementPlanId;
  31 +
  32 + /**
  33 + * 变更事由
  34 + */
  35 + @ApiModelProperty("变更事由")
  36 + private String changeReason;
  37 +
  38 + /**
  39 + * 变更单编号
  40 + */
  41 + @ApiModelProperty("变更单编号")
  42 + private String code;
  43 +
  44 + /**
  45 + * 公司简称ID
  46 + */
  47 + @ApiModelProperty("公司简称ID")
  48 + private String companyShortId;
  49 +
  50 + /**
  51 + * 公司简称名称
  52 + */
  53 + @ApiModelProperty("公司简称名称")
  54 + private String companyShortName;
  55 +
  56 + /**
  57 + * 供应商ID
  58 + */
  59 + @ApiModelProperty("供应商ID")
  60 + private String supplierId;
  61 +
  62 + /**
  63 + * 供应商名称
  64 + */
  65 + @ApiModelProperty("供应商名称")
  66 + private String supplierName;
  67 +
  68 + /**
  69 + * 采购处
  70 + */
  71 + @ApiModelProperty("采购处")
  72 + private String purchaseDepartment;
  73 +
  74 + /**
  75 + * 采购处名称
  76 + */
  77 + @ApiModelProperty("采购处名称")
  78 + private String purchaseDepartmentName;
  79 +
  80 + /**
  81 + * 区域
  82 + */
  83 + @ApiModelProperty("区域")
  84 + private String region;
  85 +
  86 + /**
  87 + * 区域名称
  88 + */
  89 + @ApiModelProperty("区域名称")
  90 + private String regionName;
  91 +
  92 + /**
  93 + * 日期
  94 + */
  95 + @ApiModelProperty("日期")
  96 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  97 + private LocalDate date;
  98 +
  99 + /**
  100 + * 报价时效
  101 + */
  102 + @ApiModelProperty("报价时效")
  103 + private String validityPeriod;
  104 +
  105 + /**
  106 + * 报价人ID
  107 + */
  108 + @ApiModelProperty("报价人ID")
  109 + private String quoterId;
  110 +
  111 + /**
  112 + * 报价人
  113 + */
  114 + @ApiModelProperty("报价人")
  115 + private String quoterName;
  116 +
  117 + /**
  118 + * 是否长单操作
  119 + */
  120 + @ApiModelProperty("是否长单操作")
  121 + private Boolean longTermOperation;
  122 +
  123 + /**
  124 + * 是否终端客户
  125 + */
  126 + @ApiModelProperty("是否终端客户")
  127 + private Boolean terminalCustomer;
  128 +
  129 + /**
  130 + * 是否未点价
  131 + */
  132 + @ApiModelProperty("是否未点价")
  133 + private Boolean priced;
  134 +
  135 + /**
  136 + * 点价截止日期
  137 + */
  138 + @ApiModelProperty("点价截止日期")
  139 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  140 + private LocalDate pricingDeadline;
  141 +
  142 + /**
  143 + * 是否暂定价
  144 + */
  145 + @ApiModelProperty("是否暂定价")
  146 + private Boolean temporaryPrice;
  147 +
  148 + /**
  149 + * 其他费用凭票到厂另行结算
  150 + */
  151 + @ApiModelProperty("其他费用凭票到厂另行结算")
  152 + private Boolean otherExpenseSettlement;
  153 +
  154 + /**
  155 + * 交提货方式
  156 + */
  157 + @ApiModelProperty("交提货方式")
  158 + private String deliveryMode;
  159 +
  160 + /**
  161 + * 是否通货买断
  162 + */
  163 + @ApiModelProperty("是否通货买断")
  164 + private Boolean commodityBuyout;
  165 +
  166 + /**
  167 + * 是否质量买断
  168 + */
  169 + @ApiModelProperty("是否质量买断")
  170 + private Boolean qualityBuyout;
  171 +
  172 + /**
  173 + * 是否数量买断
  174 + */
  175 + @ApiModelProperty("是否数量买断")
  176 + private Boolean quantityBuyout;
  177 +
  178 + /**
  179 + * 是否送货上门
  180 + */
  181 + @ApiModelProperty("是否送货上门")
  182 + private Boolean doorDelivery;
  183 +
  184 + /**
  185 + * 另付运费
  186 + */
  187 + @ApiModelProperty("另付运费")
  188 + private BigDecimal shippingCost;
  189 +
  190 + /**
  191 + * 装车费
  192 + */
  193 + @ApiModelProperty("装车费")
  194 + private BigDecimal loadingFee;
  195 +
  196 + /**
  197 + * 开票品名
  198 + */
  199 + @ApiModelProperty("开票品名")
  200 + private String invoiceProductName;
  201 +
  202 + /**
  203 + * 交货日期
  204 + */
  205 + @ApiModelProperty("交货日期")
  206 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  207 + private LocalDate deliveryDate;
  208 +
  209 + /**
  210 + * 结算方式
  211 + */
  212 + @ApiModelProperty("结算方式")
  213 + private String settlementMethod;
  214 +
  215 + /**
  216 + * 结算比例(%)
  217 + */
  218 + @ApiModelProperty("结算比例(%)")
  219 + private BigDecimal settlementRatio;
  220 +
  221 + /**
  222 + * 价格表ID
  223 + */
  224 + @ApiModelProperty("价格表ID")
  225 + private String priceId;
  226 +
  227 + /**
  228 + * 价格表编号
  229 + */
  230 + @ApiModelProperty("价格表编号")
  231 + private String priceCode;
  232 +
  233 + /**
  234 + * 协调事由
  235 + */
  236 + @ApiModelProperty("协调事由")
  237 + private String coordinationReason;
  238 +
  239 + /**
  240 + * 票类状况
  241 + */
  242 + @ApiModelProperty("票类状况")
  243 + private String invoiceTypeStatus;
  244 +
  245 + /**
  246 + * 数量合计
  247 + */
  248 + @ApiModelProperty("数量合计")
  249 + private BigDecimal totalQuantity;
  250 +
  251 + /**
  252 + * 备注
  253 + */
  254 + @ApiModelProperty("备注")
  255 + private String remark;
  256 +
  257 + /**
  258 + * 是否启用料质状况
  259 + */
  260 + @ApiModelProperty("是否启用料质状况")
  261 + private Boolean materialConditionEnabled;
  262 +
  263 + /**
  264 + * 铜米
  265 + */
  266 + @ApiModelProperty("铜米")
  267 + private String materialConditionCopperRice;
  268 +
  269 + /**
  270 + * 光亮铜
  271 + */
  272 + @ApiModelProperty("光亮铜")
  273 + private String materialConditionBrightCopper;
  274 +
  275 + /**
  276 + * 一特
  277 + */
  278 + @ApiModelProperty("一特")
  279 + private String materialConditionFirstClass;
  280 +
  281 + /**
  282 + * 二特
  283 + */
  284 + @ApiModelProperty("二特")
  285 + private String materialConditionSecondClass;
  286 +
  287 + /**
  288 + * 镀锡紫
  289 + */
  290 + @ApiModelProperty("镀锡紫")
  291 + private String materialConditionTinCoated;
  292 +
  293 + /**
  294 + * 角料
  295 + */
  296 + @ApiModelProperty("角料")
  297 + private String materialConditionScrap;
  298 +
  299 + /**
  300 + * 镀白黄
  301 + */
  302 + @ApiModelProperty("镀白黄")
  303 + private String materialConditionWhiteYellow;
  304 +
  305 + /**
  306 + * 磷铜
  307 + */
  308 + @ApiModelProperty("磷铜")
  309 + private String materialConditionPhosphorCopper;
  310 +
  311 + /**
  312 + * 审核状态
  313 + */
  314 + @ApiModelProperty("审核状态")
  315 + private String approvalStatus;
  316 +
  317 + /**
  318 + * 流程状态
  319 + */
  320 + @ApiModelProperty("流程状态")
  321 + private String processStatus;
  322 +
  323 + /**
  324 + * 流程节点
  325 + */
  326 + @ApiModelProperty("流程节点")
  327 + private String processNode;
  328 +
  329 + /**
  330 + * 分厂ID
  331 + */
  332 + @ApiModelProperty("分厂ID")
  333 + private String workshopId;
  334 +
  335 + /**
  336 + * 创建人ID
  337 + */
  338 + @ApiModelProperty("创建人ID")
  339 + private String createById;
  340 +
  341 + /**
  342 + * 创建人
  343 + */
  344 + @ApiModelProperty("创建人")
  345 + private String createBy;
  346 +
  347 + /**
  348 + * 更新人ID
  349 + */
  350 + @ApiModelProperty("更新人ID")
  351 + private String updateById;
  352 +
  353 + /**
  354 + * 更新人
  355 + */
  356 + @ApiModelProperty("更新人")
  357 + private String updateBy;
  358 +
  359 + /**
  360 + * 创建时间
  361 + */
  362 + @ApiModelProperty("创建时间")
  363 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  364 + private LocalDateTime createTime;
  365 +
  366 + /**
  367 + * 更新时间
  368 + */
  369 + @ApiModelProperty("更新时间")
  370 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  371 + private LocalDateTime updateTime;
  372 +
  373 + /**
  374 + * 明细信息
  375 + */
  376 + @ApiModelProperty("明细信息")
  377 + private List<GetProcurementPlanChangeLineBo> lines;
  378 +
  379 + public GetProcurementPlanChangeBo() {
  380 + }
  381 +
  382 + public GetProcurementPlanChangeBo(ProcurementPlanChange dto) {
  383 + super(dto);
  384 + }
  385 +
  386 + public GetProcurementPlanChangeBo(ProcurementPlanChange dto, List<ProcurementPlanChangeLine> lineList) {
  387 + super(dto);
  388 + if (!CollectionUtil.isEmpty(lineList)) {
  389 + this.lines = lineList.stream().map(GetProcurementPlanChangeLineBo::new).collect(Collectors.toList());
  390 + }
  391 + }
  392 +
  393 + @Override
  394 + public BaseBo<ProcurementPlanChange> convert(ProcurementPlanChange dto) {
  395 + return super.convert(dto);
  396 + }
  397 +
  398 + @Override
  399 + protected void afterInit(ProcurementPlanChange dto) {
  400 +
  401 + }
  402 +}
... ...
  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.ProcurementPlanChangeLine;
  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 GetProcurementPlanChangeLineBo extends BaseBo<ProcurementPlanChangeLine> {
  14 +
  15 + /**
  16 + * ID
  17 + */
  18 + @ApiModelProperty("ID")
  19 + private String id;
  20 +
  21 + /**
  22 + * 采购计划变更单ID
  23 + */
  24 + @ApiModelProperty("采购计划变更单ID")
  25 + private String procurementPlanChangeId;
  26 +
  27 + /**
  28 + * 品种ID
  29 + */
  30 + @ApiModelProperty("品种ID")
  31 + private String productId;
  32 +
  33 + /**
  34 + * 料型
  35 + */
  36 + @ApiModelProperty("料型")
  37 + private String materialType;
  38 +
  39 + /**
  40 + * 数量
  41 + */
  42 + @ApiModelProperty("数量")
  43 + private BigDecimal quantity;
  44 +
  45 + /**
  46 + * 实际采购价
  47 + */
  48 + @ApiModelProperty("实际采购价")
  49 + private BigDecimal actualPurchasePrice;
  50 +
  51 + /**
  52 + * 含运到厂价
  53 + */
  54 + @ApiModelProperty("含运到厂价")
  55 + private BigDecimal includingShippingPrice;
  56 +
  57 + /**
  58 + * 价格表价格
  59 + */
  60 + @ApiModelProperty("价格表价格")
  61 + private BigDecimal priceListPrices;
  62 +
  63 + /**
  64 + * 协调幅度
  65 + */
  66 + @ApiModelProperty("协调幅度")
  67 + private BigDecimal coordinationRange;
  68 +
  69 + /**
  70 + * 买断料预计损耗
  71 + */
  72 + @ApiModelProperty("买断料预计损耗")
  73 + private BigDecimal estimatedLoss;
  74 +
  75 + /**
  76 + * 申请损耗(%)
  77 + */
  78 + @ApiModelProperty("申请损耗(%)")
  79 + private BigDecimal applicationAttrition;
  80 +
  81 + /**
  82 + * 漆损率(%)
  83 + */
  84 + @ApiModelProperty("漆损率(%)")
  85 + private BigDecimal paintDamageRatio;
  86 +
  87 + /**
  88 + * 分厂
  89 + */
  90 + @ApiModelProperty("分厂")
  91 + private String workshopId;
  92 +
  93 + /**
  94 + * 前端行标识
  95 + */
  96 + @ApiModelProperty("前端行标识")
  97 + private String itemId;
  98 +
  99 + /**
  100 + * 创建人ID
  101 + */
  102 + @ApiModelProperty("创建人ID")
  103 + private String createById;
  104 +
  105 + /**
  106 + * 创建人
  107 + */
  108 + @ApiModelProperty("创建人")
  109 + private String createBy;
  110 +
  111 + /**
  112 + * 更新人ID
  113 + */
  114 + @ApiModelProperty("更新人ID")
  115 + private String updateById;
  116 +
  117 + /**
  118 + * 更新人
  119 + */
  120 + @ApiModelProperty("更新人")
  121 + private String updateBy;
  122 +
  123 + /**
  124 + * 创建时间
  125 + */
  126 + @ApiModelProperty("创建时间")
  127 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  128 + private LocalDateTime createTime;
  129 +
  130 + /**
  131 + * 更新时间
  132 + */
  133 + @ApiModelProperty("更新时间")
  134 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  135 + private LocalDateTime updateTime;
  136 +
  137 + public GetProcurementPlanChangeLineBo() {
  138 + }
  139 +
  140 + public GetProcurementPlanChangeLineBo(ProcurementPlanChangeLine dto) {
  141 + super(dto);
  142 + }
  143 +
  144 + @Override
  145 + public BaseBo<ProcurementPlanChangeLine> convert(ProcurementPlanChangeLine dto) {
  146 + return super.convert(dto);
  147 + }
  148 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.controller.change;
  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.GetProcurementPlanChangeBo;
  9 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;
  10 +import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService;
  11 +import com.lframework.xingyun.sc.procurement.vo.change.CreateProcurementPlanChangeVo;
  12 +import com.lframework.xingyun.sc.procurement.vo.change.QueryProcurementPlanChangeVo;
  13 +import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo;
  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.GetMapping;
  22 +import org.springframework.web.bind.annotation.PostMapping;
  23 +import org.springframework.web.bind.annotation.RequestBody;
  24 +import org.springframework.web.bind.annotation.RequestMapping;
  25 +import org.springframework.web.bind.annotation.RestController;
  26 +
  27 +@Api(tags = "采购计划变更单管理")
  28 +@Validated
  29 +@RestController
  30 +@RequestMapping("/procurement/plan/change")
  31 +public class ProcurementPlanChangeController extends DefaultBaseController {
  32 +
  33 + @Autowired
  34 + private ProcurementPlanChangeService procurementPlanChangeService;
  35 +
  36 + /**
  37 + * 查询列表
  38 + */
  39 + @ApiOperation("查询列表")
  40 + @HasPermission({"plan-manage:plan-change:query"})
  41 + @GetMapping("/query")
  42 + public InvokeResult<PageResult<ProcurementPlanChange>> query(@Valid QueryProcurementPlanChangeVo vo) {
  43 + PageResult<ProcurementPlanChange> result = procurementPlanChangeService.query(
  44 + getPageIndex(vo), getPageSize(vo), vo);
  45 + return InvokeResultBuilder.success(result);
  46 + }
  47 +
  48 + /**
  49 + * 查询详情
  50 + */
  51 + @ApiOperation("查询详情")
  52 + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true)
  53 + @HasPermission({"plan-manage:plan-change:query"})
  54 + @GetMapping("/findById")
  55 + public InvokeResult<GetProcurementPlanChangeBo> findById(@NotBlank(message = "ID不能为空!") String id) {
  56 + GetProcurementPlanChangeBo result = procurementPlanChangeService.findDetail(id);
  57 + return InvokeResultBuilder.success(result);
  58 + }
  59 +
  60 + /**
  61 + * 新增
  62 + */
  63 + @ApiOperation("新增采购计划变更单")
  64 + @HasPermission({"plan-manage:plan-change:add"})
  65 + @PostMapping("/create")
  66 + public InvokeResult<String> create(@RequestBody @Valid CreateProcurementPlanChangeVo vo) {
  67 + vo.validate();
  68 + String id = procurementPlanChangeService.create(vo);
  69 + return InvokeResultBuilder.success(id);
  70 + }
  71 +
  72 + /**
  73 + * 修改
  74 + */
  75 + @ApiOperation("修改采购计划变更单")
  76 + @HasPermission({"plan-manage:plan-change:supple"})
  77 + @PostMapping("/update")
  78 + public InvokeResult<Void> update(@RequestBody @Valid UpdateProcurementPlanChangeVo vo) {
  79 + vo.validate();
  80 + procurementPlanChangeService.update(vo);
  81 + return InvokeResultBuilder.success();
  82 + }
  83 +
  84 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.entity;
  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_change")
  15 +public class ProcurementPlanChange extends BaseEntity implements BaseDto {
  16 +
  17 + private static final long serialVersionUID = 1L;
  18 +
  19 + /**
  20 + * ID
  21 + */
  22 + private String id;
  23 +
  24 + /**
  25 + * 原采购计划ID
  26 + */
  27 + private String procurementPlanId;
  28 +
  29 + /**
  30 + * 变更事由
  31 + */
  32 + private String changeReason;
  33 +
  34 + /**
  35 + * 变更单编号
  36 + */
  37 + private String code;
  38 +
  39 + /**
  40 + * 公司简称ID
  41 + */
  42 + private String companyShortId;
  43 +
  44 + /**
  45 + * 公司简称名称
  46 + */
  47 + @TableField(exist = false)
  48 + private String companyShortName;
  49 +
  50 + /**
  51 + * 供应商ID
  52 + */
  53 + private String supplierId;
  54 +
  55 + /**
  56 + * 供应商名称
  57 + */
  58 + @TableField(exist = false)
  59 + private String supplierName;
  60 +
  61 + /**
  62 + * 采购处
  63 + */
  64 + private String purchaseDepartment;
  65 +
  66 + /**
  67 + * 采购处名称
  68 + */
  69 + @TableField(exist = false)
  70 + private String purchaseDepartmentName;
  71 +
  72 + /**
  73 + * 区域
  74 + */
  75 + private String region;
  76 +
  77 + /**
  78 + * 区域名称
  79 + */
  80 + @TableField(exist = false)
  81 + private String regionName;
  82 +
  83 + /**
  84 + * 日期
  85 + */
  86 + private LocalDate date;
  87 +
  88 + /**
  89 + * 报价时效
  90 + */
  91 + private String validityPeriod;
  92 +
  93 + /**
  94 + * 报价人ID
  95 + */
  96 + private String quoterId;
  97 +
  98 + /**
  99 + * 报价人
  100 + */
  101 + private String quoterName;
  102 +
  103 + /**
  104 + * 是否长单操作
  105 + */
  106 + private Boolean longTermOperation;
  107 +
  108 + /**
  109 + * 是否终端客户
  110 + */
  111 + private Boolean terminalCustomer;
  112 +
  113 + /**
  114 + * 是否未点价
  115 + */
  116 + private Boolean priced;
  117 +
  118 + /**
  119 + * 点价截止日期
  120 + */
  121 + private LocalDate pricingDeadline;
  122 +
  123 + /**
  124 + * 是否暂定价
  125 + */
  126 + private Boolean temporaryPrice;
  127 +
  128 + /**
  129 + * 其他费用凭票到厂另行结算
  130 + */
  131 + private Boolean otherExpenseSettlement;
  132 +
  133 + /**
  134 + * 交提货方式
  135 + */
  136 + private String deliveryMode;
  137 +
  138 + /**
  139 + * 是否通货买断
  140 + */
  141 + private Boolean commodityBuyout;
  142 +
  143 + /**
  144 + * 是否质量买断
  145 + */
  146 + private Boolean qualityBuyout;
  147 +
  148 + /**
  149 + * 是否数量买断
  150 + */
  151 + private Boolean quantityBuyout;
  152 +
  153 + /**
  154 + * 是否送货上门
  155 + */
  156 + private Boolean doorDelivery;
  157 +
  158 + /**
  159 + * 另付运费
  160 + */
  161 + private BigDecimal shippingCost;
  162 +
  163 + /**
  164 + * 装车费
  165 + */
  166 + private BigDecimal loadingFee;
  167 +
  168 + /**
  169 + * 开票品名
  170 + */
  171 + private String invoiceProductName;
  172 +
  173 + /**
  174 + * 交货日期
  175 + */
  176 + private LocalDate deliveryDate;
  177 +
  178 + /**
  179 + * 结算方式
  180 + */
  181 + private String settlementMethod;
  182 +
  183 + /**
  184 + * 结算比例(%)
  185 + */
  186 + private BigDecimal settlementRatio;
  187 +
  188 + /**
  189 + * 价格表ID
  190 + */
  191 + private String priceId;
  192 +
  193 + @TableField(exist = false)
  194 + private String priceCode;
  195 +
  196 + /**
  197 + * 协调事由
  198 + */
  199 + private String coordinationReason;
  200 +
  201 + /**
  202 + * 票类状况
  203 + */
  204 + private String invoiceTypeStatus;
  205 +
  206 + /**
  207 + * 数量合计
  208 + */
  209 + private BigDecimal totalQuantity;
  210 +
  211 + /**
  212 + * 备注
  213 + */
  214 + private String remark;
  215 +
  216 + /**
  217 + * 是否启用料质状况
  218 + */
  219 + private Boolean materialConditionEnabled;
  220 +
  221 + /**
  222 + * 铜米
  223 + */
  224 + private String materialConditionCopperRice;
  225 +
  226 + /**
  227 + * 光亮铜
  228 + */
  229 + private String materialConditionBrightCopper;
  230 +
  231 + /**
  232 + * 一特
  233 + */
  234 + private String materialConditionFirstClass;
  235 +
  236 + /**
  237 + * 二特
  238 + */
  239 + private String materialConditionSecondClass;
  240 +
  241 + /**
  242 + * 镀锡紫
  243 + */
  244 + private String materialConditionTinCoated;
  245 +
  246 + /**
  247 + * 角料
  248 + */
  249 + private String materialConditionScrap;
  250 +
  251 + /**
  252 + * 镀白黄
  253 + */
  254 + private String materialConditionWhiteYellow;
  255 +
  256 + /**
  257 + * 磷铜
  258 + */
  259 + private String materialConditionPhosphorCopper;
  260 +
  261 + /**
  262 + * 审核状态
  263 + */
  264 + private String approvalStatus;
  265 +
  266 + /**
  267 + * 流程状态
  268 + */
  269 + private String processStatus;
  270 +
  271 + /**
  272 + * 流程节点
  273 + */
  274 + private String processNode;
  275 +
  276 + /**
  277 + * 分厂ID
  278 + */
  279 + private String workshopId;
  280 +
  281 + /**
  282 + * 创建人ID
  283 + */
  284 + @TableField(fill = FieldFill.INSERT)
  285 + private String createById;
  286 +
  287 + /**
  288 + * 创建人
  289 + */
  290 + @TableField(fill = FieldFill.INSERT)
  291 + private String createBy;
  292 +
  293 + /**
  294 + * 更新人ID
  295 + */
  296 + @TableField(fill = FieldFill.INSERT_UPDATE)
  297 + private String updateById;
  298 +
  299 + /**
  300 + * 更新人
  301 + */
  302 + @TableField(fill = FieldFill.INSERT_UPDATE)
  303 + private String updateBy;
  304 +
  305 + /**
  306 + * 创建时间
  307 + */
  308 + @TableField(fill = FieldFill.INSERT)
  309 + private LocalDateTime createTime;
  310 +
  311 + /**
  312 + * 更新时间
  313 + */
  314 + @TableField(fill = FieldFill.INSERT_UPDATE)
  315 + private LocalDateTime updateTime;
  316 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.entity;
  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.LocalDateTime;
  11 +
  12 +@Data
  13 +@TableName("procurement_plan_change_line")
  14 +public class ProcurementPlanChangeLine extends BaseEntity implements BaseDto {
  15 +
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /**
  19 + * ID
  20 + */
  21 + private String id;
  22 +
  23 + /**
  24 + * 采购计划变更单ID
  25 + */
  26 + private String procurementPlanChangeId;
  27 +
  28 + /**
  29 + * 品种ID
  30 + */
  31 + private String productId;
  32 +
  33 + /**
  34 + * 料型
  35 + */
  36 + private String materialType;
  37 +
  38 + /**
  39 + * 数量
  40 + */
  41 + private BigDecimal quantity;
  42 +
  43 + /**
  44 + * 实际采购价
  45 + */
  46 + private BigDecimal actualPurchasePrice;
  47 +
  48 + /**
  49 + * 含运到厂价
  50 + */
  51 + private BigDecimal includingShippingPrice;
  52 +
  53 + /**
  54 + * 价格表价格
  55 + */
  56 + private BigDecimal priceListPrices;
  57 +
  58 + /**
  59 + * 协调幅度
  60 + */
  61 + private BigDecimal coordinationRange;
  62 +
  63 + /**
  64 + * 买断料预计损耗
  65 + */
  66 + private BigDecimal estimatedLoss;
  67 +
  68 + /**
  69 + * 申请损耗(%)
  70 + */
  71 + private BigDecimal applicationAttrition;
  72 +
  73 + /**
  74 + * 漆损率(%)
  75 + */
  76 + private BigDecimal paintDamageRatio;
  77 +
  78 + /**
  79 + * 分厂
  80 + */
  81 + private String workshopId;
  82 +
  83 + /**
  84 + * 前端行标识
  85 + */
  86 + private String itemId;
  87 +
  88 + /**
  89 + * 创建人ID
  90 + */
  91 + @TableField(fill = FieldFill.INSERT)
  92 + private String createById;
  93 +
  94 + /**
  95 + * 创建人
  96 + */
  97 + @TableField(fill = FieldFill.INSERT)
  98 + private String createBy;
  99 +
  100 + /**
  101 + * 更新人ID
  102 + */
  103 + @TableField(fill = FieldFill.INSERT_UPDATE)
  104 + private String updateById;
  105 +
  106 + /**
  107 + * 更新人
  108 + */
  109 + @TableField(fill = FieldFill.INSERT_UPDATE)
  110 + private String updateBy;
  111 +
  112 + /**
  113 + * 创建时间
  114 + */
  115 + @TableField(fill = FieldFill.INSERT)
  116 + private LocalDateTime createTime;
  117 +
  118 + /**
  119 + * 更新时间
  120 + */
  121 + @TableField(fill = FieldFill.INSERT_UPDATE)
  122 + private LocalDateTime updateTime;
  123 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.impl.change;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine;
  5 +import com.lframework.xingyun.sc.procurement.mappers.change.ProcurementPlanChangeLineMapper;
  6 +import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeLineService;
  7 +import org.springframework.stereotype.Service;
  8 +import java.util.List;
  9 +
  10 +@Service
  11 +public class ProcurementPlanChangeLineServiceImpl extends
  12 + ServiceImpl<ProcurementPlanChangeLineMapper, ProcurementPlanChangeLine> implements
  13 + ProcurementPlanChangeLineService {
  14 +
  15 + @Override
  16 + public List<ProcurementPlanChangeLine> getByChangeId(String changeId) {
  17 + return getBaseMapper().getByChangeId(changeId);
  18 + }
  19 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.impl.change;
  2 +
  3 +import cn.hutool.core.bean.BeanUtil;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  6 +import com.github.pagehelper.PageInfo;
  7 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  8 +import com.lframework.starter.common.exceptions.impl.InputErrorException;
  9 +import com.lframework.starter.common.utils.Assert;
  10 +import com.lframework.starter.common.utils.CollectionUtil;
  11 +import com.lframework.starter.common.utils.StringUtil;
  12 +import com.lframework.starter.web.core.annotations.oplog.OpLog;
  13 +import com.lframework.starter.web.core.components.resp.PageResult;
  14 +import com.lframework.starter.web.core.components.security.SecurityUtil;
  15 +import com.lframework.starter.web.core.utils.IdUtil;
  16 +import com.lframework.starter.web.core.utils.PageHelperUtil;
  17 +import com.lframework.starter.web.core.utils.PageResultUtil;
  18 +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  19 +import com.lframework.starter.web.inner.entity.SysRole;
  20 +import com.lframework.starter.web.inner.service.system.SysRoleService;
  21 +import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanChangeBo;
  22 +import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanChangeLineBo;
  23 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan;
  24 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;
  25 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine;
  26 +import com.lframework.xingyun.sc.procurement.mappers.change.ProcurementPlanChangeLineMapper;
  27 +import com.lframework.xingyun.sc.procurement.mappers.change.ProcurementPlanChangeMapper;
  28 +import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeLineService;
  29 +import com.lframework.xingyun.sc.procurement.service.change.ProcurementPlanChangeService;
  30 +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService;
  31 +import com.lframework.xingyun.sc.procurement.vo.change.CreateProcurementPlanChangeLineVo;
  32 +import com.lframework.xingyun.sc.procurement.vo.change.CreateProcurementPlanChangeVo;
  33 +import com.lframework.xingyun.sc.procurement.vo.change.QueryProcurementPlanChangeVo;
  34 +import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeLineVo;
  35 +import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo;
  36 +import java.util.*;
  37 +import java.util.stream.Collectors;
  38 +import javax.annotation.Resource;
  39 +import org.springframework.stereotype.Service;
  40 +import org.springframework.transaction.annotation.Transactional;
  41 +
  42 +@Service
  43 +public class ProcurementPlanChangeServiceImpl extends
  44 + ServiceImpl<ProcurementPlanChangeMapper, ProcurementPlanChange> implements
  45 + ProcurementPlanChangeService {
  46 +
  47 + @Resource
  48 + private ProcurementPlanService procurementPlanService;
  49 + @Resource
  50 + private ProcurementPlanChangeLineService procurementPlanChangeLineService;
  51 + @Resource
  52 + private ProcurementPlanChangeLineMapper procurementPlanChangeLineMapper;
  53 + @Resource
  54 + private SysRoleService sysRoleService;
  55 +
  56 +
  57 + private static final List<String> PROCESS_STATUSES = Arrays.asList(
  58 + "COMPLETED", "ABORTED"
  59 + );
  60 +
  61 + private static final List<String> CHANGE_DUPLICATE_EXCLUDES = Arrays.asList(
  62 + "已作废", "已驳回", "草稿"
  63 + );
  64 +
  65 + @Override
  66 + @Transactional(rollbackFor = Exception.class)
  67 + @OpLog(type = OtherOpLogType.class, name = "创建采购计划变更单,原计划ID:{},变更单ID:{}", params = {"#vo.procurementPlanId", "#result"})
  68 + public String create(CreateProcurementPlanChangeVo vo) {
  69 + if (StringUtil.isBlank(vo.getProcurementPlanId())) {
  70 + throw new InputErrorException("原采购计划ID不能为空!");
  71 + }
  72 + if (StringUtil.isBlank(vo.getChangeReason())) {
  73 + throw new InputErrorException("变更事由不能为空!");
  74 + }
  75 +
  76 + ProcurementPlan plan = procurementPlanService.getById(vo.getProcurementPlanId());
  77 + if (plan == null) {
  78 + throw new DefaultClientException("原采购计划不存在!");
  79 + }
  80 +
  81 + if (StringUtil.isNotBlank(plan.getParentId())) {
  82 + throw new DefaultClientException("只能选择主计划进行变更!");
  83 + }
  84 +
  85 + if (StringUtil.isBlank(plan.getApprovalStatus())
  86 + || !PROCESS_STATUSES.contains(plan.getApprovalStatus())) {
  87 + throw new DefaultClientException("原采购计划状态不允许变更,请确认计划已中止/完成");
  88 + }
  89 + String currentUserId = SecurityUtil.getCurrentUser().getId();
  90 + List<SysRole> roles = sysRoleService.getByUserId(currentUserId);
  91 + List<String> roleCodes = CollectionUtil.isEmpty(roles) ? new java.util.ArrayList<>()
  92 + : roles.stream().map(SysRole::getCode).collect(Collectors.toList());
  93 + ProcurementPlanChange planChange = new ProcurementPlanChange();
  94 + BeanUtil.copyProperties(vo, planChange);
  95 + planChange.setId(IdUtil.getId());
  96 + planChange.setProcessStatus("DRAFT");
  97 + if (roleCodes.contains("ltcgczg") || roleCodes.contains("ztcgczg")
  98 + || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) {
  99 + planChange.setProcessNode("CGCZG");
  100 + } else if (roleCodes.contains("qyjl")) {
  101 + planChange.setProcessNode("QYJL");
  102 + } else if (roleCodes.contains("nmcgkywy")) {
  103 + planChange.setProcessNode("YWY");
  104 + }
  105 +
  106 +
  107 + this.save(planChange);
  108 +
  109 + List<ProcurementPlanChangeLine> lines = new ArrayList<>();
  110 + if (!CollectionUtil.isEmpty(vo.getLines())) {
  111 + for (CreateProcurementPlanChangeLineVo lineVo : vo.getLines()) {
  112 + ProcurementPlanChangeLine line = new ProcurementPlanChangeLine();
  113 + BeanUtil.copyProperties(lineVo, line);
  114 + line.setId(IdUtil.getId());
  115 + line.setProcurementPlanChangeId(planChange.getId());
  116 + lines.add(line);
  117 + }
  118 + }
  119 +
  120 + if (!CollectionUtil.isEmpty(lines)) {
  121 + procurementPlanChangeLineService.saveBatch(lines);
  122 + }
  123 +
  124 + return planChange.getId();
  125 + }
  126 +
  127 + @Override
  128 + @Transactional(rollbackFor = Exception.class)
  129 + @OpLog(type = OtherOpLogType.class, name = "修改采购计划变更单,ID:{}", params = {"#vo.id"})
  130 + public void update(UpdateProcurementPlanChangeVo vo) {
  131 + if (StringUtil.isBlank(vo.getId())) {
  132 + throw new InputErrorException("ID不能为空!");
  133 + }
  134 +
  135 + ProcurementPlanChange entity = this.getById(vo.getId());
  136 + if (entity == null) {
  137 + throw new DefaultClientException("采购计划变更单不存在!");
  138 + }
  139 + ProcurementPlanChange planChange = new ProcurementPlanChange();
  140 + BeanUtil.copyProperties(vo, planChange);
  141 + this.updateById(entity);
  142 + //保存或更新采购计划变更单明细
  143 + saveOrUpdateLines(vo.getProcurementPlanId(), vo.getLines());
  144 + }
  145 +
  146 + @Override
  147 + public PageResult<ProcurementPlanChange> query(Integer pageIndex, Integer pageSize,
  148 + QueryProcurementPlanChangeVo vo) {
  149 + Assert.greaterThanZero(pageIndex);
  150 + Assert.greaterThanZero(pageSize);
  151 +
  152 + PageHelperUtil.startPage(pageIndex, pageSize);
  153 + List<ProcurementPlanChange> datas = this.query(vo);
  154 +
  155 + return PageResultUtil.convert(new PageInfo<>(datas));
  156 + }
  157 +
  158 + @Override
  159 + public List<ProcurementPlanChange> query(QueryProcurementPlanChangeVo vo) {
  160 + return this.getBaseMapper().query(vo);
  161 + }
  162 +
  163 + @Override
  164 + public GetProcurementPlanChangeBo findDetail(String id) {
  165 + if (StringUtil.isBlank(id)) {
  166 + throw new InputErrorException("ID不能为空!");
  167 + }
  168 +
  169 + ProcurementPlanChange entity = this.getById(id);
  170 + if (entity == null) {
  171 + throw new DefaultClientException("采购计划变更单不存在!");
  172 + }
  173 +
  174 + GetProcurementPlanChangeBo bo = new GetProcurementPlanChangeBo(entity);
  175 +
  176 + List<ProcurementPlanChangeLine> lines = procurementPlanChangeLineMapper.selectList(
  177 + Wrappers.lambdaQuery(ProcurementPlanChangeLine.class)
  178 + .eq(ProcurementPlanChangeLine::getProcurementPlanChangeId, id));
  179 +
  180 + if (!CollectionUtil.isEmpty(lines)) {
  181 + bo.setLines(lines.stream().map(GetProcurementPlanChangeLineBo::new).collect(Collectors.toList()));
  182 + }
  183 +
  184 + return bo;
  185 + }
  186 +
  187 +
  188 + /**
  189 + * 保存或更新采购计划变更单明细
  190 + *
  191 + * @param planChangeId 计划变更ID
  192 + * @param lineList 明细列表
  193 + */
  194 + private void saveOrUpdateLines(String planChangeId, List<UpdateProcurementPlanChangeLineVo> lineList) {
  195 + List<ProcurementPlanChangeLine> oldLineList = procurementPlanChangeLineService
  196 + .getByChangeId(planChangeId);
  197 + Map<String, ProcurementPlanChangeLine> oldLineMap = CollectionUtil.isEmpty(oldLineList)
  198 + ? Collections.emptyMap()
  199 + : oldLineList.stream().collect(Collectors.toMap(ProcurementPlanChangeLine::getId, v -> v));
  200 +
  201 + List<String> existIdList = new ArrayList<>();
  202 + for (UpdateProcurementPlanChangeLineVo lineVo : lineList) {
  203 + if (StringUtil.isNotBlank(lineVo.getId())) {
  204 + ProcurementPlanChangeLine oldLine = oldLineMap.get(lineVo.getId());
  205 + if (oldLine == null) {
  206 + throw new DefaultClientException("采购计划变更单明细不存在或不属于当前采购计划变更单!");
  207 + }
  208 +
  209 + existIdList.add(lineVo.getId());
  210 + lineVo.setProcurementPlanChangeId(planChangeId);
  211 + if (StringUtil.isBlank(lineVo.getItemId())) {
  212 + lineVo.setItemId(oldLine.getItemId());
  213 + }
  214 + ProcurementPlanChangeLine updateLine = BeanUtil.copyProperties(lineVo, ProcurementPlanChangeLine.class);
  215 + updateLine.setId(lineVo.getId());
  216 + procurementPlanChangeLineService.updateById(updateLine);
  217 + } else {
  218 + ProcurementPlanChangeLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanChangeLine.class);
  219 + createLine.setId(IdUtil.getId());
  220 + createLine.setProcurementPlanChangeId(planChangeId);
  221 + procurementPlanChangeLineService.save(createLine);
  222 + existIdList.add(createLine.getId());
  223 + }
  224 + }
  225 +
  226 + List<ProcurementPlanChangeLine> safeOldLineList = oldLineList == null ? Collections.emptyList() : oldLineList;
  227 + List<String> needDeleteIdList = safeOldLineList.stream()
  228 + .map(ProcurementPlanChangeLine::getId)
  229 + .filter(oldLineId -> !existIdList.contains(oldLineId))
  230 + .collect(Collectors.toList());
  231 + if (CollectionUtil.isNotEmpty(needDeleteIdList)) {
  232 + procurementPlanChangeLineService.removeByIds(needDeleteIdList);
  233 + }
  234 + }
  235 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.mappers.change;
  2 +
  3 +import com.lframework.starter.web.core.mapper.BaseMapper;
  4 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine;
  5 +import org.apache.ibatis.annotations.Param;
  6 +import java.util.List;
  7 +
  8 +public interface ProcurementPlanChangeLineMapper extends BaseMapper<ProcurementPlanChangeLine> {
  9 +
  10 + /**
  11 + * 根据变更单ID查询
  12 + *
  13 + * @param changeId
  14 + * @return
  15 + */
  16 + List<ProcurementPlanChangeLine> getByChangeId(@Param("changeId") String changeId);
  17 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.mappers.change;
  2 +
  3 +import com.lframework.starter.web.core.mapper.BaseMapper;
  4 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;
  5 +import com.lframework.xingyun.sc.procurement.vo.change.QueryProcurementPlanChangeVo;
  6 +import java.util.List;
  7 +import org.apache.ibatis.annotations.Param;
  8 +
  9 +public interface ProcurementPlanChangeMapper extends BaseMapper<ProcurementPlanChange> {
  10 +
  11 + /**
  12 + * 根据ID查询
  13 + *
  14 + * @param id
  15 + * @return
  16 + */
  17 + ProcurementPlanChange findById(@Param("id") String id);
  18 +
  19 + /**
  20 + * 查询变更单列表
  21 + *
  22 + * @param vo
  23 + * @return
  24 + */
  25 + List<ProcurementPlanChange> query(@Param("vo") QueryProcurementPlanChangeVo vo);
  26 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.service.change;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine;
  5 +import java.util.List;
  6 +
  7 +public interface ProcurementPlanChangeLineService extends IService<ProcurementPlanChangeLine> {
  8 +
  9 + /**
  10 + * 根据变更单ID查询
  11 + *
  12 + * @param changeId
  13 + * @return
  14 + */
  15 + List<ProcurementPlanChangeLine> getByChangeId(String changeId);
  16 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.service.change;
  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.GetProcurementPlanChangeBo;
  6 +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;
  7 +import com.lframework.xingyun.sc.procurement.vo.change.CreateProcurementPlanChangeVo;
  8 +import com.lframework.xingyun.sc.procurement.vo.change.QueryProcurementPlanChangeVo;
  9 +import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChangeVo;
  10 +import java.util.List;
  11 +
  12 +public interface ProcurementPlanChangeService extends IService<ProcurementPlanChange> {
  13 +
  14 + /**
  15 + * 创建
  16 + *
  17 + * @param vo
  18 + * @return
  19 + */
  20 + String create(CreateProcurementPlanChangeVo vo);
  21 +
  22 + /**
  23 + * 修改
  24 + *
  25 + * @param vo
  26 + */
  27 + void update(UpdateProcurementPlanChangeVo vo);
  28 +
  29 + /**
  30 + * 分页查询变更单列表
  31 + *
  32 + * @param pageIndex 页码
  33 + * @param pageSize 页大小
  34 + * @param vo 查询条件
  35 + * @return 分页结果
  36 + */
  37 + PageResult<ProcurementPlanChange> query(Integer pageIndex, Integer pageSize,
  38 + QueryProcurementPlanChangeVo vo);
  39 +
  40 + /**
  41 + * 查询变更单列表(不分页)
  42 + *
  43 + * @param vo 查询条件
  44 + * @return 数据列表
  45 + */
  46 + List<ProcurementPlanChange> query(QueryProcurementPlanChangeVo vo);
  47 +
  48 + /**
  49 + * 根据ID查询详情
  50 + *
  51 + * @param id
  52 + * @return
  53 + */
  54 + GetProcurementPlanChangeBo findDetail(String id);
  55 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.vo.change;
  2 +
  3 +import com.lframework.starter.web.core.vo.BaseVo;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import java.io.Serializable;
  6 +import java.math.BigDecimal;
  7 +import javax.validation.constraints.Digits;
  8 +import javax.validation.constraints.NotBlank;
  9 +import javax.validation.constraints.NotNull;
  10 +import lombok.Data;
  11 +import org.hibernate.validator.constraints.Length;
  12 +
  13 +@Data
  14 +public class CreateProcurementPlanChangeLineVo implements BaseVo, Serializable {
  15 +
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /**
  19 + * 品种ID
  20 + */
  21 + @ApiModelProperty(value = "品种ID", required = true)
  22 + @NotBlank(message = "品种ID不能为空!")
  23 + private String productId;
  24 +
  25 + /**
  26 + * 料型
  27 + */
  28 + @ApiModelProperty("料型")
  29 + @Length(max = 200, message = "料型最多允许200个字符!")
  30 + private String materialType;
  31 +
  32 + /**
  33 + * 数量
  34 + */
  35 + @ApiModelProperty(value = "数量", required = true)
  36 + @NotNull(message = "数量不能为空!")
  37 + @Digits(integer = 14, fraction = 5, message = "数量最多支持14位整数和5位小数!")
  38 + private BigDecimal quantity;
  39 +
  40 + /**
  41 + * 实际采购价
  42 + */
  43 + @ApiModelProperty("实际采购价")
  44 + @Digits(integer = 14, fraction = 10, message = "实际采购价最多支持14位整数和10位小数!")
  45 + private BigDecimal actualPurchasePrice;
  46 +
  47 + /**
  48 + * 含运到厂价
  49 + */
  50 + @ApiModelProperty("含运到厂价")
  51 + @Digits(integer = 14, fraction = 10, message = "含运到厂价最多支持14位整数和10位小数!")
  52 + private BigDecimal includingShippingPrice;
  53 +
  54 + /**
  55 + * 价格表价格
  56 + */
  57 + @ApiModelProperty("价格表价格")
  58 + @Digits(integer = 14, fraction = 10, message = "价格表价格最多支持14位整数和10位小数!")
  59 + private BigDecimal priceListPrices;
  60 +
  61 + /**
  62 + * 协调幅度
  63 + */
  64 + @ApiModelProperty("协调幅度")
  65 + @Digits(integer = 14, fraction = 10, message = "协调幅度最多支持14位整数和10位小数!")
  66 + private BigDecimal coordinationRange;
  67 +
  68 + /**
  69 + * 买断料预计损耗
  70 + */
  71 + @ApiModelProperty("买断料预计损耗")
  72 + @Digits(integer = 8, fraction = 10, message = "买断料预计损耗最多支持8位整数和10位小数!")
  73 + private BigDecimal estimatedLoss;
  74 +
  75 + /**
  76 + * 申请损耗(%)
  77 + */
  78 + @ApiModelProperty("申请损耗(%)")
  79 + @Digits(integer = 8, fraction = 10, message = "申请损耗最多支持8位整数和10位小数!")
  80 + private BigDecimal applicationAttrition;
  81 +
  82 + /**
  83 + * 漆损率(%)
  84 + */
  85 + @ApiModelProperty("漆损率(%)")
  86 + @Digits(integer = 8, fraction = 10, message = "漆损率最多支持8位整数和10位小数!")
  87 + private BigDecimal paintDamageRatio;
  88 +
  89 + /**
  90 + * 分厂
  91 + */
  92 + @ApiModelProperty("分厂")
  93 + @Length(max = 50, message = "分厂最多允许50个字符!")
  94 + private String workshopId;
  95 +
  96 + /**
  97 + * 前端行标识
  98 + */
  99 + @ApiModelProperty(value = "前端行标识", required = true)
  100 + @NotBlank(message = "前端行标识不能为空!")
  101 + private String itemId;
  102 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.vo.change;
  2 +
  3 +import com.lframework.starter.web.core.vo.BaseVo;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import java.io.Serializable;
  6 +import java.math.BigDecimal;
  7 +import java.time.LocalDate;
  8 +import java.util.List;
  9 +import javax.validation.Valid;
  10 +import javax.validation.constraints.NotBlank;
  11 +import javax.validation.constraints.NotEmpty;
  12 +import lombok.Data;
  13 +import org.hibernate.validator.constraints.Length;
  14 +
  15 +@Data
  16 +public class CreateProcurementPlanChangeVo implements BaseVo, Serializable {
  17 +
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /**
  21 + * 原采购计划ID
  22 + */
  23 + @ApiModelProperty(value = "原采购计划ID", required = true)
  24 + @NotBlank(message = "原采购计划ID不能为空!")
  25 + private String procurementPlanId;
  26 +
  27 + /**
  28 + * 变更事由
  29 + */
  30 + @ApiModelProperty(value = "变更事由", required = true)
  31 + @NotBlank(message = "变更事由不能为空!")
  32 + @Length(max = 1000, message = "变更事由最多允许1000个字符!")
  33 + private String changeReason;
  34 +
  35 + /**
  36 + * 变更单编号
  37 + */
  38 + @ApiModelProperty("变更单编号")
  39 + private String changeCode;
  40 +
  41 + /**
  42 + * 公司简称ID
  43 + */
  44 + @ApiModelProperty("公司简称ID")
  45 + private String companyShortId;
  46 +
  47 + /**
  48 + * 供应商ID
  49 + */
  50 + @ApiModelProperty("供应商ID")
  51 + private String supplierId;
  52 +
  53 + /**
  54 + * 采购处
  55 + */
  56 + @ApiModelProperty("采购处")
  57 + private String purchaseDepartment;
  58 +
  59 + /**
  60 + * 区域
  61 + */
  62 + @ApiModelProperty("区域")
  63 + private String region;
  64 +
  65 + /**
  66 + * 日期
  67 + */
  68 + @ApiModelProperty("日期")
  69 + private LocalDate date;
  70 +
  71 + /**
  72 + * 报价时效
  73 + */
  74 + @ApiModelProperty("报价时效")
  75 + private String validityPeriod;
  76 +
  77 + /**
  78 + * 报价人ID
  79 + */
  80 + @ApiModelProperty("报价人ID")
  81 + private String quoterId;
  82 +
  83 + /**
  84 + * 报价人
  85 + */
  86 + @ApiModelProperty("报价人")
  87 + private String quoterName;
  88 +
  89 + /**
  90 + * 是否长单操作
  91 + */
  92 + @ApiModelProperty("是否长单操作")
  93 + private Boolean longTermOperation;
  94 +
  95 + /**
  96 + * 是否终端客户
  97 + */
  98 + @ApiModelProperty("是否终端客户")
  99 + private Boolean terminalCustomer;
  100 +
  101 + /**
  102 + * 是否未点价
  103 + */
  104 + @ApiModelProperty("是否未点价")
  105 + private Boolean priced;
  106 +
  107 + /**
  108 + * 点价截止日期
  109 + */
  110 + @ApiModelProperty("点价截止日期")
  111 + private LocalDate pricingDeadline;
  112 +
  113 + /**
  114 + * 是否暂定价
  115 + */
  116 + @ApiModelProperty("是否暂定价")
  117 + private Boolean temporaryPrice;
  118 +
  119 + /**
  120 + * 其他费用凭票到厂另行结算
  121 + */
  122 + @ApiModelProperty("其他费用凭票到厂另行结算")
  123 + private Boolean otherExpenseSettlement;
  124 +
  125 + /**
  126 + * 交提货方式
  127 + */
  128 + @ApiModelProperty("交提货方式")
  129 + private String deliveryMode;
  130 +
  131 + /**
  132 + * 是否通货买断
  133 + */
  134 + @ApiModelProperty("是否通货买断")
  135 + private Boolean commodityBuyout;
  136 +
  137 + /**
  138 + * 是否质量买断
  139 + */
  140 + @ApiModelProperty("是否质量买断")
  141 + private Boolean qualityBuyout;
  142 +
  143 + /**
  144 + * 是否数量买断
  145 + */
  146 + @ApiModelProperty("是否数量买断")
  147 + private Boolean quantityBuyout;
  148 +
  149 + /**
  150 + * 是否送货上门
  151 + */
  152 + @ApiModelProperty("是否送货上门")
  153 + private Boolean doorDelivery;
  154 +
  155 + /**
  156 + * 另付运费
  157 + */
  158 + @ApiModelProperty("另付运费")
  159 + private BigDecimal shippingCost;
  160 +
  161 + /**
  162 + * 装车费
  163 + */
  164 + @ApiModelProperty("装车费")
  165 + private BigDecimal loadingFee;
  166 +
  167 + /**
  168 + * 开票品名
  169 + */
  170 + @ApiModelProperty("开票品名")
  171 + private String invoiceProductName;
  172 +
  173 + /**
  174 + * 交货日期
  175 + */
  176 + @ApiModelProperty("交货日期")
  177 + private LocalDate deliveryDate;
  178 +
  179 + /**
  180 + * 结算方式
  181 + */
  182 + @ApiModelProperty("结算方式")
  183 + private String settlementMethod;
  184 +
  185 + /**
  186 + * 结算比例(%)
  187 + */
  188 + @ApiModelProperty("结算比例(%)")
  189 + private BigDecimal settlementRatio;
  190 +
  191 + /**
  192 + * 价格表ID
  193 + */
  194 + @ApiModelProperty("价格表ID")
  195 + private String priceId;
  196 +
  197 + /**
  198 + * 协调事由
  199 + */
  200 + @ApiModelProperty("协调事由")
  201 + private String coordinationReason;
  202 +
  203 + /**
  204 + * 票类状况
  205 + */
  206 + @ApiModelProperty("票类状况")
  207 + private String invoiceTypeStatus;
  208 +
  209 + /**
  210 + * 数量合计
  211 + */
  212 + @ApiModelProperty("数量合计")
  213 + private BigDecimal totalQuantity;
  214 +
  215 + /**
  216 + * 备注
  217 + */
  218 + @ApiModelProperty("备注")
  219 + private String remark;
  220 +
  221 + /**
  222 + * 是否启用料质状况
  223 + */
  224 + @ApiModelProperty("是否启用料质状况")
  225 + private Boolean materialConditionEnabled;
  226 +
  227 + /**
  228 + * 铜米
  229 + */
  230 + @ApiModelProperty("铜米")
  231 + private String materialConditionCopperRice;
  232 +
  233 + /**
  234 + * 光亮铜
  235 + */
  236 + @ApiModelProperty("光亮铜")
  237 + private String materialConditionBrightCopper;
  238 +
  239 + /**
  240 + * 一特
  241 + */
  242 + @ApiModelProperty("一特")
  243 + private String materialConditionFirstClass;
  244 +
  245 + /**
  246 + * 二特
  247 + */
  248 + @ApiModelProperty("二特")
  249 + private String materialConditionSecondClass;
  250 +
  251 + /**
  252 + * 镀锡紫
  253 + */
  254 + @ApiModelProperty("镀锡紫")
  255 + private String materialConditionTinCoated;
  256 +
  257 + /**
  258 + * 角料
  259 + */
  260 + @ApiModelProperty("角料")
  261 + private String materialConditionScrap;
  262 +
  263 + /**
  264 + * 镀白黄
  265 + */
  266 + @ApiModelProperty("镀白黄")
  267 + private String materialConditionWhiteYellow;
  268 +
  269 + /**
  270 + * 磷铜
  271 + */
  272 + @ApiModelProperty("磷铜")
  273 + private String materialConditionPhosphorCopper;
  274 +
  275 + /**
  276 + * 分厂ID
  277 + */
  278 + @ApiModelProperty("分厂ID")
  279 + private String workshopId;
  280 +
  281 + /**
  282 + * 明细信息
  283 + */
  284 + @ApiModelProperty(value = "明细信息", required = true)
  285 + @Valid
  286 + @NotEmpty(message = "明细不能为空!")
  287 + private List<CreateProcurementPlanChangeLineVo> lines;
  288 +
  289 + public void validate() {
  290 + }
  291 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.vo.change;
  2 +
  3 +import com.lframework.starter.web.core.vo.SortPageVo;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import java.time.LocalDate;
  6 +import lombok.Data;
  7 +
  8 +@Data
  9 +public class QueryProcurementPlanChangeVo extends SortPageVo {
  10 +
  11 + private static final long serialVersionUID = 1L;
  12 +
  13 + /**
  14 + * 变更单编号
  15 + */
  16 + @ApiModelProperty("变更单编号")
  17 + private String code;
  18 +
  19 + /**
  20 + * 公司简称ID
  21 + */
  22 + @ApiModelProperty("公司简称ID")
  23 + private String companyShortId;
  24 +
  25 + /**
  26 + * 供应商ID
  27 + */
  28 + @ApiModelProperty("供应商ID")
  29 + private String supplierId;
  30 +
  31 + /**
  32 + * 采购处
  33 + */
  34 + @ApiModelProperty("采购处")
  35 + private String purchaseDepartment;
  36 +
  37 + /**
  38 + * 区域
  39 + */
  40 + @ApiModelProperty("区域")
  41 + private String region;
  42 +
  43 + /**
  44 + * 日期起始
  45 + */
  46 + @ApiModelProperty("日期起始")
  47 + private LocalDate startDate;
  48 +
  49 + /**
  50 + * 日期截止
  51 + */
  52 + @ApiModelProperty("日期截止")
  53 + private LocalDate endDate;
  54 +
  55 + /**
  56 + * 分厂ID
  57 + */
  58 + @ApiModelProperty("分厂ID")
  59 + private String workshopId;
  60 +
  61 + /**
  62 + * 关键词(模糊匹配变更事由、变更单编号、供应商名称)
  63 + */
  64 + @ApiModelProperty("关键词")
  65 + private String keyword;
  66 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.vo.change;
  2 +
  3 +import io.swagger.annotations.ApiModelProperty;
  4 +import lombok.Data;
  5 +
  6 +@Data
  7 +public class UpdateProcurementPlanChangeLineVo extends CreateProcurementPlanChangeLineVo {
  8 +
  9 + private static final long serialVersionUID = 1L;
  10 +
  11 + /**
  12 + * ID
  13 + */
  14 + @ApiModelProperty("ID")
  15 + private String id;
  16 +
  17 + /**
  18 + * 采购计划变更单ID
  19 + */
  20 + @ApiModelProperty("采购计划变更单ID")
  21 + private String procurementPlanChangeId;
  22 +}
... ...
  1 +package com.lframework.xingyun.sc.procurement.vo.change;
  2 +
  3 +import io.swagger.annotations.ApiModelProperty;
  4 +import java.io.Serializable;
  5 +import java.math.BigDecimal;
  6 +import java.time.LocalDate;
  7 +import java.util.List;
  8 +import javax.validation.Valid;
  9 +import javax.validation.constraints.NotBlank;
  10 +import javax.validation.constraints.NotEmpty;
  11 +import lombok.Data;
  12 +import org.hibernate.validator.constraints.Length;
  13 +
  14 +@Data
  15 +public class UpdateProcurementPlanChangeVo implements Serializable {
  16 +
  17 + private static final long serialVersionUID = 1L;
  18 +
  19 + /**
  20 + * ID
  21 + */
  22 + @ApiModelProperty(value = "ID", required = true)
  23 + @NotBlank(message = "ID不能为空!")
  24 + private String id;
  25 +
  26 + /**
  27 + * 原采购计划ID
  28 + */
  29 + @ApiModelProperty(value = "原采购计划ID", required = true)
  30 + @NotBlank(message = "原采购计划ID不能为空!")
  31 + private String procurementPlanId;
  32 +
  33 + /**
  34 + * 变更事由
  35 + */
  36 + @ApiModelProperty(value = "变更事由", required = true)
  37 + @NotBlank(message = "变更事由不能为空!")
  38 + @Length(max = 1000, message = "变更事由最多允许1000个字符!")
  39 + private String changeReason;
  40 +
  41 + /**
  42 + * 变更单编号
  43 + */
  44 + @ApiModelProperty("变更单编号")
  45 + private String changeCode;
  46 +
  47 + /**
  48 + * 公司简称ID
  49 + */
  50 + @ApiModelProperty("公司简称ID")
  51 + private String companyShortId;
  52 +
  53 + /**
  54 + * 供应商ID
  55 + */
  56 + @ApiModelProperty("供应商ID")
  57 + private String supplierId;
  58 +
  59 + /**
  60 + * 采购处
  61 + */
  62 + @ApiModelProperty("采购处")
  63 + private String purchaseDepartment;
  64 +
  65 + /**
  66 + * 区域
  67 + */
  68 + @ApiModelProperty("区域")
  69 + private String region;
  70 +
  71 + /**
  72 + * 日期
  73 + */
  74 + @ApiModelProperty("日期")
  75 + private LocalDate date;
  76 +
  77 + /**
  78 + * 报价时效
  79 + */
  80 + @ApiModelProperty("报价时效")
  81 + private String validityPeriod;
  82 +
  83 + /**
  84 + * 报价人ID
  85 + */
  86 + @ApiModelProperty("报价人ID")
  87 + private String quoterId;
  88 +
  89 + /**
  90 + * 报价人
  91 + */
  92 + @ApiModelProperty("报价人")
  93 + private String quoterName;
  94 +
  95 + /**
  96 + * 是否长单操作
  97 + */
  98 + @ApiModelProperty("是否长单操作")
  99 + private Boolean longTermOperation;
  100 +
  101 + /**
  102 + * 是否终端客户
  103 + */
  104 + @ApiModelProperty("是否终端客户")
  105 + private Boolean terminalCustomer;
  106 +
  107 + /**
  108 + * 是否未点价
  109 + */
  110 + @ApiModelProperty("是否未点价")
  111 + private Boolean priced;
  112 +
  113 + /**
  114 + * 点价截止日期
  115 + */
  116 + @ApiModelProperty("点价截止日期")
  117 + private LocalDate pricingDeadline;
  118 +
  119 + /**
  120 + * 是否暂定价
  121 + */
  122 + @ApiModelProperty("是否暂定价")
  123 + private Boolean temporaryPrice;
  124 +
  125 + /**
  126 + * 其他费用凭票到厂另行结算
  127 + */
  128 + @ApiModelProperty("其他费用凭票到厂另行结算")
  129 + private Boolean otherExpenseSettlement;
  130 +
  131 + /**
  132 + * 交提货方式
  133 + */
  134 + @ApiModelProperty("交提货方式")
  135 + private String deliveryMode;
  136 +
  137 + /**
  138 + * 是否通货买断
  139 + */
  140 + @ApiModelProperty("是否通货买断")
  141 + private Boolean commodityBuyout;
  142 +
  143 + /**
  144 + * 是否质量买断
  145 + */
  146 + @ApiModelProperty("是否质量买断")
  147 + private Boolean qualityBuyout;
  148 +
  149 + /**
  150 + * 是否数量买断
  151 + */
  152 + @ApiModelProperty("是否数量买断")
  153 + private Boolean quantityBuyout;
  154 +
  155 + /**
  156 + * 是否送货上门
  157 + */
  158 + @ApiModelProperty("是否送货上门")
  159 + private Boolean doorDelivery;
  160 +
  161 + /**
  162 + * 另付运费
  163 + */
  164 + @ApiModelProperty("另付运费")
  165 + private BigDecimal shippingCost;
  166 +
  167 + /**
  168 + * 装车费
  169 + */
  170 + @ApiModelProperty("装车费")
  171 + private BigDecimal loadingFee;
  172 +
  173 + /**
  174 + * 开票品名
  175 + */
  176 + @ApiModelProperty("开票品名")
  177 + private String invoiceProductName;
  178 +
  179 + /**
  180 + * 交货日期
  181 + */
  182 + @ApiModelProperty("交货日期")
  183 + private LocalDate deliveryDate;
  184 +
  185 + /**
  186 + * 结算方式
  187 + */
  188 + @ApiModelProperty("结算方式")
  189 + private String settlementMethod;
  190 +
  191 + /**
  192 + * 结算比例(%)
  193 + */
  194 + @ApiModelProperty("结算比例(%)")
  195 + private BigDecimal settlementRatio;
  196 +
  197 + /**
  198 + * 价格表ID
  199 + */
  200 + @ApiModelProperty("价格表ID")
  201 + private String priceId;
  202 +
  203 + /**
  204 + * 协调事由
  205 + */
  206 + @ApiModelProperty("协调事由")
  207 + private String coordinationReason;
  208 +
  209 + /**
  210 + * 票类状况
  211 + */
  212 + @ApiModelProperty("票类状况")
  213 + private String invoiceTypeStatus;
  214 +
  215 + /**
  216 + * 数量合计
  217 + */
  218 + @ApiModelProperty("数量合计")
  219 + private BigDecimal totalQuantity;
  220 +
  221 + /**
  222 + * 备注
  223 + */
  224 + @ApiModelProperty("备注")
  225 + private String remark;
  226 +
  227 + /**
  228 + * 是否启用料质状况
  229 + */
  230 + @ApiModelProperty("是否启用料质状况")
  231 + private Boolean materialConditionEnabled;
  232 +
  233 + /**
  234 + * 铜米
  235 + */
  236 + @ApiModelProperty("铜米")
  237 + private String materialConditionCopperRice;
  238 +
  239 + /**
  240 + * 光亮铜
  241 + */
  242 + @ApiModelProperty("光亮铜")
  243 + private String materialConditionBrightCopper;
  244 +
  245 + /**
  246 + * 一特
  247 + */
  248 + @ApiModelProperty("一特")
  249 + private String materialConditionFirstClass;
  250 +
  251 + /**
  252 + * 二特
  253 + */
  254 + @ApiModelProperty("二特")
  255 + private String materialConditionSecondClass;
  256 +
  257 + /**
  258 + * 镀锡紫
  259 + */
  260 + @ApiModelProperty("镀锡紫")
  261 + private String materialConditionTinCoated;
  262 +
  263 + /**
  264 + * 角料
  265 + */
  266 + @ApiModelProperty("角料")
  267 + private String materialConditionScrap;
  268 +
  269 + /**
  270 + * 镀白黄
  271 + */
  272 + @ApiModelProperty("镀白黄")
  273 + private String materialConditionWhiteYellow;
  274 +
  275 + /**
  276 + * 磷铜
  277 + */
  278 + @ApiModelProperty("磷铜")
  279 + private String materialConditionPhosphorCopper;
  280 +
  281 + /**
  282 + * 分厂ID
  283 + */
  284 + @ApiModelProperty("分厂ID")
  285 + private String workshopId;
  286 +
  287 + /**
  288 + * 流程状态
  289 + */
  290 + @ApiModelProperty("流程状态")
  291 + private String processStatus;
  292 +
  293 + /**
  294 + * 流程节点
  295 + */
  296 + @ApiModelProperty("流程节点")
  297 + private String processNode;
  298 +
  299 + /**
  300 + * 明细信息
  301 + */
  302 + @ApiModelProperty(value = "明细信息", required = true)
  303 + @Valid
  304 + @NotEmpty(message = "明细不能为空!")
  305 + private List<UpdateProcurementPlanChangeLineVo> lines;
  306 +
  307 + public void validate() {
  308 + }
  309 +}
... ...
  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.change.ProcurementPlanChangeLineMapper">
  4 +
  5 + <resultMap id="ProcurementPlanChangeLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChangeLine">
  6 + <id column="id" property="id"/>
  7 + <result column="procurement_plan_change_id" property="procurementPlanChangeId"/>
  8 + <result column="product_id" property="productId"/>
  9 + <result column="material_type" property="materialType"/>
  10 + <result column="quantity" property="quantity"/>
  11 + <result column="actual_purchase_price" property="actualPurchasePrice"/>
  12 + <result column="including_shipping_price" property="includingShippingPrice"/>
  13 + <result column="price_list_prices" property="priceListPrices"/>
  14 + <result column="coordination_range" property="coordinationRange"/>
  15 + <result column="estimated_loss" property="estimatedLoss"/>
  16 + <result column="application_attrition" property="applicationAttrition"/>
  17 + <result column="paint_damage_ratio" property="paintDamageRatio"/>
  18 + <result column="workshop_id" property="workshopId"/>
  19 + <result column="item_id" property="itemId"/>
  20 + <result column="create_by_id" property="createById"/>
  21 + <result column="create_by" property="createBy"/>
  22 + <result column="update_by_id" property="updateById"/>
  23 + <result column="update_by" property="updateBy"/>
  24 + <result column="create_time" property="createTime"/>
  25 + <result column="update_time" property="updateTime"/>
  26 + </resultMap>
  27 +
  28 + <sql id="ProcurementPlanChangeLine_sql">
  29 + SELECT
  30 + ppcl.id,
  31 + ppcl.procurement_plan_change_id,
  32 + ppcl.product_id,
  33 + ppcl.material_type,
  34 + ppcl.quantity,
  35 + ppcl.actual_purchase_price,
  36 + ppcl.including_shipping_price,
  37 + ppcl.price_list_prices,
  38 + ppcl.coordination_range,
  39 + ppcl.estimated_loss,
  40 + ppcl.application_attrition,
  41 + ppcl.paint_damage_ratio,
  42 + ppcl.workshop_id,
  43 + ppcl.item_id,
  44 + ppcl.create_by_id,
  45 + ppcl.create_by,
  46 + ppcl.update_by_id,
  47 + ppcl.update_by,
  48 + ppcl.create_time,
  49 + ppcl.update_time
  50 + FROM procurement_plan_change_line AS ppcl
  51 + </sql>
  52 +
  53 + <select id="getByChangeId" resultMap="ProcurementPlanChangeLine">
  54 + <include refid="ProcurementPlanChangeLine_sql"/>
  55 + WHERE ppcl.procurement_plan_change_id = #{changeId}
  56 + ORDER BY ppcl.create_time ASC
  57 + </select>
  58 +</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.change.ProcurementPlanChangeMapper">
  4 +
  5 + <resultMap id="ProcurementPlanChange" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange">
  6 + <id column="id" property="id"/>
  7 + <result column="procurement_plan_id" property="procurementPlanId"/>
  8 + <result column="change_reason" property="changeReason"/>
  9 + <result column="code" property="code"/>
  10 + <result column="company_short_id" property="companyShortId"/>
  11 + <result column="company_short_name" property="companyShortName"/>
  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="region" property="region"/>
  17 + <result column="region_name" property="regionName"/>
  18 + <result column="date" property="date"/>
  19 + <result column="validity_period" property="validityPeriod"/>
  20 + <result column="quoter_id" property="quoterId"/>
  21 + <result column="quoter_name" property="quoterName"/>
  22 + <result column="long_term_operation" property="longTermOperation"/>
  23 + <result column="terminal_customer" property="terminalCustomer"/>
  24 + <result column="priced" property="priced"/>
  25 + <result column="pricing_deadline" property="pricingDeadline"/>
  26 + <result column="temporary_price" property="temporaryPrice"/>
  27 + <result column="other_expense_settlement" property="otherExpenseSettlement"/>
  28 + <result column="delivery_mode" property="deliveryMode"/>
  29 + <result column="commodity_buyout" property="commodityBuyout"/>
  30 + <result column="quality_buyout" property="qualityBuyout"/>
  31 + <result column="quantity_buyout" property="quantityBuyout"/>
  32 + <result column="door_delivery" property="doorDelivery"/>
  33 + <result column="shipping_cost" property="shippingCost"/>
  34 + <result column="loading_fee" property="loadingFee"/>
  35 + <result column="invoice_product_name" property="invoiceProductName"/>
  36 + <result column="delivery_date" property="deliveryDate"/>
  37 + <result column="settlement_method" property="settlementMethod"/>
  38 + <result column="settlement_ratio" property="settlementRatio"/>
  39 + <result column="price_id" property="priceId"/>
  40 + <result column="price_code" property="priceCode"/>
  41 + <result column="coordination_reason" property="coordinationReason"/>
  42 + <result column="invoice_type_status" property="invoiceTypeStatus"/>
  43 + <result column="total_quantity" property="totalQuantity"/>
  44 + <result column="remark" property="remark"/>
  45 + <result column="material_condition_enabled" property="materialConditionEnabled"/>
  46 + <result column="material_condition_copper_rice" property="materialConditionCopperRice"/>
  47 + <result column="material_condition_bright_copper" property="materialConditionBrightCopper"/>
  48 + <result column="material_condition_first_class" property="materialConditionFirstClass"/>
  49 + <result column="material_condition_second_class" property="materialConditionSecondClass"/>
  50 + <result column="material_condition_tin_coated" property="materialConditionTinCoated"/>
  51 + <result column="material_condition_scrap" property="materialConditionScrap"/>
  52 + <result column="material_condition_white_yellow" property="materialConditionWhiteYellow"/>
  53 + <result column="material_condition_phosphor_copper" property="materialConditionPhosphorCopper"/>
  54 + <result column="approval_status" property="approvalStatus"/>
  55 + <result column="process_status" property="processStatus"/>
  56 + <result column="process_node" property="processNode"/>
  57 + <result column="workshop_id" property="workshopId"/>
  58 + <result column="create_by_id" property="createById"/>
  59 + <result column="create_by" property="createBy"/>
  60 + <result column="update_by_id" property="updateById"/>
  61 + <result column="update_by" property="updateBy"/>
  62 + <result column="create_time" property="createTime"/>
  63 + <result column="update_time" property="updateTime"/>
  64 + </resultMap>
  65 +
  66 + <sql id="ProcurementPlanChange_sql">
  67 + SELECT
  68 + ppc.id,
  69 + ppc.procurement_plan_id,
  70 + ppc.change_reason,
  71 + ppc.code,
  72 + ppc.company_short_id,
  73 + bdcs.short_name AS company_short_name,
  74 + ppc.supplier_id,
  75 + pdc.unit_name AS supplier_name,
  76 + ppc.purchase_department,
  77 + sd.name AS purchase_department_name,
  78 + ppc.region,
  79 + sd1.name AS region_name,
  80 + ppc.date,
  81 + ppc.validity_period,
  82 + ppc.quoter_id,
  83 + ppc.quoter_name,
  84 + ppc.long_term_operation,
  85 + ppc.terminal_customer,
  86 + ppc.priced,
  87 + ppc.pricing_deadline,
  88 + ppc.temporary_price,
  89 + ppc.other_expense_settlement,
  90 + ppc.delivery_mode,
  91 + ppc.commodity_buyout,
  92 + ppc.quality_buyout,
  93 + ppc.quantity_buyout,
  94 + ppc.door_delivery,
  95 + ppc.shipping_cost,
  96 + ppc.loading_fee,
  97 + ppc.invoice_product_name,
  98 + ppc.delivery_date,
  99 + ppc.settlement_method,
  100 + ppc.settlement_ratio,
  101 + ppc.price_id,
  102 + bdp.code AS price_code,
  103 + ppc.coordination_reason,
  104 + ppc.invoice_type_status,
  105 + ppc.total_quantity,
  106 + ppc.remark,
  107 + ppc.material_condition_enabled,
  108 + ppc.material_condition_copper_rice,
  109 + ppc.material_condition_bright_copper,
  110 + ppc.material_condition_first_class,
  111 + ppc.material_condition_second_class,
  112 + ppc.material_condition_tin_coated,
  113 + ppc.material_condition_scrap,
  114 + ppc.material_condition_white_yellow,
  115 + ppc.material_condition_phosphor_copper,
  116 + ppc.approval_status,
  117 + ppc.process_status,
  118 + ppc.process_node,
  119 + ppc.workshop_id,
  120 + ppc.create_by_id,
  121 + ppc.create_by,
  122 + ppc.update_by_id,
  123 + ppc.update_by,
  124 + ppc.create_time,
  125 + ppc.update_time
  126 + FROM procurement_plan_change AS ppc
  127 + LEFT JOIN base_data_company_short AS bdcs ON bdcs.id = ppc.company_short_id
  128 + LEFT JOIN procurement_domestic_customer_credit pdc ON pdc.id = ppc.supplier_id
  129 + LEFT JOIN sys_dept sd ON sd.id = ppc.purchase_department
  130 + LEFT JOIN sys_dept sd1 ON sd1.id = ppc.region
  131 + LEFT JOIN base_data_price bdp ON bdp.id = ppc.price_id
  132 + </sql>
  133 +
  134 + <select id="findById" resultMap="ProcurementPlanChange">
  135 + <include refid="ProcurementPlanChange_sql"/>
  136 + WHERE ppc.id = #{id}
  137 + </select>
  138 +
  139 + <select id="query" resultMap="ProcurementPlanChange">
  140 + <include refid="ProcurementPlanChange_sql"/>
  141 + <where>
  142 + <if test="vo.code != null and vo.code != ''">
  143 + AND ppc.code LIKE CONCAT('%', #{vo.code}, '%')
  144 + </if>
  145 + <if test="vo.companyShortId != null and vo.companyShortId != ''">
  146 + AND ppc.company_short_id = #{vo.companyShortId}
  147 + </if>
  148 + <if test="vo.supplierId != null and vo.supplierId != ''">
  149 + AND ppc.supplier_id = #{vo.supplierId}
  150 + </if>
  151 + <if test="vo.purchaseDepartment != null and vo.purchaseDepartment != ''">
  152 + AND ppc.purchase_department = #{vo.purchaseDepartment}
  153 + </if>
  154 + <if test="vo.region != null and vo.region != ''">
  155 + AND ppc.region = #{vo.region}
  156 + </if>
  157 + <if test="vo.workshopId != null and vo.workshopId != ''">
  158 + AND ppc.workshop_id = #{vo.workshopId}
  159 + </if>
  160 + <if test="vo.startDate != null">
  161 + AND ppc.date &gt;= #{vo.startDate}
  162 + </if>
  163 + <if test="vo.endDate != null">
  164 + AND ppc.date &lt;= #{vo.endDate}
  165 + </if>
  166 + <if test="vo.keyword != null and vo.keyword != ''">
  167 + AND (
  168 + ppc.code LIKE CONCAT('%', #{vo.keyword}, '%')
  169 + OR ppc.change_reason LIKE CONCAT('%', #{vo.keyword}, '%')
  170 + )
  171 + </if>
  172 + </where>
  173 + ORDER BY ppc.create_time DESC
  174 + </select>
  175 +</mapper>
... ...