Showing
1 changed file
with
33 additions
and
0 deletions
| ... | ... | @@ -40,6 +40,7 @@ import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardSer |
| 40 | 40 | import com.lframework.xingyun.sc.service.contract.ContractFrameworkService; |
| 41 | 41 | import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService; |
| 42 | 42 | import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; |
| 43 | +import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; | |
| 43 | 44 | import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorLineVo; |
| 44 | 45 | import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorStandardVo; |
| 45 | 46 | import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractStdProcessingLineVo; |
| ... | ... | @@ -102,6 +103,8 @@ public class ContractDistributorStandardServiceImpl extends |
| 102 | 103 | private SysRoleService sysRoleService; |
| 103 | 104 | @Resource |
| 104 | 105 | private SysUserDeptService sysUserDeptService; |
| 106 | + @Resource | |
| 107 | + private PurchaseOrderLineService purchaseOrderLineService; | |
| 105 | 108 | |
| 106 | 109 | @Override |
| 107 | 110 | public PageResult<ContractDistributorStandard> query(Integer pageIndex, Integer pageSize, QueryContractDistributorStandardVo vo) { |
| ... | ... | @@ -991,6 +994,36 @@ public class ContractDistributorStandardServiceImpl extends |
| 991 | 994 | |
| 992 | 995 | // 创建订货单 |
| 993 | 996 | createPurchaseOrderInfo(data, "NO_PRODUCTION"); |
| 997 | + | |
| 998 | + // 更新之前的订货单信息 | |
| 999 | + Wrapper<PurchaseOrderInfo> orderInfoWrapper = Wrappers.lambdaQuery(PurchaseOrderInfo.class) | |
| 1000 | + .eq(PurchaseOrderInfo::getContractId, vo.getId()); | |
| 1001 | + List<PurchaseOrderInfo> purchaseOrderInfoList = purchaseOrderInfoService.list(orderInfoWrapper); | |
| 1002 | + if (CollectionUtils.isEmpty(purchaseOrderInfoList)) { | |
| 1003 | + return; | |
| 1004 | + } | |
| 1005 | + | |
| 1006 | + PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoList.get(0); | |
| 1007 | + if (purchaseOrderInfo == null) { | |
| 1008 | + return; | |
| 1009 | + } | |
| 1010 | + | |
| 1011 | + Wrapper<PurchaseOrderLine> orderLineWrapper = Wrappers.lambdaQuery(PurchaseOrderLine.class) | |
| 1012 | + .eq(PurchaseOrderLine::getPurchaseOrderId, purchaseOrderInfo.getId()) | |
| 1013 | + .orderByAsc(PurchaseOrderLine::getShowOrder); | |
| 1014 | + List<PurchaseOrderLine> purchaseOrderLineList = purchaseOrderLineService.list(orderLineWrapper); | |
| 1015 | + if (CollectionUtils.isEmpty(purchaseOrderLineList)) { | |
| 1016 | + return; | |
| 1017 | + } | |
| 1018 | + | |
| 1019 | + for (int index = 0; index < purchaseOrderLineList.size(); index++) { | |
| 1020 | + PurchaseOrderLine oldLine = purchaseOrderLineList.get(index); | |
| 1021 | + UpdateContractDistributorLineVo contractDistributorLine = vo.getContractDistributorLineList().get(index); | |
| 1022 | + Wrapper<PurchaseOrderLine> updateOrderLineWrapper = Wrappers.lambdaUpdate(PurchaseOrderLine.class) | |
| 1023 | + .set(PurchaseOrderLine::getSalesPrice, contractDistributorLine.getUnitPrice()) | |
| 1024 | + .eq(PurchaseOrderLine::getId, oldLine.getId()); | |
| 1025 | + purchaseOrderLineService.update(updateOrderLineWrapper); | |
| 1026 | + } | |
| 994 | 1027 | } |
| 995 | 1028 | |
| 996 | 1029 | @Override | ... | ... |