From 5e1aa408c1b8bd36fefd0b5ea380a2fde6d57810 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 27 十二月 2023 17:35:50 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/SRM --- proto/code.proto | 48 ++ model/purchase/purchase.go | 8 router/test/code.go | 20 api/v1/test/enter.go | 1 model/purchase/request/purchase.go | 6 api/v1/test/code.go | 101 ++++ model/test/request/common.go | 24 + router/test/enter.go | 1 service/test/supplier.go | 6 utils/code.go | 33 + proto/purchase_wms.proto | 3 pkg/contextx/contextx.go | 17 global/model.go | 18 api/v1/purchase/purchase.go | 5 constvar/const.go | 7 model/purchase/purchase_type.go | 2 proto/code/code_grpc.pb.go | 109 +++++ proto/purchase_wms/purchase_wms.pb.go | 213 +++++---- model/purchase/response/purchase.go | 1 initialize/router.go | 1 model/test/supplier.go | 2 model/test/request/code.go | 32 + service/purchase/purchase.go | 6 proto/code/code.pb.go | 584 +++++++++++++++++++++++++++ 24 files changed, 1,119 insertions(+), 129 deletions(-) diff --git a/api/v1/purchase/purchase.go b/api/v1/purchase/purchase.go index edec24e..e723875 100644 --- a/api/v1/purchase/purchase.go +++ b/api/v1/purchase/purchase.go @@ -2,7 +2,6 @@ import ( "context" - "fmt" "github.com/gin-gonic/gin" "go.uber.org/zap" "gorm.io/gorm" @@ -13,8 +12,6 @@ "srm/proto/purchase_wms" "strconv" "strings" - "time" - //"srm/model/purchase" //"srm/model/purchase" @@ -54,7 +51,6 @@ purchaseRecord.Status = purchase.OrderStatusConfirmed purchaseRecord.HandledBy = "admin" purchaseRecord.Creator = "admin" - purchaseRecord.Number = fmt.Sprintf("CG%v", time.Now().Unix()) purchaseRecord.Principal = "admin" purchaseRecord.OrderType = "閲囪喘璁㈠崟" @@ -267,6 +263,7 @@ Number: data.Number, SupplierName: data.Supplier.Name, Product: product, + Source: "SRM_PURCHASE", }) if err != nil { global.GVA_LOG.Error("grpc璋冪敤澶辫触!", zap.Error(err)) diff --git a/api/v1/test/code.go b/api/v1/test/code.go new file mode 100644 index 0000000..2c2420d --- /dev/null +++ b/api/v1/test/code.go @@ -0,0 +1,101 @@ +package test + +import ( + "github.com/gin-gonic/gin" + "github.com/spf13/cast" + "srm/constvar" + "srm/model/common/response" + "srm/model/test/request" + "srm/pkg/contextx" + "srm/pkg/logx" + "srm/proto/code" + "srm/service" + purchaseService "srm/service/purchase" + "srm/utils" +) + +type CodeApi struct { +} + +var ( + supplierService = service.ServiceGroupApp.TestServiceGroup.SupplierService +) + +// GetCodeList +// +// @Tags 缂栫爜 +// @Summary 鑾峰彇缂栫爜鍒楄〃 +// @Produce application/json +// @Param object query request.GetCodeList true "鍙傛暟" +// @Success 200 {object} util.ResponseList{data=[]code.CodeStandard} +// +// @Router /code/getCodeList [get] +func (ca *CodeApi) GetCodeList(c *gin.Context) { + var params request.GetCodeList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + params.CodeStandID = c.Query("codeStandID") + params.Name = c.Query("name") + params.Type = c.Query("type") + client := code.NewCodeServiceClient(productServiceConn) + list, err := client.GetCodeList(ctx.GetCtx(), &code.GetCodeListRequest{ + Page: cast.ToInt32(params.Page), + PageSize: cast.ToInt32(params.PageSize), + CodeStandID: params.CodeStandID, + Name: params.Name, + Type: params.Type, + }) + if err != nil { + logx.Errorf("GetCodeList err: %v", err.Error()) + response.FailWithMessage("浜у搧鍚嶇О涓嶈兘涓虹┖", c) + return + } + response.OkWithDetailed(response.PageResult{ + List: list.List, + Total: list.Total, + Page: params.Page, + PageSize: params.PageSize, + }, "鑾峰彇鎴愬姛", c) +} + +// GetAutoCode +// +// @Tags 缂栫爜 +// @Summary 鑾峰彇鑷姩缂栫爜 +// @Produce application/json +// @Param object body code.CodeStandard true "鍙傛暟" +// @Success 200 {object} util.ResponseList{data=map[string]interface{}} +// +// @Router /code/getAutoCode [post] +func (ca *CodeApi) GetAutoCode(c *gin.Context) { + var params code.CodeStandard + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + var ( + id = 0 + err error + ) + switch constvar.CodeStandardType(params.Type) { + case constvar.CodeStandardType_PurchaseOrder: + id, err = purchaseService.NewPurchaseService().MaxAutoIncr() + case constvar.CodeStandardType_Supplier: + id, err = supplierService.MaxAutoIncr() + default: + response.FailWithMessage("缂栫爜瑙勫垯涓嶅瓨鍦�", c) + return + } + if err != nil { + response.FailWithMessage("鑾峰彇鏈�澶у�煎け璐�", c) + return + } + m := make(map[string]interface{}) + autoCode := utils.GetAutoCode(id, ¶ms) + m["id"] = autoCode + m["codeStandardID"] = params.ID + m["maxAutoIncr"] = id + 1 + ctx.OkWithDetailed(m) +} diff --git a/api/v1/test/enter.go b/api/v1/test/enter.go index b0f6dc2..7f39c8f 100644 --- a/api/v1/test/enter.go +++ b/api/v1/test/enter.go @@ -7,4 +7,5 @@ ContractApi ProductApi MemberApi + CodeApi } diff --git a/constvar/const.go b/constvar/const.go index e1cda77..6bd9591 100644 --- a/constvar/const.go +++ b/constvar/const.go @@ -9,3 +9,10 @@ ) const SystemTypeSrm = 4 //srm璐﹀彿 + +type CodeStandardType string + +const ( + CodeStandardType_PurchaseOrder CodeStandardType = "閲囪喘鍗曠紪鐮�" + CodeStandardType_Supplier CodeStandardType = "渚涘簲鍟嗙紪鐮�" +) diff --git a/global/model.go b/global/model.go index b4594ee..9a3d5b1 100644 --- a/global/model.go +++ b/global/model.go @@ -7,10 +7,10 @@ ) type GVA_MODEL struct { - ID uint `gorm:"primarykey"` // 涓婚敭ID - CreatedAt *time.Time `json:"-"` // 鍒涘缓鏃堕棿 - UpdatedAt *time.Time `json:"-"` // 鏇存柊鏃堕棿 - DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 鍒犻櫎鏃堕棿 + ID uint `json:"id" gorm:"primarykey"` // 涓婚敭ID + CreatedAt *time.Time `json:"-"` // 鍒涘缓鏃堕棿 + UpdatedAt *time.Time `json:"-"` // 鏇存柊鏃堕棿 + DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 鍒犻櫎鏃堕棿 FormattedCreatedAt string `gorm:"-" json:"created_at"` FormattedUpdatedAt string `gorm:"-" json:"updated_at"` @@ -21,3 +21,13 @@ m.FormattedUpdatedAt = m.UpdatedAt.Format("2006-01-02 15:04:05") return } + +type GVA_MODEL_INT struct { + ID uint `json:"id,string" gorm:"primarykey"` // 涓婚敭ID + CreatedAt *time.Time `json:"-"` // 鍒涘缓鏃堕棿 + UpdatedAt *time.Time `json:"-"` // 鏇存柊鏃堕棿 + DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 鍒犻櫎鏃堕棿 + + FormattedCreatedAt string `gorm:"-" json:"created_at"` + FormattedUpdatedAt string `gorm:"-" json:"updated_at"` +} diff --git a/initialize/router.go b/initialize/router.go index 10607fb..b54d472 100644 --- a/initialize/router.go +++ b/initialize/router.go @@ -54,6 +54,7 @@ testRouter.InitContractRouter(PrivateGroup) testRouter.InitProductRouter(PrivateGroup) testRouter.InitMemberRouter(PrivateGroup) + testRouter.InitCodeRouter(PrivateGroup) } global.GVA_LOG.Info("router register success") diff --git a/model/purchase/purchase.go b/model/purchase/purchase.go index 27de935..df91ce9 100644 --- a/model/purchase/purchase.go +++ b/model/purchase/purchase.go @@ -7,11 +7,11 @@ ) type Purchase struct { - global.GVA_MODEL - PurchaseTypeId int `json:"purchaseTypeId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘绫诲瀷id + global.GVA_MODEL_INT + PurchaseTypeId int `json:"purchaseTypeId,string" 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:鍗曟嵁鏉ユ簮"` // 鍗曟嵁鏉ユ簮 - SupplierId int `json:"supplierId" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:渚涘簲鍟唅d"` // 渚涘簲鍟唅d + OrderSource string `json:"orderSource" gorm:"type:varchar(255);not null;default '';comment:鍗曟嵁鏉ユ簮"` // 鍗曟嵁鏉ユ簮 + SupplierId int `json:"supplierId,string" 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:閲囪喘鍚嶇О"` // 閲囪喘鍚嶇О diff --git a/model/purchase/purchase_type.go b/model/purchase/purchase_type.go index 8fc0535..402269c 100644 --- a/model/purchase/purchase_type.go +++ b/model/purchase/purchase_type.go @@ -6,7 +6,7 @@ type PurchaseType struct { global.GVA_MODEL - ID uint `gorm:"primarykey"` // 涓婚敭ID + ID uint `json:"id,string" gorm:"primarykey"` // 涓婚敭ID Name string `json:"name" form:"name" gorm:"type:varchar(255);not null;default '';comment:閲囪喘绫诲瀷"` // 閲囪喘绫诲瀷 Sort int `json:"sort" form:"sort" gorm:"type:int(11);not null;default 0;comment:鎺掑簭"` // 鎺掑簭 Pin bool `json:"pin" form:"pin" gorm:"type:tinyint(1);not null;default 0;comment:閲囪喘鍚嶇О"` // 鏄惁缃《 diff --git a/model/purchase/request/purchase.go b/model/purchase/request/purchase.go index 673dcbe..baad417 100644 --- a/model/purchase/request/purchase.go +++ b/model/purchase/request/purchase.go @@ -27,9 +27,9 @@ } 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 + ID uint `json:"id,string" gorm:"primarykey"` // 涓婚敭ID + PurchaseTypeId int `json:"purchaseTypeId,string" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘绫诲瀷id + SupplierId int `json:"supplierId,string" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:渚涘簲鍟唅d"` // 渚涘簲鍟唅d OrderSource string `json:"orderSource" gorm:"type:varchar(255);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:閲囪喘鍚嶇О"` // 閲囪喘鍚嶇О diff --git a/model/purchase/response/purchase.go b/model/purchase/response/purchase.go index 043729b..83912ac 100644 --- a/model/purchase/response/purchase.go +++ b/model/purchase/response/purchase.go @@ -26,6 +26,7 @@ Specifications string `json:"specifications" form:"specifications" gorm:"column:specifications;comment:瑙勬牸;size:255;"` 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;"` + Remark string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null; default '';comment:鎻忚堪"` //鎻忚堪 } type QualityInspectList struct { diff --git a/model/test/request/code.go b/model/test/request/code.go new file mode 100644 index 0000000..ecc73fa --- /dev/null +++ b/model/test/request/code.go @@ -0,0 +1,32 @@ +package request + +type GetCodeList struct { + PageInfo + CodeStandID string `json:"codeStandID"` + Name string `json:"name"` + Type string `json:"type"` +} + +type CodeStandard struct { + ID string `json:"id"` + Name string `json:"name"` + Type string `json:"type"` + Method int32 `json:"method"` + Status string `json:"status"` + List []*CodeRule `json:"list"` + AutoRule *CodeAuto `json:"autoRule"` +} + +type CodeRule struct { + Name string `json:"name"` + Length int32 `json:"length"` + Desc string `json:"desc"` +} + +type CodeAuto struct { + PrefixMethod int32 `json:"prefixMethod"` + PrefixValue string `json:"prefixValue"` + SuffixMethod int32 `json:"suffixMethod"` + AutoLength int32 `json:"autoLength"` + Desc string `json:"desc"` +} diff --git a/model/test/request/common.go b/model/test/request/common.go new file mode 100644 index 0000000..6126266 --- /dev/null +++ b/model/test/request/common.go @@ -0,0 +1,24 @@ +package request + +type PageInfo struct { + Page int `json:"page" form:"page"` // 椤电爜 + PageSize int `json:"pageSize" form:"pageSize"` // 姣忛〉澶у皬 +} + +func (p PageInfo) Check() bool { + if p.Page <= 0 { + return false + } + if p.PageSize <= 0 || p.PageSize > 500 { + return false + } + return true +} + +type GetById struct { + ID string `json:"id"` +} + +type GetByIdInt struct { + ID uint `json:"id"` +} diff --git a/model/test/supplier.go b/model/test/supplier.go index acba403..5519a66 100644 --- a/model/test/supplier.go +++ b/model/test/supplier.go @@ -7,7 +7,7 @@ // Supplier 缁撴瀯浣� type Supplier struct { - global.GVA_MODEL + global.GVA_MODEL_INT Number string `json:"number" form:"number" gorm:"column:number;comment:渚涘簲鍟嗙紪鍙�;size:255;"` Name string `json:"name" form:"name" gorm:"column:name;comment:鍚嶇О;size:255;"` SupplierType string `json:"supplierType" form:"supplierType" gorm:"column:supplier_type;comment:渚涘簲鍟嗙被鍨�;size:255;"` diff --git a/pkg/contextx/contextx.go b/pkg/contextx/contextx.go index 958df06..6137a2c 100644 --- a/pkg/contextx/contextx.go +++ b/pkg/contextx/contextx.go @@ -4,7 +4,6 @@ "github.com/gin-gonic/gin" "net/http" "srm/pkg/ecode" - "srm/pkg/logx" ) type ( @@ -29,14 +28,14 @@ return } - defer func() { - query := r.ctx.Request.URL.RawQuery - if query != "" { - query = "?" + query - } - urlPath := r.ctx.Request.URL.Path - logx.Infof("%s | %s %s | uid: %s | %+v", ctx.ClientIP(), r.ctx.Request.Method, urlPath+query, r.GetUserId(), params) - }() + //defer func() { + // query := r.ctx.Request.URL.RawQuery + // if query != "" { + // query = "?" + query + // } + // urlPath := r.ctx.Request.URL.Path + // logx.Infof("%s | %s %s | uid: %s | %+v", ctx.ClientIP(), r.ctx.Request.Method, urlPath+query, r.GetUserId(), params) + //}() // validate params if params != nil { diff --git a/proto/code.proto b/proto/code.proto new file mode 100644 index 0000000..e394b43 --- /dev/null +++ b/proto/code.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; + +option go_package = "./code"; + +service codeService { + rpc GetCodeList(GetCodeListRequest) returns(GetCodeListResponse) {} +} + +message CodeStandard { + string ID = 1; + string Name = 2; + string Type = 3; + int32 Method = 4; + string Status = 5; + repeated CodeRule List = 6; + CodeAuto AutoRule = 7; +} + +message CodeRule { + string Name = 1; + int32 Length = 2; + string Desc = 3; +} + +message CodeAuto { + int32 PrefixMethod = 1; + string PrefixValue = 2; + int32 SuffixMethod = 3; + int32 AutoLength = 4; + string Desc = 5; +} + + + +message GetCodeListRequest{ + int32 page = 1; + int32 pageSize = 2; + string CodeStandID = 3; + string Name = 4; + string Type = 5; +} + +message GetCodeListResponse{ + int32 Code = 1; + string Msg = 2; + repeated CodeStandard List = 3; + int64 Total = 4; +} \ No newline at end of file diff --git a/proto/code/code.pb.go b/proto/code/code.pb.go new file mode 100644 index 0000000..2cc50cf --- /dev/null +++ b/proto/code/code.pb.go @@ -0,0 +1,584 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.8.0 +// source: code.proto + +package code + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CodeStandard struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` + Type string `protobuf:"bytes,3,opt,name=Type,proto3" json:"Type,omitempty"` + Method int32 `protobuf:"varint,4,opt,name=Method,proto3" json:"Method,omitempty"` + Status string `protobuf:"bytes,5,opt,name=Status,proto3" json:"Status,omitempty"` + List []*CodeRule `protobuf:"bytes,6,rep,name=List,proto3" json:"List,omitempty"` + AutoRule *CodeAuto `protobuf:"bytes,7,opt,name=AutoRule,proto3" json:"AutoRule,omitempty"` +} + +func (x *CodeStandard) Reset() { + *x = CodeStandard{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CodeStandard) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CodeStandard) ProtoMessage() {} + +func (x *CodeStandard) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CodeStandard.ProtoReflect.Descriptor instead. +func (*CodeStandard) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{0} +} + +func (x *CodeStandard) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +func (x *CodeStandard) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CodeStandard) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CodeStandard) GetMethod() int32 { + if x != nil { + return x.Method + } + return 0 +} + +func (x *CodeStandard) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *CodeStandard) GetList() []*CodeRule { + if x != nil { + return x.List + } + return nil +} + +func (x *CodeStandard) GetAutoRule() *CodeAuto { + if x != nil { + return x.AutoRule + } + return nil +} + +type CodeRule struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Length int32 `protobuf:"varint,2,opt,name=Length,proto3" json:"Length,omitempty"` + Desc string `protobuf:"bytes,3,opt,name=Desc,proto3" json:"Desc,omitempty"` +} + +func (x *CodeRule) Reset() { + *x = CodeRule{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CodeRule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CodeRule) ProtoMessage() {} + +func (x *CodeRule) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CodeRule.ProtoReflect.Descriptor instead. +func (*CodeRule) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{1} +} + +func (x *CodeRule) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CodeRule) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *CodeRule) GetDesc() string { + if x != nil { + return x.Desc + } + return "" +} + +type CodeAuto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PrefixMethod int32 `protobuf:"varint,1,opt,name=PrefixMethod,proto3" json:"PrefixMethod,omitempty"` + PrefixValue string `protobuf:"bytes,2,opt,name=PrefixValue,proto3" json:"PrefixValue,omitempty"` + SuffixMethod int32 `protobuf:"varint,3,opt,name=SuffixMethod,proto3" json:"SuffixMethod,omitempty"` + AutoLength int32 `protobuf:"varint,4,opt,name=AutoLength,proto3" json:"AutoLength,omitempty"` + Desc string `protobuf:"bytes,5,opt,name=Desc,proto3" json:"Desc,omitempty"` +} + +func (x *CodeAuto) Reset() { + *x = CodeAuto{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CodeAuto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CodeAuto) ProtoMessage() {} + +func (x *CodeAuto) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CodeAuto.ProtoReflect.Descriptor instead. +func (*CodeAuto) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{2} +} + +func (x *CodeAuto) GetPrefixMethod() int32 { + if x != nil { + return x.PrefixMethod + } + return 0 +} + +func (x *CodeAuto) GetPrefixValue() string { + if x != nil { + return x.PrefixValue + } + return "" +} + +func (x *CodeAuto) GetSuffixMethod() int32 { + if x != nil { + return x.SuffixMethod + } + return 0 +} + +func (x *CodeAuto) GetAutoLength() int32 { + if x != nil { + return x.AutoLength + } + return 0 +} + +func (x *CodeAuto) GetDesc() string { + if x != nil { + return x.Desc + } + return "" +} + +type GetCodeListRequest struct { + state protoimpl.MessageState + 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"` + CodeStandID string `protobuf:"bytes,3,opt,name=CodeStandID,proto3" json:"CodeStandID,omitempty"` + Name string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"` + Type string `protobuf:"bytes,5,opt,name=Type,proto3" json:"Type,omitempty"` +} + +func (x *GetCodeListRequest) Reset() { + *x = GetCodeListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCodeListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCodeListRequest) ProtoMessage() {} + +func (x *GetCodeListRequest) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCodeListRequest.ProtoReflect.Descriptor instead. +func (*GetCodeListRequest) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{3} +} + +func (x *GetCodeListRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetCodeListRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetCodeListRequest) GetCodeStandID() string { + if x != nil { + return x.CodeStandID + } + return "" +} + +func (x *GetCodeListRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetCodeListRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +type GetCodeListResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"` + List []*CodeStandard `protobuf:"bytes,3,rep,name=List,proto3" json:"List,omitempty"` + Total int64 `protobuf:"varint,4,opt,name=Total,proto3" json:"Total,omitempty"` +} + +func (x *GetCodeListResponse) Reset() { + *x = GetCodeListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_code_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCodeListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCodeListResponse) ProtoMessage() {} + +func (x *GetCodeListResponse) ProtoReflect() protoreflect.Message { + mi := &file_code_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCodeListResponse.ProtoReflect.Descriptor instead. +func (*GetCodeListResponse) Descriptor() ([]byte, []int) { + return file_code_proto_rawDescGZIP(), []int{4} +} + +func (x *GetCodeListResponse) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *GetCodeListResponse) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *GetCodeListResponse) GetList() []*CodeStandard { + if x != nil { + return x.List + } + return nil +} + +func (x *GetCodeListResponse) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +var File_code_proto protoreflect.FileDescriptor + +var file_code_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbc, 0x01, 0x0a, + 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x12, 0x0e, 0x0a, + 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, + 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x06, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x75, 0x6c, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x41, 0x75, 0x74, + 0x6f, 0x52, 0x08, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x75, 0x6c, 0x65, 0x22, 0x4a, 0x0a, 0x08, 0x43, + 0x6f, 0x64, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x65, 0x73, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x44, 0x65, 0x73, 0x63, 0x22, 0xa8, 0x01, 0x0a, 0x08, 0x43, 0x6f, 0x64, 0x65, + 0x41, 0x75, 0x74, 0x6f, 0x12, 0x22, 0x0a, 0x0c, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x50, 0x72, 0x65, 0x66, + 0x69, 0x78, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x72, 0x65, 0x66, + 0x69, 0x78, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x75, + 0x66, 0x66, 0x69, 0x78, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0c, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1e, + 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x6f, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0a, 0x41, 0x75, 0x74, 0x6f, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12, + 0x0a, 0x04, 0x44, 0x65, 0x73, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x44, 0x65, + 0x73, 0x63, 0x22, 0x8e, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 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, 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x64, + 0x65, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x43, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x4e, + 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, + 0x79, 0x70, 0x65, 0x22, 0x74, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 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, 0x21, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 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, 0x32, 0x49, 0x0a, 0x0b, 0x63, 0x6f, 0x64, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x43, + 0x6f, 0x64, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, + 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x47, + 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_code_proto_rawDescOnce sync.Once + file_code_proto_rawDescData = file_code_proto_rawDesc +) + +func file_code_proto_rawDescGZIP() []byte { + file_code_proto_rawDescOnce.Do(func() { + file_code_proto_rawDescData = protoimpl.X.CompressGZIP(file_code_proto_rawDescData) + }) + return file_code_proto_rawDescData +} + +var file_code_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_code_proto_goTypes = []interface{}{ + (*CodeStandard)(nil), // 0: CodeStandard + (*CodeRule)(nil), // 1: CodeRule + (*CodeAuto)(nil), // 2: CodeAuto + (*GetCodeListRequest)(nil), // 3: GetCodeListRequest + (*GetCodeListResponse)(nil), // 4: GetCodeListResponse +} +var file_code_proto_depIdxs = []int32{ + 1, // 0: CodeStandard.List:type_name -> CodeRule + 2, // 1: CodeStandard.AutoRule:type_name -> CodeAuto + 0, // 2: GetCodeListResponse.List:type_name -> CodeStandard + 3, // 3: codeService.GetCodeList:input_type -> GetCodeListRequest + 4, // 4: codeService.GetCodeList:output_type -> GetCodeListResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_code_proto_init() } +func file_code_proto_init() { + if File_code_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_code_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CodeStandard); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_code_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CodeRule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_code_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CodeAuto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_code_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCodeListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_code_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCodeListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_code_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_code_proto_goTypes, + DependencyIndexes: file_code_proto_depIdxs, + MessageInfos: file_code_proto_msgTypes, + }.Build() + File_code_proto = out.File + file_code_proto_rawDesc = nil + file_code_proto_goTypes = nil + file_code_proto_depIdxs = nil +} diff --git a/proto/code/code_grpc.pb.go b/proto/code/code_grpc.pb.go new file mode 100644 index 0000000..9c3ded6 --- /dev/null +++ b/proto/code/code_grpc.pb.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.8.0 +// source: code.proto + +package code + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + CodeService_GetCodeList_FullMethodName = "/codeService/GetCodeList" +) + +// CodeServiceClient is the client API for CodeService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CodeServiceClient interface { + GetCodeList(ctx context.Context, in *GetCodeListRequest, opts ...grpc.CallOption) (*GetCodeListResponse, error) +} + +type codeServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCodeServiceClient(cc grpc.ClientConnInterface) CodeServiceClient { + return &codeServiceClient{cc} +} + +func (c *codeServiceClient) GetCodeList(ctx context.Context, in *GetCodeListRequest, opts ...grpc.CallOption) (*GetCodeListResponse, error) { + out := new(GetCodeListResponse) + err := c.cc.Invoke(ctx, CodeService_GetCodeList_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CodeServiceServer is the server API for CodeService service. +// All implementations must embed UnimplementedCodeServiceServer +// for forward compatibility +type CodeServiceServer interface { + GetCodeList(context.Context, *GetCodeListRequest) (*GetCodeListResponse, error) + mustEmbedUnimplementedCodeServiceServer() +} + +// UnimplementedCodeServiceServer must be embedded to have forward compatible implementations. +type UnimplementedCodeServiceServer struct { +} + +func (UnimplementedCodeServiceServer) GetCodeList(context.Context, *GetCodeListRequest) (*GetCodeListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCodeList not implemented") +} +func (UnimplementedCodeServiceServer) mustEmbedUnimplementedCodeServiceServer() {} + +// UnsafeCodeServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CodeServiceServer will +// result in compilation errors. +type UnsafeCodeServiceServer interface { + mustEmbedUnimplementedCodeServiceServer() +} + +func RegisterCodeServiceServer(s grpc.ServiceRegistrar, srv CodeServiceServer) { + s.RegisterService(&CodeService_ServiceDesc, srv) +} + +func _CodeService_GetCodeList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCodeListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CodeServiceServer).GetCodeList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CodeService_GetCodeList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CodeServiceServer).GetCodeList(ctx, req.(*GetCodeListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CodeService_ServiceDesc is the grpc.ServiceDesc for CodeService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CodeService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "codeService", + HandlerType: (*CodeServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetCodeList", + Handler: _CodeService_GetCodeList_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "code.proto", +} diff --git a/proto/purchase_wms.proto b/proto/purchase_wms.proto index 57b61a0..c344dfd 100644 --- a/proto/purchase_wms.proto +++ b/proto/purchase_wms.proto @@ -20,7 +20,8 @@ message PurchaseToWmsRequest { string Number = 1; //閲囪喘缂栧彿 string SupplierName = 2; //渚涘簲鍟� - repeated PurchaseProduct Product = 3; + string Source = 3;//鏉ユ簮 + repeated PurchaseProduct Product = 4; } message PurchaseToWmsResponse { diff --git a/proto/purchase_wms/purchase_wms.pb.go b/proto/purchase_wms/purchase_wms.pb.go index 94f9372..5af5073 100644 --- a/proto/purchase_wms/purchase_wms.pb.go +++ b/proto/purchase_wms/purchase_wms.pb.go @@ -82,7 +82,8 @@ Number string `protobuf:"bytes,1,opt,name=Number,proto3" json:"Number,omitempty"` //閲囪喘缂栧彿 SupplierName string `protobuf:"bytes,2,opt,name=SupplierName,proto3" json:"SupplierName,omitempty"` //渚涘簲鍟� - Product []*PurchaseProduct `protobuf:"bytes,3,rep,name=Product,proto3" json:"Product,omitempty"` + Source string `protobuf:"bytes,3,opt,name=Source,proto3" json:"Source,omitempty"` //鏉ユ簮 + Product []*PurchaseProduct `protobuf:"bytes,4,rep,name=Product,proto3" json:"Product,omitempty"` } func (x *PurchaseToWmsRequest) Reset() { @@ -127,6 +128,13 @@ func (x *PurchaseToWmsRequest) GetSupplierName() string { if x != nil { return x.SupplierName + } + return "" +} + +func (x *PurchaseToWmsRequest) GetSource() string { + if x != nil { + return x.Source } return "" } @@ -791,111 +799,112 @@ 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x7e, 0x0a, 0x14, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, - 0x22, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50, - 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x22, - 0x63, 0x0a, 0x15, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, - 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, - 0x6f, 0x75, 0x73, 0x65, 0x22, 0x35, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, - 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x44, 0x0a, 0x1c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 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, 0x41, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, - 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x49, 0x64, 0x22, 0x78, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x75, 0x72, 0x63, - 0x68, 0x61, 0x73, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, - 0x0d, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x6d, - 0x0a, 0x22, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, - 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x96, 0x01, 0x0a, 0x14, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x07, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, + 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x22, 0x63, 0x0a, 0x15, 0x50, 0x75, 0x72, 0x63, + 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x22, 0x35, 0x0a, + 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x22, 0x44, 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, + 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 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, 0x21, 0x0a, 0x04, 0x4c, 0x69, - 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x8a, 0x01, - 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, - 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, - 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x6b, 0x0a, 0x1b, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, - 0x73, 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, - 0x26, 0x0a, 0x0e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, - 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x42, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x50, 0x75, - 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x50, 0x75, 0x72, 0x63, - 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0xae, 0x01, 0x0a, 0x0c, - 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x0a, 0x0e, - 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, - 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x75, 0x72, 0x63, - 0x68, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x3e, 0x0a, 0x17, - 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x49, 0x6e, 0x66, 0x6f, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x32, 0xad, 0x03, 0x0a, - 0x0f, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x3e, 0x0a, 0x0d, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, - 0x73, 0x12, 0x15, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, - 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x55, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, - 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x53, 0x75, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x22, 0x41, 0x0a, 0x21, 0x47, 0x65, + 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1c, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x22, 0x78, 0x0a, + 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x0a, + 0x0a, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0a, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x22, 0x0a, + 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50, 0x72, 0x69, + 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0d, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, + 0x73, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x6d, 0x0a, 0x22, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, - 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x22, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, - 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x47, 0x65, 0x74, 0x53, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, - 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x52, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, - 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x12, 0x1b, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, + 0x75, 0x63, 0x74, 0x49, 0x64, 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, 0x21, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0d, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x8a, 0x01, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x22, 0x6b, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, - 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, - 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x10, 0x5a, 0x0e, - 0x2e, 0x2f, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x77, 0x6d, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x26, 0x0a, 0x0e, 0x50, 0x75, 0x72, 0x63, + 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x22, 0x42, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x50, 0x75, + 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x0f, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x73, 0x22, 0xae, 0x01, 0x0a, 0x0c, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, + 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, + 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x22, 0x0a, + 0x0c, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x3e, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, + 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x23, 0x0a, 0x05, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, + 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x32, 0xad, 0x03, 0x0a, 0x0f, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, + 0x73, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x50, 0x75, 0x72, + 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x75, 0x72, + 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x14, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x1c, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, + 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x67, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, + 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x22, + 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, + 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, + 0x12, 0x1b, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, + 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, + 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x50, + 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x70, 0x75, 0x72, 0x63, 0x68, + 0x61, 0x73, 0x65, 0x5f, 0x77, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/router/test/code.go b/router/test/code.go new file mode 100644 index 0000000..f9988be --- /dev/null +++ b/router/test/code.go @@ -0,0 +1,20 @@ +package test + +import ( + "github.com/gin-gonic/gin" + v1 "srm/api/v1" +) + +type CodeRouter struct { +} + +// InitCodeRouter 鍒濆鍖� Code 璺敱淇℃伅 +func (s *CodeRouter) InitCodeRouter(Router *gin.RouterGroup) { + codeRouter := Router.Group("code") + var codeApi = v1.ApiGroupApp.TestApiGroup.CodeApi + { + codeRouter.GET("getCodeList", codeApi.GetCodeList) // 鑾峰彇缂栫爜鍒楄〃 + codeRouter.POST("getAutoCode", codeApi.GetAutoCode) //鑾峰彇鑷姩缂栫爜 + + } +} diff --git a/router/test/enter.go b/router/test/enter.go index 7b78a04..5765ac6 100644 --- a/router/test/enter.go +++ b/router/test/enter.go @@ -7,4 +7,5 @@ ContractRouter ProductRouter MemberRouter + CodeRouter } diff --git a/service/purchase/purchase.go b/service/purchase/purchase.go index 7dabf2c..fb3db12 100644 --- a/service/purchase/purchase.go +++ b/service/purchase/purchase.go @@ -297,3 +297,9 @@ err = db.Order("pin desc, sort desc, id asc").Find(&list).Error return list, err } + +func (slf *PurchaseService) MaxAutoIncr() (int, error) { + var total int64 + err := global.GVA_DB.Model(&purchase.Purchase{}).Count(&total).Error + return int(total), err +} diff --git a/service/test/supplier.go b/service/test/supplier.go index 87a8024..27f4a39 100644 --- a/service/test/supplier.go +++ b/service/test/supplier.go @@ -95,3 +95,9 @@ err = global.GVA_DB.Model(&test.Supplier{}).Where("id = ?", id).Update("status", status).Error return err } + +func (sService *SupplierService) MaxAutoIncr() (int, error) { + var total int64 + err := global.GVA_DB.Model(&test.Supplier{}).Count(&total).Error + return int(total), err +} diff --git a/utils/code.go b/utils/code.go new file mode 100644 index 0000000..12571ac --- /dev/null +++ b/utils/code.go @@ -0,0 +1,33 @@ +package utils + +import ( + "fmt" + "srm/proto/code" + "strconv" + "time" +) + +func GetAutoCode(id int, codeStandard *code.CodeStandard) string { + autoCode := "" + var prefixValue string + if codeStandard.AutoRule.PrefixMethod == 2 { // 鏉ユ簮鍗曟嵁 + prefixValue = "" + } else { // 鍥哄畾鍊� + prefixValue = codeStandard.AutoRule.PrefixValue + } + strMaxAutoIncr := strconv.Itoa(id + 1) + count := int(codeStandard.AutoRule.AutoLength) - len(strMaxAutoIncr) + for i := 0; i < count; i++ { + strMaxAutoIncr = "0" + strMaxAutoIncr + } + + var suffixValue string + if codeStandard.AutoRule.SuffixMethod == 2 { // 骞存湀鏃�+鑷闀� + suffixValue = fmt.Sprintf("%v%v", time.Now().Format("20060102"), strMaxAutoIncr) + } else { // 鑷闀� + suffixValue = strMaxAutoIncr + } + + autoCode = prefixValue + suffixValue + return autoCode +} -- Gitblit v1.8.0