From 84efc2b9cc81fadfffe35c6e3a07dd735ef46a98 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期四, 28 九月 2023 11:25:11 +0800
Subject: [PATCH] 1.修改库存盘点列表bug
---
models/location_product_amount.go | 21 ++--
docs/swagger.yaml | 48 ++++++++++++
docs/docs.go | 77 +++++++++++++++++++
docs/swagger.json | 77 +++++++++++++++++++
controllers/location_product_amount.go | 13 +-
5 files changed, 220 insertions(+), 16 deletions(-)
diff --git a/controllers/location_product_amount.go b/controllers/location_product_amount.go
index 0e909f3..053979e 100644
--- a/controllers/location_product_amount.go
+++ b/controllers/location_product_amount.go
@@ -42,6 +42,7 @@
search.Orm = search.Orm.
Table("wms_location_product_amount").
Select(`
+ wms_location_product_amount.id as location_product_amount_id,
wms_location.id as location_id,
wms_location.name as location_name,
material.id as product_id,
@@ -52,12 +53,10 @@
wms_operation_details.amount as adjust_amount,
wms_operation.id as operation_id`).
InnerJoins("inner join wms_location_product on wms_location_product.id=wms_location_product_amount.location_product_id").
+ InnerJoins("inner join material on material.id=wms_location_product.product_id").
InnerJoins("inner join wms_location on wms_location.id=wms_location_product.location_id").
- InnerJoins("inner join wms_operation_details on wms_operation_details.product_id=wms_location_product.product_id").
- InnerJoins("inner join material on material.id=wms_operation_details.product_id").
- InnerJoins("inner join wms_operation on wms_operation.id=wms_operation_details.operation_id").
- Where("wms_operation.base_operation_type=?", constvar.BaseOperationTypeAdjust)
-
+ Joins("left join wms_operation_details on wms_operation_details.product_id=wms_location_product.product_id").
+ Joins("left join wms_operation on wms_operation.id=wms_operation_details.operation_id and wms_operation.base_operation_type=? and wms_operation.status=?", constvar.BaseOperationTypeAdjust, constvar.OperationStatus_Ready)
var (
records = make([]*models.LocationProductAmountWithOperation, 0)
total int64
@@ -76,7 +75,9 @@
return
}
for k, v := range records {
- records[k].DifferenceAmount = v.Amount.Sub(v.AdjustAmount)
+ if v.OperationId != 0 {
+ records[k].DifferenceAmount = v.Amount.Add(v.AdjustAmount)
+ }
}
util.ResponseFormatListWithPage(c, code.Success, records, int(total), params.Page, params.PageSize)
}
diff --git a/docs/docs.go b/docs/docs.go
index ce8cdb9..cf3da7a 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -780,6 +780,51 @@
}
}
},
+ "/api-wms/v1/locationProductAmount/getRuleList": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "搴撳瓨鐩樼偣"
+ ],
+ "summary": "鑾峰彇涓婃灦瑙勫垯",
+ "parameters": [
+ {
+ "description": "鏌ヨ淇℃伅",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.GetRuleList"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.ResponseList"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.RuleList"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/api-wms/v1/locationProductAmount/list": {
"post": {
"produces": [
@@ -3071,6 +3116,19 @@
}
}
},
+ "request.GetRuleList": {
+ "type": "object",
+ "properties": {
+ "locationId": {
+ "description": "浣嶇疆id",
+ "type": "integer"
+ },
+ "productId": {
+ "description": "浜у搧id",
+ "type": "string"
+ }
+ }
+ },
"request.OperationAllList": {
"type": "object",
"properties": {
@@ -3579,6 +3637,25 @@
}
}
},
+ "response.RuleList": {
+ "type": "object",
+ "properties": {
+ "locationList": {
+ "description": "浣嶇疆鍒楄〃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/models.Location"
+ }
+ },
+ "productList": {
+ "description": "浜у搧鍒楄〃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/models.Material"
+ }
+ }
+ }
+ },
"util.Response": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index a6dca38..ae21a86 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -768,6 +768,51 @@
}
}
},
+ "/api-wms/v1/locationProductAmount/getRuleList": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "搴撳瓨鐩樼偣"
+ ],
+ "summary": "鑾峰彇涓婃灦瑙勫垯",
+ "parameters": [
+ {
+ "description": "鏌ヨ淇℃伅",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.GetRuleList"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.ResponseList"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.RuleList"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/api-wms/v1/locationProductAmount/list": {
"post": {
"produces": [
@@ -3059,6 +3104,19 @@
}
}
},
+ "request.GetRuleList": {
+ "type": "object",
+ "properties": {
+ "locationId": {
+ "description": "浣嶇疆id",
+ "type": "integer"
+ },
+ "productId": {
+ "description": "浜у搧id",
+ "type": "string"
+ }
+ }
+ },
"request.OperationAllList": {
"type": "object",
"properties": {
@@ -3567,6 +3625,25 @@
}
}
},
+ "response.RuleList": {
+ "type": "object",
+ "properties": {
+ "locationList": {
+ "description": "浣嶇疆鍒楄〃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/models.Location"
+ }
+ },
+ "productList": {
+ "description": "浜у搧鍒楄〃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/models.Material"
+ }
+ }
+ }
+ },
"util.Response": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index fe5de96..cdfc43c 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -859,6 +859,15 @@
description: 姣忛〉澶у皬
type: integer
type: object
+ request.GetRuleList:
+ properties:
+ locationId:
+ description: 浣嶇疆id
+ type: integer
+ productId:
+ description: 浜у搧id
+ type: string
+ type: object
request.OperationAllList:
properties:
number:
@@ -1210,6 +1219,19 @@
value:
description: 鎬讳环鍊�
type: number
+ type: object
+ response.RuleList:
+ properties:
+ locationList:
+ description: 浣嶇疆鍒楄〃
+ items:
+ $ref: '#/definitions/models.Location'
+ type: array
+ productList:
+ description: 浜у搧鍒楄〃
+ items:
+ $ref: '#/definitions/models.Material'
+ type: array
type: object
util.Response:
properties:
@@ -1705,6 +1727,32 @@
summary: 搴旂敤銆侀獙璇�
tags:
- 搴撳瓨鐩樼偣
+ /api-wms/v1/locationProductAmount/getRuleList:
+ post:
+ parameters:
+ - description: 鏌ヨ淇℃伅
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.GetRuleList'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鎴愬姛
+ schema:
+ allOf:
+ - $ref: '#/definitions/util.ResponseList'
+ - properties:
+ data:
+ items:
+ $ref: '#/definitions/response.RuleList'
+ type: array
+ type: object
+ summary: 鑾峰彇涓婃灦瑙勫垯
+ tags:
+ - 搴撳瓨鐩樼偣
/api-wms/v1/locationProductAmount/list:
post:
parameters:
diff --git a/models/location_product_amount.go b/models/location_product_amount.go
index 1f77ec0..7ed5dea 100644
--- a/models/location_product_amount.go
+++ b/models/location_product_amount.go
@@ -29,16 +29,17 @@
LocationProductAmountWithOperation struct {
//LocationProductAmount LocationProductAmount `json:"locationProductAmount"`
- LocationId int `json:"locationId" gorm:"column:location_id"`
- LocationName string `json:"locationName" gorm:"column:location_name"`
- ProductId string `json:"productId" gorm:"column:product_id"`
- ProductName string `json:"productName" gorm:"column:product_name"`
- Amount decimal.Decimal `json:"amount" gorm:"column:amount"`
- Unit string `json:"unit" gorm:"column:unit"`
- CreateDate string `json:"createDate" gorm:"column:create_date"`
- AdjustAmount decimal.Decimal `json:"adjustAmount" gorm:"column:adjust_amount"`
- DifferenceAmount decimal.Decimal `json:"differenceAmount" gorm:"-"`
- OperationId int `json:"operationId" gorm:"column:operation_id"`
+ LocationProductAmountId int `json:"locationProductAmount" gorm:"location_product_amount_id"`
+ LocationId int `json:"locationId" gorm:"column:location_id"`
+ LocationName string `json:"locationName" gorm:"column:location_name"`
+ ProductId string `json:"productId" gorm:"column:product_id"`
+ ProductName string `json:"productName" gorm:"column:product_name"`
+ Amount decimal.Decimal `json:"amount" gorm:"column:amount"`
+ Unit string `json:"unit" gorm:"column:unit"`
+ CreateDate string `json:"createDate" gorm:"column:create_date"`
+ AdjustAmount decimal.Decimal `json:"adjustAmount" gorm:"column:adjust_amount"`
+ DifferenceAmount decimal.Decimal `json:"differenceAmount" gorm:"-"`
+ OperationId int `json:"operationId" gorm:"column:operation_id"`
}
)
--
Gitblit v1.8.0