liujiandao
2024-03-14 c28ff1e6df57900a5d2fced3becae8ddc3313608
aps在srm创建采购单
4个文件已修改
357 ■■■■ 已修改文件
proto/purchase_wms.proto 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proto/purchase_wms/purchase_wms.pb.go 216 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proto/purchase_wms/purchase_wms_grpc.pb.go 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proto/purchase_wms/server.go 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proto/purchase_wms.proto
@@ -11,6 +11,7 @@
  rpc ExistSupplier(ExistSupplierRequest) returns (ExistSupplierResponse) {}
  rpc SrmGetWarehouseInfo(SrmGetWarehouseInfoRequest) returns (SrmGetWarehouseInfoResponse) {}
  rpc SrmGetOperationInfo(SrmGetOperationInfoRequest) returns (SrmGetOperationInfoResponse) {}
  rpc CreatePurchaseByAps(CreatePurchaseByApsRequest) returns (CreatePurchaseByWmsResponse) {}
}
//------------------------------------------PurchaseToWms--------------------------------
@@ -137,3 +138,10 @@
message SrmGetOperationInfoResponse{
  repeated SrmOperation operations = 1;
}
//--------------------------------------------------CreatePurchaseByAps---------------------------------------
message CreatePurchaseByApsRequest {
  string sourceOrder = 1;
  repeated CreatePurchaseByWmsRequest req = 2;
}
proto/purchase_wms/purchase_wms.pb.go
@@ -1232,6 +1232,61 @@
    return nil
}
type CreatePurchaseByApsRequest struct {
    state         protoimpl.MessageState
    sizeCache     protoimpl.SizeCache
    unknownFields protoimpl.UnknownFields
    SourceOrder string                        `protobuf:"bytes,1,opt,name=sourceOrder,proto3" json:"sourceOrder,omitempty"`
    Req         []*CreatePurchaseByWmsRequest `protobuf:"bytes,2,rep,name=req,proto3" json:"req,omitempty"`
}
func (x *CreatePurchaseByApsRequest) Reset() {
    *x = CreatePurchaseByApsRequest{}
    if protoimpl.UnsafeEnabled {
        mi := &file_purchase_wms_proto_msgTypes[21]
        ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
        ms.StoreMessageInfo(mi)
    }
}
func (x *CreatePurchaseByApsRequest) String() string {
    return protoimpl.X.MessageStringOf(x)
}
func (*CreatePurchaseByApsRequest) ProtoMessage() {}
func (x *CreatePurchaseByApsRequest) ProtoReflect() protoreflect.Message {
    mi := &file_purchase_wms_proto_msgTypes[21]
    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 CreatePurchaseByApsRequest.ProtoReflect.Descriptor instead.
func (*CreatePurchaseByApsRequest) Descriptor() ([]byte, []int) {
    return file_purchase_wms_proto_rawDescGZIP(), []int{21}
}
func (x *CreatePurchaseByApsRequest) GetSourceOrder() string {
    if x != nil {
        return x.SourceOrder
    }
    return ""
}
func (x *CreatePurchaseByApsRequest) GetReq() []*CreatePurchaseByWmsRequest {
    if x != nil {
        return x.Req
    }
    return nil
}
var File_purchase_wms_proto protoreflect.FileDescriptor
var file_purchase_wms_proto_rawDesc = []byte{
@@ -1359,50 +1414,63 @@
    0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x0a,
    0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
    0x32, 0x0d, 0x2e, 0x53, 0x72, 0x6d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
    0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0x97, 0x05, 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,
    0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x6d, 0x0a, 0x1a, 0x43,
    0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x41,
    0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x6f, 0x75,
    0x72, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
    0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x03, 0x72,
    0x65, 0x71, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 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, 0x52, 0x03, 0x72, 0x65, 0x71, 0x32, 0xeb, 0x05, 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, 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, 0x12, 0x40, 0x0a, 0x0d, 0x45,
    0x78, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x45,
    0x78, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
    0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c,
    0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a,
    0x13, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65,
    0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x2e, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72,
    0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
    0x74, 0x1a, 0x1c, 0x2e, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f,
    0x75, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
    0x00, 0x12, 0x52, 0x0a, 0x13, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61,
    0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x2e, 0x53, 0x72, 0x6d, 0x47, 0x65,
    0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
    0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x4f, 0x70,
    0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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,
    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, 0x12, 0x40, 0x0a, 0x0d, 0x45, 0x78,
    0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x45, 0x78,
    0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
    0x73, 0x74, 0x1a, 0x16, 0x2e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69,
    0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13,
    0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x49,
    0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x2e, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65,
    0x68, 0x6f, 0x75, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
    0x1a, 0x1c, 0x2e, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75,
    0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
    0x12, 0x52, 0x0a, 0x13, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
    0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x2e, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74,
    0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
    0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x53, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x65,
    0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 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, 0x41, 0x70, 0x73, 0x12, 0x1b, 0x2e, 0x43, 0x72,
    0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x41, 0x70,
    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, 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 (
@@ -1417,7 +1485,7 @@
    return file_purchase_wms_proto_rawDescData
}
var file_purchase_wms_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
var file_purchase_wms_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_purchase_wms_proto_goTypes = []interface{}{
    (*PurchaseProduct)(nil),                    // 0: PurchaseProduct
    (*PurchaseToWmsRequest)(nil),               // 1: PurchaseToWmsRequest
@@ -1440,6 +1508,7 @@
    (*SrmGetOperationInfoRequest)(nil),         // 18: SrmGetOperationInfoRequest
    (*SrmOperation)(nil),                       // 19: SrmOperation
    (*SrmGetOperationInfoResponse)(nil),        // 20: SrmGetOperationInfoResponse
    (*CreatePurchaseByApsRequest)(nil),         // 21: CreatePurchaseByApsRequest
}
var file_purchase_wms_proto_depIdxs = []int32{
    0,  // 0: PurchaseToWmsRequest.Product:type_name -> PurchaseProduct
@@ -1447,27 +1516,30 @@
    11, // 2: GetPurchaseInfoResponse.Infos:type_name -> PurchaseInfo
    16, // 3: SrmGetWarehouseInfoResponse.info:type_name -> SrmWarehouseInfo
    19, // 4: SrmGetOperationInfoResponse.operations:type_name -> SrmOperation
    1,  // 5: PurchaseService.PurchaseToWms:input_type -> PurchaseToWmsRequest
    3,  // 6: PurchaseService.UpdatePurchaseStatus:input_type -> UpdatePurchaseStatusRequest
    5,  // 7: PurchaseService.GetSupplierListByProductId:input_type -> GetSupplierListByProductIdRequest
    8,  // 8: PurchaseService.CreatePurchaseByWms:input_type -> CreatePurchaseByWmsRequest
    10, // 9: PurchaseService.GetPurchaseInfo:input_type -> GetPurchaseInfoRequest
    13, // 10: PurchaseService.ExistSupplier:input_type -> ExistSupplierRequest
    15, // 11: PurchaseService.SrmGetWarehouseInfo:input_type -> SrmGetWarehouseInfoRequest
    18, // 12: PurchaseService.SrmGetOperationInfo:input_type -> SrmGetOperationInfoRequest
    2,  // 13: PurchaseService.PurchaseToWms:output_type -> PurchaseToWmsResponse
    4,  // 14: PurchaseService.UpdatePurchaseStatus:output_type -> UpdatePurchaseStatusResponse
    7,  // 15: PurchaseService.GetSupplierListByProductId:output_type -> GetSupplierListByProductIdResponse
    9,  // 16: PurchaseService.CreatePurchaseByWms:output_type -> CreatePurchaseByWmsResponse
    12, // 17: PurchaseService.GetPurchaseInfo:output_type -> GetPurchaseInfoResponse
    14, // 18: PurchaseService.ExistSupplier:output_type -> ExistSupplierResponse
    17, // 19: PurchaseService.SrmGetWarehouseInfo:output_type -> SrmGetWarehouseInfoResponse
    20, // 20: PurchaseService.SrmGetOperationInfo:output_type -> SrmGetOperationInfoResponse
    13, // [13:21] is the sub-list for method output_type
    5,  // [5:13] 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
    8,  // 5: CreatePurchaseByApsRequest.req:type_name -> CreatePurchaseByWmsRequest
    1,  // 6: PurchaseService.PurchaseToWms:input_type -> PurchaseToWmsRequest
    3,  // 7: PurchaseService.UpdatePurchaseStatus:input_type -> UpdatePurchaseStatusRequest
    5,  // 8: PurchaseService.GetSupplierListByProductId:input_type -> GetSupplierListByProductIdRequest
    8,  // 9: PurchaseService.CreatePurchaseByWms:input_type -> CreatePurchaseByWmsRequest
    10, // 10: PurchaseService.GetPurchaseInfo:input_type -> GetPurchaseInfoRequest
    13, // 11: PurchaseService.ExistSupplier:input_type -> ExistSupplierRequest
    15, // 12: PurchaseService.SrmGetWarehouseInfo:input_type -> SrmGetWarehouseInfoRequest
    18, // 13: PurchaseService.SrmGetOperationInfo:input_type -> SrmGetOperationInfoRequest
    21, // 14: PurchaseService.CreatePurchaseByAps:input_type -> CreatePurchaseByApsRequest
    2,  // 15: PurchaseService.PurchaseToWms:output_type -> PurchaseToWmsResponse
    4,  // 16: PurchaseService.UpdatePurchaseStatus:output_type -> UpdatePurchaseStatusResponse
    7,  // 17: PurchaseService.GetSupplierListByProductId:output_type -> GetSupplierListByProductIdResponse
    9,  // 18: PurchaseService.CreatePurchaseByWms:output_type -> CreatePurchaseByWmsResponse
    12, // 19: PurchaseService.GetPurchaseInfo:output_type -> GetPurchaseInfoResponse
    14, // 20: PurchaseService.ExistSupplier:output_type -> ExistSupplierResponse
    17, // 21: PurchaseService.SrmGetWarehouseInfo:output_type -> SrmGetWarehouseInfoResponse
    20, // 22: PurchaseService.SrmGetOperationInfo:output_type -> SrmGetOperationInfoResponse
    9,  // 23: PurchaseService.CreatePurchaseByAps:output_type -> CreatePurchaseByWmsResponse
    15, // [15:24] is the sub-list for method output_type
    6,  // [6:15] is the sub-list for method input_type
    6,  // [6:6] is the sub-list for extension type_name
    6,  // [6:6] is the sub-list for extension extendee
    0,  // [0:6] is the sub-list for field type_name
}
func init() { file_purchase_wms_proto_init() }
@@ -1728,6 +1800,18 @@
                return nil
            }
        }
        file_purchase_wms_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
            switch v := v.(*CreatePurchaseByApsRequest); 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{
@@ -1735,7 +1819,7 @@
            GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
            RawDescriptor: file_purchase_wms_proto_rawDesc,
            NumEnums:      0,
            NumMessages:   21,
            NumMessages:   22,
            NumExtensions: 0,
            NumServices:   1,
        },
