|
|
@@ -940,3 +940,113 @@ func (r *MineTradeTradeDetail) GetDataByPage() (interface{}, error, int, int, in
|
|
|
}
|
|
|
return sData, err, r.Page, r.PageSize, total
|
|
|
}
|
|
|
+
|
|
|
+// MineTradeGoodsDeliveryOffline 交收提货-线下交收单
|
|
|
+type MineTradeGoodsDeliveryOffline struct {
|
|
|
+ DELIVERYORDERID string `json:"deliveryorderid" xorm:"DELIVERYORDERID"` // 交收单号(905+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
|
|
|
+ USERID int64 `json:"userid" xorm:"USERID" form:"userid" binding:"required"` // 申请用户ID
|
|
|
+ ACCOUNTID int64 `json:"accountid" xorm:"ACCOUNTID"` // 账户ID
|
|
|
+ GOODSID int64 `json:"goodsid" xorm:"GOODSID"` // 商品ID
|
|
|
+ MARKETID int32 `json:"marketid" xorm:"MARKETID"` // 市场ID
|
|
|
+ BUYORSELL int32 `json:"buyorsell" xorm:"BUYORSELL"` // 交收方向 - 0:买 1:卖
|
|
|
+ DELIVERYLOT int64 `json:"deliverylot" xorm:"DELIVERYLOT"` // 交收手数
|
|
|
+ DELIVERYQTY int64 `json:"deliveryqty" xorm:"DELIVERYQTY"` // 交收数量 (手数*合约乘数)
|
|
|
+ DELIVERYINFO string `json:"deliveryinfo" xorm:"DELIVERYINFO"` // 交收信息
|
|
|
+ MATCHUSERID int64 `json:"matchuserid" xorm:"MATCHUSERID"` // 对手方UserID
|
|
|
+ MATCHACCOUNTID int64 `json:"matchaccountid" xorm:"MATCHACCOUNTID"` // 对手方AccountID
|
|
|
+ REQTIME string `json:"reqtime" xorm:"REQTIME"` // 申请时间
|
|
|
+ REQTRADEDATE string `json:"reqtradedate" xorm:"REQTRADEDATE"` // 申请交易日
|
|
|
+ ORDERSTATUS int32 `json:"orderstatus" xorm:"ORDERSTATUS"` // 单据状态 - 1:待处理 2:交收中 3:已完成
|
|
|
+ DELIVERYPRICE float64 `json:"deliveryprice" xorm:"DELIVERYPRICE"` // 交收价格
|
|
|
+ DELIVERYAMOUNT float64 `json:"deliveryamount" xorm:"DELIVERYAMOUNT"` // 交收货款
|
|
|
+ CLOSETIME time.Time `json:"closetime" xorm:"CLOSETIME"` // 完成时间
|
|
|
+ CLOSETRADEDATE string `json:"closetradedate" xorm:"CLOSETRADEDATE"` // 完成交易日
|
|
|
+
|
|
|
+ GOODSCODE string `json:"goodscode" xorm:"GOODSCODE"` // 期货合约代码(内部)
|
|
|
+ GOODSNAME string `json:"goodsname" xorm:"GOODSNAME"` // 期货合约名称
|
|
|
+ Goodsnamedisplay string `json:"goodsnamedisplay" xorm:"GOODSNAMEDISPLAY"` // 商品名称
|
|
|
+
|
|
|
+ Buyorselldisplay string `json:"buyorselldisplay" xorm:"BUYORSELLDISPLAY"` // 交收方向
|
|
|
+ Goodsunit string `json:"goodsunit" xorm:"GOODSUNIT"` // 单位
|
|
|
+ Orderstatusdisplay string `json:"orderstatusdisplay" xorm:"ORDERSTATUSDISPLAY"` // 单据状态
|
|
|
+
|
|
|
+ CUSTOMERNAME string `json:"matchusername" xorm:"MATCHUSERNAME"` // [交收对手方]客户名称(企业名称)
|
|
|
+
|
|
|
+ PageEx `xorm:"extends"` // 页码信息
|
|
|
+}
|
|
|
+
|
|
|
+func (r *MineTradeGoodsDeliveryOffline) calc() {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func (r *MineTradeGoodsDeliveryOffline) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
+ select
|
|
|
+ g.goodscode,
|
|
|
+ g.goodsname,
|
|
|
+ g.goodscode || '/' || g.goodsname GOODSNAMEDISPLAY,
|
|
|
+ e1.enumdicname BUYORSELLDISPLAY,
|
|
|
+ e2.enumdicname GOODSUNIT,
|
|
|
+
|
|
|
+ ui.customername MATCHUSERNAME,
|
|
|
+ e3.enumdicname ORDERSTATUSDISPLAY,
|
|
|
+ to_char(t.deliveryorderid) DELIVERYORDERID,
|
|
|
+ t.userid,
|
|
|
+ t.accountid,
|
|
|
+ t.goodsid,
|
|
|
+ t.marketid,
|
|
|
+ t.buyorsell,
|
|
|
+ t.deliverylot,
|
|
|
+ t.deliveryqty,
|
|
|
+ t.deliveryinfo,
|
|
|
+ t.matchuserid,
|
|
|
+ t.matchaccountid,
|
|
|
+ to_char(t.reqtime, 'yyyy-mm-dd hh24:mi:ss') REQTIME,
|
|
|
+ t.reqtradedate,
|
|
|
+ t.orderstatus,
|
|
|
+ t.deliveryprice,
|
|
|
+ t.deliveryamount,
|
|
|
+ t.closetime,
|
|
|
+ t.closetradedate
|
|
|
+
|
|
|
+ from Trade_GoodsDeliveryOffLine t
|
|
|
+
|
|
|
+ left join goods g
|
|
|
+ on t.goodsid = g.goodsid
|
|
|
+
|
|
|
+ left join enumdicitem e1
|
|
|
+ on e1.enumdiccode = 'buyOrSell'
|
|
|
+ and t.buyorsell = e1.enumitemname
|
|
|
+
|
|
|
+ left join enumdicitem e2
|
|
|
+ on e2.enumdiccode = 'goodsunit'
|
|
|
+ and g.goodunitid = e2.enumitemname
|
|
|
+
|
|
|
+ left join enumdicitem e3
|
|
|
+ on e3.enumdiccode = 'deliveryOrderStatus'
|
|
|
+ and t.orderstatus = e3.enumitemname
|
|
|
+
|
|
|
+ left join userinfo ui
|
|
|
+ on t.matchuserid = ui.userid
|
|
|
+
|
|
|
+ where t.userid = %v
|
|
|
+
|
|
|
+ order by t.reqtime desc
|
|
|
+ `
|
|
|
+
|
|
|
+ sqlId.FormatParam(r.USERID)
|
|
|
+
|
|
|
+ sqlId.Page(r.Page, r.PageSize)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+func (r *MineTradeGoodsDeliveryOffline) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
+ sData := make([]MineTradeGoodsDeliveryOffline, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ total := 0
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ total = sData[i].Total
|
|
|
+ }
|
|
|
+ return sData, err, r.Page, r.PageSize, total
|
|
|
+}
|