From 9984c2c7cef1cca16055ae5d49d5ad275a7981ab Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 29 八月 2023 21:08:43 +0800
Subject: [PATCH] 按采购编号查询质检单列表
---
proto/quality_inspect.proto | 15
model/purchase/purchase.go | 59 ++-
model/purchase/request/purchase.go | 36 +-
api/v1/purchase/quality_inspection.go | 137 +++++++++
service/purchase/quality_inspect.go | 61 ++++
proto/qualityinspect/quality_inspect.pb.go | 233 +++++++++------
docs/swagger.yaml | 42 ++
docs/docs.go | 69 ++++
docs/swagger.json | 69 ++++
api/v1/purchase/purchase.go | 13
router/purchase/purchase.go | 8
utils/structx.go | 16 +
model/purchase/response/purchase.go | 22 +
service/purchase/purchase.go | 84 +++--
14 files changed, 671 insertions(+), 193 deletions(-)
diff --git a/api/v1/purchase/purchase.go b/api/v1/purchase/purchase.go
index 67aec20..0a5c918 100644
--- a/api/v1/purchase/purchase.go
+++ b/api/v1/purchase/purchase.go
@@ -3,7 +3,6 @@
import (
"fmt"
"github.com/gin-gonic/gin"
- "github.com/mitchellh/mapstructure"
"go.uber.org/zap"
"gorm.io/gorm"
"srm/global"
@@ -44,7 +43,7 @@
}
var purchaseRecord purchase.Purchase
- if err := mapstructure.Decode(params.Purchase, &purchaseRecord); err != nil {
+ if err := utils.AssignTo(params.Purchase, &purchaseRecord); err != nil {
global.GVA_LOG.Error("Add Purchase failed", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
@@ -75,7 +74,7 @@
return
}
global.GVA_LOG.Error("鍒涘缓澶辫触!", zap.Error(err))
- response.FailWithMessage("鍒涘缓澶辫触", c)
+ response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("鍒涘缓鎴愬姛", c)
@@ -123,7 +122,7 @@
}
var purchaseRecord purchase.Purchase
- if err := mapstructure.Decode(params.Purchase, &purchaseRecord); err != nil {
+ if err := utils.AssignTo(params.Purchase, &purchaseRecord); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
@@ -167,7 +166,7 @@
return
}
respProductList := make([]*purchaseRes.PurchaseProducts, len(productList))
- err = mapstructure.Decode(productList, &respProductList)
+ err = utils.AssignTo(productList, &respProductList)
if err != nil {
global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
response.FailWithMessage("鑾峰彇澶辫触", c)
@@ -177,7 +176,7 @@
respProductList[k].Amount = item.Amount
respProductList[k].Price = item.Price
respProductList[k].Total = item.Total
- err = mapstructure.Decode(item.Product, &respProductList[k])
+ err = utils.AssignTo(item.Product, &respProductList[k])
if err != nil {
global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
response.FailWithMessage("鑾峰彇澶辫触", c)
@@ -265,7 +264,7 @@
}
purchaseTypeList := make([]*purchase.PurchaseType, 0, len(params))
- if err := mapstructure.Decode(params, &purchaseTypeList); err != nil {
+ if err := utils.AssignTo(params, &purchaseTypeList); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
diff --git a/api/v1/purchase/quality_inspection.go b/api/v1/purchase/quality_inspection.go
new file mode 100644
index 0000000..803f593
--- /dev/null
+++ b/api/v1/purchase/quality_inspection.go
@@ -0,0 +1,137 @@
+package purchase
+
+import (
+ "context"
+ "github.com/gin-gonic/gin"
+ "go.uber.org/zap"
+ "srm/global"
+ "srm/model/common/request"
+ "srm/model/common/response"
+ "srm/model/purchase"
+ purchaseRes "srm/model/purchase/response"
+ "srm/proto/qualityinspect"
+ service "srm/service/purchase"
+ "srm/utils"
+)
+
+type QualityInspectApi struct{}
+
+// GetQualityInspectList
+// @Tags QualityInspect
+// @Summary 鍒嗛〉鑾峰彇璐ㄦ鍗曞垪琛�
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data query request.PageInfo true "椤电爜, 姣忛〉澶у皬"
+// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "鍒嗛〉鑾峰彇璐ㄦ鍗曞垪琛�,杩斿洖鍖呮嫭鍒楄〃,鎬绘暟,椤电爜,姣忛〉鏁伴噺"
+// @Router /purchase/qualityInspectList [get]
+func (e *QualityInspectApi) GetQualityInspectList(c *gin.Context) {
+ var pageInfo request.PageInfo
+ err := c.ShouldBindQuery(&pageInfo)
+ if err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ err = utils.Verify(pageInfo, utils.PageInfoVerify)
+ if err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ list, total, err := service.NewPurchaseService().GetPurchaseList(pageInfo)
+ purchaseList := list.([]*purchase.Purchase)
+ purchaseNumbers := make([]string, 0, len(purchaseList))
+ for _, item := range purchaseList {
+ purchaseNumbers = append(purchaseNumbers, item.Number)
+ }
+ resultList := make([]*purchaseRes.QualityInspectList, 0, len(purchaseList))
+ if len(purchaseList) == 0 {
+ err = utils.AssignTo(purchaseList, &resultList)
+ if err != nil {
+ global.GVA_LOG.Error("mapStructure decode", zap.Error(err))
+ response.FailWithMessage("鍐呴儴閿欒", c)
+ return
+ }
+
+ client := qualityinspect.NewQualityInspectServiceClient(qualityinspect.Conn)
+ inspectList, err := client.GetInspectList(context.Background(), &qualityinspect.GetInspectListRequest{
+ PurchaseOrderId: purchaseNumbers,
+ })
+ if err != nil {
+ global.GVA_LOG.Error("GetInspectList", zap.Error(err))
+ response.FailWithMessage("鍐呴儴閿欒", c)
+ return
+ }
+
+ inspectUnFinishedMap := make(map[string]bool, len(purchaseNumbers)) //榛樿瀹屾垚
+ for _, inspectItem := range inspectList.List {
+ if inspectItem.Status != qualityinspect.InspectStatus_InspectStatusInspectFinish {
+ inspectUnFinishedMap[inspectItem.PurchaseOrderId] = true
+ }
+ }
+
+ for _, result := range resultList {
+ if inspectUnFinishedMap[result.Number] {
+ result.InspectStatus = "寰呰川妫�"
+ } else {
+ result.InspectStatus = "宸插畬鎴�"
+ }
+ }
+ }
+
+ response.OkWithDetailed(response.PageResult{
+ List: resultList,
+ Total: total,
+ Page: pageInfo.Page,
+ PageSize: pageInfo.PageSize,
+ }, "鑾峰彇鎴愬姛", c)
+}
+
+//
+//// GetQualityInspect
+//// @Tags QualityInspect
+//// @Summary 鑾峰彇鍗曚竴璐ㄦ鍗曚俊鎭�
+//// @Security ApiKeyAuth
+//// @accept application/json
+//// @Produce application/json
+//// @Param id path int true "璐ㄦ鍗旾D" true "璐ㄦ鍗旾D"
+//// @Success 200 {object} response.Response{data=QualityInspectRes.QualityInspectResponse,msg=string} "鑾峰彇鍗曚竴璐ㄦ鍗曚俊鎭�,杩斿洖鍖呮嫭璐ㄦ鍗曡鎯�"
+//// @Router /purchase/qualityInspect/{id} [get]
+//func (e *QualityInspectApi) GetQualityInspect(c *gin.Context) {
+// id, _ := strconv.Atoi(c.Param("id"))
+// if id == 0 {
+// response.FailWithMessage("鍙傛暟缂哄け", c)
+// return
+// }
+// data, err := service.NewPurchaseService().GetPurchase(uint(id))
+// if err != nil {
+// global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
+// response.FailWithMessage("鑾峰彇澶辫触", c)
+// return
+// }
+// productList, err := service.NewPurchaseService().GetPurchaseProductList(uint(id))
+// if err != nil {
+// global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
+// response.FailWithMessage("鑾峰彇澶辫触", c)
+// return
+// }
+// respProductList := make([]*purchaseRes.PurchaseProducts, len(productList))
+// err = mapstructure.Decode(productList, &respProductList)
+// if err != nil {
+// global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
+// response.FailWithMessage("鑾峰彇澶辫触", c)
+// return
+// }
+// for k, item := range productList {
+// respProductList[k].Amount = item.Amount
+// respProductList[k].Price = item.Price
+// respProductList[k].Total = item.Total
+// err = mapstructure.Decode(item.Product, &respProductList[k])
+// if err != nil {
+// global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
+// response.FailWithMessage("鑾峰彇澶辫触", c)
+// return
+// }
+// }
+//
+// response.OkWithDetailed(purchaseRes.PurchaseResponse{Purchase: data, ProductList: respProductList}, "鑾峰彇鎴愬姛", c)
+//}
diff --git a/docs/docs.go b/docs/docs.go
index 42749da..9156122 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -4917,6 +4917,68 @@
}
}
},
+ "/purchase/qualityInspectList": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "QualityInspect"
+ ],
+ "summary": "鍒嗛〉鑾峰彇璐ㄦ鍗曞垪琛�",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "鍏抽敭瀛�",
+ "name": "keyword",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "椤电爜",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "姣忛〉澶у皬",
+ "name": "pageSize",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鍒嗛〉鑾峰彇璐ㄦ鍗曞垪琛�,杩斿洖鍖呮嫭鍒楄〃,鎬绘暟,椤电爜,姣忛〉鏁伴噺",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/response.PageResult"
+ },
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/purchase/submit/{id}": {
"post": {
"security": [
@@ -8496,6 +8558,10 @@
}
]
},
+ "principal": {
+ "description": "閲囪喘璐熻矗浜�",
+ "type": "string"
+ },
"purchaseType": {
"$ref": "#/definitions/purchase.PurchaseType"
},
@@ -8629,17 +8695,14 @@
"purchase.WholeDiscountType": {
"type": "integer",
"enum": [
- 0,
1,
2
],
"x-enum-comments": {
- "WholeDiscountTypeDefault": "鏃犳姌鎵�",
"WholeDiscountTypeDiscount": "鐩存帴闄嶄环",
"WholeDiscountTypePercent": "鐧惧垎姣旈檷浠�"
},
"x-enum-varnames": [
- "WholeDiscountTypeDefault",
"WholeDiscountTypePercent",
"WholeDiscountTypeDiscount"
]
diff --git a/docs/swagger.json b/docs/swagger.json
index 7710747..c0e042f 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -4908,6 +4908,68 @@
}
}
},
+ "/purchase/qualityInspectList": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "QualityInspect"
+ ],
+ "summary": "鍒嗛〉鑾峰彇璐ㄦ鍗曞垪琛�",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "鍏抽敭瀛�",
+ "name": "keyword",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "椤电爜",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "姣忛〉澶у皬",
+ "name": "pageSize",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鍒嗛〉鑾峰彇璐ㄦ鍗曞垪琛�,杩斿洖鍖呮嫭鍒楄〃,鎬绘暟,椤电爜,姣忛〉鏁伴噺",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/response.PageResult"
+ },
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/purchase/submit/{id}": {
"post": {
"security": [
@@ -8487,6 +8549,10 @@
}
]
},
+ "principal": {
+ "description": "閲囪喘璐熻矗浜�",
+ "type": "string"
+ },
"purchaseType": {
"$ref": "#/definitions/purchase.PurchaseType"
},
@@ -8620,17 +8686,14 @@
"purchase.WholeDiscountType": {
"type": "integer",
"enum": [
- 0,
1,
2
],
"x-enum-comments": {
- "WholeDiscountTypeDefault": "鏃犳姌鎵�",
"WholeDiscountTypeDiscount": "鐩存帴闄嶄环",
"WholeDiscountTypePercent": "鐧惧垎姣旈檷浠�"
},
"x-enum-varnames": [
- "WholeDiscountTypeDefault",
"WholeDiscountTypePercent",
"WholeDiscountTypeDiscount"
]
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 391b1de..2df7b38 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -753,6 +753,9 @@
allOf:
- $ref: '#/definitions/purchase.PriceAdjustmentType'
description: 浠锋牸璋冩暣绫诲瀷
+ principal:
+ description: 閲囪喘璐熻矗浜�
+ type: string
purchaseType:
$ref: '#/definitions/purchase.PurchaseType'
purchaseTypeId:
@@ -846,16 +849,13 @@
type: object
purchase.WholeDiscountType:
enum:
- - 0
- 1
- 2
type: integer
x-enum-comments:
- WholeDiscountTypeDefault: 鏃犳姌鎵�
WholeDiscountTypeDiscount: 鐩存帴闄嶄环
WholeDiscountTypePercent: 鐧惧垎姣旈檷浠�
x-enum-varnames:
- - WholeDiscountTypeDefault
- WholeDiscountTypePercent
- WholeDiscountTypeDiscount
purchaserequest.AddPurchase:
@@ -4841,6 +4841,42 @@
summary: 鑾峰彇閲囪喘绫诲瀷鍒楄〃
tags:
- Purchase
+ /purchase/qualityInspectList:
+ get:
+ consumes:
+ - application/json
+ parameters:
+ - description: 鍏抽敭瀛�
+ in: query
+ name: keyword
+ type: string
+ - description: 椤电爜
+ in: query
+ name: page
+ type: integer
+ - description: 姣忛〉澶у皬
+ in: query
+ name: pageSize
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鍒嗛〉鑾峰彇璐ㄦ鍗曞垪琛�,杩斿洖鍖呮嫭鍒楄〃,鎬绘暟,椤电爜,姣忛〉鏁伴噺
+ schema:
+ allOf:
+ - $ref: '#/definitions/response.Response'
+ - properties:
+ data:
+ $ref: '#/definitions/response.PageResult'
+ msg:
+ type: string
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: 鍒嗛〉鑾峰彇璐ㄦ鍗曞垪琛�
+ tags:
+ - QualityInspect
/purchase/submit/{id}:
post:
consumes:
diff --git a/model/purchase/purchase.go b/model/purchase/purchase.go
index 6f2f6c7..c690479 100644
--- a/model/purchase/purchase.go
+++ b/model/purchase/purchase.go
@@ -10,33 +10,33 @@
global.GVA_MODEL
PurchaseTypeId int `json:"purchaseTypeId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘绫诲瀷id
PurchaseType PurchaseType `json:"purchaseType" gorm:"foreignKey:PurchaseTypeId"`
- OrderSource string `json:"orderSource" gorm:"type:varchar(255);not null;default '';comment:鍗曟嵁鏉ユ簮"` // 鍗曟嵁鏉ユ簮
+ OrderSource string `json:"orderSource" gorm:"type:varchar(255);not null;default '';comment:鍗曟嵁鏉ユ簮"` // 鍗曟嵁鏉ユ簮
SupplierId int `json:"supplierId" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:渚涘簲鍟唅d"` // 渚涘簲鍟唅d
Supplier test.Supplier `json:"supplier" gorm:"foreignKey:SupplierId"`
- Number string `json:"number" form:"number" gorm:"unique;type:varchar(255);not null;default '';comment:閲囪喘缂栧彿"` // 閲囪喘缂栧彿
- Name string `json:"name" form:"name" gorm:"type:varchar(255);not null;default '';comment:閲囪喘鍚嶇О"` // 閲囪喘鍚嶇О
- Contact string `json:"contact" form:"contact" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜�"` // 鑱旂郴浜�
- Phone string `json:"phone" form:"phone" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜虹數璇�"` // 鑱旂郴浜虹數璇�
- SigningDate string `json:"signingDate" form:"signingDate" gorm:"type:varchar(255);not null;default '';comment:绛剧害鏃ユ湡"` // 绛剧害鏃ユ湡
- DeliveryDate string `json:"deliveryDate" form:"deliveryDate" gorm:"type:varchar(255);not null;default '';comment:浜や粯鏃ユ湡"` //浜や粯鏃ユ湡
- Remark string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null;default '';comment:澶囨敞"` //澶囨敞
- Status OrderStatus `json:"status" form:"status" gorm:"type:tinyint(1);not null;default 0;comment:鐘舵��"` //鐘舵��
- HandledBy string `json:"handledBy" form:"handledBy" gorm:"type:varchar(255);not null;default '';comment:缁忓姙浜�"` //缁忓姙浜�
- Creator string `json:"creator" form:"creator" gorm:"type:varchar(255);not null;default '';comment:鍒跺崟浜�"` //鍒跺崟浜�
- Principal string `json:"principal" form:"principal" gorm:"type:varchar(255);not null;default '';comment:閲囪喘璐熻矗浜�"` //閲囪喘璐熻矗浜�
- OrderType string `json:"orderType" form:"orderType" gorm:"type:varchar(255);not null;default '';comment:鍗曟嵁绫诲瀷"` //鍗曟嵁绫诲瀷
- Warehouse string `json:"warehouse" form:"warehouse" gorm:"type:varchar(255);not null;default '';comment:鏀惰揣浠撳簱"` //鏀惰揣浠撳簱
- Quantity decimal.Decimal `json:"quantity" form:"quantity" gorm:"type:decimal(12,4);not null;comment:閲囪喘鏁伴噺"` // 閲囪喘鏁伴噺
- TotalPrice decimal.Decimal `json:"totalPrice" form:"totalPrice" gorm:"type:decimal(12,2);not null;default '';comment:浠风◣鍚堣"` //浠风◣鍚堣
- WholeDiscountType WholeDiscountType `json:"wholeDiscountType" form:"wholeDiscountType" gorm:"type:decimal(12,2);not null;default '';comment:鏁村崟鎶樻墸"` //鏁村崟鎶樻墸绫诲瀷
- WholeDiscount decimal.Decimal `json:"wholeDiscount" form:"wholeDiscount" gorm:"type:decimal(12,2);not null;default '';comment:鏁村崟鎶樻墸"` //鏁村崟鎶樻墸鍊�
- PriceAdjustmentType PriceAdjustmentType `json:"priceAdjustmentType" form:"priceAdjustmentType" gorm:"type:decimal(12,2);not null;default '';comment:浠锋牸璋冩暣"` //浠锋牸璋冩暣绫诲瀷
- PriceAdjustment decimal.Decimal `json:"priceAdjustment" form:"priceAdjustment" gorm:"type:decimal(12,2);not null;default '';comment:浠锋牸璋冩暣"` //浠锋牸璋冩暣鍊�
- RealTotalPrice decimal.Decimal `json:"realTotalPrice" form:"realTotalPrice" gorm:"type:decimal(12,2);not null;default '';comment:鏈�缁堜环鏍�"` //鏈�缁堜环鏍�
- InvoiceAmount decimal.Decimal `json:"invoiceAmount" form:"invoiceAmount" gorm:"type:decimal(12,2);not null;default '';comment:宸叉敹绁ㄩ噾棰�"` //宸叉敹绁ㄩ噾棰�
- UnInvoiceAmount decimal.Decimal `json:"unInvoiceAmount" form:"unInvoiceAmount" gorm:"type:decimal(12,2);not null;default '';comment:鏈敹绁ㄩ噾棰�"` //鏈敹绁ㄩ噾棰�
- ShouldPayAmount decimal.Decimal `json:"shouldPayAmount" form:"shouldPayAmount" gorm:"type:decimal(12,2);not null;default '';comment:搴斾粯閲戦"` //搴斾粯閲戦
- PaidAmount decimal.Decimal `json:"paidAmount" form:"paidAmount" gorm:"type:decimal(12,2);not null;default '';comment:宸蹭粯閲戦"` //宸蹭粯閲戦
+ Number string `json:"number" form:"number" gorm:"unique;type:varchar(255);not null;default '';comment:閲囪喘缂栧彿"` // 閲囪喘缂栧彿
+ Name string `json:"name" form:"name" gorm:"type:varchar(255);not null;default '';comment:閲囪喘鍚嶇О"` // 閲囪喘鍚嶇О
+ Contact string `json:"contact" form:"contact" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜�"` // 鑱旂郴浜�
+ Phone string `json:"phone" form:"phone" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜虹數璇�"` // 鑱旂郴浜虹數璇�
+ SigningDate string `json:"signingDate" form:"signingDate" gorm:"type:varchar(255);not null;default '';comment:绛剧害鏃ユ湡"` // 绛剧害鏃ユ湡
+ DeliveryDate string `json:"deliveryDate" form:"deliveryDate" gorm:"type:varchar(255);not null;default '';comment:浜や粯鏃ユ湡"` //浜や粯鏃ユ湡
+ Remark string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null;default '';comment:澶囨敞"` //澶囨敞
+ Status OrderStatus `json:"status" form:"status" gorm:"type:tinyint(1);not null;default 0;comment:鐘舵��"` //鐘舵��
+ HandledBy string `json:"handledBy" form:"handledBy" gorm:"type:varchar(255);not null;default '';comment:缁忓姙浜�"` //缁忓姙浜�
+ Creator string `json:"creator" form:"creator" gorm:"type:varchar(255);not null;default '';comment:鍒跺崟浜�"` //鍒跺崟浜�
+ Principal string `json:"principal" form:"principal" gorm:"type:varchar(255);not null;default '';comment:閲囪喘璐熻矗浜�"` //閲囪喘璐熻矗浜�
+ OrderType string `json:"orderType" form:"orderType" gorm:"type:varchar(255);not null;default '';comment:鍗曟嵁绫诲瀷"` //鍗曟嵁绫诲瀷
+ Warehouse string `json:"warehouse" form:"warehouse" gorm:"type:varchar(255);not null;default '';comment:鏀惰揣浠撳簱"` //鏀惰揣浠撳簱
+ Quantity decimal.Decimal `json:"quantity" form:"quantity" gorm:"type:decimal(12,4);not null;comment:閲囪喘鏁伴噺"` // 閲囪喘鏁伴噺
+ TotalPrice decimal.Decimal `json:"totalPrice" form:"totalPrice" gorm:"type:decimal(12,2);not null;default '';comment:浠风◣鍚堣"` //浠风◣鍚堣
+ WholeDiscountType WholeDiscountType `json:"wholeDiscountType" form:"wholeDiscountType" gorm:"type:tinyint(1);not null;default '';comment:鏁村崟鎶樻墸"` //鏁村崟鎶樻墸绫诲瀷
+ WholeDiscount decimal.Decimal `json:"wholeDiscount" form:"wholeDiscount" gorm:"type:decimal(12,2);not null;default '';comment:鏁村崟鎶樻墸"` //鏁村崟鎶樻墸鍊�
+ PriceAdjustmentType PriceAdjustmentType `json:"priceAdjustmentType" form:"priceAdjustmentType" gorm:"type:tinyint(1);not null;default '';comment:浠锋牸璋冩暣"` //浠锋牸璋冩暣绫诲瀷
+ PriceAdjustment decimal.Decimal `json:"priceAdjustment" form:"priceAdjustment" gorm:"type:decimal(12,2);not null;default '';comment:浠锋牸璋冩暣"` //浠锋牸璋冩暣鍊�
+ RealTotalPrice decimal.Decimal `json:"realTotalPrice" form:"realTotalPrice" gorm:"type:decimal(12,2);not null;default '';comment:鏈�缁堜环鏍�"` //鏈�缁堜环鏍�
+ InvoiceAmount decimal.Decimal `json:"invoiceAmount" form:"invoiceAmount" gorm:"type:decimal(12,2);not null;default '';comment:宸叉敹绁ㄩ噾棰�"` //宸叉敹绁ㄩ噾棰�
+ UnInvoiceAmount decimal.Decimal `json:"unInvoiceAmount" form:"unInvoiceAmount" gorm:"type:decimal(12,2);not null;default '';comment:鏈敹绁ㄩ噾棰�"` //鏈敹绁ㄩ噾棰�
+ ShouldPayAmount decimal.Decimal `json:"shouldPayAmount" form:"shouldPayAmount" gorm:"type:decimal(12,2);not null;default '';comment:搴斾粯閲戦"` //搴斾粯閲戦
+ PaidAmount decimal.Decimal `json:"paidAmount" form:"paidAmount" gorm:"type:decimal(12,2);not null;default '';comment:宸蹭粯閲戦"` //宸蹭粯閲戦
}
type OrderStatus int
@@ -51,13 +51,15 @@
type WholeDiscountType int
const (
- WholeDiscountTypeDefault WholeDiscountType = 0 //鏃犳姌鎵�
WholeDiscountTypePercent WholeDiscountType = 1 //鐧惧垎姣旈檷浠�
WholeDiscountTypeDiscount WholeDiscountType = 2 //鐩存帴闄嶄环
)
func (wdt WholeDiscountType) IsValid(totalPrice, value decimal.Decimal) bool {
- if wdt != WholeDiscountTypePercent && wdt != WholeDiscountTypeDiscount && wdt != WholeDiscountTypeDefault {
+ if wdt == 0 {
+ return true
+ }
+ if wdt != WholeDiscountTypePercent && wdt != WholeDiscountTypeDiscount {
return false
}
if wdt == WholeDiscountTypeDiscount && value.GreaterThan(totalPrice) {
@@ -77,6 +79,9 @@
)
func (pat PriceAdjustmentType) IsValid(totalPrice, value decimal.Decimal) bool {
+ if pat == 0 {
+ return true
+ }
if pat != PriceAdjustmentTypeAdd && pat != PriceAdjustmentTypeSub {
return false
}
diff --git a/model/purchase/request/purchase.go b/model/purchase/request/purchase.go
index 19fe8c0..6bcea8b 100644
--- a/model/purchase/request/purchase.go
+++ b/model/purchase/request/purchase.go
@@ -24,22 +24,22 @@
}
type Purchase struct {
- ID uint `gorm:"primarykey"` // 涓婚敭ID
- PurchaseTypeId int `json:"purchaseTypeId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘绫诲瀷id
- SupplierId int `json:"supplierId" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:渚涘簲鍟唅d"` // 渚涘簲鍟唅d
- Number string `json:"number" form:"number" gorm:"unique;type:varchar(255);not null;default '';comment:閲囪喘缂栧彿"` // 閲囪喘缂栧彿
- Name string `json:"name" form:"name" gorm:"type:varchar(255);not null;default '';comment:閲囪喘鍚嶇О"` // 閲囪喘鍚嶇О
- Contact string `json:"contact" form:"contact" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜�"` // 鑱旂郴浜�
- Phone string `json:"phone" form:"phone" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜虹數璇�"` // 鑱旂郴浜虹數璇�
- SigningDate string `json:"signingDate" form:"signingDate" gorm:"type:varchar(255);not null;default '';comment:绛剧害鏃ユ湡"` // 绛剧害鏃ユ湡
- DeliveryDate string `json:"deliveryDate" form:"deliveryDate" gorm:"type:varchar(255);not null;default '';comment:浜や粯鏃ユ湡"` //浜や粯鏃ユ湡
- Remark string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null;default '';comment:澶囨敞"` //澶囨敞
- Status purchase.OrderStatus `json:"status" form:"status" gorm:"type:tinyint(1);not null;default 0;comment:鐘舵��"` //鐘舵��
- Quantity decimal.Decimal `json:"quantity" form:"quantity" gorm:"type:decimal(12,4);not null;comment:閲囪喘鏁伴噺"` // 閲囪喘鏁伴噺
- TotalPrice decimal.Decimal `json:"totalPrice" form:"totalPrice" gorm:"type:decimal(12,2);not null;default '';comment:浠风◣鍚堣"` //浠风◣鍚堣
- WholeDiscountType purchase.WholeDiscountType `json:"wholeDiscountType" form:"wholeDiscountType" gorm:"type:decimal(12,2);not null;default '';comment:鏁村崟鎶樻墸"` //鏁村崟鎶樻墸绫诲瀷
- WholeDiscount decimal.Decimal `json:"wholeDiscount" form:"wholeDiscount" gorm:"type:decimal(12,2);not null;default '';comment:鏁村崟鎶樻墸"` //鏁村崟鎶樻墸鍊�
- PriceAdjustmentType purchase.PriceAdjustmentType `json:"priceAdjustmentType" form:"priceAdjustmentType" gorm:"type:decimal(12,2);not null;default '';comment:浠锋牸璋冩暣"` //浠锋牸璋冩暣绫诲瀷
- PriceAdjustment decimal.Decimal `json:"priceAdjustment" form:"priceAdjustment" gorm:"type:decimal(12,2);not null;default '';comment:浠锋牸璋冩暣"` //浠锋牸璋冩暣鍊�
- RealTotalPrice decimal.Decimal `json:"realTotalPrice" form:"realTotalPrice" gorm:"type:decimal(12,2);not null;default '';comment:鏈�缁堜环鏍�"` //鏈�缁堜环鏍�
+ ID uint `gorm:"primarykey"` // 涓婚敭ID
+ PurchaseTypeId int `json:"purchaseTypeId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘绫诲瀷id
+ SupplierId int `json:"supplierId" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:渚涘簲鍟唅d"` // 渚涘簲鍟唅d
+ Number string `json:"number" form:"number" gorm:"unique;type:varchar(255);not null;default '';comment:閲囪喘缂栧彿"` // 閲囪喘缂栧彿
+ Name string `json:"name" form:"name" gorm:"type:varchar(255);not null;default '';comment:閲囪喘鍚嶇О"` // 閲囪喘鍚嶇О
+ Contact string `json:"contact" form:"contact" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜�"` // 鑱旂郴浜�
+ Phone string `json:"phone" form:"phone" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜虹數璇�"` // 鑱旂郴浜虹數璇�
+ SigningDate string `json:"signingDate" form:"signingDate" gorm:"type:varchar(255);not null;default '';comment:绛剧害鏃ユ湡"` // 绛剧害鏃ユ湡
+ DeliveryDate string `json:"deliveryDate" form:"deliveryDate" gorm:"type:varchar(255);not null;default '';comment:浜や粯鏃ユ湡"` //浜や粯鏃ユ湡
+ Remark string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null;default '';comment:澶囨敞"` //澶囨敞
+ Status purchase.OrderStatus `json:"status" form:"status" gorm:"type:tinyint(1);not null;default 0;comment:鐘舵��"` //鐘舵��
+ Quantity decimal.Decimal `json:"quantity" form:"quantity" gorm:"type:decimal(12,2);not null;default 0;comment:閲囪喘鏁伴噺"` // 閲囪喘鏁伴噺
+ TotalPrice decimal.Decimal `json:"totalPrice" form:"totalPrice" gorm:"type:decimal(12,2);not null;default 0.00;comment:浠风◣鍚堣"` //浠风◣鍚堣
+ WholeDiscountType purchase.WholeDiscountType `json:"wholeDiscountType" form:"wholeDiscountType" gorm:"type:decimal(12,2);not null;default 0.00;comment:鏁村崟鎶樻墸"` //鏁村崟鎶樻墸绫诲瀷
+ WholeDiscount decimal.Decimal `json:"wholeDiscount" form:"wholeDiscount" gorm:"type:decimal(12,2);not null;default 0;comment:鏁村崟鎶樻墸"` //鏁村崟鎶樻墸鍊�
+ PriceAdjustmentType purchase.PriceAdjustmentType `json:"priceAdjustmentType" form:"priceAdjustmentType" gorm:"type:decimal(12,2);not null;default 0;comment:浠锋牸璋冩暣绫诲瀷"` //浠锋牸璋冩暣绫诲瀷
+ PriceAdjustment decimal.Decimal `json:"priceAdjustment" form:"priceAdjustment" gorm:"type:decimal(12,2);not null;default 0.00;comment:浠锋牸璋冩暣"` //浠锋牸璋冩暣鍊�
+ RealTotalPrice decimal.Decimal `json:"realTotalPrice" form:"realTotalPrice" gorm:"type:decimal(12,2);not null;default 0.00;comment:鏈�缁堜环鏍�"` //鏈�缁堜环鏍�
}
diff --git a/model/purchase/response/purchase.go b/model/purchase/response/purchase.go
index 2588e67..043729b 100644
--- a/model/purchase/response/purchase.go
+++ b/model/purchase/response/purchase.go
@@ -3,6 +3,7 @@
import (
"github.com/shopspring/decimal"
"srm/model/purchase"
+ "srm/model/test"
)
type PurchaseResponse struct {
@@ -26,3 +27,24 @@
ModelNumber string `json:"modelNumber" form:"modelNumber" gorm:"column:model_number;comment:鍨嬪彿;size:255;"`
ProductType string `json:"productType" form:"productType" gorm:"column:product_type;comment:浜у搧绫诲埆;size:255;"`
}
+
+type QualityInspectList struct {
+ PurchaseTypeId int `json:"purchaseTypeId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘绫诲瀷id
+ OrderSource string `json:"orderSource" gorm:"type:varchar(255);not null;default '';comment:鍗曟嵁鏉ユ簮"` // 鍗曟嵁鏉ユ簮
+ SupplierId int `json:"supplierId" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:渚涘簲鍟唅d"` // 渚涘簲鍟唅d
+ Supplier test.Supplier `json:"supplier" gorm:"foreignKey:SupplierId"`
+ Number string `json:"number" form:"number" gorm:"unique;type:varchar(255);not null;default '';comment:閲囪喘缂栧彿"` // 閲囪喘缂栧彿
+ Name string `json:"name" form:"name" gorm:"type:varchar(255);not null;default '';comment:閲囪喘鍚嶇О"` // 閲囪喘鍚嶇О
+ Contact string `json:"contact" form:"contact" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜�"` // 鑱旂郴浜�
+ Phone string `json:"phone" form:"phone" gorm:"type:varchar(255);not null;default '';comment:鑱旂郴浜虹數璇�"` // 鑱旂郴浜虹數璇�
+ SigningDate string `json:"signingDate" form:"signingDate" gorm:"type:varchar(255);not null;default '';comment:绛剧害鏃ユ湡"` // 绛剧害鏃ユ湡
+ DeliveryDate string `json:"deliveryDate" form:"deliveryDate" gorm:"type:varchar(255);not null;default '';comment:浜や粯鏃ユ湡"` //浜や粯鏃ユ湡
+ Remark string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null;default '';comment:澶囨敞"` //澶囨敞
+ HandledBy string `json:"handledBy" form:"handledBy" gorm:"type:varchar(255);not null;default '';comment:缁忓姙浜�"` //缁忓姙浜�
+ Creator string `json:"creator" form:"creator" gorm:"type:varchar(255);not null;default '';comment:鍒跺崟浜�"` //鍒跺崟浜�
+ Principal string `json:"principal" form:"principal" gorm:"type:varchar(255);not null;default '';comment:閲囪喘璐熻矗浜�"` //閲囪喘璐熻矗浜�
+ OrderType string `json:"orderType" form:"orderType" gorm:"type:varchar(255);not null;default '';comment:鍗曟嵁绫诲瀷"` //鍗曟嵁绫诲瀷
+ Warehouse string `json:"warehouse" form:"warehouse" gorm:"type:varchar(255);not null;default '';comment:鏀惰揣浠撳簱"` //鏀惰揣浠撳簱
+ Quantity decimal.Decimal `json:"quantity" form:"quantity" gorm:"type:decimal(12,4);not null;comment:閲囪喘鏁伴噺"` // 閲囪喘鏁伴噺
+ InspectStatus string `json:"inspectStatus" form:"inspectStatus"` //妫�娴嬬粨鏋�
+}
diff --git a/proto/quality_inspect.proto b/proto/quality_inspect.proto
index 3d8c695..9eb6165 100644
--- a/proto/quality_inspect.proto
+++ b/proto/quality_inspect.proto
@@ -26,7 +26,7 @@
double report_amount = 13; // 鎶ユ鏁伴噺
InspectMethod inspect_method = 14; // 妫�楠屾柟寮�
double inspect_amount = 15; // 妫�楠屾暟閲�
- int32 status = 16; // 鐘舵��
+ InspectStatus status = 16; // 鐘舵��
string submit_id = 17; // 鎻愪氦浜篒D
double reject_amount = 18; // 閫�璐ф暟閲�
double exchange_amount = 19; // 鎹㈣揣鏁伴噺
@@ -60,6 +60,15 @@
}
+// InspectStatus 妫�楠岀姸鎬�
+enum InspectStatus {
+ InspectStatusNull = 0;
+ InspectStatusWaitInspect = 1; // 寰呮鏌�
+ InspectStatusAuditing = 2; // 瀹℃牳涓�
+ InspectStatusAuditFinish = 3; // 瀹℃牳瀹屾垚
+ InspectStatusInspectFinish = 4; // 妫�鏌ュ畬鎴�
+}
+
message SendPurchaseInspectResponse {
int32 Code = 1;
@@ -68,9 +77,7 @@
message GetInspectListRequest{
- int32 page = 1;
- int32 pageSize = 2;
- string keyword = 3;
+ repeated string purchase_order_id = 1;
}
message GetInspectListResponse{
diff --git a/proto/qualityinspect/quality_inspect.pb.go b/proto/qualityinspect/quality_inspect.pb.go
index 7d05402..e1f671b 100644
--- a/proto/qualityinspect/quality_inspect.pb.go
+++ b/proto/qualityinspect/quality_inspect.pb.go
@@ -176,6 +176,62 @@
return file_quality_inspect_proto_rawDescGZIP(), []int{2}
}
+// InspectStatus 妫�楠岀姸鎬�
+type InspectStatus int32
+
+const (
+ InspectStatus_InspectStatusNull InspectStatus = 0
+ InspectStatus_InspectStatusWaitInspect InspectStatus = 1 // 寰呮鏌�
+ InspectStatus_InspectStatusAuditing InspectStatus = 2 // 瀹℃牳涓�
+ InspectStatus_InspectStatusAuditFinish InspectStatus = 3 // 瀹℃牳瀹屾垚
+ InspectStatus_InspectStatusInspectFinish InspectStatus = 4 // 妫�鏌ュ畬鎴�
+)
+
+// Enum value maps for InspectStatus.
+var (
+ InspectStatus_name = map[int32]string{
+ 0: "InspectStatusNull",
+ 1: "InspectStatusWaitInspect",
+ 2: "InspectStatusAuditing",
+ 3: "InspectStatusAuditFinish",
+ 4: "InspectStatusInspectFinish",
+ }
+ InspectStatus_value = map[string]int32{
+ "InspectStatusNull": 0,
+ "InspectStatusWaitInspect": 1,
+ "InspectStatusAuditing": 2,
+ "InspectStatusAuditFinish": 3,
+ "InspectStatusInspectFinish": 4,
+ }
+)
+
+func (x InspectStatus) Enum() *InspectStatus {
+ p := new(InspectStatus)
+ *p = x
+ return p
+}
+
+func (x InspectStatus) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (InspectStatus) Descriptor() protoreflect.EnumDescriptor {
+ return file_quality_inspect_proto_enumTypes[3].Descriptor()
+}
+
+func (InspectStatus) Type() protoreflect.EnumType {
+ return &file_quality_inspect_proto_enumTypes[3]
+}
+
+func (x InspectStatus) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use InspectStatus.Descriptor instead.
+func (InspectStatus) EnumDescriptor() ([]byte, []int) {
+ return file_quality_inspect_proto_rawDescGZIP(), []int{3}
+}
+
type SendPurchaseInspectRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -243,7 +299,7 @@
ReportAmount float64 `protobuf:"fixed64,13,opt,name=report_amount,json=reportAmount,proto3" json:"report_amount,omitempty"` // 鎶ユ鏁伴噺
InspectMethod InspectMethod `protobuf:"varint,14,opt,name=inspect_method,json=inspectMethod,proto3,enum=InspectMethod" json:"inspect_method,omitempty"` // 妫�楠屾柟寮�
InspectAmount float64 `protobuf:"fixed64,15,opt,name=inspect_amount,json=inspectAmount,proto3" json:"inspect_amount,omitempty"` // 妫�楠屾暟閲�
- Status int32 `protobuf:"varint,16,opt,name=status,proto3" json:"status,omitempty"` // 鐘舵��
+ Status InspectStatus `protobuf:"varint,16,opt,name=status,proto3,enum=InspectStatus" json:"status,omitempty"` // 鐘舵��
SubmitId string `protobuf:"bytes,17,opt,name=submit_id,json=submitId,proto3" json:"submit_id,omitempty"` // 鎻愪氦浜篒D
RejectAmount float64 `protobuf:"fixed64,18,opt,name=reject_amount,json=rejectAmount,proto3" json:"reject_amount,omitempty"` // 閫�璐ф暟閲�
ExchangeAmount float64 `protobuf:"fixed64,19,opt,name=exchange_amount,json=exchangeAmount,proto3" json:"exchange_amount,omitempty"` // 鎹㈣揣鏁伴噺
@@ -389,11 +445,11 @@
return 0
}
-func (x *QualityInspect) GetStatus() int32 {
+func (x *QualityInspect) GetStatus() InspectStatus {
if x != nil {
return x.Status
}
- return 0
+ return InspectStatus_InspectStatusNull
}
func (x *QualityInspect) GetSubmitId() string {
@@ -498,9 +554,7 @@
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
- PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
- Keyword string `protobuf:"bytes,3,opt,name=keyword,proto3" json:"keyword,omitempty"`
+ PurchaseOrderId []string `protobuf:"bytes,1,rep,name=purchase_order_id,json=purchaseOrderId,proto3" json:"purchase_order_id,omitempty"`
}
func (x *GetInspectListRequest) Reset() {
@@ -535,25 +589,11 @@
return file_quality_inspect_proto_rawDescGZIP(), []int{3}
}
-func (x *GetInspectListRequest) GetPage() int32 {
+func (x *GetInspectListRequest) GetPurchaseOrderId() []string {
if x != nil {
- return x.Page
+ return x.PurchaseOrderId
}
- return 0
-}
-
-func (x *GetInspectListRequest) GetPageSize() int32 {
- if x != nil {
- return x.PageSize
- }
- return 0
-}
-
-func (x *GetInspectListRequest) GetKeyword() string {
- if x != nil {
- return x.Keyword
- }
- return ""
+ return nil
}
type GetInspectListResponse struct {
@@ -635,7 +675,7 @@
0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x73,
- 0x70, 0x65, 0x63, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0xbe, 0x06, 0x0a, 0x0e, 0x51,
+ 0x70, 0x65, 0x63, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0xce, 0x06, 0x0a, 0x0e, 0x51,
0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2f, 0x0a,
0x0c, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20,
@@ -672,7 +712,8 @@
0x65, 0x63, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x73,
0x70, 0x65, 0x63, 0x74, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28,
0x01, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
- 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05,
+ 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0e,
+ 0x32, 0x0e, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6d,
0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, 0x62,
0x6d, 0x69, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x5f,
@@ -692,54 +733,62 @@
0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f,
0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10,
0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67,
- 0x22, 0x61, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4c, 0x69,
- 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67,
- 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a,
- 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
- 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6b, 0x65, 0x79,
- 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x77,
- 0x6f, 0x72, 0x64, 0x22, 0x79, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63,
- 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a,
- 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64,
- 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
- 0x4d, 0x73, 0x67, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28,
- 0x0b, 0x32, 0x0f, 0x2e, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x73, 0x70, 0x65,
- 0x63, 0x74, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x74, 0x61,
- 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x86,
- 0x01, 0x0a, 0x0b, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16,
- 0x0a, 0x12, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74,
- 0x54, 0x79, 0x70, 0x65, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63,
- 0x74, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x10, 0x01, 0x12, 0x17, 0x0a,
- 0x13, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x50, 0x75, 0x72, 0x63,
- 0x68, 0x61, 0x73, 0x65, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63,
- 0x74, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0x03,
- 0x12, 0x15, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52,
- 0x65, 0x6a, 0x65, 0x63, 0x74, 0x10, 0x04, 0x2a, 0x6c, 0x0a, 0x0c, 0x4d, 0x61, 0x74, 0x65, 0x72,
- 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x66, 0x61, 0x75,
- 0x6c, 0x74, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x10, 0x00,
- 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65,
- 0x52, 0x61, 0x77, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61,
- 0x6c, 0x54, 0x79, 0x70, 0x65, 0x53, 0x65, 0x6d, 0x69, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x4d,
- 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73,
- 0x68, 0x65, 0x64, 0x10, 0x03, 0x2a, 0x56, 0x0a, 0x0d, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74,
- 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c,
- 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x10, 0x00,
- 0x12, 0x14, 0x0a, 0x10, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f,
- 0x64, 0x41, 0x6c, 0x6c, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63,
- 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x53, 0x70, 0x6f, 0x74, 0x10, 0x02, 0x32, 0xb0, 0x01,
- 0x0a, 0x15, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74,
- 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x50,
- 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x12, 0x1b,
- 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x73,
- 0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x53, 0x65,
- 0x6e, 0x64, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63,
- 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x47,
- 0x65, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e,
- 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
- 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65,
- 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
- 0x42, 0x12, 0x5a, 0x10, 0x2e, 0x2f, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x69, 0x6e, 0x73,
- 0x70, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x22, 0x43, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4c, 0x69,
+ 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x75, 0x72,
+ 0x63, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4f, 0x72,
+ 0x64, 0x65, 0x72, 0x49, 0x64, 0x22, 0x79, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x70,
+ 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43,
+ 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x73,
+ 0x70, 0x65, 0x63, 0x74, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f,
+ 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c,
+ 0x2a, 0x86, 0x01, 0x0a, 0x0b, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65,
+ 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65,
+ 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x70,
+ 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x10, 0x01, 0x12,
+ 0x17, 0x0a, 0x13, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x50, 0x75,
+ 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x49, 0x6e, 0x73, 0x70,
+ 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+ 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70,
+ 0x65, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x10, 0x04, 0x2a, 0x6c, 0x0a, 0x0c, 0x4d, 0x61, 0x74,
+ 0x65, 0x72, 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x66,
+ 0x61, 0x75, 0x6c, 0x74, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65,
+ 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x54, 0x79,
+ 0x70, 0x65, 0x52, 0x61, 0x77, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x61, 0x74, 0x65, 0x72,
+ 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x53, 0x65, 0x6d, 0x69, 0x10, 0x02, 0x12, 0x18, 0x0a,
+ 0x14, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x46, 0x69, 0x6e,
+ 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0x03, 0x2a, 0x56, 0x0a, 0x0d, 0x49, 0x6e, 0x73, 0x70, 0x65,
+ 0x63, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x65, 0x66, 0x61,
+ 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64,
+ 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4d, 0x65, 0x74,
+ 0x68, 0x6f, 0x64, 0x41, 0x6c, 0x6c, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x70,
+ 0x65, 0x63, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x53, 0x70, 0x6f, 0x74, 0x10, 0x02, 0x2a,
+ 0x9d, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75,
+ 0x73, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x53, 0x74, 0x61, 0x74,
+ 0x75, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x49, 0x6e, 0x73, 0x70,
+ 0x65, 0x63, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x57, 0x61, 0x69, 0x74, 0x49, 0x6e, 0x73,
+ 0x70, 0x65, 0x63, 0x74, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63,
+ 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x10,
+ 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x53, 0x74, 0x61, 0x74,
+ 0x75, 0x73, 0x41, 0x75, 0x64, 0x69, 0x74, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0x03, 0x12,
+ 0x1e, 0x0a, 0x1a, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
+ 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0x04, 0x32,
+ 0xb0, 0x01, 0x0a, 0x15, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x73, 0x70, 0x65,
+ 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x13, 0x53, 0x65, 0x6e,
+ 0x64, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74,
+ 0x12, 0x1b, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49,
+ 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e,
+ 0x53, 0x65, 0x6e, 0x64, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x73, 0x70,
+ 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a,
+ 0x0e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12,
+ 0x16, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73,
+ 0x70, 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x22, 0x00, 0x42, 0x12, 0x5a, 0x10, 0x2e, 0x2f, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x69,
+ 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -754,33 +803,35 @@
return file_quality_inspect_proto_rawDescData
}
-var file_quality_inspect_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
+var file_quality_inspect_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
var file_quality_inspect_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_quality_inspect_proto_goTypes = []interface{}{
(InspectType)(0), // 0: InspectType
(MaterialType)(0), // 1: MaterialType
(InspectMethod)(0), // 2: InspectMethod
- (*SendPurchaseInspectRequest)(nil), // 3: SendPurchaseInspectRequest
- (*QualityInspect)(nil), // 4: QualityInspect
- (*SendPurchaseInspectResponse)(nil), // 5: SendPurchaseInspectResponse
- (*GetInspectListRequest)(nil), // 6: GetInspectListRequest
- (*GetInspectListResponse)(nil), // 7: GetInspectListResponse
+ (InspectStatus)(0), // 3: InspectStatus
+ (*SendPurchaseInspectRequest)(nil), // 4: SendPurchaseInspectRequest
+ (*QualityInspect)(nil), // 5: QualityInspect
+ (*SendPurchaseInspectResponse)(nil), // 6: SendPurchaseInspectResponse
+ (*GetInspectListRequest)(nil), // 7: GetInspectListRequest
+ (*GetInspectListResponse)(nil), // 8: GetInspectListResponse
}
var file_quality_inspect_proto_depIdxs = []int32{
- 4, // 0: SendPurchaseInspectRequest.list:type_name -> QualityInspect
+ 5, // 0: SendPurchaseInspectRequest.list:type_name -> QualityInspect
0, // 1: QualityInspect.inspect_type:type_name -> InspectType
1, // 2: QualityInspect.material_type:type_name -> MaterialType
2, // 3: QualityInspect.inspect_method:type_name -> InspectMethod
- 4, // 4: GetInspectListResponse.List:type_name -> QualityInspect
- 3, // 5: QualityInspectService.SendPurchaseInspect:input_type -> SendPurchaseInspectRequest
- 6, // 6: QualityInspectService.GetInspectList:input_type -> GetInspectListRequest
- 5, // 7: QualityInspectService.SendPurchaseInspect:output_type -> SendPurchaseInspectResponse
- 7, // 8: QualityInspectService.GetInspectList:output_type -> GetInspectListResponse
- 7, // [7:9] is the sub-list for method output_type
- 5, // [5:7] is the sub-list for method input_type
- 5, // [5:5] is the sub-list for extension type_name
- 5, // [5:5] is the sub-list for extension extendee
- 0, // [0:5] is the sub-list for field type_name
+ 3, // 4: QualityInspect.status:type_name -> InspectStatus
+ 5, // 5: GetInspectListResponse.List:type_name -> QualityInspect
+ 4, // 6: QualityInspectService.SendPurchaseInspect:input_type -> SendPurchaseInspectRequest
+ 7, // 7: QualityInspectService.GetInspectList:input_type -> GetInspectListRequest
+ 6, // 8: QualityInspectService.SendPurchaseInspect:output_type -> SendPurchaseInspectResponse
+ 8, // 9: QualityInspectService.GetInspectList:output_type -> GetInspectListResponse
+ 8, // [8:10] is the sub-list for method output_type
+ 6, // [6:8] is the sub-list for method input_type
+ 6, // [6:6] is the sub-list for extension type_name
+ 6, // [6:6] is the sub-list for extension extendee
+ 0, // [0:6] is the sub-list for field type_name
}
func init() { file_quality_inspect_proto_init() }
@@ -855,7 +906,7 @@
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_quality_inspect_proto_rawDesc,
- NumEnums: 3,
+ NumEnums: 4,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
diff --git a/router/purchase/purchase.go b/router/purchase/purchase.go
index a7b3728..fc32f6a 100644
--- a/router/purchase/purchase.go
+++ b/router/purchase/purchase.go
@@ -18,4 +18,12 @@
purchaseRouter.POST("purchaseType", PurchaseApi.SavePurchaseType) // 淇濆瓨閲囪喘绫诲瀷
purchaseRouter.GET("purchaseTypeList", PurchaseApi.GetPurchaseTypeList) // 鏌ヨ閲囪喘绫诲瀷
}
+
+ qualityInspectRouter := Router.Group("purchase")
+ qualityInspectApi := purchase.QualityInspectApi{}
+ {
+ //qualityInspectRouter.GET("purchase/:id", qualityInspectApi.GetPurchase) // 鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�
+ qualityInspectRouter.GET("qualityInspectList", qualityInspectApi.GetQualityInspectList) // 鑾峰彇閲囪喘鍗曞垪琛�
+ }
+
}
diff --git a/service/purchase/purchase.go b/service/purchase/purchase.go
index ffa39d2..2d72725 100644
--- a/service/purchase/purchase.go
+++ b/service/purchase/purchase.go
@@ -25,27 +25,11 @@
//@return: err error
func (slf *PurchaseService) CreatePurchase(record *purchase.Purchase, productList []*purchase.PurchaseProducts) (err error) {
+ err = DealPrice(record, productList)
+ if err != nil {
+ return err
+ }
err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
- var quantity decimal.Decimal
- var totalPrice decimal.Decimal
- var realTotalPrice decimal.Decimal
- for _, product := range productList {
- quantity = quantity.Add(product.Amount)
- totalPrice = totalPrice.Add(product.Price.Mul(product.Amount))
- }
- if !totalPrice.Equal(record.TotalPrice) {
- return errors.New("浠风◣鎬昏璁$畻閿欒")
- }
- if !quantity.Equal(record.Quantity) {
- return errors.New("浜у搧鏁伴噺璁$畻閿欒")
- }
- realTotalPrice = record.CalcRealTotalPrice()
- if !realTotalPrice.Equal(record.RealTotalPrice) {
- return errors.New("鏈�缁堜环鏍艰绠楅敊璇�")
- }
- record.UnInvoiceAmount = record.RealTotalPrice
- record.ShouldPayAmount = record.RealTotalPrice
-
err = tx.Create(&record).Error
if err != nil {
return err
@@ -57,6 +41,29 @@
})
return err
+}
+
+func DealPrice(record *purchase.Purchase, productList []*purchase.PurchaseProducts) error {
+ var quantity decimal.Decimal
+ var totalPrice decimal.Decimal
+ var realTotalPrice decimal.Decimal
+ for _, product := range productList {
+ quantity = quantity.Add(product.Amount)
+ totalPrice = totalPrice.Add(product.Price.Mul(product.Amount))
+ }
+ if !totalPrice.Equal(record.TotalPrice) {
+ return errors.New("浠风◣鎬昏璁$畻閿欒")
+ }
+ if !quantity.Equal(record.Quantity) {
+ return errors.New("浜у搧鏁伴噺璁$畻閿欒")
+ }
+ realTotalPrice = record.CalcRealTotalPrice()
+ if !realTotalPrice.Equal(record.RealTotalPrice) {
+ return errors.New("鏈�缁堜环鏍艰绠楅敊璇�")
+ }
+ record.UnInvoiceAmount = record.RealTotalPrice
+ record.ShouldPayAmount = record.RealTotalPrice
+ return nil
}
//@function: DeletePurchase
@@ -81,12 +88,11 @@
//@return: err error
func (slf *PurchaseService) UpdatePurchase(params *purchase.Purchase, productList []*purchase.PurchaseProducts) (err error) {
+ err = DealPrice(params, productList)
+ if err != nil {
+ return err
+ }
err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
- var quantity decimal.Decimal
- for _, product := range productList {
- quantity = quantity.Add(product.Amount)
- }
- params.Quantity = quantity
err = tx.Where("id = ?", params.ID).Updates(params).Error
if err != nil {
return err
@@ -131,7 +137,7 @@
Or("Product.name like ?", "%"+info.Keyword+"%").
Or("supplier.name like ?", "%"+info.Keyword+"%")
}
- var purchaseList []purchase.Purchase
+ var purchaseList []*purchase.Purchase
err = db.Count(&total).Error
if err != nil {
return purchaseList, total, err
@@ -210,20 +216,24 @@
continue
}
inspectOrder := &qualityinspect.QualityInspect{
- InspectType: qualityinspect.InspectType_InspectTypePurchase,
- MaterialType: qualityinspect.MaterialType_MaterialTypeRaw,
- MaterialName: product.Name,
- MaterialId: product.Number,
- MaterialTp: product.ModelNumber,
- MaterialUnit: product.Unit,
- Supplier: record.Supplier.Name,
- WarehouseName: "閲囪喘鎬讳粨",
- ReportAmount: productItem.Amount.InexactFloat64(),
- InspectMethod: qualityinspect.InspectMethod_InspectMethodAll,
- InspectAmount: productItem.Amount.InexactFloat64(),
+ InspectType: qualityinspect.InspectType_InspectTypePurchase,
+ MaterialType: qualityinspect.MaterialType_MaterialTypeRaw,
+ MaterialName: product.Name,
+ MaterialId: product.Number,
+ MaterialTp: product.ModelNumber,
+ MaterialUnit: product.Unit,
+ Supplier: record.Supplier.Name,
+ WarehouseName: "閲囪喘鎬讳粨",
+ ReportAmount: productItem.Amount.InexactFloat64(),
+ InspectMethod: qualityinspect.InspectMethod_InspectMethodAll,
+ InspectAmount: productItem.Amount.InexactFloat64(),
+ PurchaseOrderId: record.Number,
}
inspectOrders = append(inspectOrders, inspectOrder)
}
+ if len(inspectOrders) == 0 {
+ return nil
+ }
inspectRequest := qualityinspect.SendPurchaseInspectRequest{List: inspectOrders}
_, err = qualityinspect.NewQualityInspectServiceClient(qualityinspect.Conn).SendPurchaseInspect(context.Background(), &inspectRequest)
return err
diff --git a/service/purchase/quality_inspect.go b/service/purchase/quality_inspect.go
new file mode 100644
index 0000000..ce17a43
--- /dev/null
+++ b/service/purchase/quality_inspect.go
@@ -0,0 +1,61 @@
+package purchase
+
+//
+//import (
+// "srm/global"
+// "srm/model/common/request"
+//)
+//
+//type QualityInspect struct{}
+//
+//func NewQualityInspect() *QualityInspect {
+// return &QualityInspect{}
+//}
+//
+////@function: GetQualityInspect
+////@description: 鑾峰彇閲囪喘鍗曚俊鎭�
+////@param: id uint
+////@return: QualityInspect model.QualityInspect, err error
+//
+//func (slf *QualityInspect) GetQualityInspect(id uint) (QualityInspect QualityInspect.QualityInspect, err error) {
+// err = global.GVA_DB.Where("id = ?", id).Preload("Supplier").First(&QualityInspect).Error
+// return
+//}
+//
+////@function: GetQualityInspectList
+////@description: 鍒嗛〉鑾峰彇閲囪喘鍗曞垪琛�
+////@param: info request.PageInfo
+////@return: list interface{}, total int64, err error
+//
+//func (slf *QualityInspect) GetQualityInspectList(info request.PageInfo) (list interface{}, total int64, err error) {
+// limit := info.PageSize
+// offset := info.PageSize * (info.Page - 1)
+// db := global.GVA_DB.Model(&QualityInspect.QualityInspect{})
+// if info.Keyword != "" {
+// db.Distinct("QualityInspects.id").Joins("left join QualityInspect_products on QualityInspect_products.QualityInspect_id = QualityInspects.id").
+// Joins("left join Product on Product.Id = QualityInspect_products.product_id").
+// Joins("left join supplier on supplier.Id = QualityInspects.supplier_id").
+// Where("QualityInspects.name like ?", "%"+info.Keyword+"%").
+// Or("Product.name like ?", "%"+info.Keyword+"%").
+// Or("supplier.name like ?", "%"+info.Keyword+"%")
+// }
+// var QualityInspectList []QualityInspect.QualityInspect
+// err = db.Count(&total).Error
+// if err != nil {
+// return QualityInspectList, total, err
+// }
+// err = db.Limit(limit).Offset(offset).Find(&QualityInspectList).Error
+// return QualityInspectList, total, err
+//}
+//
+////@function: GetQualityInspectProductList
+////@description: 鍒嗛〉鑾峰彇閲囪喘鍗曚骇鍝佸垪琛�
+////@param: QualityInspectId int
+////@return: list interface{}, err error
+//
+//func (slf *QualityInspect) GetQualityInspectProductList(QualityInspectId uint) (list []*QualityInspect.QualityInspectProducts, err error) {
+// db := global.GVA_DB.Model(&QualityInspect.QualityInspectProducts{})
+// list = make([]*QualityInspect.QualityInspectProducts, 0)
+// err = db.Where("QualityInspect_id = ?", QualityInspectId).Preload("Product").Find(&list).Error
+// return list, err
+//}
diff --git a/utils/structx.go b/utils/structx.go
new file mode 100644
index 0000000..b7b0aec
--- /dev/null
+++ b/utils/structx.go
@@ -0,0 +1,16 @@
+package utils
+
+import "encoding/json"
+
+func AssignTo(from interface{}, to interface{}) error {
+ data, err := json.Marshal(from)
+ if err != nil {
+ return err
+ }
+
+ err = json.Unmarshal(data, to)
+ if err != nil {
+ return err
+ }
+ return nil
+}
--
Gitblit v1.8.0