Commit 315bf5e264106bb4d368e529b4f0f91337e8e3d6

Authored by 杨鸣坤
1 parent 48696d3c

楚江ERP:锁价更新订货单价格

@@ -40,6 +40,7 @@ import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardSer @@ -40,6 +40,7 @@ import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardSer
40 import com.lframework.xingyun.sc.service.contract.ContractFrameworkService; 40 import com.lframework.xingyun.sc.service.contract.ContractFrameworkService;
41 import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService; 41 import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService;
42 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; 42 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
  43 +import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
43 import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorLineVo; 44 import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorLineVo;
44 import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorStandardVo; 45 import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorStandardVo;
45 import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractStdProcessingLineVo; 46 import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractStdProcessingLineVo;
@@ -102,6 +103,8 @@ public class ContractDistributorStandardServiceImpl extends @@ -102,6 +103,8 @@ public class ContractDistributorStandardServiceImpl extends
102 private SysRoleService sysRoleService; 103 private SysRoleService sysRoleService;
103 @Resource 104 @Resource
104 private SysUserDeptService sysUserDeptService; 105 private SysUserDeptService sysUserDeptService;
  106 + @Resource
  107 + private PurchaseOrderLineService purchaseOrderLineService;
105 108
106 @Override 109 @Override
107 public PageResult<ContractDistributorStandard> query(Integer pageIndex, Integer pageSize, QueryContractDistributorStandardVo vo) { 110 public PageResult<ContractDistributorStandard> query(Integer pageIndex, Integer pageSize, QueryContractDistributorStandardVo vo) {
@@ -991,6 +994,36 @@ public class ContractDistributorStandardServiceImpl extends @@ -991,6 +994,36 @@ public class ContractDistributorStandardServiceImpl extends
991 994
992 // 创建订货单 995 // 创建订货单
993 createPurchaseOrderInfo(data, "NO_PRODUCTION"); 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 @Override 1029 @Override