proto/purchase_wms/purchase_wms_grpc.pb.go
@@ -26,6 +26,7 @@
    ExistSupplier(ctx context.Context, in *ExistSupplierRequest, opts ...grpc.CallOption) (*ExistSupplierResponse, error)
    SrmGetWarehouseInfo(ctx context.Context, in *SrmGetWarehouseInfoRequest, opts ...grpc.CallOption) (*SrmGetWarehouseInfoResponse, error)
    SrmGetOperationInfo(ctx context.Context, in *SrmGetOperationInfoRequest, opts ...grpc.CallOption) (*SrmGetOperationInfoResponse, error)
    CreatePurchaseByAps(ctx context.Context, in *CreatePurchaseByApsRequest, opts ...grpc.CallOption) (*CreatePurchaseByWmsResponse, error)
}
type purchaseServiceClient struct {
@@ -108,6 +109,15 @@
    return out, nil
}
func (c *purchaseServiceClient) CreatePurchaseByAps(ctx context.Context, in *CreatePurchaseByApsRequest, opts ...grpc.CallOption) (*CreatePurchaseByWmsResponse, error) {
    out := new(CreatePurchaseByWmsResponse)
    err := c.cc.Invoke(ctx, "/PurchaseService/CreatePurchaseByAps", in, out, opts...)
    if err != nil {
        return nil, err
    }
    return out, nil
}
// PurchaseServiceServer is the server API for PurchaseService service.
// All implementations must embed UnimplementedPurchaseServiceServer
// for forward compatibility
@@ -120,6 +130,7 @@
    ExistSupplier(context.Context, *ExistSupplierRequest) (*ExistSupplierResponse, error)
    SrmGetWarehouseInfo(context.Context, *SrmGetWarehouseInfoRequest) (*SrmGetWarehouseInfoResponse, error)
    SrmGetOperationInfo(context.Context, *SrmGetOperationInfoRequest) (*SrmGetOperationInfoResponse, error)
    CreatePurchaseByAps(context.Context, *CreatePurchaseByApsRequest) (*CreatePurchaseByWmsResponse, error)
    mustEmbedUnimplementedPurchaseServiceServer()
}
@@ -150,6 +161,9 @@
}
func (UnimplementedPurchaseServiceServer) SrmGetOperationInfo(context.Context, *SrmGetOperationInfoRequest) (*SrmGetOperationInfoResponse, error) {
    return nil, status.Errorf(codes.Unimplemented, "method SrmGetOperationInfo not implemented")
}
func (UnimplementedPurchaseServiceServer) CreatePurchaseByAps(context.Context, *CreatePurchaseByApsRequest) (*CreatePurchaseByWmsResponse, error) {
    return nil, status.Errorf(codes.Unimplemented, "method CreatePurchaseByAps not implemented")
}
func (UnimplementedPurchaseServiceServer) mustEmbedUnimplementedPurchaseServiceServer() {}
@@ -308,6 +322,24 @@
    return interceptor(ctx, in, info, handler)
}
func _PurchaseService_CreatePurchaseByAps_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
    in := new(CreatePurchaseByApsRequest)
    if err := dec(in); err != nil {
        return nil, err
    }
    if interceptor == nil {
        return srv.(PurchaseServiceServer).CreatePurchaseByAps(ctx, in)
    }
    info := &grpc.UnaryServerInfo{
        Server:     srv,
        FullMethod: "/PurchaseService/CreatePurchaseByAps",
    }
    handler := func(ctx context.Context, req interface{}) (interface{}, error) {
        return srv.(PurchaseServiceServer).CreatePurchaseByAps(ctx, req.(*CreatePurchaseByApsRequest))
    }
    return interceptor(ctx, in, info, handler)
}
// PurchaseService_ServiceDesc is the grpc.ServiceDesc for PurchaseService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -347,6 +379,10 @@
            MethodName: "SrmGetOperationInfo",
            Handler:    _PurchaseService_SrmGetOperationInfo_Handler,
        },
        {
            MethodName: "CreatePurchaseByAps",
            Handler:    _PurchaseService_CreatePurchaseByAps_Handler,
        },
    },
    Streams:  []grpc.StreamDesc{},
    Metadata: "purchase_wms.proto",
