|
|
@@ -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)
|
|
|
}
|
|
|
}
|
|
|
|