Commit f12853e02449b5b365c08655926303c85cc498cc

Authored by 房远帅
1 parent 36168c74

采购-入库:过磅码单已生成送样单的不允许复磅

... ... @@ -31,6 +31,7 @@ import com.lframework.xingyun.sc.bo.procurement.WeighingTicketPlanBo;
31 31 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan;
32 32 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;
33 33 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine;
  34 +import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementAssayApply;
34 35 import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicket;
35 36 import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketApplyLine;
36 37 import com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketLine;
... ... @@ -662,7 +663,7 @@ public class ProcurementWeighingTicketServiceImpl
662 663 Set<String> loaded = CollectionUtil.isEmpty(plans) ? new HashSet<>()
663 664 : plans.stream().map(ProcurementPlan::getId).collect(Collectors.toSet());
664 665 List<String> invalid = distinctIds.stream().filter(i -> !loaded.contains(i)).collect(Collectors.toList());
665   - throw new DefaultClientException("所选采购计划不存在或已完成/变更/补单状态不满足选择条件:" + String.join(",", invalid));
  666 + throw new DefaultClientException("所选采购计划不存在/或状态不是已完成/或变更中/或补单中不满足选择条件:" + String.join(",", invalid));
666 667 }
667 668
668 669 ProcurementPlan first = plans.get(0);
... ... @@ -822,7 +823,8 @@ public class ProcurementWeighingTicketServiceImpl
822 823 }
823 824
824 825 /**
825   - * 复磅原单校验:存在且未作废、非复磅单(不允许复磅的复磅)、无未作废的复磅记录
  826 + * 复磅原单校验:存在且未作废、非复磅单(不允许复磅的复磅)、无未作废的复磅记录、
  827 + * 已生成化验送样单(未作废)的原码单不允许复磅
826 828 *
827 829 * @return 原过磅码单
828 830 */
... ... @@ -839,6 +841,12 @@ public class ProcurementWeighingTicketServiceImpl
839 841 .eq(ProcurementWeighingTicket::getDeleted, false)) > 0) {
840 842 throw new DefaultClientException("该过磅码单已存在复磅记录!");
841 843 }
  844 + // 已生成化验送样单(未作废)的原码单不允许复磅
  845 + if (assayApplyService.count(Wrappers.lambdaQuery(ProcurementAssayApply.class)
  846 + .eq(ProcurementAssayApply::getWeighingTicketId, originId)
  847 + .eq(ProcurementAssayApply::getDeleted, false)) > 0) {
  848 + throw new DefaultClientException("该过磅码单已生成化验送样单,不允许复磅!");
  849 + }
842 850 return origin;
843 851 }
844 852
... ...