Pārlūkot izejas kodu

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

Zhou.xiaoning 4 gadi atpakaļ
vecāks
revīzija
db7d3eec37
5 mainītis faili ar 51 papildinājumiem un 3 dzēšanām
  1. 1 0
      controllers/wrTrade2/qryWrTrade.go
  2. 11 0
      docs/docs.go
  3. 11 0
      docs/swagger.json
  4. 8 0
      docs/swagger.yaml
  5. 20 3
      models/wrTrade2.go

+ 1 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -66,6 +66,7 @@ func QueryOrderQuoteDetail(c *gin.Context) {
 // @Security ApiKeyAuth
 // @Param userid query int true "用户id"
 // @Param querytype query int true "查询类型  1-现货汇总 2-库存汇总(订单汇总)"
+// @Param haswr query int true "0:仓单预售 1:仓单贸易"
 // @Success 200 {array} models.WrPosition
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryWrPosition [get]

+ 11 - 0
docs/docs.go

@@ -11500,6 +11500,13 @@ var doc = `{
                         "name": "querytype",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "0:仓单预售 1:仓单贸易",
+                        "name": "haswr",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {
@@ -30356,6 +30363,10 @@ var doc = `{
                     "description": "总冻结数量",
                     "type": "number"
                 },
+                "haswr": {
+                    "description": "是否有仓单-卖方 - 0:无仓单 1:有仓单",
+                    "type": "integer"
+                },
                 "modifytime": {
                     "description": "修改时间(过户时间)",
                     "type": "string"

+ 11 - 0
docs/swagger.json

@@ -11484,6 +11484,13 @@
                         "name": "querytype",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "0:仓单预售 1:仓单贸易",
+                        "name": "haswr",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {
@@ -30340,6 +30347,10 @@
                     "description": "总冻结数量",
                     "type": "number"
                 },
+                "haswr": {
+                    "description": "是否有仓单-卖方 - 0:无仓单 1:有仓单",
+                    "type": "integer"
+                },
                 "modifytime": {
                     "description": "修改时间(过户时间)",
                     "type": "string"

+ 8 - 0
docs/swagger.yaml

@@ -13938,6 +13938,9 @@ definitions:
       freezeqty:
         description: 总冻结数量
         type: number
+      haswr:
+        description: 是否有仓单-卖方 - 0:无仓单 1:有仓单
+        type: integer
       modifytime:
         description: 修改时间(过户时间)
         type: string
@@ -23405,6 +23408,11 @@ paths:
         name: querytype
         required: true
         type: integer
+      - description: 0:仓单预售 1:仓单贸易
+        in: query
+        name: haswr
+        required: true
+        type: integer
       produces:
       - application/json
       responses:

+ 20 - 3
models/wrTrade2.go

@@ -394,6 +394,7 @@ type WrPosition struct {
 	WRPOSITIONNO    string  `json:"wrpositionno"`                              // 仓单编号
 
 	QueryType int32 `json:"querytype" form:"querytype"` // 查询类型  1-现货汇总 2-库存汇总(订单汇总)
+	HASWR     int32 `json:"haswr" form:"haswr"`         // 是否有仓单-卖方 - 0:无仓单 1:有仓单
 }
 
 func (r *WrPosition) calc() {
@@ -443,7 +444,7 @@ func (r *WrPosition) buildSql1() string {
 		"      on t.wrfactortypeid = w.wrfactortypeid" +
 		"    left join wrstandard wd" +
 		"      on w.wrstandardid = wd.wrstandardid" +
-		"   where t.wruserid = %v)," +
+		"   where 1=1 %v)," +
 		"hld as" +
 		" (select k.deliverygoodsid," +
 		"         k.wrtypename," +
@@ -470,7 +471,14 @@ func (r *WrPosition) buildSql1() string {
 		"  left join enumdicitem e" +
 		"    on e.enumitemname = wd.unitid" +
 		"   and e.enumdiccode = 'goodsunit'"
-	sqlId.FormatParam(r.WRUSERID)
+	var param utils.SQLVal
+	param.And("t.wruserid", r.WRUSERID)
+	if r.HASWR == 0 {
+		param.Join(" and t.CREDITTOTALQTY > 0")
+	} else {
+		param.Join(" and t.TOTALQTY > 0")
+	}
+	sqlId.FormatParam(param.String())
 	return sqlId.String()
 }
 
@@ -505,6 +513,8 @@ func (r *WrPosition) buildSql3() string {
 		"       dg.deliverygoodsname," +
 		"       wd.wrstandardcode," +
 		"       wd.wrstandardname," +
+		"       h.warehousecode," +
+		"       h.warehousename," +
 		"       e.enumdicname" +
 		"  FROM WRPOSITION t" +
 		"  LEFT JOIN WRFACTORTYPE w" +
@@ -513,11 +523,17 @@ func (r *WrPosition) buildSql3() string {
 		"    on t.deliverygoodsid = dg.deliverygoodsid" +
 		"  LEFT JOIN WRSTANDARD wd" +
 		"    on w.wrstandardid = wd.wrstandardid" +
+		"  left join warehouseinfo h on w.warehouseid=h.autoid" +
 		"  left join enumdicitem e" +
 		"    on e.enumitemname = wd.unitid" +
 		"   and e.enumdiccode = 'goodsunit'" +
 		" WHERE 1 = 1"
 	sqlId.And("t.WRUSERID", r.WRUSERID)
+	if r.HASWR == 0 {
+		sqlId.Join(" and t.CREDITTOTALQTY > 0")
+	} else {
+		sqlId.Join(" and t.TOTALQTY > 0")
+	}
 	return sqlId.String()
 }
 
@@ -528,6 +544,7 @@ func (r *WrPosition) GetDataEx() (interface{}, error) {
 	for i := range sData {
 		sData[i].calc()
 		sData[i].QueryType = r.QueryType
+		sData[i].HASWR = r.HASWR
 	}
 	// 查履约中的数量
 	if len(sData) > 0 {
@@ -1380,7 +1397,7 @@ func (r *WrPerformanPlanSum) buildSql_XHHZ() string {
 		"       sum(k.qty) qty" +
 		"  from tmp k" +
 		" group by k.selluserid, k.deliverygoodsid, k.wrstandardid, k.wrtypename"
-	sqlId.FormatParam(r.USERID, r.USERID)
+	sqlId.FormatParam(r.USERID)
 	return sqlId.String()
 }