Browse Source

更新委外验收单批量更新价格的方法,处理批量更新价格出现的异常问题

hejq 7 years ago
parent
commit
fdc8bae26f

+ 4 - 5
src/main/java/com/uas/platform/b2b/openapi/service/impl/UASCustDataService.java

@@ -62,11 +62,10 @@ public class UASCustDataService implements CustDataService {
 				final String brandsWithFix = StringUtils.collectionToDelimitedString(Arrays.asList(brands.split(",")), ",", "'", "'");
 				int nowMonth = DateUtils.getYearmonth(new Date());
 				// 修改为按物料分组,防止物料本身的原厂型号或规格定义重复
-				return commonDao
-						.query("select brand,org_item,item_desc,item_spec,item_unit,sum(stock) as stock,sum(beginStock) as beginStock from (select pr_brand as brand,coalesce(pr_orispeccode,pr_spec) as org_item,pr_detail as item_desc,pr_spec as item_spec,pr_unit as item_unit,po_onhand as stock,(select pm_beginqty from v$productmonth where pr_code=pm_prodcode and pm_yearmonth=?) as beginStock from productonhand left join product on po_prodcode=pr_code where po_onhand > 0 and pr_brand in ("
-								+ brandsWithFix
-								+ ")) group by brand,org_item,item_desc,item_spec,item_unit order by brand,org_item,item_desc,item_spec,item_unit",
-								Stock.class, nowMonth);
+				String sql = "select brand,org_item,item_desc,item_spec,item_unit,sum(stock) as stock,sum(beginStock) as beginStock from (select pr_brand as brand,coalesce(pr_orispeccode,pr_spec) as org_item,pr_detail as item_desc,pr_spec as item_spec,pr_unit as item_unit,po_onhand as stock,(select pm_beginqty from v$productmonth where pr_code=pm_prodcode and pm_yearmonth=?) as beginStock from productonhand left join product on po_prodcode=pr_code where po_onhand > 0 and pr_brand in ("
+						+ brandsWithFix
+						+ ")) group by brand,org_item,item_desc,item_spec,item_unit order by brand,org_item,item_desc,item_spec,item_unit";
+				return commonDao.query(sql, Stock.class, nowMonth);
 			} finally {
 				SpObserver.putSp(currDs);
 			}

+ 6 - 4
src/main/java/com/uas/platform/b2b/service/impl/MakeAcceptServiceImpl.java

@@ -17,6 +17,7 @@ import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.Status;
 import com.uas.platform.core.persistence.criteria.PredicateUtils;
 import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.jpa.domain.Specification;
@@ -173,12 +174,13 @@ public class MakeAcceptServiceImpl implements MakeAcceptService {
 						SystemSession.getUser().getEnterprise().getUu(), prod.getPbu_inoutno(), prod.getPbu_pdno());
 				if (null != acceptItem) {
                     MakeOrderAcceptItem item = new MakeOrderAcceptItem();
-                    acceptItem.setOrderPrice(prod.getPbu_orderprice());
-                    acceptItem.setTaxrate(prod.getPbu_taxrate());
-					item.setAcceptId(acceptItem.getAccept().getId());
+					BeanUtils.copyProperties(acceptItem, item, MakeOrderAcceptItem.class);
+					item.setOrderPrice(prod.getPbu_orderprice());
+					item.setTaxrate(prod.getPbu_taxrate());
+                    item.setAcceptId(acceptItem.getAccept().getId());
 					items.add(item);
 					if (null != acceptItem.getOrderId()) {
-						detailPriceList.add(new OrderDetailPrice(acceptItem.getOrderId(), acceptItem.getOrderPrice(), acceptItem.getTaxrate()));
+						detailPriceList.add(new OrderDetailPrice(acceptItem.getOrderId(), item.getOrderPrice(), item.getTaxrate()));
 					}
 				}
 			}