syntax = "proto3"; package inventory; option go_package = "github.com/muyuqingfeng/iloom/shared/pkg/grpc/pb/inventory"; // ==================== Product ==================== message ProductInfo { string product_id = 1; string product_name = 2; string image_url = 3; string spec = 4; string color = 5; int64 unit_pieces = 6; int64 unit_rolls = 7; string stock_quantity = 8; string location = 9; string cost_price = 10; string sales_price = 11; string remark = 12; int64 status = 13; string created_at = 14; string updated_at = 15; } message CreateProductReq { string product_name = 1; string image_url = 2; string spec = 3; string color = 4; int64 unit_pieces = 5; int64 unit_rolls = 6; string stock_quantity = 7; string location = 8; string cost_price = 9; string sales_price = 10; string remark = 11; } message UpdateProductReq { string product_id = 1; string product_name = 2; string image_url = 3; string spec = 4; string color = 5; int64 unit_pieces = 6; int64 unit_rolls = 7; string stock_quantity = 8; string location = 9; string cost_price = 10; string sales_price = 11; string remark = 12; } 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; string location = 6; int64 status = 7; } message ListProductResp { int64 total = 1; repeated ProductInfo 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_rolls = 3; string total_cost_value = 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 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); // 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); }