|
|
@@ -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);
|
|
|
}
|