Kaynağa Gözat

小红点增加库存信息、查询库存BUG修改

zou.yingbin 4 yıl önce
ebeveyn
işleme
01e514e179

+ 5 - 3
controllers/ermcp/qryBrandModel.go

@@ -14,7 +14,8 @@ import (
 
 // QueryBrandModelReq 查询品牌和型号请求
 type QueryBrandModelReq struct {
-	UserId int64 `form:"userid" binding:"required"` // 用户ID
+	UserId       int64 `form:"userid" binding:"required"` // 用户ID
+	Wrstandardid int64 `form:"wrstandardid"`              // 现货商品ID
 }
 
 // QueryGoodsBrand
@@ -22,6 +23,7 @@ type QueryBrandModelReq struct {
 // @Produce json
 // @Security ApiKeyAuth
 // @Param userid query int true "用户ID"
+// @Param wrstandardid query int false "现货商品ID"
 // @Success 200 {array} models.ErmcpGoodsBrand
 // @Failure 500 {object} app.Response
 // @Router /Ermcp/QueryGoodsBrand [get]
@@ -30,7 +32,7 @@ func QueryGoodsBrand(c *gin.Context) {
 	a := app.GinUtils{Gin: app.Gin{C: c}}
 	req := QueryBrandModelReq{}
 	a.DoBindReq(&req)
-	m := models.ErmcpGoodsBrand{AREAUSERID: req.UserId}
+	m := models.ErmcpGoodsBrand{AREAUSERID: req.UserId, WRSTANDARDID: req.Wrstandardid}
 	a.DoGetDataEx(&m)
 }
 
@@ -47,6 +49,6 @@ func QueryGoodsModel(c *gin.Context) {
 	a := app.GinUtils{Gin: app.Gin{C: c}}
 	req := QueryBrandModelReq{}
 	a.DoBindReq(&req)
-	m := models.ErmcpGoodsModel{AREAUSERID: req.UserId}
+	m := models.ErmcpGoodsModel{AREAUSERID: req.UserId, WRSTANDARDID: req.Wrstandardid}
 	a.DoGetDataEx(&m)
 }

+ 10 - 0
docs/docs.go

@@ -2580,6 +2580,12 @@ var doc = `{
                         "name": "userid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "现货商品ID",
+                        "name": "wrstandardid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -12354,6 +12360,10 @@ var doc = `{
         "models.ErmcpPendingAudit": {
             "type": "object",
             "properties": {
+                "areastockqty": {
+                    "description": "待审核数量: 库存申请",
+                    "type": "integer"
+                },
                 "businessdjqty": {
                     "description": "待审核数量: 点价",
                     "type": "integer"

+ 10 - 0
docs/swagger.json

@@ -2564,6 +2564,12 @@
                         "name": "userid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "现货商品ID",
+                        "name": "wrstandardid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -12338,6 +12344,10 @@
         "models.ErmcpPendingAudit": {
             "type": "object",
             "properties": {
+                "areastockqty": {
+                    "description": "待审核数量: 库存申请",
+                    "type": "integer"
+                },
                 "businessdjqty": {
                     "description": "待审核数量: 点价",
                     "type": "integer"

+ 7 - 0
docs/swagger.yaml

@@ -4031,6 +4031,9 @@ definitions:
     type: object
   models.ErmcpPendingAudit:
     properties:
+      areastockqty:
+        description: '待审核数量: 库存申请'
+        type: integer
       businessdjqty:
         description: '待审核数量: 点价'
         type: integer
@@ -11243,6 +11246,10 @@ paths:
         name: userid
         required: true
         type: integer
+      - description: 现货商品ID
+        in: query
+        name: wrstandardid
+        type: integer
       produces:
       - application/json
       responses:

+ 4 - 4
models/ermcp.go

@@ -249,7 +249,7 @@ func (r *ErmcpModel) buildSql(nContractType, nQueryType int32) string {
 		"       end) unsureqty," +
 		"       t.reckonedamount PayAmount," +
 		"       t.invoiceamount," +
-		"       (t.pricedamount + t.pricedqty * t.pricemove + t.RECKONADJUSTAMOUNT + t.RECKONOTHERAMOUNT -" +
+		"       (t.pricedamount + t.RECKONADJUSTAMOUNT + t.RECKONOTHERAMOUNT -" +
 		"       t.invoiceamount) as daikaiAmount," +
 		"       to_char(t.startdate, 'yyyy-mm-dd hh24:mi:ss') startdate," +
 		"       to_char(t.enddate, 'yyyy-mm-dd hh24:mi:ss') enddate," +
@@ -278,8 +278,8 @@ func (r *ErmcpModel) buildSql(nContractType, nQueryType int32) string {
 		"       gm.modelname," +
 		"       e.enumdicname," +
 		"       t.contracttype," +
-		"       t.pricedamount + t.pricedqty * t.pricemove as pricedamount," +
-		"       case when t.pricedqty > 0 then (t.pricedamount + t.pricedqty * t.pricemove)/t.pricedqty else 0 end pricedAvg," +
+		"       t.pricedamount," +
+		"       case when t.pricedqty > 0 then (t.pricedamount)/t.pricedqty else 0 end pricedAvg," +
 		"       t.ReckonRealQty," +
 		"       t.ReckonOtherAmount," +
 		"       t.ReckonAdjustAmount," +
@@ -287,7 +287,7 @@ func (r *ErmcpModel) buildSql(nContractType, nQueryType int32) string {
 		"       t.ReckonedAmount," +
 		"       to_char(t.audittime,'yyyy-mm-dd hh24:mi:ss') audittime," +
 		"       to_char(t.createtime,'yyyy-mm-dd hh24:mi:ss') createtime," +
-		"       t.pricedamount + t.pricedqty * t.pricemove + t.ReckonAdjustAmount as LoanAmount" +
+		"       t.pricedamount + t.ReckonAdjustAmount as LoanAmount" +
 		"  from ermcp_spotcontract t" +
 		"  left join useraccount u" +
 		"    on t.%v = u.userid" +

+ 9 - 5
models/ermcpAreaStock.go

@@ -131,10 +131,6 @@ func (r *ErmcpAreaStockApply) buildSql() string {
 		" WHERE 1 = 1"
 	// 用户id(必要条件)
 	sqlId.And("t.USERID", r.USERID)
-	// 出入库类型
-	if r.INOUTTYPE > 0 {
-		sqlId.And("t.INOUTTYPE", r.INOUTTYPE)
-	}
 	// 合同id
 	if len(r.SPOTCONTRACTID) > 0 {
 		sqlId.And("t.SPOTCONTRACTID", r.SPOTCONTRACTID)
@@ -159,11 +155,19 @@ func (r *ErmcpAreaStockApply) buildSql() string {
 	if len(r.BeginDate) > 0 {
 		if r.BeginDate == r.EndDate {
 			sqlId.And("t.audittradedate", r.BeginDate)
-		}else if r.EndDate > r.BeginDate {
+		} else if r.EndDate > r.BeginDate {
 			sqlId.BiggerOrEq("t.audittradedate", r.BeginDate)
 			sqlId.LessOrEq("t.audittradedate", r.EndDate)
 		}
 	}
+	// 出入库类型
+	if len(r.FilterType) > 0 {
+		if len(r.FilterType) == 1 {
+			sqlId.And("t.INOUTTYPE", r.FilterType)
+		} else {
+			sqlId.Join(fmt.Sprintf(" and t.INOUTTYPE in(%v)", r.FilterType))
+		}
+	}
 	// 出入库状态
 	if len(r.FilterStatus) > 0 {
 		sqlId.Join(fmt.Sprintf(" and t.APPLYSTATUS in(%v)", r.FilterStatus))

+ 6 - 0
models/ermcpBrandModel.go

@@ -43,6 +43,9 @@ func (r *ErmcpGoodsBrand) buildSql() string {
 		"  FROM SPOTGOODSBRAND t" +
 		" WHERE 1 = 1"
 	sqlId.And("t.AREAUSERID", r.AREAUSERID)
+	if r.WRSTANDARDID > 0 {
+		sqlId.And("t.WRSTANDARDID", r.WRSTANDARDID)
+	}
 	return sqlId.String()
 }
 
@@ -85,6 +88,9 @@ func (r *ErmcpGoodsModel) buildSql() string {
 		"  FROM SPOTGOODSMODEL t" +
 		" WHERE 1 = 1"
 	sqlId.And("t.AREAUSERID", r.AREAUSERID)
+	if r.WRSTANDARDID > 0 {
+		sqlId.And("t.WRSTANDARDID", r.WRSTANDARDID)
+	}
 	return sqlId.String()
 }
 

+ 7 - 2
models/ermcpPendingAuditInfo.go

@@ -20,6 +20,7 @@ type ErmcpPendingAudit struct {
 	BusinessJsQty   int64 `json:"businessjsqty"  xorm:"'BusinessJsQty'"`     // 待审核数量: 结算
 	BusinessKxQty   int64 `json:"businesskxqty"  xorm:"'BusinessKxQty'"`     // 待审核数量: 款项
 	BusinessFpQty   int64 `json:"businessfpqty"  xorm:"'BusinessFpQty'"`     // 待审核数量: 发票
+	AreaStockQty    int64 `json:"areastockqty"  xorm:"'AreaStockQty'"`       // 待审核数量: 库存申请
 
 	UserId int64 `json:"-"` // 所属用户id
 }
@@ -43,7 +44,9 @@ func (r *ErmcpPendingAudit) buildSql() string {
 		" union all " +
 		"select 6, count(1) BusinessKxQty from ermcp_contractoperateapply t where t.userid = %v and t.applystatus = 1 and t.operateapplytype=3" +
 		" union all " +
-		"select 7, count(1) BusinessFpQty from ermcp_contractoperateapply t where t.userid = %v and t.applystatus = 1 and t.operateapplytype=4"
+		"select 7, count(1) BusinessFpQty from ermcp_contractoperateapply t where t.userid = %v and t.applystatus = 1 and t.operateapplytype=4" +
+		" union all " +
+		"select 8, count(1) AreaStockQty from ermcp_areainoutstockapply t where t.ApplyStatus = 1"
 	sqlId = fmt.Sprintf(sqlId, r.UserId, r.UserId, r.UserId, r.UserId, r.UserId, r.UserId, r.UserId)
 	return sqlId
 }
@@ -69,9 +72,11 @@ func (r *ErmcpPendingAudit) GetDataEx() (interface{}, error) {
 			case 5:
 				v.BusinessJsQty = d.CntQty
 			case 6:
-				v.BusinessFpQty = d.CntQty
+				v.BusinessKxQty = d.CntQty
 			case 7:
 				v.BusinessFpQty = d.CntQty
+			case 8:
+				v.AreaStockQty = d.CntQty
 			}
 		}
 		rspData = append(rspData, v)