Showing
41 changed files
with
3152 additions
and
0 deletions
| @@ -2464,3 +2464,135 @@ CREATE TABLE `base_data_online_price` | @@ -2464,3 +2464,135 @@ CREATE TABLE `base_data_online_price` | ||
| 2464 | PRIMARY KEY (`id`), | 2464 | PRIMARY KEY (`id`), |
| 2465 | UNIQUE KEY `uk_record_date` (`record_date`) | 2465 | UNIQUE KEY `uk_record_date` (`record_date`) |
| 2466 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='基础网价表'; | 2466 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='基础网价表'; |
| 2467 | + | ||
| 2468 | +-- ============================================================ | ||
| 2469 | +-- 过磅码单 | ||
| 2470 | +-- 主表 + 计划明细子表 + 过磅明细子表 + 申请数量明细子表 | ||
| 2471 | +-- 排序规则与 procurement_plan / procurement_plan_line 保持一致,便于关联查询 | ||
| 2472 | +-- ============================================================ | ||
| 2473 | + | ||
| 2474 | +CREATE TABLE IF NOT EXISTS `procurement_weighing_ticket` | ||
| 2475 | +( | ||
| 2476 | + `id` varchar(32) NOT NULL COMMENT 'ID', | ||
| 2477 | + `code` varchar(50) NOT NULL COMMENT '编号(GB+8位时间戳数字,系统自动生成)', | ||
| 2478 | + `type` varchar(50) NOT NULL COMMENT '类型 REGULAR-常规 RETURN-退料换料,默认常规', | ||
| 2479 | + `unit` varchar(20) NOT NULL COMMENT '单位,固定公斤', | ||
| 2480 | + `first_gross_weight_time` datetime DEFAULT NULL COMMENT '时间(以第一次记录货物毛重时间为准,新增时不填,其余页面展示)', | ||
| 2481 | + `supplier_id` varchar(32) DEFAULT NULL COMMENT '供料单位ID(供应商ID,自动带出采购计划)', | ||
| 2482 | + `supplier_name` varchar(200) DEFAULT NULL COMMENT '供料单位名称(自动带出采购计划)', | ||
| 2483 | + `company_short_id` varchar(32) DEFAULT NULL COMMENT '收料单位ID(公司简称ID,自动带出采购计划)', | ||
| 2484 | + `company_short_name` varchar(200) DEFAULT NULL COMMENT '收料单位公司简称名称', | ||
| 2485 | + `workshop_id` varchar(32) DEFAULT NULL COMMENT '收料单位分厂ID(自动带出采购计划)', | ||
| 2486 | + `workshop_name` varchar(200) DEFAULT NULL COMMENT '收料单位分厂名称(收料单位=公司简称+分厂)', | ||
| 2487 | + `buyout` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否买断 0否 1是(取自所选采购计划,多计划须一致;买断时需填写申请数量明细)', | ||
| 2488 | + `material_name` varchar(500) DEFAULT NULL COMMENT '物料名称(自动带出过磅明细的开票品名,去重后数量叠加)', | ||
| 2489 | + `total_gross_weight` decimal(18, 4) DEFAULT NULL COMMENT '过磅总重', | ||
| 2490 | + `actual_impurity_weight` decimal(18, 4) DEFAULT NULL COMMENT '实际伙重', | ||
| 2491 | + `net_weight` decimal(18, 4) DEFAULT NULL COMMENT '货物净重 = 过磅总重 - 实际伙重', | ||
| 2492 | + `net_weight_upper` varchar(200) DEFAULT NULL COMMENT '货物净重大写', | ||
| 2493 | + `deduction_types` varchar(200) DEFAULT NULL COMMENT '来料扣杂类型(多选,逗号分隔:WATER-水杂,BAG-袋伙,STEEL-钢带伙,WOOD-木托伙)', | ||
| 2494 | + `supplier_stock_material` varchar(500) DEFAULT NULL COMMENT '供应存欠料', | ||
| 2495 | + `logistics_stock_material` varchar(500) DEFAULT NULL COMMENT '物流存欠料', | ||
| 2496 | + `plate_number` varchar(50) DEFAULT NULL COMMENT '车牌号', | ||
| 2497 | + `business_summary` text COMMENT '业务摘要(过磅品种+数量+公斤,水杂/袋伙/钢带伙/木托伙,供应存欠料,物流存欠料,车牌号)', | ||
| 2498 | + `special_note` text COMMENT '特别说明', | ||
| 2499 | + `document_remark` text COMMENT '单据备注 = 业务摘要 + 特别说明', | ||
| 2500 | + `approval_status` varchar(50) DEFAULT NULL COMMENT '审核状态 DRAFT-草稿 AUDIT-审核中 PASS-审核通过 REFUSE-已驳回', | ||
| 2501 | + `sign_attachment_file_ids` text COMMENT '签字凭证附件文件ID集合(多文件,逗号分隔,可多次上传)', | ||
| 2502 | + `sign_attachment_file_names` text COMMENT '签字凭证附件文件名称集合(多文件,逗号分隔)', | ||
| 2503 | + `delay_attachment_file_ids` text COMMENT '延期说明附件文件ID集合(多文件,逗号分隔)', | ||
| 2504 | + `delay_attachment_file_names` text COMMENT '延期说明附件文件名称集合(多文件,逗号分隔)', | ||
| 2505 | + `reweigh_attachment_file_ids` text COMMENT '复磅附件文件ID集合(多文件,逗号分隔)', | ||
| 2506 | + `reweigh_attachment_file_names` text COMMENT '复磅附件文件名称集合(多文件,逗号分隔)', | ||
| 2507 | + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否作废/删除 0-有效单 1-作废单(作废单只能查看)', | ||
| 2508 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | ||
| 2509 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 2510 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | ||
| 2511 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | ||
| 2512 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 2513 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 2514 | + PRIMARY KEY (`id`), | ||
| 2515 | + UNIQUE KEY `uk_pwt_code` (`code`), | ||
| 2516 | + KEY `idx_pwt_supplier_id` (`supplier_id`), | ||
| 2517 | + KEY `idx_pwt_company_short_id` (`company_short_id`), | ||
| 2518 | + KEY `idx_pwt_workshop_id` (`workshop_id`), | ||
| 2519 | + KEY `idx_pwt_type` (`type`), | ||
| 2520 | + KEY `idx_pwt_approval_status` (`approval_status`), | ||
| 2521 | + KEY `idx_pwt_first_gross_weight_time` (`first_gross_weight_time`), | ||
| 2522 | + KEY `idx_pwt_create_time` (`create_time`) | ||
| 2523 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='过磅码单主表'; | ||
| 2524 | + | ||
| 2525 | +-- 计划明细子表:所选采购计划(多选,须为已完成且不在变更/补单流程中,非买断买断、供料单位、收料单位一致) | ||
| 2526 | +CREATE TABLE IF NOT EXISTS `procurement_weighing_ticket_plan` | ||
| 2527 | +( | ||
| 2528 | + `id` varchar(32) NOT NULL COMMENT 'ID', | ||
| 2529 | + `weighing_ticket_id` varchar(32) NOT NULL COMMENT '过磅码单主表ID', | ||
| 2530 | + `procurement_plan_id` varchar(32) NOT NULL COMMENT '采购计划ID', | ||
| 2531 | + `procurement_plan_line_id` varchar(32) DEFAULT NULL COMMENT '采购计划明细行ID', | ||
| 2532 | + `plan_code` varchar(50) DEFAULT NULL COMMENT '计划编号(自动带出采购计划)', | ||
| 2533 | + `product_id` varchar(32) DEFAULT NULL COMMENT '计划单品种ID(自动带出采购计划)', | ||
| 2534 | + `quantity` decimal(18, 4) DEFAULT NULL COMMENT '计划数量(自动带出采购计划)', | ||
| 2535 | + `order_no` int DEFAULT NULL COMMENT '排序号', | ||
| 2536 | + `item_id` varchar(32) DEFAULT NULL COMMENT '前端行标识', | ||
| 2537 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | ||
| 2538 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 2539 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | ||
| 2540 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | ||
| 2541 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 2542 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 2543 | + PRIMARY KEY (`id`), | ||
| 2544 | + KEY `idx_pwtp_weighing_ticket_id` (`weighing_ticket_id`), | ||
| 2545 | + KEY `idx_pwtp_procurement_plan_id` (`procurement_plan_id`), | ||
| 2546 | + KEY `idx_pwtp_product_id` (`product_id`) | ||
| 2547 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='过磅码单计划明细子表'; | ||
| 2548 | + | ||
| 2549 | +-- 过磅明细子表:可新增/删除 | ||
| 2550 | +CREATE TABLE IF NOT EXISTS `procurement_weighing_ticket_line` | ||
| 2551 | +( | ||
| 2552 | + `id` varchar(32) NOT NULL COMMENT 'ID', | ||
| 2553 | + `weighing_ticket_id` varchar(32) NOT NULL COMMENT '过磅码单主表ID', | ||
| 2554 | + `procurement_plan_id` varchar(32) DEFAULT NULL COMMENT '采购计划ID(计划编号下拉来源)', | ||
| 2555 | + `plan_code` varchar(50) DEFAULT NULL COMMENT '计划编号(自动带出计划单数据,下拉)', | ||
| 2556 | + `product_id` varchar(32) DEFAULT NULL COMMENT '过磅品种ID(自动带出计划单数据,下拉)', | ||
| 2557 | + `invoice_product_name` varchar(200) DEFAULT NULL COMMENT '开票品名(自动带出)', | ||
| 2558 | + `quantity` decimal(18, 4) DEFAULT NULL COMMENT '过磅数量(自动带出计划单数据,下拉)', | ||
| 2559 | + `order_no` int DEFAULT NULL COMMENT '排序号', | ||
| 2560 | + `item_id` varchar(32) DEFAULT NULL COMMENT '前端行标识', | ||
| 2561 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | ||
| 2562 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 2563 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | ||
| 2564 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | ||
| 2565 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 2566 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 2567 | + PRIMARY KEY (`id`), | ||
| 2568 | + KEY `idx_pwtl_weighing_ticket_id` (`weighing_ticket_id`), | ||
| 2569 | + KEY `idx_pwtl_procurement_plan_id` (`procurement_plan_id`), | ||
| 2570 | + KEY `idx_pwtl_product_id` (`product_id`) | ||
| 2571 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='过磅码单过磅明细子表'; | ||
| 2572 | + | ||
| 2573 | +-- 申请数量明细子表:可新增/删除;是否填写取决于计划是否买断(买断填写,否则为空) | ||
| 2574 | +CREATE TABLE IF NOT EXISTS `procurement_weighing_ticket_apply_line` | ||
| 2575 | +( | ||
| 2576 | + `id` varchar(32) NOT NULL COMMENT 'ID', | ||
| 2577 | + `weighing_ticket_id` varchar(32) NOT NULL COMMENT '过磅码单主表ID', | ||
| 2578 | + `category` varchar(200) DEFAULT NULL COMMENT '类别(下拉,参考品种关系对应表 base_data_breed_relationship)', | ||
| 2579 | + `quantity` decimal(18, 4) DEFAULT NULL COMMENT '数量(保留小数)', | ||
| 2580 | + `order_no` int DEFAULT NULL COMMENT '排序号', | ||
| 2581 | + `item_id` varchar(32) DEFAULT NULL COMMENT '前端行标识', | ||
| 2582 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | ||
| 2583 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 2584 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | ||
| 2585 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | ||
| 2586 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 2587 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 2588 | + PRIMARY KEY (`id`), | ||
| 2589 | + KEY `idx_pwta_weighing_ticket_id` (`weighing_ticket_id`) | ||
| 2590 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='过磅码单申请数量明细子表'; | ||
| 2591 | + | ||
| 2592 | +-- 申请数量明细:并新增品种关系表关联ID | ||
| 2593 | +ALTER TABLE procurement_weighing_ticket_apply_line | ||
| 2594 | + ADD COLUMN breed_relationship_id VARCHAR(32) DEFAULT NULL COMMENT '品种关系表ID(base_data_breed_relationship.id)' AFTER category; | ||
| 2595 | + | ||
| 2596 | +-- 过磅码单主表:新增完成时间(第一次上传签字凭证时间) | ||
| 2597 | +ALTER TABLE procurement_weighing_ticket | ||
| 2598 | + ADD COLUMN complete_time datetime DEFAULT NULL COMMENT '完成时间(第一次上传签字凭证时间)'; |
| 1 | +package com.lframework.xingyun.sc.bo.procurement; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.bo.BaseBo; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketApplyLine; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +public class GetProcurementWeighingTicketApplyLineBo extends BaseBo<ProcurementWeighingTicketApplyLine> { | ||
| 12 | + | ||
| 13 | + @ApiModelProperty("ID") | ||
| 14 | + private String id; | ||
| 15 | + | ||
| 16 | + @ApiModelProperty("品种代号") | ||
| 17 | + private String category; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty("品种关系表ID") | ||
| 20 | + private String breedRelationshipId; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty("数量") | ||
| 23 | + private BigDecimal quantity; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty("排序号") | ||
| 26 | + private Integer orderNo; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty("前端行标识") | ||
| 29 | + private String itemId; | ||
| 30 | + | ||
| 31 | + public GetProcurementWeighingTicketApplyLineBo() { | ||
| 32 | + super(); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public GetProcurementWeighingTicketApplyLineBo(ProcurementWeighingTicketApplyLine dto) { | ||
| 36 | + super(dto); | ||
| 37 | + } | ||
| 38 | +} |
| 1 | +package com.lframework.xingyun.sc.bo.procurement; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.starter.common.constants.StringPool; | ||
| 5 | +import com.lframework.starter.web.core.bo.BaseBo; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicket; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import lombok.Data; | ||
| 9 | + | ||
| 10 | +import java.math.BigDecimal; | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +@Data | ||
| 15 | +public class GetProcurementWeighingTicketBo extends BaseBo<ProcurementWeighingTicket> { | ||
| 16 | + | ||
| 17 | + @ApiModelProperty("ID") | ||
| 18 | + private String id; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty("编号") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty("类型 REGULAR-常规 RETURN-退料换料") | ||
| 24 | + private String type; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty("单位") | ||
| 27 | + private String unit; | ||
| 28 | + | ||
| 29 | + @ApiModelProperty("时间(第一次记录货物毛重时间)") | ||
| 30 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 31 | + private LocalDateTime firstGrossWeightTime; | ||
| 32 | + | ||
| 33 | + @ApiModelProperty("完成时间(第一次上传签字凭证时间)") | ||
| 34 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 35 | + private LocalDateTime completeTime; | ||
| 36 | + | ||
| 37 | + @ApiModelProperty("供料单位ID") | ||
| 38 | + private String supplierId; | ||
| 39 | + | ||
| 40 | + @ApiModelProperty("供料单位名称") | ||
| 41 | + private String supplierName; | ||
| 42 | + | ||
| 43 | + @ApiModelProperty("收料单位公司简称ID") | ||
| 44 | + private String companyShortId; | ||
| 45 | + | ||
| 46 | + @ApiModelProperty("收料单位公司简称名称") | ||
| 47 | + private String companyShortName; | ||
| 48 | + | ||
| 49 | + @ApiModelProperty("收料单位分厂ID") | ||
| 50 | + private String workshopId; | ||
| 51 | + | ||
| 52 | + @ApiModelProperty("收料单位分厂名称") | ||
| 53 | + private String workshopName; | ||
| 54 | + | ||
| 55 | + @ApiModelProperty("收料单位分厂编码") | ||
| 56 | + private String workshopCode; | ||
| 57 | + | ||
| 58 | + @ApiModelProperty("收料单位(公司简称+分厂)") | ||
| 59 | + private String receiveUnitName; | ||
| 60 | + | ||
| 61 | + @ApiModelProperty("是否买断") | ||
| 62 | + private Boolean buyout; | ||
| 63 | + | ||
| 64 | + @ApiModelProperty("物料名称(过磅明细开票品名去重叠加)") | ||
| 65 | + private String materialName; | ||
| 66 | + | ||
| 67 | + @ApiModelProperty("过磅总重") | ||
| 68 | + private BigDecimal totalGrossWeight; | ||
| 69 | + | ||
| 70 | + @ApiModelProperty("实际伙重") | ||
| 71 | + private BigDecimal actualImpurityWeight; | ||
| 72 | + | ||
| 73 | + @ApiModelProperty("货物净重") | ||
| 74 | + private BigDecimal netWeight; | ||
| 75 | + | ||
| 76 | + @ApiModelProperty("货物净重大写") | ||
| 77 | + private String netWeightUpper; | ||
| 78 | + | ||
| 79 | + @ApiModelProperty("来料扣杂类型") | ||
| 80 | + private String deductionTypes; | ||
| 81 | + | ||
| 82 | + @ApiModelProperty("供应存欠料") | ||
| 83 | + private String supplierStockMaterial; | ||
| 84 | + | ||
| 85 | + @ApiModelProperty("物流存欠料") | ||
| 86 | + private String logisticsStockMaterial; | ||
| 87 | + | ||
| 88 | + @ApiModelProperty("车牌号") | ||
| 89 | + private String plateNumber; | ||
| 90 | + | ||
| 91 | + @ApiModelProperty("业务摘要") | ||
| 92 | + private String businessSummary; | ||
| 93 | + | ||
| 94 | + @ApiModelProperty("特别说明") | ||
| 95 | + private String specialNote; | ||
| 96 | + | ||
| 97 | + @ApiModelProperty("单据备注") | ||
| 98 | + private String documentRemark; | ||
| 99 | + | ||
| 100 | + @ApiModelProperty("审核状态 DRAFT/AUDIT/PASS/REFUSE") | ||
| 101 | + private String approvalStatus; | ||
| 102 | + | ||
| 103 | + @ApiModelProperty("签字凭证附件文件ID集合") | ||
| 104 | + private String signAttachmentFileIds; | ||
| 105 | + | ||
| 106 | + @ApiModelProperty("签字凭证附件文件名称集合") | ||
| 107 | + private String signAttachmentFileNames; | ||
| 108 | + | ||
| 109 | + @ApiModelProperty("延期说明附件文件ID集合") | ||
| 110 | + private String delayAttachmentFileIds; | ||
| 111 | + | ||
| 112 | + @ApiModelProperty("延期说明附件文件名称集合") | ||
| 113 | + private String delayAttachmentFileNames; | ||
| 114 | + | ||
| 115 | + @ApiModelProperty("复磅附件文件ID集合") | ||
| 116 | + private String reweighAttachmentFileIds; | ||
| 117 | + | ||
| 118 | + @ApiModelProperty("复磅附件文件名称集合") | ||
| 119 | + private String reweighAttachmentFileNames; | ||
| 120 | + | ||
| 121 | + @ApiModelProperty("是否作废单") | ||
| 122 | + private Boolean deleted; | ||
| 123 | + | ||
| 124 | + @ApiModelProperty("是否展示审核按钮") | ||
| 125 | + private Boolean showExamine; | ||
| 126 | + | ||
| 127 | + @ApiModelProperty("是否展示审核详情按钮") | ||
| 128 | + private Boolean showExamineDetail; | ||
| 129 | + | ||
| 130 | + @ApiModelProperty("创建人") | ||
| 131 | + private String createBy; | ||
| 132 | + | ||
| 133 | + @ApiModelProperty("创建人ID") | ||
| 134 | + private String createById; | ||
| 135 | + | ||
| 136 | + @ApiModelProperty("创建时间") | ||
| 137 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 138 | + private LocalDateTime createTime; | ||
| 139 | + | ||
| 140 | + @ApiModelProperty("计划明细列表") | ||
| 141 | + private List<GetProcurementWeighingTicketPlanBo> planLines; | ||
| 142 | + | ||
| 143 | + @ApiModelProperty("过磅明细列表") | ||
| 144 | + private List<GetProcurementWeighingTicketLineBo> weighLines; | ||
| 145 | + | ||
| 146 | + @ApiModelProperty("申请数量明细列表") | ||
| 147 | + private List<GetProcurementWeighingTicketApplyLineBo> applyLines; | ||
| 148 | + | ||
| 149 | + public GetProcurementWeighingTicketBo() { | ||
| 150 | + super(); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public GetProcurementWeighingTicketBo(ProcurementWeighingTicket dto) { | ||
| 154 | + super(dto); | ||
| 155 | + } | ||
| 156 | +} |
| 1 | +package com.lframework.xingyun.sc.bo.procurement; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.bo.BaseBo; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketLine; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +public class GetProcurementWeighingTicketLineBo extends BaseBo<ProcurementWeighingTicketLine> { | ||
| 12 | + | ||
| 13 | + @ApiModelProperty("ID") | ||
| 14 | + private String id; | ||
| 15 | + | ||
| 16 | + @ApiModelProperty("采购计划ID") | ||
| 17 | + private String procurementPlanId; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty("计划编号") | ||
| 20 | + private String planCode; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty("过磅品种ID") | ||
| 23 | + private String productId; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty("过磅品种名称") | ||
| 26 | + private String productName; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty("开票品名") | ||
| 29 | + private String invoiceProductName; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty("过磅数量") | ||
| 32 | + private BigDecimal quantity; | ||
| 33 | + | ||
| 34 | + @ApiModelProperty("排序号") | ||
| 35 | + private Integer orderNo; | ||
| 36 | + | ||
| 37 | + @ApiModelProperty("前端行标识") | ||
| 38 | + private String itemId; | ||
| 39 | + | ||
| 40 | + public GetProcurementWeighingTicketLineBo() { | ||
| 41 | + super(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public GetProcurementWeighingTicketLineBo(ProcurementWeighingTicketLine dto) { | ||
| 45 | + super(dto); | ||
| 46 | + } | ||
| 47 | +} |
| 1 | +package com.lframework.xingyun.sc.bo.procurement; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.bo.BaseBo; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketPlan; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +public class GetProcurementWeighingTicketPlanBo extends BaseBo<ProcurementWeighingTicketPlan> { | ||
| 12 | + | ||
| 13 | + @ApiModelProperty("ID") | ||
| 14 | + private String id; | ||
| 15 | + | ||
| 16 | + @ApiModelProperty("采购计划ID") | ||
| 17 | + private String procurementPlanId; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty("采购计划明细行ID") | ||
| 20 | + private String procurementPlanLineId; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty("计划编号") | ||
| 23 | + private String planCode; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty("计划单品种ID") | ||
| 26 | + private String productId; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty("计划单品种名称") | ||
| 29 | + private String productName; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty("计划数量") | ||
| 32 | + private BigDecimal quantity; | ||
| 33 | + | ||
| 34 | + @ApiModelProperty("排序号") | ||
| 35 | + private Integer orderNo; | ||
| 36 | + | ||
| 37 | + @ApiModelProperty("前端行标识") | ||
| 38 | + private String itemId; | ||
| 39 | + | ||
| 40 | + public GetProcurementWeighingTicketPlanBo() { | ||
| 41 | + super(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public GetProcurementWeighingTicketPlanBo(ProcurementWeighingTicketPlan dto) { | ||
| 45 | + super(dto); | ||
| 46 | + } | ||
| 47 | +} |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/procurement/WeighingTicketPlanBo.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 io.swagger.annotations.ApiModel; | ||
| 6 | +import io.swagger.annotations.ApiModelProperty; | ||
| 7 | +import lombok.Data; | ||
| 8 | + | ||
| 9 | +import java.io.Serializable; | ||
| 10 | +import java.math.BigDecimal; | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Data | ||
| 14 | +@ApiModel("可关联过磅码单的采购计划") | ||
| 15 | +public class WeighingTicketPlanBo implements Serializable { | ||
| 16 | + | ||
| 17 | + private static final long serialVersionUID = 1L; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty("采购计划ID") | ||
| 20 | + private String id; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty("计划编号") | ||
| 23 | + private String code; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty("公司简称ID") | ||
| 26 | + private String companyShortId; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty("公司名称") | ||
| 29 | + private String companyName; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty("供应商ID") | ||
| 32 | + private String supplierId; | ||
| 33 | + | ||
| 34 | + @ApiModelProperty("供应商名称") | ||
| 35 | + private String supplierName; | ||
| 36 | + | ||
| 37 | + @ApiModelProperty("采购处ID") | ||
| 38 | + private String purchaseDepartment; | ||
| 39 | + | ||
| 40 | + @ApiModelProperty("采购处名称") | ||
| 41 | + private String purchaseDepartmentName; | ||
| 42 | + | ||
| 43 | + @ApiModelProperty("区域ID") | ||
| 44 | + private String region; | ||
| 45 | + | ||
| 46 | + @ApiModelProperty("区域名称") | ||
| 47 | + private String regionName; | ||
| 48 | + | ||
| 49 | + @ApiModelProperty("流程状态") | ||
| 50 | + private String processStatus; | ||
| 51 | + | ||
| 52 | + @ApiModelProperty("计划类型 补单 变更 补单+变更") | ||
| 53 | + private String planType; | ||
| 54 | + | ||
| 55 | + @ApiModelProperty("数量合计") | ||
| 56 | + private BigDecimal totalQuantity; | ||
| 57 | + | ||
| 58 | + @ApiModelProperty("是否买断(通货/质量/数量买断任一为真)") | ||
| 59 | + private Boolean buyout; | ||
| 60 | + | ||
| 61 | + @ApiModelProperty("分厂ID") | ||
| 62 | + private String workshopId; | ||
| 63 | + | ||
| 64 | + @ApiModelProperty("分厂名称") | ||
| 65 | + private String workshopName; | ||
| 66 | + | ||
| 67 | + @ApiModelProperty("创建人") | ||
| 68 | + private String createBy; | ||
| 69 | + | ||
| 70 | + @ApiModelProperty("创建时间") | ||
| 71 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 72 | + private LocalDateTime createTime; | ||
| 73 | +} |
| @@ -28,6 +28,7 @@ import com.lframework.xingyun.sc.procurement.service.credit.ProcurementForeignTr | @@ -28,6 +28,7 @@ import com.lframework.xingyun.sc.procurement.service.credit.ProcurementForeignTr | ||
| 28 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; | 28 | import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; |
| 29 | import com.lframework.xingyun.sc.procurement.service.quotation.SalesmanQuotationService; | 29 | import com.lframework.xingyun.sc.procurement.service.quotation.SalesmanQuotationService; |
| 30 | import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService; | 30 | import com.lframework.xingyun.sc.procurement.service.replenish.ProcurementPlanReplenishService; |
| 31 | +import com.lframework.xingyun.sc.procurement.service.weighing.ProcurementWeighingTicketService; | ||
| 31 | import com.lframework.xingyun.sc.service.contract.ContractDistributorLineService; | 32 | import com.lframework.xingyun.sc.service.contract.ContractDistributorLineService; |
| 32 | import com.lframework.xingyun.sc.service.contract.ContractChangeApplicationService; | 33 | import com.lframework.xingyun.sc.service.contract.ContractChangeApplicationService; |
| 33 | import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; | 34 | import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; |
| @@ -171,6 +172,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -171,6 +172,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 171 | private CoordinationSummaryApprovalService coordinationSummaryApprovalService; | 172 | private CoordinationSummaryApprovalService coordinationSummaryApprovalService; |
| 172 | @Resource | 173 | @Resource |
| 173 | private ProcurementContractService procurementContractService; | 174 | private ProcurementContractService procurementContractService; |
| 175 | + @Resource | ||
| 176 | + private ProcurementWeighingTicketService procurementWeighingTicketService; | ||
| 174 | 177 | ||
| 175 | 178 | ||
| 176 | 179 | ||
| @@ -276,6 +279,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -276,6 +279,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 276 | case "PROCUREMENT_CONTRACT": | 279 | case "PROCUREMENT_CONTRACT": |
| 277 | handleProcurementContractData(flowStatus, businessId); | 280 | handleProcurementContractData(flowStatus, businessId); |
| 278 | break; | 281 | break; |
| 282 | + case "WEIGHING_RECORD": | ||
| 283 | + handleWeighingTicketData(flowStatus, businessId); | ||
| 284 | + break; | ||
| 279 | default: | 285 | default: |
| 280 | break; | 286 | break; |
| 281 | } | 287 | } |
| @@ -1225,4 +1231,21 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -1225,4 +1231,21 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 1225 | procurementContractService.updateApprovalStatus(businessId, "REFUSE"); | 1231 | procurementContractService.updateApprovalStatus(businessId, "REFUSE"); |
| 1226 | } | 1232 | } |
| 1227 | } | 1233 | } |
| 1234 | + | ||
| 1235 | + /** | ||
| 1236 | + * 过磅码单审核业务数据处理 | ||
| 1237 | + * | ||
| 1238 | + * @param flowStatus 审核结果 | ||
| 1239 | + * @param businessId 业务ID | ||
| 1240 | + */ | ||
| 1241 | + private void handleWeighingTicketData(String flowStatus, String businessId) { | ||
| 1242 | + if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) | ||
| 1243 | + || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { | ||
| 1244 | + procurementWeighingTicketService.updateApprovalStatus(businessId, "PASS"); | ||
| 1245 | + } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) | ||
| 1246 | + || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus) | ||
| 1247 | + || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) { | ||
| 1248 | + procurementWeighingTicketService.updateApprovalStatus(businessId, "REFUSE"); | ||
| 1249 | + } | ||
| 1250 | + } | ||
| 1228 | } | 1251 | } |
| 1 | +package com.lframework.xingyun.sc.procurement.controller.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.annotations.security.HasPermission; | ||
| 4 | +import com.lframework.starter.web.core.components.resp.InvokeResult; | ||
| 5 | +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | ||
| 6 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 7 | +import com.lframework.starter.web.core.controller.DefaultBaseController; | ||
| 8 | +import com.lframework.xingyun.sc.bo.procurement.GetProcurementWeighingTicketBo; | ||
| 9 | +import com.lframework.xingyun.sc.bo.procurement.WeighingTicketPlanBo; | ||
| 10 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | ||
| 11 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicket; | ||
| 12 | +import com.lframework.xingyun.sc.procurement.service.weighing.ProcurementWeighingTicketService; | ||
| 13 | +import com.lframework.xingyun.sc.procurement.vo.weighing.CreateProcurementWeighingTicketVo; | ||
| 14 | +import com.lframework.xingyun.sc.procurement.vo.weighing.QueryProcurementWeighingTicketVo; | ||
| 15 | +import com.lframework.xingyun.sc.procurement.vo.weighing.QueryWeighingTicketPlanVo; | ||
| 16 | +import com.lframework.xingyun.sc.procurement.vo.weighing.UpdateProcurementWeighingTicketVo; | ||
| 17 | +import com.lframework.xingyun.sc.procurement.vo.weighing.WeighingTicketAttachmentVo; | ||
| 18 | +import io.swagger.annotations.Api; | ||
| 19 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 20 | +import io.swagger.annotations.ApiOperation; | ||
| 21 | +import java.util.List; | ||
| 22 | +import javax.annotation.Resource; | ||
| 23 | +import javax.validation.Valid; | ||
| 24 | +import javax.validation.constraints.NotBlank; | ||
| 25 | +import lombok.extern.slf4j.Slf4j; | ||
| 26 | +import org.springframework.validation.annotation.Validated; | ||
| 27 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 28 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 29 | +import org.springframework.web.bind.annotation.PutMapping; | ||
| 30 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 31 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 32 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 33 | +import org.springframework.web.bind.annotation.RestController; | ||
| 34 | + | ||
| 35 | +/** | ||
| 36 | + * 过磅码单 | ||
| 37 | + */ | ||
| 38 | +@Api(tags = "过磅码单管理") | ||
| 39 | +@Slf4j | ||
| 40 | +@Validated | ||
| 41 | +@RestController | ||
| 42 | +@RequestMapping("/procurement/weighing/ticket") | ||
| 43 | +public class ProcurementWeighingTicketController extends DefaultBaseController { | ||
| 44 | + | ||
| 45 | + @Resource | ||
| 46 | + private ProcurementWeighingTicketService procurementWeighingTicketService; | ||
| 47 | + | ||
| 48 | + @ApiOperation("分页查询过磅码单") | ||
| 49 | + @HasPermission({"warehouse-manage:weight-ticket:query"}) | ||
| 50 | + @GetMapping("/query") | ||
| 51 | + public InvokeResult<PageResult<ProcurementWeighingTicket>> query( | ||
| 52 | + @Valid QueryProcurementWeighingTicketVo vo) { | ||
| 53 | + PageResult<ProcurementWeighingTicket> result = procurementWeighingTicketService.query( | ||
| 54 | + getPageIndex(vo), getPageSize(vo), vo); | ||
| 55 | + return InvokeResultBuilder.success(result); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @ApiOperation("查询过磅码单详情") | ||
| 59 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) | ||
| 60 | + @HasPermission({"warehouse-manage:weight-ticket:query", "warehouse-manage:weight-ticket:review"}) | ||
| 61 | + @GetMapping("") | ||
| 62 | + public InvokeResult<GetProcurementWeighingTicketBo> findById( | ||
| 63 | + @NotBlank(message = "ID不能为空!") String id) { | ||
| 64 | + return InvokeResultBuilder.success(procurementWeighingTicketService.findDetail(id)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @ApiOperation("分页查询可关联过磅码单的采购计划(新增选择计划弹窗:未冻结、流程已完成、不在变更/补单中)") | ||
| 68 | + @GetMapping("/weighingTicketPlans") | ||
| 69 | + public InvokeResult<PageResult<WeighingTicketPlanBo>> queryWeighingTicketPlans( | ||
| 70 | + @Valid QueryWeighingTicketPlanVo vo) { | ||
| 71 | + PageResult<WeighingTicketPlanBo> result = procurementWeighingTicketService | ||
| 72 | + .queryWeighingTicketPlans(getPageIndex(vo), getPageSize(vo), vo); | ||
| 73 | + return InvokeResultBuilder.success(result); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @ApiOperation("根据多个采购计划ID批量查询计划明细子表数据(选择计划弹窗带出明细)") | ||
| 77 | + @GetMapping("/planLines") | ||
| 78 | + public InvokeResult<List<ProcurementPlanLine>> queryPlanLines(@RequestParam("ids") List<String> ids) { | ||
| 79 | + return InvokeResultBuilder.success(procurementWeighingTicketService.queryPlanLines(ids)); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @ApiOperation("生成下一个可用编号(新增时前端预取)") | ||
| 83 | + @GetMapping("/generateCode") | ||
| 84 | + public InvokeResult<String> generateCode() { | ||
| 85 | + return InvokeResultBuilder.success(procurementWeighingTicketService.generateCode()); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @ApiOperation("新增过磅码单(草稿)") | ||
| 89 | + @HasPermission({"warehouse-manage:weight-ticket:add"}) | ||
| 90 | + @PostMapping("/create") | ||
| 91 | + public InvokeResult<String> create(@RequestBody @Valid CreateProcurementWeighingTicketVo vo) { | ||
| 92 | + return InvokeResultBuilder.success(procurementWeighingTicketService.create(vo)); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + @ApiOperation("修改过磅码单") | ||
| 96 | + @HasPermission({"warehouse-manage:weight-ticket:modify"}) | ||
| 97 | + @PutMapping("") | ||
| 98 | + public InvokeResult<Void> update(@RequestBody @Valid UpdateProcurementWeighingTicketVo vo) { | ||
| 99 | + procurementWeighingTicketService.update(vo); | ||
| 100 | + return InvokeResultBuilder.success(); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + @ApiOperation("提交审核") | ||
| 104 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) | ||
| 105 | + @HasPermission({"warehouse-manage:weight-ticket:submit"}) | ||
| 106 | + @PutMapping("/submit") | ||
| 107 | + public InvokeResult<Void> submit(@NotBlank(message = "ID不能为空!") String id) { | ||
| 108 | + procurementWeighingTicketService.submit(id); | ||
| 109 | + return InvokeResultBuilder.success(); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @ApiOperation("上传签字凭证") | ||
| 113 | + @HasPermission({"warehouse-manage:weight-ticket:uploadSigned"}) | ||
| 114 | + @PutMapping("/attachment/sign") | ||
| 115 | + public InvokeResult<Void> uploadSignAttachment(@RequestBody @Valid WeighingTicketAttachmentVo vo) { | ||
| 116 | + procurementWeighingTicketService.uploadSignAttachment(vo.getId(), vo.getFileIds(), vo.getFileNames()); | ||
| 117 | + return InvokeResultBuilder.success(); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @ApiOperation("上传延期说明附件") | ||
| 121 | + @HasPermission({"warehouse-manage:weight-ticket:uploadExtension"}) | ||
| 122 | + @PutMapping("/attachment/delay") | ||
| 123 | + public InvokeResult<Void> uploadDelayAttachment(@RequestBody @Valid WeighingTicketAttachmentVo vo) { | ||
| 124 | + procurementWeighingTicketService.uploadDelayAttachment(vo.getId(), vo.getFileIds(), vo.getFileNames()); | ||
| 125 | + return InvokeResultBuilder.success(); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + @ApiOperation("上传复磅附件") | ||
| 129 | + @HasPermission({"weighing-manage:weighing-ticket:reweigh"}) | ||
| 130 | + @PutMapping("/attachment/reweigh") | ||
| 131 | + public InvokeResult<Void> uploadReweighAttachment(@RequestBody @Valid WeighingTicketAttachmentVo vo) { | ||
| 132 | + procurementWeighingTicketService.uploadReweighAttachment(vo.getId(), vo.getFileIds(), vo.getFileNames()); | ||
| 133 | + return InvokeResultBuilder.success(); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + @ApiOperation("作废过磅码单") | ||
| 137 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) | ||
| 138 | + @HasPermission({"warehouse-manage:weight-ticket:cancel"}) | ||
| 139 | + @PutMapping("/delete") | ||
| 140 | + public InvokeResult<Void> delete(@NotBlank(message = "ID不能为空!") String id) { | ||
| 141 | + procurementWeighingTicketService.delete(id); | ||
| 142 | + return InvokeResultBuilder.success(); | ||
| 143 | + } | ||
| 144 | +} |
| @@ -28,6 +28,12 @@ public class ProcurementPlanLine extends BaseEntity implements BaseDto { | @@ -28,6 +28,12 @@ public class ProcurementPlanLine extends BaseEntity implements BaseDto { | ||
| 28 | private String procurementPlanId; | 28 | private String procurementPlanId; |
| 29 | 29 | ||
| 30 | /** | 30 | /** |
| 31 | + * 采购计划编号 | ||
| 32 | + */ | ||
| 33 | + @TableField(exist = false) | ||
| 34 | + private String planCode; | ||
| 35 | + | ||
| 36 | + /** | ||
| 31 | * 采购主计划明细表ID | 37 | * 采购主计划明细表ID |
| 32 | */ | 38 | */ |
| 33 | private String procurementPlanLineId; | 39 | private String procurementPlanLineId; |
| 1 | +package com.lframework.xingyun.sc.procurement.entity.weighing; | ||
| 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 | +/** | ||
| 14 | + * 过磅码单主表 | ||
| 15 | + */ | ||
| 16 | +@Data | ||
| 17 | +@TableName("procurement_weighing_ticket") | ||
| 18 | +public class ProcurementWeighingTicket extends BaseEntity implements BaseDto { | ||
| 19 | + | ||
| 20 | + private static final long serialVersionUID = 1L; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 主键ID | ||
| 24 | + */ | ||
| 25 | + private String id; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 编号(GB+8位时间戳数字,系统自动生成) | ||
| 29 | + */ | ||
| 30 | + private String code; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 类型 REGULAR-常规 RETURN-退料换料,默认常规 | ||
| 34 | + */ | ||
| 35 | + private String type; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 单位,固定公斤 | ||
| 39 | + */ | ||
| 40 | + private String unit; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 时间(以第一次记录货物毛重时间为准:新增/修改时首次填写过磅总重的时间点) | ||
| 44 | + */ | ||
| 45 | + private LocalDateTime firstGrossWeightTime; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 完成时间(第一次上传签字凭证时间) | ||
| 49 | + */ | ||
| 50 | + private LocalDateTime completeTime; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 供料单位ID(供应商ID,自动带出采购计划) | ||
| 54 | + */ | ||
| 55 | + private String supplierId; | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 供料单位名称 | ||
| 59 | + */ | ||
| 60 | + private String supplierName; | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 收料单位ID(公司简称ID) | ||
| 64 | + */ | ||
| 65 | + private String companyShortId; | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 收料单位公司简称名称 | ||
| 69 | + */ | ||
| 70 | + private String companyShortName; | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 收料单位分厂ID | ||
| 74 | + */ | ||
| 75 | + private String workshopId; | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 收料单位分厂名称(收料单位=公司简称+分厂) | ||
| 79 | + */ | ||
| 80 | + private String workshopName; | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * 收料单位分厂编码 | ||
| 84 | + */ | ||
| 85 | + @TableField(exist = false) | ||
| 86 | + private String workshopCode; | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 是否买断 0否 1是(取自所选采购计划,多计划须一致;买断时需填写申请数量明细) | ||
| 90 | + */ | ||
| 91 | + private Boolean buyout; | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * 物料名称(自动带出过磅明细的开票品名,去重后数量叠加) | ||
| 95 | + */ | ||
| 96 | + private String materialName; | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * 过磅总重 | ||
| 100 | + */ | ||
| 101 | + private BigDecimal totalGrossWeight; | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 实际伙重 | ||
| 105 | + */ | ||
| 106 | + private BigDecimal actualImpurityWeight; | ||
| 107 | + | ||
| 108 | + /** | ||
| 109 | + * 货物净重 = 过磅总重 - 实际伙重 | ||
| 110 | + */ | ||
| 111 | + private BigDecimal netWeight; | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * 货物净重大写 | ||
| 115 | + */ | ||
| 116 | + private String netWeightUpper; | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * 来料扣杂类型(多选,逗号分隔:WATER-水杂,BAG-袋伙,STEEL-钢带伙,WOOD-木托伙) | ||
| 120 | + */ | ||
| 121 | + private String deductionTypes; | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * 供应存欠料 | ||
| 125 | + */ | ||
| 126 | + private String supplierStockMaterial; | ||
| 127 | + | ||
| 128 | + /** | ||
| 129 | + * 物流存欠料 | ||
| 130 | + */ | ||
| 131 | + private String logisticsStockMaterial; | ||
| 132 | + | ||
| 133 | + /** | ||
| 134 | + * 车牌号 | ||
| 135 | + */ | ||
| 136 | + private String plateNumber; | ||
| 137 | + | ||
| 138 | + /** | ||
| 139 | + * 业务摘要 | ||
| 140 | + */ | ||
| 141 | + private String businessSummary; | ||
| 142 | + | ||
| 143 | + /** | ||
| 144 | + * 特别说明 | ||
| 145 | + */ | ||
| 146 | + private String specialNote; | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * 单据备注 = 业务摘要 + 特别说明 | ||
| 150 | + */ | ||
| 151 | + private String documentRemark; | ||
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * 审核状态 DRAFT-草稿 AUDIT-审核中 PASS-审核通过 REFUSE-已驳回 | ||
| 155 | + */ | ||
| 156 | + private String approvalStatus; | ||
| 157 | + | ||
| 158 | + /** | ||
| 159 | + * 签字凭证附件文件ID集合(多文件,逗号分隔,可多次上传) | ||
| 160 | + */ | ||
| 161 | + private String signAttachmentFileIds; | ||
| 162 | + | ||
| 163 | + /** | ||
| 164 | + * 签字凭证附件文件名称集合 | ||
| 165 | + */ | ||
| 166 | + private String signAttachmentFileNames; | ||
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * 延期说明附件文件ID集合 | ||
| 170 | + */ | ||
| 171 | + private String delayAttachmentFileIds; | ||
| 172 | + | ||
| 173 | + /** | ||
| 174 | + * 延期说明附件文件名称集合 | ||
| 175 | + */ | ||
| 176 | + private String delayAttachmentFileNames; | ||
| 177 | + | ||
| 178 | + /** | ||
| 179 | + * 复磅附件文件ID集合 | ||
| 180 | + */ | ||
| 181 | + private String reweighAttachmentFileIds; | ||
| 182 | + | ||
| 183 | + /** | ||
| 184 | + * 复磅附件文件名称集合 | ||
| 185 | + */ | ||
| 186 | + private String reweighAttachmentFileNames; | ||
| 187 | + | ||
| 188 | + /** | ||
| 189 | + * 是否作废/删除 0-有效单 1-作废单(作废单只能查看) | ||
| 190 | + */ | ||
| 191 | + private Boolean deleted; | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * 创建人ID | ||
| 195 | + */ | ||
| 196 | + @TableField(fill = FieldFill.INSERT) | ||
| 197 | + private String createById; | ||
| 198 | + | ||
| 199 | + /** | ||
| 200 | + * 创建人 | ||
| 201 | + */ | ||
| 202 | + @TableField(fill = FieldFill.INSERT) | ||
| 203 | + private String createBy; | ||
| 204 | + | ||
| 205 | + /** | ||
| 206 | + * 更新人ID | ||
| 207 | + */ | ||
| 208 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 209 | + private String updateById; | ||
| 210 | + | ||
| 211 | + /** | ||
| 212 | + * 更新人 | ||
| 213 | + */ | ||
| 214 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 215 | + private String updateBy; | ||
| 216 | + | ||
| 217 | + /** | ||
| 218 | + * 创建时间 | ||
| 219 | + */ | ||
| 220 | + @TableField(fill = FieldFill.INSERT) | ||
| 221 | + private LocalDateTime createTime; | ||
| 222 | + | ||
| 223 | + /** | ||
| 224 | + * 更新时间 | ||
| 225 | + */ | ||
| 226 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 227 | + private LocalDateTime updateTime; | ||
| 228 | + | ||
| 229 | + /** | ||
| 230 | + * 计划编号集合(列表展示用,GROUP_CONCAT 聚合,非持久化) | ||
| 231 | + */ | ||
| 232 | + @TableField(exist = false) | ||
| 233 | + private String planCodes; | ||
| 234 | + | ||
| 235 | + /** | ||
| 236 | + * 计划ID集合(列表展示用,GROUP_CONCAT 聚合,非持久化) | ||
| 237 | + */ | ||
| 238 | + @TableField(exist = false) | ||
| 239 | + private String planIds; | ||
| 240 | + | ||
| 241 | + /** | ||
| 242 | + * 是否展示审核按钮(非持久化) | ||
| 243 | + */ | ||
| 244 | + @TableField(exist = false) | ||
| 245 | + private Boolean showExamine = false; | ||
| 246 | + | ||
| 247 | + /** | ||
| 248 | + * 是否展示审核详情按钮(非持久化) | ||
| 249 | + */ | ||
| 250 | + @TableField(exist = false) | ||
| 251 | + private Boolean showExamineDetail = false; | ||
| 252 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.entity.weighing; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import com.lframework.starter.web.core.dto.BaseDto; | ||
| 7 | +import com.lframework.starter.web.core.entity.BaseEntity; | ||
| 8 | +import lombok.Data; | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +@Data | ||
| 13 | +@TableName("procurement_weighing_ticket_apply_line") | ||
| 14 | +public class ProcurementWeighingTicketApplyLine extends BaseEntity implements BaseDto { | ||
| 15 | + | ||
| 16 | + private static final long serialVersionUID = 1L; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 主键ID | ||
| 20 | + */ | ||
| 21 | + private String id; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 过磅码单主表ID | ||
| 25 | + */ | ||
| 26 | + private String weighingTicketId; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 品种代号(base_data_breed_relationship.code) | ||
| 30 | + */ | ||
| 31 | + private String category; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 品种关系表ID(base_data_breed_relationship.id) | ||
| 35 | + */ | ||
| 36 | + private String breedRelationshipId; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 数量 | ||
| 40 | + */ | ||
| 41 | + private BigDecimal quantity; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 排序号 | ||
| 45 | + */ | ||
| 46 | + private Integer orderNo; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 前端行标识 | ||
| 50 | + */ | ||
| 51 | + private String itemId; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 创建人ID | ||
| 55 | + */ | ||
| 56 | + @TableField(fill = FieldFill.INSERT) | ||
| 57 | + private String createById; | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 创建人 | ||
| 61 | + */ | ||
| 62 | + @TableField(fill = FieldFill.INSERT) | ||
| 63 | + private String createBy; | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 更新人ID | ||
| 67 | + */ | ||
| 68 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 69 | + private String updateById; | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 更新人 | ||
| 73 | + */ | ||
| 74 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 75 | + private String updateBy; | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 创建时间 | ||
| 79 | + */ | ||
| 80 | + @TableField(fill = FieldFill.INSERT) | ||
| 81 | + private LocalDateTime createTime; | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 更新时间 | ||
| 85 | + */ | ||
| 86 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 87 | + private LocalDateTime updateTime; | ||
| 88 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.entity.weighing; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import com.lframework.starter.web.core.dto.BaseDto; | ||
| 7 | +import com.lframework.starter.web.core.entity.BaseEntity; | ||
| 8 | +import lombok.Data; | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +@Data | ||
| 13 | +@TableName("procurement_weighing_ticket_line") | ||
| 14 | +public class ProcurementWeighingTicketLine extends BaseEntity implements BaseDto { | ||
| 15 | + | ||
| 16 | + private static final long serialVersionUID = 1L; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 主键ID | ||
| 20 | + */ | ||
| 21 | + private String id; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 过磅码单主表ID | ||
| 25 | + */ | ||
| 26 | + private String weighingTicketId; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 采购计划ID(计划编号下拉来源) | ||
| 30 | + */ | ||
| 31 | + private String procurementPlanId; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 计划编号 | ||
| 35 | + */ | ||
| 36 | + private String planCode; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 过磅品种ID | ||
| 40 | + */ | ||
| 41 | + private String productId; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 品种名称(冗余,JOIN base_data_breed_relationship) | ||
| 45 | + */ | ||
| 46 | + @TableField(exist = false) | ||
| 47 | + private String productName; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 开票品名 | ||
| 51 | + */ | ||
| 52 | + private String invoiceProductName; | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 过磅数量 | ||
| 56 | + */ | ||
| 57 | + private BigDecimal quantity; | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 排序号 | ||
| 61 | + */ | ||
| 62 | + private Integer orderNo; | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 前端行标识 | ||
| 66 | + */ | ||
| 67 | + private String itemId; | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 创建人ID | ||
| 71 | + */ | ||
| 72 | + @TableField(fill = FieldFill.INSERT) | ||
| 73 | + private String createById; | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 创建人 | ||
| 77 | + */ | ||
| 78 | + @TableField(fill = FieldFill.INSERT) | ||
| 79 | + private String createBy; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 更新人ID | ||
| 83 | + */ | ||
| 84 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 85 | + private String updateById; | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * 更新人 | ||
| 89 | + */ | ||
| 90 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 91 | + private String updateBy; | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * 创建时间 | ||
| 95 | + */ | ||
| 96 | + @TableField(fill = FieldFill.INSERT) | ||
| 97 | + private LocalDateTime createTime; | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * 更新时间 | ||
| 101 | + */ | ||
| 102 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 103 | + private LocalDateTime updateTime; | ||
| 104 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.entity.weighing; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import com.lframework.starter.web.core.dto.BaseDto; | ||
| 7 | +import com.lframework.starter.web.core.entity.BaseEntity; | ||
| 8 | +import lombok.Data; | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +@Data | ||
| 13 | +@TableName("procurement_weighing_ticket_plan") | ||
| 14 | +public class ProcurementWeighingTicketPlan extends BaseEntity implements BaseDto { | ||
| 15 | + | ||
| 16 | + private static final long serialVersionUID = 1L; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 主键ID | ||
| 20 | + */ | ||
| 21 | + private String id; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 过磅码单主表ID | ||
| 25 | + */ | ||
| 26 | + private String weighingTicketId; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 采购计划ID | ||
| 30 | + */ | ||
| 31 | + private String procurementPlanId; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 采购计划明细行ID | ||
| 35 | + */ | ||
| 36 | + private String procurementPlanLineId; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 计划编号(自动带出采购计划) | ||
| 40 | + */ | ||
| 41 | + private String planCode; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 计划单品种ID(自动带出采购计划) | ||
| 45 | + */ | ||
| 46 | + private String productId; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 品种名称(冗余,JOIN base_data_breed_relationship) | ||
| 50 | + */ | ||
| 51 | + @TableField(exist = false) | ||
| 52 | + private String productName; | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 计划数量(自动带出采购计划) | ||
| 56 | + */ | ||
| 57 | + private BigDecimal quantity; | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 排序号 | ||
| 61 | + */ | ||
| 62 | + private Integer orderNo; | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 前端行标识 | ||
| 66 | + */ | ||
| 67 | + private String itemId; | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 创建人ID | ||
| 71 | + */ | ||
| 72 | + @TableField(fill = FieldFill.INSERT) | ||
| 73 | + private String createById; | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 创建人 | ||
| 77 | + */ | ||
| 78 | + @TableField(fill = FieldFill.INSERT) | ||
| 79 | + private String createBy; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 更新人ID | ||
| 83 | + */ | ||
| 84 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 85 | + private String updateById; | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * 更新人 | ||
| 89 | + */ | ||
| 90 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 91 | + private String updateBy; | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * 创建时间 | ||
| 95 | + */ | ||
| 96 | + @TableField(fill = FieldFill.INSERT) | ||
| 97 | + private LocalDateTime createTime; | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * 更新时间 | ||
| 101 | + */ | ||
| 102 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 103 | + private LocalDateTime updateTime; | ||
| 104 | +} |
| @@ -19,6 +19,11 @@ public class ProcurementPlanLineServiceImpl extends | @@ -19,6 +19,11 @@ public class ProcurementPlanLineServiceImpl extends | ||
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | @Override | 21 | @Override |
| 22 | + public List<ProcurementPlanLine> getByProcurementPlanIds(List<String> procurementPlanIds) { | ||
| 23 | + return getBaseMapper().getByProcurementPlanIds(procurementPlanIds); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @Override | ||
| 22 | public int deleteByProcurementPlanId(String procurementPlanId) { | 27 | public int deleteByProcurementPlanId(String procurementPlanId) { |
| 23 | return getBaseMapper().deleteByProcurementPlanId(procurementPlanId); | 28 | return getBaseMapper().deleteByProcurementPlanId(procurementPlanId); |
| 24 | } | 29 | } |
| 1 | +package com.lframework.xingyun.sc.procurement.impl.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketApplyLine; | ||
| 5 | +import com.lframework.xingyun.sc.procurement.mappers.weighing.ProcurementWeighingTicketApplyLineMapper; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.service.weighing.ProcurementWeighingTicketApplyLineService; | ||
| 7 | +import java.util.List; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | + | ||
| 10 | +@Service | ||
| 11 | +public class ProcurementWeighingTicketApplyLineServiceImpl | ||
| 12 | + extends BaseMpServiceImpl<ProcurementWeighingTicketApplyLineMapper, ProcurementWeighingTicketApplyLine> | ||
| 13 | + implements ProcurementWeighingTicketApplyLineService { | ||
| 14 | + | ||
| 15 | + @Override | ||
| 16 | + public List<ProcurementWeighingTicketApplyLine> getByWeighingTicketId(String weighingTicketId) { | ||
| 17 | + return getBaseMapper().getByWeighingTicketId(weighingTicketId); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public void deleteByWeighingTicketId(String weighingTicketId) { | ||
| 22 | + getBaseMapper().deleteByWeighingTicketId(weighingTicketId); | ||
| 23 | + } | ||
| 24 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.impl.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketLine; | ||
| 5 | +import com.lframework.xingyun.sc.procurement.mappers.weighing.ProcurementWeighingTicketLineMapper; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.service.weighing.ProcurementWeighingTicketLineService; | ||
| 7 | +import java.util.List; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | + | ||
| 10 | +@Service | ||
| 11 | +public class ProcurementWeighingTicketLineServiceImpl | ||
| 12 | + extends BaseMpServiceImpl<ProcurementWeighingTicketLineMapper, ProcurementWeighingTicketLine> | ||
| 13 | + implements ProcurementWeighingTicketLineService { | ||
| 14 | + | ||
| 15 | + @Override | ||
| 16 | + public List<ProcurementWeighingTicketLine> getByWeighingTicketId(String weighingTicketId) { | ||
| 17 | + return getBaseMapper().getByWeighingTicketId(weighingTicketId); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public void deleteByWeighingTicketId(String weighingTicketId) { | ||
| 22 | + getBaseMapper().deleteByWeighingTicketId(weighingTicketId); | ||
| 23 | + } | ||
| 24 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.impl.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketPlan; | ||
| 5 | +import com.lframework.xingyun.sc.procurement.mappers.weighing.ProcurementWeighingTicketPlanMapper; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.service.weighing.ProcurementWeighingTicketPlanService; | ||
| 7 | +import java.util.List; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | + | ||
| 10 | +@Service | ||
| 11 | +public class ProcurementWeighingTicketPlanServiceImpl | ||
| 12 | + extends BaseMpServiceImpl<ProcurementWeighingTicketPlanMapper, ProcurementWeighingTicketPlan> | ||
| 13 | + implements ProcurementWeighingTicketPlanService { | ||
| 14 | + | ||
| 15 | + @Override | ||
| 16 | + public List<ProcurementWeighingTicketPlan> getByWeighingTicketId(String weighingTicketId) { | ||
| 17 | + return getBaseMapper().getByWeighingTicketId(weighingTicketId); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public void deleteByWeighingTicketId(String weighingTicketId) { | ||
| 22 | + getBaseMapper().deleteByWeighingTicketId(weighingTicketId); | ||
| 23 | + } | ||
| 24 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.impl.weighing; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.bean.BeanUtil; | ||
| 4 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
| 5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
| 6 | +import com.github.pagehelper.PageInfo; | ||
| 7 | +import com.lframework.starter.bpm.dto.FlowTaskDto; | ||
| 8 | +import com.lframework.starter.bpm.entity.FlowInstanceWrapper; | ||
| 9 | +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper; | ||
| 10 | +import com.lframework.starter.bpm.service.FlowInstanceWrapperService; | ||
| 11 | +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; | ||
| 12 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | ||
| 13 | +import com.lframework.starter.common.exceptions.impl.InputErrorException; | ||
| 14 | +import com.lframework.starter.common.utils.Assert; | ||
| 15 | +import com.lframework.starter.common.utils.CollectionUtil; | ||
| 16 | +import com.lframework.starter.common.utils.StringUtil; | ||
| 17 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | ||
| 18 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 19 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | ||
| 20 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 21 | +import com.lframework.starter.web.core.utils.IdUtil; | ||
| 22 | +import com.lframework.starter.web.core.utils.OpLogUtil; | ||
| 23 | +import com.lframework.starter.web.core.utils.PageHelperUtil; | ||
| 24 | +import com.lframework.starter.web.core.utils.PageResultUtil; | ||
| 25 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | ||
| 26 | +import com.lframework.xingyun.sc.bo.procurement.GetProcurementWeighingTicketApplyLineBo; | ||
| 27 | +import com.lframework.xingyun.sc.bo.procurement.GetProcurementWeighingTicketBo; | ||
| 28 | +import com.lframework.xingyun.sc.bo.procurement.GetProcurementWeighingTicketLineBo; | ||
| 29 | +import com.lframework.xingyun.sc.bo.procurement.GetProcurementWeighingTicketPlanBo; | ||
| 30 | +import com.lframework.xingyun.sc.bo.procurement.WeighingTicketPlanBo; | ||
| 31 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | ||
| 32 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | ||
| 33 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicket; | ||
| 34 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketApplyLine; | ||
| 35 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketLine; | ||
| 36 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketPlan; | ||
| 37 | +import com.lframework.xingyun.sc.procurement.mappers.weighing.ProcurementWeighingTicketMapper; | ||
| 38 | +import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanLineService; | ||
| 39 | +import com.lframework.xingyun.sc.procurement.service.weighing.ProcurementWeighingTicketApplyLineService; | ||
| 40 | +import com.lframework.xingyun.sc.procurement.service.weighing.ProcurementWeighingTicketLineService; | ||
| 41 | +import com.lframework.xingyun.sc.procurement.service.weighing.ProcurementWeighingTicketPlanService; | ||
| 42 | +import com.lframework.xingyun.sc.procurement.service.weighing.ProcurementWeighingTicketService; | ||
| 43 | +import com.lframework.xingyun.sc.procurement.vo.weighing.CreateProcurementWeighingTicketVo; | ||
| 44 | +import com.lframework.xingyun.sc.procurement.vo.weighing.QueryProcurementWeighingTicketVo; | ||
| 45 | +import com.lframework.xingyun.sc.procurement.vo.weighing.QueryWeighingTicketPlanVo; | ||
| 46 | +import com.lframework.xingyun.sc.procurement.vo.weighing.UpdateProcurementWeighingTicketVo; | ||
| 47 | +import com.lframework.xingyun.sc.procurement.vo.weighing.WeighingTicketApplyLineVo; | ||
| 48 | +import com.lframework.xingyun.sc.procurement.vo.weighing.WeighingTicketWeighLineVo; | ||
| 49 | +import java.math.BigDecimal; | ||
| 50 | +import java.time.LocalDate; | ||
| 51 | +import java.time.LocalDateTime; | ||
| 52 | +import java.time.format.DateTimeFormatter; | ||
| 53 | +import java.util.ArrayList; | ||
| 54 | +import java.util.Collections; | ||
| 55 | +import java.util.Comparator; | ||
| 56 | +import java.util.HashMap; | ||
| 57 | +import java.util.HashSet; | ||
| 58 | +import java.util.LinkedHashSet; | ||
| 59 | +import java.util.List; | ||
| 60 | +import java.util.Map; | ||
| 61 | +import java.util.Objects; | ||
| 62 | +import java.util.Set; | ||
| 63 | +import java.util.stream.Collectors; | ||
| 64 | +import javax.annotation.Resource; | ||
| 65 | +import lombok.extern.slf4j.Slf4j; | ||
| 66 | +import org.springframework.stereotype.Service; | ||
| 67 | +import org.springframework.transaction.annotation.Transactional; | ||
| 68 | + | ||
| 69 | +/** | ||
| 70 | + * 过磅码单 | ||
| 71 | + */ | ||
| 72 | +@Slf4j | ||
| 73 | +@Service | ||
| 74 | +public class ProcurementWeighingTicketServiceImpl | ||
| 75 | + extends BaseMpServiceImpl<ProcurementWeighingTicketMapper, ProcurementWeighingTicket> | ||
| 76 | + implements ProcurementWeighingTicketService { | ||
| 77 | + | ||
| 78 | + /** 类型-常规 */ | ||
| 79 | + private static final String TYPE_REGULAR = "REGULAR"; | ||
| 80 | + /** 编号前缀 */ | ||
| 81 | + private static final String CODE_PREFIX = "GB"; | ||
| 82 | + /** 编号日期部分格式 */ | ||
| 83 | + private static final DateTimeFormatter DATE_CODE_FORMATTER = DateTimeFormatter.ofPattern("yyMMdd"); | ||
| 84 | + | ||
| 85 | + /** 审核状态-草稿 */ | ||
| 86 | + private static final String STATUS_DRAFT = "DRAFT"; | ||
| 87 | + /** 审核状态-审核中 */ | ||
| 88 | + private static final String STATUS_AUDIT = "AUDIT"; | ||
| 89 | + /** 审核状态-审核通过 */ | ||
| 90 | + private static final String STATUS_PASS = "PASS"; | ||
| 91 | + /** 审核状态-已驳回 */ | ||
| 92 | + private static final String STATUS_REFUSE = "REFUSE"; | ||
| 93 | + private static final String BPM_FLAG = "WEIGHING_RECORD"; | ||
| 94 | + | ||
| 95 | + @Resource | ||
| 96 | + private ProcurementWeighingTicketMapper weighingTicketMapper; | ||
| 97 | + @Resource | ||
| 98 | + private ProcurementWeighingTicketPlanService planLineService; | ||
| 99 | + @Resource | ||
| 100 | + private ProcurementWeighingTicketLineService weighLineService; | ||
| 101 | + @Resource | ||
| 102 | + private ProcurementWeighingTicketApplyLineService applyLineService; | ||
| 103 | + @Resource | ||
| 104 | + private ProcurementPlanLineService procurementPlanLineService; | ||
| 105 | + @Resource | ||
| 106 | + private FlowInstanceWrapperService flowInstanceWrapperService; | ||
| 107 | + @Resource | ||
| 108 | + private FlowTaskWrapperMapper flowTaskWrapperMapper; | ||
| 109 | + | ||
| 110 | + @Override | ||
| 111 | + public PageResult<ProcurementWeighingTicket> query(Integer pageIndex, Integer pageSize, | ||
| 112 | + QueryProcurementWeighingTicketVo vo) { | ||
| 113 | + Assert.greaterThanZero(pageIndex); | ||
| 114 | + Assert.greaterThanZero(pageSize); | ||
| 115 | + | ||
| 116 | + PageHelperUtil.startPage(pageIndex, pageSize); | ||
| 117 | + List<ProcurementWeighingTicket> datas = this.query(vo); | ||
| 118 | + if (CollectionUtil.isNotEmpty(datas)) { | ||
| 119 | + fillOperateFlags(datas); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + return PageResultUtil.convert(new PageInfo<>(datas)); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + @Override | ||
| 126 | + public List<ProcurementWeighingTicket> query(QueryProcurementWeighingTicketVo vo) { | ||
| 127 | + return weighingTicketMapper.query(vo); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + @Override | ||
| 131 | + public GetProcurementWeighingTicketBo findDetail(String id) { | ||
| 132 | + if (StringUtil.isBlank(id)) { | ||
| 133 | + throw new InputErrorException("ID不能为空!"); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + ProcurementWeighingTicket entity = weighingTicketMapper.findById(id); | ||
| 137 | + if (entity == null) { | ||
| 138 | + throw new DefaultClientException("过磅码单不存在!"); | ||
| 139 | + } | ||
| 140 | + fillOperateFlags(Collections.singletonList(entity)); | ||
| 141 | + | ||
| 142 | + GetProcurementWeighingTicketBo bo = new GetProcurementWeighingTicketBo(entity); | ||
| 143 | + bo.convert(entity); | ||
| 144 | + | ||
| 145 | + // 收料单位 = 公司简称 + 分厂 | ||
| 146 | + String receiveUnitName = StringUtil.isBlank(entity.getCompanyShortName()) ? "" : entity.getCompanyShortName(); | ||
| 147 | + if (StringUtil.isNotBlank(entity.getWorkshopName())) { | ||
| 148 | + receiveUnitName = receiveUnitName + entity.getWorkshopName(); | ||
| 149 | + } | ||
| 150 | + bo.setReceiveUnitName(receiveUnitName); | ||
| 151 | + | ||
| 152 | + List<ProcurementWeighingTicketPlan> plans = planLineService.getByWeighingTicketId(id); | ||
| 153 | + bo.setPlanLines(CollectionUtil.isEmpty(plans) ? new ArrayList<>() : plans.stream() | ||
| 154 | + .map(GetProcurementWeighingTicketPlanBo::new).collect(Collectors.toList())); | ||
| 155 | + | ||
| 156 | + List<ProcurementWeighingTicketLine> weighs = weighLineService.getByWeighingTicketId(id); | ||
| 157 | + bo.setWeighLines(CollectionUtil.isEmpty(weighs) ? new ArrayList<>() : weighs.stream() | ||
| 158 | + .map(GetProcurementWeighingTicketLineBo::new).collect(Collectors.toList())); | ||
| 159 | + | ||
| 160 | + List<ProcurementWeighingTicketApplyLine> applies = applyLineService.getByWeighingTicketId(id); | ||
| 161 | + bo.setApplyLines(CollectionUtil.isEmpty(applies) ? new ArrayList<>() : applies.stream() | ||
| 162 | + .map(GetProcurementWeighingTicketApplyLineBo::new).collect(Collectors.toList())); | ||
| 163 | + | ||
| 164 | + return bo; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + @Override | ||
| 168 | + @Transactional(rollbackFor = Exception.class) | ||
| 169 | + @OpLog(type = OtherOpLogType.class, name = "新增过磅码单,ID:{}", params = {"#result"}) | ||
| 170 | + public String create(CreateProcurementWeighingTicketVo vo) { | ||
| 171 | + // 1. 校验所选采购计划(状态合法 + 全部存在 + 供收料单位与买断一致) | ||
| 172 | + List<ProcurementPlan> plans = validateAndLoadPlans(vo.getPlanIds()); | ||
| 173 | + | ||
| 174 | + ProcurementPlan first = plans.get(0); | ||
| 175 | + | ||
| 176 | + ProcurementWeighingTicket entity = new ProcurementWeighingTicket(); | ||
| 177 | + BeanUtil.copyProperties(vo, entity); | ||
| 178 | + entity.setId(IdUtil.getId()); | ||
| 179 | + // 编号由前端预取后传入,入库前校验唯一性(不过滤 deleted,避免与作废单据重复) | ||
| 180 | + if (this.count(Wrappers.lambdaQuery(ProcurementWeighingTicket.class) | ||
| 181 | + .eq(ProcurementWeighingTicket::getCode, vo.getCode())) > 0) { | ||
| 182 | + throw new DefaultClientException("编号已存在,请重新获取编号后再提交!"); | ||
| 183 | + } | ||
| 184 | + entity.setCode(vo.getCode()); | ||
| 185 | + entity.setType(StringUtil.isBlank(vo.getType()) ? TYPE_REGULAR : vo.getType()); | ||
| 186 | + // 第一次记录货物毛重时间:新增时填写了过磅总重,则以新增时间为准 | ||
| 187 | + if (vo.getTotalGrossWeight() != null) { | ||
| 188 | + entity.setFirstGrossWeightTime(LocalDateTime.now()); | ||
| 189 | + } else { | ||
| 190 | + entity.setFirstGrossWeightTime(null); | ||
| 191 | + } | ||
| 192 | + entity.setSupplierId(first.getSupplierId()); | ||
| 193 | + entity.setSupplierName(first.getSupplierName()); | ||
| 194 | + entity.setCompanyShortId(first.getCompanyShortId()); | ||
| 195 | + entity.setCompanyShortName(first.getCompanyShortName()); | ||
| 196 | + entity.setWorkshopId(first.getWorkshopId()); | ||
| 197 | + entity.setWorkshopName(first.getWorkshopName()); | ||
| 198 | + entity.setBuyout(isBuyout(plans)); | ||
| 199 | + entity.setApprovalStatus(STATUS_DRAFT); | ||
| 200 | + entity.setDeleted(false); | ||
| 201 | + | ||
| 202 | + this.save(entity); | ||
| 203 | + | ||
| 204 | + savePlanLines(entity.getId(), plans); | ||
| 205 | + saveWeighLines(entity.getId(), vo.getWeighLines()); | ||
| 206 | + saveApplyLines(entity.getId(), vo.getApplyLines()); | ||
| 207 | + | ||
| 208 | + OpLogUtil.setVariable("id", entity.getId()); | ||
| 209 | + OpLogUtil.setExtra(entity); | ||
| 210 | + | ||
| 211 | + return entity.getId(); | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + @Override | ||
| 215 | + @Transactional(rollbackFor = Exception.class) | ||
| 216 | + @OpLog(type = OtherOpLogType.class, name = "修改过磅码单,ID:{}", params = {"#vo.id"}) | ||
| 217 | + public void update(UpdateProcurementWeighingTicketVo vo) { | ||
| 218 | + Assert.notBlank(vo.getId(), "ID不能为空!"); | ||
| 219 | + | ||
| 220 | + ProcurementWeighingTicket oldEntity = this.getById(vo.getId()); | ||
| 221 | + if (oldEntity == null) { | ||
| 222 | + throw new DefaultClientException("过磅码单不存在!"); | ||
| 223 | + } | ||
| 224 | + // 仅草稿、已驳回可修改;审核中、审核通过不可修改;作废单只能查看 | ||
| 225 | + assertEditable(oldEntity); | ||
| 226 | + | ||
| 227 | + List<ProcurementPlan> plans = validateAndLoadPlans(vo.getPlanIds()); | ||
| 228 | + ProcurementPlan first = plans.get(0); | ||
| 229 | + | ||
| 230 | + // 使用 LambdaUpdateWrapper 显式赋值:updateById 的 NOT_NULL 策略会忽略 null, | ||
| 231 | + // 无法清空前端未传的可选字段,故此处显式 set 前端传入的值 | ||
| 232 | + LambdaUpdateWrapper<ProcurementWeighingTicket> updateWrapper = Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) | ||
| 233 | + .set(ProcurementWeighingTicket::getType, StringUtil.isBlank(vo.getType()) ? oldEntity.getType() : vo.getType()) | ||
| 234 | + .set(ProcurementWeighingTicket::getUnit, vo.getUnit()) | ||
| 235 | + .set(ProcurementWeighingTicket::getSupplierId, first.getSupplierId()) | ||
| 236 | + .set(ProcurementWeighingTicket::getSupplierName, first.getSupplierName()) | ||
| 237 | + .set(ProcurementWeighingTicket::getCompanyShortId, first.getCompanyShortId()) | ||
| 238 | + .set(ProcurementWeighingTicket::getCompanyShortName, first.getCompanyShortName()) | ||
| 239 | + .set(ProcurementWeighingTicket::getWorkshopId, first.getWorkshopId()) | ||
| 240 | + .set(ProcurementWeighingTicket::getWorkshopName, first.getWorkshopName()) | ||
| 241 | + .set(ProcurementWeighingTicket::getBuyout, isBuyout(plans)) | ||
| 242 | + .set(ProcurementWeighingTicket::getMaterialName, vo.getMaterialName()) | ||
| 243 | + .set(ProcurementWeighingTicket::getTotalGrossWeight, vo.getTotalGrossWeight()) | ||
| 244 | + .set(ProcurementWeighingTicket::getActualImpurityWeight, vo.getActualImpurityWeight()) | ||
| 245 | + .set(ProcurementWeighingTicket::getNetWeight, vo.getNetWeight()) | ||
| 246 | + .set(ProcurementWeighingTicket::getNetWeightUpper, vo.getNetWeightUpper()) | ||
| 247 | + .set(ProcurementWeighingTicket::getDeductionTypes, vo.getDeductionTypes()) | ||
| 248 | + .set(ProcurementWeighingTicket::getSupplierStockMaterial, vo.getSupplierStockMaterial()) | ||
| 249 | + .set(ProcurementWeighingTicket::getLogisticsStockMaterial, vo.getLogisticsStockMaterial()) | ||
| 250 | + .set(ProcurementWeighingTicket::getPlateNumber, vo.getPlateNumber()) | ||
| 251 | + .set(ProcurementWeighingTicket::getBusinessSummary, vo.getBusinessSummary()) | ||
| 252 | + .set(ProcurementWeighingTicket::getSpecialNote, vo.getSpecialNote()) | ||
| 253 | + .set(ProcurementWeighingTicket::getDocumentRemark, vo.getDocumentRemark()) | ||
| 254 | + .eq(ProcurementWeighingTicket::getId, vo.getId()); | ||
| 255 | + | ||
| 256 | + // 第一次记录货物毛重时间:原单未记录过、本次修改首次填写过磅总重,则以修改时间为准;已记录则保持不变 | ||
| 257 | + if (oldEntity.getFirstGrossWeightTime() == null && vo.getTotalGrossWeight() != null) { | ||
| 258 | + updateWrapper.set(ProcurementWeighingTicket::getFirstGrossWeightTime, LocalDateTime.now()); | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + this.update(updateWrapper); | ||
| 262 | + | ||
| 263 | + // 计划集合可能变化,三张子表整体重建 | ||
| 264 | + planLineService.deleteByWeighingTicketId(vo.getId()); | ||
| 265 | + weighLineService.deleteByWeighingTicketId(vo.getId()); | ||
| 266 | + applyLineService.deleteByWeighingTicketId(vo.getId()); | ||
| 267 | + | ||
| 268 | + savePlanLines(vo.getId(), plans); | ||
| 269 | + saveWeighLines(vo.getId(), vo.getWeighLines()); | ||
| 270 | + saveApplyLines(vo.getId(), vo.getApplyLines()); | ||
| 271 | + | ||
| 272 | + OpLogUtil.setVariable("id", vo.getId()); | ||
| 273 | + OpLogUtil.setExtra(oldEntity); | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + @Override | ||
| 277 | + @Transactional(rollbackFor = Exception.class) | ||
| 278 | + @OpLog(type = OtherOpLogType.class, name = "提交过磅码单审核,ID:{}", params = {"#id"}) | ||
| 279 | + public void submit(String id) { | ||
| 280 | + Assert.notBlank(id); | ||
| 281 | + | ||
| 282 | + ProcurementWeighingTicket entity = weighingTicketMapper.findById(id); | ||
| 283 | + if (entity == null) { | ||
| 284 | + throw new DefaultClientException("过磅码单不存在!"); | ||
| 285 | + } | ||
| 286 | + assertValid(entity); | ||
| 287 | + if (!STATUS_DRAFT.equals(entity.getApprovalStatus()) && !STATUS_REFUSE.equals(entity.getApprovalStatus())) { | ||
| 288 | + throw new DefaultClientException("当前单据状态不允许提交审核!"); | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + // 提交前完整性校验 | ||
| 292 | + List<ProcurementWeighingTicketLine> weighs = weighLineService.getByWeighingTicketId(id); | ||
| 293 | + if (CollectionUtil.isEmpty(weighs)) { | ||
| 294 | + throw new DefaultClientException("过磅明细不能为空,无法提交审核!"); | ||
| 295 | + } | ||
| 296 | + if (Boolean.TRUE.equals(entity.getBuyout()) && CollectionUtil.isEmpty(applyLineService.getByWeighingTicketId(id))) { | ||
| 297 | + throw new DefaultClientException("该单据为买断计划,申请数量明细不能为空!"); | ||
| 298 | + } | ||
| 299 | + if (entity.getTotalGrossWeight() == null || entity.getActualImpurityWeight() == null) { | ||
| 300 | + throw new DefaultClientException("过磅总重、实际伙重不能为空,无法提交审核!"); | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + this.update(Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) | ||
| 304 | + .set(ProcurementWeighingTicket::getApprovalStatus, STATUS_AUDIT) | ||
| 305 | + .eq(ProcurementWeighingTicket::getId, id)); | ||
| 306 | + | ||
| 307 | + flowInstanceWrapperService.startInstance(BPM_FLAG, entity.getId(), BPM_FLAG, entity); | ||
| 308 | + | ||
| 309 | + OpLogUtil.setVariable("id", id); | ||
| 310 | + OpLogUtil.setExtra(entity); | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + @Override | ||
| 314 | + @Transactional(rollbackFor = Exception.class) | ||
| 315 | + public void updateApprovalStatus(String id, String approvalStatus) { | ||
| 316 | + if (StringUtil.isBlank(id) || StringUtil.isBlank(approvalStatus)) { | ||
| 317 | + throw new DefaultClientException("过磅码单ID、审核状态不能为空!"); | ||
| 318 | + } | ||
| 319 | + | ||
| 320 | + ProcurementWeighingTicket entity = this.getById(id); | ||
| 321 | + if (entity == null) { | ||
| 322 | + throw new DefaultClientException("过磅码单不存在!"); | ||
| 323 | + } | ||
| 324 | + | ||
| 325 | + this.update(Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) | ||
| 326 | + .set(ProcurementWeighingTicket::getApprovalStatus, approvalStatus) | ||
| 327 | + .eq(ProcurementWeighingTicket::getId, id)); | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + @Override | ||
| 331 | + @Transactional(rollbackFor = Exception.class) | ||
| 332 | + @OpLog(type = OtherOpLogType.class, name = "上传过磅码单签字凭证,ID:{}", params = {"#id"}) | ||
| 333 | + public void uploadSignAttachment(String id, String fileIds, String fileNames) { | ||
| 334 | + Assert.notBlank(id); | ||
| 335 | + | ||
| 336 | + ProcurementWeighingTicket entity = this.getById(id); | ||
| 337 | + if (entity == null) { | ||
| 338 | + throw new DefaultClientException("过磅码单不存在!"); | ||
| 339 | + } | ||
| 340 | + assertValid(entity); | ||
| 341 | + if (!STATUS_PASS.equals(entity.getApprovalStatus())) { | ||
| 342 | + throw new DefaultClientException("过磅码单审核通过后才能上传签字凭证!"); | ||
| 343 | + } | ||
| 344 | + | ||
| 345 | + LambdaUpdateWrapper<ProcurementWeighingTicket> wrapper = Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) | ||
| 346 | + .set(ProcurementWeighingTicket::getSignAttachmentFileIds, | ||
| 347 | + appendFiles(entity.getSignAttachmentFileIds(), fileIds)) | ||
| 348 | + .set(ProcurementWeighingTicket::getSignAttachmentFileNames, | ||
| 349 | + appendFiles(entity.getSignAttachmentFileNames(), fileNames)) | ||
| 350 | + .eq(ProcurementWeighingTicket::getId, id); | ||
| 351 | + | ||
| 352 | + // 完成时间:以第一次上传签字凭证的时间为准 | ||
| 353 | + if (entity.getCompleteTime() == null) { | ||
| 354 | + wrapper.set(ProcurementWeighingTicket::getCompleteTime, LocalDateTime.now()); | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + this.update(wrapper); | ||
| 358 | + | ||
| 359 | + OpLogUtil.setVariable("id", id); | ||
| 360 | + OpLogUtil.setExtra(entity); | ||
| 361 | + } | ||
| 362 | + | ||
| 363 | + @Override | ||
| 364 | + @Transactional(rollbackFor = Exception.class) | ||
| 365 | + @OpLog(type = OtherOpLogType.class, name = "上传过磅码单延期说明附件,ID:{}", params = {"#id"}) | ||
| 366 | + public void uploadDelayAttachment(String id, String fileIds, String fileNames) { | ||
| 367 | + Assert.notBlank(id); | ||
| 368 | + | ||
| 369 | + ProcurementWeighingTicket entity = this.getById(id); | ||
| 370 | + if (entity == null) { | ||
| 371 | + throw new DefaultClientException("过磅码单不存在!"); | ||
| 372 | + } | ||
| 373 | + assertValid(entity); | ||
| 374 | + if (!STATUS_PASS.equals(entity.getApprovalStatus())) { | ||
| 375 | + throw new DefaultClientException("过磅码单审核通过后才能上传延期说明附件!"); | ||
| 376 | + } | ||
| 377 | + | ||
| 378 | + this.update(Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) | ||
| 379 | + .set(ProcurementWeighingTicket::getDelayAttachmentFileIds, | ||
| 380 | + appendFiles(entity.getDelayAttachmentFileIds(), fileIds)) | ||
| 381 | + .set(ProcurementWeighingTicket::getDelayAttachmentFileNames, | ||
| 382 | + appendFiles(entity.getDelayAttachmentFileNames(), fileNames)) | ||
| 383 | + .eq(ProcurementWeighingTicket::getId, id)); | ||
| 384 | + | ||
| 385 | + OpLogUtil.setVariable("id", id); | ||
| 386 | + OpLogUtil.setExtra(entity); | ||
| 387 | + } | ||
| 388 | + | ||
| 389 | + @Override | ||
| 390 | + @Transactional(rollbackFor = Exception.class) | ||
| 391 | + @OpLog(type = OtherOpLogType.class, name = "上传过磅码单复磅附件,ID:{}", params = {"#id"}) | ||
| 392 | + public void uploadReweighAttachment(String id, String fileIds, String fileNames) { | ||
| 393 | + Assert.notBlank(id); | ||
| 394 | + | ||
| 395 | + ProcurementWeighingTicket entity = this.getById(id); | ||
| 396 | + if (entity == null) { | ||
| 397 | + throw new DefaultClientException("过磅码单不存在!"); | ||
| 398 | + } | ||
| 399 | + assertValid(entity); | ||
| 400 | + | ||
| 401 | + this.update(Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) | ||
| 402 | + .set(ProcurementWeighingTicket::getReweighAttachmentFileIds, | ||
| 403 | + appendFiles(entity.getReweighAttachmentFileIds(), fileIds)) | ||
| 404 | + .set(ProcurementWeighingTicket::getReweighAttachmentFileNames, | ||
| 405 | + appendFiles(entity.getReweighAttachmentFileNames(), fileNames)) | ||
| 406 | + .eq(ProcurementWeighingTicket::getId, id)); | ||
| 407 | + | ||
| 408 | + OpLogUtil.setVariable("id", id); | ||
| 409 | + OpLogUtil.setExtra(entity); | ||
| 410 | + } | ||
| 411 | + | ||
| 412 | + @Override | ||
| 413 | + @Transactional(rollbackFor = Exception.class) | ||
| 414 | + @OpLog(type = OtherOpLogType.class, name = "作废过磅码单,ID:{}", params = {"#id"}) | ||
| 415 | + public void delete(String id) { | ||
| 416 | + Assert.notBlank(id); | ||
| 417 | + | ||
| 418 | + ProcurementWeighingTicket entity = this.getById(id); | ||
| 419 | + if (entity == null) { | ||
| 420 | + throw new DefaultClientException("过磅码单不存在!"); | ||
| 421 | + } | ||
| 422 | + assertValid(entity); | ||
| 423 | + if (!STATUS_PASS.equals(entity.getApprovalStatus())) { | ||
| 424 | + throw new DefaultClientException("仅审核通过的过磅码单可以作废!"); | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + this.update(Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) | ||
| 428 | + .set(ProcurementWeighingTicket::getDeleted, true) | ||
| 429 | + .eq(ProcurementWeighingTicket::getId, id)); | ||
| 430 | + | ||
| 431 | + OpLogUtil.setVariable("id", id); | ||
| 432 | + OpLogUtil.setExtra(entity); | ||
| 433 | + } | ||
| 434 | + | ||
| 435 | + @Override | ||
| 436 | + public PageResult<WeighingTicketPlanBo> queryWeighingTicketPlans(Integer pageIndex, Integer pageSize, | ||
| 437 | + QueryWeighingTicketPlanVo vo) { | ||
| 438 | + Assert.greaterThanZero(pageIndex); | ||
| 439 | + Assert.greaterThanZero(pageSize); | ||
| 440 | + | ||
| 441 | + PageHelperUtil.startPage(pageIndex, pageSize); | ||
| 442 | + List<WeighingTicketPlanBo> datas = weighingTicketMapper.queryWeighingTicketPlans(vo); | ||
| 443 | + | ||
| 444 | + return PageResultUtil.convert(new PageInfo<>(datas)); | ||
| 445 | + } | ||
| 446 | + | ||
| 447 | + @Override | ||
| 448 | + public List<ProcurementPlanLine> queryPlanLines(List<String> planIds) { | ||
| 449 | + if (CollectionUtil.isEmpty(planIds)) { | ||
| 450 | + return new ArrayList<>(); | ||
| 451 | + } | ||
| 452 | + | ||
| 453 | + List<String> distinctIds = planIds.stream().filter(StringUtil::isNotBlank).distinct() | ||
| 454 | + .collect(Collectors.toList()); | ||
| 455 | + if (CollectionUtil.isEmpty(distinctIds)) { | ||
| 456 | + return new ArrayList<>(); | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + List<ProcurementPlanLine> lines = procurementPlanLineService.getByProcurementPlanIds(distinctIds); | ||
| 460 | + if (CollectionUtil.isEmpty(lines)) { | ||
| 461 | + return lines; | ||
| 462 | + } | ||
| 463 | + | ||
| 464 | + // 按传入计划ID的先后顺序排列,同一计划内保持 SQL 已排好的创建时间顺序(List.sort 为稳定排序) | ||
| 465 | + Map<String, Integer> planOrder = new HashMap<>(); | ||
| 466 | + for (int i = 0; i < distinctIds.size(); i++) { | ||
| 467 | + planOrder.put(distinctIds.get(i), i); | ||
| 468 | + } | ||
| 469 | + lines.sort(Comparator.comparingInt( | ||
| 470 | + line -> planOrder.getOrDefault(line.getProcurementPlanId(), Integer.MAX_VALUE))); | ||
| 471 | + | ||
| 472 | + // 计划明细数量原始单位为吨,过磅码单业务单位为公斤,返回前换算 | ||
| 473 | + for (ProcurementPlanLine line : lines) { | ||
| 474 | + line.setQuantity(convertTonToKilogram(line.getQuantity())); | ||
| 475 | + } | ||
| 476 | + | ||
| 477 | + return lines; | ||
| 478 | + } | ||
| 479 | + | ||
| 480 | + // ==================== 私有方法 ==================== | ||
| 481 | + | ||
| 482 | + /** | ||
| 483 | + * 校验所选采购计划并返回带名称的计划数据 | ||
| 484 | + * 1. 计划必须存在且满足「已完成、不在变更流程、不在补单流程」 | ||
| 485 | + * 2. 多计划的供料单位、收料单位(公司简称+分厂)、买断属性必须一致 | ||
| 486 | + */ | ||
| 487 | + private List<ProcurementPlan> validateAndLoadPlans(List<String> planIds) { | ||
| 488 | + if (CollectionUtil.isEmpty(planIds)) { | ||
| 489 | + throw new DefaultClientException("请至少选择一个采购计划!"); | ||
| 490 | + } | ||
| 491 | + | ||
| 492 | + List<String> distinctIds = planIds.stream().filter(StringUtil::isNotBlank).distinct() | ||
| 493 | + .collect(Collectors.toList()); | ||
| 494 | + if (CollectionUtil.isEmpty(distinctIds)) { | ||
| 495 | + throw new DefaultClientException("请至少选择一个采购计划!"); | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + List<ProcurementPlan> plans = weighingTicketMapper.getCandidatePlansByIds(distinctIds); | ||
| 499 | + if (CollectionUtil.isEmpty(plans) || plans.size() != distinctIds.size()) { | ||
| 500 | + Set<String> loaded = CollectionUtil.isEmpty(plans) ? new HashSet<>() | ||
| 501 | + : plans.stream().map(ProcurementPlan::getId).collect(Collectors.toSet()); | ||
| 502 | + List<String> invalid = distinctIds.stream().filter(i -> !loaded.contains(i)).collect(Collectors.toList()); | ||
| 503 | + throw new DefaultClientException("所选采购计划不存在或已完成/变更/补单状态不满足选择条件:" + String.join(",", invalid)); | ||
| 504 | + } | ||
| 505 | + | ||
| 506 | + ProcurementPlan first = plans.get(0); | ||
| 507 | + for (ProcurementPlan plan : plans) { | ||
| 508 | + if (!Objects.equals(first.getSupplierId(), plan.getSupplierId())) { | ||
| 509 | + throw new DefaultClientException("所选采购计划的供料单位必须保持一致!"); | ||
| 510 | + } | ||
| 511 | + if (!Objects.equals(first.getCompanyShortId(), plan.getCompanyShortId()) | ||
| 512 | + || !Objects.equals(first.getWorkshopId(), plan.getWorkshopId())) { | ||
| 513 | + throw new DefaultClientException("所选采购计划的收料单位必须保持一致!"); | ||
| 514 | + } | ||
| 515 | + if (isBuyout(first) != isBuyout(plan)) { | ||
| 516 | + throw new DefaultClientException("所选采购计划的买断属性必须保持一致!"); | ||
| 517 | + } | ||
| 518 | + } | ||
| 519 | + | ||
| 520 | + return plans; | ||
| 521 | + } | ||
| 522 | + | ||
| 523 | + /** | ||
| 524 | + * 数量单位换算:吨 -> 公斤(1吨=1000公斤),小数点右移3位无精度损失 | ||
| 525 | + */ | ||
| 526 | + private BigDecimal convertTonToKilogram(BigDecimal quantity) { | ||
| 527 | + return quantity == null ? null : quantity.movePointRight(3); | ||
| 528 | + } | ||
| 529 | + | ||
| 530 | + /** | ||
| 531 | + * 是否买断:通货买断/质量买断/数量买断任一为真 | ||
| 532 | + */ | ||
| 533 | + private boolean isBuyout(ProcurementPlan plan) { | ||
| 534 | + return Boolean.TRUE.equals(plan.getCommodityBuyout()) | ||
| 535 | + || Boolean.TRUE.equals(plan.getQualityBuyout()) | ||
| 536 | + || Boolean.TRUE.equals(plan.getQuantityBuyout()); | ||
| 537 | + } | ||
| 538 | + | ||
| 539 | + private boolean isBuyout(List<ProcurementPlan> plans) { | ||
| 540 | + return plans.stream().anyMatch(this::isBuyout); | ||
| 541 | + } | ||
| 542 | + | ||
| 543 | + /** | ||
| 544 | + * 保存计划明细:按所选计划展开其采购计划明细行,自动带出品种与数量 | ||
| 545 | + */ | ||
| 546 | + private void savePlanLines(String ticketId, List<ProcurementPlan> plans) { | ||
| 547 | + List<ProcurementWeighingTicketPlan> lines = new ArrayList<>(); | ||
| 548 | + int orderNo = 0; | ||
| 549 | + for (ProcurementPlan plan : plans) { | ||
| 550 | + List<ProcurementPlanLine> planLines = procurementPlanLineService.getByProcurementPlanId(plan.getId()); | ||
| 551 | + if (CollectionUtil.isEmpty(planLines)) { | ||
| 552 | + ProcurementWeighingTicketPlan line = new ProcurementWeighingTicketPlan(); | ||
| 553 | + line.setId(IdUtil.getId()); | ||
| 554 | + line.setWeighingTicketId(ticketId); | ||
| 555 | + line.setProcurementPlanId(plan.getId()); | ||
| 556 | + line.setPlanCode(plan.getCode()); | ||
| 557 | + line.setQuantity(convertTonToKilogram(plan.getTotalQuantity())); | ||
| 558 | + line.setOrderNo(++orderNo); | ||
| 559 | + lines.add(line); | ||
| 560 | + continue; | ||
| 561 | + } | ||
| 562 | + for (ProcurementPlanLine planLine : planLines) { | ||
| 563 | + ProcurementWeighingTicketPlan line = new ProcurementWeighingTicketPlan(); | ||
| 564 | + line.setId(IdUtil.getId()); | ||
| 565 | + line.setWeighingTicketId(ticketId); | ||
| 566 | + line.setProcurementPlanId(plan.getId()); | ||
| 567 | + line.setProcurementPlanLineId(planLine.getId()); | ||
| 568 | + line.setPlanCode(plan.getCode()); | ||
| 569 | + line.setProductId(planLine.getProductId()); | ||
| 570 | + line.setQuantity(convertTonToKilogram(planLine.getQuantity())); | ||
| 571 | + line.setOrderNo(++orderNo); | ||
| 572 | + lines.add(line); | ||
| 573 | + } | ||
| 574 | + } | ||
| 575 | + | ||
| 576 | + if (CollectionUtil.isNotEmpty(lines)) { | ||
| 577 | + planLineService.saveBatch(lines); | ||
| 578 | + } | ||
| 579 | + } | ||
| 580 | + | ||
| 581 | + private void saveWeighLines(String ticketId, List<WeighingTicketWeighLineVo> vos) { | ||
| 582 | + if (CollectionUtil.isEmpty(vos)) { | ||
| 583 | + return; | ||
| 584 | + } | ||
| 585 | + | ||
| 586 | + List<ProcurementWeighingTicketLine> lines = new ArrayList<>(vos.size()); | ||
| 587 | + int orderNo = 0; | ||
| 588 | + for (WeighingTicketWeighLineVo item : vos) { | ||
| 589 | + if (item == null) { | ||
| 590 | + continue; | ||
| 591 | + } | ||
| 592 | + ProcurementWeighingTicketLine line = BeanUtil.copyProperties(item, ProcurementWeighingTicketLine.class); | ||
| 593 | + line.setId(IdUtil.getId()); | ||
| 594 | + line.setWeighingTicketId(ticketId); | ||
| 595 | + line.setOrderNo(++orderNo); | ||
| 596 | + lines.add(line); | ||
| 597 | + } | ||
| 598 | + | ||
| 599 | + if (CollectionUtil.isNotEmpty(lines)) { | ||
| 600 | + weighLineService.saveBatch(lines); | ||
| 601 | + } | ||
| 602 | + } | ||
| 603 | + | ||
| 604 | + private void saveApplyLines(String ticketId, List<WeighingTicketApplyLineVo> vos) { | ||
| 605 | + if (CollectionUtil.isEmpty(vos)) { | ||
| 606 | + return; | ||
| 607 | + } | ||
| 608 | + | ||
| 609 | + List<ProcurementWeighingTicketApplyLine> lines = new ArrayList<>(vos.size()); | ||
| 610 | + int orderNo = 0; | ||
| 611 | + for (WeighingTicketApplyLineVo item : vos) { | ||
| 612 | + if (item == null) { | ||
| 613 | + continue; | ||
| 614 | + } | ||
| 615 | + if (item.getQuantity() != null && item.getQuantity().compareTo(BigDecimal.ZERO) < 0) { | ||
| 616 | + throw new DefaultClientException("申请数量不能小于0!"); | ||
| 617 | + } | ||
| 618 | + ProcurementWeighingTicketApplyLine line = BeanUtil.copyProperties(item, ProcurementWeighingTicketApplyLine.class); | ||
| 619 | + line.setId(IdUtil.getId()); | ||
| 620 | + line.setWeighingTicketId(ticketId); | ||
| 621 | + line.setOrderNo(++orderNo); | ||
| 622 | + lines.add(line); | ||
| 623 | + } | ||
| 624 | + | ||
| 625 | + if (CollectionUtil.isNotEmpty(lines)) { | ||
| 626 | + applyLineService.saveBatch(lines); | ||
| 627 | + } | ||
| 628 | + } | ||
| 629 | + | ||
| 630 | + /** | ||
| 631 | + * 生成编号:GB + 6位日期(yyMMdd) + 4位当日流水,如 GB2610130001 | ||
| 632 | + * 以当日最大流水为基础递增,并校验唯一性,存在则顺延下一个流水号 | ||
| 633 | + */ | ||
| 634 | + @Override | ||
| 635 | + public String generateCode() { | ||
| 636 | + String prefix = CODE_PREFIX + LocalDate.now().format(DATE_CODE_FORMATTER); | ||
| 637 | + | ||
| 638 | + // 当日已有最大编号,取其后四位流水作为起始 | ||
| 639 | + int seq = 0; | ||
| 640 | + String maxCode = weighingTicketMapper.findMaxCodeByPrefix(prefix); | ||
| 641 | + if (StringUtil.isNotBlank(maxCode) && maxCode.length() > prefix.length()) { | ||
| 642 | + try { | ||
| 643 | + seq = Integer.parseInt(maxCode.substring(prefix.length())); | ||
| 644 | + } catch (NumberFormatException e) { | ||
| 645 | + log.warn("过磅码单编号流水解析失败,maxCode={}", maxCode); | ||
| 646 | + } | ||
| 647 | + } | ||
| 648 | + | ||
| 649 | + // 并发下流水可能已被占用,逐个顺延并校验唯一 | ||
| 650 | + for (int i = 1; i <= 1000; i++) { | ||
| 651 | + String code = prefix + String.format("%04d", seq + i); | ||
| 652 | + long exists = this.count(Wrappers.lambdaQuery(ProcurementWeighingTicket.class) | ||
| 653 | + .eq(ProcurementWeighingTicket::getCode, code)); | ||
| 654 | + if (exists <= 0) { | ||
| 655 | + return code; | ||
| 656 | + } | ||
| 657 | + } | ||
| 658 | + | ||
| 659 | + throw new DefaultClientException("过磅码单编号生成失败,请重试!"); | ||
| 660 | + } | ||
| 661 | + | ||
| 662 | + /** | ||
| 663 | + * 追加附件(多次上传累加,保持顺序去重) | ||
| 664 | + */ | ||
| 665 | + private String appendFiles(String oldValues, String newValues) { | ||
| 666 | + Set<String> merged = new LinkedHashSet<>(); | ||
| 667 | + splitToSet(oldValues, merged); | ||
| 668 | + splitToSet(newValues, merged); | ||
| 669 | + return merged.isEmpty() ? null : String.join(",", merged); | ||
| 670 | + } | ||
| 671 | + | ||
| 672 | + private void splitToSet(String value, Set<String> target) { | ||
| 673 | + if (StringUtil.isBlank(value)) { | ||
| 674 | + return; | ||
| 675 | + } | ||
| 676 | + for (String item : value.split(",")) { | ||
| 677 | + if (StringUtil.isNotBlank(item)) { | ||
| 678 | + target.add(item.trim()); | ||
| 679 | + } | ||
| 680 | + } | ||
| 681 | + } | ||
| 682 | + | ||
| 683 | + /** | ||
| 684 | + * 填充按钮展示标记(审核按钮按当前用户流程待办判断) | ||
| 685 | + */ | ||
| 686 | + private void fillOperateFlags(List<ProcurementWeighingTicket> datas) { | ||
| 687 | + if (CollectionUtil.isEmpty(datas)) { | ||
| 688 | + return; | ||
| 689 | + } | ||
| 690 | + | ||
| 691 | + List<String> businessIds = datas.stream() | ||
| 692 | + .filter(Objects::nonNull) | ||
| 693 | + .map(ProcurementWeighingTicket::getId) | ||
| 694 | + .collect(Collectors.toList()); | ||
| 695 | + | ||
| 696 | + List<FlowInstanceWrapper> flowList = flowInstanceWrapperService.getFlowByBusinessIdList(businessIds); | ||
| 697 | + Set<String> flowBusinessIdSet = CollectionUtil.isNotEmpty(flowList) | ||
| 698 | + ? flowList.stream().map(FlowInstanceWrapper::getBusinessId).collect(Collectors.toSet()) | ||
| 699 | + : new HashSet<>(); | ||
| 700 | + | ||
| 701 | + List<FlowTaskDto> todoFlowTaskList = flowTaskWrapperMapper.queryTodoList( | ||
| 702 | + new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId()); | ||
| 703 | + Set<String> todoBusinessIdSet = CollectionUtil.isNotEmpty(todoFlowTaskList) | ||
| 704 | + ? todoFlowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toSet()) | ||
| 705 | + : new HashSet<>(); | ||
| 706 | + | ||
| 707 | + for (ProcurementWeighingTicket data : datas) { | ||
| 708 | + if (data == null) { | ||
| 709 | + continue; | ||
| 710 | + } | ||
| 711 | + boolean hasFlow = flowBusinessIdSet.contains(data.getId()); | ||
| 712 | + boolean hasTodo = todoBusinessIdSet.contains(data.getId()); | ||
| 713 | + data.setShowExamine(hasTodo && STATUS_AUDIT.equals(data.getApprovalStatus())); | ||
| 714 | + data.setShowExamineDetail(hasFlow && StringUtil.isNotBlank(data.getApprovalStatus())); | ||
| 715 | + } | ||
| 716 | + } | ||
| 717 | + | ||
| 718 | + /** | ||
| 719 | + * 作废单校验:作废单只能查看 | ||
| 720 | + */ | ||
| 721 | + private void assertValid(ProcurementWeighingTicket entity) { | ||
| 722 | + if (Boolean.TRUE.equals(entity.getDeleted())) { | ||
| 723 | + throw new DefaultClientException("作废单据只能查看,不允许该操作!"); | ||
| 724 | + } | ||
| 725 | + } | ||
| 726 | + | ||
| 727 | + /** | ||
| 728 | + * 可编辑校验 | ||
| 729 | + */ | ||
| 730 | + private void assertEditable(ProcurementWeighingTicket entity) { | ||
| 731 | + assertValid(entity); | ||
| 732 | + if (!STATUS_DRAFT.equals(entity.getApprovalStatus()) && !STATUS_REFUSE.equals(entity.getApprovalStatus())) { | ||
| 733 | + throw new DefaultClientException("仅草稿、已驳回状态的过磅码单可以修改!"); | ||
| 734 | + } | ||
| 735 | + } | ||
| 736 | +} |
| @@ -16,6 +16,14 @@ public interface ProcurementPlanLineMapper extends BaseMapper<ProcurementPlanLin | @@ -16,6 +16,14 @@ public interface ProcurementPlanLineMapper extends BaseMapper<ProcurementPlanLin | ||
| 16 | List<ProcurementPlanLine> getByProcurementPlanId(@Param("procurementPlanId") String procurementPlanId); | 16 | List<ProcurementPlanLine> getByProcurementPlanId(@Param("procurementPlanId") String procurementPlanId); |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | + * 根据多个采购计划ID批量查询 | ||
| 20 | + * | ||
| 21 | + * @param procurementPlanIds | ||
| 22 | + * @return | ||
| 23 | + */ | ||
| 24 | + List<ProcurementPlanLine> getByProcurementPlanIds(@Param("procurementPlanIds") List<String> procurementPlanIds); | ||
| 25 | + | ||
| 26 | + /** | ||
| 19 | * 根据采购计划ID删除 | 27 | * 根据采购计划ID删除 |
| 20 | * | 28 | * |
| 21 | * @param procurementPlanId | 29 | * @param procurementPlanId |
| 1 | +package com.lframework.xingyun.sc.procurement.mappers.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketApplyLine; | ||
| 5 | +import java.util.List; | ||
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | + | ||
| 8 | +public interface ProcurementWeighingTicketApplyLineMapper extends BaseMapper<ProcurementWeighingTicketApplyLine> { | ||
| 9 | + | ||
| 10 | + List<ProcurementWeighingTicketApplyLine> getByWeighingTicketId(@Param("weighingTicketId") String weighingTicketId); | ||
| 11 | + | ||
| 12 | + void deleteByWeighingTicketId(@Param("weighingTicketId") String weighingTicketId); | ||
| 13 | + | ||
| 14 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.mappers.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketLine; | ||
| 5 | +import java.util.List; | ||
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | + | ||
| 8 | +public interface ProcurementWeighingTicketLineMapper extends BaseMapper<ProcurementWeighingTicketLine> { | ||
| 9 | + | ||
| 10 | + List<ProcurementWeighingTicketLine> getByWeighingTicketId(@Param("weighingTicketId") String weighingTicketId); | ||
| 11 | + | ||
| 12 | + void deleteByWeighingTicketId(@Param("weighingTicketId") String weighingTicketId); | ||
| 13 | + | ||
| 14 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.mappers.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 4 | +import com.lframework.xingyun.sc.bo.procurement.WeighingTicketPlanBo; | ||
| 5 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicket; | ||
| 7 | +import com.lframework.xingyun.sc.procurement.vo.weighing.QueryProcurementWeighingTicketVo; | ||
| 8 | +import com.lframework.xingyun.sc.procurement.vo.weighing.QueryWeighingTicketPlanVo; | ||
| 9 | +import java.util.List; | ||
| 10 | +import org.apache.ibatis.annotations.Param; | ||
| 11 | + | ||
| 12 | +public interface ProcurementWeighingTicketMapper extends BaseMapper<ProcurementWeighingTicket> { | ||
| 13 | + | ||
| 14 | + List<ProcurementWeighingTicket> query(@Param("vo") QueryProcurementWeighingTicketVo vo); | ||
| 15 | + | ||
| 16 | + ProcurementWeighingTicket findById(@Param("id") String id); | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 查询以指定前缀开头的最大编号(用于生成流水号) | ||
| 20 | + * 不过滤 deleted,避免与作废单据的编号重复 | ||
| 21 | + */ | ||
| 22 | + String findMaxCodeByPrefix(@Param("prefix") String prefix); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 按计划ID批量查询满足过磅码单条件的采购计划(带供料单位/收料单位名称) | ||
| 26 | + * 用于新增、修改时的选择校验与数据自动带出 | ||
| 27 | + * 条件:未删除、未冻结、流程状态已完成、不在变更中、不在补单中 | ||
| 28 | + */ | ||
| 29 | + List<ProcurementPlan> getCandidatePlansByIds(@Param("ids") List<String> ids); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 查询可关联过磅码单的采购计划(选择计划弹窗) | ||
| 33 | + * 条件:未删除、未冻结、流程状态已完成、不在变更中、不在补单中 | ||
| 34 | + */ | ||
| 35 | + List<WeighingTicketPlanBo> queryWeighingTicketPlans(@Param("vo") QueryWeighingTicketPlanVo vo); | ||
| 36 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.mappers.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketPlan; | ||
| 5 | +import java.util.List; | ||
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | + | ||
| 8 | +public interface ProcurementWeighingTicketPlanMapper extends BaseMapper<ProcurementWeighingTicketPlan> { | ||
| 9 | + | ||
| 10 | + List<ProcurementWeighingTicketPlan> getByWeighingTicketId(@Param("weighingTicketId") String weighingTicketId); | ||
| 11 | + | ||
| 12 | + void deleteByWeighingTicketId(@Param("weighingTicketId") String weighingTicketId); | ||
| 13 | + | ||
| 14 | +} |
| @@ -15,6 +15,14 @@ public interface ProcurementPlanLineService extends BaseMpService<ProcurementPla | @@ -15,6 +15,14 @@ public interface ProcurementPlanLineService extends BaseMpService<ProcurementPla | ||
| 15 | List<ProcurementPlanLine> getByProcurementPlanId(String procurementPlanId); | 15 | List<ProcurementPlanLine> getByProcurementPlanId(String procurementPlanId); |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | + * 根据多个采购计划ID批量查询 | ||
| 19 | + * | ||
| 20 | + * @param procurementPlanIds | ||
| 21 | + * @return | ||
| 22 | + */ | ||
| 23 | + List<ProcurementPlanLine> getByProcurementPlanIds(List<String> procurementPlanIds); | ||
| 24 | + | ||
| 25 | + /** | ||
| 18 | * 根据采购计划ID删除 | 26 | * 根据采购计划ID删除 |
| 19 | * | 27 | * |
| 20 | * @param procurementPlanId | 28 | * @param procurementPlanId |
| 1 | +package com.lframework.xingyun.sc.procurement.service.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.service.BaseMpService; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketApplyLine; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +public interface ProcurementWeighingTicketApplyLineService extends BaseMpService<ProcurementWeighingTicketApplyLine> { | ||
| 8 | + | ||
| 9 | + List<ProcurementWeighingTicketApplyLine> getByWeighingTicketId(String weighingTicketId); | ||
| 10 | + | ||
| 11 | + void deleteByWeighingTicketId(String weighingTicketId); | ||
| 12 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.service.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.service.BaseMpService; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketLine; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +public interface ProcurementWeighingTicketLineService extends BaseMpService<ProcurementWeighingTicketLine> { | ||
| 8 | + | ||
| 9 | + List<ProcurementWeighingTicketLine> getByWeighingTicketId(String weighingTicketId); | ||
| 10 | + | ||
| 11 | + void deleteByWeighingTicketId(String weighingTicketId); | ||
| 12 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.service.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.service.BaseMpService; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketPlan; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +public interface ProcurementWeighingTicketPlanService extends BaseMpService<ProcurementWeighingTicketPlan> { | ||
| 8 | + | ||
| 9 | + List<ProcurementWeighingTicketPlan> getByWeighingTicketId(String weighingTicketId); | ||
| 10 | + | ||
| 11 | + void deleteByWeighingTicketId(String weighingTicketId); | ||
| 12 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.service.weighing; | ||
| 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.GetProcurementWeighingTicketBo; | ||
| 6 | +import com.lframework.xingyun.sc.bo.procurement.WeighingTicketPlanBo; | ||
| 7 | +import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; | ||
| 8 | +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicket; | ||
| 9 | +import com.lframework.xingyun.sc.procurement.vo.weighing.CreateProcurementWeighingTicketVo; | ||
| 10 | +import com.lframework.xingyun.sc.procurement.vo.weighing.QueryProcurementWeighingTicketVo; | ||
| 11 | +import com.lframework.xingyun.sc.procurement.vo.weighing.QueryWeighingTicketPlanVo; | ||
| 12 | +import com.lframework.xingyun.sc.procurement.vo.weighing.UpdateProcurementWeighingTicketVo; | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +public interface ProcurementWeighingTicketService extends BaseMpService<ProcurementWeighingTicket> { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 分页查询过磅码单列表 | ||
| 19 | + */ | ||
| 20 | + PageResult<ProcurementWeighingTicket> query(Integer pageIndex, Integer pageSize, QueryProcurementWeighingTicketVo vo); | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 查询过磅码单列表 | ||
| 24 | + */ | ||
| 25 | + List<ProcurementWeighingTicket> query(QueryProcurementWeighingTicketVo vo); | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 查询过磅码单详情(含三类明细) | ||
| 29 | + */ | ||
| 30 | + GetProcurementWeighingTicketBo findDetail(String id); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 生成下一个可用编号(GB + 6位日期yyMMdd + 4位当日流水,如 GB2610130001) | ||
| 34 | + * 供前端新增时预取,新增保存时后端会再次校验唯一性 | ||
| 35 | + */ | ||
| 36 | + String generateCode(); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 新增过磅码单(草稿),编号由前端预取后传入 | ||
| 40 | + */ | ||
| 41 | + String create(CreateProcurementWeighingTicketVo vo); | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 修改过磅码单 | ||
| 45 | + */ | ||
| 46 | + void update(UpdateProcurementWeighingTicketVo vo); | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 提交审核 | ||
| 50 | + */ | ||
| 51 | + void submit(String id); | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 审核流程回调更新审核状态(流程结束时由 BusinessDataHandlerService 调用) | ||
| 55 | + * | ||
| 56 | + * @param id 过磅码单ID | ||
| 57 | + * @param approvalStatus 审核结果 PASS/REFUSE | ||
| 58 | + */ | ||
| 59 | + void updateApprovalStatus(String id, String approvalStatus); | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 上传签字凭证(可多次,首次上传时锁定过磅重量) | ||
| 63 | + */ | ||
| 64 | + void uploadSignAttachment(String id, String fileIds, String fileNames); | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * 上传延期说明附件 | ||
| 68 | + */ | ||
| 69 | + void uploadDelayAttachment(String id, String fileIds, String fileNames); | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 上传复磅附件 | ||
| 73 | + */ | ||
| 74 | + void uploadReweighAttachment(String id, String fileIds, String fileNames); | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 作废过磅码单 | ||
| 78 | + */ | ||
| 79 | + void delete(String id); | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 分页查询可关联过磅码单的采购计划(选择计划弹窗) | ||
| 83 | + * 未冻结、流程状态已完成、不在变更中、不在补单中 | ||
| 84 | + */ | ||
| 85 | + PageResult<WeighingTicketPlanBo> queryWeighingTicketPlans(Integer pageIndex, Integer pageSize, | ||
| 86 | + QueryWeighingTicketPlanVo vo); | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 根据多个采购计划ID批量查询计划明细子表数据 | ||
| 90 | + */ | ||
| 91 | + List<ProcurementPlanLine> queryPlanLines(List<String> planIds); | ||
| 92 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import javax.validation.Valid; | ||
| 8 | +import javax.validation.constraints.NotBlank; | ||
| 9 | +import javax.validation.constraints.NotEmpty; | ||
| 10 | +import java.io.Serializable; | ||
| 11 | +import java.math.BigDecimal; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +@Data | ||
| 15 | +@ApiModel("新增过磅码单Vo") | ||
| 16 | +public class CreateProcurementWeighingTicketVo implements BaseVo, Serializable { | ||
| 17 | + | ||
| 18 | + private static final long serialVersionUID = 1L; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty(value = "编号(前端调用生成编号接口预取后传入)", required = true) | ||
| 21 | + @NotBlank(message = "编号不能为空!") | ||
| 22 | + private String code; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty("类型 REGULAR-常规 RETURN-退料换料,不传默认常规") | ||
| 25 | + private String type; | ||
| 26 | + | ||
| 27 | + @ApiModelProperty(value = "选择的采购计划ID集合(多选)", required = true) | ||
| 28 | + @NotEmpty(message = "请至少选择一个采购计划!") | ||
| 29 | + private List<String> planIds; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty("过磅明细") | ||
| 32 | + @Valid | ||
| 33 | + private List<WeighingTicketWeighLineVo> weighLines; | ||
| 34 | + | ||
| 35 | + @ApiModelProperty("申请数量明细(计划为买断时必须填写)") | ||
| 36 | + @Valid | ||
| 37 | + private List<WeighingTicketApplyLineVo> applyLines; | ||
| 38 | + | ||
| 39 | + @ApiModelProperty("单位") | ||
| 40 | + private String unit; | ||
| 41 | + | ||
| 42 | + @ApiModelProperty("物料名称") | ||
| 43 | + private String materialName; | ||
| 44 | + | ||
| 45 | + @ApiModelProperty("过磅总重") | ||
| 46 | + private BigDecimal totalGrossWeight; | ||
| 47 | + | ||
| 48 | + @ApiModelProperty("实际伙重") | ||
| 49 | + private BigDecimal actualImpurityWeight; | ||
| 50 | + | ||
| 51 | + @ApiModelProperty("货物净重") | ||
| 52 | + private BigDecimal netWeight; | ||
| 53 | + | ||
| 54 | + @ApiModelProperty("净重大写") | ||
| 55 | + private String netWeightUpper; | ||
| 56 | + | ||
| 57 | + @ApiModelProperty("来料扣杂类型(多选,逗号分隔:WATER-水杂,BAG-袋伙,STEEL-钢带伙,WOOD-木托伙)") | ||
| 58 | + private String deductionTypes; | ||
| 59 | + | ||
| 60 | + @ApiModelProperty("供应存欠料") | ||
| 61 | + private String supplierStockMaterial; | ||
| 62 | + | ||
| 63 | + @ApiModelProperty("物流存欠料") | ||
| 64 | + private String logisticsStockMaterial; | ||
| 65 | + | ||
| 66 | + @ApiModelProperty("车牌号") | ||
| 67 | + private String plateNumber; | ||
| 68 | + | ||
| 69 | + @ApiModelProperty("业务摘要") | ||
| 70 | + private String businessSummary; | ||
| 71 | + | ||
| 72 | + @ApiModelProperty("特别说明") | ||
| 73 | + private String specialNote; | ||
| 74 | + | ||
| 75 | + @ApiModelProperty("单据备注") | ||
| 76 | + private String documentRemark; | ||
| 77 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.weighing; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.starter.common.constants.StringPool; | ||
| 5 | +import com.lframework.starter.web.core.vo.SortPageVo; | ||
| 6 | +import io.swagger.annotations.ApiModel; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import lombok.Data; | ||
| 9 | + | ||
| 10 | +import java.io.Serializable; | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +@Data | ||
| 15 | +@ApiModel("查询过磅码单") | ||
| 16 | +public class QueryProcurementWeighingTicketVo extends SortPageVo implements Serializable { | ||
| 17 | + | ||
| 18 | + private static final long serialVersionUID = 1L; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty("编号(模糊匹配)") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty("计划编号(模糊匹配,命中标题下任一关联计划)") | ||
| 24 | + private String planCode; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty("供料单位名称(模糊匹配)") | ||
| 27 | + private String supplierName; | ||
| 28 | + | ||
| 29 | + @ApiModelProperty("公司简称ID") | ||
| 30 | + private String companyShortId; | ||
| 31 | + | ||
| 32 | + @ApiModelProperty("审核状态 DRAFT/AUDIT/PASS/REFUSE/CANCEL") | ||
| 33 | + private String approvalStatus; | ||
| 34 | + | ||
| 35 | + @ApiModelProperty("时间-开始(按第一次记录货物毛重时间)") | ||
| 36 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 37 | + private LocalDateTime startTime; | ||
| 38 | + | ||
| 39 | + @ApiModelProperty("时间-结束") | ||
| 40 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 41 | + private LocalDateTime endTime; | ||
| 42 | + | ||
| 43 | + @ApiModelProperty("创建人(模糊匹配)") | ||
| 44 | + private String createBy; | ||
| 45 | + | ||
| 46 | + @ApiModelProperty("创建人ID(数据权限用,后端注入)") | ||
| 47 | + private String createById; | ||
| 48 | + | ||
| 49 | + @ApiModelProperty("创建人ID集合(数据权限用,后端注入)") | ||
| 50 | + private List<String> createByIdList; | ||
| 51 | + | ||
| 52 | + @ApiModelProperty("是否作废单 true=作废单 false/空=有效单") | ||
| 53 | + private Boolean deleted; | ||
| 54 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.SortPageVo; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.io.Serializable; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +@ApiModel("查询可关联过磅码单的采购计划Vo") | ||
| 12 | +public class QueryWeighingTicketPlanVo extends SortPageVo implements Serializable { | ||
| 13 | + | ||
| 14 | + private static final long serialVersionUID = 1L; | ||
| 15 | + | ||
| 16 | + @ApiModelProperty("计划编号(模糊匹配)") | ||
| 17 | + private String code; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty("公司名称(模糊匹配)") | ||
| 20 | + private String companyName; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty("采购处ID") | ||
| 23 | + private String purchaseDeptId; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty("供应商名称(模糊匹配)") | ||
| 26 | + private String supplierName; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty("计划类型") | ||
| 29 | + private String planType; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty("一致性锁定-是否买断(已选计划后传入,只返回同买断属性的计划)") | ||
| 32 | + private Boolean buyout; | ||
| 33 | + | ||
| 34 | + @ApiModelProperty("一致性锁定-供料单位ID") | ||
| 35 | + private String supplierId; | ||
| 36 | + | ||
| 37 | + @ApiModelProperty("一致性锁定-公司简称ID") | ||
| 38 | + private String companyShortId; | ||
| 39 | + | ||
| 40 | + @ApiModelProperty("一致性锁定-分厂ID") | ||
| 41 | + private String workshopId; | ||
| 42 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import javax.validation.Valid; | ||
| 9 | +import javax.validation.constraints.NotBlank; | ||
| 10 | +import javax.validation.constraints.NotEmpty; | ||
| 11 | +import java.io.Serializable; | ||
| 12 | +import java.math.BigDecimal; | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +@Data | ||
| 16 | +@ApiModel("修改过磅码单Vo") | ||
| 17 | +public class UpdateProcurementWeighingTicketVo implements BaseVo, Serializable { | ||
| 18 | + | ||
| 19 | + private static final long serialVersionUID = 1L; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty(value = "ID", required = true) | ||
| 22 | + @NotBlank(message = "ID不能为空!") | ||
| 23 | + private String id; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty("类型 REGULAR-常规 RETURN-退料换料") | ||
| 26 | + private String type; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty(value = "选择的采购计划ID集合(多选)", required = true) | ||
| 29 | + @NotEmpty(message = "请至少选择一个采购计划!") | ||
| 30 | + private List<String> planIds; | ||
| 31 | + | ||
| 32 | + @ApiModelProperty("计划明细行(重新选择计划时由后端重建,前端无需传)") | ||
| 33 | + @Valid | ||
| 34 | + private List<WeighingTicketPlanLineVo> planLines; | ||
| 35 | + | ||
| 36 | + @ApiModelProperty("过磅明细") | ||
| 37 | + @Valid | ||
| 38 | + private List<WeighingTicketWeighLineVo> weighLines; | ||
| 39 | + | ||
| 40 | + @ApiModelProperty("申请数量明细(计划为买断时必须填写)") | ||
| 41 | + @Valid | ||
| 42 | + private List<WeighingTicketApplyLineVo> applyLines; | ||
| 43 | + | ||
| 44 | + @ApiModelProperty("单位") | ||
| 45 | + private String unit; | ||
| 46 | + | ||
| 47 | + @ApiModelProperty("物料名称") | ||
| 48 | + private String materialName; | ||
| 49 | + | ||
| 50 | + @ApiModelProperty("过磅总重") | ||
| 51 | + private BigDecimal totalGrossWeight; | ||
| 52 | + | ||
| 53 | + @ApiModelProperty("实际伙重") | ||
| 54 | + private BigDecimal actualImpurityWeight; | ||
| 55 | + | ||
| 56 | + @ApiModelProperty("货物净重") | ||
| 57 | + private BigDecimal netWeight; | ||
| 58 | + | ||
| 59 | + @ApiModelProperty("净重大写") | ||
| 60 | + private String netWeightUpper; | ||
| 61 | + | ||
| 62 | + @ApiModelProperty("来料扣杂类型(多选,逗号分隔)") | ||
| 63 | + private String deductionTypes; | ||
| 64 | + | ||
| 65 | + @ApiModelProperty("供应存欠料") | ||
| 66 | + private String supplierStockMaterial; | ||
| 67 | + | ||
| 68 | + @ApiModelProperty("物流存欠料") | ||
| 69 | + private String logisticsStockMaterial; | ||
| 70 | + | ||
| 71 | + @ApiModelProperty("车牌号") | ||
| 72 | + private String plateNumber; | ||
| 73 | + | ||
| 74 | + @ApiModelProperty("业务摘要") | ||
| 75 | + private String businessSummary; | ||
| 76 | + | ||
| 77 | + @ApiModelProperty("特别说明") | ||
| 78 | + private String specialNote; | ||
| 79 | + | ||
| 80 | + @ApiModelProperty("单据备注") | ||
| 81 | + private String documentRemark; | ||
| 82 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.weighing; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModelProperty; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 过磅码单-申请数量明细行(买断计划才填写) | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class WeighingTicketApplyLineVo implements Serializable { | ||
| 14 | + | ||
| 15 | + private static final long serialVersionUID = 1L; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty("行ID,修改时传") | ||
| 18 | + private String id; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty("类别(品种关系表.code)") | ||
| 21 | + private String category; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty("品种关系表ID") | ||
| 24 | + private String breedRelationshipId; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty("数量") | ||
| 27 | + private BigDecimal quantity; | ||
| 28 | + | ||
| 29 | + @ApiModelProperty("前端行标识") | ||
| 30 | + private String itemId; | ||
| 31 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.weighing; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import javax.validation.constraints.NotBlank; | ||
| 9 | +import java.io.Serializable; | ||
| 10 | + | ||
| 11 | +@Data | ||
| 12 | +@ApiModel("过磅码单上传附件Vo") | ||
| 13 | +public class WeighingTicketAttachmentVo implements BaseVo, Serializable { | ||
| 14 | + | ||
| 15 | + private static final long serialVersionUID = 1L; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty(value = "过磅码单ID", required = true) | ||
| 18 | + @NotBlank(message = "过磅码单ID不能为空!") | ||
| 19 | + private String id; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty("附件文件ID集合(多文件,逗号分隔)") | ||
| 22 | + private String fileIds; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty("附件文件名称集合(多文件,逗号分隔)") | ||
| 25 | + private String fileNames; | ||
| 26 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.weighing; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModelProperty; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 过磅码单-计划明细行(选择计划后自动带出) | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class WeighingTicketPlanLineVo implements Serializable { | ||
| 14 | + | ||
| 15 | + private static final long serialVersionUID = 1L; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty("行ID,修改时传") | ||
| 18 | + private String id; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty(value = "采购计划ID", required = true) | ||
| 21 | + private String procurementPlanId; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty("采购计划明细行ID") | ||
| 24 | + private String procurementPlanLineId; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty("计划编号") | ||
| 27 | + private String planCode; | ||
| 28 | + | ||
| 29 | + @ApiModelProperty("计划单品种ID") | ||
| 30 | + private String productId; | ||
| 31 | + | ||
| 32 | + @ApiModelProperty("计划数量") | ||
| 33 | + private BigDecimal quantity; | ||
| 34 | + | ||
| 35 | + @ApiModelProperty("前端行标识") | ||
| 36 | + private String itemId; | ||
| 37 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.weighing; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModelProperty; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 过磅码单-过磅明细行 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class WeighingTicketWeighLineVo implements Serializable { | ||
| 14 | + | ||
| 15 | + private static final long serialVersionUID = 1L; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty("行ID,修改时传") | ||
| 18 | + private String id; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty("采购计划ID(计划编号下拉来源)") | ||
| 21 | + private String procurementPlanId; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty("计划编号") | ||
| 24 | + private String planCode; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty("过磅品种ID") | ||
| 27 | + private String productId; | ||
| 28 | + | ||
| 29 | + @ApiModelProperty("开票品名") | ||
| 30 | + private String invoiceProductName; | ||
| 31 | + | ||
| 32 | + @ApiModelProperty("过磅数量") | ||
| 33 | + private BigDecimal quantity; | ||
| 34 | + | ||
| 35 | + @ApiModelProperty("前端行标识") | ||
| 36 | + private String itemId; | ||
| 37 | +} |
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | <resultMap id="ProcurementPlanLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine"> | 5 | <resultMap id="ProcurementPlanLine" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine"> |
| 6 | <id column="id" property="id"/> | 6 | <id column="id" property="id"/> |
| 7 | <result column="procurement_plan_id" property="procurementPlanId"/> | 7 | <result column="procurement_plan_id" property="procurementPlanId"/> |
| 8 | + <result column="plan_code" property="planCode"/> | ||
| 8 | <result column="procurement_plan_line_id" property="procurementPlanLineId"/> | 9 | <result column="procurement_plan_line_id" property="procurementPlanLineId"/> |
| 9 | <result column="salesman_quotation_line_id" property="salesmanQuotationLineId"/> | 10 | <result column="salesman_quotation_line_id" property="salesmanQuotationLineId"/> |
| 10 | <result column="product_id" property="productId"/> | 11 | <result column="product_id" property="productId"/> |
| @@ -34,6 +35,7 @@ | @@ -34,6 +35,7 @@ | ||
| 34 | SELECT | 35 | SELECT |
| 35 | ppl.id, | 36 | ppl.id, |
| 36 | ppl.procurement_plan_id, | 37 | ppl.procurement_plan_id, |
| 38 | + pp.code AS plan_code, | ||
| 37 | ppl.procurement_plan_line_id, | 39 | ppl.procurement_plan_line_id, |
| 38 | ppl.salesman_quotation_line_id, | 40 | ppl.salesman_quotation_line_id, |
| 39 | ppl.product_id, | 41 | ppl.product_id, |
| @@ -58,6 +60,7 @@ | @@ -58,6 +60,7 @@ | ||
| 58 | ppl.create_time, | 60 | ppl.create_time, |
| 59 | ppl.update_time | 61 | ppl.update_time |
| 60 | FROM procurement_plan_line AS ppl | 62 | FROM procurement_plan_line AS ppl |
| 63 | + LEFT JOIN procurement_plan pp ON pp.id = ppl.procurement_plan_id | ||
| 61 | LEFT JOIN base_data_breed_relationship br ON br.id = ppl.product_id | 64 | LEFT JOIN base_data_breed_relationship br ON br.id = ppl.product_id |
| 62 | LEFT JOIN base_data_workshop as ws on ws.id = ppl.workshop_id | 65 | LEFT JOIN base_data_workshop as ws on ws.id = ppl.workshop_id |
| 63 | </sql> | 66 | </sql> |
| @@ -68,6 +71,15 @@ | @@ -68,6 +71,15 @@ | ||
| 68 | ORDER BY ppl.create_time ASC | 71 | ORDER BY ppl.create_time ASC |
| 69 | </select> | 72 | </select> |
| 70 | 73 | ||
| 74 | + <select id="getByProcurementPlanIds" resultMap="ProcurementPlanLine"> | ||
| 75 | + <include refid="ProcurementPlanLine_sql"/> | ||
| 76 | + WHERE ppl.procurement_plan_id IN | ||
| 77 | + <foreach collection="procurementPlanIds" open="(" separator="," close=")" item="item"> | ||
| 78 | + #{item} | ||
| 79 | + </foreach> | ||
| 80 | + ORDER BY ppl.procurement_plan_id, ppl.create_time ASC | ||
| 81 | + </select> | ||
| 82 | + | ||
| 71 | <delete id="deleteByProcurementPlanId"> | 83 | <delete id="deleteByProcurementPlanId"> |
| 72 | DELETE FROM procurement_plan_line WHERE procurement_plan_id = #{procurementPlanId} | 84 | DELETE FROM procurement_plan_line WHERE procurement_plan_id = #{procurementPlanId} |
| 73 | </delete> | 85 | </delete> |
| 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.weighing.ProcurementWeighingTicketApplyLineMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="ProcurementWeighingTicketApplyLineResult" type="com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketApplyLine"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="weighing_ticket_id" property="weighingTicketId"/> | ||
| 8 | + <result column="category" property="category"/> | ||
| 9 | + <result column="breed_relationship_id" property="breedRelationshipId"/> | ||
| 10 | + <result column="quantity" property="quantity"/> | ||
| 11 | + <result column="order_no" property="orderNo"/> | ||
| 12 | + <result column="item_id" property="itemId"/> | ||
| 13 | + <result column="create_by_id" property="createById"/> | ||
| 14 | + <result column="create_by" property="createBy"/> | ||
| 15 | + <result column="update_by_id" property="updateById"/> | ||
| 16 | + <result column="update_by" property="updateBy"/> | ||
| 17 | + <result column="create_time" property="createTime"/> | ||
| 18 | + <result column="update_time" property="updateTime"/> | ||
| 19 | + </resultMap> | ||
| 20 | + | ||
| 21 | + <sql id="PWTA_sql"> | ||
| 22 | + SELECT | ||
| 23 | + pwta.id, | ||
| 24 | + pwta.weighing_ticket_id, | ||
| 25 | + pwta.category, | ||
| 26 | + pwta.breed_relationship_id, | ||
| 27 | + pwta.quantity, | ||
| 28 | + pwta.order_no, | ||
| 29 | + pwta.item_id, | ||
| 30 | + pwta.create_by_id, | ||
| 31 | + pwta.create_by, | ||
| 32 | + pwta.update_by_id, | ||
| 33 | + pwta.update_by, | ||
| 34 | + pwta.create_time, | ||
| 35 | + pwta.update_time | ||
| 36 | + FROM procurement_weighing_ticket_apply_line AS pwta | ||
| 37 | + </sql> | ||
| 38 | + | ||
| 39 | + <select id="getByWeighingTicketId" resultMap="ProcurementWeighingTicketApplyLineResult"> | ||
| 40 | + <include refid="PWTA_sql"/> | ||
| 41 | + WHERE pwta.weighing_ticket_id = #{weighingTicketId} | ||
| 42 | + ORDER BY pwta.order_no ASC | ||
| 43 | + </select> | ||
| 44 | + | ||
| 45 | + <delete id="deleteByWeighingTicketId"> | ||
| 46 | + DELETE FROM procurement_weighing_ticket_apply_line WHERE weighing_ticket_id = #{weighingTicketId} | ||
| 47 | + </delete> | ||
| 48 | +</mapper> |
xingyun-sc/src/main/resources/mappers/procurement/weighing/ProcurementWeighingTicketLineMapper.xml
0 → 100644
| 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.weighing.ProcurementWeighingTicketLineMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="ProcurementWeighingTicketLineResult" type="com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketLine"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="weighing_ticket_id" property="weighingTicketId"/> | ||
| 8 | + <result column="procurement_plan_id" property="procurementPlanId"/> | ||
| 9 | + <result column="plan_code" property="planCode"/> | ||
| 10 | + <result column="product_id" property="productId"/> | ||
| 11 | + <result column="product_name" property="productName"/> | ||
| 12 | + <result column="invoice_product_name" property="invoiceProductName"/> | ||
| 13 | + <result column="quantity" property="quantity"/> | ||
| 14 | + <result column="order_no" property="orderNo"/> | ||
| 15 | + <result column="item_id" property="itemId"/> | ||
| 16 | + <result column="create_by_id" property="createById"/> | ||
| 17 | + <result column="create_by" property="createBy"/> | ||
| 18 | + <result column="update_by_id" property="updateById"/> | ||
| 19 | + <result column="update_by" property="updateBy"/> | ||
| 20 | + <result column="create_time" property="createTime"/> | ||
| 21 | + <result column="update_time" property="updateTime"/> | ||
| 22 | + </resultMap> | ||
| 23 | + | ||
| 24 | + <sql id="PWTL_sql"> | ||
| 25 | + SELECT | ||
| 26 | + pwtl.id, | ||
| 27 | + pwtl.weighing_ticket_id, | ||
| 28 | + pwtl.procurement_plan_id, | ||
| 29 | + pwtl.plan_code, | ||
| 30 | + pwtl.product_id, | ||
| 31 | + br.product_name, | ||
| 32 | + pwtl.invoice_product_name, | ||
| 33 | + pwtl.quantity, | ||
| 34 | + pwtl.order_no, | ||
| 35 | + pwtl.item_id, | ||
| 36 | + pwtl.create_by_id, | ||
| 37 | + pwtl.create_by, | ||
| 38 | + pwtl.update_by_id, | ||
| 39 | + pwtl.update_by, | ||
| 40 | + pwtl.create_time, | ||
| 41 | + pwtl.update_time | ||
| 42 | + FROM procurement_weighing_ticket_line AS pwtl | ||
| 43 | + LEFT JOIN base_data_breed_relationship br ON br.id = pwtl.product_id | ||
| 44 | + </sql> | ||
| 45 | + | ||
| 46 | + <select id="getByWeighingTicketId" resultMap="ProcurementWeighingTicketLineResult"> | ||
| 47 | + <include refid="PWTL_sql"/> | ||
| 48 | + WHERE pwtl.weighing_ticket_id = #{weighingTicketId} | ||
| 49 | + ORDER BY pwtl.order_no ASC | ||
| 50 | + </select> | ||
| 51 | + | ||
| 52 | + <delete id="deleteByWeighingTicketId"> | ||
| 53 | + DELETE FROM procurement_weighing_ticket_line WHERE weighing_ticket_id = #{weighingTicketId} | ||
| 54 | + </delete> | ||
| 55 | +</mapper> |
xingyun-sc/src/main/resources/mappers/procurement/weighing/ProcurementWeighingTicketMapper.xml
0 → 100644
| 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.weighing.ProcurementWeighingTicketMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="ProcurementWeighingTicketResult" type="com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicket"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="code" property="code"/> | ||
| 8 | + <result column="type" property="type"/> | ||
| 9 | + <result column="unit" property="unit"/> | ||
| 10 | + <result column="first_gross_weight_time" property="firstGrossWeightTime"/> | ||
| 11 | + <result column="complete_time" property="completeTime"/> | ||
| 12 | + <result column="supplier_id" property="supplierId"/> | ||
| 13 | + <result column="supplier_name" property="supplierName"/> | ||
| 14 | + <result column="company_short_id" property="companyShortId"/> | ||
| 15 | + <result column="company_short_name" property="companyShortName"/> | ||
| 16 | + <result column="workshop_id" property="workshopId"/> | ||
| 17 | + <result column="workshop_name" property="workshopName"/> | ||
| 18 | + <result column="workshop_code" property="workshopCode"/> | ||
| 19 | + <result column="buyout" property="buyout"/> | ||
| 20 | + <result column="material_name" property="materialName"/> | ||
| 21 | + <result column="total_gross_weight" property="totalGrossWeight"/> | ||
| 22 | + <result column="actual_impurity_weight" property="actualImpurityWeight"/> | ||
| 23 | + <result column="net_weight" property="netWeight"/> | ||
| 24 | + <result column="net_weight_upper" property="netWeightUpper"/> | ||
| 25 | + <result column="deduction_types" property="deductionTypes"/> | ||
| 26 | + <result column="supplier_stock_material" property="supplierStockMaterial"/> | ||
| 27 | + <result column="logistics_stock_material" property="logisticsStockMaterial"/> | ||
| 28 | + <result column="plate_number" property="plateNumber"/> | ||
| 29 | + <result column="business_summary" property="businessSummary"/> | ||
| 30 | + <result column="special_note" property="specialNote"/> | ||
| 31 | + <result column="document_remark" property="documentRemark"/> | ||
| 32 | + <result column="approval_status" property="approvalStatus"/> | ||
| 33 | + <result column="sign_attachment_file_ids" property="signAttachmentFileIds"/> | ||
| 34 | + <result column="sign_attachment_file_names" property="signAttachmentFileNames"/> | ||
| 35 | + <result column="delay_attachment_file_ids" property="delayAttachmentFileIds"/> | ||
| 36 | + <result column="delay_attachment_file_names" property="delayAttachmentFileNames"/> | ||
| 37 | + <result column="reweigh_attachment_file_ids" property="reweighAttachmentFileIds"/> | ||
| 38 | + <result column="reweigh_attachment_file_names" property="reweighAttachmentFileNames"/> | ||
| 39 | + <result column="deleted" property="deleted"/> | ||
| 40 | + <result column="create_by_id" property="createById"/> | ||
| 41 | + <result column="create_by" property="createBy"/> | ||
| 42 | + <result column="update_by_id" property="updateById"/> | ||
| 43 | + <result column="update_by" property="updateBy"/> | ||
| 44 | + <result column="create_time" property="createTime"/> | ||
| 45 | + <result column="update_time" property="updateTime"/> | ||
| 46 | + <result column="plan_codes" property="planCodes"/> | ||
| 47 | + <result column="plan_ids" property="planIds"/> | ||
| 48 | + </resultMap> | ||
| 49 | + | ||
| 50 | + <sql id="PWT_sql"> | ||
| 51 | + SELECT | ||
| 52 | + pwt.id, | ||
| 53 | + pwt.code, | ||
| 54 | + pwt.type, | ||
| 55 | + pwt.unit, | ||
| 56 | + pwt.first_gross_weight_time, | ||
| 57 | + pwt.complete_time, | ||
| 58 | + pwt.supplier_id, | ||
| 59 | + pwt.supplier_name, | ||
| 60 | + pwt.company_short_id, | ||
| 61 | + pwt.company_short_name, | ||
| 62 | + pwt.workshop_id, | ||
| 63 | + pwt.workshop_name, | ||
| 64 | + ws.code AS workshop_code, | ||
| 65 | + pwt.buyout, | ||
| 66 | + pwt.material_name, | ||
| 67 | + pwt.total_gross_weight, | ||
| 68 | + pwt.actual_impurity_weight, | ||
| 69 | + pwt.net_weight, | ||
| 70 | + pwt.net_weight_upper, | ||
| 71 | + pwt.deduction_types, | ||
| 72 | + pwt.supplier_stock_material, | ||
| 73 | + pwt.logistics_stock_material, | ||
| 74 | + pwt.plate_number, | ||
| 75 | + pwt.business_summary, | ||
| 76 | + pwt.special_note, | ||
| 77 | + pwt.document_remark, | ||
| 78 | + pwt.approval_status, | ||
| 79 | + pwt.sign_attachment_file_ids, | ||
| 80 | + pwt.sign_attachment_file_names, | ||
| 81 | + pwt.delay_attachment_file_ids, | ||
| 82 | + pwt.delay_attachment_file_names, | ||
| 83 | + pwt.reweigh_attachment_file_ids, | ||
| 84 | + pwt.reweigh_attachment_file_names, | ||
| 85 | + pwt.deleted, | ||
| 86 | + pwt.create_by_id, | ||
| 87 | + pwt.create_by, | ||
| 88 | + pwt.update_by_id, | ||
| 89 | + pwt.update_by, | ||
| 90 | + pwt.create_time, | ||
| 91 | + pwt.update_time, | ||
| 92 | + ( | ||
| 93 | + SELECT GROUP_CONCAT(DISTINCT pwtp.plan_code ORDER BY pwtp.order_no SEPARATOR ',') | ||
| 94 | + FROM procurement_weighing_ticket_plan pwtp | ||
| 95 | + WHERE pwtp.weighing_ticket_id = pwt.id | ||
| 96 | + ) AS plan_codes, | ||
| 97 | + ( | ||
| 98 | + SELECT GROUP_CONCAT(DISTINCT pwtpi.procurement_plan_id SEPARATOR ',') | ||
| 99 | + FROM procurement_weighing_ticket_plan pwtpi | ||
| 100 | + WHERE pwtpi.weighing_ticket_id = pwt.id | ||
| 101 | + ) AS plan_ids | ||
| 102 | + FROM procurement_weighing_ticket AS pwt | ||
| 103 | + LEFT JOIN base_data_workshop ws ON ws.id = pwt.workshop_id | ||
| 104 | + </sql> | ||
| 105 | + | ||
| 106 | + <select id="query" resultMap="ProcurementWeighingTicketResult"> | ||
| 107 | + <include refid="PWT_sql"/> | ||
| 108 | + <where> | ||
| 109 | + <choose> | ||
| 110 | + <when test="vo.deleted != null"> | ||
| 111 | + AND pwt.deleted = #{vo.deleted} | ||
| 112 | + </when> | ||
| 113 | + <otherwise> | ||
| 114 | + AND pwt.deleted = 0 | ||
| 115 | + </otherwise> | ||
| 116 | + </choose> | ||
| 117 | + <if test="vo != null"> | ||
| 118 | + <if test="vo.code != null and vo.code != ''"> | ||
| 119 | + AND pwt.code LIKE CONCAT('%', #{vo.code}, '%') | ||
| 120 | + </if> | ||
| 121 | + <if test="vo.planCode != null and vo.planCode != ''"> | ||
| 122 | + AND EXISTS ( | ||
| 123 | + SELECT 1 FROM procurement_weighing_ticket_plan pwtp | ||
| 124 | + WHERE pwtp.weighing_ticket_id = pwt.id | ||
| 125 | + AND pwtp.plan_code LIKE CONCAT('%', #{vo.planCode}, '%') | ||
| 126 | + ) | ||
| 127 | + </if> | ||
| 128 | + <if test="vo.supplierName != null and vo.supplierName != ''"> | ||
| 129 | + AND pwt.supplier_name LIKE CONCAT('%', #{vo.supplierName}, '%') | ||
| 130 | + </if> | ||
| 131 | + <if test="vo.companyShortId != null and vo.companyShortId != ''"> | ||
| 132 | + AND pwt.company_short_id = #{vo.companyShortId} | ||
| 133 | + </if> | ||
| 134 | + <if test="vo.approvalStatus != null and vo.approvalStatus != ''"> | ||
| 135 | + AND pwt.approval_status = #{vo.approvalStatus} | ||
| 136 | + </if> | ||
| 137 | + <if test="vo.startTime != null"> | ||
| 138 | + AND pwt.first_gross_weight_time <![CDATA[ >= ]]> #{vo.startTime} | ||
| 139 | + </if> | ||
| 140 | + <if test="vo.endTime != null"> | ||
| 141 | + AND pwt.first_gross_weight_time <![CDATA[ <= ]]> #{vo.endTime} | ||
| 142 | + </if> | ||
| 143 | + <if test="vo.createBy != null and vo.createBy != ''"> | ||
| 144 | + AND pwt.create_by LIKE CONCAT('%', #{vo.createBy}, '%') | ||
| 145 | + </if> | ||
| 146 | + <if test="vo.createById != null and vo.createById != ''"> | ||
| 147 | + AND pwt.create_by_id = #{vo.createById} | ||
| 148 | + </if> | ||
| 149 | + <if test="vo.createByIdList != null and vo.createByIdList.size() > 0"> | ||
| 150 | + AND pwt.create_by_id IN | ||
| 151 | + <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item"> | ||
| 152 | + #{item} | ||
| 153 | + </foreach> | ||
| 154 | + </if> | ||
| 155 | + </if> | ||
| 156 | + </where> | ||
| 157 | + ORDER BY pwt.create_time DESC | ||
| 158 | + </select> | ||
| 159 | + | ||
| 160 | + <select id="findById" resultMap="ProcurementWeighingTicketResult"> | ||
| 161 | + <include refid="PWT_sql"/> | ||
| 162 | + WHERE pwt.id = #{id} | ||
| 163 | + </select> | ||
| 164 | + | ||
| 165 | + <!-- 查询以指定前缀开头的最大编号(用于生成当日流水号),不过滤 deleted 避免与作废单据重复 --> | ||
| 166 | + <select id="findMaxCodeByPrefix" resultType="java.lang.String"> | ||
| 167 | + SELECT MAX(pwt.code) | ||
| 168 | + FROM procurement_weighing_ticket pwt | ||
| 169 | + WHERE pwt.code LIKE CONCAT(#{prefix}, '%') | ||
| 170 | + </select> | ||
| 171 | + | ||
| 172 | + <!-- 可关联过磅码单的采购计划(新增过磅码单选择计划弹窗) --> | ||
| 173 | + <resultMap id="WeighingTicketPlanResult" type="com.lframework.xingyun.sc.bo.procurement.WeighingTicketPlanBo"> | ||
| 174 | + <id column="id" property="id"/> | ||
| 175 | + <result column="code" property="code"/> | ||
| 176 | + <result column="company_short_id" property="companyShortId"/> | ||
| 177 | + <result column="company_name" property="companyName"/> | ||
| 178 | + <result column="supplier_id" property="supplierId"/> | ||
| 179 | + <result column="supplier_name" property="supplierName"/> | ||
| 180 | + <result column="purchase_department" property="purchaseDepartment"/> | ||
| 181 | + <result column="purchase_department_name" property="purchaseDepartmentName"/> | ||
| 182 | + <result column="region" property="region"/> | ||
| 183 | + <result column="region_name" property="regionName"/> | ||
| 184 | + <result column="process_status" property="processStatus"/> | ||
| 185 | + <result column="plan_type" property="planType"/> | ||
| 186 | + <result column="total_quantity" property="totalQuantity"/> | ||
| 187 | + <result column="buyout" property="buyout"/> | ||
| 188 | + <result column="workshop_id" property="workshopId"/> | ||
| 189 | + <result column="workshop_name" property="workshopName"/> | ||
| 190 | + <result column="create_by" property="createBy"/> | ||
| 191 | + <result column="create_time" property="createTime"/> | ||
| 192 | + </resultMap> | ||
| 193 | + | ||
| 194 | + <select id="queryWeighingTicketPlans" resultMap="WeighingTicketPlanResult"> | ||
| 195 | + SELECT | ||
| 196 | + pp.id, | ||
| 197 | + pp.code, | ||
| 198 | + pp.company_short_id, | ||
| 199 | + bdcs.company_name AS company_name, | ||
| 200 | + pp.supplier_id, | ||
| 201 | + pdc.unit_name AS supplier_name, | ||
| 202 | + pp.purchase_department, | ||
| 203 | + sd.name AS purchase_department_name, | ||
| 204 | + pp.region, | ||
| 205 | + sd1.name AS region_name, | ||
| 206 | + pp.process_status, | ||
| 207 | + pp.plan_type, | ||
| 208 | + pp.total_quantity, | ||
| 209 | + CASE WHEN pp.commodity_buyout = 1 OR pp.quality_buyout = 1 OR pp.quantity_buyout = 1 | ||
| 210 | + THEN 1 ELSE 0 END AS buyout, | ||
| 211 | + pp.workshop_id, | ||
| 212 | + ws.name AS workshop_name, | ||
| 213 | + pp.create_by, | ||
| 214 | + pp.create_time | ||
| 215 | + FROM procurement_plan AS pp | ||
| 216 | + LEFT JOIN base_data_company_short AS bdcs ON bdcs.id = pp.company_short_id | ||
| 217 | + LEFT JOIN procurement_domestic_customer_credit pdc ON pdc.id = pp.supplier_id | ||
| 218 | + LEFT JOIN sys_dept sd ON sd.id = pp.purchase_department | ||
| 219 | + LEFT JOIN sys_dept sd1 ON sd1.id = pp.region | ||
| 220 | + LEFT JOIN base_data_workshop AS ws ON ws.id = pp.workshop_id | ||
| 221 | + <where> | ||
| 222 | + AND pp.deleted = 0 | ||
| 223 | + <!-- 未冻结 --> | ||
| 224 | + AND (pp.frozen = 0 OR pp.frozen IS NULL) | ||
| 225 | + <!-- 流程状态已完成 --> | ||
| 226 | + AND pp.process_status = 'COMPLETED' | ||
| 227 | + <!-- 不在变更中(空或变更完成可选) --> | ||
| 228 | + AND (pp.change_status = '' OR pp.change_status IS NULL OR pp.change_status = 'CHANGED') | ||
| 229 | + <!-- 不在补单中(空或补单完成可选) --> | ||
| 230 | + AND (pp.replenishment_status = '' OR pp.replenishment_status IS NULL | ||
| 231 | + OR pp.replenishment_status = 'REPLENISHED') | ||
| 232 | + <!-- 多计划一致性:非买断/买断、供料单位、收料单位保持一致 --> | ||
| 233 | + <if test="vo != null"> | ||
| 234 | + <if test="vo.code != null and vo.code != ''"> | ||
| 235 | + AND pp.code LIKE CONCAT('%', #{vo.code}, '%') | ||
| 236 | + </if> | ||
| 237 | + <if test="vo.companyName != null and vo.companyName != ''"> | ||
| 238 | + AND bdcs.company_name LIKE CONCAT('%', #{vo.companyName}, '%') | ||
| 239 | + </if> | ||
| 240 | + <if test="vo.purchaseDeptId != null and vo.purchaseDeptId != ''"> | ||
| 241 | + AND pp.purchase_department = #{vo.purchaseDeptId} | ||
| 242 | + </if> | ||
| 243 | + <if test="vo.supplierName != null and vo.supplierName != ''"> | ||
| 244 | + AND pdc.unit_name LIKE CONCAT('%', #{vo.supplierName}, '%') | ||
| 245 | + </if> | ||
| 246 | + <if test="vo.planType != null and vo.planType != ''"> | ||
| 247 | + AND pp.plan_type = #{vo.planType} | ||
| 248 | + </if> | ||
| 249 | + <if test="vo.buyout != null"> | ||
| 250 | + <choose> | ||
| 251 | + <when test="vo.buyout"> | ||
| 252 | + AND (pp.commodity_buyout = 1 OR pp.quality_buyout = 1 OR pp.quantity_buyout = 1) | ||
| 253 | + </when> | ||
| 254 | + <otherwise> | ||
| 255 | + AND pp.commodity_buyout = 0 | ||
| 256 | + AND pp.quality_buyout = 0 | ||
| 257 | + AND pp.quantity_buyout = 0 | ||
| 258 | + </otherwise> | ||
| 259 | + </choose> | ||
| 260 | + </if> | ||
| 261 | + <if test="vo.supplierId != null and vo.supplierId != ''"> | ||
| 262 | + AND pp.supplier_id = #{vo.supplierId} | ||
| 263 | + </if> | ||
| 264 | + <if test="vo.companyShortId != null and vo.companyShortId != ''"> | ||
| 265 | + AND pp.company_short_id = #{vo.companyShortId} | ||
| 266 | + </if> | ||
| 267 | + <if test="vo.workshopId != null and vo.workshopId != ''"> | ||
| 268 | + AND pp.workshop_id = #{vo.workshopId} | ||
| 269 | + </if> | ||
| 270 | + </if> | ||
| 271 | + </where> | ||
| 272 | + ORDER BY pp.create_time DESC | ||
| 273 | + </select> | ||
| 274 | + | ||
| 275 | + <!-- 过磅码单可选采购计划:复用 ProcurementPlan 的 JOIN 取名称,供新增/修改校验与数据带出 --> | ||
| 276 | + <resultMap id="WeighCandidatePlanResult" type="com.lframework.xingyun.sc.procurement.entity.ProcurementPlan"> | ||
| 277 | + <id column="id" property="id"/> | ||
| 278 | + <result column="code" property="code"/> | ||
| 279 | + <result column="parent_id" property="parentId"/> | ||
| 280 | + <result column="company_short_id" property="companyShortId"/> | ||
| 281 | + <result column="company_short_name" property="companyShortName"/> | ||
| 282 | + <result column="supplier_id" property="supplierId"/> | ||
| 283 | + <result column="supplier_name" property="supplierName"/> | ||
| 284 | + <result column="workshop_id" property="workshopId"/> | ||
| 285 | + <result column="workshop_name" property="workshopName"/> | ||
| 286 | + <result column="date" property="date"/> | ||
| 287 | + <result column="quoter_name" property="quoterName"/> | ||
| 288 | + <result column="total_quantity" property="totalQuantity"/> | ||
| 289 | + <result column="commodity_buyout" property="commodityBuyout"/> | ||
| 290 | + <result column="quality_buyout" property="qualityBuyout"/> | ||
| 291 | + <result column="quantity_buyout" property="quantityBuyout"/> | ||
| 292 | + <result column="approval_status" property="approvalStatus"/> | ||
| 293 | + <result column="process_status" property="processStatus"/> | ||
| 294 | + <result column="change_status" property="changeStatus"/> | ||
| 295 | + <result column="replenishment_status" property="replenishmentStatus"/> | ||
| 296 | + <result column="deleted" property="deleted"/> | ||
| 297 | + <result column="create_by_id" property="createById"/> | ||
| 298 | + <result column="create_by" property="createBy"/> | ||
| 299 | + <result column="create_time" property="createTime"/> | ||
| 300 | + </resultMap> | ||
| 301 | + | ||
| 302 | + <!-- 按计划ID批量查询满足过磅码单条件的采购计划(新增/修改时的选择校验与自动带出) --> | ||
| 303 | + <select id="getCandidatePlansByIds" resultMap="WeighCandidatePlanResult"> | ||
| 304 | + SELECT | ||
| 305 | + pp.id, | ||
| 306 | + pp.code, | ||
| 307 | + pp.parent_id, | ||
| 308 | + pp.company_short_id, | ||
| 309 | + bdcs.short_name AS company_short_name, | ||
| 310 | + pp.supplier_id, | ||
| 311 | + pdc.unit_name AS supplier_name, | ||
| 312 | + pp.workshop_id, | ||
| 313 | + ws.name AS workshop_name, | ||
| 314 | + pp.date, | ||
| 315 | + pp.quoter_name, | ||
| 316 | + pp.total_quantity, | ||
| 317 | + pp.commodity_buyout, | ||
| 318 | + pp.quality_buyout, | ||
| 319 | + pp.quantity_buyout, | ||
| 320 | + pp.approval_status, | ||
| 321 | + pp.process_status, | ||
| 322 | + pp.change_status, | ||
| 323 | + pp.replenishment_status, | ||
| 324 | + pp.deleted, | ||
| 325 | + pp.create_by_id, | ||
| 326 | + pp.create_by, | ||
| 327 | + pp.create_time | ||
| 328 | + FROM procurement_plan AS pp | ||
| 329 | + LEFT JOIN base_data_company_short AS bdcs ON bdcs.id = pp.company_short_id | ||
| 330 | + LEFT JOIN procurement_domestic_customer_credit pdc ON pdc.id = pp.supplier_id | ||
| 331 | + LEFT JOIN base_data_workshop AS ws ON ws.id = pp.workshop_id | ||
| 332 | + WHERE pp.id IN | ||
| 333 | + <foreach collection="ids" open="(" separator="," close=")" item="item"> | ||
| 334 | + #{item} | ||
| 335 | + </foreach> | ||
| 336 | + AND pp.deleted = 0 | ||
| 337 | + <!-- 未冻结 --> | ||
| 338 | + AND (pp.frozen = 0 OR pp.frozen IS NULL) | ||
| 339 | + <!-- 流程状态已完成 --> | ||
| 340 | + AND pp.process_status = 'COMPLETED' | ||
| 341 | + <!-- 不在变更中(空或变更完成可选) --> | ||
| 342 | + AND (pp.change_status = '' OR pp.change_status IS NULL OR pp.change_status = 'CHANGED') | ||
| 343 | + <!-- 不在补单中(空或补单完成可选) --> | ||
| 344 | + AND (pp.replenishment_status = '' OR pp.replenishment_status IS NULL | ||
| 345 | + OR pp.replenishment_status = 'REPLENISHED') | ||
| 346 | + </select> | ||
| 347 | +</mapper> |
xingyun-sc/src/main/resources/mappers/procurement/weighing/ProcurementWeighingTicketPlanMapper.xml
0 → 100644
| 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.weighing.ProcurementWeighingTicketPlanMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="ProcurementWeighingTicketPlanResult" type="com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketPlan"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="weighing_ticket_id" property="weighingTicketId"/> | ||
| 8 | + <result column="procurement_plan_id" property="procurementPlanId"/> | ||
| 9 | + <result column="procurement_plan_line_id" property="procurementPlanLineId"/> | ||
| 10 | + <result column="plan_code" property="planCode"/> | ||
| 11 | + <result column="product_id" property="productId"/> | ||
| 12 | + <result column="product_name" property="productName"/> | ||
| 13 | + <result column="quantity" property="quantity"/> | ||
| 14 | + <result column="order_no" property="orderNo"/> | ||
| 15 | + <result column="item_id" property="itemId"/> | ||
| 16 | + <result column="create_by_id" property="createById"/> | ||
| 17 | + <result column="create_by" property="createBy"/> | ||
| 18 | + <result column="update_by_id" property="updateById"/> | ||
| 19 | + <result column="update_by" property="updateBy"/> | ||
| 20 | + <result column="create_time" property="createTime"/> | ||
| 21 | + <result column="update_time" property="updateTime"/> | ||
| 22 | + </resultMap> | ||
| 23 | + | ||
| 24 | + <sql id="PWTP_sql"> | ||
| 25 | + SELECT | ||
| 26 | + pwtp.id, | ||
| 27 | + pwtp.weighing_ticket_id, | ||
| 28 | + pwtp.procurement_plan_id, | ||
| 29 | + pwtp.procurement_plan_line_id, | ||
| 30 | + pwtp.plan_code, | ||
| 31 | + pwtp.product_id, | ||
| 32 | + br.product_name, | ||
| 33 | + pwtp.quantity, | ||
| 34 | + pwtp.order_no, | ||
| 35 | + pwtp.item_id, | ||
| 36 | + pwtp.create_by_id, | ||
| 37 | + pwtp.create_by, | ||
| 38 | + pwtp.update_by_id, | ||
| 39 | + pwtp.update_by, | ||
| 40 | + pwtp.create_time, | ||
| 41 | + pwtp.update_time | ||
| 42 | + FROM procurement_weighing_ticket_plan AS pwtp | ||
| 43 | + LEFT JOIN base_data_breed_relationship br ON br.id = pwtp.product_id | ||
| 44 | + </sql> | ||
| 45 | + | ||
| 46 | + <select id="getByWeighingTicketId" resultMap="ProcurementWeighingTicketPlanResult"> | ||
| 47 | + <include refid="PWTP_sql"/> | ||
| 48 | + WHERE pwtp.weighing_ticket_id = #{weighingTicketId} | ||
| 49 | + ORDER BY pwtp.order_no ASC | ||
| 50 | + </select> | ||
| 51 | + | ||
| 52 | + <delete id="deleteByWeighingTicketId"> | ||
| 53 | + DELETE FROM procurement_weighing_ticket_plan WHERE weighing_ticket_id = #{weighingTicketId} | ||
| 54 | + </delete> | ||
| 55 | +</mapper> |