Showing
27 changed files
with
3012 additions
and
1 deletions
| ... | ... | @@ -1697,7 +1697,7 @@ CREATE TABLE `procurement_salesman_quotation` |
| 1697 | 1697 | `quoter_name` varchar(64) NOT NULL COMMENT '报价人', |
| 1698 | 1698 | `long_term_operation` bool NOT NULL COMMENT '是否长单操作', |
| 1699 | 1699 | `terminal_customer` bool NOT NULL COMMENT '是否终端客户', |
| 1700 | - `priced` bool NOT NULL COMMENT '是否为点价', | |
| 1700 | + `priced` bool NOT NULL COMMENT '是否未点价', | |
| 1701 | 1701 | `pricing_deadline` date DEFAULT NULL COMMENT '点价截止日期', |
| 1702 | 1702 | `temporary_price` bool DEFAULT NULL COMMENT '是否暂定价', |
| 1703 | 1703 | `other_expense_settlement` bool NOT NULL COMMENT '其他费用凭票到厂另行结算', |
| ... | ... | @@ -1727,6 +1727,7 @@ CREATE TABLE `procurement_salesman_quotation` |
| 1727 | 1727 | `approval_status` varchar(50) DEFAULT NULL COMMENT '审核状态', |
| 1728 | 1728 | `status` varchar(50) DEFAULT NULL COMMENT '状态', |
| 1729 | 1729 | `reason` varchar(500) DEFAULT NULL COMMENT '终止原因', |
| 1730 | + `generated_plan` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否生成过采购计划 0否 1是', | |
| 1730 | 1731 | `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', |
| 1731 | 1732 | `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', |
| 1732 | 1733 | `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', |
| ... | ... | @@ -1876,3 +1877,94 @@ create table if not exists base_data_company_short |
| 1876 | 1877 | update_time datetime default now() comment '更新时间', |
| 1877 | 1878 | unique key uk_bd_company_short_company_name (company_name) |
| 1878 | 1879 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='公司简称'; |
| 1880 | + | |
| 1881 | +CREATE TABLE `procurement_plan` | |
| 1882 | +( | |
| 1883 | + `id` varchar(32) NOT NULL COMMENT 'ID', | |
| 1884 | + `parent_id` varchar(32) DEFAULT NULL COMMENT '父ID,拆分使用', | |
| 1885 | + `code` varchar(20) NOT NULL COMMENT '编号', | |
| 1886 | + `company_short_id` varchar(32) DEFAULT NULL COMMENT '公司简称ID', | |
| 1887 | + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID', | |
| 1888 | + `purchase_department` varchar(32) NOT NULL COMMENT '采购处', | |
| 1889 | + `region` varchar(32) NOT NULL COMMENT '区域', | |
| 1890 | + `date` date NOT NULL COMMENT '日期', | |
| 1891 | + `validity_period` varchar(200) NOT NULL COMMENT '报价时效', | |
| 1892 | + `quoter_id` varchar(32) NOT NULL COMMENT '报价人ID', | |
| 1893 | + `quoter_name` varchar(64) NOT NULL COMMENT '报价人', | |
| 1894 | + `long_term_operation` bool NOT NULL COMMENT '是否长单操作', | |
| 1895 | + `terminal_customer` bool NOT NULL COMMENT '是否终端客户', | |
| 1896 | + `priced` bool NOT NULL COMMENT '是否未点价', | |
| 1897 | + `pricing_deadline` date DEFAULT NULL COMMENT '点价截止日期', | |
| 1898 | + `temporary_price` bool DEFAULT NULL COMMENT '是否暂定价', | |
| 1899 | + `other_expense_settlement` bool NOT NULL COMMENT '其他费用凭票到厂另行结算', | |
| 1900 | + `delivery_mode` varchar(50) NOT NULL COMMENT '交提货方式', | |
| 1901 | + `commodity_buyout` bool NOT NULL COMMENT '是否通货买断', | |
| 1902 | + `quality_buyout` bool NOT NULL COMMENT '是否质量买断', | |
| 1903 | + `quantity_buyout` bool NOT NULL COMMENT '是否数量买断', | |
| 1904 | + `door_delivery` bool NOT NULL COMMENT '是否送货上门', | |
| 1905 | + `shipping_cost` decimal(18, 5) DEFAULT NULL COMMENT '另付运费', | |
| 1906 | + `loading_fee` decimal(18, 5) DEFAULT NULL COMMENT '装车费', | |
| 1907 | + `invoice_product_name` varchar(200) NOT NULL COMMENT '开票品名', | |
| 1908 | + `delivery_date` date NOT NULL COMMENT '交货日期', | |
| 1909 | + `settlement_method` varchar(200) NOT NULL COMMENT '结算方式', | |
| 1910 | + `settlement_ratio` decimal(10, 5) NOT NULL COMMENT '结算比例(%)', | |
| 1911 | + `price_id` varchar(32) NOT NULL COMMENT '价格表ID', | |
| 1912 | + `coordination_reason` varchar(200) NOT NULL COMMENT '协调事由', | |
| 1913 | + `invoice_type_status` varchar(50) NOT NULL COMMENT '票类状况', | |
| 1914 | + `total_quantity` decimal(18, 5) NOT NULL COMMENT '数量合计', | |
| 1915 | + `remark` varchar(1000) DEFAULT NULL COMMENT '备注', | |
| 1916 | + `material_condition_enabled` bool NOT NULL COMMENT '是否启用料质状况', | |
| 1917 | + `material_condition_copper_rice` varchar(500) DEFAULT NULL COMMENT '铜米', | |
| 1918 | + `material_condition_bright_copper` varchar(500) DEFAULT NULL COMMENT '光亮铜', | |
| 1919 | + `material_condition_first_class` varchar(500) DEFAULT NULL COMMENT '一特', | |
| 1920 | + `material_condition_second_class` varchar(500) DEFAULT NULL COMMENT '二特', | |
| 1921 | + `material_condition_tin_coated` varchar(500) DEFAULT NULL COMMENT '镀锡紫', | |
| 1922 | + `material_condition_scrap` varchar(500) DEFAULT NULL COMMENT '角料', | |
| 1923 | + `material_condition_white_yellow` varchar(500) DEFAULT NULL COMMENT '镀白黄', | |
| 1924 | + `material_condition_phosphor_copper` varchar(500) DEFAULT NULL COMMENT '磷铜', | |
| 1925 | + `approval_status` varchar(50) DEFAULT NULL COMMENT '审核状态', | |
| 1926 | + `process_status` varchar(50) DEFAULT NULL COMMENT '流程状态', | |
| 1927 | + `process_node` varchar(50) DEFAULT NULL COMMENT '流程节点', | |
| 1928 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | |
| 1929 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | |
| 1930 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | |
| 1931 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | |
| 1932 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 1933 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 1934 | + PRIMARY KEY (`id`), | |
| 1935 | + UNIQUE KEY `uk_pp_code` (`code`), | |
| 1936 | + KEY `idx_pp_company_short_id` (`company_short_id`), | |
| 1937 | + KEY `idx_pp_supplier_id` (`supplier_id`), | |
| 1938 | + KEY `idx_pp_date` (`date`), | |
| 1939 | + KEY `idx_pp_quoter_id` (`quoter_id`), | |
| 1940 | + KEY `idx_pp_create_time` (`create_time`), | |
| 1941 | + KEY `idx_pp_process_status` (`process_status`), | |
| 1942 | + KEY `idx_pp_process_node` (`process_node`) | |
| 1943 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='采购计划主表'; | |
| 1944 | + | |
| 1945 | +CREATE TABLE `procurement_plan_line` | |
| 1946 | +( | |
| 1947 | + `id` varchar(32) NOT NULL COMMENT 'ID', | |
| 1948 | + `procurement_plan_id` varchar(32) NOT NULL COMMENT '采购计划ID', | |
| 1949 | + `product_id` varchar(32) NOT NULL COMMENT '品种ID', | |
| 1950 | + `material_type` varchar(200) DEFAULT NULL COMMENT '料型', | |
| 1951 | + `quantity` decimal(18, 5) NOT NULL COMMENT '数量', | |
| 1952 | + `actual_purchase_price` decimal(18, 10) DEFAULT NULL COMMENT '实际采购价', | |
| 1953 | + `including_shipping_price` decimal(18, 10) DEFAULT NULL COMMENT '含运到厂价', | |
| 1954 | + `price_list_prices` decimal(18, 10) DEFAULT NULL COMMENT '价格表价格', | |
| 1955 | + `coordination_range` decimal(18, 10) DEFAULT NULL COMMENT '协调幅度', | |
| 1956 | + `estimated_loss` decimal(18, 10) DEFAULT NULL COMMENT '买断料预计损耗', | |
| 1957 | + `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗(%)', | |
| 1958 | + `workshop_id` varchar(50) DEFAULT NULL COMMENT '分厂', | |
| 1959 | + `item_id` varchar(32) NOT NULL COMMENT '前端行标识', | |
| 1960 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | |
| 1961 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | |
| 1962 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | |
| 1963 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | |
| 1964 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 1965 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 1966 | + PRIMARY KEY (`id`), | |
| 1967 | + KEY `idx_ppl_procurement_plan_id` (`procurement_plan_id`), | |
| 1968 | + KEY `idx_ppl_product_id` (`product_id`), | |
| 1969 | + KEY `idx_ppl_create_time` (`create_time`) | |
| 1970 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='采购计划明细表'; | ... | ... |
| ... | ... | @@ -146,6 +146,32 @@ public class PriceServiceImpl extends BaseMpServiceImpl<PriceMapper, Price> impl |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | + * 查询最新的一条价格表数据(包含子表信息) | |
| 150 | + */ | |
| 151 | + @Override | |
| 152 | + public Price findLatest() { | |
| 153 | + // 1. 查询全表中最新的一条主表数据(按创建时间倒序,取第一条) | |
| 154 | + Price data = getBaseMapper().selectOne( | |
| 155 | + Wrappers.lambdaQuery(Price.class) | |
| 156 | + .orderByDesc(Price::getCreateTime) // 如果表里没有 createTime,可以换成 Price::getId | |
| 157 | + .last("LIMIT 1") | |
| 158 | + ); | |
| 159 | + | |
| 160 | + // 2. 如果主表没有数据,直接返回 null,避免后续空指针异常 | |
| 161 | + if (data == null) { | |
| 162 | + return null; | |
| 163 | + } | |
| 164 | + | |
| 165 | + // 3. 根据最新的主表 ID,查询关联的子表数据 | |
| 166 | + QueryPriceSubTableVo vo = new QueryPriceSubTableVo(); | |
| 167 | + vo.setPriceId(data.getId()); | |
| 168 | + List<PriceSubTable> query = priceSubTableService.query(vo); | |
| 169 | + data.setPriceSubTableList(query); | |
| 170 | + | |
| 171 | + return data; | |
| 172 | + } | |
| 173 | + | |
| 174 | + /** | |
| 149 | 175 | * 校验编码唯一性 |
| 150 | 176 | * |
| 151 | 177 | * @param code 编码 | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/procurement/GetProcurementPlanBo.java
0 → 100644
| 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.starter.web.core.utils.ApplicationUtil; | |
| 8 | +import com.lframework.xingyun.basedata.entity.CompanyShort; | |
| 9 | +import com.lframework.xingyun.basedata.entity.Supplier; | |
| 10 | +import com.lframework.xingyun.basedata.service.company.CompanyShortService; | |
| 11 | +import com.lframework.xingyun.basedata.service.supplier.SupplierService; | |
| 12 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | |
| 13 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | |
| 14 | +import io.swagger.annotations.ApiModelProperty; | |
| 15 | +import java.math.BigDecimal; | |
| 16 | +import java.time.LocalDate; | |
| 17 | +import java.time.LocalDateTime; | |
| 18 | +import java.util.List; | |
| 19 | +import java.util.stream.Collectors; | |
| 20 | +import lombok.Data; | |
| 21 | + | |
| 22 | +@Data | |
| 23 | +public class GetProcurementPlanBo extends BaseBo<ProcurementPlan> { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * ID | |
| 27 | + */ | |
| 28 | + @ApiModelProperty("ID") | |
| 29 | + private String id; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 父ID,拆分使用 | |
| 33 | + */ | |
| 34 | + @ApiModelProperty("父ID,拆分使用") | |
| 35 | + private String parentId; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 编号 | |
| 39 | + */ | |
| 40 | + @ApiModelProperty("编号") | |
| 41 | + private String code; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 公司简称ID | |
| 45 | + */ | |
| 46 | + @ApiModelProperty("公司简称ID") | |
| 47 | + private String companyShortId; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 公司简称名称 | |
| 51 | + */ | |
| 52 | + @ApiModelProperty("公司简称名称") | |
| 53 | + private String companyShortName; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 公司全称 | |
| 57 | + */ | |
| 58 | + @ApiModelProperty("公司全称") | |
| 59 | + private String companyFullName; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 供应商ID | |
| 63 | + */ | |
| 64 | + @ApiModelProperty("供应商ID") | |
| 65 | + private String supplierId; | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 供应商名称 | |
| 69 | + */ | |
| 70 | + @ApiModelProperty("供应商名称") | |
| 71 | + private String supplierName; | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 采购处 | |
| 75 | + */ | |
| 76 | + @ApiModelProperty("采购处") | |
| 77 | + private String purchaseDepartment; | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 采购处 | |
| 81 | + */ | |
| 82 | + @ApiModelProperty("采购处") | |
| 83 | + private String purchaseDepartmentName; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 区域 | |
| 87 | + */ | |
| 88 | + @ApiModelProperty("区域") | |
| 89 | + private String region; | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 区域 | |
| 93 | + */ | |
| 94 | + @ApiModelProperty("区域") | |
| 95 | + private String regionName; | |
| 96 | + | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 日期 | |
| 100 | + */ | |
| 101 | + @ApiModelProperty("日期") | |
| 102 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | |
| 103 | + private LocalDate date; | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * 报价时效 | |
| 107 | + */ | |
| 108 | + @ApiModelProperty("报价时效") | |
| 109 | + private String validityPeriod; | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * 报价人ID | |
| 113 | + */ | |
| 114 | + @ApiModelProperty("报价人ID") | |
| 115 | + private String quoterId; | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * 报价人 | |
| 119 | + */ | |
| 120 | + @ApiModelProperty("报价人") | |
| 121 | + private String quoterName; | |
| 122 | + | |
| 123 | + /** | |
| 124 | + * 是否长单操作 | |
| 125 | + */ | |
| 126 | + @ApiModelProperty("是否长单操作") | |
| 127 | + private Boolean longTermOperation; | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * 是否终端客户 | |
| 131 | + */ | |
| 132 | + @ApiModelProperty("是否终端客户") | |
| 133 | + private Boolean terminalCustomer; | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * 是否未点价 | |
| 137 | + */ | |
| 138 | + @ApiModelProperty("是否未点价") | |
| 139 | + private Boolean priced; | |
| 140 | + | |
| 141 | + /** | |
| 142 | + * 点价截止日期 | |
| 143 | + */ | |
| 144 | + @ApiModelProperty("点价截止日期") | |
| 145 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | |
| 146 | + private LocalDate pricingDeadline; | |
| 147 | + | |
| 148 | + /** | |
| 149 | + * 是否暂定价 | |
| 150 | + */ | |
| 151 | + @ApiModelProperty("是否暂定价") | |
| 152 | + private Boolean temporaryPrice; | |
| 153 | + | |
| 154 | + /** | |
| 155 | + * 其他费用凭票到厂另行结算 | |
| 156 | + */ | |
| 157 | + @ApiModelProperty("其他费用凭票到厂另行结算") | |
| 158 | + private Boolean otherExpenseSettlement; | |
| 159 | + | |
| 160 | + /** | |
| 161 | + * 交提货方式 | |
| 162 | + */ | |
| 163 | + @ApiModelProperty("交提货方式") | |
| 164 | + private String deliveryMode; | |
| 165 | + | |
| 166 | + /** | |
| 167 | + * 是否通货买断 | |
| 168 | + */ | |
| 169 | + @ApiModelProperty("是否通货买断") | |
| 170 | + private Boolean commodityBuyout; | |
| 171 | + | |
| 172 | + /** | |
| 173 | + * 是否质量买断 | |
| 174 | + */ | |
| 175 | + @ApiModelProperty("是否质量买断") | |
| 176 | + private Boolean qualityBuyout; | |
| 177 | + | |
| 178 | + /** | |
| 179 | + * 是否数量买断 | |
| 180 | + */ | |
| 181 | + @ApiModelProperty("是否数量买断") | |
| 182 | + private Boolean quantityBuyout; | |
| 183 | + | |
| 184 | + /** | |
| 185 | + * 是否送货上门 | |
| 186 | + */ | |
| 187 | + @ApiModelProperty("是否送货上门") | |
| 188 | + private Boolean doorDelivery; | |
| 189 | + | |
| 190 | + /** | |
| 191 | + * 另付运费 | |
| 192 | + */ | |
| 193 | + @ApiModelProperty("另付运费") | |
| 194 | + private BigDecimal shippingCost; | |
| 195 | + | |
| 196 | + /** | |
| 197 | + * 装车费 | |
| 198 | + */ | |
| 199 | + @ApiModelProperty("装车费") | |
| 200 | + private BigDecimal loadingFee; | |
| 201 | + | |
| 202 | + /** | |
| 203 | + * 开票品名 | |
| 204 | + */ | |
| 205 | + @ApiModelProperty("开票品名") | |
| 206 | + private String invoiceProductName; | |
| 207 | + | |
| 208 | + /** | |
| 209 | + * 交货日期 | |
| 210 | + */ | |
| 211 | + @ApiModelProperty("交货日期") | |
| 212 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | |
| 213 | + private LocalDate deliveryDate; | |
| 214 | + | |
| 215 | + /** | |
| 216 | + * 结算方式 | |
| 217 | + */ | |
| 218 | + @ApiModelProperty("结算方式") | |
| 219 | + private String settlementMethod; | |
| 220 | + | |
| 221 | + /** | |
| 222 | + * 结算比例(%) | |
| 223 | + */ | |
| 224 | + @ApiModelProperty("结算比例(%)") | |
| 225 | + private BigDecimal settlementRatio; | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * 价格表ID | |
| 229 | + */ | |
| 230 | + @ApiModelProperty("价格表ID") | |
| 231 | + private String priceId; | |
| 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 createById; | |
| 334 | + | |
| 335 | + /** | |
| 336 | + * 创建人 | |
| 337 | + */ | |
| 338 | + @ApiModelProperty("创建人") | |
| 339 | + private String createBy; | |
| 340 | + | |
| 341 | + /** | |
| 342 | + * 更新人ID | |
| 343 | + */ | |
| 344 | + @ApiModelProperty("更新人ID") | |
| 345 | + private String updateById; | |
| 346 | + | |
| 347 | + /** | |
| 348 | + * 更新人 | |
| 349 | + */ | |
| 350 | + @ApiModelProperty("更新人") | |
| 351 | + private String updateBy; | |
| 352 | + | |
| 353 | + /** | |
| 354 | + * 创建时间 | |
| 355 | + */ | |
| 356 | + @ApiModelProperty("创建时间") | |
| 357 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 358 | + private LocalDateTime createTime; | |
| 359 | + | |
| 360 | + /** | |
| 361 | + * 更新时间 | |
| 362 | + */ | |
| 363 | + @ApiModelProperty("更新时间") | |
| 364 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 365 | + private LocalDateTime updateTime; | |
| 366 | + | |
| 367 | + /** | |
| 368 | + * 明细信息 | |
| 369 | + */ | |
| 370 | + @ApiModelProperty("明细信息") | |
| 371 | + private List<ProcurementPlanLineBo> procurementPlanLineList; | |
| 372 | + | |
| 373 | + public GetProcurementPlanBo() { | |
| 374 | + } | |
| 375 | + | |
| 376 | + public GetProcurementPlanBo(ProcurementPlan dto, List<ProcurementPlanLine> procurementPlanLineList) { | |
| 377 | + super(dto); | |
| 378 | + if (!CollectionUtil.isEmpty(procurementPlanLineList)) { | |
| 379 | + this.procurementPlanLineList = procurementPlanLineList.stream().map(ProcurementPlanLineBo::new).collect(Collectors.toList()); | |
| 380 | + } | |
| 381 | + } | |
| 382 | + | |
| 383 | + public GetProcurementPlanBo(ProcurementPlan procurementPlan) { | |
| 384 | + super(procurementPlan); | |
| 385 | + } | |
| 386 | + | |
| 387 | + | |
| 388 | + @Override | |
| 389 | + public BaseBo<ProcurementPlan> convert(ProcurementPlan dto) { | |
| 390 | + return super.convert(dto); | |
| 391 | + } | |
| 392 | + | |
| 393 | + @Override | |
| 394 | + protected void afterInit(ProcurementPlan dto) { | |
| 395 | + | |
| 396 | + } | |
| 397 | + | |
| 398 | + @Data | |
| 399 | + public static class ProcurementPlanLineBo extends BaseBo<ProcurementPlanLine> { | |
| 400 | + | |
| 401 | + /** | |
| 402 | + * ID | |
| 403 | + */ | |
| 404 | + @ApiModelProperty("ID") | |
| 405 | + private String id; | |
| 406 | + | |
| 407 | + /** | |
| 408 | + * 采购计划ID | |
| 409 | + */ | |
| 410 | + @ApiModelProperty("采购计划ID") | |
| 411 | + private String procurementPlanId; | |
| 412 | + | |
| 413 | + /** | |
| 414 | + * 品种ID | |
| 415 | + */ | |
| 416 | + @ApiModelProperty("品种ID") | |
| 417 | + private String productId; | |
| 418 | + | |
| 419 | + /** | |
| 420 | + * 料型 | |
| 421 | + */ | |
| 422 | + @ApiModelProperty("料型") | |
| 423 | + private String materialType; | |
| 424 | + | |
| 425 | + /** | |
| 426 | + * 数量 | |
| 427 | + */ | |
| 428 | + @ApiModelProperty("数量") | |
| 429 | + private BigDecimal quantity; | |
| 430 | + | |
| 431 | + /** | |
| 432 | + * 实际采购价 | |
| 433 | + */ | |
| 434 | + @ApiModelProperty("实际采购价") | |
| 435 | + private BigDecimal actualPurchasePrice; | |
| 436 | + | |
| 437 | + /** | |
| 438 | + * 含运到厂价 | |
| 439 | + */ | |
| 440 | + @ApiModelProperty("含运到厂价") | |
| 441 | + private BigDecimal includingShippingPrice; | |
| 442 | + | |
| 443 | + /** | |
| 444 | + * 价格表价格 | |
| 445 | + */ | |
| 446 | + @ApiModelProperty("价格表价格") | |
| 447 | + private BigDecimal priceListPrices; | |
| 448 | + | |
| 449 | + /** | |
| 450 | + * 协调幅度 | |
| 451 | + */ | |
| 452 | + @ApiModelProperty("协调幅度") | |
| 453 | + private BigDecimal coordinationRange; | |
| 454 | + | |
| 455 | + /** | |
| 456 | + * 买断料预计损耗 | |
| 457 | + */ | |
| 458 | + @ApiModelProperty("买断料预计损耗") | |
| 459 | + private BigDecimal estimatedLoss; | |
| 460 | + | |
| 461 | + /** | |
| 462 | + * 申请损耗(%) | |
| 463 | + */ | |
| 464 | + @ApiModelProperty("申请损耗(%)") | |
| 465 | + private BigDecimal applicationAttrition; | |
| 466 | + | |
| 467 | + /** | |
| 468 | + * 分厂 | |
| 469 | + */ | |
| 470 | + @ApiModelProperty("分厂") | |
| 471 | + private String workshopId; | |
| 472 | + | |
| 473 | + /** | |
| 474 | + * 前端行标识 | |
| 475 | + */ | |
| 476 | + @ApiModelProperty("前端行标识") | |
| 477 | + private String itemId; | |
| 478 | + | |
| 479 | + /** | |
| 480 | + * 创建人ID | |
| 481 | + */ | |
| 482 | + @ApiModelProperty("创建人ID") | |
| 483 | + private String createById; | |
| 484 | + | |
| 485 | + /** | |
| 486 | + * 创建人 | |
| 487 | + */ | |
| 488 | + @ApiModelProperty("创建人") | |
| 489 | + private String createBy; | |
| 490 | + | |
| 491 | + /** | |
| 492 | + * 更新人ID | |
| 493 | + */ | |
| 494 | + @ApiModelProperty("更新人ID") | |
| 495 | + private String updateById; | |
| 496 | + | |
| 497 | + /** | |
| 498 | + * 更新人 | |
| 499 | + */ | |
| 500 | + @ApiModelProperty("更新人") | |
| 501 | + private String updateBy; | |
| 502 | + | |
| 503 | + /** | |
| 504 | + * 创建时间 | |
| 505 | + */ | |
| 506 | + @ApiModelProperty("创建时间") | |
| 507 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 508 | + private LocalDateTime createTime; | |
| 509 | + | |
| 510 | + /** | |
| 511 | + * 更新时间 | |
| 512 | + */ | |
| 513 | + @ApiModelProperty("更新时间") | |
| 514 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 515 | + private LocalDateTime updateTime; | |
| 516 | + | |
| 517 | + public ProcurementPlanLineBo(ProcurementPlanLine dto) { | |
| 518 | + super(dto); | |
| 519 | + } | |
| 520 | + | |
| 521 | + @Override | |
| 522 | + public BaseBo<ProcurementPlanLine> convert(ProcurementPlanLine dto) { | |
| 523 | + return super.convert(dto); | |
| 524 | + } | |
| 525 | + } | |
| 526 | +} | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/procurement/QueryProcurementPlanBo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.bo.procurement; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.bo.BaseBo; | |
| 4 | +import com.lframework.starter.web.core.utils.ApplicationUtil; | |
| 5 | +import com.lframework.xingyun.basedata.entity.CompanyShort; | |
| 6 | +import com.lframework.xingyun.basedata.entity.Supplier; | |
| 7 | +import com.lframework.xingyun.basedata.service.company.CompanyShortService; | |
| 8 | +import com.lframework.xingyun.basedata.service.supplier.SupplierService; | |
| 9 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | |
| 10 | +import io.swagger.annotations.ApiModelProperty; | |
| 11 | +import java.math.BigDecimal; | |
| 12 | +import lombok.Data; | |
| 13 | + | |
| 14 | +@Data | |
| 15 | +public class QueryProcurementPlanBo extends BaseBo<ProcurementPlan> { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * ID | |
| 19 | + */ | |
| 20 | + @ApiModelProperty("ID") | |
| 21 | + private String id; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 编号 | |
| 25 | + */ | |
| 26 | + @ApiModelProperty("编号") | |
| 27 | + private String code; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 公司简称ID | |
| 31 | + */ | |
| 32 | + @ApiModelProperty("公司简称ID") | |
| 33 | + private String companyShortId; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 公司简称名称 | |
| 37 | + */ | |
| 38 | + @ApiModelProperty("公司简称名称") | |
| 39 | + private String companyShortName; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 公司全称 | |
| 43 | + */ | |
| 44 | + @ApiModelProperty("公司全称") | |
| 45 | + private String companyFullName; | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 供应商ID | |
| 49 | + */ | |
| 50 | + @ApiModelProperty("供应商ID") | |
| 51 | + private String supplierId; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 供应商名称 | |
| 55 | + */ | |
| 56 | + @ApiModelProperty("供应商名称") | |
| 57 | + private String supplierName; | |
| 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 String processStatus; | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 流程节点 | |
| 79 | + */ | |
| 80 | + @ApiModelProperty("流程节点") | |
| 81 | + private String processNode; | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 数量合计 | |
| 85 | + */ | |
| 86 | + @ApiModelProperty("数量合计") | |
| 87 | + private BigDecimal totalQuantity; | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * 创建人 | |
| 91 | + */ | |
| 92 | + @ApiModelProperty("创建人") | |
| 93 | + private String createBy; | |
| 94 | + | |
| 95 | + public QueryProcurementPlanBo(ProcurementPlan dto) { | |
| 96 | + super(dto); | |
| 97 | + } | |
| 98 | + | |
| 99 | + @Override | |
| 100 | + public BaseBo<ProcurementPlan> convert(ProcurementPlan dto) { | |
| 101 | + return super.convert(dto); | |
| 102 | + } | |
| 103 | + | |
| 104 | + @Override | |
| 105 | + protected void afterInit(ProcurementPlan dto) { | |
| 106 | + CompanyShortService companyShortService = ApplicationUtil.getBean(CompanyShortService.class); | |
| 107 | + CompanyShort companyShort = companyShortService.findById(dto.getCompanyShortId()); | |
| 108 | + if (companyShort != null) { | |
| 109 | + this.companyShortName = companyShort.getShortName(); | |
| 110 | + this.companyFullName = companyShort.getCompanyName(); | |
| 111 | + } | |
| 112 | + | |
| 113 | + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); | |
| 114 | + Supplier supplier = supplierService.findById(dto.getSupplierId()); | |
| 115 | + if (supplier != null) { | |
| 116 | + this.supplierName = supplier.getName(); | |
| 117 | + } | |
| 118 | + } | |
| 119 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.sc.procurement.controller.plan; | |
| 2 | + | |
| 3 | +import com.lframework.starter.common.utils.CollectionUtil; | |
| 4 | +import com.lframework.starter.web.core.annotations.security.HasPermission; | |
| 5 | +import com.lframework.starter.web.core.controller.DefaultBaseController; | |
| 6 | +import com.lframework.starter.web.core.components.resp.InvokeResult; | |
| 7 | +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | |
| 8 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 9 | +import com.lframework.starter.web.core.utils.PageResultUtil; | |
| 10 | +import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanBo; | |
| 11 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | |
| 12 | +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; | |
| 13 | +import com.lframework.xingyun.sc.procurement.vo.plan.CreateProcurementPlanVo; | |
| 14 | +import com.lframework.xingyun.sc.procurement.vo.plan.QueryProcurementPlanVo; | |
| 15 | +import com.lframework.xingyun.sc.procurement.vo.plan.UpdateProcurementPlanVo; | |
| 16 | +import io.swagger.annotations.Api; | |
| 17 | +import io.swagger.annotations.ApiImplicitParam; | |
| 18 | +import io.swagger.annotations.ApiOperation; | |
| 19 | +import java.util.List; | |
| 20 | +import java.util.stream.Collectors; | |
| 21 | +import javax.validation.Valid; | |
| 22 | +import javax.validation.constraints.NotBlank; | |
| 23 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 24 | +import org.springframework.validation.annotation.Validated; | |
| 25 | +import org.springframework.web.bind.annotation.DeleteMapping; | |
| 26 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 27 | +import org.springframework.web.bind.annotation.PostMapping; | |
| 28 | +import org.springframework.web.bind.annotation.PutMapping; | |
| 29 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 30 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 31 | +import org.springframework.web.bind.annotation.RestController; | |
| 32 | + | |
| 33 | +@Api(tags = "采购计划管理") | |
| 34 | +@Validated | |
| 35 | +@RestController | |
| 36 | +@RequestMapping("/procurement/plan") | |
| 37 | +public class ProcurementPlanController extends DefaultBaseController { | |
| 38 | + | |
| 39 | + @Autowired | |
| 40 | + private ProcurementPlanService procurementPlanService; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 查询列表 | |
| 44 | + */ | |
| 45 | + @ApiOperation("查询列表") | |
| 46 | + @HasPermission({"procurement:plan:query"}) | |
| 47 | + @GetMapping("/query") | |
| 48 | + public InvokeResult<PageResult<GetProcurementPlanBo>> query(@Valid QueryProcurementPlanVo vo) { | |
| 49 | + | |
| 50 | + PageResult<ProcurementPlan> pageResult = procurementPlanService.query(getPageIndex(vo), | |
| 51 | + getPageSize(vo), vo); | |
| 52 | + | |
| 53 | + List<ProcurementPlan> datas = pageResult.getDatas(); | |
| 54 | + List<GetProcurementPlanBo> results = null; | |
| 55 | + if (!CollectionUtil.isEmpty(datas)) { | |
| 56 | + results = datas.stream() | |
| 57 | + .map(GetProcurementPlanBo::new) | |
| 58 | + .collect(Collectors.toList()); | |
| 59 | + } | |
| 60 | + | |
| 61 | + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); | |
| 62 | + } | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 根据ID查询 | |
| 66 | + */ | |
| 67 | + @ApiOperation("根据ID查询") | |
| 68 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) | |
| 69 | + @HasPermission({"procurement:plan:query"}) | |
| 70 | + @GetMapping | |
| 71 | + public InvokeResult<GetProcurementPlanBo> findById( | |
| 72 | + @NotBlank(message = "ID不能为空!") String id) { | |
| 73 | + | |
| 74 | + GetProcurementPlanBo result = procurementPlanService.getDetail(id); | |
| 75 | + | |
| 76 | + return InvokeResultBuilder.success(result); | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 创建 | |
| 81 | + */ | |
| 82 | + @ApiOperation("创建") | |
| 83 | + @HasPermission({"procurement:plan:add"}) | |
| 84 | + @PostMapping | |
| 85 | + public InvokeResult<String> create(@RequestBody @Valid CreateProcurementPlanVo vo) { | |
| 86 | + | |
| 87 | + vo.validate(); | |
| 88 | + | |
| 89 | + String id = procurementPlanService.create(vo); | |
| 90 | + | |
| 91 | + return InvokeResultBuilder.success(id); | |
| 92 | + } | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * 修改 | |
| 96 | + */ | |
| 97 | + @ApiOperation("修改") | |
| 98 | + @HasPermission({"procurement:plan:modify"}) | |
| 99 | + @PutMapping | |
| 100 | + public InvokeResult<Void> update(@RequestBody @Valid UpdateProcurementPlanVo vo) { | |
| 101 | + | |
| 102 | + vo.validate(); | |
| 103 | + | |
| 104 | + procurementPlanService.update(vo); | |
| 105 | + | |
| 106 | + return InvokeResultBuilder.success(); | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * 删除 | |
| 111 | + */ | |
| 112 | + @ApiOperation("删除") | |
| 113 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) | |
| 114 | + @HasPermission({"procurement:plan:delete"}) | |
| 115 | + @DeleteMapping | |
| 116 | + public InvokeResult<Void> deleteById(@NotBlank(message = "ID不能为空!") String id) { | |
| 117 | + | |
| 118 | + procurementPlanService.deleteById(id); | |
| 119 | + | |
| 120 | + return InvokeResultBuilder.success(); | |
| 121 | + } | |
| 122 | +} | ... | ... |
| ... | ... | @@ -166,4 +166,15 @@ public class SalesmanQuotationController extends DefaultBaseController { |
| 166 | 166 | return InvokeResultBuilder.success( |
| 167 | 167 | salesmanQuotationLineService.statCurrentDayDealClosedByProduct(today)); |
| 168 | 168 | } |
| 169 | + | |
| 170 | + /** | |
| 171 | + * 生成计划 | |
| 172 | + */ | |
| 173 | + @ApiOperation("生成计划") | |
| 174 | + @HasPermission({"procure-manage:sales-price:create"}) | |
| 175 | + @PostMapping("/createPlan") | |
| 176 | + public InvokeResult<Void> createPlan(@Valid String id) { | |
| 177 | + salesmanQuotationService.createPlan(id); | |
| 178 | + return InvokeResultBuilder.success(); | |
| 179 | + } | |
| 169 | 180 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/procurement/entity/ProcurementPlan.java
0 → 100644
| 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") | |
| 15 | +public class ProcurementPlan 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 parentId; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 编号 | |
| 31 | + */ | |
| 32 | + private String code; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 公司简称ID | |
| 36 | + */ | |
| 37 | + private String companyShortId; | |
| 38 | + | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 公司简称名称 | |
| 42 | + */ | |
| 43 | + @TableField(exist = false) | |
| 44 | + private String companyShortName; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 公司全称 | |
| 48 | + */ | |
| 49 | + @TableField(exist = false) | |
| 50 | + private String companyFullName; | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 供应商ID | |
| 54 | + */ | |
| 55 | + private String supplierId; | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 供应商名称 | |
| 59 | + */ | |
| 60 | + @TableField(exist = false) | |
| 61 | + private String supplierName; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 采购处 | |
| 65 | + */ | |
| 66 | + private String purchaseDepartment; | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * 采购处 | |
| 70 | + */ | |
| 71 | + @TableField(exist = false) | |
| 72 | + private String purchaseDepartmentName; | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 区域 | |
| 76 | + */ | |
| 77 | + private String region; | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 区域 | |
| 81 | + */ | |
| 82 | + @TableField(exist = false) | |
| 83 | + private String regionName; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 日期 | |
| 87 | + */ | |
| 88 | + private LocalDate date; | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * 报价时效 | |
| 92 | + */ | |
| 93 | + private String validityPeriod; | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * 报价人ID | |
| 97 | + */ | |
| 98 | + private String quoterId; | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * 报价人 | |
| 102 | + */ | |
| 103 | + private String quoterName; | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * 是否长单操作 | |
| 107 | + */ | |
| 108 | + private Boolean longTermOperation; | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * 是否终端客户 | |
| 112 | + */ | |
| 113 | + private Boolean terminalCustomer; | |
| 114 | + | |
| 115 | + /** | |
| 116 | + * 是否未点价 | |
| 117 | + */ | |
| 118 | + private Boolean priced; | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * 点价截止日期 | |
| 122 | + */ | |
| 123 | + private LocalDate pricingDeadline; | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 是否暂定价 | |
| 127 | + */ | |
| 128 | + private Boolean temporaryPrice; | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * 其他费用凭票到厂另行结算 | |
| 132 | + */ | |
| 133 | + private Boolean otherExpenseSettlement; | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * 交提货方式 | |
| 137 | + */ | |
| 138 | + private String deliveryMode; | |
| 139 | + | |
| 140 | + /** | |
| 141 | + * 是否通货买断 | |
| 142 | + */ | |
| 143 | + private Boolean commodityBuyout; | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * 是否质量买断 | |
| 147 | + */ | |
| 148 | + private Boolean qualityBuyout; | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * 是否数量买断 | |
| 152 | + */ | |
| 153 | + private Boolean quantityBuyout; | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * 是否送货上门 | |
| 157 | + */ | |
| 158 | + private Boolean doorDelivery; | |
| 159 | + | |
| 160 | + /** | |
| 161 | + * 另付运费 | |
| 162 | + */ | |
| 163 | + private BigDecimal shippingCost; | |
| 164 | + | |
| 165 | + /** | |
| 166 | + * 装车费 | |
| 167 | + */ | |
| 168 | + private BigDecimal loadingFee; | |
| 169 | + | |
| 170 | + /** | |
| 171 | + * 开票品名 | |
| 172 | + */ | |
| 173 | + private String invoiceProductName; | |
| 174 | + | |
| 175 | + /** | |
| 176 | + * 交货日期 | |
| 177 | + */ | |
| 178 | + private LocalDate deliveryDate; | |
| 179 | + | |
| 180 | + /** | |
| 181 | + * 结算方式 | |
| 182 | + */ | |
| 183 | + private String settlementMethod; | |
| 184 | + | |
| 185 | + /** | |
| 186 | + * 结算比例(%) | |
| 187 | + */ | |
| 188 | + private BigDecimal settlementRatio; | |
| 189 | + | |
| 190 | + /** | |
| 191 | + * 价格表ID | |
| 192 | + */ | |
| 193 | + private String priceId; | |
| 194 | + | |
| 195 | + /** | |
| 196 | + * 协调事由 | |
| 197 | + */ | |
| 198 | + private String coordinationReason; | |
| 199 | + | |
| 200 | + /** | |
| 201 | + * 票类状况 | |
| 202 | + */ | |
| 203 | + private String invoiceTypeStatus; | |
| 204 | + | |
| 205 | + /** | |
| 206 | + * 数量合计 | |
| 207 | + */ | |
| 208 | + private BigDecimal totalQuantity; | |
| 209 | + | |
| 210 | + /** | |
| 211 | + * 备注 | |
| 212 | + */ | |
| 213 | + private String remark; | |
| 214 | + | |
| 215 | + /** | |
| 216 | + * 是否启用料质状况 | |
| 217 | + */ | |
| 218 | + private Boolean materialConditionEnabled; | |
| 219 | + | |
| 220 | + /** | |
| 221 | + * 铜米 | |
| 222 | + */ | |
| 223 | + private String materialConditionCopperRice; | |
| 224 | + | |
| 225 | + /** | |
| 226 | + * 光亮铜 | |
| 227 | + */ | |
| 228 | + private String materialConditionBrightCopper; | |
| 229 | + | |
| 230 | + /** | |
| 231 | + * 一特 | |
| 232 | + */ | |
| 233 | + private String materialConditionFirstClass; | |
| 234 | + | |
| 235 | + /** | |
| 236 | + * 二特 | |
| 237 | + */ | |
| 238 | + private String materialConditionSecondClass; | |
| 239 | + | |
| 240 | + /** | |
| 241 | + * 镀锡紫 | |
| 242 | + */ | |
| 243 | + private String materialConditionTinCoated; | |
| 244 | + | |
| 245 | + /** | |
| 246 | + * 角料 | |
| 247 | + */ | |
| 248 | + private String materialConditionScrap; | |
| 249 | + | |
| 250 | + /** | |
| 251 | + * 镀白黄 | |
| 252 | + */ | |
| 253 | + private String materialConditionWhiteYellow; | |
| 254 | + | |
| 255 | + /** | |
| 256 | + * 磷铜 | |
| 257 | + */ | |
| 258 | + private String materialConditionPhosphorCopper; | |
| 259 | + | |
| 260 | + /** | |
| 261 | + * 审核状态 | |
| 262 | + */ | |
| 263 | + private String approvalStatus; | |
| 264 | + | |
| 265 | + /** | |
| 266 | + * 流程状态 | |
| 267 | + */ | |
| 268 | + private String processStatus; | |
| 269 | + | |
| 270 | + /** | |
| 271 | + * 流程节点 | |
| 272 | + */ | |
| 273 | + private String processNode; | |
| 274 | + | |
| 275 | + /** | |
| 276 | + * 创建人ID | |
| 277 | + */ | |
| 278 | + @TableField(fill = FieldFill.INSERT) | |
| 279 | + private String createById; | |
| 280 | + | |
| 281 | + /** | |
| 282 | + * 创建人 | |
| 283 | + */ | |
| 284 | + @TableField(fill = FieldFill.INSERT) | |
| 285 | + private String createBy; | |
| 286 | + | |
| 287 | + /** | |
| 288 | + * 更新人ID | |
| 289 | + */ | |
| 290 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 291 | + private String updateById; | |
| 292 | + | |
| 293 | + /** | |
| 294 | + * 更新人 | |
| 295 | + */ | |
| 296 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 297 | + private String updateBy; | |
| 298 | + | |
| 299 | + /** | |
| 300 | + * 创建时间 | |
| 301 | + */ | |
| 302 | + @TableField(fill = FieldFill.INSERT) | |
| 303 | + private LocalDateTime createTime; | |
| 304 | + | |
| 305 | + /** | |
| 306 | + * 更新时间 | |
| 307 | + */ | |
| 308 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 309 | + private LocalDateTime updateTime; | |
| 310 | +} | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/procurement/entity/ProcurementPlanLine.java
0 → 100644
| 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 | + | |
| 10 | +import java.math.BigDecimal; | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | + | |
| 13 | +@Data | |
| 14 | +@TableName("procurement_plan_line") | |
| 15 | +public class ProcurementPlanLine 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 | + * 品种ID | |
| 31 | + */ | |
| 32 | + private String productId; | |
| 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 String workshopId; | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 前端行标识 | |
| 81 | + */ | |
| 82 | + private String itemId; | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * 创建人ID | |
| 86 | + */ | |
| 87 | + @TableField(fill = FieldFill.INSERT) | |
| 88 | + private String createById; | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * 创建人 | |
| 92 | + */ | |
| 93 | + @TableField(fill = FieldFill.INSERT) | |
| 94 | + private String createBy; | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * 更新人ID | |
| 98 | + */ | |
| 99 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 100 | + private String updateById; | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * 更新人 | |
| 104 | + */ | |
| 105 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 106 | + private String updateBy; | |
| 107 | + | |
| 108 | + /** | |
| 109 | + * 创建时间 | |
| 110 | + */ | |
| 111 | + @TableField(fill = FieldFill.INSERT) | |
| 112 | + private LocalDateTime createTime; | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * 更新时间 | |
| 116 | + */ | |
| 117 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 118 | + private LocalDateTime updateTime; | |
| 119 | +} | ... | ... |
| ... | ... | @@ -252,6 +252,11 @@ public class SalesmanQuotation extends BaseEntity implements BaseDto { |
| 252 | 252 | private String reason; |
| 253 | 253 | |
| 254 | 254 | /** |
| 255 | + * 是否生成过采购计划 0否 1是 | |
| 256 | + */ | |
| 257 | + private Boolean generatedPlan; | |
| 258 | + | |
| 259 | + /** | |
| 255 | 260 | * 是否展示审核按钮(非持久化字段) |
| 256 | 261 | */ |
| 257 | 262 | @TableField(exist = false) | ... | ... |
| 1 | +package com.lframework.xingyun.sc.procurement.impl.plan; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | |
| 4 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | |
| 5 | +import com.lframework.xingyun.sc.procurement.mappers.plan.ProcurementPlanLineMapper; | |
| 6 | +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanLineService; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +@Service | |
| 12 | +public class ProcurementPlanLineServiceImpl extends | |
| 13 | + BaseMpServiceImpl<ProcurementPlanLineMapper, ProcurementPlanLine> implements | |
| 14 | + ProcurementPlanLineService { | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public List<ProcurementPlanLine> getByProcurementPlanId(String procurementPlanId) { | |
| 18 | + return getBaseMapper().getByProcurementPlanId(procurementPlanId); | |
| 19 | + } | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public int deleteByProcurementPlanId(String procurementPlanId) { | |
| 23 | + return getBaseMapper().deleteByProcurementPlanId(procurementPlanId); | |
| 24 | + } | |
| 25 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.sc.procurement.impl.plan; | |
| 2 | + | |
| 3 | +import cn.hutool.core.bean.BeanUtil; | |
| 4 | +import com.baomidou.mybatisplus.core.conditions.Wrapper; | |
| 5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 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.NumberUtil; | |
| 12 | +import com.lframework.starter.common.utils.StringUtil; | |
| 13 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | |
| 14 | +import com.lframework.starter.web.core.utils.IdUtil; | |
| 15 | +import com.lframework.starter.web.core.utils.PageHelperUtil; | |
| 16 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 17 | +import com.lframework.starter.web.core.utils.PageResultUtil; | |
| 18 | +import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanBo; | |
| 19 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | |
| 20 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | |
| 21 | +import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotation; | |
| 22 | +import com.lframework.xingyun.sc.procurement.mappers.plan.ProcurementPlanMapper; | |
| 23 | +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanLineService; | |
| 24 | +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; | |
| 25 | +import com.lframework.xingyun.sc.procurement.vo.plan.CreateProcurementPlanVo; | |
| 26 | +import com.lframework.xingyun.sc.procurement.vo.plan.ProcurementPlanLineVo; | |
| 27 | +import com.lframework.xingyun.sc.procurement.vo.plan.ProcurementPlanUpdateLineVo; | |
| 28 | +import com.lframework.xingyun.sc.procurement.vo.plan.QueryProcurementPlanVo; | |
| 29 | +import com.lframework.xingyun.sc.procurement.vo.plan.UpdateProcurementPlanVo; | |
| 30 | +import java.math.BigDecimal; | |
| 31 | +import java.time.LocalDate; | |
| 32 | +import java.time.format.DateTimeFormatter; | |
| 33 | +import java.util.ArrayList; | |
| 34 | +import java.util.Collections; | |
| 35 | +import java.util.List; | |
| 36 | +import java.util.Map; | |
| 37 | +import java.util.stream.Collectors; | |
| 38 | +import org.apache.commons.lang3.StringUtils; | |
| 39 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 40 | +import org.springframework.stereotype.Service; | |
| 41 | +import org.springframework.transaction.annotation.Transactional; | |
| 42 | + | |
| 43 | +@Service | |
| 44 | +public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPlanMapper, ProcurementPlan> | |
| 45 | + implements ProcurementPlanService { | |
| 46 | + | |
| 47 | + @Autowired | |
| 48 | + private ProcurementPlanLineService procurementPlanLineService; | |
| 49 | + | |
| 50 | + @Override | |
| 51 | + public PageResult<ProcurementPlan> query(Integer pageIndex, Integer pageSize, | |
| 52 | + QueryProcurementPlanVo vo) { | |
| 53 | + | |
| 54 | + Assert.greaterThanZero(pageIndex); | |
| 55 | + Assert.greaterThanZero(pageSize); | |
| 56 | + | |
| 57 | + PageHelperUtil.startPage(pageIndex, pageSize); | |
| 58 | + List<ProcurementPlan> datas = this.query(vo); | |
| 59 | + | |
| 60 | + return PageResultUtil.convert(new PageInfo<>(datas)); | |
| 61 | + } | |
| 62 | + | |
| 63 | + @Override | |
| 64 | + public List<ProcurementPlan> query(QueryProcurementPlanVo vo) { | |
| 65 | + | |
| 66 | + return getBaseMapper().query(vo); | |
| 67 | + } | |
| 68 | + | |
| 69 | + @Override | |
| 70 | + public GetProcurementPlanBo getDetail(String id) { | |
| 71 | + if (StringUtil.isBlank(id)) { | |
| 72 | + throw new InputErrorException("ID不能为空!"); | |
| 73 | + } | |
| 74 | + | |
| 75 | + ProcurementPlan plan = getBaseMapper().findById(id); | |
| 76 | + if (plan == null) { | |
| 77 | + throw new DefaultClientException("采购计划不存在!"); | |
| 78 | + } | |
| 79 | + | |
| 80 | + List<ProcurementPlanLine> lines = procurementPlanLineService.getByProcurementPlanId(id); | |
| 81 | + | |
| 82 | + return new GetProcurementPlanBo(plan, lines); | |
| 83 | + } | |
| 84 | + | |
| 85 | + @Transactional(rollbackFor = Exception.class) | |
| 86 | + @Override | |
| 87 | + public String create(CreateProcurementPlanVo vo) { | |
| 88 | + | |
| 89 | + vo.validate(); | |
| 90 | + vo.setCode(buildPlanCode()); | |
| 91 | + | |
| 92 | + ProcurementPlan plan = BeanUtil.copyProperties(vo, ProcurementPlan.class); | |
| 93 | + plan.setId(IdUtil.getId()); | |
| 94 | + | |
| 95 | + BigDecimal totalQuantity = BigDecimal.ZERO; | |
| 96 | + if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) { | |
| 97 | + for (ProcurementPlanLineVo lineVo : vo.getProcurementPlanLineList()) { | |
| 98 | + if (lineVo.getQuantity() != null) { | |
| 99 | + totalQuantity = NumberUtil.add(totalQuantity, lineVo.getQuantity()); | |
| 100 | + } | |
| 101 | + } | |
| 102 | + } | |
| 103 | + plan.setTotalQuantity(totalQuantity); | |
| 104 | + | |
| 105 | + getBaseMapper().insert(plan); | |
| 106 | + | |
| 107 | + if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) { | |
| 108 | + for (ProcurementPlanLineVo lineVo : vo.getProcurementPlanLineList()) { | |
| 109 | + ProcurementPlanLine line = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class); | |
| 110 | + line.setId(IdUtil.getId()); | |
| 111 | + line.setProcurementPlanId(plan.getId()); | |
| 112 | + procurementPlanLineService.save(line); | |
| 113 | + } | |
| 114 | + } | |
| 115 | + | |
| 116 | + return plan.getId(); | |
| 117 | + } | |
| 118 | + | |
| 119 | + @Transactional(rollbackFor = Exception.class) | |
| 120 | + @Override | |
| 121 | + public void update(UpdateProcurementPlanVo vo) { | |
| 122 | + | |
| 123 | + vo.validate(); | |
| 124 | + | |
| 125 | + ProcurementPlan plan = getBaseMapper().selectById(vo.getId()); | |
| 126 | + if (plan == null) { | |
| 127 | + throw new DefaultClientException("采购计划不存在!"); | |
| 128 | + } | |
| 129 | + | |
| 130 | + ProcurementPlan updateEntity = BeanUtil.copyProperties(vo, ProcurementPlan.class); | |
| 131 | + | |
| 132 | + BigDecimal totalQuantity = BigDecimal.ZERO; | |
| 133 | + if (!CollectionUtil.isEmpty(vo.getProcurementPlanLineList())) { | |
| 134 | + for (ProcurementPlanLineVo lineVo : vo.getProcurementPlanLineList()) { | |
| 135 | + if (lineVo.getQuantity() != null) { | |
| 136 | + totalQuantity = NumberUtil.add(totalQuantity, lineVo.getQuantity()); | |
| 137 | + } | |
| 138 | + } | |
| 139 | + } | |
| 140 | + updateEntity.setTotalQuantity(totalQuantity); | |
| 141 | + | |
| 142 | + Wrapper<ProcurementPlan> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class) | |
| 143 | + .eq(ProcurementPlan::getId, vo.getId()); | |
| 144 | + | |
| 145 | + this.update(updateEntity, updateWrapper); | |
| 146 | + | |
| 147 | + saveOrUpdateLines(vo.getId(), vo.getProcurementPlanLineList()); | |
| 148 | + } | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * 保存或更新采购计划明细 | |
| 152 | + * | |
| 153 | + * @param procurementPlanId 采购计划ID | |
| 154 | + * @param lineList 明细列表 | |
| 155 | + */ | |
| 156 | + private void saveOrUpdateLines(String procurementPlanId, List<ProcurementPlanUpdateLineVo> lineList) { | |
| 157 | + List<ProcurementPlanLine> oldLineList = procurementPlanLineService | |
| 158 | + .getByProcurementPlanId(procurementPlanId); | |
| 159 | + Map<String, ProcurementPlanLine> oldLineMap = CollectionUtil.isEmpty(oldLineList) | |
| 160 | + ? Collections.emptyMap() | |
| 161 | + : oldLineList.stream().collect(Collectors.toMap(ProcurementPlanLine::getId, v -> v)); | |
| 162 | + | |
| 163 | + List<String> existIdList = new ArrayList<>(); | |
| 164 | + for (ProcurementPlanUpdateLineVo lineVo : lineList) { | |
| 165 | + if (StringUtil.isNotBlank(lineVo.getId())) { | |
| 166 | + ProcurementPlanLine oldLine = oldLineMap.get(lineVo.getId()); | |
| 167 | + if (oldLine == null) { | |
| 168 | + throw new DefaultClientException("采购计划明细不存在或不属于当前采购计划!"); | |
| 169 | + } | |
| 170 | + | |
| 171 | + existIdList.add(lineVo.getId()); | |
| 172 | + lineVo.setProcurementPlanId(procurementPlanId); | |
| 173 | + if (StringUtil.isBlank(lineVo.getItemId())) { | |
| 174 | + lineVo.setItemId(oldLine.getItemId()); | |
| 175 | + } | |
| 176 | + ProcurementPlanLine updateLine = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class); | |
| 177 | + updateLine.setId(lineVo.getId()); | |
| 178 | + procurementPlanLineService.updateById(updateLine); | |
| 179 | + } else { | |
| 180 | + ProcurementPlanLine createLine = BeanUtil.copyProperties(lineVo, ProcurementPlanLine.class); | |
| 181 | + createLine.setId(IdUtil.getId()); | |
| 182 | + createLine.setProcurementPlanId(procurementPlanId); | |
| 183 | + procurementPlanLineService.save(createLine); | |
| 184 | + existIdList.add(createLine.getId()); | |
| 185 | + } | |
| 186 | + } | |
| 187 | + | |
| 188 | + List<ProcurementPlanLine> safeOldLineList = oldLineList == null ? Collections.emptyList() : oldLineList; | |
| 189 | + List<String> needDeleteIdList = safeOldLineList.stream() | |
| 190 | + .map(ProcurementPlanLine::getId) | |
| 191 | + .filter(oldLineId -> !existIdList.contains(oldLineId)) | |
| 192 | + .collect(Collectors.toList()); | |
| 193 | + if (CollectionUtil.isNotEmpty(needDeleteIdList)) { | |
| 194 | + procurementPlanLineService.removeByIds(needDeleteIdList); | |
| 195 | + } | |
| 196 | + } | |
| 197 | + | |
| 198 | + @Transactional(rollbackFor = Exception.class) | |
| 199 | + @Override | |
| 200 | + public void deleteById(String id) { | |
| 201 | + if (StringUtil.isBlank(id)) { | |
| 202 | + throw new InputErrorException("ID不能为空!"); | |
| 203 | + } | |
| 204 | + | |
| 205 | + ProcurementPlan plan = getBaseMapper().selectById(id); | |
| 206 | + if (plan == null) { | |
| 207 | + throw new DefaultClientException("采购计划不存在!"); | |
| 208 | + } | |
| 209 | + | |
| 210 | + procurementPlanLineService.deleteByProcurementPlanId(id); | |
| 211 | + | |
| 212 | + getBaseMapper().deleteById(id); | |
| 213 | + } | |
| 214 | + | |
| 215 | + /** | |
| 216 | + * 生成采购计划编号(业务要求按日期时间生成,保证唯一) | |
| 217 | + * | |
| 218 | + * @return 编号 | |
| 219 | + */ | |
| 220 | + /** | |
| 221 | + * 生成采购计划编号 | |
| 222 | + * 规则:YYMM + 5位流水号(如:260100001),按月重置 | |
| 223 | + */ | |
| 224 | + private String buildPlanCode() { | |
| 225 | + // 1. 获取当前年月(格式:YYMM,如 2601) | |
| 226 | + String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyMM")); | |
| 227 | + | |
| 228 | + // 2. 查询当月最大的编号(例如:260100005) | |
| 229 | + // 使用 MyBatis-Plus 的 likeRight 进行前缀匹配,确保只查当月的数据 | |
| 230 | + ProcurementPlan maxPlan = getBaseMapper().selectOne( | |
| 231 | + Wrappers.lambdaQuery(ProcurementPlan.class) | |
| 232 | + .likeRight(ProcurementPlan::getCode, datePrefix) | |
| 233 | + .orderByDesc(ProcurementPlan::getCode) | |
| 234 | + .last("LIMIT 1") | |
| 235 | + ); | |
| 236 | + | |
| 237 | + // 3. 计算下一个流水号 | |
| 238 | + int nextSeq = 1; // 默认当月第一条 | |
| 239 | + if (maxPlan != null && StringUtils.isNotBlank(maxPlan.getCode())) { | |
| 240 | + String maxCode = maxPlan.getCode(); | |
| 241 | + // 截取后5位作为流水号,并转换为整数 | |
| 242 | + String seqStr = maxCode.substring(datePrefix.length()); | |
| 243 | + try { | |
| 244 | + nextSeq = Integer.parseInt(seqStr) + 1; | |
| 245 | + } catch (NumberFormatException e) { | |
| 246 | + // 容错处理,防止脏数据导致解析失败 | |
| 247 | + System.out.println("解析历史最大编号失败,将重置流水号:" + maxCode); | |
| 248 | + } | |
| 249 | + } | |
| 250 | + | |
| 251 | + // 4. 拼接最终编号,流水号不足5位左侧补0 | |
| 252 | + String candidate = datePrefix + String.format("%05d", nextSeq); | |
| 253 | + | |
| 254 | + // 5. 兜底校验:防止极端并发下出现重复 | |
| 255 | + Integer count = getBaseMapper().selectCount( | |
| 256 | + Wrappers.lambdaQuery(ProcurementPlan.class).eq(ProcurementPlan::getCode, candidate) | |
| 257 | + ); | |
| 258 | + if (count != null && count > 0) { | |
| 259 | + throw new DefaultClientException("自动生成采购计划编号冲突,请稍后重试!"); | |
| 260 | + } | |
| 261 | + | |
| 262 | + return candidate; | |
| 263 | + } | |
| 264 | +} | ... | ... |
| ... | ... | @@ -27,7 +27,10 @@ import com.lframework.starter.web.inner.entity.SysUser; |
| 27 | 27 | import com.lframework.starter.web.inner.service.system.SysRoleService; |
| 28 | 28 | import com.lframework.starter.web.inner.service.system.SysUserService; |
| 29 | 29 | import com.lframework.xingyun.basedata.entity.BreedRelationship; |
| 30 | +import com.lframework.xingyun.basedata.entity.Price; | |
| 31 | +import com.lframework.xingyun.basedata.entity.PriceSubTable; | |
| 30 | 32 | import com.lframework.xingyun.basedata.service.breed.BreedRelationshipService; |
| 33 | +import com.lframework.xingyun.basedata.service.price.PriceService; | |
| 31 | 34 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; |
| 32 | 35 | import com.lframework.xingyun.sc.events.quotation.CommonChangedEvent; |
| 33 | 36 | import com.lframework.xingyun.sc.procurement.entity.ProcurementDomesticCustomerCredit; |
| ... | ... | @@ -35,8 +38,11 @@ import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotation; |
| 35 | 38 | import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotationLine; |
| 36 | 39 | import com.lframework.xingyun.sc.procurement.mappers.quotation.SalesmanQuotationMapper; |
| 37 | 40 | import com.lframework.xingyun.sc.procurement.service.credit.ProcurementDomesticCustomerCreditService; |
| 41 | +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; | |
| 38 | 42 | import com.lframework.xingyun.sc.procurement.service.quotation.SalesmanQuotationLineService; |
| 39 | 43 | import com.lframework.xingyun.sc.procurement.service.quotation.SalesmanQuotationService; |
| 44 | +import com.lframework.xingyun.sc.procurement.vo.plan.CreateProcurementPlanVo; | |
| 45 | +import com.lframework.xingyun.sc.procurement.vo.plan.ProcurementPlanLineVo; | |
| 40 | 46 | import com.lframework.xingyun.sc.procurement.vo.quotation.CreateSalesmanQuotationLineVo; |
| 41 | 47 | import com.lframework.xingyun.sc.procurement.vo.quotation.CreateSalesmanQuotationVo; |
| 42 | 48 | import com.lframework.xingyun.sc.procurement.vo.quotation.QuerySalesmanQuotationLineVo; |
| ... | ... | @@ -92,6 +98,10 @@ public class SalesmanQuotationServiceImpl |
| 92 | 98 | private SysRoleService sysRoleService; |
| 93 | 99 | @Resource |
| 94 | 100 | private ApplicationEventPublisher applicationEventPublisher; |
| 101 | + @Resource | |
| 102 | + private ProcurementPlanService procurementPlanService; | |
| 103 | + @Resource | |
| 104 | + private PriceService priceService; | |
| 95 | 105 | |
| 96 | 106 | /** |
| 97 | 107 | * 编号前缀 |
| ... | ... | @@ -694,6 +704,130 @@ public class SalesmanQuotationServiceImpl |
| 694 | 704 | return doGenerateCode(); |
| 695 | 705 | } |
| 696 | 706 | |
| 707 | + @OpLog(type = OtherOpLogType.class, name = "业务员报价生成采购计划,ID:{}", params = {"#id"}) | |
| 708 | + @Transactional(rollbackFor = Exception.class) | |
| 709 | + @Override | |
| 710 | + public void createPlan(String id) { | |
| 711 | + SalesmanQuotation salesmanQuotation = findById(id); | |
| 712 | + if (salesmanQuotation == null) { | |
| 713 | + throw new DefaultClientException("业务员报价不存在!"); | |
| 714 | + } | |
| 715 | + if (Boolean.TRUE.equals(salesmanQuotation.getGeneratedPlan())) { | |
| 716 | + throw new DefaultClientException("该业务员报价已生成过采购计划,无需重复生成!"); | |
| 717 | + } | |
| 718 | + | |
| 719 | + List<SalesmanQuotationLine> lineList = salesmanQuotation.getQuotationLineList(); | |
| 720 | + if (CollectionUtil.isEmpty(lineList)) { | |
| 721 | + throw new DefaultClientException("业务员报价明细不存在!"); | |
| 722 | + } | |
| 723 | + | |
| 724 | + CreateProcurementPlanVo vo = new CreateProcurementPlanVo(); | |
| 725 | + | |
| 726 | + // 供应商/采购处/区域:直接从报价主表带回 | |
| 727 | + vo.setSupplierId(salesmanQuotation.getSupplierId()); | |
| 728 | + vo.setPurchaseDepartment(salesmanQuotation.getPurchaseDepartment()); | |
| 729 | + vo.setRegion(salesmanQuotation.getRegion()); | |
| 730 | + // 日期:默认取报价时间的日期,可在补充页面修改 | |
| 731 | + vo.setDate(salesmanQuotation.getQuoteTime() == null | |
| 732 | + ? null | |
| 733 | + : salesmanQuotation.getQuoteTime().toLocalDate()); | |
| 734 | + // 报价时效/报价人 | |
| 735 | + vo.setValidityPeriod(salesmanQuotation.getValidityPeriod()); | |
| 736 | + vo.setQuoterId(salesmanQuotation.getQuoterId()); | |
| 737 | + vo.setQuoterName(salesmanQuotation.getQuoterName()); | |
| 738 | + // 买断、交提货、质量等布尔、文本字段直接映射 | |
| 739 | + vo.setLongTermOperation(Boolean.TRUE.equals(salesmanQuotation.getLongTermOperation())); | |
| 740 | + vo.setTerminalCustomer(Boolean.TRUE.equals(salesmanQuotation.getTerminalCustomer())); | |
| 741 | + vo.setPriced(Boolean.TRUE.equals(salesmanQuotation.getPriced())); | |
| 742 | + vo.setPricingDeadline(salesmanQuotation.getPricingDeadline()); | |
| 743 | + vo.setTemporaryPrice(Boolean.TRUE.equals(salesmanQuotation.getTemporaryPrice())); | |
| 744 | + vo.setOtherExpenseSettlement(Boolean.TRUE.equals(salesmanQuotation.getOtherExpenseSettlement())); | |
| 745 | + vo.setDeliveryMode(salesmanQuotation.getDeliveryMode()); | |
| 746 | + vo.setCommodityBuyout(Boolean.TRUE.equals(salesmanQuotation.getCommodityBuyout())); | |
| 747 | + vo.setQualityBuyout(Boolean.TRUE.equals(salesmanQuotation.getQualityBuyout())); | |
| 748 | + vo.setQuantityBuyout(Boolean.TRUE.equals(salesmanQuotation.getQuantityBuyout())); | |
| 749 | + vo.setDoorDelivery(Boolean.TRUE.equals(salesmanQuotation.getDoorDelivery())); | |
| 750 | + vo.setLoadingFee(salesmanQuotation.getLoadingFee()); | |
| 751 | + vo.setInvoiceProductName(salesmanQuotation.getInvoiceProductName()); | |
| 752 | + vo.setDeliveryDate(salesmanQuotation.getDeliveryDate()); | |
| 753 | + vo.setSettlementMethod(salesmanQuotation.getSettlementMethod()); | |
| 754 | + vo.setSettlementRatio(salesmanQuotation.getSettlementRatio()); | |
| 755 | + Price latest = priceService.findLatest(); | |
| 756 | + vo.setPriceId(latest == null ? null : latest.getId()); | |
| 757 | + vo.setCoordinationReason(salesmanQuotation.getCoordinationReason()); | |
| 758 | + vo.setInvoiceTypeStatus(salesmanQuotation.getInvoiceTypeStatus()); | |
| 759 | + vo.setTotalQuantity(salesmanQuotation.getTotalQuantity()); | |
| 760 | + vo.setRemark(salesmanQuotation.getRemark()); | |
| 761 | + // 料质状况 8 项 | |
| 762 | + boolean enabled = Boolean.TRUE.equals(salesmanQuotation.getMaterialConditionEnabled()); | |
| 763 | + vo.setMaterialConditionEnabled(enabled); | |
| 764 | + vo.setMaterialConditionCopperRice(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionCopperRice())); | |
| 765 | + vo.setMaterialConditionBrightCopper(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionBrightCopper())); | |
| 766 | + vo.setMaterialConditionFirstClass(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionFirstClass())); | |
| 767 | + vo.setMaterialConditionSecondClass(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionSecondClass())); | |
| 768 | + vo.setMaterialConditionTinCoated(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionTinCoated())); | |
| 769 | + vo.setMaterialConditionScrap(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionScrap())); | |
| 770 | + vo.setMaterialConditionWhiteYellow(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionWhiteYellow())); | |
| 771 | + vo.setMaterialConditionPhosphorCopper(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionPhosphorCopper())); | |
| 772 | + vo.setProcessStatus("TO_SUPPLEMENT"); | |
| 773 | + List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId()); | |
| 774 | + if (CollectionUtil.isNotEmpty(sysRoleList)) { | |
| 775 | + // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率 | |
| 776 | + Set<String> roleCodeSet = sysRoleList.stream() | |
| 777 | + .map(SysRole::getCode) | |
| 778 | + .collect(Collectors.toSet()); | |
| 779 | + | |
| 780 | + // 2. 判断是否包含采购主管相关的角色 | |
| 781 | + if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg") | |
| 782 | + || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) { | |
| 783 | + vo.setProcessNode("CGCZG"); | |
| 784 | + } else if (roleCodeSet.contains("qyjl")) { | |
| 785 | + // 3. 如果没有,继续判断是否包含区域经理 | |
| 786 | + vo.setProcessNode("QYJL"); | |
| 787 | + } else if (roleCodeSet.contains("nmcgkywy")) { | |
| 788 | + // 4. 如果还没有,继续判断是否包含内贸采购科业务员 | |
| 789 | + vo.setProcessNode("YWY"); | |
| 790 | + } else { | |
| 791 | + throw new DefaultClientException("当前角色无法生成计划!"); | |
| 792 | + } | |
| 793 | + } | |
| 794 | + | |
| 795 | + // 明细行:按报价明细逐行带入 | |
| 796 | + List<ProcurementPlanLineVo> lineVoList = new ArrayList<>(); | |
| 797 | + for (SalesmanQuotationLine line : lineList) { | |
| 798 | + ProcurementPlanLineVo lineVo = new ProcurementPlanLineVo(); | |
| 799 | + lineVo.setProductId(line.getProductId()); | |
| 800 | + lineVo.setMaterialType(line.getMaterialType()); | |
| 801 | + lineVo.setQuantity(line.getQuantity()); | |
| 802 | + // 实际采购价 = 报价明细采购价 | |
| 803 | + lineVo.setActualPurchasePrice(line.getPurchasePrice()); | |
| 804 | + // 价格表价格 | |
| 805 | + if (latest != null && CollectionUtil.isNotEmpty(latest.getPriceSubTableList())) { | |
| 806 | + List<PriceSubTable> priceSubTableList = latest.getPriceSubTableList(); | |
| 807 | + BigDecimal targetPrice = priceSubTableList.stream() | |
| 808 | + .filter(sub -> line.getProductId().equals(sub.getProductId())) // 匹配品名ID | |
| 809 | + .map(PriceSubTable::getPrice) // 提取价格字段 | |
| 810 | + .findFirst() // 获取匹配到的第一条记录 | |
| 811 | + .orElse(null); // 如果没有匹配到,返回 null | |
| 812 | + lineVo.setPriceListPrices(targetPrice); | |
| 813 | + } | |
| 814 | + lineVo.setEstimatedLoss(line.getEstimatedLoss()); | |
| 815 | + lineVo.setApplicationAttrition(line.getApplicationAttrition()); | |
| 816 | + lineVo.setItemId(line.getItemId()); | |
| 817 | + lineVoList.add(lineVo); | |
| 818 | + } | |
| 819 | + vo.setProcurementPlanLineList(lineVoList); | |
| 820 | + | |
| 821 | + // 落库生成采购计划(会自动计算totalQuantity) | |
| 822 | + procurementPlanService.create(vo); | |
| 823 | + | |
| 824 | + // 生成成功后回写报价单的「是否生成过采购计划」= 已生成 | |
| 825 | + Wrapper<SalesmanQuotation> updateWrapper = Wrappers.lambdaUpdate(SalesmanQuotation.class) | |
| 826 | + .set(SalesmanQuotation::getGeneratedPlan, true) | |
| 827 | + .eq(SalesmanQuotation::getId, id); | |
| 828 | + getBaseMapper().update(null, updateWrapper); | |
| 829 | + } | |
| 830 | + | |
| 697 | 831 | /** |
| 698 | 832 | * 生成编号 |
| 699 | 833 | * | ... | ... |
| 1 | +package com.lframework.xingyun.sc.procurement.mappers.plan; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | |
| 4 | +import java.util.List; | |
| 5 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 7 | + | |
| 8 | +public interface ProcurementPlanLineMapper extends BaseMapper<ProcurementPlanLine> { | |
| 9 | + | |
| 10 | + /** | |
| 11 | + * 根据采购计划ID查询 | |
| 12 | + * | |
| 13 | + * @param procurementPlanId | |
| 14 | + * @return | |
| 15 | + */ | |
| 16 | + List<ProcurementPlanLine> getByProcurementPlanId(@Param("procurementPlanId") String procurementPlanId); | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 根据采购计划ID删除 | |
| 20 | + * | |
| 21 | + * @param procurementPlanId | |
| 22 | + * @return | |
| 23 | + */ | |
| 24 | + int deleteByProcurementPlanId(@Param("procurementPlanId") String procurementPlanId); | |
| 25 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.sc.procurement.mappers.plan; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | |
| 4 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | |
| 5 | +import com.lframework.xingyun.sc.procurement.vo.plan.QueryProcurementPlanVo; | |
| 6 | +import java.util.List; | |
| 7 | +import org.apache.ibatis.annotations.Param; | |
| 8 | + | |
| 9 | +public interface ProcurementPlanMapper extends BaseMapper<ProcurementPlan> { | |
| 10 | + | |
| 11 | + /** | |
| 12 | + * 查询列表 | |
| 13 | + * | |
| 14 | + * @param vo | |
| 15 | + * @return | |
| 16 | + */ | |
| 17 | + List<ProcurementPlan> query(@Param("vo") QueryProcurementPlanVo vo); | |
| 18 | + | |
| 19 | + ProcurementPlan findById(@Param("id") String id); | |
| 20 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.sc.procurement.service.plan; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.service.BaseMpService; | |
| 4 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | |
| 5 | +import java.util.List; | |
| 6 | + | |
| 7 | +public interface ProcurementPlanLineService extends BaseMpService<ProcurementPlanLine> { | |
| 8 | + | |
| 9 | + /** | |
| 10 | + * 根据采购计划ID查询 | |
| 11 | + * | |
| 12 | + * @param procurementPlanId | |
| 13 | + * @return | |
| 14 | + */ | |
| 15 | + List<ProcurementPlanLine> getByProcurementPlanId(String procurementPlanId); | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 根据采购计划ID删除 | |
| 19 | + * | |
| 20 | + * @param procurementPlanId | |
| 21 | + * @return | |
| 22 | + */ | |
| 23 | + int deleteByProcurementPlanId(String procurementPlanId); | |
| 24 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.sc.procurement.service.plan; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 4 | +import com.lframework.starter.web.core.service.BaseMpService; | |
| 5 | +import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanBo; | |
| 6 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | |
| 7 | +import com.lframework.xingyun.sc.procurement.vo.plan.CreateProcurementPlanVo; | |
| 8 | +import com.lframework.xingyun.sc.procurement.vo.plan.QueryProcurementPlanVo; | |
| 9 | +import com.lframework.xingyun.sc.procurement.vo.plan.UpdateProcurementPlanVo; | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +public interface ProcurementPlanService extends BaseMpService<ProcurementPlan> { | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * 查询列表 | |
| 16 | + * | |
| 17 | + * @param pageIndex | |
| 18 | + * @param pageSize | |
| 19 | + * @param vo | |
| 20 | + * @return | |
| 21 | + */ | |
| 22 | + PageResult<ProcurementPlan> query(Integer pageIndex, Integer pageSize, QueryProcurementPlanVo vo); | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 查询列表 | |
| 26 | + * | |
| 27 | + * @param vo | |
| 28 | + * @return | |
| 29 | + */ | |
| 30 | + List<ProcurementPlan> query(QueryProcurementPlanVo vo); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 根据ID查询详情 | |
| 34 | + * | |
| 35 | + * @param id | |
| 36 | + * @return | |
| 37 | + */ | |
| 38 | + GetProcurementPlanBo getDetail(String id); | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 创建 | |
| 42 | + * | |
| 43 | + * @param vo | |
| 44 | + * @return | |
| 45 | + */ | |
| 46 | + String create(CreateProcurementPlanVo vo); | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 修改 | |
| 50 | + * | |
| 51 | + * @param vo | |
| 52 | + */ | |
| 53 | + void update(UpdateProcurementPlanVo vo); | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 根据ID删除 | |
| 57 | + * | |
| 58 | + * @param id | |
| 59 | + */ | |
| 60 | + void deleteById(String id); | |
| 61 | +} | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/procurement/vo/plan/CreateProcurementPlanVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.procurement.vo.plan; | |
| 2 | + | |
| 3 | +import com.lframework.starter.common.exceptions.impl.InputErrorException; | |
| 4 | +import com.lframework.starter.common.utils.StringUtil; | |
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 6 | +import io.swagger.annotations.ApiModelProperty; | |
| 7 | +import java.io.Serializable; | |
| 8 | +import java.math.BigDecimal; | |
| 9 | +import java.time.LocalDate; | |
| 10 | +import java.util.List; | |
| 11 | +import javax.validation.Valid; | |
| 12 | +import javax.validation.constraints.NotBlank; | |
| 13 | +import javax.validation.constraints.NotEmpty; | |
| 14 | +import javax.validation.constraints.NotNull; | |
| 15 | +import lombok.Data; | |
| 16 | + | |
| 17 | +@Data | |
| 18 | +public class CreateProcurementPlanVo implements BaseVo, Serializable { | |
| 19 | + | |
| 20 | + private static final long serialVersionUID = 1L; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 父ID,拆分使用 | |
| 24 | + */ | |
| 25 | + @ApiModelProperty("父ID,拆分使用") | |
| 26 | + private String parentId; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 编号 | |
| 30 | + */ | |
| 31 | + @ApiModelProperty(value = "编号", required = true) | |
| 32 | + @NotBlank(message = "编号不能为空!") | |
| 33 | + private String code; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 公司简称ID | |
| 37 | + */ | |
| 38 | + @ApiModelProperty(value = "公司简称ID", required = true) | |
| 39 | + @NotBlank(message = "公司简称ID不能为空!") | |
| 40 | + private String companyShortId; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 供应商ID | |
| 44 | + */ | |
| 45 | + @ApiModelProperty(value = "供应商ID", required = true) | |
| 46 | + @NotBlank(message = "供应商ID不能为空!") | |
| 47 | + private String supplierId; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 采购处 | |
| 51 | + */ | |
| 52 | + @ApiModelProperty(value = "采购处", required = true) | |
| 53 | + @NotBlank(message = "采购处不能为空!") | |
| 54 | + private String purchaseDepartment; | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 区域 | |
| 58 | + */ | |
| 59 | + @ApiModelProperty(value = "区域", required = true) | |
| 60 | + @NotBlank(message = "区域不能为空!") | |
| 61 | + private String region; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 日期 | |
| 65 | + */ | |
| 66 | + @ApiModelProperty(value = "日期", required = true) | |
| 67 | + @NotNull(message = "日期不能为空!") | |
| 68 | + private LocalDate date; | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 报价时效 | |
| 72 | + */ | |
| 73 | + @ApiModelProperty(value = "报价时效", required = true) | |
| 74 | + @NotBlank(message = "报价时效不能为空!") | |
| 75 | + private String validityPeriod; | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 报价人ID | |
| 79 | + */ | |
| 80 | + @ApiModelProperty(value = "报价人ID", required = true) | |
| 81 | + @NotBlank(message = "报价人ID不能为空!") | |
| 82 | + private String quoterId; | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * 报价人 | |
| 86 | + */ | |
| 87 | + @ApiModelProperty(value = "报价人", required = true) | |
| 88 | + @NotBlank(message = "报价人不能为空!") | |
| 89 | + private String quoterName; | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 是否长单操作 | |
| 93 | + */ | |
| 94 | + @ApiModelProperty(value = "是否长单操作", required = true) | |
| 95 | + @NotNull(message = "是否长单操作不能为空!") | |
| 96 | + private Boolean longTermOperation; | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 是否终端客户 | |
| 100 | + */ | |
| 101 | + @ApiModelProperty(value = "是否终端客户", required = true) | |
| 102 | + @NotNull(message = "是否终端客户不能为空!") | |
| 103 | + private Boolean terminalCustomer; | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * 是否未点价 | |
| 107 | + */ | |
| 108 | + @ApiModelProperty(value = "是否未点价", required = true) | |
| 109 | + @NotNull(message = "是否未点价不能为空!") | |
| 110 | + private Boolean priced; | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 点价截止日期 | |
| 114 | + */ | |
| 115 | + @ApiModelProperty("点价截止日期") | |
| 116 | + private LocalDate pricingDeadline; | |
| 117 | + | |
| 118 | + /** | |
| 119 | + * 是否暂定价 | |
| 120 | + */ | |
| 121 | + @ApiModelProperty("是否暂定价") | |
| 122 | + private Boolean temporaryPrice; | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * 其他费用凭票到厂另行结算 | |
| 126 | + */ | |
| 127 | + @ApiModelProperty(value = "其他费用凭票到厂另行结算", required = true) | |
| 128 | + @NotNull(message = "其他费用凭票到厂另行结算不能为空!") | |
| 129 | + private Boolean otherExpenseSettlement; | |
| 130 | + | |
| 131 | + /** | |
| 132 | + * 交提货方式 | |
| 133 | + */ | |
| 134 | + @ApiModelProperty(value = "交提货方式", required = true) | |
| 135 | + @NotBlank(message = "交提货方式不能为空!") | |
| 136 | + private String deliveryMode; | |
| 137 | + | |
| 138 | + /** | |
| 139 | + * 是否通货买断 | |
| 140 | + */ | |
| 141 | + @ApiModelProperty(value = "是否通货买断", required = true) | |
| 142 | + @NotNull(message = "是否通货买断不能为空!") | |
| 143 | + private Boolean commodityBuyout; | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * 是否质量买断 | |
| 147 | + */ | |
| 148 | + @ApiModelProperty(value = "是否质量买断", required = true) | |
| 149 | + @NotNull(message = "是否质量买断不能为空!") | |
| 150 | + private Boolean qualityBuyout; | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 是否数量买断 | |
| 154 | + */ | |
| 155 | + @ApiModelProperty(value = "是否数量买断", required = true) | |
| 156 | + @NotNull(message = "是否数量买断不能为空!") | |
| 157 | + private Boolean quantityBuyout; | |
| 158 | + | |
| 159 | + /** | |
| 160 | + * 是否送货上门 | |
| 161 | + */ | |
| 162 | + @ApiModelProperty(value = "是否送货上门", required = true) | |
| 163 | + @NotNull(message = "是否送货上门不能为空!") | |
| 164 | + private Boolean doorDelivery; | |
| 165 | + | |
| 166 | + /** | |
| 167 | + * 另付运费 | |
| 168 | + */ | |
| 169 | + @ApiModelProperty("另付运费") | |
| 170 | + private BigDecimal shippingCost; | |
| 171 | + | |
| 172 | + /** | |
| 173 | + * 装车费 | |
| 174 | + */ | |
| 175 | + @ApiModelProperty("装车费") | |
| 176 | + private BigDecimal loadingFee; | |
| 177 | + | |
| 178 | + /** | |
| 179 | + * 开票品名 | |
| 180 | + */ | |
| 181 | + @ApiModelProperty(value = "开票品名", required = true) | |
| 182 | + @NotBlank(message = "开票品名不能为空!") | |
| 183 | + private String invoiceProductName; | |
| 184 | + | |
| 185 | + /** | |
| 186 | + * 交货日期 | |
| 187 | + */ | |
| 188 | + @ApiModelProperty(value = "交货日期", required = true) | |
| 189 | + @NotNull(message = "交货日期不能为空!") | |
| 190 | + private LocalDate deliveryDate; | |
| 191 | + | |
| 192 | + /** | |
| 193 | + * 结算方式 | |
| 194 | + */ | |
| 195 | + @ApiModelProperty(value = "结算方式", required = true) | |
| 196 | + @NotBlank(message = "结算方式不能为空!") | |
| 197 | + private String settlementMethod; | |
| 198 | + | |
| 199 | + /** | |
| 200 | + * 结算比例(%) | |
| 201 | + */ | |
| 202 | + @ApiModelProperty(value = "结算比例(%)", required = true) | |
| 203 | + @NotNull(message = "结算比例不能为空!") | |
| 204 | + private BigDecimal settlementRatio; | |
| 205 | + | |
| 206 | + /** | |
| 207 | + * 价格表ID | |
| 208 | + */ | |
| 209 | + @ApiModelProperty(value = "价格表ID", required = true) | |
| 210 | + @NotBlank(message = "价格表ID不能为空!") | |
| 211 | + private String priceId; | |
| 212 | + | |
| 213 | + /** | |
| 214 | + * 协调事由 | |
| 215 | + */ | |
| 216 | + @ApiModelProperty(value = "协调事由", required = true) | |
| 217 | + @NotBlank(message = "协调事由不能为空!") | |
| 218 | + private String coordinationReason; | |
| 219 | + | |
| 220 | + /** | |
| 221 | + * 票类状况 | |
| 222 | + */ | |
| 223 | + @ApiModelProperty(value = "票类状况", required = true) | |
| 224 | + @NotBlank(message = "票类状况不能为空!") | |
| 225 | + private String invoiceTypeStatus; | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * 数量合计 | |
| 229 | + */ | |
| 230 | + @ApiModelProperty("数量合计") | |
| 231 | + private BigDecimal totalQuantity; | |
| 232 | + | |
| 233 | + /** | |
| 234 | + * 备注 | |
| 235 | + */ | |
| 236 | + @ApiModelProperty("备注") | |
| 237 | + private String remark; | |
| 238 | + | |
| 239 | + /** | |
| 240 | + * 是否启用料质状况 | |
| 241 | + */ | |
| 242 | + @ApiModelProperty(value = "是否启用料质状况", required = true) | |
| 243 | + @NotNull(message = "是否启用料质状况不能为空!") | |
| 244 | + private Boolean materialConditionEnabled; | |
| 245 | + | |
| 246 | + /** | |
| 247 | + * 铜米 | |
| 248 | + */ | |
| 249 | + @ApiModelProperty("铜米") | |
| 250 | + private String materialConditionCopperRice; | |
| 251 | + | |
| 252 | + /** | |
| 253 | + * 光亮铜 | |
| 254 | + */ | |
| 255 | + @ApiModelProperty("光亮铜") | |
| 256 | + private String materialConditionBrightCopper; | |
| 257 | + | |
| 258 | + /** | |
| 259 | + * 一特 | |
| 260 | + */ | |
| 261 | + @ApiModelProperty("一特") | |
| 262 | + private String materialConditionFirstClass; | |
| 263 | + | |
| 264 | + /** | |
| 265 | + * 二特 | |
| 266 | + */ | |
| 267 | + @ApiModelProperty("二特") | |
| 268 | + private String materialConditionSecondClass; | |
| 269 | + | |
| 270 | + /** | |
| 271 | + * 镀锡紫 | |
| 272 | + */ | |
| 273 | + @ApiModelProperty("镀锡紫") | |
| 274 | + private String materialConditionTinCoated; | |
| 275 | + | |
| 276 | + /** | |
| 277 | + * 角料 | |
| 278 | + */ | |
| 279 | + @ApiModelProperty("角料") | |
| 280 | + private String materialConditionScrap; | |
| 281 | + | |
| 282 | + /** | |
| 283 | + * 镀白黄 | |
| 284 | + */ | |
| 285 | + @ApiModelProperty("镀白黄") | |
| 286 | + private String materialConditionWhiteYellow; | |
| 287 | + | |
| 288 | + /** | |
| 289 | + * 磷铜 | |
| 290 | + */ | |
| 291 | + @ApiModelProperty("磷铜") | |
| 292 | + private String materialConditionPhosphorCopper; | |
| 293 | + | |
| 294 | + /** | |
| 295 | + * 审核状态 | |
| 296 | + */ | |
| 297 | + @ApiModelProperty("审核状态") | |
| 298 | + private String approvalStatus; | |
| 299 | + | |
| 300 | + /** | |
| 301 | + * 流程状态 | |
| 302 | + */ | |
| 303 | + @ApiModelProperty("流程状态") | |
| 304 | + private String processStatus; | |
| 305 | + | |
| 306 | + /** | |
| 307 | + * 流程节点 | |
| 308 | + */ | |
| 309 | + @ApiModelProperty("流程节点") | |
| 310 | + private String processNode; | |
| 311 | + | |
| 312 | + /** | |
| 313 | + * 明细信息 | |
| 314 | + */ | |
| 315 | + @ApiModelProperty(value = "明细信息", required = true) | |
| 316 | + @Valid | |
| 317 | + @NotEmpty(message = "明细不能为空!") | |
| 318 | + private List<ProcurementPlanLineVo> procurementPlanLineList; | |
| 319 | + | |
| 320 | + public void validate() { | |
| 321 | + int orderNo = 1; | |
| 322 | + for (ProcurementPlanLineVo line : this.procurementPlanLineList) { | |
| 323 | + if (StringUtil.isBlank(line.getProductId())) { | |
| 324 | + throw new InputErrorException("第" + orderNo + "行品种ID不能为空!"); | |
| 325 | + } | |
| 326 | + if (line.getQuantity() == null) { | |
| 327 | + throw new InputErrorException("第" + orderNo + "行数量不能为空!"); | |
| 328 | + } | |
| 329 | + if (line.getQuantity().compareTo(BigDecimal.ZERO) <= 0) { | |
| 330 | + throw new InputErrorException("第" + orderNo + "行数量必须大于0!"); | |
| 331 | + } | |
| 332 | + if (StringUtil.isBlank(line.getItemId())) { | |
| 333 | + throw new InputErrorException("第" + orderNo + "行前端行标识不能为空!"); | |
| 334 | + } | |
| 335 | + orderNo++; | |
| 336 | + } | |
| 337 | + } | |
| 338 | +} | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/procurement/vo/plan/ProcurementPlanLineVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.procurement.vo.plan; | |
| 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 | +/** | |
| 14 | + * 采购计划明细入参 | |
| 15 | + */ | |
| 16 | +@Data | |
| 17 | +public class ProcurementPlanLineVo implements BaseVo, Serializable { | |
| 18 | + | |
| 19 | + private static final long serialVersionUID = 1L; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 采购计划ID | |
| 23 | + */ | |
| 24 | + @ApiModelProperty(value = "采购计划ID", required = true) | |
| 25 | + @NotBlank(message = "采购计划ID不能为空!") | |
| 26 | + private String procurementPlanId; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 品种ID | |
| 30 | + */ | |
| 31 | + @ApiModelProperty(value = "品种ID", required = true) | |
| 32 | + @NotBlank(message = "品种ID不能为空!") | |
| 33 | + private String productId; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 料型 | |
| 37 | + */ | |
| 38 | + @ApiModelProperty("料型") | |
| 39 | + @Length(max = 200, message = "料型最多允许200个字符!") | |
| 40 | + private String materialType; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 数量 | |
| 44 | + */ | |
| 45 | + @ApiModelProperty(value = "数量", required = true) | |
| 46 | + @NotNull(message = "数量不能为空!") | |
| 47 | + @Digits(integer = 14, fraction = 5, message = "数量最多支持14位整数和5位小数!") | |
| 48 | + private BigDecimal quantity; | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 实际采购价 | |
| 52 | + */ | |
| 53 | + @ApiModelProperty("实际采购价") | |
| 54 | + @Digits(integer = 14, fraction = 10, message = "实际采购价最多支持14位整数和10位小数!") | |
| 55 | + private BigDecimal actualPurchasePrice; | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 含运到厂价 | |
| 59 | + */ | |
| 60 | + @ApiModelProperty("含运到厂价") | |
| 61 | + @Digits(integer = 14, fraction = 10, message = "含运到厂价最多支持14位整数和10位小数!") | |
| 62 | + private BigDecimal includingShippingPrice; | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 价格表价格 | |
| 66 | + */ | |
| 67 | + @ApiModelProperty("价格表价格") | |
| 68 | + @Digits(integer = 14, fraction = 10, message = "价格表价格最多支持14位整数和10位小数!") | |
| 69 | + private BigDecimal priceListPrices; | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 协调幅度 | |
| 73 | + */ | |
| 74 | + @ApiModelProperty("协调幅度") | |
| 75 | + @Digits(integer = 14, fraction = 10, message = "协调幅度最多支持14位整数和10位小数!") | |
| 76 | + private BigDecimal coordinationRange; | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * 买断料预计损耗 | |
| 80 | + */ | |
| 81 | + @ApiModelProperty("买断料预计损耗") | |
| 82 | + @Digits(integer = 8, fraction = 10, message = "买断料预计损耗最多支持8位整数和10位小数!") | |
| 83 | + private BigDecimal estimatedLoss; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 申请损耗(%) | |
| 87 | + */ | |
| 88 | + @ApiModelProperty("申请损耗(%)") | |
| 89 | + @Digits(integer = 8, fraction = 10, message = "申请损耗最多支持8位整数和10位小数!") | |
| 90 | + private BigDecimal applicationAttrition; | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * 分厂 | |
| 94 | + */ | |
| 95 | + @ApiModelProperty("分厂") | |
| 96 | + @Length(max = 50, message = "分厂最多允许50个字符!") | |
| 97 | + private String workshopId; | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * 前端行标识 | |
| 101 | + */ | |
| 102 | + @ApiModelProperty(value = "前端行标识", required = true) | |
| 103 | + @NotBlank(message = "前端行标识不能为空!") | |
| 104 | + private String itemId; | |
| 105 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.plan; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModelProperty; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 采购计划明细修改入参 | |
| 8 | + */ | |
| 9 | +@Data | |
| 10 | +public class ProcurementPlanUpdateLineVo extends ProcurementPlanLineVo { | |
| 11 | + | |
| 12 | + private static final long serialVersionUID = 1L; | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * ID | |
| 16 | + */ | |
| 17 | + @ApiModelProperty("ID") | |
| 18 | + private String id; | |
| 19 | +} | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/procurement/vo/plan/QueryProcurementPlanVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.procurement.vo.plan; | |
| 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 QueryProcurementPlanVo 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 | + * 公司名称 | |
| 27 | + */ | |
| 28 | + @ApiModelProperty("公司名称") | |
| 29 | + private String companyName; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 采购处 | |
| 33 | + */ | |
| 34 | + @ApiModelProperty("采购处") | |
| 35 | + private String purchaseDepartment; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 日期起始 | |
| 39 | + */ | |
| 40 | + @ApiModelProperty("日期起始") | |
| 41 | + private LocalDate startDate; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 日期截止 | |
| 45 | + */ | |
| 46 | + @ApiModelProperty("日期截止") | |
| 47 | + private LocalDate endDate; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 供应商ID | |
| 51 | + */ | |
| 52 | + @ApiModelProperty("供应商ID") | |
| 53 | + private String supplierId; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 供应商名称 | |
| 57 | + */ | |
| 58 | + @ApiModelProperty("供应商名称") | |
| 59 | + private String supplierName; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 流程状态 | |
| 63 | + */ | |
| 64 | + @ApiModelProperty("流程状态") | |
| 65 | + private String processStatus; | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 流程节点 | |
| 69 | + */ | |
| 70 | + @ApiModelProperty("流程节点") | |
| 71 | + private String processNode; | |
| 72 | +} | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/procurement/vo/plan/UpdateProcurementPlanVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.procurement.vo.plan; | |
| 2 | + | |
| 3 | +import com.lframework.starter.common.exceptions.impl.InputErrorException; | |
| 4 | +import com.lframework.starter.common.utils.StringUtil; | |
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 6 | +import io.swagger.annotations.ApiModelProperty; | |
| 7 | +import java.io.Serializable; | |
| 8 | +import java.math.BigDecimal; | |
| 9 | +import java.time.LocalDate; | |
| 10 | +import java.util.List; | |
| 11 | +import javax.validation.Valid; | |
| 12 | +import javax.validation.constraints.NotBlank; | |
| 13 | +import javax.validation.constraints.NotEmpty; | |
| 14 | +import javax.validation.constraints.NotNull; | |
| 15 | +import lombok.Data; | |
| 16 | + | |
| 17 | +@Data | |
| 18 | +public class UpdateProcurementPlanVo implements BaseVo, Serializable { | |
| 19 | + | |
| 20 | + private static final long serialVersionUID = 1L; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * ID | |
| 24 | + */ | |
| 25 | + @ApiModelProperty(value = "ID", required = true) | |
| 26 | + @NotBlank(message = "ID不能为空!") | |
| 27 | + private String id; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 父ID,拆分使用 | |
| 31 | + */ | |
| 32 | + @ApiModelProperty("父ID,拆分使用") | |
| 33 | + private String parentId; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 编号 | |
| 37 | + */ | |
| 38 | + @ApiModelProperty(value = "编号", required = true) | |
| 39 | + @NotBlank(message = "编号不能为空!") | |
| 40 | + private String code; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 公司简称ID | |
| 44 | + */ | |
| 45 | + @ApiModelProperty(value = "公司简称ID", required = true) | |
| 46 | + @NotBlank(message = "公司简称ID不能为空!") | |
| 47 | + private String companyShortId; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 供应商ID | |
| 51 | + */ | |
| 52 | + @ApiModelProperty(value = "供应商ID", required = true) | |
| 53 | + @NotBlank(message = "供应商ID不能为空!") | |
| 54 | + private String supplierId; | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 采购处 | |
| 58 | + */ | |
| 59 | + @ApiModelProperty(value = "采购处", required = true) | |
| 60 | + @NotBlank(message = "采购处不能为空!") | |
| 61 | + private String purchaseDepartment; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 区域 | |
| 65 | + */ | |
| 66 | + @ApiModelProperty(value = "区域", required = true) | |
| 67 | + @NotBlank(message = "区域不能为空!") | |
| 68 | + private String region; | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 日期 | |
| 72 | + */ | |
| 73 | + @ApiModelProperty(value = "日期", required = true) | |
| 74 | + @NotNull(message = "日期不能为空!") | |
| 75 | + private LocalDate date; | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 报价时效 | |
| 79 | + */ | |
| 80 | + @ApiModelProperty(value = "报价时效", required = true) | |
| 81 | + @NotBlank(message = "报价时效不能为空!") | |
| 82 | + private String validityPeriod; | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * 报价人ID | |
| 86 | + */ | |
| 87 | + @ApiModelProperty(value = "报价人ID", required = true) | |
| 88 | + @NotBlank(message = "报价人ID不能为空!") | |
| 89 | + private String quoterId; | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 报价人 | |
| 93 | + */ | |
| 94 | + @ApiModelProperty(value = "报价人", required = true) | |
| 95 | + @NotBlank(message = "报价人不能为空!") | |
| 96 | + private String quoterName; | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 是否长单操作 | |
| 100 | + */ | |
| 101 | + @ApiModelProperty(value = "是否长单操作", required = true) | |
| 102 | + @NotNull(message = "是否长单操作不能为空!") | |
| 103 | + private Boolean longTermOperation; | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * 是否终端客户 | |
| 107 | + */ | |
| 108 | + @ApiModelProperty(value = "是否终端客户", required = true) | |
| 109 | + @NotNull(message = "是否终端客户不能为空!") | |
| 110 | + private Boolean terminalCustomer; | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 是否未点价 | |
| 114 | + */ | |
| 115 | + @ApiModelProperty(value = "是否未点价", required = true) | |
| 116 | + @NotNull(message = "是否未点价不能为空!") | |
| 117 | + private Boolean priced; | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * 点价截止日期 | |
| 121 | + */ | |
| 122 | + @ApiModelProperty("点价截止日期") | |
| 123 | + private LocalDate pricingDeadline; | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 是否暂定价 | |
| 127 | + */ | |
| 128 | + @ApiModelProperty("是否暂定价") | |
| 129 | + private Boolean temporaryPrice; | |
| 130 | + | |
| 131 | + /** | |
| 132 | + * 其他费用凭票到厂另行结算 | |
| 133 | + */ | |
| 134 | + @ApiModelProperty(value = "其他费用凭票到厂另行结算", required = true) | |
| 135 | + @NotNull(message = "其他费用凭票到厂另行结算不能为空!") | |
| 136 | + private Boolean otherExpenseSettlement; | |
| 137 | + | |
| 138 | + /** | |
| 139 | + * 交提货方式 | |
| 140 | + */ | |
| 141 | + @ApiModelProperty(value = "交提货方式", required = true) | |
| 142 | + @NotBlank(message = "交提货方式不能为空!") | |
| 143 | + private String deliveryMode; | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * 是否通货买断 | |
| 147 | + */ | |
| 148 | + @ApiModelProperty(value = "是否通货买断", required = true) | |
| 149 | + @NotNull(message = "是否通货买断不能为空!") | |
| 150 | + private Boolean commodityBuyout; | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 是否质量买断 | |
| 154 | + */ | |
| 155 | + @ApiModelProperty(value = "是否质量买断", required = true) | |
| 156 | + @NotNull(message = "是否质量买断不能为空!") | |
| 157 | + private Boolean qualityBuyout; | |
| 158 | + | |
| 159 | + /** | |
| 160 | + * 是否数量买断 | |
| 161 | + */ | |
| 162 | + @ApiModelProperty(value = "是否数量买断", required = true) | |
| 163 | + @NotNull(message = "是否数量买断不能为空!") | |
| 164 | + private Boolean quantityBuyout; | |
| 165 | + | |
| 166 | + /** | |
| 167 | + * 是否送货上门 | |
| 168 | + */ | |
| 169 | + @ApiModelProperty(value = "是否送货上门", required = true) | |
| 170 | + @NotNull(message = "是否送货上门不能为空!") | |
| 171 | + private Boolean doorDelivery; | |
| 172 | + | |
| 173 | + /** | |
| 174 | + * 另付运费 | |
| 175 | + */ | |
| 176 | + @ApiModelProperty("另付运费") | |
| 177 | + private BigDecimal shippingCost; | |
| 178 | + | |
| 179 | + /** | |
| 180 | + * 装车费 | |
| 181 | + */ | |
| 182 | + @ApiModelProperty("装车费") | |
| 183 | + private BigDecimal loadingFee; | |
| 184 | + | |
| 185 | + /** | |
| 186 | + * 开票品名 | |
| 187 | + */ | |
| 188 | + @ApiModelProperty(value = "开票品名", required = true) | |
| 189 | + @NotBlank(message = "开票品名不能为空!") | |
| 190 | + private String invoiceProductName; | |
| 191 | + | |
| 192 | + /** | |
| 193 | + * 交货日期 | |
| 194 | + */ | |
| 195 | + @ApiModelProperty(value = "交货日期", required = true) | |
| 196 | + @NotNull(message = "交货日期不能为空!") | |
| 197 | + private LocalDate deliveryDate; | |
| 198 | + | |
| 199 | + /** | |
| 200 | + * 结算方式 | |
| 201 | + */ | |
| 202 | + @ApiModelProperty(value = "结算方式", required = true) | |
| 203 | + @NotBlank(message = "结算方式不能为空!") | |
| 204 | + private String settlementMethod; | |
| 205 | + | |
| 206 | + /** | |
| 207 | + * 结算比例(%) | |
| 208 | + */ | |
| 209 | + @ApiModelProperty(value = "结算比例(%)", required = true) | |
| 210 | + @NotNull(message = "结算比例不能为空!") | |
| 211 | + private BigDecimal settlementRatio; | |
| 212 | + | |
| 213 | + /** | |
| 214 | + * 价格表ID | |
| 215 | + */ | |
| 216 | + @ApiModelProperty(value = "价格表ID", required = true) | |
| 217 | + @NotBlank(message = "价格表ID不能为空!") | |
| 218 | + private String priceId; | |
| 219 | + | |
| 220 | + /** | |
| 221 | + * 协调事由 | |
| 222 | + */ | |
| 223 | + @ApiModelProperty(value = "协调事由", required = true) | |
| 224 | + @NotBlank(message = "协调事由不能为空!") | |
| 225 | + private String coordinationReason; | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * 票类状况 | |
| 229 | + */ | |
| 230 | + @ApiModelProperty(value = "票类状况", required = true) | |
| 231 | + @NotBlank(message = "票类状况不能为空!") | |
| 232 | + private String invoiceTypeStatus; | |
| 233 | + | |
| 234 | + /** | |
| 235 | + * 备注 | |
| 236 | + */ | |
| 237 | + @ApiModelProperty("备注") | |
| 238 | + private String remark; | |
| 239 | + | |
| 240 | + /** | |
| 241 | + * 是否启用料质状况 | |
| 242 | + */ | |
| 243 | + @ApiModelProperty(value = "是否启用料质状况", required = true) | |
| 244 | + @NotNull(message = "是否启用料质状况不能为空!") | |
| 245 | + private Boolean materialConditionEnabled; | |
| 246 | + | |
| 247 | + /** | |
| 248 | + * 铜米 | |
| 249 | + */ | |
| 250 | + @ApiModelProperty("铜米") | |
| 251 | + private String materialConditionCopperRice; | |
| 252 | + | |
| 253 | + /** | |
| 254 | + * 光亮铜 | |
| 255 | + */ | |
| 256 | + @ApiModelProperty("光亮铜") | |
| 257 | + private String materialConditionBrightCopper; | |
| 258 | + | |
| 259 | + /** | |
| 260 | + * 一特 | |
| 261 | + */ | |
| 262 | + @ApiModelProperty("一特") | |
| 263 | + private String materialConditionFirstClass; | |
| 264 | + | |
| 265 | + /** | |
| 266 | + * 二特 | |
| 267 | + */ | |
| 268 | + @ApiModelProperty("二特") | |
| 269 | + private String materialConditionSecondClass; | |
| 270 | + | |
| 271 | + /** | |
| 272 | + * 镀锡紫 | |
| 273 | + */ | |
| 274 | + @ApiModelProperty("镀锡紫") | |
| 275 | + private String materialConditionTinCoated; | |
| 276 | + | |
| 277 | + /** | |
| 278 | + * 角料 | |
| 279 | + */ | |
| 280 | + @ApiModelProperty("角料") | |
| 281 | + private String materialConditionScrap; | |
| 282 | + | |
| 283 | + /** | |
| 284 | + * 镀白黄 | |
| 285 | + */ | |
| 286 | + @ApiModelProperty("镀白黄") | |
| 287 | + private String materialConditionWhiteYellow; | |
| 288 | + | |
| 289 | + /** | |
| 290 | + * 磷铜 | |
| 291 | + */ | |
| 292 | + @ApiModelProperty("磷铜") | |
| 293 | + private String materialConditionPhosphorCopper; | |
| 294 | + | |
| 295 | + /** | |
| 296 | + * 审核状态 | |
| 297 | + */ | |
| 298 | + @ApiModelProperty("审核状态") | |
| 299 | + private String approvalStatus; | |
| 300 | + | |
| 301 | + /** | |
| 302 | + * 流程状态 | |
| 303 | + */ | |
| 304 | + @ApiModelProperty("流程状态") | |
| 305 | + private String processStatus; | |
| 306 | + | |
| 307 | + /** | |
| 308 | + * 流程节点 | |
| 309 | + */ | |
| 310 | + @ApiModelProperty("流程节点") | |
| 311 | + private String processNode; | |
| 312 | + | |
| 313 | + /** | |
| 314 | + * 明细信息 | |
| 315 | + */ | |
| 316 | + @ApiModelProperty(value = "明细信息", required = true) | |
| 317 | + @Valid | |
| 318 | + @NotEmpty(message = "明细不能为空!") | |
| 319 | + private List<ProcurementPlanUpdateLineVo> procurementPlanLineList; | |
| 320 | + | |
| 321 | + public void validate() { | |
| 322 | + int orderNo = 1; | |
| 323 | + for (ProcurementPlanUpdateLineVo line : this.procurementPlanLineList) { | |
| 324 | + if (StringUtil.isBlank(line.getProductId())) { | |
| 325 | + throw new InputErrorException("第" + orderNo + "行品种ID不能为空!"); | |
| 326 | + } | |
| 327 | + if (line.getQuantity() == null) { | |
| 328 | + throw new InputErrorException("第" + orderNo + "行数量不能为空!"); | |
| 329 | + } | |
| 330 | + if (line.getQuantity().compareTo(BigDecimal.ZERO) <= 0) { | |
| 331 | + throw new InputErrorException("第" + orderNo + "行数量必须大于0!"); | |
| 332 | + } | |
| 333 | + if (StringUtil.isBlank(line.getItemId())) { | |
| 334 | + throw new InputErrorException("第" + orderNo + "行前端行标识不能为空!"); | |
| 335 | + } | |
| 336 | + orderNo++; | |
| 337 | + } | |
| 338 | + } | |
| 339 | +} | ... | ... |
| 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.plan.ProcurementPlanLineMapper"> | |
| 4 | + | |
| 5 | + <resultMap id="ProcurementPlanLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine"> | |
| 6 | + <id column="id" property="id"/> | |
| 7 | + <result column="procurement_plan_id" property="procurementPlanId"/> | |
| 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="workshop_id" property="workshopId"/> | |
| 18 | + <result column="item_id" property="itemId"/> | |
| 19 | + <result column="create_by_id" property="createById"/> | |
| 20 | + <result column="create_by" property="createBy"/> | |
| 21 | + <result column="update_by_id" property="updateById"/> | |
| 22 | + <result column="update_by" property="updateBy"/> | |
| 23 | + <result column="create_time" property="createTime"/> | |
| 24 | + <result column="update_time" property="updateTime"/> | |
| 25 | + </resultMap> | |
| 26 | + | |
| 27 | + <sql id="ProcurementPlanLine_sql"> | |
| 28 | + SELECT | |
| 29 | + ppl.id, | |
| 30 | + ppl.procurement_plan_id, | |
| 31 | + ppl.product_id, | |
| 32 | + ppl.material_type, | |
| 33 | + ppl.quantity, | |
| 34 | + ppl.actual_purchase_price, | |
| 35 | + ppl.including_shipping_price, | |
| 36 | + ppl.price_list_prices, | |
| 37 | + ppl.coordination_range, | |
| 38 | + ppl.estimated_loss, | |
| 39 | + ppl.application_attrition, | |
| 40 | + ppl.workshop_id, | |
| 41 | + ppl.item_id, | |
| 42 | + ppl.create_by_id, | |
| 43 | + ppl.create_by, | |
| 44 | + ppl.update_by_id, | |
| 45 | + ppl.update_by, | |
| 46 | + ppl.create_time, | |
| 47 | + ppl.update_time | |
| 48 | + FROM procurement_plan_line AS ppl | |
| 49 | + </sql> | |
| 50 | + | |
| 51 | + <select id="getByProcurementPlanId" resultMap="ProcurementPlanLine"> | |
| 52 | + <include refid="ProcurementPlanLine_sql"/> | |
| 53 | + WHERE ppl.procurement_plan_id = #{procurementPlanId} | |
| 54 | + ORDER BY ppl.create_time ASC | |
| 55 | + </select> | |
| 56 | + | |
| 57 | + <delete id="deleteByProcurementPlanId"> | |
| 58 | + DELETE FROM procurement_plan_line WHERE procurement_plan_id = #{procurementPlanId} | |
| 59 | + </delete> | |
| 60 | +</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.plan.ProcurementPlanMapper"> | |
| 4 | + | |
| 5 | + <resultMap id="ProcurementPlan" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlan"> | |
| 6 | + <id column="id" property="id"/> | |
| 7 | + <result column="parent_id" property="parentId"/> | |
| 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="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="coordination_reason" property="coordinationReason"/> | |
| 41 | + <result column="invoice_type_status" property="invoiceTypeStatus"/> | |
| 42 | + <result column="total_quantity" property="totalQuantity"/> | |
| 43 | + <result column="remark" property="remark"/> | |
| 44 | + <result column="material_condition_enabled" property="materialConditionEnabled"/> | |
| 45 | + <result column="material_condition_copper_rice" property="materialConditionCopperRice"/> | |
| 46 | + <result column="material_condition_bright_copper" property="materialConditionBrightCopper"/> | |
| 47 | + <result column="material_condition_first_class" property="materialConditionFirstClass"/> | |
| 48 | + <result column="material_condition_second_class" property="materialConditionSecondClass"/> | |
| 49 | + <result column="material_condition_tin_coated" property="materialConditionTinCoated"/> | |
| 50 | + <result column="material_condition_scrap" property="materialConditionScrap"/> | |
| 51 | + <result column="material_condition_white_yellow" property="materialConditionWhiteYellow"/> | |
| 52 | + <result column="material_condition_phosphor_copper" property="materialConditionPhosphorCopper"/> | |
| 53 | + <result column="approval_status" property="approvalStatus"/> | |
| 54 | + <result column="process_status" property="processStatus"/> | |
| 55 | + <result column="process_node" property="processNode"/> | |
| 56 | + <result column="create_by_id" property="createById"/> | |
| 57 | + <result column="create_by" property="createBy"/> | |
| 58 | + <result column="update_by_id" property="updateById"/> | |
| 59 | + <result column="update_by" property="updateBy"/> | |
| 60 | + <result column="create_time" property="createTime"/> | |
| 61 | + <result column="update_time" property="updateTime"/> | |
| 62 | + </resultMap> | |
| 63 | + | |
| 64 | + <sql id="ProcurementPlan_sql"> | |
| 65 | + SELECT | |
| 66 | + pp.id, | |
| 67 | + pp.parent_id, | |
| 68 | + pp.code, | |
| 69 | + pp.company_short_id, | |
| 70 | + bdcs.short_name AS company_short_name, | |
| 71 | + bdcs.company_name AS company_full_name, | |
| 72 | + pp.supplier_id, | |
| 73 | + pdc.unit_name AS supplier_name, | |
| 74 | + pp.purchase_department, | |
| 75 | + sd.name AS purchase_department_name, | |
| 76 | + pp.region, | |
| 77 | + sd1.name AS region_name, | |
| 78 | + pp.date, | |
| 79 | + pp.validity_period, | |
| 80 | + pp.quoter_id, | |
| 81 | + pp.quoter_name, | |
| 82 | + pp.long_term_operation, | |
| 83 | + pp.terminal_customer, | |
| 84 | + pp.priced, | |
| 85 | + pp.pricing_deadline, | |
| 86 | + pp.temporary_price, | |
| 87 | + pp.other_expense_settlement, | |
| 88 | + pp.delivery_mode, | |
| 89 | + pp.commodity_buyout, | |
| 90 | + pp.quality_buyout, | |
| 91 | + pp.quantity_buyout, | |
| 92 | + pp.door_delivery, | |
| 93 | + pp.shipping_cost, | |
| 94 | + pp.loading_fee, | |
| 95 | + pp.invoice_product_name, | |
| 96 | + pp.delivery_date, | |
| 97 | + pp.settlement_method, | |
| 98 | + pp.settlement_ratio, | |
| 99 | + pp.price_id, | |
| 100 | + pp.coordination_reason, | |
| 101 | + pp.invoice_type_status, | |
| 102 | + pp.total_quantity, | |
| 103 | + pp.remark, | |
| 104 | + pp.material_condition_enabled, | |
| 105 | + pp.material_condition_copper_rice, | |
| 106 | + pp.material_condition_bright_copper, | |
| 107 | + pp.material_condition_first_class, | |
| 108 | + pp.material_condition_second_class, | |
| 109 | + pp.material_condition_tin_coated, | |
| 110 | + pp.material_condition_scrap, | |
| 111 | + pp.material_condition_white_yellow, | |
| 112 | + pp.material_condition_phosphor_copper, | |
| 113 | + pp.approval_status, | |
| 114 | + pp.process_status, | |
| 115 | + pp.process_node, | |
| 116 | + pp.create_by_id, | |
| 117 | + pp.create_by, | |
| 118 | + pp.update_by_id, | |
| 119 | + pp.update_by, | |
| 120 | + pp.create_time, | |
| 121 | + pp.update_time | |
| 122 | + FROM procurement_plan AS pp | |
| 123 | + LEFT JOIN base_data_company_short AS bdcs ON bdcs.id = pp.company_short_id | |
| 124 | + LEFT JOIN procurement_domestic_customer_credit pdc ON pdc.id = pp.supplier_id | |
| 125 | + LEFT JOIN sys_dept sd ON sd.id = pp.purchase_department | |
| 126 | + LEFT JOIN sys_dept sd1 ON sd1.id = pp.region | |
| 127 | + </sql> | |
| 128 | + | |
| 129 | + <select id="query" resultMap="ProcurementPlan"> | |
| 130 | + <include refid="ProcurementPlan_sql"/> | |
| 131 | + <where> | |
| 132 | + <if test="vo != null"> | |
| 133 | + <if test="vo.code != null and vo.code != ''"> | |
| 134 | + AND pp.code LIKE CONCAT('%', #{vo.code}, '%') | |
| 135 | + </if> | |
| 136 | + <if test="vo.companyShortId != null and vo.companyShortId != ''"> | |
| 137 | + AND pp.company_short_id = #{vo.companyShortId} | |
| 138 | + </if> | |
| 139 | + <if test="vo.companyName != null and vo.companyName != ''"> | |
| 140 | + AND ( | |
| 141 | + bdcs.company_name LIKE CONCAT('%', #{vo.companyName}, '%') | |
| 142 | + OR bdcs.short_name LIKE CONCAT('%', #{vo.companyName}, '%') | |
| 143 | + ) | |
| 144 | + </if> | |
| 145 | + <if test="vo.purchaseDepartment != null and vo.purchaseDepartment != ''"> | |
| 146 | + AND pp.purchase_department = #{vo.purchaseDepartment} | |
| 147 | + </if> | |
| 148 | + <if test="vo.startDate != null"> | |
| 149 | + AND pp.date >= #{vo.startDate} | |
| 150 | + </if> | |
| 151 | + <if test="vo.endDate != null"> | |
| 152 | + <![CDATA[ | |
| 153 | + AND pp.date <= #{vo.endDate} | |
| 154 | + ]]> | |
| 155 | + </if> | |
| 156 | + <if test="vo.supplierId != null and vo.supplierId != ''"> | |
| 157 | + AND pp.supplier_id = #{vo.supplierId} | |
| 158 | + </if> | |
| 159 | + <if test="vo.supplierName != null and vo.supplierName != ''"> | |
| 160 | + AND pdc.unit_name LIKE CONCAT('%', #{vo.supplierName}, '%') | |
| 161 | + </if> | |
| 162 | + <if test="vo.processStatus != null and vo.processStatus != ''"> | |
| 163 | + AND pp.process_status = #{vo.processStatus} | |
| 164 | + </if> | |
| 165 | + <if test="vo.processNode != null and vo.processNode != ''"> | |
| 166 | + AND pp.process_node = #{vo.processNode} | |
| 167 | + </if> | |
| 168 | + </if> | |
| 169 | + </where> | |
| 170 | + ORDER BY pp.create_time DESC | |
| 171 | + </select> | |
| 172 | + | |
| 173 | + <select id="findById" resultMap="ProcurementPlan"> | |
| 174 | + <include refid="ProcurementPlan_sql"/> | |
| 175 | + WHERE pp.id = #{id} | |
| 176 | + </select> | |
| 177 | +</mapper> | ... | ... |
| ... | ... | @@ -48,6 +48,7 @@ |
| 48 | 48 | <result column="status" property="status"/> |
| 49 | 49 | <result column="remark" property="remark"/> |
| 50 | 50 | <result column="reason" property="reason"/> |
| 51 | + <result column="generated_plan" property="generatedPlan"/> | |
| 51 | 52 | <result column="create_by_id" property="createById"/> |
| 52 | 53 | <result column="create_by" property="createBy"/> |
| 53 | 54 | <result column="update_by_id" property="updateById"/> |
| ... | ... | @@ -103,6 +104,7 @@ |
| 103 | 104 | tb.approval_status, |
| 104 | 105 | tb.status, |
| 105 | 106 | tb.reason, |
| 107 | + tb.generated_plan, | |
| 106 | 108 | tb.create_by_id, |
| 107 | 109 | tb.create_by, |
| 108 | 110 | tb.update_by_id, | ... | ... |