|
@@ -2,12 +2,14 @@ package com.uas.platform.b2b.openapi.service.impl;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
+import com.uas.platform.b2b.core.util.DateUtils;
|
|
|
import com.uas.platform.b2b.dao.CommonDao;
|
|
import com.uas.platform.b2b.dao.CommonDao;
|
|
|
import com.uas.platform.b2b.data.support.DS;
|
|
import com.uas.platform.b2b.data.support.DS;
|
|
|
import com.uas.platform.b2b.data.support.DSUtils;
|
|
import com.uas.platform.b2b.data.support.DSUtils;
|
|
@@ -65,9 +67,10 @@ public class UASCustDataService implements CustDataService {
|
|
|
SpObserver.putSp(ds.getId());
|
|
SpObserver.putSp(ds.getId());
|
|
|
// A,B,C格式的数据改为'A','B','C'格式
|
|
// A,B,C格式的数据改为'A','B','C'格式
|
|
|
final String brandsWithFix = StringUtils.collectionToDelimitedString(Arrays.asList(brands.split(",")), ",", "'", "'");
|
|
final String brandsWithFix = StringUtils.collectionToDelimitedString(Arrays.asList(brands.split(",")), ",", "'", "'");
|
|
|
|
|
+ int nowMonth = DateUtils.getYearmonth(new Date());
|
|
|
return commonDao
|
|
return commonDao
|
|
|
- .query("select pr_brand as brand,pr_orispeccode as code,pr_detail as title,pr_spec as spec,po_onhand as stock,pr_unit as unit from productonhand left join product on po_prodcode=pr_code where po_onhand > 0 and pr_brand in ("
|
|
|
|
|
- + brandsWithFix + ")", Stock.class);
|
|
|
|
|
|
|
+ .query("select pr_brand as brand,pr_orispeccode as code,pr_detail as title,pr_spec as spec,pr_unit as 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 + ")", Stock.class, nowMonth);
|
|
|
} finally {
|
|
} finally {
|
|
|
SpObserver.putSp(currDs);
|
|
SpObserver.putSp(currDs);
|
|
|
}
|
|
}
|
|
@@ -112,14 +115,16 @@ public class UASCustDataService implements CustDataService {
|
|
|
SpObserver.putSp(ds.getId());
|
|
SpObserver.putSp(ds.getId());
|
|
|
// A,B,C格式的数据改为'A','B','C'格式
|
|
// A,B,C格式的数据改为'A','B','C'格式
|
|
|
final String brandsWithFix = StringUtils.collectionToDelimitedString(Arrays.asList(brands.split(",")), ",", "'", "'");
|
|
final String brandsWithFix = StringUtils.collectionToDelimitedString(Arrays.asList(brands.split(",")), ",", "'", "'");
|
|
|
|
|
+ // {@code startDate}所处期间
|
|
|
|
|
+ int month = DateUtils.getYearmonth(startDate);
|
|
|
StringBuffer sql = new StringBuffer(
|
|
StringBuffer sql = new StringBuffer(
|
|
|
- "select pr_brand as brand,pr_orispeccode as code,pr_detail as title,pr_spec as spec,pr_unit as unit,pi_date as \"DATE\",pi_title as trader,nvl(pd_inqty,0)+nvl(pd_outqty,0) as qty,case when nvl(pd_inqty,0)<>0 then 'in' else 'out' end as type from prodinout left join prodiodetail on pi_id=pd_piid left join product on pd_prodcode=pr_code where ");
|
|
|
|
|
|
|
+ "select pr_brand as brand,pr_orispeccode as code,pr_detail as title,pr_spec as spec,pr_unit as unit,pi_date as \"DATE\",pi_title as trader,nvl(pd_inqty,0)+nvl(pd_outqty,0) as qty,case when nvl(pd_inqty,0)<>0 then 'in' else 'out' end as type,(select pm_beginqty from v$productmonth where pr_code=pm_prodcode and pm_yearmonth=?) as beginStock from prodinout left join prodiodetail on pi_id=pd_piid left join product on pd_prodcode=pr_code where ");
|
|
|
sql.append("pi_statuscode='POSTED' and pi_date > to_date('").append(startDate).append("','yyyy-mm-dd')");
|
|
sql.append("pi_statuscode='POSTED' and pi_date > to_date('").append(startDate).append("','yyyy-mm-dd')");
|
|
|
if (StringUtils.hasText(code))
|
|
if (StringUtils.hasText(code))
|
|
|
sql.append(" and pr_orispeccode='").append(code).append("'");
|
|
sql.append(" and pr_orispeccode='").append(code).append("'");
|
|
|
sql.append(" and pr_brand in (").append(brandsWithFix).append(")");
|
|
sql.append(" and pr_brand in (").append(brandsWithFix).append(")");
|
|
|
sql.append(" order by pr_brand,pr_orispeccode,pi_date,pd_pdno");
|
|
sql.append(" order by pr_brand,pr_orispeccode,pi_date,pd_pdno");
|
|
|
- return TEMP_IO.reduce(commonDao.query(sql.toString(), TEMP_IO.class));
|
|
|
|
|
|
|
+ return TEMP_IO.reduce(commonDao.query(sql.toString(), TEMP_IO.class, month));
|
|
|
} finally {
|
|
} finally {
|
|
|
SpObserver.putSp(currDs);
|
|
SpObserver.putSp(currDs);
|
|
|
}
|
|
}
|