Browse Source

1. 查行情增加品种筛选条件
2. 查持有记录问题修复

zou.yingbin 4 years ago
parent
commit
99543d5a51
5 changed files with 54 additions and 28 deletions
  1. 1 0
      controllers/wrTrade2/qryWrTrade.go
  2. 10 4
      docs/docs.go
  3. 10 4
      docs/swagger.json
  4. 7 3
      docs/swagger.yaml
  5. 26 17
      models/wrTrade2.go

+ 1 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -24,6 +24,7 @@ import (
 // @Param wrstandardname query string false "商品名称(筛选条件)"
 // @Param brandname query string false "品牌名称(筛选条件)"
 // @Param warehouseid query int false "仓库id(筛选条件)"
+// @Param deliverygoodsid query int false "品种id"
 // @Success 200 {array} models.WrOrderQuote
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryOrderQuote [get]

+ 10 - 4
docs/docs.go

@@ -11082,6 +11082,12 @@ var doc = `{
                         "description": "仓库id(筛选条件)",
                         "name": "warehouseid",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品种id",
+                        "name": "deliverygoodsid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -29384,10 +29390,6 @@ var doc = `{
                 "itemtype": {
                     "description": "类型 1-品种 2-品类(商品) 3-仓库",
                     "type": "integer"
-                },
-                "itype": {
-                    "description": "类型 逗号隔开, 如 1,2",
-                    "type": "string"
                 }
             }
         },
