|
@@ -204,6 +204,7 @@ public class PurchaseOrderServiceImpl extends ServiceImpl<PurchaseOrderMapper, P
|
|
|
if (purchaseContract == null) {
|
|
|
return false;
|
|
|
}
|
|
|
+ purchaseOrder.setCurrency(purchaseContract.getContractCurrency());
|
|
|
purchaseOrder.setPurchaseContractNo(purchaseContract.getContractNo());
|
|
|
ContractTerms contractTerms = contractTermsService.getByContractIdAndType(purchaseContract.getId(),
|
|
|
ConstantUtil.PURCHASE_CONTRACT_CODE);
|
|
@@ -215,9 +216,13 @@ public class PurchaseOrderServiceImpl extends ServiceImpl<PurchaseOrderMapper, P
|
|
|
.eq(PurchaseCommodity::getPurchaseContractId, purchaseContract.getId())
|
|
|
.eq(PurchaseCommodity::getSalesContractId, 0).eq(PurchaseCommodity::getDeleted, 0).list();
|
|
|
for (PurchaseOrderCommodity commodity : commodities) {
|
|
|
- purchaseCommodities.stream()
|
|
|
- .filter(p -> p.getSalesCommodityId().equals(commodity.getSalesCommodityId())).findAny()
|
|
|
- .ifPresent(purchaseCommodity -> commodity.setPriceUnit(purchaseCommodity.getPriceUnit()));
|
|
|
+ PurchaseCommodity purchaseCommodity = purchaseCommodities.stream()
|
|
|
+ .filter(p -> p.getSalesCommodityId().equals(commodity.getSalesCommodityId())).findAny().orElse(null);
|
|
|
+ if (purchaseCommodity != null) {
|
|
|
+ commodity.setPriceUnit(purchaseCommodity.getPriceUnit());
|
|
|
+ commodity.setAmount(purchaseCommodity.getTotalAmount());
|
|
|
+ commodity.setCurrency(purchaseCommodity.getCurrency());
|
|
|
+ }
|
|
|
}
|
|
|
this.baseMapper.insert(purchaseOrder);
|
|
|
commodities.forEach(commodity -> commodity.setPurchaseOrderId(purchaseOrder.getId()));
|