muyu-apiserver/rpc/inventory/inventory.proto

615 lines
13 KiB
Protocol Buffer
Raw Permalink Normal View History

syntax = "proto3";
package inventory;
option go_package = "./pb";
// ==================== Product ====================
message ProductInfo {
string product_id = 1;
string product_name = 2;
string image_url = 3;
string spec = 4;
string color = 5;
string sales_price = 6;
string remark = 7;
int64 status = 8;
string created_at = 9;
string updated_at = 10;
string color_no = 11;
string product_code = 12;
}
message CreateProductReq {
string product_name = 1;
string image_url = 2;
string spec = 3;
string color = 4;
string sales_price = 5;
string remark = 6;
repeated PanInput pans = 7;
string color_no = 8;
ProductBatchInput initial_batch = 9;
string product_code = 10;
}
message UpdateProductReq {
string product_id = 1;
string product_name = 2;
string image_url = 3;
string spec = 4;
string color = 5;
string sales_price = 6;
string remark = 7;
string color_no = 8;
}
message DeleteProductReq {
string product_id = 1;
}
message GetProductReq {
string product_id = 1;
}
message ListProductReq {
int64 page = 1;
int64 page_size = 2;
string product_name = 3;
string spec = 4;
string color = 5;
int64 status = 6;
string color_no = 7;
string product_code = 8;
}
message ListProductResp {
int64 total = 1;
repeated ProductInfo list = 2;
}
// ==================== Pan (盘) ====================
message PanInfo {
string pan_id = 1;
string product_id = 2;
string name = 3;
string position = 4;
int64 sort_order = 5;
repeated BoltInfo bolts = 6;
int64 bolt_count = 7;
string total_length = 8;
string batch_id = 9;
string batch_no = 10;
}
message PanInput {
string name = 1;
string position = 2;
repeated string bolt_lengths = 3;
string batch_id = 4;
}
message ListPanReq {
string product_id = 1;
}
message ListPanResp {
repeated PanInfo list = 1;
}
message SavePansReq {
string product_id = 1;
repeated PanInput pans = 2;
}
// ==================== Bolt (匹) ====================
message BoltInfo {
string bolt_id = 1;
string pan_id = 2;
string length_m = 3;
int64 sort_order = 4;
}
message ListBoltReq {
string pan_id = 1;
}
message ListBoltResp {
repeated BoltInfo list = 1;
}
message SaveBoltsReq {
string pan_id = 1;
repeated string lengths = 2;
}
// ==================== Product Tree (三层详情) ====================
message ProductTreeResp {
ProductInfo product = 1;
repeated PanInfo pans = 2;
int64 total_pan_count = 3;
int64 total_bolt_count = 4;
string total_length_m = 5;
}
// ==================== Panel 1: Product Summary ====================
message ProductSummaryItem {
string product_name = 1;
string spec = 2;
int64 color_count = 3;
int64 total_pan_count = 4;
int64 total_bolt_count = 5;
string total_length_m = 6;
string colors = 7;
string locations = 8;
}
message ListProductSummaryReq {}
message ListProductSummaryResp {
repeated ProductSummaryItem list = 1;
}
// ==================== Panel 2: Color Detail ====================
message ColorDetailItem {
string product_id = 1;
string product_name = 2;
string color = 3;
string spec = 4;
string image_url = 5;
int64 pan_count = 6;
int64 bolt_count = 7;
string total_length_m = 8;
string locations = 9;
string sales_price = 10;
string color_no = 11;
string product_code = 12;
int64 batch_count = 13;
}
message ListColorDetailReq {
string product_name = 1;
}
message ListColorDetailResp {
repeated ColorDetailItem list = 1;
}
// ==================== Pan / Bolt List View ====================
message PanListItem {
string pan_id = 1;
string product_id = 2;
string name = 3;
string position = 4;
string product_name = 5;
string colors = 6; // aggregated from bolt.color, no spec
int64 bolt_count = 7;
string total_length_m = 8;
string batch_id = 9;
string batch_no = 10;
}
message ListPanViewReq {
int64 page = 1;
int64 page_size = 2;
string product_name = 3;
string position = 4;
}
message ListPanViewResp {
int64 total = 1;
repeated PanListItem list = 2;
}
message BoltListItem {
string bolt_id = 1;
string pan_id = 2;
string length_m = 3;
string color = 4; // bolt's own color, no spec
int64 sort_order = 5;
string pan_name = 6;
string position = 7;
string product_id = 8;
string product_name = 9;
}
message ListBoltViewReq {
int64 page = 1;
int64 page_size = 2;
string product_name = 3;
string position = 4;
}
message ListBoltViewResp {
int64 total = 1;
repeated BoltListItem list = 2;
}
// ==================== Stock Import ====================
message ImportProductReq {
repeated CreateProductReq products = 1;
string file_name = 2;
string operator = 3;
}
message ImportProductResp {
int64 total_count = 1;
int64 success_count = 2;
int64 fail_count = 3;
string error_msg = 4;
string import_id = 5;
}
message ListImportLogReq {
int64 page = 1;
int64 page_size = 2;
}
message ListImportLogResp {
int64 total = 1;
repeated ImportLogInfo list = 2;
}
// ==================== Yarn ====================
message YarnInfo {
string yarn_id = 1;
string yarn_name = 2;
string color = 3;
string weight_g_m = 4;
string supplier_id = 5;
string supplier_name = 6;
string dye_factory = 7;
string image_url = 8;
string remark = 9;
int64 status = 10;
string created_at = 11;
string updated_at = 12;
}
message CreateYarnReq {
string yarn_name = 1;
string color = 2;
string weight_g_m = 3;
string supplier_id = 4;
string dye_factory = 5;
string image_url = 6;
string remark = 7;
}
message UpdateYarnReq {
string yarn_id = 1;
string yarn_name = 2;
string color = 3;
string weight_g_m = 4;
string supplier_id = 5;
string dye_factory = 6;
string image_url = 7;
string remark = 8;
int64 status = 9;
}
message DeleteYarnReq {
string yarn_id = 1;
}
message GetYarnReq {
string yarn_id = 1;
}
message ListYarnReq {
int64 page = 1;
int64 page_size = 2;
string yarn_name = 3;
string supplier_id = 4;
int64 status = 5;
}
message ListYarnResp {
int64 total = 1;
repeated YarnInfo list = 2;
}
// ==================== Product Batch ====================
message ProductBatchInput {
string yarn_ratio = 1;
string warp_weight_g_m = 2;
string weft_weight_g_m = 3;
string production_process = 4;
string remark = 5;
string batch_no = 6;
}
message ProductBatchInfo {
string batch_id = 1;
string product_id = 2;
string batch_no = 3;
string yarn_ratio = 4;
string warp_weight_g_m = 5;
string weft_weight_g_m = 6;
string production_process = 7;
string remark = 8;
int64 status = 9;
string created_at = 10;
string updated_at = 11;
}
message CreateProductBatchReq {
string product_id = 1;
ProductBatchInput batch = 2;
}
message UpdateProductBatchReq {
string product_id = 1;
string batch_id = 2;
ProductBatchInput batch = 3;
int64 status = 4;
}
message DeleteProductBatchReq {
string product_id = 1;
string batch_id = 2;
}
message ListProductBatchReq {
string product_id = 1;
}
message ListProductBatchResp {
repeated ProductBatchInfo list = 1;
}
message ImportLogInfo {
string import_id = 1;
string file_name = 2;
int64 total_count = 3;
int64 success_count = 4;
int64 fail_count = 5;
string error_msg = 6;
string operator = 7;
string created_at = 8;
}
// ==================== Stock Statistics ====================
message StockSummaryReq {}
message StockSummaryResp {
int64 product_count = 1;
int64 total_pieces = 2;
int64 total_pans = 3;
string total_length_m = 4;
string total_sales_value = 5;
}
message StockGroupReq {
string group_by = 1;
}
message StockGroupItem {
string name = 1;
int64 count = 2;
string quantity = 3;
}
message StockGroupResp {
repeated StockGroupItem list = 1;
}
// ==================== Stock Check ====================
message StockCheckInfo {
string check_id = 1;
string check_no = 2;
string check_date = 3;
string checker = 4;
int64 status = 5;
string remark = 6;
string created_at = 7;
string updated_at = 8;
repeated StockCheckDetailInfo details = 9;
}
message StockCheckDetailInfo {
string detail_id = 1;
string check_id = 2;
string product_id = 3;
string product_name = 4;
string system_quantity = 5;
string actual_quantity = 6;
string diff_quantity = 7;
string diff_amount = 8;
string remark = 9;
}
message CreateStockCheckReq {
string check_date = 1;
string checker = 2;
string remark = 3;
repeated StockCheckDetailReq details = 4;
}
message StockCheckDetailReq {
string product_id = 1;
string actual_quantity = 2;
string remark = 3;
}
message UpdateStockCheckReq {
string check_id = 1;
string remark = 2;
repeated StockCheckDetailReq details = 3;
}
message ConfirmStockCheckReq {
string check_id = 1;
string operator = 2;
}
message GetStockCheckReq {
string check_id = 1;
}
message ListStockCheckReq {
int64 page = 1;
int64 page_size = 2;
string check_no = 3;
int64 status = 4;
string start_date = 5;
string end_date = 6;
}
message ListStockCheckResp {
int64 total = 1;
repeated StockCheckInfo list = 2;
}
// ==================== Stock Adjust ====================
message StockAdjustInfo {
string adjust_id = 1;
string adjust_no = 2;
string adjust_date = 3;
string adjust_reason = 4;
string operator = 5;
string approver = 6;
int64 status = 7;
string remark = 8;
string created_at = 9;
string updated_at = 10;
repeated StockAdjustDetailInfo details = 11;
}
message StockAdjustDetailInfo {
string detail_id = 1;
string adjust_id = 2;
string product_id = 3;
string product_name = 4;
string before_quantity = 5;
string adjust_quantity = 6;
string after_quantity = 7;
string remark = 8;
}
message CreateStockAdjustReq {
string adjust_date = 1;
string adjust_reason = 2;
string operator = 3;
string remark = 4;
repeated StockAdjustDetailReq details = 5;
}
message StockAdjustDetailReq {
string product_id = 1;
string adjust_quantity = 2;
string remark = 3;
}
message ApproveStockAdjustReq {
string adjust_id = 1;
string approver = 2;
int64 action = 3;
}
message GetStockAdjustReq {
string adjust_id = 1;
}
message ListStockAdjustReq {
int64 page = 1;
int64 page_size = 2;
string adjust_no = 3;
string adjust_reason = 4;
int64 status = 5;
string start_date = 6;
string end_date = 7;
}
message ListStockAdjustResp {
int64 total = 1;
repeated StockAdjustInfo list = 2;
}
// ==================== Common ====================
message IdResp {
string id = 1;
}
message Empty {}
// ==================== Service ====================
service InventoryService {
// Product CRUD
rpc CreateProduct(CreateProductReq) returns (IdResp);
rpc UpdateProduct(UpdateProductReq) returns (Empty);
rpc DeleteProduct(DeleteProductReq) returns (Empty);
rpc GetProduct(GetProductReq) returns (ProductInfo);
rpc ListProduct(ListProductReq) returns (ListProductResp);
// Product Tree (panel 3)
rpc GetProductTree(GetProductReq) returns (ProductTreeResp);
// Product Summary (panel 1)
rpc ListProductSummary(ListProductSummaryReq) returns (ListProductSummaryResp);
// Color Detail (panel 2)
rpc ListColorDetail(ListColorDetailReq) returns (ListColorDetailResp);
// Yarn CRUD
rpc CreateYarn(CreateYarnReq) returns (IdResp);
rpc UpdateYarn(UpdateYarnReq) returns (Empty);
rpc DeleteYarn(DeleteYarnReq) returns (Empty);
rpc GetYarn(GetYarnReq) returns (YarnInfo);
rpc ListYarn(ListYarnReq) returns (ListYarnResp);
// Product Batch CRUD
rpc CreateProductBatch(CreateProductBatchReq) returns (IdResp);
rpc UpdateProductBatch(UpdateProductBatchReq) returns (Empty);
rpc DeleteProductBatch(DeleteProductBatchReq) returns (Empty);
rpc ListProductBatch(ListProductBatchReq) returns (ListProductBatchResp);
// Pan / Bolt list views (dimension panels)
rpc ListPanView(ListPanViewReq) returns (ListPanViewResp);
rpc ListBoltView(ListBoltViewReq) returns (ListBoltViewResp);
// Pan CRUD
rpc ListPans(ListPanReq) returns (ListPanResp);
rpc SavePans(SavePansReq) returns (Empty);
// Bolt CRUD
rpc ListBolts(ListBoltReq) returns (ListBoltResp);
rpc SaveBolts(SaveBoltsReq) returns (Empty);
// Import
rpc ImportProducts(ImportProductReq) returns (ImportProductResp);
rpc ListImportLog(ListImportLogReq) returns (ListImportLogResp);
// Stock Statistics
rpc GetStockSummary(StockSummaryReq) returns (StockSummaryResp);
rpc GetStockGroup(StockGroupReq) returns (StockGroupResp);
// Stock Check
rpc CreateStockCheck(CreateStockCheckReq) returns (IdResp);
rpc UpdateStockCheck(UpdateStockCheckReq) returns (Empty);
rpc ConfirmStockCheck(ConfirmStockCheckReq) returns (Empty);
rpc GetStockCheck(GetStockCheckReq) returns (StockCheckInfo);
rpc ListStockCheck(ListStockCheckReq) returns (ListStockCheckResp);
// Stock Adjust
rpc CreateStockAdjust(CreateStockAdjustReq) returns (IdResp);
rpc ApproveStockAdjust(ApproveStockAdjustReq) returns (Empty);
rpc GetStockAdjust(GetStockAdjustReq) returns (StockAdjustInfo);
rpc ListStockAdjust(ListStockAdjustReq) returns (ListStockAdjustResp);
}