@@ -29514,6 +29516,10 @@ var doc = `{
                     "description": "拆分父子单号",
                     "type": "integer"
                 },
+                "pledgeqty": {
+                    "description": "质押数量",
+                    "type": "number"
+                },
                 "qty": {
                     "description": "数量",
                     "type": "number"

+ 10 - 4
docs/swagger.json

@@ -11066,6 +11066,12 @@
                         "description": "仓库id(筛选条件)",
                         "name": "warehouseid",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "品种id",
+                        "name": "deliverygoodsid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -29368,10 +29374,6 @@
                 "itemtype": {
                     "description": "类型 1-品种 2-品类(商品) 3-仓库",
                     "type": "integer"
-                },
-                "itype": {
-                    "description": "类型 逗号隔开, 如 1,2",
-                    "type": "string"
                 }
             }
         },
@@ -29498,6 +29500,10 @@
                     "description": "拆分父子单号",
                     "type": "integer"
                 },
+                "pledgeqty": {
+                    "description": "质押数量",
+                    "type": "number"
+                },
                 "qty": {
                     "description": "数量",
                     "type": "number"

+ 7 - 3
docs/swagger.yaml

@@ -13294,9 +13294,6 @@ definitions:
       itemtype:
         description: 类型 1-品种 2-品类(商品) 3-仓库
         type: integer
-      itype:
-        description: 类型 逗号隔开, 如 1,2
-        type: string
     type: object
   models.WrGoodsInfo:
     properties:
@@ -13389,6 +13386,9 @@ definitions:
       parentsubnum:
         description: 拆分父子单号
         type: integer
+      pledgeqty:
+        description: 质押数量
+        type: number
       qty:
         description: 数量
         type: number
@@ -23026,6 +23026,10 @@ paths:
         in: query
         name: warehouseid
         type: integer
+      - description: 品种id
+        in: query
+        name: deliverygoodsid
+        type: integer
       produces:
       - application/json
       responses:

+ 26 - 17
models/wrTrade2.go

@@ -99,7 +99,7 @@ func (r *WrOrderQuote) buildSqlFixedPrice() string {
 		"       h.warehousecode," +
 		"       wg.wrstandardname," +
 		"       wg.wrstandardcode," +
-		"       wg.wrstandardname || w.wrfactortypename as wrgoodsname" +
+		"       wg.wrstandardname || w.wrfactortypename2 as wrgoodsname" +
 		"  from wrQuote k" +
 		"  left join WRFactorType w" +
 		"    on k.wrfactortypeid = w.wrfactortypeid" +
@@ -119,6 +119,7 @@ func (r *WrOrderQuote) buildSqlFixedPrice() string {
 	param2.AndLike("w.wrfactortypename", r.WRSTANDARDNAME)
 	param2.AndLike("w.wrfactortypename", r.BRANDNAME)
 	param2.AndEx("w.warehouseid", r.WAREHOUSEID, r.WAREHOUSEID > 0)
+	param2.AndEx("w.deliverygoodsid", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
 	sqlId.FormatParam(param.String(), param.String(), param2.String())
 
 	sqlId.Page(r.Page, r.PageSize)
@@ -197,7 +198,7 @@ func (r *WrOrderQuote) buildSqlPriceMove() string {
 		"       h.warehousecode," +
 		"       wg.wrstandardname," +
 		"       wg.wrstandardcode," +
-		"       wg.wrstandardname || w.wrfactortypename as wrgoodsname" +
+		"       wg.wrstandardname || w.wrfactortypename2 as wrgoodsname" +
 		"  from wrQuote k" +
 		"  left join WRFactorType w" +
 		"    on k.wrfactortypeid = w.wrfactortypeid" +
@@ -341,7 +342,11 @@ type Wr2FactorType struct {
 }
 
 func (r *Wr2FactorType) Calc() {
-	r.WRTYPENAME = r.WRSTANDARDNAME + "-" + r.WRFACTORTYPENAME
+	if len(r.WRFACTORTYPENAME) > 0 {
+		r.WRTYPENAME = r.WRSTANDARDNAME + "-" + r.WRFACTORTYPENAME
+	} else {
+		r.WRTYPENAME = r.WRSTANDARDNAME
+	}
 	r.WRTYPENAME = strings.ReplaceAll(r.WRTYPENAME, ",", "-")
 }
 
@@ -400,7 +405,7 @@ func (r *WrPosition) buildSql1() string {
 		"         w.wrstandardid," +
 		"         w.warehouseid," +
 		"         wd.wrstandardname," +
-		"         wd.wrstandardname || '-' ||w.wrfactortypename as wrtypename" +
+		"         wd.wrstandardname || '-' ||w.wrfactortypename2 as wrtypename" +
 		"    from WRPOSITION t" +
 		"    left join WRFACTORTYPE w" +
 		"      on t.wrfactortypeid = w.wrfactortypeid" +
@@ -455,7 +460,7 @@ func (r *WrPosition) buildSql3() string {
 		"       t.CREDITFREEZEQTY," +
 		"       t.CREDITTRADEQTY," +
 		"       w.WRFACTORTYPEID," +
-		"       w.WRFACTORTYPENAME," +
+		"       w.WRFACTORTYPENAME2 WRFACTORTYPENAME," +
 		"       w.DELIVERYGOODSID," +
 		"       w.WAREHOUSEID," +
 		"       w.WRSTANDARDID," +
@@ -527,12 +532,13 @@ func (r *WrOrderDetail) calc() {
 	} else {
 		r.FUTUSHOW = fmt.Sprintf("%v//%.2f", r.GOODSCODE, r.FUTUPRICEMOVE)
 	}
+	r.Wr2FactorType.Calc()
 }
 
 func (r *WrOrderDetail) buildSql() string {
 	var sqlId utils.SQLVal = "with tmp as" +
 		" (select t.wrfactortypeid," +
-		"         t.wrfactortypename," +
+		"         t.wrfactortypename2 wrfactortypename," +
 		"         t.wrstandardid," +
 		"         t.deliverygoodsid," +
 		"         g.deliverygoodscode," +
@@ -542,7 +548,7 @@ func (r *WrOrderDetail) buildSql() string {
 		"         h.warehousecode," +
 		"         h.warehousename," +
 		"         e.enumdicname," +
-		"         w.wrstandardname || '-' || t.wrfactortypename as wrtypename" +
+		"         w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
 		"    from wrfactortype t" +
 		"    left join deliverygoods g" +
 		"      on t.deliverygoodsid = g.deliverygoodsid" +
@@ -620,7 +626,7 @@ type WrTradeDetail struct {
 }
 
 func (r *WrTradeDetail) calc() {
-
+	r.Wr2FactorType.Calc()
 }
 
 func (r *WrTradeDetail) buildSql() string {
@@ -636,7 +642,7 @@ func (r *WrTradeDetail) buildSql() string {
 		"         h.warehousecode," +
 		"         h.warehousename," +
 		"         e.enumdicname," +
-		"         w.wrstandardname || '-' || t.wrfactortypename as wrtypename" +
+		"         w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
 		"    from wrfactortype t" +
 		"    left join deliverygoods g" +
 		"      on t.deliverygoodsid = g.deliverygoodsid" +
@@ -715,12 +721,13 @@ type WrSpecialMatchOrder struct {
 
 func (r *WrSpecialMatchOrder) calc() {
 	r.AMOUNT = r.FIXEDPRICE * r.ORDERQTY
+	r.Wr2FactorType.Calc()
 }
 
 func (r *WrSpecialMatchOrder) buildSql() string {
 	var sqlId utils.SQLVal = "with tmp as" +
 		" (select t.wrfactortypeid," +
-		"         t.wrfactortypename," +
+		"         t.wrfactortypename2 wrfactortypename," +
 		"         t.wrstandardid," +
 		"         t.deliverygoodsid," +
 		"         g.deliverygoodscode," +
@@ -730,7 +737,7 @@ func (r *WrSpecialMatchOrder) buildSql() string {
 		"         h.warehousecode," +
 		"         h.warehousename," +
 		"         e.enumdicname," +
-		"         w.wrstandardname || '-' || t.wrfactortypename as wrtypename" +
+		"         w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
 		"    from wrfactortype t" +
 		"    left join deliverygoods g" +
 		"      on t.deliverygoodsid = g.deliverygoodsid" +
@@ -810,7 +817,7 @@ func (r *WrFactorTypeInfo) calc() {
 }
 
 func (r *WrFactorTypeInfo) buildSql() string {
-	var sqlId utils.SQLVal = "select t.wrfactortypeid," +
+	var sqlId utils.SQLVal = "select to_char(t.wrfactortypeid) wrfactortypeid," +
 		"       b.dgfactoryitemtypeid," +
 		"       b.itemtypename," +
 		"       c.dgfactoryitemvalue," +
@@ -1003,7 +1010,7 @@ type WrPerformancePlan struct {
 }
 
 func (r *WrPerformancePlan) calc() {
-
+	r.Wr2FactorType.Calc()
 }
 
 func (r *WrPerformancePlan) buildSql() string {
@@ -1019,7 +1026,7 @@ func (r *WrPerformancePlan) buildSql() string {
 		"         h.warehousecode," +
 		"         h.warehousename," +
 		"         e.enumdicname," +
-		"         w.wrstandardname || '-' || t.wrfactortypename as wrtypename" +
+		"         w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
 		"    from wrfactortype t" +
 		"    left join deliverygoods g" +
 		"      on t.deliverygoodsid = g.deliverygoodsid" +
@@ -1119,6 +1126,7 @@ type WrHoldLB struct {
 	TRADEDATE       string  `json:"tradedate"  xorm:"TRADEDATE" form:"tradedate"`                   // 交易日(yyyyMMdd)
 	WRID            int64   `json:"wrid"  xorm:"WRID" form:"wrid"`                                  // 仓单变更ID
 	PARENTSUBNUM    int32   `json:"parentsubnum"  xorm:"PARENTSUBNUM" form:"parentsubnum"`          // 拆分父子单号
+	PLEDGEQTY       float64 `json:"pledgeqty"  xorm:"'-'"`                                          // 质押数量
 	Wr2FactorType   `xorm:"extends"`
 
 	WRHOLDENO string  `json:"wrholdeno"` // 仓单编号
@@ -1128,6 +1136,7 @@ type WrHoldLB struct {
 func (r *WrHoldLB) calc() {
 	r.WRHOLDENO = fmt.Sprintf("%v_%v", r.LADINGBILLID, r.SUBNUM)
 	r.ENABLEQTY = r.QTY - r.FREEZERQTY
+	r.Wr2FactorType.Calc()
 }
 
 func (r *WrHoldLB) buildSql() string {
@@ -1143,7 +1152,7 @@ func (r *WrHoldLB) buildSql() string {
 		"         h.warehousecode," +
 		"         h.warehousename," +
 		"         e.enumdicname," +
-		"         w.wrstandardname || '-' || t.wrfactortypename as wrtypename" +
+		"         w.wrstandardname || '-' || t.wrfactortypename2 as wrtypename" +
 		"    from wrfactortype t" +
 		"    left join deliverygoods g" +
 		"      on t.deliverygoodsid = g.deliverygoodsid" +
@@ -1155,9 +1164,9 @@ func (r *WrHoldLB) buildSql() string {
 		"      on w.unitid = e.enumitemname" +
 		"     and e.enumdiccode = 'goodsunit'" +
 		")" +
-		"SELECT t.LADINGBILLID," +
+		"SELECT to_char(t.LADINGBILLID) LADINGBILLID," +
 		"       t.SUBNUM," +
-		"       t.WRFACTORTYPEID," +
+		"       to_char(t.WRFACTORTYPEID) WRFACTORTYPEID," +
 		"       t.DELIVERYGOODSID," +
 		"       t.QTY," +
 		"       t.FREEZERQTY," +