|
|
@@ -81,37 +81,27 @@ public class PurchaseAPBillServiceImpl implements PurchaseAPBillService {
|
|
|
List<ApbillAdjustment> adjusts = new ArrayList<ApbillAdjustment>();
|
|
|
if (!CollectionUtils.isEmpty(apBills)) {
|
|
|
Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ // 获取物料编号集合
|
|
|
+ Set<String> productCodes = CollectionUtil.getProductCodeCollection(apBills);
|
|
|
+ Map<String, ProductInfo> products = null;
|
|
|
+ if (!CollectionUtils.isEmpty(productCodes)) {
|
|
|
+ products = ProductUtils.findByEnUUAndCodes(enUU, productCodes);
|
|
|
+ }
|
|
|
for (PurchaseAPBill apBill : apBills) {
|
|
|
if (!CollectionUtils.isEmpty(apBill.getDetails())) {
|
|
|
for (PurchaseAPBillDetail detail : apBill.getDetails()) {
|
|
|
- ApbillAdjustment adjust = new ApbillAdjustment(apBill);
|
|
|
- Product product = new Product();
|
|
|
- product.setCode(detail.getAbd_prodcode());
|
|
|
- adjust.setPrid(product.getId());
|
|
|
- adjust.setDetno(detail.getAbd_detno());
|
|
|
- adjust.setProdcode(product.getCode());
|
|
|
- adjust.setProdUnit(product.getUnit());
|
|
|
- adjust.setQty(detail.getAbd_qty());
|
|
|
- adjust.setThischeckqty(detail.getAbd_thisvoqty());
|
|
|
- adjust.setOrderprice(detail.getAbd_price());
|
|
|
- adjust.setOrdercode(detail.getAbd_ordercode());
|
|
|
- adjust.setOrderdetno(detail.getAbd_orderdetno());
|
|
|
- adjust.setTaxrate(detail.getAbd_taxrate());
|
|
|
- if (detail.getAbd_yqty() != null) {
|
|
|
- adjust.setYcheckqty(detail.getAbd_yqty());
|
|
|
- } else {
|
|
|
- adjust.setYcheckqty((double) 0);
|
|
|
- }
|
|
|
+ ApbillAdjustment adjust = new ApbillAdjustment(apBill, detail);
|
|
|
Enterprise enterprise = enterpriseDao.findEnterpriseByUu(adjust.getEnuu());
|
|
|
adjust.setReceivename(enterprise.getEnName());
|
|
|
- List<Product> products = ProductUtils.findByEnUUAndCode(enUU, adjust.getProdcode());
|
|
|
if (!CollectionUtils.isEmpty(products)) {
|
|
|
- Product productInfo = products.get(0);
|
|
|
- adjust.setPrid(productInfo.getId());
|
|
|
- adjust.setProdcode(productInfo.getCode());
|
|
|
- adjust.setProdtitle(productInfo.getTitle());
|
|
|
- adjust.setProdspec(productInfo.getSpec());
|
|
|
- }
|
|
|
+ ProductInfo product = products.get(adjust.getProdcode());
|
|
|
+ if (null != product) {
|
|
|
+ adjust.setPrid(product.getId());
|
|
|
+ adjust.setProdcode(product.getCode());
|
|
|
+ adjust.setProdtitle(product.getTitle());
|
|
|
+ adjust.setProdspec(product.getSpec());
|
|
|
+ }
|
|
|
+ }
|
|
|
adjusts.add(adjust);
|
|
|
}
|
|
|
}
|