|
|
@@ -77,7 +77,7 @@ func (r *WrOrderQuote) buildSqlFixedPrice() string {
|
|
|
" nvl(t.deliverymonth,'0') deliverymonth," +
|
|
|
" rank() over(partition by t.wrfactortypeid, nvl(t.deliverymonth,'0') order by t.fixedprice desc) cnt" +
|
|
|
" from wrtrade_orderdetail t" +
|
|
|
- " where t.wrtradetype = 1 and t.buyorsell = 0 and t.wrtradeorderstatus in(3,10) %v" +
|
|
|
+ " where t.wrtradetype = 1 and t.isspecified=0 and t.buyorsell = 0 and t.wrtradeorderstatus in(3,10) %v" +
|
|
|
" ) a" +
|
|
|
" where a.cnt = 1" +
|
|
|
" group by a.wrfactortypeid, a.fixedprice, a.deliverymonth)," +
|
|
|
@@ -92,7 +92,7 @@ func (r *WrOrderQuote) buildSqlFixedPrice() string {
|
|
|
" nvl(t.deliverymonth,'0') deliverymonth," +
|
|
|
" rank() over(partition by t.wrfactortypeid, nvl(t.deliverymonth,'0') order by t.fixedprice asc) cnt" +
|
|
|
" from wrtrade_orderdetail t" +
|
|
|
- " where t.wrtradetype = 1 and t.buyorsell = 1 and t.wrtradeorderstatus in(3,10) %v " +
|
|
|
+ " where t.wrtradetype = 1 and t.isspecified=0 and t.buyorsell = 1 and t.wrtradeorderstatus in(3,10) %v " +
|
|
|
" ) a" +
|
|
|
" where a.cnt = 1" +
|
|
|
" group by a.wrfactortypeid, a.fixedprice, a.deliverymonth)," +
|
|
|
@@ -176,7 +176,7 @@ func (r *WrOrderQuote) buildSqlPriceMove() string {
|
|
|
" from wrtrade_orderdetail t" +
|
|
|
" left join WRTrade_GoodsConfig c" +
|
|
|
" on t.wrtradeorderid = c.wrtradeorderid" +
|
|
|
- " where t.wrtradetype = 1 and t.wrtradeorderstatus in(3,10)" +
|
|
|
+ " where t.wrtradetype = 1 and t.isspecified=0 and t.wrtradeorderstatus in(3,10)" +
|
|
|
" and t.buyorsell = 0 %v) a" +
|
|
|
" where a.cnt = 1" +
|
|
|
" group by a.wrfactortypeid, a.pricemove, a.goodsid, a.goodscode, a.deliverymonth)," +
|
|
|
@@ -199,7 +199,7 @@ func (r *WrOrderQuote) buildSqlPriceMove() string {
|
|
|
" from wrtrade_orderdetail t" +
|
|
|
" left join WRTrade_GoodsConfig c" +
|
|
|
" on t.wrtradeorderid = c.wrtradeorderid" +
|
|
|
- " where t.wrtradetype = 1 and t.wrtradeorderstatus in(3,10)" +
|
|
|
+ " where t.wrtradetype = 1 and t.isspecified=0 and t.wrtradeorderstatus in(3,10)" +
|
|
|
" and t.buyorsell = 1 %v) a" +
|
|
|
" where a.cnt = 1" +
|
|
|
" group by a.wrfactortypeid, a.pricemove, a.goodsid, a.goodscode, a.deliverymonth)," +
|
|
|
@@ -336,6 +336,7 @@ func (r *WrOrderQuoteDetail) buildSql() string {
|
|
|
" left join enumdicitem e on wd.unitid=e.enumitemname and e.enumdiccode='goodsunit'" +
|
|
|
" where 1 = 1" +
|
|
|
" and t.wrtradetype = 1" +
|
|
|
+ " and t.isspecified = 0" +
|
|
|
" and t.wrtradeorderstatus in (3, 10)"
|
|
|
sqlId.And("t.haswr", r.HasWr)
|
|
|
sqlId.And("t.wrpricetype", r.WrPriceType)
|
|
|
@@ -655,7 +656,8 @@ type WrOrderDetail struct {
|
|
|
Wr2FactorType `xorm:"extends"`
|
|
|
PageEx `xorm:"extends"`
|
|
|
|
|
|
- FUTUSHOW string `json:"futushow"` // 期货合约/升贴水
|
|
|
+ FUTUSHOW string `json:"futushow"` // 期货合约/升贴水
|
|
|
+ AMOUNT SFLOAT64 `json:"amount"` // 挂牌金额 = 委托数量 * 固定价或升贴水
|
|
|
}
|
|
|
|
|
|
func (r *WrOrderDetail) calc() {
|
|
|
@@ -666,6 +668,11 @@ func (r *WrOrderDetail) calc() {
|
|
|
}
|
|
|
r.Wr2FactorType.Calc()
|
|
|
r.MATCHUSERNAME = EncryptByStar(r.MATCHUSERNAME)
|
|
|
+ if r.WRPRICETYPE == 1 {
|
|
|
+ r.AMOUNT.Set(r.ORDERQTY * r.FIXEDPRICE)
|
|
|
+ } else {
|
|
|
+ r.AMOUNT.Set(r.ORDERQTY * r.PRICEMOVE)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func (r *WrOrderDetail) buildSql() string {
|
|
|
@@ -2815,6 +2822,10 @@ type WrQuoteOrderMyq struct {
|
|
|
WRSTANDARDID int64 `json:"wrstandardid" xorm:"WRSTANDARDID" form:"wrstandardid"` // 现货商品ID
|
|
|
DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"DELIVERYGOODSID" form:"deliverygoodsid"` // 品种ID
|
|
|
WRFACTORTYPEID string `json:"wrfactortypeid" xorm:"'WRFACTORTYPEID'"` // 仓单要素id
|
|
|
+ WRSTANDARDNAME string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'"` // 商品名称
|
|
|
+ WRSTANDARDCODE string `json:"wrstandardcode" xorm:"WRSTANDARDCODE" form:"wrstandardcode"` // 现货商品代码
|
|
|
+ DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 品种代码
|
|
|
+ DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 品种名称
|
|
|
PageEx `xorm:"extends"`
|
|
|
|
|
|
HasWr int32 `json:"-" form:"haswr"` // 是否有仓单 0-没有 1-有
|
|
|
@@ -2830,52 +2841,67 @@ func (r *WrQuoteOrderMyq) calc() {
|
|
|
}
|
|
|
|
|
|
func (r *WrQuoteOrderMyq) buildSql() string {
|
|
|
- var sqlId utils.SQLVal = "select to_char(t.wrtradeorderid) wrtradeorderid," +
|
|
|
- " to_char(t.wrfactortypeid) wrfactortypeid," +
|
|
|
- " t.userid," +
|
|
|
- " t.orderqty - t.tradeqty as qty," +
|
|
|
- " t.fixedprice as price," +
|
|
|
- " t.pricemove," +
|
|
|
- " t.wrpricetype," +
|
|
|
- " t.buyorsell," +
|
|
|
- " t.deliverymonth," +
|
|
|
- " t.delistminqty," +
|
|
|
- " t.haswr," +
|
|
|
- " t.canbargain," +
|
|
|
- " t.canpart," +
|
|
|
- " t.marginflag," +
|
|
|
- " t.marginvalue," +
|
|
|
- " t.validtype," +
|
|
|
- " to_char(t.validtime, 'yyyy-mm-dd hh24:mi:ss') validtime," +
|
|
|
- " t.performancetemplateid," +
|
|
|
- " to_char(t.ordertime, 'yyyy-mm-dd hh24:mi:ss') ordertime," +
|
|
|
- " u.accountname as username," +
|
|
|
- " c.goodsid," +
|
|
|
- " c.goodscode," +
|
|
|
- " wd.minivalue," +
|
|
|
- " e.enumdicname," +
|
|
|
- " wd.wrstandardname || w.wrfactortypename2 WRTYPENAME," +
|
|
|
- " w.wrstandardid," +
|
|
|
- " w.deliverygoodsid," +
|
|
|
- " s.templatename," +
|
|
|
- " h.warehousename" +
|
|
|
- " from WRTRADE_ORDERDETAIL t" +
|
|
|
- " left join WRTRADE_GOODSCONFIG c" +
|
|
|
- " on t.wrtradeorderid = c.wrtradeorderid" +
|
|
|
- " left join Useraccount u" +
|
|
|
- " on t.userid = u.userid" +
|
|
|
- " left join wrfactortype w" +
|
|
|
- " on t.wrfactortypeid = w.wrfactortypeid" +
|
|
|
- " left join wrstandard wd" +
|
|
|
- " on w.wrstandardid = wd.wrstandardid" +
|
|
|
- " left join performanceplantemplate s on t.performancetemplateid=s.autoid" +
|
|
|
- " left join warehouseinfo h on w.warehouseid=h.autoid" +
|
|
|
- " left join enumdicitem e" +
|
|
|
- " on wd.unitid = e.enumitemname" +
|
|
|
- " and e.enumdiccode = 'goodsunit'" +
|
|
|
- " where 1 = 1" +
|
|
|
- " and t.wrtradetype = 1" +
|
|
|
- " and t.wrtradeorderstatus in (3, 10)"
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
+select to_char(t.wrtradeorderid) wrtradeorderid,
|
|
|
+ to_char(t.wrfactortypeid) wrfactortypeid,
|
|
|
+ t.userid,
|
|
|
+ t.orderqty - t.tradeqty as qty,
|
|
|
+ t.fixedprice as price,
|
|
|
+ t.pricemove,
|
|
|
+ t.wrpricetype,
|
|
|
+ t.buyorsell,
|
|
|
+ t.deliverymonth,
|
|
|
+ t.delistminqty,
|
|
|
+ t.haswr,
|
|
|
+ t.canbargain,
|
|
|
+ t.canpart,
|
|
|
+ t.marginflag,
|
|
|
+ t.marginvalue,
|
|
|
+ t.validtype,
|
|
|
+ to_char(t.validtime, 'yyyy-mm-dd hh24:mi:ss') validtime,
|
|
|
+ t.performancetemplateid,
|
|
|
+ to_char(t.ordertime, 'yyyy-mm-dd hh24:mi:ss') ordertime,
|
|
|
+ u.accountname as username,
|
|
|
+ c.goodsid,
|
|
|
+ c.goodscode,
|
|
|
+ wd.minivalue,
|
|
|
+ wd.wrstandardname,
|
|
|
+ wd.wrstandardcode,
|
|
|
+ g.deliverygoodscode,
|
|
|
+ g.deliverygoodsname,
|
|
|
+ e.enumdicname,
|
|
|
+ wd.wrstandardname || w.wrfactortypename2 WRTYPENAME,
|
|
|
+ w.wrstandardid,
|
|
|
+ w.deliverygoodsid,
|
|
|
+ s.templatename,
|
|
|
+ h.warehousename
|
|
|
+ from WRTRADE_ORDERDETAIL t
|
|
|
+ left join WRTRADE_GOODSCONFIG c
|
|
|
+ on t.wrtradeorderid = c.wrtradeorderid
|
|
|
+ left join Useraccount u
|
|
|
+ on t.userid = u.userid
|
|
|
+ left join wrfactortype w
|
|
|
+ on t.wrfactortypeid = w.wrfactortypeid
|
|
|
+ left join wrstandard wd
|
|
|
+ on w.wrstandardid = wd.wrstandardid
|
|
|
+ left join performanceplantemplate s
|
|
|
+ on t.performancetemplateid = s.autoid
|
|
|
+ left join warehouseinfo h
|
|
|
+ on w.warehouseid = h.autoid
|
|
|
+ left join deliverygoods g on w.deliverygoodsid=g.deliverygoodsid
|
|
|
+ left join enumdicitem e
|
|
|
+ on wd.unitid = e.enumitemname
|
|
|
+ and e.enumdiccode = 'goodsunit'
|
|
|
+ where 1 = 1
|
|
|
+ and t.wrtradetype = 1
|
|
|
+ and t.isspecified=1
|
|
|
+ and t.wrtradeorderstatus in (3, 10)
|
|
|
+ and (t.userid=%v or
|
|
|
+ (t.allfriendsflag=1 and t.userid in(select frienduserid from userfriend where userid=%v))
|
|
|
+ or (t.allfriendsflag=0 and %v in(select k.matchuserid from wrtrade_matchdetail k where k.wrtradeorderid=t.wrtradeorderid))
|
|
|
+ )
|
|
|
+`
|
|
|
+ sqlId.FormatParam(r.USERID, r.USERID, r.USERID)
|
|
|
sqlId.And("t.haswr", r.HasWr)
|
|
|
r.WrPriceType = 1 // 查固定价
|
|
|
sqlId.And("t.wrpricetype", r.WrPriceType)
|