|
@ -255,7 +255,8 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
//订单子表去除实际物料数量位null或者0的物料信息
|
|
|
//订单子表去除实际物料数量位null或者0的物料信息
|
|
|
purchaseOrderChildList = purchaseOrderChildList.stream().filter(child -> child.getMaterialRealNum() != null).collect(Collectors.toList()); |
|
|
purchaseOrderChildList = purchaseOrderChildList.stream().filter(child -> child.getMaterialRealNum() != null).collect(Collectors.toList()); |
|
|
for (PurchaseOrderChild child : purchaseOrderChildList) { |
|
|
for (PurchaseOrderChild child : purchaseOrderChildList) { |
|
|
if (child.getCorrelationCode().contains(",")) { |
|
|
if (child.getCorrelationCode().contains(",")) |
|
|
|
|
|
{ |
|
|
String[] correlationCodes = child.getCorrelationCode().split(","); |
|
|
String[] correlationCodes = child.getCorrelationCode().split(","); |
|
|
String[] planCodes = child.getPurchasePlanCode().split(","); |
|
|
String[] planCodes = child.getPurchasePlanCode().split(","); |
|
|
String[] purchaseQuoteCodes = child.getPurchaseQuoteCode().split(","); |
|
|
String[] purchaseQuoteCodes = child.getPurchaseQuoteCode().split(","); |
|
@ -286,7 +287,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal); |
|
|
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal); |
|
|
// 设置采购报价单编号和供应商信息到QuoteChild
|
|
|
// 设置采购报价单编号和供应商信息到QuoteChild
|
|
|
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
material.setPurchasePlanCorrelationCode(child.getCorrelationCode()); |
|
|
material.setPurchasePlanCorrelationCode(correlationCodes[i]); |
|
|
material.setSupplierCode(child.getSupplierCode()); |
|
|
material.setSupplierCode(child.getSupplierCode()); |
|
|
material.setMaterialUnit(child.getMaterialUnit()); |
|
|
material.setMaterialUnit(child.getMaterialUnit()); |
|
|
material.setWarehouseDept(child.getWarehouseDept()); |
|
|
material.setWarehouseDept(child.getWarehouseDept()); |
|
@ -311,9 +312,9 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
//实际采购单价合计
|
|
|
//实际采购单价合计
|
|
|
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal); |
|
|
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal); |
|
|
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal); |
|
|
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal); |
|
|
material.setCorrelationCode(child.getCorrelationCode()); |
|
|
material.setCorrelationCode(correlationCodes[i]); |
|
|
material.setDeliveryTime(child.getDeliveryTime()); |
|
|
material.setDeliveryTime(child.getDeliveryTime()); |
|
|
material.setPurchasePlanCode(child.getPurchasePlanCode()); |
|
|
material.setPurchasePlanCode(planCode); |
|
|
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode()); |
|
|
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode()); |
|
|
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
|
|
|
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
|
|
|
material.setEceiptStatus("0"); |
|
|
material.setEceiptStatus("0"); |
|
@ -321,15 +322,23 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
// 执行子表插入操作
|
|
|
// 执行子表插入操作
|
|
|
purchaseOrderChildService.insertPurchaseOrderChild(material); |
|
|
purchaseOrderChildService.insertPurchaseOrderChild(material); |
|
|
PurchasePlan plan = new PurchasePlan(); |
|
|
PurchasePlan plan = new PurchasePlan(); |
|
|
plan.setPurchasePlanCode(child.getPurchasePlanCode()); |
|
|
plan.setPurchasePlanCode(planCode); |
|
|
plan.setPurchasePlanStatus("1"); |
|
|
plan.setPurchasePlanStatus("1"); |
|
|
int result = purchasePlanService.updatePurchasePlan(plan); |
|
|
int result = purchasePlanService.updatePurchasePlan(plan); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else if ((!child.getCorrelationCode().contains(",")) |
|
|
else if ((child.getPurchasePlanCode().contains(",") && !child.getCorrelationCode().contains(",") |
|
|
&& child.getPurchasePlanCode() != null) { |
|
|
&& child.getCorrelationCode()!= null)) |
|
|
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(child.getPurchasePlanCode()); |
|
|
{ |
|
|
|
|
|
String[] planCodes = child.getPurchasePlanCode().split(","); |
|
|
|
|
|
for (int i = 0; i < planCodes.length - 1; i++) { |
|
|
|
|
|
String[] correlationCodes = child.getCorrelationCode().split(","); |
|
|
|
|
|
String[] planCode2 = child.getPurchasePlanCode().split(","); |
|
|
|
|
|
String[] purchaseQuoteCodes = child.getPurchaseQuoteCode().split(","); |
|
|
|
|
|
String planCode = planCode2[i]; |
|
|
|
|
|
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(planCode); |
|
|
|
|
|
if (planCode != null) { |
|
|
PurchaseOrderChild material = new PurchaseOrderChild(); |
|
|
PurchaseOrderChild material = new PurchaseOrderChild(); |
|
|
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
//获取物料供应商不含税采购价格
|
|
|
//获取物料供应商不含税采购价格
|
|
@ -338,9 +347,91 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb(); |
|
|
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb(); |
|
|
// 获取物料数量
|
|
|
// 获取物料数量
|
|
|
BigDecimal suplierMaterialNum = child.getMaterialRealNum(); |
|
|
BigDecimal suplierMaterialNum = child.getMaterialRealNum(); |
|
|
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;} |
|
|
if (suplierMaterialNoRmb == null) { |
|
|
if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;} |
|
|
suplierMaterialNoRmb = BigDecimal.ZERO; |
|
|
if(suplierMaterialNum == null){suplierMaterialNum = new BigDecimal(0);} |
|
|
} |
|
|
|
|
|
if (suplierMaterialRmb == null) { |
|
|
|
|
|
suplierMaterialRmb = BigDecimal.ZERO; |
|
|
|
|
|
} |
|
|
|
|
|
if (suplierMaterialNum == null) { |
|
|
|
|
|
suplierMaterialNum = new BigDecimal(0); |
|
|
|
|
|
} |
|
|
|
|
|
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
|
|
|
|
|
|
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum); |
|
|
|
|
|
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
|
|
|
|
|
|
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(suplierMaterialNum); |
|
|
|
|
|
// 累加物料数量
|
|
|
|
|
|
materialNum = materialNum.add(suplierMaterialNum); |
|
|
|
|
|
// 累加物料总价
|
|
|
|
|
|
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal); |
|
|
|
|
|
// 累加物料含税总价
|
|
|
|
|
|
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal); |
|
|
|
|
|
// 设置采购报价单编号和供应商信息到QuoteChild
|
|
|
|
|
|
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
|
|
|
material.setCorrelationCode(purchasePlan.getCorrelationCode()); |
|
|
|
|
|
material.setPurchasePlanCorrelationCode(correlationCodes[i]); |
|
|
|
|
|
material.setSupplierCode(child.getSupplierCode()); |
|
|
|
|
|
material.setMaterialUnit(child.getMaterialUnit()); |
|
|
|
|
|
material.setWarehouseDept(child.getWarehouseDept()); |
|
|
|
|
|
material.setSupplierName(child.getSupplierName()); |
|
|
|
|
|
material.setMaterialCode(child.getMaterialCode()); |
|
|
|
|
|
material.setMaterialName(child.getMaterialName()); |
|
|
|
|
|
material.setMaterialBrand(child.getMaterialBrand()); |
|
|
|
|
|
material.setMaterialDescribe(child.getMaterialDescribe()); |
|
|
|
|
|
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl()); |
|
|
|
|
|
material.setMaterialProcessMethod(child.getMaterialProcessMethod()); |
|
|
|
|
|
material.setWarehouseDept(child.getWarehouseDept()); |
|
|
|
|
|
//计划采购数
|
|
|
|
|
|
material.setMaterialNum(child.getMaterialNum()); |
|
|
|
|
|
material.setMaterialNoRmb(child.getMaterialNoRmb()); |
|
|
|
|
|
material.setMaterialRmb(child.getMaterialRmb()); |
|
|
|
|
|
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); |
|
|
|
|
|
material.setMaterialRmbSum(child.getMaterialRmbSum()); |
|
|
|
|
|
//实际采购数
|
|
|
|
|
|
material.setMaterialRealNum(child.getMaterialRealNum()); |
|
|
|
|
|
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb()); |
|
|
|
|
|
material.setMaterialRealRmb(child.getMaterialRealRmb()); |
|
|
|
|
|
material.setDeliveryTime(child.getDeliveryTime()); |
|
|
|
|
|
//实际采购单价合计
|
|
|
|
|
|
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal); |
|
|
|
|
|
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal); |
|
|
|
|
|
material.setCorrelationCode(child.getCorrelationCode()); |
|
|
|
|
|
material.setPurchasePlanCode(planCode); |
|
|
|
|
|
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode()); |
|
|
|
|
|
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
|
|
|
|
|
|
material.setEceiptStatus("0"); |
|
|
|
|
|
material.setPaymentStatus("0"); |
|
|
|
|
|
// 执行子表插入操作
|
|
|
|
|
|
purchaseOrderChildService.insertPurchaseOrderChild(material); |
|
|
|
|
|
PurchasePlan plan = new PurchasePlan(); |
|
|
|
|
|
plan.setPurchasePlanCode(planCode); |
|
|
|
|
|
plan.setPurchasePlanStatus("1"); |
|
|
|
|
|
int result = purchasePlanService.updatePurchasePlan(plan); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else if(child.getCorrelationCode().contains(",") && child.getCorrelationCode().contains(",") && |
|
|
|
|
|
child.getPurchasePlanCode()!=null && child.getCorrelationCode()!=null){ |
|
|
|
|
|
String planCode = child.getPurchasePlanCode(); |
|
|
|
|
|
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(planCode); |
|
|
|
|
|
if (planCode != null) { |
|
|
|
|
|
PurchaseOrderChild material = new PurchaseOrderChild(); |
|
|
|
|
|
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
|
|
|
//获取物料供应商不含税采购价格
|
|
|
|
|
|
BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb(); |
|
|
|
|
|
// 获取物料供应商含税采购价格
|
|
|
|
|
|
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb(); |
|
|
|
|
|
// 获取物料数量
|
|
|
|
|
|
BigDecimal suplierMaterialNum = child.getMaterialRealNum(); |
|
|
|
|
|
if (suplierMaterialNoRmb == null) { |
|
|
|
|
|
suplierMaterialNoRmb = BigDecimal.ZERO; |
|
|
|
|
|
} |
|
|
|
|
|
if (suplierMaterialRmb == null) { |
|
|
|
|
|
suplierMaterialRmb = BigDecimal.ZERO; |
|
|
|
|
|
} |
|
|
|
|
|
if (suplierMaterialNum == null) { |
|
|
|
|
|
suplierMaterialNum = new BigDecimal(0); |
|
|
|
|
|
} |
|
|
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
|
|
|
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
|
|
|
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum); |
|
|
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum); |
|
|
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
|
|
|
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
|
|
@ -395,6 +486,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
// 遍历处理采购订单子表
|
|
|
// 遍历处理采购订单子表
|
|
|
// 设置累加的物料信息到子表
|
|
|
// 设置累加的物料信息到子表
|
|
|
|
|
|
|
|
@ -430,6 +522,178 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
@Override |
|
|
@Override |
|
|
public int updatePurchaseOrder(PurchaseOrder purchaseOrder) |
|
|
public int updatePurchaseOrder(PurchaseOrder purchaseOrder) |
|
|
{ |
|
|
{ |
|
|
|
|
|
// 初始化累加变量
|
|
|
|
|
|
BigDecimal materialNoRmb = BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal materialRmb = BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal materialNoRmbSum = BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal materialRmbSum = BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal materialNum = BigDecimal.ZERO; |
|
|
|
|
|
int supplierNum = 0; |
|
|
|
|
|
//根据上传的物料信息做采购订单子项
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(purchaseOrder.getPurchaseOrderChildList())) { |
|
|
|
|
|
supplierNum = purchaseOrder.getPurchaseOrderChildList().size(); |
|
|
|
|
|
} |
|
|
|
|
|
if (purchaseOrder.getPurchaseOrderChildList() != null) { |
|
|
|
|
|
List<PurchaseOrderChild> purchaseOrderChildList = purchaseOrder.getPurchaseOrderChildList(); |
|
|
|
|
|
//订单子表去除实际物料数量位null或者0的物料信息
|
|
|
|
|
|
purchaseOrderChildList = purchaseOrderChildList.stream().filter(child -> child.getMaterialRealNum() != null).collect(Collectors.toList()); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(purchaseOrderChildList)) { |
|
|
|
|
|
purchaseOrderChildService.deletePurchaseOrderChildByPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
|
|
|
for (PurchaseOrderChild child : purchaseOrderChildList) { |
|
|
|
|
|
if (child.getCorrelationCode().contains(",")) { |
|
|
|
|
|
String[] correlationCodes = child.getCorrelationCode().split(","); |
|
|
|
|
|
String[] planCodes = child.getPurchasePlanCode().split(","); |
|
|
|
|
|
String[] purchaseQuoteCodes = child.getPurchaseQuoteCode().split(","); |
|
|
|
|
|
for (int i = 0; i < planCodes.length - 1; i++) { |
|
|
|
|
|
String planCode = planCodes[i]; |
|
|
|
|
|
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(planCode); |
|
|
|
|
|
if (planCode != null) { |
|
|
|
|
|
PurchaseOrderChild material = new PurchaseOrderChild(); |
|
|
|
|
|
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
|
|
|
//获取物料供应商不含税采购价格
|
|
|
|
|
|
BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb(); |
|
|
|
|
|
// 获取物料供应商含税采购价格
|
|
|
|
|
|
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb(); |
|
|
|
|
|
// 获取物料数量
|
|
|
|
|
|
BigDecimal suplierMaterialNum = child.getMaterialRealNum(); |
|
|
|
|
|
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;} |
|
|
|
|
|
if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;} |
|
|
|
|
|
if(suplierMaterialNum == null){suplierMaterialNum = new BigDecimal(0);} |
|
|
|
|
|
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
|
|
|
|
|
|
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum); |
|
|
|
|
|
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
|
|
|
|
|
|
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(suplierMaterialNum); |
|
|
|
|
|
// 累加物料数量
|
|
|
|
|
|
materialNum = materialNum.add(suplierMaterialNum); |
|
|
|
|
|
// 累加物料总价
|
|
|
|
|
|
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal); |
|
|
|
|
|
// 累加物料含税总价
|
|
|
|
|
|
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal); |
|
|
|
|
|
// 设置采购报价单编号和供应商信息到QuoteChild
|
|
|
|
|
|
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
|
|
|
material.setPurchasePlanCorrelationCode(child.getCorrelationCode()); |
|
|
|
|
|
material.setSupplierCode(child.getSupplierCode()); |
|
|
|
|
|
material.setMaterialUnit(child.getMaterialUnit()); |
|
|
|
|
|
material.setWarehouseDept(child.getWarehouseDept()); |
|
|
|
|
|
material.setSupplierName(child.getSupplierName()); |
|
|
|
|
|
material.setMaterialCode(child.getMaterialCode()); |
|
|
|
|
|
material.setMaterialName(child.getMaterialName()); |
|
|
|
|
|
material.setMaterialBrand(child.getMaterialBrand()); |
|
|
|
|
|
material.setMaterialDescribe(child.getMaterialDescribe()); |
|
|
|
|
|
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl()); |
|
|
|
|
|
material.setMaterialProcessMethod(child.getMaterialProcessMethod()); |
|
|
|
|
|
material.setWarehouseDept(child.getWarehouseDept()); |
|
|
|
|
|
//计划采购数
|
|
|
|
|
|
material.setMaterialNum(child.getMaterialNum()); |
|
|
|
|
|
material.setMaterialNoRmb(child.getMaterialNoRmb()); |
|
|
|
|
|
material.setMaterialRmb(child.getMaterialRmb()); |
|
|
|
|
|
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); |
|
|
|
|
|
material.setMaterialRmbSum(child.getMaterialRmbSum()); |
|
|
|
|
|
//实际采购数
|
|
|
|
|
|
material.setMaterialRealNum(child.getMaterialRealNum()); |
|
|
|
|
|
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb()); |
|
|
|
|
|
material.setMaterialRealRmb(child.getMaterialRealRmb()); |
|
|
|
|
|
//实际采购单价合计
|
|
|
|
|
|
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal); |
|
|
|
|
|
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal); |
|
|
|
|
|
material.setCorrelationCode(child.getCorrelationCode()); |
|
|
|
|
|
material.setDeliveryTime(child.getDeliveryTime()); |
|
|
|
|
|
material.setPurchasePlanCode(child.getPurchasePlanCode()); |
|
|
|
|
|
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode()); |
|
|
|
|
|
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
|
|
|
|
|
|
material.setEceiptStatus("0"); |
|
|
|
|
|
material.setPaymentStatus("0"); |
|
|
|
|
|
// 执行子表插入操作
|
|
|
|
|
|
purchaseOrderChildService.insertPurchaseOrderChild(material); |
|
|
|
|
|
PurchasePlan plan = new PurchasePlan(); |
|
|
|
|
|
plan.setPurchasePlanCode(child.getPurchasePlanCode()); |
|
|
|
|
|
plan.setPurchasePlanStatus("1"); |
|
|
|
|
|
int result = purchasePlanService.updatePurchasePlan(plan); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else if ((!child.getCorrelationCode().contains(",")) |
|
|
|
|
|
&& child.getPurchasePlanCode() != null) { |
|
|
|
|
|
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(child.getPurchasePlanCode()); |
|
|
|
|
|
PurchaseOrderChild material = new PurchaseOrderChild(); |
|
|
|
|
|
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
|
|
|
//获取物料供应商不含税采购价格
|
|
|
|
|
|
BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb(); |
|
|
|
|
|
// 获取物料供应商含税采购价格
|
|
|
|
|
|
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb(); |
|
|
|
|
|
// 获取物料数量
|
|
|
|
|
|
BigDecimal suplierMaterialNum = child.getMaterialRealNum(); |
|
|
|
|
|
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;} |
|
|
|
|
|
if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;} |
|
|
|
|
|
if(suplierMaterialNum == null){suplierMaterialNum = new BigDecimal(0);} |
|
|
|
|
|
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
|
|
|
|
|
|
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum); |
|
|
|
|
|
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
|
|
|
|
|
|
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(suplierMaterialNum); |
|
|
|
|
|
// 累加物料数量
|
|
|
|
|
|
materialNum = materialNum.add(suplierMaterialNum); |
|
|
|
|
|
// 累加物料总价
|
|
|
|
|
|
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal); |
|
|
|
|
|
// 累加物料含税总价
|
|
|
|
|
|
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal); |
|
|
|
|
|
// 设置采购报价单编号和供应商信息到QuoteChild
|
|
|
|
|
|
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); |
|
|
|
|
|
material.setCorrelationCode(purchasePlan.getCorrelationCode()); |
|
|
|
|
|
material.setPurchasePlanCorrelationCode(child.getCorrelationCode()); |
|
|
|
|
|
material.setSupplierCode(child.getSupplierCode()); |
|
|
|
|
|
material.setMaterialUnit(child.getMaterialUnit()); |
|
|
|
|
|
material.setWarehouseDept(child.getWarehouseDept()); |
|
|
|
|
|
material.setSupplierName(child.getSupplierName()); |
|
|
|
|
|
material.setMaterialCode(child.getMaterialCode()); |
|
|
|
|
|
material.setMaterialName(child.getMaterialName()); |
|
|
|
|
|
material.setMaterialBrand(child.getMaterialBrand()); |
|
|
|
|
|
material.setMaterialDescribe(child.getMaterialDescribe()); |
|
|
|
|
|
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl()); |
|
|
|
|
|
material.setMaterialProcessMethod(child.getMaterialProcessMethod()); |
|
|
|
|
|
material.setWarehouseDept(child.getWarehouseDept()); |
|
|
|
|
|
//计划采购数
|
|
|
|
|
|
material.setMaterialNum(child.getMaterialNum()); |
|
|
|
|
|
material.setMaterialNoRmb(child.getMaterialNoRmb()); |
|
|
|
|
|
material.setMaterialRmb(child.getMaterialRmb()); |
|
|
|
|
|
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); |
|
|
|
|
|
material.setMaterialRmbSum(child.getMaterialRmbSum()); |
|
|
|
|
|
//实际采购数
|
|
|
|
|
|
material.setMaterialRealNum(child.getMaterialRealNum()); |
|
|
|
|
|
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb()); |
|
|
|
|
|
material.setMaterialRealRmb(child.getMaterialRealRmb()); |
|
|
|
|
|
material.setDeliveryTime(child.getDeliveryTime()); |
|
|
|
|
|
//实际采购单价合计
|
|
|
|
|
|
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal); |
|
|
|
|
|
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal); |
|
|
|
|
|
material.setCorrelationCode(child.getCorrelationCode()); |
|
|
|
|
|
material.setPurchasePlanCode(child.getPurchasePlanCode()); |
|
|
|
|
|
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode()); |
|
|
|
|
|
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
|
|
|
|
|
|
material.setEceiptStatus("0"); |
|
|
|
|
|
material.setPaymentStatus("0"); |
|
|
|
|
|
// 执行子表插入操作
|
|
|
|
|
|
purchaseOrderChildService.insertPurchaseOrderChild(material); |
|
|
|
|
|
PurchasePlan plan = new PurchasePlan(); |
|
|
|
|
|
plan.setPurchasePlanCode(child.getPurchasePlanCode()); |
|
|
|
|
|
plan.setPurchasePlanStatus("1"); |
|
|
|
|
|
int result = purchasePlanService.updatePurchasePlan(plan); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 遍历处理采购订单子表// 设置累加的物料信息到子表// 设置主表的供应商数量
|
|
|
|
|
|
purchaseOrder.setSupplierNum(supplierNum); |
|
|
|
|
|
purchaseOrder.setNoRmbSum(materialNoRmbSum); |
|
|
|
|
|
purchaseOrder.setRmbSum(materialRmbSum); |
|
|
|
|
|
purchaseOrder.setDelFlag("0"); |
|
|
|
|
|
purchaseOrder.setEceiptStatus("0"); |
|
|
|
|
|
purchaseOrder.setPaymentStatus("0"); |
|
|
|
|
|
purchaseOrder.setPurchaseBuyer(purchaseOrder.getPurchaseBuyer()); |
|
|
|
|
|
purchaseOrder.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
purchaseOrder.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
|
|
Set<String> amountSet = purchaseOrder.getPurchaseOrderChildList().stream().map(PurchaseOrderChild::getMaterialCode).collect(Collectors.toSet()); |
|
|
|
|
|
Integer amount = amountSet.size(); |
|
|
|
|
|
purchaseOrder.setMaterialAmount(amount); |
|
|
purchaseOrder.setCreateTime(DateUtils.getNowDate()); |
|
|
purchaseOrder.setCreateTime(DateUtils.getNowDate()); |
|
|
purchaseOrder.setCreateBy(ShiroUtils.getLoginName()); |
|
|
purchaseOrder.setCreateBy(ShiroUtils.getLoginName()); |
|
|
return purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); |
|
|
return purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); |
|
|