| | |
| | | // @Success 200 {object} response.Response{msg=string} "提交采购单" |
| | | // @Router /purchase/submit/{id} [post] |
| | | func (e *PurchaseApi) Submit(c *gin.Context) { |
| | | var params purchaserequest.AddPurchase |
| | | err := c.ShouldBindJSON(¶ms) |
| | | if err != nil { |
| | | response.FailWithMessage(err.Error(), c) |
| | | id, _ := strconv.Atoi(c.Param("id")) |
| | | if id == 0 { |
| | | response.FailWithMessage("参数缺失", c) |
| | | return |
| | | } |
| | | err = utils.Verify(params.Purchase.GVA_MODEL, utils.IdVerify) |
| | | if err != nil { |
| | | response.FailWithMessage(err.Error(), c) |
| | | return |
| | | } |
| | | err = service.NewPurchaseService().UpdatePurchase(¶ms) |
| | | err := service.NewPurchaseService().Submit(uint(id)) |
| | | if err != nil { |
| | | global.GVA_LOG.Error("更新失败!", zap.Error(err)) |
| | | response.FailWithMessage("更新失败", c) |
New file |
| | |
| | | package initialize |
| | | |
| | | import "srm/proto/qualityinspect" |
| | | |
| | | func InitRpcClient() { |
| | | qualityinspect.InitConn() |
| | | } |
| | | |
| | | func CloseRpcClient() { |
| | | qualityinspect.CloseConn() |
| | | } |
| | |
| | | } |
| | | |
| | | go test.InitProductServiceConn() |
| | | initialize.InitRpcClient() |
| | | defer initialize.CloseRpcClient() |
| | | |
| | | core.RunWindowsServer() |
| | | } |
| | |
| | | |
| | | import ( |
| | | "srm/global" |
| | | "srm/model/test" |
| | | ) |
| | | |
| | | type Purchase struct { |
| | | global.GVA_MODEL |
| | | 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:供应商id"` // 供应商id |
| | | 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 string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null;default '';comment:备注"` //备注 |
| | | 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:供应商id"` // 供应商id |
| | | Supplier test.Supplier `json:"supplier" gorm:"foreignKey:SupplierId"` |
| | | Number string `json:"number" form:"number" gorm:"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:状态"` //状态 |
| | | } |
| | | |
| | | type OrderStatus int |
| | | |
| | | const ( |
| | | // PurchaseOrderStatusConfirmed OrderStatus = 1 //已下单 |
| | | // PurchaseOrderStatusReceived OrderStatus = 2 //已到货 |
| | | // PurchaseOrderStatus OrderStatus = 3 //已入库 |
| | | // PurchaseOrderStatusReceived OrderStatus = 4 //已完成 |
| | | OrderStatusConfirmed OrderStatus = 1 //已下单 |
| | | OrderStatusReceived OrderStatus = 2 //已到货 |
| | | OrderStatusStored OrderStatus = 3 //已入库 |
| | | OrderStatusCompleted OrderStatus = 4 //已完成 |
| | | ) |
New file |
| | |
| | | syntax = "proto3"; |
| | | |
| | | option go_package = "./qualityinspect"; |
| | | |
| | | service QualityInspectService { |
| | | rpc SendPurchaseInspect(SendPurchaseInspectRequest) returns(SendPurchaseInspectResponse) {} |
| | | rpc GetInspectList(GetInspectListRequest) returns(GetInspectListResponse) {} |
| | | } |
| | | message SendPurchaseInspectRequest { |
| | | repeated QualityInspect list = 1; |
| | | } |
| | | |
| | | message QualityInspect { |
| | | string id = 1; //检验单id |
| | | InspectType inspect_type = 2; // 检验类型 |
| | | string send_inspector_id = 3; // 送检员ID |
| | | MaterialType material_type = 4; // 物料类型(数字) |
| | | string material_name = 5; // 物料名称 |
| | | string material_id = 6; // 物料编码 |
| | | string material_tp = 7; // 物料型号 |
| | | string material_unit = 8; // 物料单位 |
| | | string supplier = 9; // 供应商 |
| | | string batch_id = 10; // 批号 |
| | | string warehouse_name = 11; // 收料仓库 |
| | | string warehouse_pos = 12; // 仓位 |
| | | double report_amount = 13; // 报检数量 |
| | | InspectMethod inspect_method = 14; // 检验方式 |
| | | double inspect_amount = 15; // 检验数量 |
| | | int32 status = 16; // 状态 |
| | | string submit_id = 17; // 提交人ID |
| | | double reject_amount = 18; // 退货数量 |
| | | double exchange_amount = 19; // 换货数量 |
| | | double repair_amount = 20; // 委外修数量 |
| | | int32 inspect_delete = 21; // 质量检验删除 1-未删除 2-已删除 |
| | | string purchase_order_id = 22; // 采购单号 |
| | | |
| | | } |
| | | |
| | | enum InspectType |
| | | { |
| | | DefaultInspectType = 0; |
| | | InspectTypeIncome = 1; // 来料检验 |
| | | InspectTypePurchase = 2; // 采购质检 |
| | | InspectTypeOutsource = 3; // 委外检验 |
| | | InspectTypeReject = 4; // 客户退货检验 |
| | | } |
| | | |
| | | enum MaterialType { |
| | | DefaultMaterialType = 0; |
| | | MaterialTypeRaw = 1; // 原材料 |
| | | MaterialTypeSemi =2; // 半成品 |
| | | MaterialTypeFinished =3; // 成品 |
| | | } |
| | | |
| | | enum InspectMethod |
| | | { |
| | | DefaultInspectMethod = 0; |
| | | InspectMethodAll = 1; // 全检 |
| | | InspectMethodSpot = 2; //抽检 |
| | | } |
| | | |
| | | |
| | | |
| | | message SendPurchaseInspectResponse { |
| | | int32 Code = 1; |
| | | string Msg = 2; |
| | | } |
| | | |
| | | |
| | | message GetInspectListRequest{ |
| | | int32 page = 1; |
| | | int32 pageSize = 2; |
| | | string keyword = 3; |
| | | } |
| | | |
| | | message GetInspectListResponse{ |
| | | int32 Code = 1; |
| | | string Msg = 2; |
| | | repeated QualityInspect List = 3; |
| | | int64 Total = 4; |
| | | } |
| | | |
New file |
| | |
| | | package qualityinspect |
| | | |
| | | import ( |
| | | "google.golang.org/grpc" |
| | | "google.golang.org/grpc/credentials/insecure" |
| | | "srm/global" |
| | | ) |
| | | |
| | | var ( |
| | | Conn *grpc.ClientConn |
| | | ) |
| | | |
| | | func InitConn() { |
| | | var err error |
| | | Conn, err = grpc.Dial(global.GVA_CONFIG.System.GrpcUrl, grpc.WithTransportCredentials(insecure.NewCredentials())) |
| | | if err != nil { |
| | | return |
| | | } |
| | | } |
| | | |
| | | func CloseConn() { |
| | | if Conn != nil { |
| | | Conn.Close() |
| | | } |
| | | } |
New file |
| | |
| | | // Code generated by protoc-gen-go. DO NOT EDIT. |
| | | // versions: |
| | | // protoc-gen-go v1.31.0 |
| | | // protoc v3.19.0 |
| | | // source: quality_inspect.proto |
| | | |
| | | package qualityinspect |
| | | |
| | | 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 InspectType int32 |
| | | |
| | | const ( |
| | | InspectType_DefaultInspectType InspectType = 0 |
| | | InspectType_InspectTypeIncome InspectType = 1 // 来料检验 |
| | | InspectType_InspectTypePurchase InspectType = 2 // 采购质检 |
| | | InspectType_InspectTypeOutsource InspectType = 3 // 委外检验 |
| | | InspectType_InspectTypeReject InspectType = 4 // 客户退货检验 |
| | | ) |
| | | |
| | | // Enum value maps for InspectType. |
| | | var ( |
| | | InspectType_name = map[int32]string{ |
| | | 0: "DefaultInspectType", |
| | | 1: "InspectTypeIncome", |
| | | 2: "InspectTypePurchase", |
| | | 3: "InspectTypeOutsource", |
| | | 4: "InspectTypeReject", |
| | | } |
| | | InspectType_value = map[string]int32{ |
| | | "DefaultInspectType": 0, |
| | | "InspectTypeIncome": 1, |
| | | "InspectTypePurchase": 2, |
| | | "InspectTypeOutsource": 3, |
| | | "InspectTypeReject": 4, |
| | | } |
| | | ) |
| | | |
| | | func (x InspectType) Enum() *InspectType { |
| | | p := new(InspectType) |
| | | *p = x |
| | | return p |
| | | } |
| | | |
| | | func (x InspectType) String() string { |
| | | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) |
| | | } |
| | | |
| | | func (InspectType) Descriptor() protoreflect.EnumDescriptor { |
| | | return file_quality_inspect_proto_enumTypes[0].Descriptor() |
| | | } |
| | | |
| | | func (InspectType) Type() protoreflect.EnumType { |
| | | return &file_quality_inspect_proto_enumTypes[0] |
| | | } |
| | | |
| | | func (x InspectType) Number() protoreflect.EnumNumber { |
| | | return protoreflect.EnumNumber(x) |
| | | } |
| | | |
| | | // Deprecated: Use InspectType.Descriptor instead. |
| | | func (InspectType) EnumDescriptor() ([]byte, []int) { |
| | | return file_quality_inspect_proto_rawDescGZIP(), []int{0} |
| | | } |
| | | |
| | | type MaterialType int32 |
| | | |
| | | const ( |
| | | MaterialType_DefaultMaterialType MaterialType = 0 |
| | | MaterialType_MaterialTypeRaw MaterialType = 1 // 原材料 |
| | | MaterialType_MaterialTypeSemi MaterialType = 2 // 半成品 |
| | | MaterialType_MaterialTypeFinished MaterialType = 3 // 成品 |
| | | ) |
| | | |
| | | // Enum value maps for MaterialType. |
| | | var ( |
| | | MaterialType_name = map[int32]string{ |
| | | 0: "DefaultMaterialType", |
| | | 1: "MaterialTypeRaw", |
| | | 2: "MaterialTypeSemi", |
| | | 3: "MaterialTypeFinished", |
| | | } |
| | | MaterialType_value = map[string]int32{ |
| | | "DefaultMaterialType": 0, |
| | | "MaterialTypeRaw": 1, |
| | | "MaterialTypeSemi": 2, |
| | | "MaterialTypeFinished": 3, |
| | | } |
| | | ) |
| | | |
| | | func (x MaterialType) Enum() *MaterialType { |
| | | p := new(MaterialType) |
| | | *p = x |
| | | return p |
| | | } |
| | | |
| | | func (x MaterialType) String() string { |
| | | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) |
| | | } |
| | | |
| | | func (MaterialType) Descriptor() protoreflect.EnumDescriptor { |
| | | return file_quality_inspect_proto_enumTypes[1].Descriptor() |
| | | } |
| | | |
| | | func (MaterialType) Type() protoreflect.EnumType { |
| | | return &file_quality_inspect_proto_enumTypes[1] |
| | | } |
| | | |
| | | func (x MaterialType) Number() protoreflect.EnumNumber { |
| | | return protoreflect.EnumNumber(x) |
| | | } |
| | | |
| | | // Deprecated: Use MaterialType.Descriptor instead. |
| | | func (MaterialType) EnumDescriptor() ([]byte, []int) { |
| | | return file_quality_inspect_proto_rawDescGZIP(), []int{1} |
| | | } |
| | | |
| | | type InspectMethod int32 |
| | | |
| | | const ( |
| | | InspectMethod_DefaultInspectMethod InspectMethod = 0 |
| | | InspectMethod_InspectMethodAll InspectMethod = 1 // 全检 |
| | | InspectMethod_InspectMethodSpot InspectMethod = 2 //抽检 |
| | | ) |
| | | |
| | | // Enum value maps for InspectMethod. |
| | | var ( |
| | | InspectMethod_name = map[int32]string{ |
| | | 0: "DefaultInspectMethod", |
| | | 1: "InspectMethodAll", |
| | | 2: "InspectMethodSpot", |
| | | } |
| | | InspectMethod_value = map[string]int32{ |
| | | "DefaultInspectMethod": 0, |
| | | "InspectMethodAll": 1, |
| | | "InspectMethodSpot": 2, |
| | | } |
| | | ) |
| | | |
| | | func (x InspectMethod) Enum() *InspectMethod { |
| | | p := new(InspectMethod) |
| | | *p = x |
| | | return p |
| | | } |
| | | |
| | | func (x InspectMethod) String() string { |
| | | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) |
| | | } |
| | | |
| | | func (InspectMethod) Descriptor() protoreflect.EnumDescriptor { |
| | | return file_quality_inspect_proto_enumTypes[2].Descriptor() |
| | | } |
| | | |
| | | func (InspectMethod) Type() protoreflect.EnumType { |
| | | return &file_quality_inspect_proto_enumTypes[2] |
| | | } |
| | | |
| | | func (x InspectMethod) Number() protoreflect.EnumNumber { |
| | | return protoreflect.EnumNumber(x) |
| | | } |
| | | |
| | | // Deprecated: Use InspectMethod.Descriptor instead. |
| | | func (InspectMethod) EnumDescriptor() ([]byte, []int) { |
| | | return file_quality_inspect_proto_rawDescGZIP(), []int{2} |
| | | } |
| | | |
| | | type SendPurchaseInspectRequest struct { |
| | | state protoimpl.MessageState |
| | | sizeCache protoimpl.SizeCache |
| | | unknownFields protoimpl.UnknownFields |
| | | |
| | | List []*QualityInspect `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` |
| | | } |
| | | |
| | | func (x *SendPurchaseInspectRequest) Reset() { |
| | | *x = SendPurchaseInspectRequest{} |
| | | if protoimpl.UnsafeEnabled { |
| | | mi := &file_quality_inspect_proto_msgTypes[0] |
| | | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| | | ms.StoreMessageInfo(mi) |
| | | } |
| | | } |
| | | |
| | | func (x *SendPurchaseInspectRequest) String() string { |
| | | return protoimpl.X.MessageStringOf(x) |
| | | } |
| | | |
| | | func (*SendPurchaseInspectRequest) ProtoMessage() {} |
| | | |
| | | func (x *SendPurchaseInspectRequest) ProtoReflect() protoreflect.Message { |
| | | mi := &file_quality_inspect_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 SendPurchaseInspectRequest.ProtoReflect.Descriptor instead. |
| | | func (*SendPurchaseInspectRequest) Descriptor() ([]byte, []int) { |
| | | return file_quality_inspect_proto_rawDescGZIP(), []int{0} |
| | | } |
| | | |
| | | func (x *SendPurchaseInspectRequest) GetList() []*QualityInspect { |
| | | if x != nil { |
| | | return x.List |
| | | } |
| | | return nil |
| | | } |
| | | |
| | | type QualityInspect struct { |
| | | state protoimpl.MessageState |
| | | sizeCache protoimpl.SizeCache |
| | | unknownFields protoimpl.UnknownFields |
| | | |
| | | Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //检验单id |
| | | InspectType InspectType `protobuf:"varint,2,opt,name=inspect_type,json=inspectType,proto3,enum=InspectType" json:"inspect_type,omitempty"` // 检验类型 |
| | | SendInspectorId string `protobuf:"bytes,3,opt,name=send_inspector_id,json=sendInspectorId,proto3" json:"send_inspector_id,omitempty"` // 送检员ID |
| | | MaterialType MaterialType `protobuf:"varint,4,opt,name=material_type,json=materialType,proto3,enum=MaterialType" json:"material_type,omitempty"` // 物料类型(数字) |
| | | MaterialName string `protobuf:"bytes,5,opt,name=material_name,json=materialName,proto3" json:"material_name,omitempty"` // 物料名称 |
| | | MaterialId string `protobuf:"bytes,6,opt,name=material_id,json=materialId,proto3" json:"material_id,omitempty"` // 物料编码 |
| | | MaterialTp string `protobuf:"bytes,7,opt,name=material_tp,json=materialTp,proto3" json:"material_tp,omitempty"` // 物料型号 |
| | | MaterialUnit string `protobuf:"bytes,8,opt,name=material_unit,json=materialUnit,proto3" json:"material_unit,omitempty"` // 物料单位 |
| | | Supplier string `protobuf:"bytes,9,opt,name=supplier,proto3" json:"supplier,omitempty"` // 供应商 |
| | | BatchId string `protobuf:"bytes,10,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` // 批号 |
| | | WarehouseName string `protobuf:"bytes,11,opt,name=warehouse_name,json=warehouseName,proto3" json:"warehouse_name,omitempty"` // 收料仓库 |
| | | WarehousePos string `protobuf:"bytes,12,opt,name=warehouse_pos,json=warehousePos,proto3" json:"warehouse_pos,omitempty"` // 仓位 |
| | | 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"` // 状态 |
| | | SubmitId string `protobuf:"bytes,17,opt,name=submit_id,json=submitId,proto3" json:"submit_id,omitempty"` // 提交人ID |
| | | 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"` // 换货数量 |
| | | RepairAmount float64 `protobuf:"fixed64,20,opt,name=repair_amount,json=repairAmount,proto3" json:"repair_amount,omitempty"` // 委外修数量 |
| | | InspectDelete int32 `protobuf:"varint,21,opt,name=inspect_delete,json=inspectDelete,proto3" json:"inspect_delete,omitempty"` // 质量检验删除 1-未删除 2-已删除 |
| | | PurchaseOrderId string `protobuf:"bytes,22,opt,name=purchase_order_id,json=purchaseOrderId,proto3" json:"purchase_order_id,omitempty"` // 采购单号 |
| | | } |
| | | |
| | | func (x *QualityInspect) Reset() { |
| | | *x = QualityInspect{} |
| | | if protoimpl.UnsafeEnabled { |
| | | mi := &file_quality_inspect_proto_msgTypes[1] |
| | | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| | | ms.StoreMessageInfo(mi) |
| | | } |
| | | } |
| | | |
| | | func (x *QualityInspect) String() string { |
| | | return protoimpl.X.MessageStringOf(x) |
| | | } |
| | | |
| | | func (*QualityInspect) ProtoMessage() {} |
| | | |
| | | func (x *QualityInspect) ProtoReflect() protoreflect.Message { |
| | | mi := &file_quality_inspect_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 QualityInspect.ProtoReflect.Descriptor instead. |
| | | func (*QualityInspect) Descriptor() ([]byte, []int) { |
| | | return file_quality_inspect_proto_rawDescGZIP(), []int{1} |
| | | } |
| | | |
| | | func (x *QualityInspect) GetId() string { |
| | | if x != nil { |
| | | return x.Id |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetInspectType() InspectType { |
| | | if x != nil { |
| | | return x.InspectType |
| | | } |
| | | return InspectType_DefaultInspectType |
| | | } |
| | | |
| | | func (x *QualityInspect) GetSendInspectorId() string { |
| | | if x != nil { |
| | | return x.SendInspectorId |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetMaterialType() MaterialType { |
| | | if x != nil { |
| | | return x.MaterialType |
| | | } |
| | | return MaterialType_DefaultMaterialType |
| | | } |
| | | |
| | | func (x *QualityInspect) GetMaterialName() string { |
| | | if x != nil { |
| | | return x.MaterialName |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetMaterialId() string { |
| | | if x != nil { |
| | | return x.MaterialId |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetMaterialTp() string { |
| | | if x != nil { |
| | | return x.MaterialTp |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetMaterialUnit() string { |
| | | if x != nil { |
| | | return x.MaterialUnit |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetSupplier() string { |
| | | if x != nil { |
| | | return x.Supplier |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetBatchId() string { |
| | | if x != nil { |
| | | return x.BatchId |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetWarehouseName() string { |
| | | if x != nil { |
| | | return x.WarehouseName |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetWarehousePos() string { |
| | | if x != nil { |
| | | return x.WarehousePos |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetReportAmount() float64 { |
| | | if x != nil { |
| | | return x.ReportAmount |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | func (x *QualityInspect) GetInspectMethod() InspectMethod { |
| | | if x != nil { |
| | | return x.InspectMethod |
| | | } |
| | | return InspectMethod_DefaultInspectMethod |
| | | } |
| | | |
| | | func (x *QualityInspect) GetInspectAmount() float64 { |
| | | if x != nil { |
| | | return x.InspectAmount |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | func (x *QualityInspect) GetStatus() int32 { |
| | | if x != nil { |
| | | return x.Status |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | func (x *QualityInspect) GetSubmitId() string { |
| | | if x != nil { |
| | | return x.SubmitId |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *QualityInspect) GetRejectAmount() float64 { |
| | | if x != nil { |
| | | return x.RejectAmount |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | func (x *QualityInspect) GetExchangeAmount() float64 { |
| | | if x != nil { |
| | | return x.ExchangeAmount |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | func (x *QualityInspect) GetRepairAmount() float64 { |
| | | if x != nil { |
| | | return x.RepairAmount |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | func (x *QualityInspect) GetInspectDelete() int32 { |
| | | if x != nil { |
| | | return x.InspectDelete |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | func (x *QualityInspect) GetPurchaseOrderId() string { |
| | | if x != nil { |
| | | return x.PurchaseOrderId |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | type SendPurchaseInspectResponse 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"` |
| | | } |
| | | |
| | | func (x *SendPurchaseInspectResponse) Reset() { |
| | | *x = SendPurchaseInspectResponse{} |
| | | if protoimpl.UnsafeEnabled { |
| | | mi := &file_quality_inspect_proto_msgTypes[2] |
| | | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| | | ms.StoreMessageInfo(mi) |
| | | } |
| | | } |
| | | |
| | | func (x *SendPurchaseInspectResponse) String() string { |
| | | return protoimpl.X.MessageStringOf(x) |
| | | } |
| | | |
| | | func (*SendPurchaseInspectResponse) ProtoMessage() {} |
| | | |
| | | func (x *SendPurchaseInspectResponse) ProtoReflect() protoreflect.Message { |
| | | mi := &file_quality_inspect_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 SendPurchaseInspectResponse.ProtoReflect.Descriptor instead. |
| | | func (*SendPurchaseInspectResponse) Descriptor() ([]byte, []int) { |
| | | return file_quality_inspect_proto_rawDescGZIP(), []int{2} |
| | | } |
| | | |
| | | func (x *SendPurchaseInspectResponse) GetCode() int32 { |
| | | if x != nil { |
| | | return x.Code |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | func (x *SendPurchaseInspectResponse) GetMsg() string { |
| | | if x != nil { |
| | | return x.Msg |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | type GetInspectListRequest 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"` |
| | | Keyword string `protobuf:"bytes,3,opt,name=keyword,proto3" json:"keyword,omitempty"` |
| | | } |
| | | |
| | | func (x *GetInspectListRequest) Reset() { |
| | | *x = GetInspectListRequest{} |
| | | if protoimpl.UnsafeEnabled { |
| | | mi := &file_quality_inspect_proto_msgTypes[3] |
| | | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| | | ms.StoreMessageInfo(mi) |
| | | } |
| | | } |
| | | |
| | | func (x *GetInspectListRequest) String() string { |
| | | return protoimpl.X.MessageStringOf(x) |
| | | } |
| | | |
| | | func (*GetInspectListRequest) ProtoMessage() {} |
| | | |
| | | func (x *GetInspectListRequest) ProtoReflect() protoreflect.Message { |
| | | mi := &file_quality_inspect_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 GetInspectListRequest.ProtoReflect.Descriptor instead. |
| | | func (*GetInspectListRequest) Descriptor() ([]byte, []int) { |
| | | return file_quality_inspect_proto_rawDescGZIP(), []int{3} |
| | | } |
| | | |
| | | func (x *GetInspectListRequest) GetPage() int32 { |
| | | if x != nil { |
| | | return x.Page |
| | | } |
| | | 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 "" |
| | | } |
| | | |
| | | type GetInspectListResponse 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 []*QualityInspect `protobuf:"bytes,3,rep,name=List,proto3" json:"List,omitempty"` |
| | | Total int64 `protobuf:"varint,4,opt,name=Total,proto3" json:"Total,omitempty"` |
| | | } |
| | | |
| | | func (x *GetInspectListResponse) Reset() { |
| | | *x = GetInspectListResponse{} |
| | | if protoimpl.UnsafeEnabled { |
| | | mi := &file_quality_inspect_proto_msgTypes[4] |
| | | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| | | ms.StoreMessageInfo(mi) |
| | | } |
| | | } |
| | | |
| | | func (x *GetInspectListResponse) String() string { |
| | | return protoimpl.X.MessageStringOf(x) |
| | | } |
| | | |
| | | func (*GetInspectListResponse) ProtoMessage() {} |
| | | |
| | | func (x *GetInspectListResponse) ProtoReflect() protoreflect.Message { |
| | | mi := &file_quality_inspect_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 GetInspectListResponse.ProtoReflect.Descriptor instead. |
| | | func (*GetInspectListResponse) Descriptor() ([]byte, []int) { |
| | | return file_quality_inspect_proto_rawDescGZIP(), []int{4} |
| | | } |
| | | |
| | | func (x *GetInspectListResponse) GetCode() int32 { |
| | | if x != nil { |
| | | return x.Code |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | func (x *GetInspectListResponse) GetMsg() string { |
| | | if x != nil { |
| | | return x.Msg |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func (x *GetInspectListResponse) GetList() []*QualityInspect { |
| | | if x != nil { |
| | | return x.List |
| | | } |
| | | return nil |
| | | } |
| | | |
| | | func (x *GetInspectListResponse) GetTotal() int64 { |
| | | if x != nil { |
| | | return x.Total |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | var File_quality_inspect_proto protoreflect.FileDescriptor |
| | | |
| | | var file_quality_inspect_proto_rawDesc = []byte{ |
| | | 0x0a, 0x15, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, |
| | | 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x41, 0x0a, 0x1a, 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, 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, |
| | | 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, |
| | | 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, |
| | | 0x65, 0x52, 0x0b, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, |
| | | 0x0a, 0x11, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x6f, 0x72, |
| | | 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x65, 0x6e, 0x64, 0x49, |
| | | 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x0d, 0x6d, 0x61, |
| | | 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, |
| | | 0x0e, 0x32, 0x0d, 0x2e, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, |
| | | 0x52, 0x0c, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x23, |
| | | 0x0a, 0x0d, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, |
| | | 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, |
| | | 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, |
| | | 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, |
| | | 0x61, 0x6c, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, |
| | | 0x5f, 0x74, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, 0x74, 0x65, 0x72, |
| | | 0x69, 0x61, 0x6c, 0x54, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, |
| | | 0x6c, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x61, |
| | | 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x75, |
| | | 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, |
| | | 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, |
| | | 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x49, |
| | | 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x6e, |
| | | 0x61, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x61, 0x72, 0x65, 0x68, |
| | | 0x6f, 0x75, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x77, 0x61, 0x72, 0x65, |
| | | 0x68, 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x70, 0x6f, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, |
| | | 0x0c, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x50, 0x6f, 0x73, 0x12, 0x23, 0x0a, |
| | | 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0d, |
| | | 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x6d, 0x6f, 0x75, |
| | | 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x0e, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x65, |
| | | 0x74, 0x68, 0x6f, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x49, 0x6e, 0x73, |
| | | 0x70, 0x65, 0x63, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x70, |
| | | 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, |
| | | 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, |
| | | 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x72, 0x65, |
| | | 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, |
| | | 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x13, 0x20, |
| | | 0x01, 0x28, 0x01, 0x52, 0x0e, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x6d, 0x6f, |
| | | 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x5f, 0x61, 0x6d, |
| | | 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x14, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x61, |
| | | 0x69, 0x72, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x73, 0x70, |
| | | 0x65, 0x63, 0x74, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x05, |
| | | 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, |
| | | 0x2a, 0x0a, 0x11, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x6f, 0x72, 0x64, 0x65, |
| | | 0x72, 0x5f, 0x69, 0x64, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x75, 0x72, 0x63, |
| | | 0x68, 0x61, 0x73, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x22, 0x43, 0x0a, 0x1b, 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, 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, |
| | | } |
| | | |
| | | var ( |
| | | file_quality_inspect_proto_rawDescOnce sync.Once |
| | | file_quality_inspect_proto_rawDescData = file_quality_inspect_proto_rawDesc |
| | | ) |
| | | |
| | | func file_quality_inspect_proto_rawDescGZIP() []byte { |
| | | file_quality_inspect_proto_rawDescOnce.Do(func() { |
| | | file_quality_inspect_proto_rawDescData = protoimpl.X.CompressGZIP(file_quality_inspect_proto_rawDescData) |
| | | }) |
| | | return file_quality_inspect_proto_rawDescData |
| | | } |
| | | |
| | | var file_quality_inspect_proto_enumTypes = make([]protoimpl.EnumInfo, 3) |
| | | 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 |
| | | } |
| | | var file_quality_inspect_proto_depIdxs = []int32{ |
| | | 4, // 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 |
| | | } |
| | | |
| | | func init() { file_quality_inspect_proto_init() } |
| | | func file_quality_inspect_proto_init() { |
| | | if File_quality_inspect_proto != nil { |
| | | return |
| | | } |
| | | if !protoimpl.UnsafeEnabled { |
| | | file_quality_inspect_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { |
| | | switch v := v.(*SendPurchaseInspectRequest); i { |
| | | case 0: |
| | | return &v.state |
| | | case 1: |
| | | return &v.sizeCache |
| | | case 2: |
| | | return &v.unknownFields |
| | | default: |
| | | return nil |
| | | } |
| | | } |
| | | file_quality_inspect_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { |
| | | switch v := v.(*QualityInspect); i { |
| | | case 0: |
| | | return &v.state |
| | | case 1: |
| | | return &v.sizeCache |
| | | case 2: |
| | | return &v.unknownFields |
| | | default: |
| | | return nil |
| | | } |
| | | } |
| | | file_quality_inspect_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { |
| | | switch v := v.(*SendPurchaseInspectResponse); i { |
| | | case 0: |
| | | return &v.state |
| | | case 1: |
| | | return &v.sizeCache |
| | | case 2: |
| | | return &v.unknownFields |
| | | default: |
| | | return nil |
| | | } |
| | | } |
| | | file_quality_inspect_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { |
| | | switch v := v.(*GetInspectListRequest); i { |
| | | case 0: |
| | | return &v.state |
| | | case 1: |
| | | return &v.sizeCache |
| | | case 2: |
| | | return &v.unknownFields |
| | | default: |
| | | return nil |
| | | } |
| | | } |
| | | file_quality_inspect_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { |
| | | switch v := v.(*GetInspectListResponse); 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_quality_inspect_proto_rawDesc, |
| | | NumEnums: 3, |
| | | NumMessages: 5, |
| | | NumExtensions: 0, |
| | | NumServices: 1, |
| | | }, |
| | | GoTypes: file_quality_inspect_proto_goTypes, |
| | | DependencyIndexes: file_quality_inspect_proto_depIdxs, |
| | | EnumInfos: file_quality_inspect_proto_enumTypes, |
| | | MessageInfos: file_quality_inspect_proto_msgTypes, |
| | | }.Build() |
| | | File_quality_inspect_proto = out.File |
| | | file_quality_inspect_proto_rawDesc = nil |
| | | file_quality_inspect_proto_goTypes = nil |
| | | file_quality_inspect_proto_depIdxs = nil |
| | | } |
New file |
| | |
| | | // Code generated by protoc-gen-go-grpc. DO NOT EDIT. |
| | | // versions: |
| | | // - protoc-gen-go-grpc v1.3.0 |
| | | // - protoc v3.19.0 |
| | | // source: quality_inspect.proto |
| | | |
| | | package qualityinspect |
| | | |
| | | 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 ( |
| | | QualityInspectService_SendPurchaseInspect_FullMethodName = "/QualityInspectService/SendPurchaseInspect" |
| | | QualityInspectService_GetInspectList_FullMethodName = "/QualityInspectService/GetInspectList" |
| | | ) |
| | | |
| | | // QualityInspectServiceClient is the client API for QualityInspectService 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 QualityInspectServiceClient interface { |
| | | SendPurchaseInspect(ctx context.Context, in *SendPurchaseInspectRequest, opts ...grpc.CallOption) (*SendPurchaseInspectResponse, error) |
| | | GetInspectList(ctx context.Context, in *GetInspectListRequest, opts ...grpc.CallOption) (*GetInspectListResponse, error) |
| | | } |
| | | |
| | | type qualityInspectServiceClient struct { |
| | | cc grpc.ClientConnInterface |
| | | } |
| | | |
| | | func NewQualityInspectServiceClient(cc grpc.ClientConnInterface) QualityInspectServiceClient { |
| | | return &qualityInspectServiceClient{cc} |
| | | } |
| | | |
| | | func (c *qualityInspectServiceClient) SendPurchaseInspect(ctx context.Context, in *SendPurchaseInspectRequest, opts ...grpc.CallOption) (*SendPurchaseInspectResponse, error) { |
| | | out := new(SendPurchaseInspectResponse) |
| | | err := c.cc.Invoke(ctx, QualityInspectService_SendPurchaseInspect_FullMethodName, in, out, opts...) |
| | | if err != nil { |
| | | return nil, err |
| | | } |
| | | return out, nil |
| | | } |
| | | |
| | | func (c *qualityInspectServiceClient) GetInspectList(ctx context.Context, in *GetInspectListRequest, opts ...grpc.CallOption) (*GetInspectListResponse, error) { |
| | | out := new(GetInspectListResponse) |
| | | err := c.cc.Invoke(ctx, QualityInspectService_GetInspectList_FullMethodName, in, out, opts...) |
| | | if err != nil { |
| | | return nil, err |
| | | } |
| | | return out, nil |
| | | } |
| | | |
| | | // QualityInspectServiceServer is the server API for QualityInspectService service. |
| | | // All implementations must embed UnimplementedQualityInspectServiceServer |
| | | // for forward compatibility |
| | | type QualityInspectServiceServer interface { |
| | | SendPurchaseInspect(context.Context, *SendPurchaseInspectRequest) (*SendPurchaseInspectResponse, error) |
| | | GetInspectList(context.Context, *GetInspectListRequest) (*GetInspectListResponse, error) |
| | | mustEmbedUnimplementedQualityInspectServiceServer() |
| | | } |
| | | |
| | | // UnimplementedQualityInspectServiceServer must be embedded to have forward compatible implementations. |
| | | type UnimplementedQualityInspectServiceServer struct { |
| | | } |
| | | |
| | | func (UnimplementedQualityInspectServiceServer) SendPurchaseInspect(context.Context, *SendPurchaseInspectRequest) (*SendPurchaseInspectResponse, error) { |
| | | return nil, status.Errorf(codes.Unimplemented, "method SendPurchaseInspect not implemented") |
| | | } |
| | | func (UnimplementedQualityInspectServiceServer) GetInspectList(context.Context, *GetInspectListRequest) (*GetInspectListResponse, error) { |
| | | return nil, status.Errorf(codes.Unimplemented, "method GetInspectList not implemented") |
| | | } |
| | | func (UnimplementedQualityInspectServiceServer) mustEmbedUnimplementedQualityInspectServiceServer() {} |
| | | |
| | | // UnsafeQualityInspectServiceServer may be embedded to opt out of forward compatibility for this service. |
| | | // Use of this interface is not recommended, as added methods to QualityInspectServiceServer will |
| | | // result in compilation errors. |
| | | type UnsafeQualityInspectServiceServer interface { |
| | | mustEmbedUnimplementedQualityInspectServiceServer() |
| | | } |
| | | |
| | | func RegisterQualityInspectServiceServer(s grpc.ServiceRegistrar, srv QualityInspectServiceServer) { |
| | | s.RegisterService(&QualityInspectService_ServiceDesc, srv) |
| | | } |
| | | |
| | | func _QualityInspectService_SendPurchaseInspect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
| | | in := new(SendPurchaseInspectRequest) |
| | | if err := dec(in); err != nil { |
| | | return nil, err |
| | | } |
| | | if interceptor == nil { |
| | | return srv.(QualityInspectServiceServer).SendPurchaseInspect(ctx, in) |
| | | } |
| | | info := &grpc.UnaryServerInfo{ |
| | | Server: srv, |
| | | FullMethod: QualityInspectService_SendPurchaseInspect_FullMethodName, |
| | | } |
| | | handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
| | | return srv.(QualityInspectServiceServer).SendPurchaseInspect(ctx, req.(*SendPurchaseInspectRequest)) |
| | | } |
| | | return interceptor(ctx, in, info, handler) |
| | | } |
| | | |
| | | func _QualityInspectService_GetInspectList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
| | | in := new(GetInspectListRequest) |
| | | if err := dec(in); err != nil { |
| | | return nil, err |
| | | } |
| | | if interceptor == nil { |
| | | return srv.(QualityInspectServiceServer).GetInspectList(ctx, in) |
| | | } |
| | | info := &grpc.UnaryServerInfo{ |
| | | Server: srv, |
| | | FullMethod: QualityInspectService_GetInspectList_FullMethodName, |
| | | } |
| | | handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
| | | return srv.(QualityInspectServiceServer).GetInspectList(ctx, req.(*GetInspectListRequest)) |
| | | } |
| | | return interceptor(ctx, in, info, handler) |
| | | } |
| | | |
| | | // QualityInspectService_ServiceDesc is the grpc.ServiceDesc for QualityInspectService service. |
| | | // It's only intended for direct use with grpc.RegisterService, |
| | | // and not to be introspected or modified (even as a copy) |
| | | var QualityInspectService_ServiceDesc = grpc.ServiceDesc{ |
| | | ServiceName: "QualityInspectService", |
| | | HandlerType: (*QualityInspectServiceServer)(nil), |
| | | Methods: []grpc.MethodDesc{ |
| | | { |
| | | MethodName: "SendPurchaseInspect", |
| | | Handler: _QualityInspectService_SendPurchaseInspect_Handler, |
| | | }, |
| | | { |
| | | MethodName: "GetInspectList", |
| | | Handler: _QualityInspectService_GetInspectList_Handler, |
| | | }, |
| | | }, |
| | | Streams: []grpc.StreamDesc{}, |
| | | Metadata: "quality_inspect.proto", |
| | | } |
| | |
| | | purchaseRouter.DELETE("purchase/:id", PurchaseApi.DeletePurchase) // 删除采购单 |
| | | purchaseRouterWithoutRecord.GET("purchase/:id", PurchaseApi.GetPurchase) // 获取单一采购单信息 |
| | | purchaseRouterWithoutRecord.GET("purchaseList", PurchaseApi.GetPurchaseList) // 获取采购单列表 |
| | | purchaseRouterWithoutRecord.POST("submit/:id", PurchaseApi.Submit) // 提交采购单 |
| | | } |
| | | } |
| | |
| | | package purchase |
| | | |
| | | import ( |
| | | "context" |
| | | "github.com/spf13/cast" |
| | | "gorm.io/gorm" |
| | | "srm/global" |
| | | "srm/model/common/request" |
| | | "srm/model/purchase" |
| | | purchaserequest "srm/model/purchase/request" |
| | | "srm/proto/qualityinspect" |
| | | "srm/service/test" |
| | | ) |
| | | |
| | | type PurchaseService struct{} |
| | |
| | | //@param: params *purchaserequest.AddPurchase |
| | | //@return: err error |
| | | |
| | | func (exa *PurchaseService) CreatePurchase(params purchaserequest.AddPurchase) (err error) { |
| | | func (slf *PurchaseService) CreatePurchase(params purchaserequest.AddPurchase) (err error) { |
| | | err = global.GVA_DB.Transaction(func(tx *gorm.DB) error { |
| | | err = global.GVA_DB.Create(¶ms.Purchase).Error |
| | | if err != nil { |
| | |
| | | //@param: id uint |
| | | //@return: err error |
| | | |
| | | func (exa *PurchaseService) DeletePurchase(id uint) (err error) { |
| | | func (slf *PurchaseService) DeletePurchase(id uint) (err error) { |
| | | err = global.GVA_DB.Transaction(func(tx *gorm.DB) error { |
| | | err = global.GVA_DB.Where("id = ?", id).Delete(&purchase.Purchase{}).Error |
| | | if err != nil { |
| | |
| | | //@param: params *purchaserequest.AddPurchase |
| | | //@return: err error |
| | | |
| | | func (exa *PurchaseService) UpdatePurchase(params *purchaserequest.AddPurchase) (err error) { |
| | | func (slf *PurchaseService) UpdatePurchase(params *purchaserequest.AddPurchase) (err error) { |
| | | err = global.GVA_DB.Transaction(func(tx *gorm.DB) error { |
| | | err = global.GVA_DB.Updates(params.Purchase).Error |
| | | if err != nil { |
| | |
| | | //@param: id uint |
| | | //@return: purchase model.Purchase, err error |
| | | |
| | | func (exa *PurchaseService) GetPurchase(id uint) (purchase purchase.Purchase, err error) { |
| | | err = global.GVA_DB.Where("id = ?", id).First(&purchase).Error |
| | | func (slf *PurchaseService) GetPurchase(id uint) (purchase purchase.Purchase, err error) { |
| | | err = global.GVA_DB.Where("id = ?", id).Preload("Supplier").First(&purchase).Error |
| | | return |
| | | } |
| | | |
| | |
| | | //@param: info request.PageInfo |
| | | //@return: list interface{}, total int64, err error |
| | | |
| | | func (exa *PurchaseService) GetPurchaseList(info request.PageInfo) (list interface{}, total int64, err error) { |
| | | func (slf *PurchaseService) GetPurchaseList(info request.PageInfo) (list interface{}, total int64, err error) { |
| | | limit := info.PageSize |
| | | offset := info.PageSize * (info.Page - 1) |
| | | db := global.GVA_DB.Model(&purchase.Purchase{}) |
| | |
| | | //@param: purchaseId int |
| | | //@return: list interface{}, err error |
| | | |
| | | func (exa *PurchaseService) GetPurchaseProductList(purchaseId uint) (list []*purchase.PurchaseProducts, err error) { |
| | | func (slf *PurchaseService) GetPurchaseProductList(purchaseId uint) (list []*purchase.PurchaseProducts, err error) { |
| | | db := global.GVA_DB.Model(&purchase.PurchaseProducts{}) |
| | | list = make([]*purchase.PurchaseProducts, 0) |
| | | err = db.Where("purchase_id = ?", purchaseId).Find(&list).Error |
| | |
| | | //@param: id uint |
| | | //@return: err error |
| | | |
| | | func (exa *PurchaseService) Submit(id uint) (err error) { |
| | | func (slf *PurchaseService) Submit(id uint) (err error) { |
| | | |
| | | purchaseData, err := slf.GetPurchase(id) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | var targetStatus purchase.OrderStatus |
| | | switch purchaseData.Status { |
| | | case purchase.OrderStatusConfirmed: |
| | | targetStatus = purchase.OrderStatusReceived |
| | | case purchase.OrderStatusReceived: |
| | | targetStatus = purchase.OrderStatusStored |
| | | case purchase.OrderStatusStored: |
| | | targetStatus = purchase.OrderStatusCompleted |
| | | } |
| | | err = global.GVA_DB.Transaction(func(tx *gorm.DB) error { |
| | | err = global.GVA_DB.Where("id = ?", id).Model(&purchase.Purchase{}).Updates(map[string]interface{}{"status": 1}).Error |
| | | err = global.GVA_DB.Where("id = ?", id).Model(&purchase.Purchase{}).Updates(map[string]interface{}{"status": targetStatus}).Error |
| | | if err != nil { |
| | | return err |
| | | } |
| | | return global.GVA_DB.Where("purchase_id = ?", id).Delete(&purchase.PurchaseProducts{}).Error |
| | | |
| | | switch targetStatus { |
| | | case purchase.OrderStatusConfirmed: |
| | | return SendInspect(purchaseData) |
| | | case purchase.OrderStatusReceived: |
| | | case purchase.OrderStatusStored: |
| | | } |
| | | return nil |
| | | }) |
| | | return err |
| | | } |
| | | |
| | | func SendInspect(record purchase.Purchase) error { |
| | | productList, err := NewPurchaseService().GetPurchaseProductList(record.ID) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | productIds := make([]uint, 0, len(productList)) |
| | | for _, product := range productList { |
| | | productIds = append(productIds, uint(product.ProductId)) |
| | | } |
| | | productService := &test.ProductService{} |
| | | _, productMap, err := productService.GetProducts(productIds) |
| | | |
| | | inspectOrders := make([]*qualityinspect.QualityInspect, 0, len(productList)) |
| | | for _, productItem := range productList { |
| | | product := productMap[uint(productItem.ProductId)] |
| | | if product == nil { |
| | | 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(), |
| | | } |
| | | inspectOrders = append(inspectOrders, inspectOrder) |
| | | } |
| | | inspectRequest := qualityinspect.SendPurchaseInspectRequest{List: inspectOrders} |
| | | _, err = qualityinspect.NewQualityInspectServiceClient(qualityinspect.Conn).SendPurchaseInspect(context.Background(), &inspectRequest) |
| | | return err |
| | | } |
| | |
| | | err = db.Limit(limit).Offset(offset).Preload("Supplier").Find(&ps).Error |
| | | return ps, total, err |
| | | } |
| | | |
| | | // GetProducts 根据ids获取Product记录 |
| | | func (pService *ProductService) GetProducts(ids []uint) (p []*test.Product, m map[uint]*test.Product, err error) { |
| | | err = global.GVA_DB.Where("id in ?", ids).Find(&p).Error |
| | | if err != nil { |
| | | return |
| | | } |
| | | m = make(map[uint]*test.Product, len(p)) |
| | | for _, product := range p { |
| | | m[product.ID] = product |
| | | } |
| | | return |
| | | } |