|
|
@@ -422,7 +422,15 @@ func (r *ErmcpReportDaySpot) Calc() {
|
|
|
}
|
|
|
|
|
|
func (r *ErmcpReportDaySpot) buildSql() string {
|
|
|
- var sqlId utils.SQLVal = "select t.reckondate," +
|
|
|
+ var sqlId utils.SQLVal = "with tmp as" +
|
|
|
+ " (select t.userid," +
|
|
|
+ " t.wrstandardid," +
|
|
|
+ " t.reckondate," +
|
|
|
+ " sum(t.todaybuyinqty) todaybuyinqty," +
|
|
|
+ " sum(t.todayselloutqty) todayselloutqty" +
|
|
|
+ " from Reckon_ERMCP_AreaStock t" +
|
|
|
+ " group by t.userid, t.wrstandardid,t.reckondate)" +
|
|
|
+ "select t.reckondate," +
|
|
|
" t.BUYPRICEDQTY," +
|
|
|
" t.SELLPRICEDQTY," +
|
|
|
" t.Oribuypricedqty," +
|
|
|
@@ -438,8 +446,10 @@ func (r *ErmcpReportDaySpot) buildSql() string {
|
|
|
" s.todaybuyinqty buyinqty," +
|
|
|
" s.todayselloutqty selloutqty" +
|
|
|
" from RECKON_ERMCP_AREASPOT t" +
|
|
|
- " left join Reckon_ERMCP_AreaStock s" +
|
|
|
+ " left join tmp s" +
|
|
|
" on t.reckondate = s.reckondate" +
|
|
|
+ " and t.areauserid = s.userid" +
|
|
|
+ " and t.wrstandardid = s.wrstandardid" +
|
|
|
" left join wrstandard w" +
|
|
|
" on t.wrstandardid = w.wrstandardid" +
|
|
|
" where 1 = 1"
|
|
|
@@ -504,7 +514,16 @@ func (r *ErmcpReportMonSpot) Calc() {
|
|
|
}
|
|
|
|
|
|
func (r *ErmcpReportMonSpot) buildSql() string {
|
|
|
- var sqlId utils.SQLVal = "select t.BUYPRICEDQTY," +
|
|
|
+ var sqlId utils.SQLVal = "with tmp as" +
|
|
|
+ " (select t.userid," +
|
|
|
+ " t.wrstandardid," +
|
|
|
+ " t.cycletime," +
|
|
|
+ " t.cycletype," +
|
|
|
+ " sum(t.todaybuyinqty) todaybuyinqty," +
|
|
|
+ " sum(t.todayselloutqty) todayselloutqty" +
|
|
|
+ " from Report_ERMCP_AreaStock t" +
|
|
|
+ " group by t.userid, t.wrstandardid, t.cycletime, t.cycletype)" +
|
|
|
+ "select t.BUYPRICEDQTY," +
|
|
|
" t.SELLPRICEDQTY," +
|
|
|
" t.Oribuypricedqty," +
|
|
|
" t.Orisellpricedqty," +
|
|
|
@@ -520,9 +539,11 @@ func (r *ErmcpReportMonSpot) buildSql() string {
|
|
|
" s.todaybuyinqty buyinqty," +
|
|
|
" s.todayselloutqty selloutqty" +
|
|
|
" from Report_ERMCP_AreaSpot t" +
|
|
|
- " left join Report_ERMCP_AreaStock s" +
|
|
|
+ " left join tmp s" +
|
|
|
" on t.cycletime = s.cycletime" +
|
|
|
" and t.cycletype = s.cycletype" +
|
|
|
+ " and t.areauserid = s.userid" +
|
|
|
+ " and t.wrstandardid = s.wrstandardid" +
|
|
|
" left join wrstandard w" +
|
|
|
" on t.wrstandardid = w.wrstandardid" +
|
|
|
" where t.cycletype = 1"
|