proto/purchase_wms/server.go
@@ -181,3 +181,100 @@
    resp.Exist = true
    return resp, nil
}
func (s *Server) CreatePurchaseByAps(ctx context.Context, req *CreatePurchaseByApsRequest) (*CreatePurchaseByWmsResponse, error) {
    if len(req.Req) == 0 {
        return nil, errors.New("产品id为空")
    }
    productIds := make([]string, 0)
    amount := int64(0)
    numMap := make(map[string]int64)
    for _, request := range req.Req {
        productIds = append(productIds, request.ProductId)
        numMap[request.ProductId] = request.Amount
        amount += request.Amount
    }
    var products []test.SupplierMaterial
    var newProducts []test.SupplierMaterial
    err := global.GVA_DB.Model(&test.SupplierMaterial{}).Where("number in (?)", productIds).Order("id desc").Find(&products).Error
    if err != nil {
        return nil, err
    }
    for _, id := range productIds {
        flag := false
        for _, product := range products {
            if id == product.Number {
                newProducts = append(newProducts, product)
                flag = true
                break
            }
        }
        if !flag {
            var material test.Material
            var product test.SupplierMaterial
            err = global.GVA_DB.Model(&test.Material{}).Where("id = ?", id).First(&material).Error
            if err != nil {
                return nil, err
            }
            product.Name = material.Name
            product.Number = material.ID
            product.Unit = material.Unit
            product.PurchasePrice = material.PurchasePrice.InexactFloat64()
            product.Specifications = material.Specs
            product.ModelNumber = material.Type
            err = global.GVA_DB.Create(&product).Error
            if err != nil {
                return nil, err
            }
            newProducts = append(newProducts, product)
        }
    }
    //采购单
    var purchaseRecord purchase.Purchase
    purchaseRecord.OrderSource = "APS推送"
    purchaseRecord.Name = "APS采购"
    purchaseRecord.ID = 0
    purchaseRecord.Status = purchase.OrderStatusConfirmed
    purchaseRecord.HandledBy = "admin"
    purchaseRecord.Creator = "admin"
    purchaseRecord.Number = fmt.Sprintf("CG%v", time.Now().Unix())
    purchaseRecord.Principal = "admin"
    purchaseRecord.OrderType = "采购订单"
    purchaseRecord.Quantity = decimal.NewFromInt(amount)
    purchaseRecord.SourceOrder = req.SourceOrder
    price := float64(0)
    var pps []purchase.PurchaseProducts
    for _, product := range newProducts {
        //产品
        var pp purchase.PurchaseProducts
        pp.ProductId = int(product.ID)
        pp.Amount = decimal.NewFromInt(numMap[product.Number])
        pp.Price = decimal.NewFromFloat(product.PurchasePrice)
        price += product.PurchasePrice
        pp.Total = pp.Amount.Mul(pp.Price)
        pp.Remark = "APS采购"
        pps = append(pps, pp)
    }
    purchaseRecord.TotalPrice = purchaseRecord.Quantity.Mul(decimal.NewFromFloat(price))
    purchaseRecord.UnInvoiceAmount = purchaseRecord.TotalPrice
    purchaseRecord.ShouldPayAmount = purchaseRecord.TotalPrice
    err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
        err = tx.Create(&purchaseRecord).Error
        if err != nil {
            return err
        }
        for i := 0; i < len(pps); i++ {
            pps[i].PurchaseId = int(purchaseRecord.ID)
        }
        return tx.Create(&pps).Error
    })
    if err != nil {
        return nil, err
    }
    resp := new(CreatePurchaseByWmsResponse)
    resp.PurchaseNumber = purchaseRecord.Number
    return resp, nil
}