|
@@ -250,7 +250,7 @@ type WrOrderQuoteDetail struct {
|
|
|
BUYORSELL int32 `json:"buyorsell" xorm:"BUYORSELL" form:"buyorsell"` // 买卖 - 0:买 1:卖
|
|
BUYORSELL int32 `json:"buyorsell" xorm:"BUYORSELL" form:"buyorsell"` // 买卖 - 0:买 1:卖
|
|
|
USERID int64 `json:"userid" xorm:"USERID" form:"userid"` // 购买方(销售方)用户ID
|
|
USERID int64 `json:"userid" xorm:"USERID" form:"userid"` // 购买方(销售方)用户ID
|
|
|
QTY float64 `json:"orderqty" xorm:"ORDERQTY"` // 买(卖)量(=委托量-成交量)
|
|
QTY float64 `json:"orderqty" xorm:"ORDERQTY"` // 买(卖)量(=委托量-成交量)
|
|
|
- PRICE float64 `json:"fixedprice" xorm:"FIXEDPRICE"` // 买(卖)价
|
|
|
|
|
|
|
+ PRICE float64 `json:"fixedprice" xorm:"price"` // 买(卖)价
|
|
|
PRICEMOVE float64 `json:"pricemove" xorm:"PRICEMOVE"` // 买(卖)升贴水- 基差
|
|
PRICEMOVE float64 `json:"pricemove" xorm:"PRICEMOVE"` // 买(卖)升贴水- 基差
|
|
|
USERNAME string `json:"username" xorm:"'USERNAME'"` // 购买方(销售方)
|
|
USERNAME string `json:"username" xorm:"'USERNAME'"` // 购买方(销售方)
|
|
|
PageEx `xorm:"extends"`
|
|
PageEx `xorm:"extends"`
|
|
@@ -282,14 +282,14 @@ func (r *WrOrderQuoteDetail) buildSql() string {
|
|
|
" left join WRTRADE_GOODSCONFIG c" +
|
|
" left join WRTRADE_GOODSCONFIG c" +
|
|
|
" on t.wrtradeorderid = c.wrtradeorderid" +
|
|
" on t.wrtradeorderid = c.wrtradeorderid" +
|
|
|
" left join Useraccount u" +
|
|
" left join Useraccount u" +
|
|
|
- " on t.userid = u.Accountname" +
|
|
|
|
|
|
|
+ " on t.userid = u.userid" +
|
|
|
" where 1 = 1" +
|
|
" where 1 = 1" +
|
|
|
" and t.wrtradetype = 1" +
|
|
" and t.wrtradetype = 1" +
|
|
|
" and t.wrtradeorderstatus in (3, 10)"
|
|
" and t.wrtradeorderstatus in (3, 10)"
|
|
|
sqlId.And("t.haswr", r.HasWr)
|
|
sqlId.And("t.haswr", r.HasWr)
|
|
|
sqlId.And("t.wrpricetype", r.WrPriceType)
|
|
sqlId.And("t.wrpricetype", r.WrPriceType)
|
|
|
sqlId.And("t.wrfactortypeid", r.WRFACTORTYPEID)
|
|
sqlId.And("t.wrfactortypeid", r.WRFACTORTYPEID)
|
|
|
- sqlId.And("c.goodsid", r.GOODSID)
|
|
|
|
|
|
|
+ sqlId.AndEx("c.goodsid", r.GOODSID, r.GOODSID > 0)
|
|
|
sqlId.And("t.buyorsell", r.BUYORSELL)
|
|
sqlId.And("t.buyorsell", r.BUYORSELL)
|
|
|
sqlId.AndEx("t.marketid", r.MarketId, r.MarketId > 0)
|
|
sqlId.AndEx("t.marketid", r.MarketId, r.MarketId > 0)
|
|
|
|
|
|
|
@@ -335,24 +335,26 @@ type Wr2FactorType struct {
|
|
|
WRSTANDARDNAME string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'"` // 商品名称
|
|
WRSTANDARDNAME string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'"` // 商品名称
|
|
|
DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 品种代码
|
|
DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 品种代码
|
|
|
DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 品种名称
|
|
DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 品种名称
|
|
|
- ENUMDICNAME string `json:"enumdicname"` // 单位名称
|
|
|
|
|
|
|
+ ENUMDICNAME string `json:"enumdicname" xorm:"'enumdicname'"` // 单位名称
|
|
|
WAREHOUSENAME string `json:"warehousename" xorm:"'WAREHOUSENAME'"` // 仓库名称
|
|
WAREHOUSENAME string `json:"warehousename" xorm:"'WAREHOUSENAME'"` // 仓库名称
|
|
|
|
|
|
|
|
- WRTYPENAME string `json:"wrtypename"` // 商品
|
|
|
|
|
|
|
+ WRTYPENAME string `json:"wrtypename" xorm:"'WRTYPENAME'"` // 商品
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (r *Wr2FactorType) Calc() {
|
|
func (r *Wr2FactorType) Calc() {
|
|
|
- if len(r.WRFACTORTYPENAME) > 0 {
|
|
|
|
|
- r.WRTYPENAME = r.WRSTANDARDNAME + "-" + r.WRFACTORTYPENAME
|
|
|
|
|
- } else {
|
|
|
|
|
- r.WRTYPENAME = r.WRSTANDARDNAME
|
|
|
|
|
|
|
+ if r.WRTYPENAME == "" {
|
|
|
|
|
+ if len(r.WRFACTORTYPENAME) > 0 {
|
|
|
|
|
+ r.WRTYPENAME = r.WRSTANDARDNAME + r.WRFACTORTYPENAME
|
|
|
|
|
+ } else {
|
|
|
|
|
+ r.WRTYPENAME = r.WRSTANDARDNAME
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
r.WRTYPENAME = strings.ReplaceAll(r.WRTYPENAME, ",", "-")
|
|
r.WRTYPENAME = strings.ReplaceAll(r.WRTYPENAME, ",", "-")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// WrPosition 仓单贸易持仓汇总
|
|
// WrPosition 仓单贸易持仓汇总
|
|
|
type WrPosition struct {
|
|
type WrPosition struct {
|
|
|
- WRPOSITIONID int64 `json:"wrpositionid" xorm:"WRPOSITIONID" form:"wrpositionid"` // 仓单头寸ID(201+Unix秒时间戳(10位)+xxxxxx)
|
|
|
|
|
|
|
+ WRPOSITIONID string `json:"wrpositionid" xorm:"WRPOSITIONID" form:"wrpositionid"` // 仓单头寸ID(201+Unix秒时间戳(10位)+xxxxxx)
|
|
|
WRUSERID int64 `json:"wruserid" xorm:"WRUSERID" form:"userid"` // 持有人ID
|
|
WRUSERID int64 `json:"wruserid" xorm:"WRUSERID" form:"userid"` // 持有人ID
|
|
|
TOTALQTY float64 `json:"totalqty" xorm:"TOTALQTY" form:"totalqty"` // 总数量(库存数量)
|
|
TOTALQTY float64 `json:"totalqty" xorm:"TOTALQTY" form:"totalqty"` // 总数量(库存数量)
|
|
|
INCREASEQTY float64 `json:"-" xorm:"INCREASEQTY" form:"increaseqty"` // 今日增加数量
|
|
INCREASEQTY float64 `json:"-" xorm:"INCREASEQTY" form:"increaseqty"` // 今日增加数量
|
|
@@ -405,7 +407,7 @@ func (r *WrPosition) buildSql1() string {
|
|
|
" w.wrstandardid," +
|
|
" w.wrstandardid," +
|
|
|
" w.warehouseid," +
|
|
" w.warehouseid," +
|
|
|
" wd.wrstandardname," +
|
|
" wd.wrstandardname," +
|
|
|
- " wd.wrstandardname || '-' ||w.wrfactortypename2 as wrtypename" +
|
|
|
|
|
|
|
+ " wd.wrstandardname || w.wrfactortypename2 as wrtypename" +
|
|
|
" from WRPOSITION t" +
|
|
" from WRPOSITION t" +
|
|
|
" left join WRFACTORTYPE w" +
|
|
" left join WRFACTORTYPE w" +
|
|
|
" on t.wrfactortypeid = w.wrfactortypeid" +
|
|
" on t.wrfactortypeid = w.wrfactortypeid" +
|
|
@@ -415,6 +417,7 @@ func (r *WrPosition) buildSql1() string {
|
|
|
"hld as" +
|
|
"hld as" +
|
|
|
" (select k.deliverygoodsid," +
|
|
" (select k.deliverygoodsid," +
|
|
|
" k.wrtypename," +
|
|
" k.wrtypename," +
|
|
|
|
|
+ " k.wrstandardid," +
|
|
|
" sum(k.TOTALQTY) TOTALQTY," +
|
|
" sum(k.TOTALQTY) TOTALQTY," +
|
|
|
" sum(k.INCREASEQTY) INCREASEQTY," +
|
|
" sum(k.INCREASEQTY) INCREASEQTY," +
|
|
|
" sum(k.DECREASEQTY) DECREASEQTY," +
|
|
" sum(k.DECREASEQTY) DECREASEQTY," +
|
|
@@ -427,13 +430,15 @@ func (r *WrPosition) buildSql1() string {
|
|
|
" sum(k.CREDITTRADEQTY) CREDITTRADEQTY" +
|
|
" sum(k.CREDITTRADEQTY) CREDITTRADEQTY" +
|
|
|
" from tmp k" +
|
|
" from tmp k" +
|
|
|
" where 1 = 1" +
|
|
" where 1 = 1" +
|
|
|
- " group by k.deliverygoodsid, k.wrstandardname, k.wrtypename)" +
|
|
|
|
|
|
|
+ " group by k.deliverygoodsid, k.wrstandardname, k.wrtypename, k.wrstandardid)" +
|
|
|
"select h.*, g.deliverygoodsname, g.deliverygoodscode, e.enumdicname" +
|
|
"select h.*, g.deliverygoodsname, g.deliverygoodscode, e.enumdicname" +
|
|
|
" from hld h" +
|
|
" from hld h" +
|
|
|
" left join deliverygoods g" +
|
|
" left join deliverygoods g" +
|
|
|
" on h.deliverygoodsid = g.deliverygoodsid" +
|
|
" on h.deliverygoodsid = g.deliverygoodsid" +
|
|
|
|
|
+ " left join wrstandard wd" +
|
|
|
|
|
+ " on h.wrstandardid = wd.wrstandardid" +
|
|
|
" left join enumdicitem e" +
|
|
" left join enumdicitem e" +
|
|
|
- " on e.enumitemname = g.goodsunitid" +
|
|
|
|
|
|
|
+ " on e.enumitemname = wd.unitid" +
|
|
|
" and e.enumdiccode = 'goodsunit'"
|
|
" and e.enumdiccode = 'goodsunit'"
|
|
|
sqlId.FormatParam(r.WRUSERID)
|
|
sqlId.FormatParam(r.WRUSERID)
|
|
|
return sqlId.String()
|
|
return sqlId.String()
|
|
@@ -444,7 +449,7 @@ func (r *WrPosition) buildSql2() string {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (r *WrPosition) buildSql3() string {
|
|
func (r *WrPosition) buildSql3() string {
|
|
|
- var sqlId utils.SQLVal = "SELECT t.WRPOSITIONID," +
|
|
|
|
|
|
|
+ var sqlId utils.SQLVal = "SELECT to_char(t.WRPOSITIONID) WRPOSITIONID," +
|
|
|
" t.WRUSERID," +
|
|
" t.WRUSERID," +
|
|
|
" t.TOTALQTY," +
|
|
" t.TOTALQTY," +
|
|
|
" t.INCREASEQTY," +
|
|
" t.INCREASEQTY," +
|
|
@@ -459,7 +464,7 @@ func (r *WrPosition) buildSql3() string {
|
|
|
" t.CREDITCURQTY," +
|
|
" t.CREDITCURQTY," +
|
|
|
" t.CREDITFREEZEQTY," +
|
|
" t.CREDITFREEZEQTY," +
|
|
|
" t.CREDITTRADEQTY," +
|
|
" t.CREDITTRADEQTY," +
|
|
|
- " w.WRFACTORTYPEID," +
|
|
|
|
|
|
|
+ " to_char(w.WRFACTORTYPEID) WRFACTORTYPEID," +
|
|
|
" w.WRFACTORTYPENAME2 WRFACTORTYPENAME," +
|
|
" w.WRFACTORTYPENAME2 WRFACTORTYPENAME," +
|
|
|
" w.DELIVERYGOODSID," +
|
|
" w.DELIVERYGOODSID," +
|
|
|
" w.WAREHOUSEID," +
|
|
" w.WAREHOUSEID," +
|
|
@@ -479,7 +484,7 @@ func (r *WrPosition) buildSql3() string {
|
|
|
" LEFT JOIN WRSTANDARD wd" +
|
|
" LEFT JOIN WRSTANDARD wd" +
|
|
|
" on w.wrstandardid = wd.wrstandardid" +
|
|
" on w.wrstandardid = wd.wrstandardid" +
|
|
|
" left join enumdicitem e" +
|
|
" left join enumdicitem e" +
|
|
|
- " on e.enumitemname = dg.goodsunitid" +
|
|
|
|
|
|
|
+ " on e.enumitemname = wd.unitid" +
|
|
|
" and e.enumdiccode = 'goodsunit'" +
|
|
" and e.enumdiccode = 'goodsunit'" +
|
|
|
" WHERE 1 = 1"
|
|
" WHERE 1 = 1"
|
|
|
sqlId.And("t.WRUSERID", r.WRUSERID)
|
|
sqlId.And("t.WRUSERID", r.WRUSERID)
|
|
@@ -548,7 +553,7 @@ func (r *WrOrderDetail) buildSql() string {
|
|
|
" h.warehousecode," +
|
|
" h.warehousecode," +
|
|
|
" h.warehousename," +
|
|
" h.warehousename," +
|
|
|
" e.enumdicname," +
|
|
" e.enumdicname," +
|
|
|
- " w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
|
|
|
|
|
|
|
+ " w.wrstandardname || t.wrfactortypename2 as wrtypename" +
|
|
|
" from wrfactortype t" +
|
|
" from wrfactortype t" +
|
|
|
" left join deliverygoods g" +
|
|
" left join deliverygoods g" +
|
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
@@ -642,7 +647,7 @@ func (r *WrTradeDetail) buildSql() string {
|
|
|
" h.warehousecode," +
|
|
" h.warehousecode," +
|
|
|
" h.warehousename," +
|
|
" h.warehousename," +
|
|
|
" e.enumdicname," +
|
|
" e.enumdicname," +
|
|
|
- " w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
|
|
|
|
|
|
|
+ " w.wrstandardname || t.wrfactortypename2 as wrtypename" +
|
|
|
" from wrfactortype t" +
|
|
" from wrfactortype t" +
|
|
|
" left join deliverygoods g" +
|
|
" left join deliverygoods g" +
|
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
@@ -737,7 +742,7 @@ func (r *WrSpecialMatchOrder) buildSql() string {
|
|
|
" h.warehousecode," +
|
|
" h.warehousecode," +
|
|
|
" h.warehousename," +
|
|
" h.warehousename," +
|
|
|
" e.enumdicname," +
|
|
" e.enumdicname," +
|
|
|
- " w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
|
|
|
|
|
|
|
+ " w.wrstandardname || t.wrfactortypename2 as wrtypename" +
|
|
|
" from wrfactortype t" +
|
|
" from wrfactortype t" +
|
|
|
" left join deliverygoods g" +
|
|
" left join deliverygoods g" +
|
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
@@ -1026,7 +1031,7 @@ func (r *WrPerformancePlan) buildSql() string {
|
|
|
" h.warehousecode," +
|
|
" h.warehousecode," +
|
|
|
" h.warehousename," +
|
|
" h.warehousename," +
|
|
|
" e.enumdicname," +
|
|
" e.enumdicname," +
|
|
|
- " w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
|
|
|
|
|
|
|
+ " w.wrstandardname || t.wrfactortypename2 as wrtypename" +
|
|
|
" from wrfactortype t" +
|
|
" from wrfactortype t" +
|
|
|
" left join deliverygoods g" +
|
|
" left join deliverygoods g" +
|
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
@@ -1152,7 +1157,7 @@ func (r *WrHoldLB) buildSql() string {
|
|
|
" h.warehousecode," +
|
|
" h.warehousecode," +
|
|
|
" h.warehousename," +
|
|
" h.warehousename," +
|
|
|
" e.enumdicname," +
|
|
" e.enumdicname," +
|
|
|
- " w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
|
|
|
|
|
|
|
+ " w.wrstandardname || t.wrfactortypename2 as wrtypename" +
|
|
|
" from wrfactortype t" +
|
|
" from wrfactortype t" +
|
|
|
" left join deliverygoods g" +
|
|
" left join deliverygoods g" +
|
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|