|
@@ -16,39 +16,44 @@ import (
|
|
|
|
|
|
|
|
// 现货合同结构(对应现货合同菜单)
|
|
// 现货合同结构(对应现货合同菜单)
|
|
|
type ErmcpSpotContractModel struct {
|
|
type ErmcpSpotContractModel struct {
|
|
|
- SPOTCONTRACTID string `json:"spotcontractid" xorm:"'SPOTCONTRACTID'"` //现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
|
|
|
|
|
- CONTRACTNO string `json:"contractno" xorm:"'CONTRACTNO'"` //现货合同编号
|
|
|
|
|
- CONTRACTTYPE int32 `json:"contracttype" xorm:"'CONTRACTTYPE'"` //现货合同类型 - 1:采购 -1:销售
|
|
|
|
|
- USERID int64 `json:"userid" xorm:"'USERID'"` //机构ID
|
|
|
|
|
- BUYUSERID int64 `json:"buyuserid" xorm:"'BUYUSERID'"` //采购方ID
|
|
|
|
|
- BUYUSERName string `json:"buyusername" xorm:"'BUYUSERName'"` //采购方名称
|
|
|
|
|
- SELLUSERID int64 `json:"selluserid" xorm:"'SELLUSERID'"` //销售方ID
|
|
|
|
|
- SELLUSERNAME string `json:"sellusername" xorm:"'SELLUSERNAME'"` //销售方名称
|
|
|
|
|
- DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` //现货品种ID
|
|
|
|
|
- DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` //现货品种代码
|
|
|
|
|
- DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` //现货品种名称
|
|
|
|
|
- PRODUCTTYPE int32 `json:"producttype" xorm:"'PRODUCTTYPE'"` //产品类型 - 1:标准仓单 2:等标 3:非标
|
|
|
|
|
- CONVERTFACTOR float64 `json:"convertfactor" xorm:"'CONVERTFACTOR'"` //标仓系数
|
|
|
|
|
- SPOTGOODSDESC string `json:"spotgoodsdesc" xorm:"'SPOTGOODSDESC'"` //商品型号
|
|
|
|
|
- PRICETYPE int32 `json:"pricetype" xorm:"'PRICETYPE'"` //定价类型 - 1:一口价 2:点价 3:暂定价
|
|
|
|
|
- QTY float64 `json:"qty" xorm:"'QTY'"` //数量
|
|
|
|
|
- PRICE float64 `json:"price" xorm:"'PRICE'"` //价格\暂定价 [1:一口价、3:暂定价]
|
|
|
|
|
- AMOUNT float64 `json:"amount" xorm:"'AMOUNT'"` //金额 [1:一口价、3:暂定价]
|
|
|
|
|
- DELIVERYSTARTDATE string `json:"deliverystartdate" xorm:"'DELIVERYSTARTDATE'"` //交收期(开始)
|
|
|
|
|
- DELIVERYENDDATE string `json:"deliveryenddate" xorm:"'DELIVERYENDDATE'"` //交收期(结束)
|
|
|
|
|
- GOODSID int32 `json:"goodsid" xorm:"'GOODSID'"` //点价合约ID - 0:为现货,其它为期货商品合约ID [2:点价 3:暂定价]
|
|
|
|
|
- GOODSCODE string `json:"goodscode" xorm:"'GOODSCODE'"` //点价合约代码
|
|
|
|
|
- PRICEMOVE float64 `json:"pricemove" xorm:"'PRICEMOVE'"` //升贴水 [2:点价 3:暂定价]
|
|
|
|
|
- STARTDATE string `json:"startdate" xorm:"'STARTDATE'"` //点价开始日期 [2:点价 3:暂定价]
|
|
|
|
|
- ENDDATE string `json:"enddate" xorm:"'ENDDATE'"` //点价结束日期 [2:点价 3:暂定价]
|
|
|
|
|
- MARGIN float64 `json:"margin" xorm:"'MARGIN'"` //当前保证金
|
|
|
|
|
- CONTRACTMARGIN float64 `json:"contractmargin" xorm:"'CONTRACTMARGIN'"` //合同保证金
|
|
|
|
|
- EnumdicName string `json:"enumdicname" xorm:"'ENUMDICNAME'"` //单位名称
|
|
|
|
|
- CONTRACCTSTATUS int32 `json:"contracctstatus" xorm:"'CONTRACTSTATUS'"` //合同状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
|
|
|
|
|
- Remark string `json:"remark" xorm:"'Remark'"` //备注
|
|
|
|
|
- AUDITTIME string `json:"audittime" xorm:"'AUDITTIME'"` //审核时间
|
|
|
|
|
|
|
+ SPOTCONTRACTID string `json:"spotcontractid" xorm:"'SPOTCONTRACTID'"` // 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
|
|
|
|
|
+ CONTRACTNO string `json:"contractno" xorm:"'CONTRACTNO'"` // 现货合同编号
|
|
|
|
|
+ CONTRACTTYPE int32 `json:"contracttype" xorm:"'CONTRACTTYPE'"` // 现货合同类型 - 1:采购 -1:销售
|
|
|
|
|
+ USERID int64 `json:"userid" xorm:"'USERID'"` // 机构ID
|
|
|
|
|
+ BUYUSERID int64 `json:"buyuserid" xorm:"'BUYUSERID'"` // 采购方ID
|
|
|
|
|
+ BUYUSERName string `json:"buyusername" xorm:"'BUYUSERName'"` // 采购方名称
|
|
|
|
|
+ SELLUSERID int64 `json:"selluserid" xorm:"'SELLUSERID'"` // 销售方ID
|
|
|
|
|
+ SELLUSERNAME string `json:"sellusername" xorm:"'SELLUSERNAME'"` // 销售方名称
|
|
|
|
|
+ DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 现货品种ID
|
|
|
|
|
+ WRSTANDARDID int32 `json:"wrstandardid" xorm:"'wrstandardid'"` // 现货商品ID
|
|
|
|
|
+ DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 现货品种代码
|
|
|
|
|
+ DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 现货品种名称
|
|
|
|
|
+ PRODUCTTYPE int32 `json:"producttype" xorm:"'PRODUCTTYPE'"` // 产品类型 - 1:标准仓单 2:等标 3:非标
|
|
|
|
|
+ CONVERTFACTOR float64 `json:"convertfactor" xorm:"'CONVERTFACTOR'"` // 标仓系数
|
|
|
|
|
+ SPOTGOODSDESC string `json:"spotgoodsdesc" xorm:"'SPOTGOODSDESC'"` // 商品型号
|
|
|
|
|
+ PRICETYPE int32 `json:"pricetype" xorm:"'PRICETYPE'"` // 定价类型 - 1:一口价 2:点价 3:暂定价
|
|
|
|
|
+ QTY float64 `json:"qty" xorm:"'QTY'"` // 数量
|
|
|
|
|
+ PRICE float64 `json:"price" xorm:"'PRICE'"` // 价格\暂定价 [1:一口价、3:暂定价]
|
|
|
|
|
+ AMOUNT float64 `json:"amount" xorm:"'AMOUNT'"` // 金额 [1:一口价、3:暂定价]
|
|
|
|
|
+ DELIVERYSTARTDATE string `json:"deliverystartdate" xorm:"'DELIVERYSTARTDATE'"` // 交收期(开始)
|
|
|
|
|
+ DELIVERYENDDATE string `json:"deliveryenddate" xorm:"'DELIVERYENDDATE'"` // 交收期(结束)
|
|
|
|
|
+ GOODSID int32 `json:"goodsid" xorm:"'GOODSID'"` // 点价合约ID - 0:为现货,其它为期货商品合约ID [2:点价 3:暂定价]
|
|
|
|
|
+ GOODSCODE string `json:"goodscode" xorm:"'GOODSCODE'"` // 点价合约代码
|
|
|
|
|
+ PRICEMOVE float64 `json:"pricemove" xorm:"'PRICEMOVE'"` // 升贴水 [2:点价 3:暂定价]
|
|
|
|
|
+ STARTDATE string `json:"startdate" xorm:"'STARTDATE'"` // 点价开始日期 [2:点价 3:暂定价]
|
|
|
|
|
+ ENDDATE string `json:"enddate" xorm:"'ENDDATE'"` // 点价结束日期 [2:点价 3:暂定价]
|
|
|
|
|
+ MARGIN float64 `json:"margin" xorm:"'MARGIN'"` // 当前保证金
|
|
|
|
|
+ CONTRACTMARGIN float64 `json:"contractmargin" xorm:"'CONTRACTMARGIN'"` // 合同保证金
|
|
|
|
|
+ EnumdicName string `json:"enumdicname" xorm:"'ENUMDICNAME'"` // 单位名称
|
|
|
|
|
+ CONTRACCTSTATUS int32 `json:"contracctstatus" xorm:"'CONTRACTSTATUS'"` // 合同状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
|
|
|
|
|
+ Remark string `json:"remark" xorm:"'Remark'"` // 备注
|
|
|
|
|
+ AUDITREMARK string `json:"auditremark" xorm:"'AUDITREMARK'"` // 审核意见
|
|
|
|
|
+ AUDITTIME string `json:"audittime" xorm:"'AUDITTIME'"` // 审核时间
|
|
|
|
|
+ CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
|
|
|
SPOTGOODSMODELID int32 `json:"spotgoodsmodelid" xorm:"'SPOTGOODSMODELID'"` // 现货型号ID
|
|
SPOTGOODSMODELID int32 `json:"spotgoodsmodelid" xorm:"'SPOTGOODSMODELID'"` // 现货型号ID
|
|
|
SPOTGOODSBRANDID int32 `json:"spotgoodsbrandid" xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID
|
|
SPOTGOODSBRANDID int32 `json:"spotgoodsbrandid" xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID
|
|
|
|
|
+ BRANDNAME string `json:"brandname" xorm:"'brandname'"` // 品牌名称
|
|
|
|
|
+ MODELNAME string `json:"modelname" xorm:"'modelname'"` // 型号名称
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (r *ErmcpSpotContractModel) buildSql(nQueryType int32) string {
|
|
func (r *ErmcpSpotContractModel) buildSql(nQueryType int32) string {
|
|
@@ -59,6 +64,7 @@ func (r *ErmcpSpotContractModel) buildSql(nQueryType int32) string {
|
|
|
" t.BUYUSERID," +
|
|
" t.BUYUSERID," +
|
|
|
" t.SELLUSERID," +
|
|
" t.SELLUSERID," +
|
|
|
" t.DELIVERYGOODSID," +
|
|
" t.DELIVERYGOODSID," +
|
|
|
|
|
+ " t.wrstandardid," +
|
|
|
" t.PRODUCTTYPE," +
|
|
" t.PRODUCTTYPE," +
|
|
|
" t.CONVERTFACTOR," +
|
|
" t.CONVERTFACTOR," +
|
|
|
" t.SPOTGOODSDESC," +
|
|
" t.SPOTGOODSDESC," +
|
|
@@ -67,23 +73,27 @@ func (r *ErmcpSpotContractModel) buildSql(nQueryType int32) string {
|
|
|
" t.PRICE," +
|
|
" t.PRICE," +
|
|
|
" t.AMOUNT," +
|
|
" t.AMOUNT," +
|
|
|
" to_char(t.DELIVERYSTARTDATE, 'yyyy-mm-dd hh24:mi:ss') DELIVERYSTARTDATE," +
|
|
" to_char(t.DELIVERYSTARTDATE, 'yyyy-mm-dd hh24:mi:ss') DELIVERYSTARTDATE," +
|
|
|
- " to_char(t.DELIVERYENDDATE,'yyyy-mm-dd hh24:mi:ss') DELIVERYENDDATE," +
|
|
|
|
|
|
|
+ " to_char(t.DELIVERYENDDATE, 'yyyy-mm-dd hh24:mi:ss') DELIVERYENDDATE," +
|
|
|
" t.GOODSID," +
|
|
" t.GOODSID," +
|
|
|
" t.PRICEMOVE," +
|
|
" t.PRICEMOVE," +
|
|
|
" to_char(t.STARTDATE, 'yyyy-mm-dd hh24:mi:ss') STARTDATE," +
|
|
" to_char(t.STARTDATE, 'yyyy-mm-dd hh24:mi:ss') STARTDATE," +
|
|
|
- " to_char(t.ENDDATE,'yyyy-mm-dd hh24:mi:ss') ENDDATE," +
|
|
|
|
|
|
|
+ " to_char(t.ENDDATE, 'yyyy-mm-dd hh24:mi:ss') ENDDATE," +
|
|
|
" t.MARGIN," +
|
|
" t.MARGIN," +
|
|
|
" t.contractmargin," +
|
|
" t.contractmargin," +
|
|
|
" t.remark," +
|
|
" t.remark," +
|
|
|
|
|
+ " t.auditremark," +
|
|
|
" t.contractstatus," +
|
|
" t.contractstatus," +
|
|
|
" t.SPOTGOODSMODELID," +
|
|
" t.SPOTGOODSMODELID," +
|
|
|
" t.SPOTGOODSBRANDID," +
|
|
" t.SPOTGOODSBRANDID," +
|
|
|
- " to_char(t.audittime,'yyyy-mm-dd hh24:mi:ss') audittime," +
|
|
|
|
|
- " u1.accountname BuyUserName," +
|
|
|
|
|
- " u2.accountname SellUserName," +
|
|
|
|
|
|
|
+ " to_char(t.audittime, 'yyyy-mm-dd hh24:mi:ss') audittime," +
|
|
|
|
|
+ " to_char(t.createtime, 'yyyy-mm-dd hh24:mi:ss') createtime," +
|
|
|
|
|
+ " u1.accountname BuyUserName," +
|
|
|
|
|
+ " u2.accountname SellUserName," +
|
|
|
" g.deliverygoodscode," +
|
|
" g.deliverygoodscode," +
|
|
|
" g.deliverygoodsname," +
|
|
" g.deliverygoodsname," +
|
|
|
" g2.goodscode," +
|
|
" g2.goodscode," +
|
|
|
|
|
+ " gb.brandname," +
|
|
|
|
|
+ " gm.modelname," +
|
|
|
" e.Enumdicname" +
|
|
" e.Enumdicname" +
|
|
|
" FROM ERMCP_SPOTCONTRACT t" +
|
|
" FROM ERMCP_SPOTCONTRACT t" +
|
|
|
" left join useraccount u1" +
|
|
" left join useraccount u1" +
|
|
@@ -94,8 +104,13 @@ func (r *ErmcpSpotContractModel) buildSql(nQueryType int32) string {
|
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
|
" left join goods g2" +
|
|
" left join goods g2" +
|
|
|
" on t.goodsid = g2.goodsid" +
|
|
" on t.goodsid = g2.goodsid" +
|
|
|
- " left join enumdicitem e on g.goodsunitid = e.enumitemname and e.enumdiccode = 'goodsunit'" +
|
|
|
|
|
- " where t.contractstatus in (%v) and t.userid=%v"
|
|
|
|
|
|
|
+ " left join spotgoodsbrand gb on t.spotgoodsbrandid=gb.brandid" +
|
|
|
|
|
+ " left join spotgoodsmodel gm on t.spotgoodsmodelid=gm.modelid" +
|
|
|
|
|
+ " left join enumdicitem e" +
|
|
|
|
|
+ " on g.goodsunitid = e.enumitemname" +
|
|
|
|
|
+ " and e.enumdiccode = 'goodsunit'" +
|
|
|
|
|
+ " where t.contractstatus in (%v)" +
|
|
|
|
|
+ " and t.userid = %v"
|
|
|
|
|
|
|
|
// 查询类型 1-未提交 2-待审核 3-履约中 4-已完成
|
|
// 查询类型 1-未提交 2-待审核 3-履约中 4-已完成
|
|
|
// 合同状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
|
|
// 合同状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
|