Sfoglia il codice sorgente

Merge branch 'master' of 192.168.30.132:MTP2.0/MTP20_IF

zwl 5 anni fa
parent
commit
da22eac717
7 ha cambiato i file con 312 aggiunte e 238 eliminazioni
  1. 7 3
      controllers/erms3/spotContract.go
  2. 17 29
      controllers/wrtrade/wrTrade.go
  3. 86 73
      docs/docs.go
  4. 86 73
      docs/swagger.json
  5. 66 57
      docs/swagger.yaml
  6. 36 0
      models/erms3.go
  7. 14 3
      models/wrTrade.go

+ 7 - 3
controllers/erms3/spotContract.go

@@ -4,7 +4,6 @@ import (
 	"encoding/hex"
 	"encoding/json"
 	"math"
-	"mtp2_if/db"
 	"mtp2_if/global/app"
 	"mtp2_if/global/e"
 	"mtp2_if/logger"
@@ -295,7 +294,7 @@ type CustomerInfo struct {
 type QuerySpotContractAppleFormRsp struct {
 	OurUser        CustomerInfo            `json:"ouruser"`        // 我方账号
 	OppositeUsers  []CustomerInfo          `json:"oppositeusers"`  // 对方账号列表
-	WrStandards    []models.Wrstandard     `json:"wrstandards"`    // 仓单标准列表
+	WrStandards    []models.WRStandardInfo `json:"wrstandards"`    // 仓单标准列表
 	WareHouseInfos []models.Warehouseinfo  `json:"warehouseinfos"` // 仓库信息列表
 	Goodses        []models.GoodsIDAndName `json:"goodses"`        // 合约列表
 }
@@ -396,7 +395,7 @@ func QuerySpotContractAppleForm(c *gin.Context) {
 	}
 
 	// 获取交易标的(仓单标准)
-	rsp.WrStandards = make([]models.Wrstandard, 0)
+	rsp.WrStandards = make([]models.WRStandardInfo, 0)
 	wrStandards, err := models.GetWrstandards()
 	if err != nil {
 		// 查询失败
@@ -498,6 +497,7 @@ func QuerySpotContractDetail(c *gin.Context) {
 	}
 
 	// 查询数据.
+<<<<<<< HEAD
 	type spotContractDetail struct {
 		models.Erms3Spotcontractdetail `xorm:"extends"`
 		Areauserid                     int64     `json:"areauserid" xorm:"AREAUSERID"`                  // 所属机构
@@ -529,6 +529,10 @@ to_char(ERMS3_BIZTRADEDETAIL.RELATEDBIZID) RELATEDBIZID, ENUMDICITEM.ENUMDICNAME
 		In("ERMS3_SPOTCONTRACT.ACCOUNTID", accountids).
 		Desc("ERMS3_SPOTCONTRACTDETAIL.SPOTCONTRACTID")
 	if err := s.Find(&datas); err != nil {
+=======
+	datas, err := models.QueryErms3SpotContractInfo(accountids, req.ContractType, req.ContractMode, req.Status)
+	if err != nil {
+>>>>>>> 795100720a8d8ab7efd84b43650bcc07c35ad118
 		// 查询失败
 		logger.GetLogger().Errorf("QuerySpotContract failed: %s", err.Error())
 		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)

+ 17 - 29
controllers/wrtrade/wrTrade.go

@@ -6,40 +6,21 @@ import (
 	"mtp2_if/global/app"
 	"mtp2_if/global/e"
 	"mtp2_if/logger"
+	"mtp2_if/models"
 	"net/http"
 	"strconv"
 
 	"github.com/gin-gonic/gin"
 )
 
-// Deliverygoods 现货品种表
-type Deliverygoods struct {
-	Deliverygoodsid   int64   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'" binding:"required"`     // 交割商品ID(SEQ_DELIVERYGOODS)
-	Deliverygoodscode string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'" binding:"required"` // 交割商品代码
-	Deliverygoodsname string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`                    // 交割商品名称
-	Goodsunitid       int64   `json:"goodsunitid"  xorm:"'GOODSUNITID'"`                                // 交割商品单位ID
-	Deliverygoodstype int64   `json:"deliverygoodstype"  xorm:"'DELIVERYGOODSTYPE'"`                    // 交割商品类型: 1-整装不拆分 2-散装记录明细 3:整装拆分 4:散装不记录明细
-	Standardqty       int64   `json:"standardqty"  xorm:"'STANDARDQTY'"`                                // 标准数量(库位数量) [标准品特有]
-	Standardqtyrange  float64 `json:"standardqtyrange"  xorm:"'STANDARDQTYRANGE'"`                      // 标准数量偏差范围 [标准品特有]
-	Issplit           int64   `json:"issplit"  xorm:"'ISSPLIT'"`                                        // 是否拆分 - 0:不拆分 1:拆分 [整装]   0:不记录明细 1:记录明细 [散货] - 作废整装时不拆分,则标准数量=合约单位;拆分时标准数量为合约单位的整数倍;整装时必须记录明细表数据
-	Agreeunit         int64   `json:"agreeunit"  xorm:"'AGREEUNIT'"`                                    // 合约单位[散货时默认为1, 整装时默认为标准数量]
-	Qtydecimalplace   int64   `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"`                        // 成交量小数位
-	Categoryid        int64   `json:"categoryid"  xorm:"'CATEGORYID'"`                                  // 类别ID(SEQ_WRCATEGORY)
-}
-
-// TableName is DELIVERYGOODS
-func (Deliverygoods) TableName() string {
-	return "DELIVERYGOODS"
-}
-
 // Wrcategory 仓单分类表
 type Wrcategory struct {
-	Categoryid       int64           `json:"categoryid"  xorm:"'CATEGORYID'" binding:"required"` // 类别ID(SEQ_WRCATEGORY)
-	Categoryname     string          `json:"categoryname"  xorm:"'CATEGORYNAME'"`                // 类别名称
-	Parentcategoryid int64           `json:"parentcategoryid"  xorm:"'PARENTCATEGORYID'"`        // 父类别ID
-	Categorydesc     string          `json:"categorydesc"  xorm:"'CATEGORYDESC'"`                // 类别描述
-	Iconurl          string          `json:"iconurl"  xorm:"'ICONURL'"`                          // 图标地址
-	Deliverygoods    []Deliverygoods // 所包含现货种类信息
+	Categoryid       int64                  `json:"categoryid"  xorm:"'CATEGORYID'" binding:"required"` // 类别ID(SEQ_WRCATEGORY)
+	Categoryname     string                 `json:"categoryname"  xorm:"'CATEGORYNAME'"`                // 类别名称
+	Parentcategoryid int64                  `json:"parentcategoryid"  xorm:"'PARENTCATEGORYID'"`        // 父类别ID
+	Categorydesc     string                 `json:"categorydesc"  xorm:"'CATEGORYDESC'"`                // 类别描述
+	Iconurl          string                 `json:"iconurl"  xorm:"'ICONURL'"`                          // 图标地址
+	Deliverygoods    []models.Deliverygoods // 所包含现货种类信息
 }
 
 // TableName is WRCATEGORY
@@ -55,13 +36,20 @@ func (Wrcategory) TableName() string {
 // @Failure 500 {object} app.Response
 // @Router /WRTrade/GetAllDeliveryGoods [get]
 // @Tags 仓单贸易
+// @Summary 获取带仓单分类的种类信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Success 200 {object} app.Response
+// @Failure 500 {object} app.Response
+// @Router /WRTrade/GetAllDeliveryGoods [get]
+// @Tags 仓单贸易
 func GetAllDeliveryGoods(c *gin.Context) {
 	appG := app.Gin{C: c}
 
 	engine := db.GetEngine()
 
 	// 获取品种(交割商品)信息
-	deliveryGoodses := make([]Deliverygoods, 0)
+	deliveryGoodses := make([]models.Deliverygoods, 0)
 	if err := engine.Where("IsValid=1").And("categoryid<>0").Find(&deliveryGoodses); err != nil {
 		// 查询失败
 		logger.GetLogger().Errorf("GetAllDeliveryGoods failed: %s", err.Error())
@@ -74,9 +62,9 @@ func GetAllDeliveryGoods(c *gin.Context) {
 	ids := ""
 	for _, deliveryGoods := range deliveryGoodses {
 		if ids == "" {
-			ids = strconv.FormatInt(deliveryGoods.Categoryid, 10)
+			ids = strconv.FormatInt(int64(deliveryGoods.Categoryid), 10)
 		} else {
-			ids += "," + strconv.FormatInt(deliveryGoods.Categoryid, 10)
+			ids += "," + strconv.FormatInt(int64(deliveryGoods.Categoryid), 10)
 		}
 	}
 

+ 86 - 73
docs/docs.go

@@ -2868,12 +2868,17 @@ var doc = `{
                 "security": [
                     {
                         "ApiKeyAuth": []
+                    },
+                    {
+                        "ApiKeyAuth": []
                     }
                 ],
                 "produces": [
+                    "application/json",
                     "application/json"
                 ],
                 "tags": [
+                    "仓单贸易",
                     "仓单贸易"
                 ],
                 "summary": "获取带仓单分类的种类信息",
@@ -4659,7 +4664,7 @@ var doc = `{
                     "description": "仓单标准列表",
                     "type": "array",
                     "items": {
-                        "$ref": "#/definitions/models.Wrstandard"
+                        "$ref": "#/definitions/models.WRStandardInfo"
                     }
                 }
             }
@@ -6620,6 +6625,86 @@ var doc = `{
                 }
             }
         },
+        "models.WRStandardInfo": {
+            "type": "object",
+            "required": [
+                "wrstandardid"
+            ],
+            "properties": {
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "交割商品名称",
+                    "type": "string"
+                },
+                "factoryitemjson": {
+                    "description": "要素项定义Json[{\"DGFactoryItemTypeID\": ,\"ItemTypeMode\": ,\"FactoryItemIDs\": },{.....},]DGFactoryItemTypeID - 要素项类型ID --DGFactoryItem-\u003eDGFactoryItemTypeIDItemTypeMode - 要素项类型模式 --DGFactoryItem-\u003eItemTypeModeFactoryItemIDs - 选择项IDs--DGFactoryItem-\u003eDGFactoryItemID, 逗号分隔",
+                    "type": "string"
+                },
+                "isvalid": {
+                    "description": "是否有效 - 0:无效 1:有效",
+                    "type": "integer"
+                },
+                "minivalue": {
+                    "description": "最小变动值",
+                    "type": "integer"
+                },
+                "minivaluedp": {
+                    "description": "最小变动值小数位",
+                    "type": "integer"
+                },
+                "realminivalue": {
+                    "description": "实际最小变动值",
+                    "type": "integer"
+                },
+                "realminivaluedp": {
+                    "description": "实际最小变动值小数位",
+                    "type": "integer"
+                },
+                "unitid": {
+                    "description": "单位ID",
+                    "type": "integer"
+                },
+                "unitname": {
+                    "description": "单位",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "updatorid": {
+                    "description": "更新人",
+                    "type": "integer"
+                },
+                "wrsstatus": {
+                    "description": "状态 - 作废 - 0:未激活 1:正常",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "仓单标准代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "仓单标准ID(SEQ_WRSTANDARD)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "仓单标准名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Warehouseinfo": {
             "type": "object",
             "required": [
@@ -6697,78 +6782,6 @@ var doc = `{
                 }
             }
         },
-        "models.Wrstandard": {
-            "type": "object",
-            "required": [
-                "wrstandardid"
-            ],
-            "properties": {
-                "createtime": {
-                    "description": "创建时间",
-                    "type": "string"
-                },
-                "creatorid": {
-                    "description": "创建人",
-                    "type": "integer"
-                },
-                "deliverygoodsid": {
-                    "description": "品种ID",
-                    "type": "integer"
-                },
-                "factoryitemjson": {
-                    "description": "要素项定义Json[{\"DGFactoryItemTypeID\": ,\"ItemTypeMode\": ,\"FactoryItemIDs\": },{.....},]DGFactoryItemTypeID - 要素项类型ID --DGFactoryItem-\u003eDGFactoryItemTypeIDItemTypeMode - 要素项类型模式 --DGFactoryItem-\u003eItemTypeModeFactoryItemIDs - 选择项IDs--DGFactoryItem-\u003eDGFactoryItemID, 逗号分隔",
-                    "type": "string"
-                },
-                "isvalid": {
-                    "description": "是否有效 - 0:无效 1:有效",
-                    "type": "integer"
-                },
-                "minivalue": {
-                    "description": "最小变动值",
-                    "type": "integer"
-                },
-                "minivaluedp": {
-                    "description": "最小变动值小数位",
-                    "type": "integer"
-                },
-                "realminivalue": {
-                    "description": "实际最小变动值",
-                    "type": "integer"
-                },
-                "realminivaluedp": {
-                    "description": "实际最小变动值小数位",
-                    "type": "integer"
-                },
-                "unitid": {
-                    "description": "单位ID",
-                    "type": "integer"
-                },
-                "updatetime": {
-                    "description": "更新时间",
-                    "type": "string"
-                },
-                "updatorid": {
-                    "description": "更新人",
-                    "type": "integer"
-                },
-                "wrsstatus": {
-                    "description": "状态 - 作废 - 0:未激活 1:正常",
-                    "type": "integer"
-                },
-                "wrstandardcode": {
-                    "description": "仓单标准代码",
-                    "type": "string"
-                },
-                "wrstandardid": {
-                    "description": "仓单标准ID(SEQ_WRSTANDARD)",
-                    "type": "integer"
-                },
-                "wrstandardname": {
-                    "description": "仓单标准名称",
-                    "type": "string"
-                }
-            }
-        },
         "order.QueryHisTradeDetailRsp": {
             "type": "object",
             "required": [

+ 86 - 73
docs/swagger.json

@@ -2852,12 +2852,17 @@
                 "security": [
                     {
                         "ApiKeyAuth": []
+                    },
+                    {
+                        "ApiKeyAuth": []
                     }
                 ],
                 "produces": [
+                    "application/json",
                     "application/json"
                 ],
                 "tags": [
+                    "仓单贸易",
                     "仓单贸易"
                 ],
                 "summary": "获取带仓单分类的种类信息",
@@ -4643,7 +4648,7 @@
                     "description": "仓单标准列表",
                     "type": "array",
                     "items": {
-                        "$ref": "#/definitions/models.Wrstandard"
+                        "$ref": "#/definitions/models.WRStandardInfo"
                     }
                 }
             }
@@ -6604,6 +6609,86 @@
                 }
             }
         },
+        "models.WRStandardInfo": {
+            "type": "object",
+            "required": [
+                "wrstandardid"
+            ],
+            "properties": {
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "deliverygoodsid": {
+                    "description": "品种ID",
+                    "type": "integer"
+                },
+                "deliverygoodsname": {
+                    "description": "交割商品名称",
+                    "type": "string"
+                },
+                "factoryitemjson": {
+                    "description": "要素项定义Json[{\"DGFactoryItemTypeID\": ,\"ItemTypeMode\": ,\"FactoryItemIDs\": },{.....},]DGFactoryItemTypeID - 要素项类型ID --DGFactoryItem-\u003eDGFactoryItemTypeIDItemTypeMode - 要素项类型模式 --DGFactoryItem-\u003eItemTypeModeFactoryItemIDs - 选择项IDs--DGFactoryItem-\u003eDGFactoryItemID, 逗号分隔",
+                    "type": "string"
+                },
+                "isvalid": {
+                    "description": "是否有效 - 0:无效 1:有效",
+                    "type": "integer"
+                },
+                "minivalue": {
+                    "description": "最小变动值",
+                    "type": "integer"
+                },
+                "minivaluedp": {
+                    "description": "最小变动值小数位",
+                    "type": "integer"
+                },
+                "realminivalue": {
+                    "description": "实际最小变动值",
+                    "type": "integer"
+                },
+                "realminivaluedp": {
+                    "description": "实际最小变动值小数位",
+                    "type": "integer"
+                },
+                "unitid": {
+                    "description": "单位ID",
+                    "type": "integer"
+                },
+                "unitname": {
+                    "description": "单位",
+                    "type": "string"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "updatorid": {
+                    "description": "更新人",
+                    "type": "integer"
+                },
+                "wrsstatus": {
+                    "description": "状态 - 作废 - 0:未激活 1:正常",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "仓单标准代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "仓单标准ID(SEQ_WRSTANDARD)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "仓单标准名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Warehouseinfo": {
             "type": "object",
             "required": [
@@ -6681,78 +6766,6 @@
                 }
             }
         },
-        "models.Wrstandard": {
-            "type": "object",
-            "required": [
-                "wrstandardid"
-            ],
-            "properties": {
-                "createtime": {
-                    "description": "创建时间",
-                    "type": "string"
-                },
-                "creatorid": {
-                    "description": "创建人",
-                    "type": "integer"
-                },
-                "deliverygoodsid": {
-                    "description": "品种ID",
-                    "type": "integer"
-                },
-                "factoryitemjson": {
-                    "description": "要素项定义Json[{\"DGFactoryItemTypeID\": ,\"ItemTypeMode\": ,\"FactoryItemIDs\": },{.....},]DGFactoryItemTypeID - 要素项类型ID --DGFactoryItem-\u003eDGFactoryItemTypeIDItemTypeMode - 要素项类型模式 --DGFactoryItem-\u003eItemTypeModeFactoryItemIDs - 选择项IDs--DGFactoryItem-\u003eDGFactoryItemID, 逗号分隔",
-                    "type": "string"
-                },
-                "isvalid": {
-                    "description": "是否有效 - 0:无效 1:有效",
-                    "type": "integer"
-                },
-                "minivalue": {
-                    "description": "最小变动值",
-                    "type": "integer"
-                },
-                "minivaluedp": {
-                    "description": "最小变动值小数位",
-                    "type": "integer"
-                },
-                "realminivalue": {
-                    "description": "实际最小变动值",
-                    "type": "integer"
-                },
-                "realminivaluedp": {
-                    "description": "实际最小变动值小数位",
-                    "type": "integer"
-                },
-                "unitid": {
-                    "description": "单位ID",
-                    "type": "integer"
-                },
-                "updatetime": {
-                    "description": "更新时间",
-                    "type": "string"
-                },
-                "updatorid": {
-                    "description": "更新人",
-                    "type": "integer"
-                },
-                "wrsstatus": {
-                    "description": "状态 - 作废 - 0:未激活 1:正常",
-                    "type": "integer"
-                },
-                "wrstandardcode": {
-                    "description": "仓单标准代码",
-                    "type": "string"
-                },
-                "wrstandardid": {
-                    "description": "仓单标准ID(SEQ_WRSTANDARD)",
-                    "type": "integer"
-                },
-                "wrstandardname": {
-                    "description": "仓单标准名称",
-                    "type": "string"
-                }
-            }
-        },
         "order.QueryHisTradeDetailRsp": {
             "type": "object",
             "required": [

+ 66 - 57
docs/swagger.yaml

@@ -1319,7 +1319,7 @@ definitions:
       wrstandards:
         description: 仓单标准列表
         items:
-          $ref: '#/definitions/models.Wrstandard'
+          $ref: '#/definitions/models.WRStandardInfo'
         type: array
     type: object
   erms3.QuerySpotContractInfoRsp:
@@ -2787,6 +2787,68 @@ definitions:
     required:
     - userid
     type: object
+  models.WRStandardInfo:
+    properties:
+      createtime:
+        description: 创建时间
+        type: string
+      creatorid:
+        description: 创建人
+        type: integer
+      deliverygoodsid:
+        description: 品种ID
+        type: integer
+      deliverygoodsname:
+        description: 交割商品名称
+        type: string
+      factoryitemjson:
+        description: '要素项定义Json[{"DGFactoryItemTypeID": ,"ItemTypeMode": ,"FactoryItemIDs":
+          },{.....},]DGFactoryItemTypeID - 要素项类型ID --DGFactoryItem->DGFactoryItemTypeIDItemTypeMode
+          - 要素项类型模式 --DGFactoryItem->ItemTypeModeFactoryItemIDs - 选择项IDs--DGFactoryItem->DGFactoryItemID,
+          逗号分隔'
+        type: string
+      isvalid:
+        description: 是否有效 - 0:无效 1:有效
+        type: integer
+      minivalue:
+        description: 最小变动值
+        type: integer
+      minivaluedp:
+        description: 最小变动值小数位
+        type: integer
+      realminivalue:
+        description: 实际最小变动值
+        type: integer
+      realminivaluedp:
+        description: 实际最小变动值小数位
+        type: integer
+      unitid:
+        description: 单位ID
+        type: integer
+      unitname:
+        description: 单位
+        type: string
+      updatetime:
+        description: 更新时间
+        type: string
+      updatorid:
+        description: 更新人
+        type: integer
+      wrsstatus:
+        description: 状态 - 作废 - 0:未激活 1:正常
+        type: integer
+      wrstandardcode:
+        description: 仓单标准代码
+        type: string
+      wrstandardid:
+        description: 仓单标准ID(SEQ_WRSTANDARD)
+        type: integer
+      wrstandardname:
+        description: 仓单标准名称
+        type: string
+    required:
+    - wrstandardid
+    type: object
   models.Warehouseinfo:
     properties:
       address:
@@ -2844,62 +2906,6 @@ definitions:
     - autoid
     - warehousecode
     type: object
-  models.Wrstandard:
-    properties:
-      createtime:
-        description: 创建时间
-        type: string
-      creatorid:
-        description: 创建人
-        type: integer
-      deliverygoodsid:
-        description: 品种ID
-        type: integer
-      factoryitemjson:
-        description: '要素项定义Json[{"DGFactoryItemTypeID": ,"ItemTypeMode": ,"FactoryItemIDs":
-          },{.....},]DGFactoryItemTypeID - 要素项类型ID --DGFactoryItem->DGFactoryItemTypeIDItemTypeMode
-          - 要素项类型模式 --DGFactoryItem->ItemTypeModeFactoryItemIDs - 选择项IDs--DGFactoryItem->DGFactoryItemID,
-          逗号分隔'
-        type: string
-      isvalid:
-        description: 是否有效 - 0:无效 1:有效
-        type: integer
-      minivalue:
-        description: 最小变动值
-        type: integer
-      minivaluedp:
-        description: 最小变动值小数位
-        type: integer
-      realminivalue:
-        description: 实际最小变动值
-        type: integer
-      realminivaluedp:
-        description: 实际最小变动值小数位
-        type: integer
-      unitid:
-        description: 单位ID
-        type: integer
-      updatetime:
-        description: 更新时间
-        type: string
-      updatorid:
-        description: 更新人
-        type: integer
-      wrsstatus:
-        description: 状态 - 作废 - 0:未激活 1:正常
-        type: integer
-      wrstandardcode:
-        description: 仓单标准代码
-        type: string
-      wrstandardid:
-        description: 仓单标准ID(SEQ_WRSTANDARD)
-        type: integer
-      wrstandardname:
-        description: 仓单标准名称
-        type: string
-    required:
-    - wrstandardid
-    type: object
   order.QueryHisTradeDetailRsp:
     properties:
       accountid:
@@ -6027,6 +6033,7 @@ paths:
     get:
       produces:
       - application/json
+      - application/json
       responses:
         "200":
           description: OK
@@ -6038,9 +6045,11 @@ paths:
             $ref: '#/definitions/app.Response'
       security:
       - ApiKeyAuth: []
+      - ApiKeyAuth: []
       summary: 获取带仓单分类的种类信息
       tags:
       - 仓单贸易
+      - 仓单贸易
 securityDefinitions:
   ApiKeyAuth:
     in: header

+ 36 - 0
models/erms3.go

@@ -52,6 +52,23 @@ func (Erms3Spotcontractdetail) TableName() string {
 	return "ERMS3_SPOTCONTRACTDETAIL"
 }
 
+// Erms3SpotContractInfo 合同明细.
+type Erms3SpotContractInfo struct {
+	Erms3Spotcontractdetail `xorm:"extends"`
+	Areauserid                     int64     `json:"areauserid" xorm:"AREAUSERID"`                  // 所属机构
+	Accountid                      int64     `json:"accountid" xorm:"ACCOUNTID"`                    // 资金账户ID
+	Customeruserid                 int64     `json:"customeruserid" xorm:"CUSTOMERUSERID"`          // 客户ID
+	Customeraccountid              int64     `json:"customeraccountid" xorm:"CUSTOMERACCOUNTID"`    // 客户资金账户ID
+	Signdate                       time.Time `json:"signdate" xorm:"SIGNDATE"`                      // 签订日期
+	Closestatus                    int32     `json:"closestatus" xorm:"CLOSESTATUS"`                // 完结状态 - 0:未完结 1:已完结
+	Relatedbizid                   string    `json:"relatedbizid" xorm:"RELATEDBIZID"`              // 关联业务ID
+	Goodunit                       string    `json:"goodunit" xorm:"'GOODUNIT'"`                    // 报价单位
+	Wrstandardcode                 string    `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`       // 仓单标准代码
+	Wrstandardname                 string    `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`       // 仓单标准名称
+	Deliverygoodscode              string    `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"` // 交割商品代码
+	Deliverygoodsname              string    `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"` // 交割商品名称
+}
+
 // Erms3SpotContractApply 现货合同申请表
 type Erms3SpotContractApply struct {
 	SpotContractID     int64     `json:"spotcontractid"  xorm:"'SPOTCONTRACTID'" binging:"required"` // 现货合同ID(345+Unix秒时间戳(10位)+xxxxxx)
@@ -152,3 +169,22 @@ func AddSpotContractApply(spotContractApply Erms3SpotContractApply) error {
 
 	return err
 }
+
+func QueryErms3SpotContractInfo(accountids []int64, contracttype, contractmode, status int32) ([]Erms3SpotContractInfo, error) {
+	datas := make([]Erms3SpotContractInfo, 0)
+	engine := db.GetEngine()
+	s := engine.Table("ERMS3_SPOTCONTRACTDETAIL").
+		Join("LEFT", "ERMS3_SPOTCONTRACT", "ERMS3_SPOTCONTRACTDETAIL.SPOTCONTRACTID = ERMS3_SPOTCONTRACT.SPOTCONTRACTID").
+		Join("LEFT", "ERMS3_BIZTRADEDETAIL", "ERMS3_BIZTRADEDETAIL.SPOTDETAILID = ERMS3_SPOTCONTRACTDETAIL.SPOTDETAILID").
+		Join("LEFT", "WRSTANDARD", "WRSTANDARD.WRSTANDARDID = ERMS3_SPOTCONTRACTDETAIL.WRSTANDARDID").
+		Join("LEFT", "DELIVERYGOODS", "DELIVERYGOODS.DELIVERYGOODSID = WRSTANDARD.DELIVERYGOODSID").
+		Join("LEFT", "ENUMDICITEM", "WRSTANDARD.UNITID = ENUMDICITEM.ENUMITEMNAME AND ENUMDICITEM.ENUMDICCODE = 'goodsunit'").
+		Select(`to_char(ERMS3_SPOTCONTRACTDETAIL.SPOTCONTRACTID) SPOTCONTRACTID, ERMS3_SPOTCONTRACT.AREAUSERID, ERMS3_SPOTCONTRACT.ACCOUNTID, ERMS3_SPOTCONTRACT.CUSTOMERUSERID, 
+ERMS3_SPOTCONTRACT.CUSTOMERACCOUNTID, ERMS3_SPOTCONTRACT.CLOSESTATUS, ERMS3_SPOTCONTRACT.SIGNDATE, ERMS3_SPOTCONTRACTDETAIL.*, WRSTANDARD.WRSTANDARDNAME, WRSTANDARD.WRSTANDARDCODE, DELIVERYGOODS.DELIVERYGOODSNAME, DELIVERYGOODS.DELIVERYGOODSCODE, 
+to_char(ERMS3_BIZTRADEDETAIL.RELATEDBIZID) RELATEDBIZID, ENUMDICITEM.ENUMDICNAME GOODUNIT`).
+		Where("ERMS3_SPOTCONTRACT.CONTRACTTYPE = ? AND ERMS3_SPOTCONTRACT.CONTRACTMODE = ? AND ERMS3_SPOTCONTRACT.CLOSESTATUS = ?", contracttype, contractmode, status).
+		In("ERMS3_SPOTCONTRACT.ACCOUNTID", accountids).
+		Desc("ERMS3_SPOTCONTRACTDETAIL.SPOTCONTRACTID")
+	err := s.Find(&datas)
+	return datas, err
+}

+ 14 - 3
models/wrTrade.go

@@ -58,12 +58,23 @@ func (Warehouseinfo) TableName() string {
 	return "WAREHOUSEINFO"
 }
 
+// WRStandardInfo 仓库信息
+type WRStandardInfo struct {
+	Wrstandard `xorm:"extends"`
+
+	Unitname          string `json:"unitname" xorm:"UNITNAME"`                      // 单位
+	Deliverygoodsname string `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"` // 交割商品名称
+}
+
 // GetWrstandards 获取有效的仓单标准
-func GetWrstandards() ([]Wrstandard, error) {
+func GetWrstandards() ([]WRStandardInfo, error) {
 	engine := db.GetEngine()
 
-	wrStandards := make([]Wrstandard, 0)
-	if err := engine.Where("ISVALID = 1").Find(&wrStandards); err != nil {
+	wrStandards := make([]WRStandardInfo, 0)
+	if err := engine.Table("WRSTANDARD").Select("WRSTANDARD.*, E1.ENUMDICNAME UNITNAME, DG.DELIVERYGOODSNAME").
+		Join("LEFT", "ENUMDICITEM E1", "E1.ENUMITEMNAME = WRSTANDARD.UNITID and E1.ENUMDICCODE = 'GOODSUNIT'").
+		Join("LEFT", "DELIVERYGOODS DG", "DG.DELIVERYGOODSID = WRSTANDARD.DELIVERYGOODSID").
+		Where("WRSTANDARD.ISVALID = 1").Find(&wrStandards); err != nil {
 		return nil, err
 	}