Align origin/main with upstream/main (GitHub). The two branches diverged due to pre-rebase vs post-rebase merge commits for the k8s-amd64-dockerfiles feature. Includes: multi-stage Go compilation Dockerfiles, pan-bolt inventory features, CRM relations, Excel import tooling, proto/gRPC updates, migration scripts, and tools/ directory. Excludes deploy/bin/ pre-compiled binaries (arm64, not needed for amd64 K3s cluster; builds use multi-stage Dockerfiles now).
476 lines
9.9 KiB
Protocol Buffer
476 lines
9.9 KiB
Protocol Buffer
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
message PanInput {
|
|
string name = 1;
|
|
string position = 2;
|
|
repeated string bolt_lengths = 3;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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);
|
|
|
|
// 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);
|
|
}
|