Explorar el Código

1.查仓单贸易持仓汇总增加过滤条件

zou.yingbin hace 4 años
padre
commit
1091797f27
Se han modificado 6 ficheros con 100 adiciones y 6 borrados
  1. 4 0
      controllers/wrTrade2/qryWrTrade.go
  2. 25 1
      docs/docs.go
  3. 25 1
      docs/swagger.json
  4. 17 1
      docs/swagger.yaml
  5. 13 0
      models/ermcpCommon.go
  6. 16 3
      models/wrTrade2.go

+ 4 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -71,6 +71,10 @@ func QueryOrderQuoteDetail(c *gin.Context) {
 // @Param userid query int true "用户id"
 // @Param querytype query int true "查询类型  1-现货汇总 2-库存汇总(订单汇总)"
 // @Param haswr query int true "0:仓单预售 1:仓单贸易"
+// @Param dgitemname query string false "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm"
+// @Param warehouseid query int false "仓库id(筛选条件)"
+// @Param deliverygoodsid query int false "品种id"
+// @Param wrstandardid query int false "品类id"
 // @Success 200 {array} models.WrPosition
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryWrPosition [get]

+ 25 - 1
docs/docs.go

@@ -11774,6 +11774,30 @@ var doc = `{
                         "name": "haswr",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm",
+                        "name": "dgitemname",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓库id(筛选条件)",
+                        "name": "warehouseid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品种id",
+                        "name": "deliverygoodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品类id",
+                        "name": "wrstandardid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -31656,7 +31680,7 @@ var doc = `{
                     "type": "number"
                 },
                 "remainwrpositionqty": {
-                    "description": "剩余仓单头寸数量 - [仓单回购\\仓单质押] -\u003e 剩余数量",
+                    "description": "剩余仓单头寸数量 - [仓单回购\\仓单质押] -\u003e 剩余数量(待回购数量)",
                     "type": "number"
                 },
                 "remark": {

+ 25 - 1
docs/swagger.json

@@ -11758,6 +11758,30 @@
                         "name": "haswr",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm",
+                        "name": "dgitemname",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓库id(筛选条件)",
+                        "name": "warehouseid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品种id",
+                        "name": "deliverygoodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品类id",
+                        "name": "wrstandardid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -31640,7 +31664,7 @@
                     "type": "number"
                 },
                 "remainwrpositionqty": {
-                    "description": "剩余仓单头寸数量 - [仓单回购\\仓单质押] -\u003e 剩余数量",
+                    "description": "剩余仓单头寸数量 - [仓单回购\\仓单质押] -\u003e 剩余数量(待回购数量)",
                     "type": "number"
                 },
                 "remark": {

+ 17 - 1
docs/swagger.yaml

@@ -14610,7 +14610,7 @@ definitions:
         description: 合同剩余金额 -> 剩余金额
         type: number
       remainwrpositionqty:
-        description: 剩余仓单头寸数量 - [仓单回购\仓单质押] -> 剩余数量
+        description: 剩余仓单头寸数量 - [仓单回购\仓单质押] -> 剩余数量(待回购数量)
         type: number
       remark:
         description: 备注
@@ -24326,6 +24326,22 @@ paths:
         name: haswr
         required: true
         type: integer
+      - description: 商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm
+        in: query
+        name: dgitemname
+        type: string
+      - description: 仓库id(筛选条件)
+        in: query
+        name: warehouseid
+        type: integer
+      - description: 品种id
+        in: query
+        name: deliverygoodsid
+        type: integer
+      - description: 品类id
+        in: query
+        name: wrstandardid
+        type: integer
       produces:
       - application/json
       responses:

+ 13 - 0
models/ermcpCommon.go

@@ -13,6 +13,7 @@ import (
 	"github.com/shopspring/decimal"
 	"math"
 	"mtp2_if/utils"
+	"strings"
 )
 
 type ReportType int
@@ -159,3 +160,15 @@ func (r *SFLOAT64) Power10(n int) *SFLOAT64 {
 	*r = *r * SFLOAT64(math.Pow10(n))
 	return r
 }
+
+// FtItemName 解析逗号隔开的字符串
+func FtItemName(dgItemName string) ([]string, bool) {
+	if len(dgItemName) < 2 {
+		return nil, false
+	}
+	sItem := strings.Split(dgItemName, ",")
+	if len(sItem) > 0 {
+		return sItem, true
+	}
+	return nil, false
+}

+ 16 - 3
models/wrTrade2.go

@@ -431,8 +431,9 @@ type WrPosition struct {
 	SELLEXCUTEQTY   float64 `json:"sellexcuteqty"`                             // 销售履约中数量
 	WRPOSITIONNO    string  `json:"wrpositionno"`                              // 仓单编号
 
-	QueryType int32 `json:"querytype" form:"querytype"` // 查询类型  1-现货汇总 2-库存汇总(订单汇总)
-	HASWR     int32 `json:"haswr" form:"haswr"`         // 是否有仓单-卖方 - 0:无仓单 1:有仓单
+	QueryType  int32  `json:"querytype" form:"querytype"` // 查询类型  1-现货汇总 2-库存汇总(订单汇总)
+	HASWR      int32  `json:"haswr" form:"haswr"`         // 是否有仓单-卖方 - 0:无仓单 1:有仓单
+	DGITEMNAME string `json:"-" form:"dgitemname"`        // 筛选项
 }
 
 func (r *WrPosition) calc() {
@@ -511,6 +512,12 @@ func (r *WrPosition) buildSql1() string {
 		"   and e.enumdiccode = 'goodsunit'"
 	var param utils.SQLVal
 	param.And("t.wruserid", r.WRUSERID)
+	param.AndEx("w.wrstandardid", r.WRSTANDARDID, r.WRSTANDARDID > 0)
+	param.AndEx("w.warehouseid", r.WAREHOUSEID, r.WAREHOUSEID > 0)
+	param.AndEx("w.deliverygoodsid", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
+	if d, ok := FtItemName(r.DGITEMNAME); ok {
+		param.AndLikes("w.wrfactortypename", d...)
+	}
 	if r.HASWR == 0 {
 		param.Join(" and t.CREDITTOTALQTY > 0")
 	} else {
@@ -573,6 +580,12 @@ func (r *WrPosition) buildSql3() string {
 	} else {
 		sqlId.Join(" and t.TOTALQTY > 0")
 	}
+	sqlId.AndEx("w.wrstandardid", r.WRSTANDARDID, r.WRSTANDARDID > 0)
+	sqlId.AndEx("w.warehouseid", r.WAREHOUSEID, r.WAREHOUSEID > 0)
+	sqlId.AndEx("w.deliverygoodsid", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
+	if d, ok := FtItemName(r.DGITEMNAME); ok {
+		sqlId.AndLikes("w.wrfactortypename", d...)
+	}
 	return sqlId.String()
 }
 
@@ -2131,7 +2144,7 @@ type WrScfContract struct {
 	ISAUTOLOAN           int32   `json:"isautoloan"  xorm:"ISAUTOLOAN"`                                  // 是否自动放款 - 0:手动 1:自动 - [仓单质押]
 	REMAINAMOUNT         float64 `json:"remainamount"  xorm:"REMAINAMOUNT"`                              // 合同剩余金额 -> 剩余金额
 	INITMARGIN           float64 `json:"initmargin"  xorm:"INITMARGIN"`                                  // 保证金 - [仓单回购]
-	REMAINWRPOSITIONQTY  float64 `json:"remainwrpositionqty"  xorm:"REMAINWRPOSITIONQTY"`                // 剩余仓单头寸数量 - [仓单回购\仓单质押] -> 剩余数量
+	REMAINWRPOSITIONQTY  float64 `json:"remainwrpositionqty"  xorm:"REMAINWRPOSITIONQTY"`                // 剩余仓单头寸数量 - [仓单回购\仓单质押] -> 剩余数量(待回购数量)
 	BUYBACKWRPOSITIONQTY float64 `json:"buybackwrpositionqty"  xorm:"BUYBACKWRPOSITIONQTY"`              // 已回购仓单头寸数量 - [仓单回购\仓单质押] -> 已回购数量
 	INTERESTAMOUNT       float64 `json:"interestamount"  xorm:"INTERESTAMOUNT"`                          // 计息金额=合同剩余金额 - 初始保证金 - 追缴保证金 \  合同剩余金额
 	TOTALINTEREST        float64 `json:"totalinterest"  xorm:"TOTALINTEREST"`                            // 已计利息 -> 已计费用