Showing
7 changed files
with
81 additions
and
0 deletions
| @@ -2600,3 +2600,7 @@ ALTER TABLE procurement_weighing_ticket | @@ -2600,3 +2600,7 @@ ALTER TABLE procurement_weighing_ticket | ||
| 2600 | -- 采购计划:差值标识(审核通过初始化为"少 总数量吨",过磅码单完成/作废时重算,供应管理科主管可手动修改) | 2600 | -- 采购计划:差值标识(审核通过初始化为"少 总数量吨",过磅码单完成/作废时重算,供应管理科主管可手动修改) |
| 2601 | ALTER TABLE procurement_plan | 2601 | ALTER TABLE procurement_plan |
| 2602 | ADD COLUMN diff_quantity_flag varchar(50) DEFAULT NULL COMMENT '差值标识(多x吨/少x吨,null=差值在容差范围内不显示)'; | 2602 | ADD COLUMN diff_quantity_flag varchar(50) DEFAULT NULL COMMENT '差值标识(多x吨/少x吨,null=差值在容差范围内不显示)'; |
| 2603 | + | ||
| 2604 | +-- 过磅码单:复磅功能(复磅=新增一张码单关联原单、编号为F+原编号,复磅单审核通过后原码单作废) | ||
| 2605 | +ALTER TABLE procurement_weighing_ticket | ||
| 2606 | + ADD COLUMN origin_weighing_ticket_id varchar(32) DEFAULT NULL COMMENT '原过磅码单ID(复磅单关联原单,复磅单审核通过后原单作废)' AFTER `id`; |
| @@ -23,6 +23,9 @@ public class GetProcurementWeighingTicketBo extends BaseBo<ProcurementWeighingTi | @@ -23,6 +23,9 @@ public class GetProcurementWeighingTicketBo extends BaseBo<ProcurementWeighingTi | ||
| 23 | @ApiModelProperty("类型 REGULAR-常规 RETURN-退料换料") | 23 | @ApiModelProperty("类型 REGULAR-常规 RETURN-退料换料") |
| 24 | private String type; | 24 | private String type; |
| 25 | 25 | ||
| 26 | + @ApiModelProperty("原过磅码单ID(复磅单关联原单)") | ||
| 27 | + private String originWeighingTicketId; | ||
| 28 | + | ||
| 26 | @ApiModelProperty("单位") | 29 | @ApiModelProperty("单位") |
| 27 | private String unit; | 30 | private String unit; |
| 28 | 31 |
| @@ -35,6 +35,11 @@ public class ProcurementWeighingTicket extends BaseEntity implements BaseDto { | @@ -35,6 +35,11 @@ public class ProcurementWeighingTicket extends BaseEntity implements BaseDto { | ||
| 35 | private String type; | 35 | private String type; |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | + * 原过磅码单ID(复磅单关联原单,复磅单审核通过后原单作废;常规码单为空) | ||
| 39 | + */ | ||
| 40 | + private String originWeighingTicketId; | ||
| 41 | + | ||
| 42 | + /** | ||
| 38 | * 单位,固定公斤 | 43 | * 单位,固定公斤 |
| 39 | */ | 44 | */ |
| 40 | private String unit; | 45 | private String unit; |
| @@ -185,6 +185,13 @@ public class ProcurementWeighingTicketServiceImpl | @@ -185,6 +185,13 @@ public class ProcurementWeighingTicketServiceImpl | ||
| 185 | throw new DefaultClientException("编号已存在,请重新获取编号后再提交!"); | 185 | throw new DefaultClientException("编号已存在,请重新获取编号后再提交!"); |
| 186 | } | 186 | } |
| 187 | entity.setCode(vo.getCode()); | 187 | entity.setCode(vo.getCode()); |
| 188 | + // 复磅:类型不新增(复磅单以编号F前缀+关联原单体现),仅校验原单可复磅并记录关联 | ||
| 189 | + if (StringUtil.isNotBlank(vo.getOriginWeighingTicketId())) { | ||
| 190 | + assertReweighOrigin(vo.getOriginWeighingTicketId()); | ||
| 191 | + entity.setOriginWeighingTicketId(vo.getOriginWeighingTicketId()); | ||
| 192 | + entity.setReweighAttachmentFileIds(vo.getReweighAttachmentFileIds()); | ||
| 193 | + entity.setReweighAttachmentFileNames(vo.getReweighAttachmentFileNames()); | ||
| 194 | + } | ||
| 188 | entity.setType(StringUtil.isBlank(vo.getType()) ? TYPE_REGULAR : vo.getType()); | 195 | entity.setType(StringUtil.isBlank(vo.getType()) ? TYPE_REGULAR : vo.getType()); |
| 189 | // 第一次记录货物毛重时间:新增时填写了过磅总重,则以新增时间为准 | 196 | // 第一次记录货物毛重时间:新增时填写了过磅总重,则以新增时间为准 |
| 190 | if (vo.getTotalGrossWeight() != null) { | 197 | if (vo.getTotalGrossWeight() != null) { |
| @@ -260,6 +267,11 @@ public class ProcurementWeighingTicketServiceImpl | @@ -260,6 +267,11 @@ public class ProcurementWeighingTicketServiceImpl | ||
| 260 | if (oldEntity.getFirstGrossWeightTime() == null && vo.getTotalGrossWeight() != null) { | 267 | if (oldEntity.getFirstGrossWeightTime() == null && vo.getTotalGrossWeight() != null) { |
| 261 | updateWrapper.set(ProcurementWeighingTicket::getFirstGrossWeightTime, LocalDateTime.now()); | 268 | updateWrapper.set(ProcurementWeighingTicket::getFirstGrossWeightTime, LocalDateTime.now()); |
| 262 | } | 269 | } |
| 270 | + //复磅编辑 | ||
| 271 | + if (StringUtil.isNotBlank(vo.getOriginWeighingTicketId())) { | ||
| 272 | + updateWrapper.set(ProcurementWeighingTicket::getReweighAttachmentFileIds, vo.getReweighAttachmentFileIds()); | ||
| 273 | + updateWrapper.set(ProcurementWeighingTicket::getReweighAttachmentFileNames, vo.getReweighAttachmentFileNames()); | ||
| 274 | + } | ||
| 263 | 275 | ||
| 264 | this.update(updateWrapper); | 276 | this.update(updateWrapper); |
| 265 | 277 | ||
| @@ -328,6 +340,22 @@ public class ProcurementWeighingTicketServiceImpl | @@ -328,6 +340,22 @@ public class ProcurementWeighingTicketServiceImpl | ||
| 328 | this.update(Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) | 340 | this.update(Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) |
| 329 | .set(ProcurementWeighingTicket::getApprovalStatus, approvalStatus) | 341 | .set(ProcurementWeighingTicket::getApprovalStatus, approvalStatus) |
| 330 | .eq(ProcurementWeighingTicket::getId, id)); | 342 | .eq(ProcurementWeighingTicket::getId, id)); |
| 343 | + | ||
| 344 | + // 复磅单审核通过:作废原码单,并重算两单关联采购计划的差值标识 | ||
| 345 | + if (STATUS_PASS.equals(approvalStatus) && StringUtil.isNotBlank(entity.getOriginWeighingTicketId())) { | ||
| 346 | + String originId = entity.getOriginWeighingTicketId(); | ||
| 347 | + this.update(Wrappers.lambdaUpdate(ProcurementWeighingTicket.class) | ||
| 348 | + .set(ProcurementWeighingTicket::getDeleted, true) | ||
| 349 | + .eq(ProcurementWeighingTicket::getId, originId)); | ||
| 350 | + | ||
| 351 | + List<String> diffPlanIds = new ArrayList<>(collectPlanIdsByTicketId(originId)); | ||
| 352 | + collectPlanIdsByTicketId(id).forEach(planId -> { | ||
| 353 | + if (!diffPlanIds.contains(planId)) { | ||
| 354 | + diffPlanIds.add(planId); | ||
| 355 | + } | ||
| 356 | + }); | ||
| 357 | + recalcPlanDiffFlags(diffPlanIds); | ||
| 358 | + } | ||
| 331 | } | 359 | } |
| 332 | 360 | ||
| 333 | @Override | 361 | @Override |
| @@ -691,6 +719,27 @@ public class ProcurementWeighingTicketServiceImpl | @@ -691,6 +719,27 @@ public class ProcurementWeighingTicketServiceImpl | ||
| 691 | } | 719 | } |
| 692 | 720 | ||
| 693 | /** | 721 | /** |
| 722 | + * 复磅原单校验:存在且未作废、非复磅单(不允许复磅的复磅)、无未作废的复磅记录 | ||
| 723 | + * | ||
| 724 | + * @return 原过磅码单 | ||
| 725 | + */ | ||
| 726 | + private ProcurementWeighingTicket assertReweighOrigin(String originId) { | ||
| 727 | + ProcurementWeighingTicket origin = weighingTicketMapper.findById(originId); | ||
| 728 | + if (origin == null || Boolean.TRUE.equals(origin.getDeleted())) { | ||
| 729 | + throw new DefaultClientException("原过磅码单不存在或已作废,无法复磅!"); | ||
| 730 | + } | ||
| 731 | + if (StringUtil.isNotBlank(origin.getOriginWeighingTicketId())) { | ||
| 732 | + throw new DefaultClientException("复磅码单不允许再次复磅!"); | ||
| 733 | + } | ||
| 734 | + if (this.count(Wrappers.lambdaQuery(ProcurementWeighingTicket.class) | ||
| 735 | + .eq(ProcurementWeighingTicket::getOriginWeighingTicketId, originId) | ||
| 736 | + .eq(ProcurementWeighingTicket::getDeleted, false)) > 0) { | ||
| 737 | + throw new DefaultClientException("该过磅码单已存在复磅记录!"); | ||
| 738 | + } | ||
| 739 | + return origin; | ||
| 740 | + } | ||
| 741 | + | ||
| 742 | + /** | ||
| 694 | * 追加附件(多次上传累加,保持顺序去重) | 743 | * 追加附件(多次上传累加,保持顺序去重) |
| 695 | */ | 744 | */ |
| 696 | private String appendFiles(String oldValues, String newValues) { | 745 | private String appendFiles(String oldValues, String newValues) { |
| @@ -24,6 +24,9 @@ public class CreateProcurementWeighingTicketVo implements BaseVo, Serializable { | @@ -24,6 +24,9 @@ public class CreateProcurementWeighingTicketVo implements BaseVo, Serializable { | ||
| 24 | @ApiModelProperty("类型 REGULAR-常规 RETURN-退料换料,不传默认常规") | 24 | @ApiModelProperty("类型 REGULAR-常规 RETURN-退料换料,不传默认常规") |
| 25 | private String type; | 25 | private String type; |
| 26 | 26 | ||
| 27 | + @ApiModelProperty("原过磅码单ID(复磅时必传,编号为F+原编号)") | ||
| 28 | + private String originWeighingTicketId; | ||
| 29 | + | ||
| 27 | @ApiModelProperty(value = "选择的采购计划ID集合(多选)", required = true) | 30 | @ApiModelProperty(value = "选择的采购计划ID集合(多选)", required = true) |
| 28 | @NotEmpty(message = "请至少选择一个采购计划!") | 31 | @NotEmpty(message = "请至少选择一个采购计划!") |
| 29 | private List<String> planIds; | 32 | private List<String> planIds; |
| @@ -74,4 +77,10 @@ public class CreateProcurementWeighingTicketVo implements BaseVo, Serializable { | @@ -74,4 +77,10 @@ public class CreateProcurementWeighingTicketVo implements BaseVo, Serializable { | ||
| 74 | 77 | ||
| 75 | @ApiModelProperty("单据备注") | 78 | @ApiModelProperty("单据备注") |
| 76 | private String documentRemark; | 79 | private String documentRemark; |
| 80 | + | ||
| 81 | + @ApiModelProperty("复磅附件文件ID集合") | ||
| 82 | + private String reweighAttachmentFileIds; | ||
| 83 | + | ||
| 84 | + @ApiModelProperty("复磅附件文件名称集合") | ||
| 85 | + private String reweighAttachmentFileNames; | ||
| 77 | } | 86 | } |
| @@ -79,4 +79,13 @@ public class UpdateProcurementWeighingTicketVo implements BaseVo, Serializable { | @@ -79,4 +79,13 @@ public class UpdateProcurementWeighingTicketVo implements BaseVo, Serializable { | ||
| 79 | 79 | ||
| 80 | @ApiModelProperty("单据备注") | 80 | @ApiModelProperty("单据备注") |
| 81 | private String documentRemark; | 81 | private String documentRemark; |
| 82 | + | ||
| 83 | + @ApiModelProperty("原过磅码单ID(复磅时必传,编号为F+原编号)") | ||
| 84 | + private String originWeighingTicketId; | ||
| 85 | + | ||
| 86 | + @ApiModelProperty("复磅附件文件ID集合") | ||
| 87 | + private String reweighAttachmentFileIds; | ||
| 88 | + | ||
| 89 | + @ApiModelProperty("复磅附件文件名称集合") | ||
| 90 | + private String reweighAttachmentFileNames; | ||
| 82 | } | 91 | } |
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | <id column="id" property="id"/> | 6 | <id column="id" property="id"/> |
| 7 | <result column="code" property="code"/> | 7 | <result column="code" property="code"/> |
| 8 | <result column="type" property="type"/> | 8 | <result column="type" property="type"/> |
| 9 | + <result column="origin_weighing_ticket_id" property="originWeighingTicketId"/> | ||
| 9 | <result column="unit" property="unit"/> | 10 | <result column="unit" property="unit"/> |
| 10 | <result column="first_gross_weight_time" property="firstGrossWeightTime"/> | 11 | <result column="first_gross_weight_time" property="firstGrossWeightTime"/> |
| 11 | <result column="complete_time" property="completeTime"/> | 12 | <result column="complete_time" property="completeTime"/> |
| @@ -52,6 +53,7 @@ | @@ -52,6 +53,7 @@ | ||
| 52 | pwt.id, | 53 | pwt.id, |
| 53 | pwt.code, | 54 | pwt.code, |
| 54 | pwt.type, | 55 | pwt.type, |
| 56 | + pwt.origin_weighing_ticket_id, | ||
| 55 | pwt.unit, | 57 | pwt.unit, |
| 56 | pwt.first_gross_weight_time, | 58 | pwt.first_gross_weight_time, |
| 57 | pwt.complete_time, | 59 | pwt.complete_time, |