|
|
@@ -2232,7 +2232,7 @@ func (r *WrScfContract) buildSql() string {
|
|
|
" tmp.*" +
|
|
|
" from scf_contract t" +
|
|
|
" left join scf_contractinfo s" +
|
|
|
- " on t.scfcontractid = t.scfcontractid" +
|
|
|
+ " on t.scfcontractid = s.scfcontractid" +
|
|
|
" left join WRTrade_FinanceBuyApply a" +
|
|
|
" on t.scfcontractid = a.scfcontractid" +
|
|
|
" left join FINANCEAREAPRODUCTDETAIL p" +
|
|
|
@@ -2358,7 +2358,7 @@ type WrOutInApply struct {
|
|
|
APPLYTYPE int32 `json:"applytype" xorm:"'APPLYTYPE'"` // 申请类型 - 1:预约入库 2:预约出库 3:入库注册 4:出库注销
|
|
|
USERID int64 `json:"userid" xorm:"'USERID'" form:"userid"` // 用户id
|
|
|
APPLYTIME string `json:"applytime" xorm:"'APPLYTIME'"` // 申请时间
|
|
|
- APPLYSTATUS int32 `json:"applystatus" xorm:"'APPLYSTATUS'"` // 申请状态 - 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销
|
|
|
+ APPLYSTATUS int32 `json:"applystatus" xorm:"'APPLYSTATUS'"` // 申请状态 - 0:预约成功 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销
|
|
|
QTY int64 `json:"qty" xorm:"'QTY'"` // 数量
|
|
|
EXPRESSNUM string `json:"expressnum" xorm:"'EXPRESSNUM'"` // 物流单号
|
|
|
EXPRESSCOMPANY string `json:"expresscompany" xorm:"'EXPRESSCOMPANY'"` // 物流公司
|
|
|
@@ -2426,3 +2426,88 @@ func (r *WrOutInApply) GetDataEx() (interface{}, error) {
|
|
|
}
|
|
|
return sData, err
|
|
|
}
|
|
|
+
|
|
|
+// WrDeliveryDetail 交收
|
|
|
+type WrDeliveryDetail struct {
|
|
|
+ DELIVERYQTY float64 `json:"deliveryqty" xorm:"DELIVERYQTY"` // 交收数量(点选数量)
|
|
|
+ XDELIVERYCLOSEQTY float64 `json:"xdeliverycloseqty" xorm:"'XDELIVERYCLOSEQTY'"` // 合约数量
|
|
|
+ PDELIVERYCLOSEQTY float64 `json:"pdeliverycloseqty" xorm:"'PDELIVERYCLOSEQTY'"` // p合约平仓数量
|
|
|
+ DELIVERYTIME string `json:"deliverytime" xorm:"DELIVERYTIME"` // 交割时间
|
|
|
+ DELIVERYAMOUNT float64 `json:"deliveryamount" xorm:"DELIVERYAMOUNT"` // 货款金额(X总货款+P总货款)
|
|
|
+ DELIVERYPRICEMOVE float64 `json:"deliverypricemove" xorm:"DELIVERYPRICEMOVE"` // 升贴水(升贴水总额)
|
|
|
+ DELIVERYTOTALAMOUNT float64 `json:"deliverytotalamount" xorm:"DELIVERYTOTALAMOUNT"` // 交收金额
|
|
|
+ P1GOODSREMAINAMOUNT float64 `json:"p1goodsremainamount" xorm:"P1GOODSREMAINAMOUNT"` // 点价货款 ps:当PPRICEMODE=2时, 界面需显示"-"
|
|
|
+ WRFACTORTYPEID int64 `json:"wrfactortypeid" xorm:"WRFACTORTYPEID"` // 仓单要素类型ID
|
|
|
+ DELIVERYSTATUS int32 `json:"deliverystatus" xorm:"DELIVERYSTATUS"` // 状态 - 1:待成交 2:已成交 3:成交失败 4:履约完成
|
|
|
+ BUYORSELL int32 `json:"buyorsell" xorm:"BUYORSELL"` // 方向 - 0:买 1:卖
|
|
|
+ DELIVERYORDERID string `json:"deliveryorderid" xorm:"DELIVERYORDERID"` // 申报单号
|
|
|
+ ACCOUNTID int64 `json:"accountid" xorm:"ACCOUNTID" form:"accountid"` // 账号ID
|
|
|
+ MATCHACCOUNTID int64 `json:"matchaccountid" xorm:"MATCHACCOUNTID"` // 对手账号ID
|
|
|
+ XGOODSID int32 `json:"xgoodsid" xorm:"XGOODSID" form:"xgoodsid"` // x交易合约ID
|
|
|
+ PGOODSID int32 `json:"pgoodsid" xorm:"'PGOODSID'"` // p点选合约id
|
|
|
+ PPRICEMODE int32 `json:"ppricemode" xorm:"PPRICEMODE"` // 点价价格方式 - 1:商品价 2:固定值
|
|
|
+ PDELIVERYPRICE float64 `json:"pdeliveryprice" xorm:"PDELIVERYPRICE"` // 点价价格 ps:当PPRICEMODE=2时, 界面需显示"-"
|
|
|
+ XGOODSCODE string `json:"xgoodscode" xorm:"'XGOODSCODE'"` // 商品代码
|
|
|
+ XGOODSNAME string `json:"xgoodsname" xorm:"'XGOODSNAME'"` // 商品名称
|
|
|
+ PGOODSCODE string `json:"pgoodscode" xorm:"'PGOODSCODE'"` // 商品代码
|
|
|
+ PGOODSNAME string `json:"pgoodsname" xorm:"'PGOODSNAME'"` // 商品名称
|
|
|
+ USERID int64 `json:"userid" xorm:"'USERID'" form:"userid"` // 用户id
|
|
|
+ USERNAME string `json:"username" xorm:"'USERNAME'"` // 用户名称
|
|
|
+ MATCHUSERNAME string `json:"matchusername" xorm:"'MATCHUSERNAME'"` // 对手方名称(仓单持有人)
|
|
|
+ TRADEDATE string `json:"tradedate" xorm:"'TRADEDATE'"` // 交易日(yyyymmdd)
|
|
|
+
|
|
|
+ XGOODSAMOUNT SFLOAT64 `json:"xgoodsamount"` // 合约金额 = 货款金额(DELIVERYAMOUNT) - 点价货款(P1GOODSREMAINAMOUNT)
|
|
|
+}
|
|
|
+
|
|
|
+func (r *WrDeliveryDetail) calc() {
|
|
|
+ r.MATCHUSERNAME = EncryptByStar(r.MATCHUSERNAME)
|
|
|
+}
|
|
|
+
|
|
|
+func (r *WrDeliveryDetail) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = "select t.xgoodsid," +
|
|
|
+ " t.buyorsell," +
|
|
|
+ " t.deliveryqty," +
|
|
|
+ " t.xdeliverycloseqty," +
|
|
|
+ " t.pdeliverycloseqty," +
|
|
|
+ " t.deliveryamount," +
|
|
|
+ " t.pdeliveryprice," +
|
|
|
+ " t.p1goodsremainamount," +
|
|
|
+ " t.deliverypricemove," +
|
|
|
+ " t.deliverytotalamount," +
|
|
|
+ " to_char(t.deliverytime, 'yyyy-mm hh24:mi:ss') deliverytime," +
|
|
|
+ " t.deliverystatus," +
|
|
|
+ " t.accountid," +
|
|
|
+ " t.matchaccountid," +
|
|
|
+ " t.tradedate," +
|
|
|
+ " t.wrfactortypeid," +
|
|
|
+ " g.goodscode xgoodscode," +
|
|
|
+ " g.goodsname xgoodsname," +
|
|
|
+ " t.pgoodsid," +
|
|
|
+ " g2.goodscode pgoodscode," +
|
|
|
+ " g2.goodsname pgoodsname," +
|
|
|
+ " ta.accountname taaccountname," +
|
|
|
+ " u.userid," +
|
|
|
+ " u.accountname username," +
|
|
|
+ " u2.accountname matchusername" +
|
|
|
+ " from deliverydetail t" +
|
|
|
+ " left join goods g on t.xgoodsid=g.goodsid" +
|
|
|
+ " left join goods g2 on t.pgoodsid=g2.goodsid" +
|
|
|
+ " left join taaccount ta on t.accountid=ta.accountid" +
|
|
|
+ " left join useraccount u on ta.userid=u.userid" +
|
|
|
+ " left join taaccount ta2 on t.accountid=ta2.accountid" +
|
|
|
+ " left join useraccount u2 on ta2.userid=u2.userid" +
|
|
|
+ "where 1=1"
|
|
|
+ sqlId.AndEx("u.userid", r.USERID, r.USERID > 0)
|
|
|
+ sqlId.AndEx("t.accountid", r.ACCOUNTID, r.ACCOUNTID > 0)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 获取交收
|
|
|
+func (r *WrDeliveryDetail) GetDataEx() (interface{}, error) {
|
|
|
+ sData := make([]WrDeliveryDetail, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ }
|
|
|
+ return sData, err
|
|
|
+}
|