syntax = "v1" import ( "base.api" ) type ( QueryMaterialsReq { PageReq SortReq Keyword string `form:"keyword,optional" comment:"关键词搜索"` } CreateMaterialReq { Name string `json:"name" validate:"required" comment:"物料名称"` MaterialType int `json:"materialType" comment:"物料类型"` ProcessTemplateId int `json:"processTemplateId" comment:"工艺模板id"` Remark string `json:"remark,optional" comment:"备注"` } UpdateMaterialReq { PathId Name string `json:"name" validate:"required" comment:"物料名称"` MaterialType int `json:"materialType" comment:"物料类型"` ProcessTemplateId int `json:"processTemplateId" comment:"工艺模板id"` Remark string `json:"remark,optional" comment:"备注"` } // 物料入库请求 StockInMaterialReq { PathId DockLocationNo int `json:"dockLocationNo" validate:"required" comment:"接驳台内位置"` RackLocationNo int `json:"rackLocationNo" validate:"required" comment:"料架内位置"` TrayGripperType int `json:"trayGripperType" validate:"required" comment:"托盘手爪类型"` } QueryMaterialsReply { PageReply Data []MaterialReply `json:"data"` } MaterialReply { Id int `json:"id"` Name string `json:"name" comment:"物料名称"` MaterialType int `json:"materialType" comment:"物料类型"` ProcessTemplateId int `json:"processTemplateId" comment:"工艺模板id"` Remark string `json:"remark,optional" comment:"备注"` CreatedAt int64 `json:"createdAt" comment:"创建时间"` UpdatedAt int64 `json:"updatedAt" comment:"更新时间"` } ) @server ( jwt: Auth group: material prefix: /api/v1 ) service hougai-api { @doc "查询物料分页列表" @handler queryMaterials get /materials (QueryMaterialsReq) returns (QueryMaterialsReply) @doc "获取物料列表" @handler listMaterials get /materials/list returns ([]MaterialReply) @doc "获取物料详情" @handler getMaterial get /materials/:id (PathId) returns (MaterialReply) @doc "创建物料" @handler createMaterial post /materials (CreateMaterialReq) returns (int) @doc "编辑物料" @handler updateMaterial put /materials/:id (UpdateMaterialReq) @doc "删除物料" @handler deleteMaterial delete /materials/:id (PathId) }