zou.yingbin преди 4 години
родител
ревизия
daf5fe7847
променени са 5 файла, в които са добавени 371 реда и са изтрити 94 реда
  1. 5 0
      controllers/wrTrade2/qryWrTrade.go
  2. 83 0
      docs/docs.go
  3. 83 0
      docs/swagger.json
  4. 60 0
      docs/swagger.yaml
  5. 140 94
      models/wrTrade2.go

+ 5 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -73,6 +73,10 @@ func QueryOrderQuoteDetail(c *gin.Context) {
 // @Param marketid query int false "仓单贸易市场id"
 // @Param haswr query int true "0:仓单预售 1:仓单贸易"
 // @Param buyorsell query int true "买卖方向 0-买 1-卖"
+// @Param deliverygoodsid query int false "品种id"
+// @Param wrstandardid query int false "品类id"
+// @Param deliverymonth query string false "交收月(yyyy-mm) 仓单预售填写"
+// @Param dgitemname query string false "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm"
 // @Success 200 {array} models.WrQuoteOrderMyq
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryOrderQuoteMyq [get]
@@ -585,6 +589,7 @@ func QueryPermancePlanTmp(c *gin.Context) {
 // @Security ApiKeyAuth
 // @Param userid query int false "议价人id(摘牌方)"
 // @Param wrtradeorderid query int false "关联委托单id"
+// @Param haswr query int true "0:仓单预售 1:仓单贸易"
 // @Success 200 {array} models.WRTradeBargainApply
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryWrTradeBargainApply [get]

+ 83 - 0
docs/docs.go

@@ -11367,6 +11367,30 @@ var doc = `{
                         "name": "buyorsell",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品种id",
+                        "name": "deliverygoodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品类id",
+                        "name": "wrstandardid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "交收月(yyyy-mm) 仓单预售填写",
+                        "name": "deliverymonth",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm",
+                        "name": "dgitemname",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -12502,6 +12526,13 @@ var doc = `{
                         "description": "关联委托单id",
                         "name": "wrtradeorderid",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "0:仓单预售 1:仓单贸易",
+                        "name": "haswr",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {
@@ -31876,14 +31907,34 @@ var doc = `{
         "models.WrOrderDetail": {
             "type": "object",
             "properties": {
+                "accountid": {
+                    "description": "交易账号(资金账号)",
+                    "type": "integer"
+                },
+                "allfriendsflag": {
+                    "description": "是否全好友可见 - 0:否 1:是",
+                    "type": "integer"
+                },
                 "buyorsell": {
                     "description": "买卖 - 0:买 1:卖(挂牌类型 买为采购 卖为销售)",
                     "type": "integer"
                 },
+                "canbargain": {
+                    "description": "是否可议价 - 0:不可 1:可",
+                    "type": "integer"
+                },
                 "cancelqty": {
                     "description": "撤销数量",
                     "type": "number"
                 },
+                "canpart": {
+                    "description": "是否允许部份摘牌 - 0:不允许(要求整单) 1:允许(可以不整单)",
+                    "type": "integer"
+                },
+                "delistminqty": {
+                    "description": "起摘数量",
+                    "type": "integer"
+                },
                 "deliverygoodscode": {
                     "description": "品种代码",
                     "type": "string"
@@ -31908,6 +31959,10 @@ var doc = `{
                     "description": "固定价格    -   [挂牌]",
                     "type": "number"
                 },
+                "freezemargin": {
+                    "description": "冻结保证金(保证金)",
+                    "type": "number"
+                },
                 "futupricemove": {
                     "description": "期货升贴水",
                     "type": "number"
@@ -31932,10 +31987,26 @@ var doc = `{
                     "description": "是否有仓单-卖方 - 0:无仓单 1:有仓单",
                     "type": "integer"
                 },
+                "isspecified": {
+                    "description": "是否指定对手 - 0:不指定 1:指定    -   [挂牌]",
+                    "type": "integer"
+                },
+                "marginvalue": {
+                    "description": "保证金设置值(履约保证金)",
+                    "type": "number"
+                },
                 "marketid": {
                     "description": "市场ID",
                     "type": "integer"
                 },
+                "matchuserid": {
+                    "description": "对手方id",
+                    "type": "integer"
+                },
+                "matchusername": {
+                    "description": "对手方名称(当ISSPECIFIED=1时,有值,指定朋友的名称)",
+                    "type": "string"
+                },
                 "minivalue": {
                     "description": "现货商品最小变动值",
                     "type": "integer"
@@ -31956,6 +32027,10 @@ var doc = `{
                     "description": "升贴水(浮动价时填写)    -   [挂牌]",
                     "type": "number"
                 },
+                "taname": {
+                    "description": "交易用户名称(资金账号名称)",
+                    "type": "string"
+                },
                 "tradedate": {
                     "description": "交易日(yyyyMMdd)",
                     "type": "string"
@@ -32859,6 +32934,10 @@ var doc = `{
                     "description": "起摘数量",
                     "type": "number"
                 },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
                 "deliverymonth": {
                     "description": "交收月",
                     "type": "string"
@@ -32927,6 +33006,10 @@ var doc = `{
                     "description": "仓库名称",
                     "type": "string"
                 },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
                 "wrtradeorderid": {
                     "description": "仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)",
                     "type": "string"

+ 83 - 0
docs/swagger.json

@@ -11351,6 +11351,30 @@
                         "name": "buyorsell",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品种id",
+                        "name": "deliverygoodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品类id",
+                        "name": "wrstandardid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "交收月(yyyy-mm) 仓单预售填写",
+                        "name": "deliverymonth",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm",
+                        "name": "dgitemname",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -12486,6 +12510,13 @@
                         "description": "关联委托单id",
                         "name": "wrtradeorderid",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "0:仓单预售 1:仓单贸易",
+                        "name": "haswr",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {
@@ -31860,14 +31891,34 @@
         "models.WrOrderDetail": {
             "type": "object",
             "properties": {
+                "accountid": {
+                    "description": "交易账号(资金账号)",
+                    "type": "integer"
+                },
+                "allfriendsflag": {
+                    "description": "是否全好友可见 - 0:否 1:是",
+                    "type": "integer"
+                },
                 "buyorsell": {
                     "description": "买卖 - 0:买 1:卖(挂牌类型 买为采购 卖为销售)",
                     "type": "integer"
                 },
+                "canbargain": {
+                    "description": "是否可议价 - 0:不可 1:可",
+                    "type": "integer"
+                },
                 "cancelqty": {
                     "description": "撤销数量",
                     "type": "number"
                 },
+                "canpart": {
+                    "description": "是否允许部份摘牌 - 0:不允许(要求整单) 1:允许(可以不整单)",
+                    "type": "integer"
+                },
+                "delistminqty": {
+                    "description": "起摘数量",
+                    "type": "integer"
+                },
                 "deliverygoodscode": {
                     "description": "品种代码",
                     "type": "string"
@@ -31892,6 +31943,10 @@
                     "description": "固定价格    -   [挂牌]",
                     "type": "number"
                 },
+                "freezemargin": {
+                    "description": "冻结保证金(保证金)",
+                    "type": "number"
+                },
                 "futupricemove": {
                     "description": "期货升贴水",
                     "type": "number"
@@ -31916,10 +31971,26 @@
                     "description": "是否有仓单-卖方 - 0:无仓单 1:有仓单",
                     "type": "integer"
                 },
+                "isspecified": {
+                    "description": "是否指定对手 - 0:不指定 1:指定    -   [挂牌]",
+                    "type": "integer"
+                },
+                "marginvalue": {
+                    "description": "保证金设置值(履约保证金)",
+                    "type": "number"
+                },
                 "marketid": {
                     "description": "市场ID",
                     "type": "integer"
                 },
+                "matchuserid": {
+                    "description": "对手方id",
+                    "type": "integer"
+                },
+                "matchusername": {
+                    "description": "对手方名称(当ISSPECIFIED=1时,有值,指定朋友的名称)",
+                    "type": "string"
+                },
                 "minivalue": {
                     "description": "现货商品最小变动值",
                     "type": "integer"
@@ -31940,6 +32011,10 @@
                     "description": "升贴水(浮动价时填写)    -   [挂牌]",
                     "type": "number"
                 },
+                "taname": {
+                    "description": "交易用户名称(资金账号名称)",
+                    "type": "string"
+                },
                 "tradedate": {
                     "description": "交易日(yyyyMMdd)",
                     "type": "string"
@@ -32843,6 +32918,10 @@
                     "description": "起摘数量",
                     "type": "number"
                 },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
                 "deliverymonth": {
                     "description": "交收月",
                     "type": "string"
@@ -32911,6 +32990,10 @@
                     "description": "仓库名称",
                     "type": "string"
                 },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
                 "wrtradeorderid": {
                     "description": "仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)",
                     "type": "string"

+ 60 - 0
docs/swagger.yaml

@@ -14288,12 +14288,27 @@ definitions:
     type: object
   models.WrOrderDetail:
     properties:
+      accountid:
+        description: 交易账号(资金账号)
+        type: integer
+      allfriendsflag:
+        description: 是否全好友可见 - 0:否 1:是
+        type: integer
       buyorsell:
         description: 买卖 - 0:买 1:卖(挂牌类型 买为采购 卖为销售)
         type: integer
+      canbargain:
+        description: 是否可议价 - 0:不可 1:可
+        type: integer
       cancelqty:
         description: 撤销数量
         type: number
+      canpart:
+        description: 是否允许部份摘牌 - 0:不允许(要求整单) 1:允许(可以不整单)
+        type: integer
+      delistminqty:
+        description: 起摘数量
+        type: integer
       deliverygoodscode:
         description: 品种代码
         type: string
@@ -14312,6 +14327,9 @@ definitions:
       fixedprice:
         description: 固定价格    -   [挂牌]
         type: number
+      freezemargin:
+        description: 冻结保证金(保证金)
+        type: number
       futupricemove:
         description: 期货升贴水
         type: number
@@ -14330,9 +14348,21 @@ definitions:
       haswr:
         description: 是否有仓单-卖方 - 0:无仓单 1:有仓单
         type: integer
+      isspecified:
+        description: 是否指定对手 - 0:不指定 1:指定    -   [挂牌]
+        type: integer
+      marginvalue:
+        description: 保证金设置值(履约保证金)
+        type: number
       marketid:
         description: 市场ID
         type: integer
+      matchuserid:
+        description: 对手方id
+        type: integer
+      matchusername:
+        description: 对手方名称(当ISSPECIFIED=1时,有值,指定朋友的名称)
+        type: string
       minivalue:
         description: 现货商品最小变动值
         type: integer
@@ -14348,6 +14378,9 @@ definitions:
       pricemove:
         description: 升贴水(浮动价时填写)    -   [挂牌]
         type: number
+      taname:
+        description: 交易用户名称(资金账号名称)
+        type: string
       tradedate:
         description: 交易日(yyyyMMdd)
         type: string
@@ -15028,6 +15061,9 @@ definitions:
       delistminqty:
         description: 起摘数量
         type: number
+      deliverygoodsid:
+        description: 品种ID
+        type: integer
       deliverymonth:
         description: 交收月
         type: string
@@ -15079,6 +15115,9 @@ definitions:
       warehousename:
         description: 仓库名称
         type: string
+      wrstandardid:
+        description: 现货商品ID
+        type: integer
       wrtradeorderid:
         description: 仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)
         type: string
@@ -24685,6 +24724,22 @@ paths:
         name: buyorsell
         required: true
         type: integer
+      - description: 品种id
+        in: query
+        name: deliverygoodsid
+        type: integer
+      - description: 品类id
+        in: query
+        name: wrstandardid
+        type: integer
+      - description: 交收月(yyyy-mm) 仓单预售填写
+        in: query
+        name: deliverymonth
+        type: string
+      - description: 商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm
+        in: query
+        name: dgitemname
+        type: string
       produces:
       - application/json
       responses:
@@ -25401,6 +25456,11 @@ paths:
         in: query
         name: wrtradeorderid
         type: integer
+      - description: 0:仓单预售 1:仓单贸易
+        in: query
+        name: haswr
+        required: true
+        type: integer
       produces:
       - application/json
       responses:

+ 140 - 94
models/wrTrade2.go

@@ -618,30 +618,42 @@ func (r *WrPosition) GetDataEx() (interface{}, error) {
 
 // WrOrderDetail 仓单贸易委托单
 type WrOrderDetail struct {
-	HASWR              int32   `json:"haswr"  xorm:"HASWR" form:"haswr"`                   // 是否有仓单-卖方 - 0:无仓单 1:有仓单
-	WRTRADEORDERID     string  `json:"wrtradeorderid"  xorm:"WRTRADEORDERID"`              // 仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)
-	TRADEDATE          string  `json:"tradedate"  xorm:"TRADEDATE" form:"tradedate"`       // 交易日(yyyyMMdd)
-	WRTRADETYPE        int32   `json:"wrtradetype"  xorm:"WRTRADETYPE" form:"wrtradetype"` // 仓单贸易类型 - 1:挂牌 2:摘牌 3:提货卖(文化中国) 4:提货买(文化中国)
-	BUYORSELL          int32   `json:"buyorsell"  xorm:"BUYORSELL" form:"buyorsell"`       // 买卖 - 0:买 1:卖(挂牌类型 买为采购 卖为销售)
-	MARKETID           int64   `json:"marketid"  xorm:"MARKETID" form:"marketid"`          // 市场ID
-	USERID             int64   `json:"userid"  xorm:"USERID" form:"userid"`                // 用户ID
-	WRFACTORTYPEID     string  `json:"wrfactortypeid"  xorm:"WRFACTORTYPEID"`              // 仓单要素类型ID/商品ID(77)
-	ORDERQTY           float64 `json:"orderqty"  xorm:"ORDERQTY" form:"orderqty"`          // 委托数量
-	TRADEQTY           float64 `json:"tradeqty"  xorm:"TRADEQTY" form:"tradeqty"`          // 成交数量
-	CANCELQTY          float64 `json:"cancelqty"  xorm:"CANCELQTY" form:"cancelqty"`       // 撤销数量
-	WRPRICETYPE        int32   `json:"wrpricetype"  xorm:"WRPRICETYPE" form:"wrpricetype"` // 价格方式 - 1:固定价 2-浮动价  -   [挂牌]
-	FIXEDPRICE         float64 `json:"fixedprice"  xorm:"FIXEDPRICE" form:"fixedprice"`    // 固定价格    -   [挂牌]
-	PRICEMOVE          float64 `json:"pricemove"  xorm:"PRICEMOVE" form:"pricemove"`       // 升贴水(浮动价时填写)    -   [挂牌]
-	TRADEPRICE         float64 `json:"tradeprice"  xorm:"TRADEPRICE" form:"tradeprice"`    // 成交价格 - [摘牌] (浮动价  ((商品1价格*商品1价格系数+升贴水)* 商品1重量系数 + 商品2价格*商品2价格系数+商品2升贴水)* 商品2重量系数 ...)* 委托单价格系数 + 委托单升贴水)
-	ORDERTIME          string  `json:"ordertime"  xorm:"ORDERTIME" form:"ordertime"`       // 委托时间(挂牌时间)
-	WRTRADEORDERSTATUS int32   `json:"wrtradeorderstatus"  xorm:"WRTRADEORDERSTATUS"`      // 委托状态 - 1:委托请求 2:待冻结 3:委托成功 4:委托失败 5:配对成功 6:已撤 7:已成 8:成交失败 9:委托拒绝 10:挂牌部分成交 11:仓单生成失败 12:首付扣款失败 13:履约失败 14:撤单解冻贷款失败 15:部成部撤
-	GOODSID            int32   `json:"goodsid"  xorm:"'GOODSID'"`                          // 期货商品id
-	GOODSCODE          string  `json:"goodscode"  xorm:"'GOODSCODE'"`                      // 期货合约
-	GOODSNAME          string  `json:"goodsname"  xorm:"'GOODSNAME'"`                      // 商品名称
-	FUTUPRICEMOVE      float64 `json:"futupricemove"  xorm:"'FUTUPRICEMOVE'"`              // 期货升贴水
-	DELIVERYMONTH      string  `json:"deliverymonth"  xorm:"'DELIVERYMONTH'"`              // 交收月
-	Wr2FactorType      `xorm:"extends"`
-	PageEx             `xorm:"extends"`
+	HASWR              int32    `json:"haswr"  xorm:"HASWR" form:"haswr"`                   // 是否有仓单-卖方 - 0:无仓单 1:有仓单
+	WRTRADEORDERID     string   `json:"wrtradeorderid"  xorm:"WRTRADEORDERID"`              // 仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)
+	TRADEDATE          string   `json:"tradedate"  xorm:"TRADEDATE" form:"tradedate"`       // 交易日(yyyyMMdd)
+	WRTRADETYPE        int32    `json:"wrtradetype"  xorm:"WRTRADETYPE" form:"wrtradetype"` // 仓单贸易类型 - 1:挂牌 2:摘牌 3:提货卖(文化中国) 4:提货买(文化中国)
+	BUYORSELL          int32    `json:"buyorsell"  xorm:"BUYORSELL" form:"buyorsell"`       // 买卖 - 0:买 1:卖(挂牌类型 买为采购 卖为销售)
+	MARKETID           int64    `json:"marketid"  xorm:"MARKETID" form:"marketid"`          // 市场ID
+	USERID             int64    `json:"userid"  xorm:"USERID" form:"userid"`                // 用户ID
+	WRFACTORTYPEID     string   `json:"wrfactortypeid"  xorm:"WRFACTORTYPEID"`              // 仓单要素类型ID/商品ID(77)
+	ORDERQTY           float64  `json:"orderqty"  xorm:"ORDERQTY" form:"orderqty"`          // 委托数量
+	TRADEQTY           float64  `json:"tradeqty"  xorm:"TRADEQTY" form:"tradeqty"`          // 成交数量
+	CANCELQTY          float64  `json:"cancelqty"  xorm:"CANCELQTY" form:"cancelqty"`       // 撤销数量
+	WRPRICETYPE        int32    `json:"wrpricetype"  xorm:"WRPRICETYPE" form:"wrpricetype"` // 价格方式 - 1:固定价 2-浮动价  -   [挂牌]
+	FIXEDPRICE         float64  `json:"fixedprice"  xorm:"FIXEDPRICE" form:"fixedprice"`    // 固定价格    -   [挂牌]
+	PRICEMOVE          float64  `json:"pricemove"  xorm:"PRICEMOVE" form:"pricemove"`       // 升贴水(浮动价时填写)    -   [挂牌]
+	TRADEPRICE         float64  `json:"tradeprice"  xorm:"TRADEPRICE" form:"tradeprice"`    // 成交价格 - [摘牌] (浮动价  ((商品1价格*商品1价格系数+升贴水)* 商品1重量系数 + 商品2价格*商品2价格系数+商品2升贴水)* 商品2重量系数 ...)* 委托单价格系数 + 委托单升贴水)
+	ORDERTIME          string   `json:"ordertime"  xorm:"ORDERTIME" form:"ordertime"`       // 委托时间(挂牌时间)
+	WRTRADEORDERSTATUS int32    `json:"wrtradeorderstatus"  xorm:"WRTRADEORDERSTATUS"`      // 委托状态 - 1:委托请求 2:待冻结 3:委托成功 4:委托失败 5:配对成功 6:已撤 7:已成 8:成交失败 9:委托拒绝 10:挂牌部分成交 11:仓单生成失败 12:首付扣款失败 13:履约失败 14:撤单解冻贷款失败 15:部成部撤
+	GOODSID            int32    `json:"goodsid"  xorm:"'GOODSID'"`                          // 期货商品id
+	GOODSCODE          string   `json:"goodscode"  xorm:"'GOODSCODE'"`                      // 期货合约
+	GOODSNAME          string   `json:"goodsname"  xorm:"'GOODSNAME'"`                      // 商品名称
+	FUTUPRICEMOVE      float64  `json:"futupricemove"  xorm:"'FUTUPRICEMOVE'"`              // 期货升贴水
+	DELIVERYMONTH      string   `json:"deliverymonth"  xorm:"'DELIVERYMONTH'"`              // 交收月
+	MARGINVALUE        SFLOAT64 `json:"marginvalue"  xorm:"'MARGINVALUE'"`                  // 保证金设置值(履约保证金)
+	FREEZEMARGIN       SFLOAT64 `json:"freezemargin"  xorm:"'FREEZEMARGIN'"`                // 冻结保证金(保证金)
+	DELISTMINQTY       int64    `json:"delistminqty"  xorm:"'DELISTMINQTY'"`                // 起摘数量
+	CANBARGAIN         int32    `json:"canbargain"  xorm:"'CANBARGAIN'"`                    // 是否可议价 - 0:不可 1:可
+	CANPART            int32    `json:"canpart"  xorm:"'CANPART'"`                          // 是否允许部份摘牌 - 0:不允许(要求整单) 1:允许(可以不整单)
+	ALLFRIENDSFLAG     int32    `json:"allfriendsflag"  xorm:"'ALLFRIENDSFLAG'"`            // 是否全好友可见 - 0:否 1:是
+	ISSPECIFIED        int32    `json:"isspecified"  xorm:"'ISSPECIFIED'"`                  // 是否指定对手 - 0:不指定 1:指定    -   [挂牌]
+	ACCOUNTID          int64    `json:"accountid"  xorm:"'ACCOUNTID'"`                      // 交易账号(资金账号)
+	MATCHUSERID        int64    `json:"matchuserid"  xorm:"'MATCHUSERID'"`                  // 对手方id
+	MATCHUSERNAME      string   `json:"matchusername"  xorm:"'MATCHUSERNAME'"`              // 对手方名称(当ISSPECIFIED=1时,有值,指定朋友的名称)
+	TANAME             string   `json:"taname"  xorm:"'TANAME'"`                            // 交易用户名称(资金账号名称)
+
+	Wr2FactorType `xorm:"extends"`
+	PageEx        `xorm:"extends"`
 
 	FUTUSHOW string `json:"futushow"` // 期货合约/升贴水
 }
@@ -653,62 +665,82 @@ func (r *WrOrderDetail) calc() {
 		r.FUTUSHOW = fmt.Sprintf("%v/%.2f", r.GOODSNAME, r.PRICEMOVE)
 	}
 	r.Wr2FactorType.Calc()
+	r.MATCHUSERNAME = EncryptByStar(r.MATCHUSERNAME)
 }
 
 func (r *WrOrderDetail) buildSql() string {
-	var sqlId utils.SQLVal = "with tmp as" +
-		" (select to_char(t.wrfactortypeid) wrfactortypeid," +
-		"         t.wrfactortypename2 wrfactortypename," +
-		"         t.wrstandardid," +
-		"         t.deliverygoodsid," +
-		"         g.deliverygoodscode," +
-		"         g.deliverygoodsname," +
-		"         w.wrstandardcode," +
-		"         w.wrstandardname," +
-		"         h.warehousecode," +
-		"         h.warehousename," +
-		"         e.enumdicname," +
-		"         w.wrstandardname || t.wrfactortypename2 as wrtypename" +
-		"    from wrfactortype t" +
-		"    left join deliverygoods g" +
-		"      on t.deliverygoodsid = g.deliverygoodsid" +
-		"    left join wrstandard w" +
-		"      on t.wrstandardid = w.wrstandardid" +
-		"    left join warehouseinfo h" +
-		"      on t.warehouseid = h.autoid" +
-		"    left join enumdicitem e" +
-		"      on w.unitid = e.enumitemname" +
-		"     and e.enumdiccode = 'goodsunit')" +
-		"select t.HASWR," +
-		"       to_char(t.WRTRADEORDERID) WRTRADEORDERID," +
-		"       t.TRADEDATE," +
-		"       t.DELIVERYMONTH," +
-		"       t.WRTRADETYPE," +
-		"       t.BUYORSELL," +
-		"       t.MARKETID," +
-		"       t.USERID," +
-		"       t.ORDERQTY," +
-		"       t.TRADEQTY," +
-		"       t.CANCELQTY," +
-		"       t.WRPRICETYPE," +
-		"       t.FIXEDPRICE," +
-		"       t.PRICEMOVE," +
-		"       t.TRADEPRICE," +
-		"       to_char(t.ORDERTIME, 'yyyy-mm-dd hh24:mi:ss') ORDERTIME," +
-		"       t.WRTRADEORDERSTATUS," +
-		"       c.GOODSID," +
-		"       c.GOODSCODE," +
-		"       c.pricemove FUTUPRICEMOVE," +
-		"       g.goodsname," +
-		"       k.*" +
-		"  from wrtrade_orderdetail t" +
-		"  left join wrtrade_goodsconfig c" +
-		"    on t.wrtradeorderid = c.wrtradeorderid" +
-		"  left join goods g on c.goodsid=g.goodsid" +
-		"  left join tmp k" +
-		"    on t.wrfactortypeid = k.wrfactortypeid" +
-		" where t.WRTRADETYPE = 1" +
-		"   and t.isspecified = 0"
+	var sqlId utils.SQLVal = `
+with tmp as
+ (select to_char(t.wrfactortypeid) wrfactortypeid,
+         t.wrfactortypename2 wrfactortypename,
+         t.wrstandardid,
+         t.deliverygoodsid,
+         g.deliverygoodscode,
+         g.deliverygoodsname,
+         w.wrstandardcode,
+         w.wrstandardname,
+         h.warehousecode,
+         h.warehousename,
+         e.enumdicname,
+         w.wrstandardname || t.wrfactortypename2 as wrtypename
+    from wrfactortype t
+    left join deliverygoods g
+      on t.deliverygoodsid = g.deliverygoodsid
+    left join wrstandard w
+      on t.wrstandardid = w.wrstandardid
+    left join warehouseinfo h
+      on t.warehouseid = h.autoid
+    left join enumdicitem e
+      on w.unitid = e.enumitemname
+     and e.enumdiccode = 'goodsunit')
+select t.HASWR,
+       to_char(t.WRTRADEORDERID) WRTRADEORDERID,
+       t.TRADEDATE,
+       t.DELIVERYMONTH,
+       t.WRTRADETYPE,
+       t.BUYORSELL,
+       t.MARKETID,
+       t.USERID,
+       t.ORDERQTY,
+       t.TRADEQTY,
+       t.CANCELQTY,
+       t.WRPRICETYPE,
+       t.FIXEDPRICE,
+       t.PRICEMOVE,
+       t.TRADEPRICE,
+       to_char(t.ORDERTIME, 'yyyy-mm-dd hh24:mi:ss') ORDERTIME,
+       t.WRTRADEORDERSTATUS,
+       t.marginvalue,
+       t.freezemargin,
+       t.delistminqty,
+       t.canbargain,
+       t.canpart,
+       t.allfriendsflag,
+       t.isspecified,
+       t.accountid,
+       c.GOODSID,
+       c.GOODSCODE,
+       c.pricemove FUTUPRICEMOVE,
+       g.goodsname,
+       m.matchuserid,
+       u.accountname matchusername,
+       ta.accountname taname,
+       k.*
+  from wrtrade_orderdetail t
+  left join wrtrade_goodsconfig c
+    on t.wrtradeorderid = c.wrtradeorderid
+  left join goods g
+    on c.goodsid = g.goodsid
+  left join tmp k
+    on t.wrfactortypeid = k.wrfactortypeid
+  left join wrtrade_matchdetail m
+    on t.wrtradeorderid = m.wrtradeorderid
+  left join useraccount u
+    on m.matchuserid = u.userid
+  left join taaccount ta
+    on t.accountid = ta.accountid
+ where t.WRTRADETYPE = 1
+`
 	sqlId.And("t.USERID", r.USERID)
 	sqlId.And("t.haswr", r.HASWR)
 	sqlId.AndEx("t.marketid", r.MARKETID, r.MARKETID > 0)
@@ -2546,7 +2578,8 @@ select t.xgoodsid,
        t.accountid,
        t.matchaccountid,
        t.tradedate,
-       t.wrfactortypeid,
+       to_char(t.wrfactortypeid) wrfactortypeid,
+       to_char(t.deliveryorderid) deliveryorderid,
        g.goodscode xgoodscode,
        g.goodsname xgoodsname,
        t.pgoodsid,
@@ -2766,24 +2799,27 @@ type WrQuoteOrderMyq struct {
 	ORDERTIME      string   `json:"ordertime"  xorm:"'ORDERTIME'"`                              // 委托时间
 	DELISTMINQTY   SFLOAT64 `json:"delistminqty"  xorm:"'DELISTMINQTY'"`                        // 起摘数量
 
-	CANBARGAIN            int32   `json:"canbargain"  xorm:"'CANBARGAIN'"`                       // 是否可议价 - 0:不可 1:可
-	CANPART               int32   `json:"canpart"  xorm:"'CANPART'"`                             // 是否允许部份摘牌 - 0:不允许 1:允许
-	MARGINFLAG            int32   `json:"marginflag"  xorm:"'MARGINFLAG'"`                       // 挂牌是否指定保证金 - 0:未指定 1:指定
-	MARGINVALUE           float64 `json:"marginvalue"  xorm:"'MARGINVALUE'"`                     // 保证金设置值
-	VALIDTYPE             int32   `json:"validtype"  xorm:"'VALIDTYPE'"`                         // 有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效
-	VALIDTIME             string  `json:"validtime"  xorm:"'VALIDTIME'"`                         // 有效期限
-	PERFORMANCETEMPLATEID int64   `json:"performancetemplateid"  xorm:"'PERFORMANCETEMPLATEID'"` // 履约模板id
-	GOODSCODE             string  `json:"goodscode"  xorm:"'GOODSCODE'"`                         // 商品合约代码
-	TEMPLATENAME          string  `json:"templatename"  xorm:"'TEMPLATENAME'"`                   // 履约模板名称
-	WAREHOUSENAME         string  `json:"warehousename"  xorm:"'WAREHOUSENAME'"`                 // 仓库名称
-	WRTYPENAME            string  `json:"wrtypename" xorm:"'WRTYPENAME'"`                        // 商品
+	CANBARGAIN            int32   `json:"canbargain"  xorm:"'CANBARGAIN'"`                                // 是否可议价 - 0:不可 1:可
+	CANPART               int32   `json:"canpart"  xorm:"'CANPART'"`                                      // 是否允许部份摘牌 - 0:不允许 1:允许
+	MARGINFLAG            int32   `json:"marginflag"  xorm:"'MARGINFLAG'"`                                // 挂牌是否指定保证金 - 0:未指定 1:指定
+	MARGINVALUE           float64 `json:"marginvalue"  xorm:"'MARGINVALUE'"`                              // 保证金设置值
+	VALIDTYPE             int32   `json:"validtype"  xorm:"'VALIDTYPE'"`                                  // 有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效
+	VALIDTIME             string  `json:"validtime"  xorm:"'VALIDTIME'"`                                  // 有效期限
+	PERFORMANCETEMPLATEID int64   `json:"performancetemplateid"  xorm:"'PERFORMANCETEMPLATEID'"`          // 履约模板id
+	GOODSCODE             string  `json:"goodscode"  xorm:"'GOODSCODE'"`                                  // 商品合约代码
+	TEMPLATENAME          string  `json:"templatename"  xorm:"'TEMPLATENAME'"`                            // 履约模板名称
+	WAREHOUSENAME         string  `json:"warehousename"  xorm:"'WAREHOUSENAME'"`                          // 仓库名称
+	WRTYPENAME            string  `json:"wrtypename" xorm:"'WRTYPENAME'"`                                 // 商品
+	WRSTANDARDID          int64   `json:"wrstandardid"  xorm:"WRSTANDARDID" form:"wrstandardid"`          // 现货商品ID
+	DELIVERYGOODSID       int32   `json:"deliverygoodsid"  xorm:"DELIVERYGOODSID" form:"deliverygoodsid"` // 品种ID
 	PageEx                `xorm:"extends"`
 
-	WRFACTORTYPEID int64 `json:"-" form:"wrfactortypeid"` // 仓单要素id
-	HasWr          int32 `json:"-" form:"haswr"`          // 是否有仓单 0-没有 1-有
-	WrPriceType    int32 `json:"-" form:"wrpricetype"`    // 价格方式 - 1:固定价 2-浮动价 - [挂牌]
-	MarketId       int32 `json:"-" form:"marketid"`       // 市场id
-	GOODSID        int32 `json:"-" form:"goodsid"`        // 商品id
+	WRFACTORTYPEID int64  `json:"-" form:"wrfactortypeid"` // 仓单要素id
+	HasWr          int32  `json:"-" form:"haswr"`          // 是否有仓单 0-没有 1-有
+	WrPriceType    int32  `json:"-" form:"wrpricetype"`    // 价格方式 - 1:固定价 2-浮动价 - [挂牌]
+	MarketId       int32  `json:"-" form:"marketid"`       // 市场id
+	GOODSID        int32  `json:"-" form:"goodsid"`        // 商品id
+	DGITEMNAME     string `json:"-" form:"dgitemname"`     // 筛选项
 }
 
 func (r *WrQuoteOrderMyq) calc() {
@@ -2817,6 +2853,8 @@ func (r *WrQuoteOrderMyq) buildSql() string {
 		"       wd.minivalue," +
 		"       e.enumdicname," +
 		"       wd.wrstandardname || w.wrfactortypename2 WRTYPENAME," +
+		"       w.wrstandardid," +
+		"       w.deliverygoodsid," +
 		"       s.templatename," +
 		"       h.warehousename" +
 		"  from WRTRADE_ORDERDETAIL t" +
@@ -2844,6 +2882,11 @@ func (r *WrQuoteOrderMyq) buildSql() string {
 	sqlId.And("t.buyorsell", r.BUYORSELL)
 	sqlId.AndEx("t.marketid", r.MarketId, r.MarketId > 0)
 	sqlId.AndEx("t.deliverymonth", r.DELIVERYMONTH, len(r.DELIVERYMONTH) > 0)
+	sqlId.AndEx("w.wrstandardid", r.WRSTANDARDID, r.WRSTANDARDID > 0)
+	sqlId.AndEx("w.deliverygoodsid", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
+	if d, ok := FtItemName(r.DGITEMNAME); ok {
+		sqlId.AndLikes("w.wrfactortypename", d...)
+	}
 
 	if r.BUYORSELL == 0 {
 		if r.WrPriceType == 1 {
@@ -3263,6 +3306,8 @@ type WRTradeBargainApply struct {
 	VALIDTIME      string   `json:"validtime"  xorm:"'VALIDTIME'"`                               // 有效期限
 	TEMPLATENAME   string   `json:"templatename"  xorm:"'TEMPLATENAME'"`                         // 履约方式(履约模板名称)
 	Wr2FactorType  `xorm:"extends"`
+
+	HASWR int32 `json:"-" form:"haswr"` // 0-仓单预售 1-仓单贸易
 }
 
 func (r *WRTradeBargainApply) calc() {
@@ -3343,6 +3388,7 @@ SELECT to_char(t.WRBARGAINID) WRBARGAINID,
 	} else {
 		sqlId.AndEx("t.WRTRADEORDERID", r.WRTRADEORDERID, r.WRTRADEORDERID != "")
 	}
+	sqlId.And("o.haswr", r.HASWR)
 
 	return sqlId.String()
 }