| | |
| | | PageInfo |
| | | KeyWord string `json:"keyWord"` |
| | | } |
| | | |
| | | type GetWorkshopManageCar struct { |
| | | WorkshopNumber string `json:"workshopNumber"` |
| | | GroupNumber int `json:"groupNumber"` |
| | | } |
| | |
| | | |
| | | import ( |
| | | "github.com/gin-gonic/gin" |
| | | "silkserver/constvar" |
| | | "silkserver/controllers/request" |
| | | "silkserver/extend/code" |
| | | "silkserver/extend/util" |
| | |
| | | |
| | | // SaveWorkshopManage |
| | | // |
| | | // @Tags 系统设置/车间管理 |
| | | // @Summary 保存车间管理 |
| | | // @Produce application/json |
| | | // @Param object body models.WorkshopManage true "参数" |
| | | // |
| | | // @Param Authorization header string true "token" |
| | | // |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-jl/v1/system/saveWorkshopManage [post] |
| | | // @Tags 系统设置/车间管理 |
| | | // @Summary 保存车间管理 |
| | | // @Produce application/json |
| | | // @Param object body models.WorkshopManage true "参数" |
| | | // @Param Authorization header string true "token" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-jl/v1/system/saveWorkshopManage [post] |
| | | func (slf WorkshopManageController) SaveWorkshopManage(c *gin.Context) { |
| | | var workshop models.WorkshopManage |
| | | err := c.BindJSON(&workshop) |
| | |
| | | } |
| | | util.ResponseFormat(c, code.Success, "删除成功") |
| | | } |
| | | |
| | | // GetWorkshopManageGroup |
| | | // |
| | | // @Tags 系统设置/车间管理 |
| | | // @Summary 获取车间组别 |
| | | // @Produce application/json |
| | | // @Param Authorization header string true "token" |
| | | // @Param number path string true "number" |
| | | // @Success 200 {object} util.Response{data=map[int]int} "成功" |
| | | // @Router /api-jl/v1/system/getWorkshopManageGroup/{number} [get] |
| | | func (slf WorkshopManageController) GetWorkshopManageGroup(c *gin.Context) { |
| | | number := c.Param("number") |
| | | if number == "" { |
| | | util.ResponseFormat(c, code.RequestParamError, "无效的编码") |
| | | return |
| | | } |
| | | all, err := models.NewWorkshopManageSearch().SetWorkshopNumber(number).FindAll() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查找失败") |
| | | return |
| | | } |
| | | groupMap := make(map[int]int) |
| | | for _, manage := range all { |
| | | groupMap[manage.GroupNumber] = manage.GroupNumber |
| | | } |
| | | util.ResponseFormat(c, code.Success, groupMap) |
| | | } |
| | | |
| | | // GetWorkshopManageCar |
| | | // |
| | | // @Tags 系统设置/车间管理 |
| | | // @Summary 获取车辆编号 |
| | | // @Produce application/json |
| | | // @Param Authorization header string true "token" |
| | | // @Param object body request.GetWorkshopManageCar true "参数" |
| | | // @Success 200 {object} util.ResponseList{data=[][]int} "成功" |
| | | // @Router /api-jl/v1/system/getWorkshopManageCar [post] |
| | | func (slf WorkshopManageController) GetWorkshopManageCar(c *gin.Context) { |
| | | var params request.GetWorkshopManageCar |
| | | err := c.BindJSON(¶ms) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | return |
| | | } |
| | | all, err := models.NewWorkshopManageSearch().SetWorkshopNumber(params.WorkshopNumber).SetGroupNumber(params.GroupNumber).FindAll() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查找失败") |
| | | return |
| | | } |
| | | carNum := make([][]int, 0) |
| | | for _, manage := range all { |
| | | car := make([]int, 0) |
| | | i := manage.StartCarNumber |
| | | if manage.CarFlag == constvar.RightHalfCar { |
| | | i++ |
| | | } |
| | | for ; i <= manage.EndCarNumber; i++ { |
| | | car = append(car, i) |
| | | } |
| | | carNum = append(carNum, car) |
| | | } |
| | | util.ResponseFormat(c, code.Success, carNum) |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/system/getWorkshopManageCar": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "系统设置/车间管理" |
| | | ], |
| | | "summary": "获取车辆编号", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "token", |
| | | "name": "Authorization", |
| | | "in": "header", |
| | | "required": true |
| | | }, |
| | | { |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetWorkshopManageCar" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/system/getWorkshopManageGroup/{number}": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "系统设置/车间管理" |
| | | ], |
| | | "summary": "获取车间组别", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "token", |
| | | "name": "Authorization", |
| | | "in": "header", |
| | | "required": true |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "number", |
| | | "name": "number", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "object", |
| | | "additionalProperties": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/system/getWorkshopManageList": { |
| | | "get": { |
| | | "produces": [ |
| | |
| | | "updatedAt": { |
| | | "type": "string" |
| | | }, |
| | | "workshopName": { |
| | | "type": "string" |
| | | }, |
| | | "workshopNumber": { |
| | | "type": "string" |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetWorkshopManageCar": { |
| | | "type": "object", |
| | | "properties": { |
| | | "groupNumber": { |
| | | "type": "integer" |
| | | }, |
| | | "workshopNumber": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetYieldRegisterList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/system/getWorkshopManageCar": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "系统设置/车间管理" |
| | | ], |
| | | "summary": "获取车辆编号", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "token", |
| | | "name": "Authorization", |
| | | "in": "header", |
| | | "required": true |
| | | }, |
| | | { |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetWorkshopManageCar" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "array", |
| | | "items": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/system/getWorkshopManageGroup/{number}": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "系统设置/车间管理" |
| | | ], |
| | | "summary": "获取车间组别", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "token", |
| | | "name": "Authorization", |
| | | "in": "header", |
| | | "required": true |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "number", |
| | | "name": "number", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "object", |
| | | "additionalProperties": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/system/getWorkshopManageList": { |
| | | "get": { |
| | | "produces": [ |
| | |
| | | "updatedAt": { |
| | | "type": "string" |
| | | }, |
| | | "workshopName": { |
| | | "type": "string" |
| | | }, |
| | | "workshopNumber": { |
| | | "type": "string" |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetWorkshopManageCar": { |
| | | "type": "object", |
| | | "properties": { |
| | | "groupNumber": { |
| | | "type": "integer" |
| | | }, |
| | | "workshopNumber": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetYieldRegisterList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | type: integer |
| | | updatedAt: |
| | | type: string |
| | | workshopName: |
| | | type: string |
| | | workshopNumber: |
| | | type: string |
| | | type: object |
| | |
| | | sum: |
| | | description: 合计 |
| | | type: number |
| | | type: object |
| | | request.GetWorkshopManageCar: |
| | | properties: |
| | | groupNumber: |
| | | type: integer |
| | | workshopNumber: |
| | | type: string |
| | | type: object |
| | | request.GetYieldRegisterList: |
| | | properties: |
| | |
| | | summary: 获取生丝等级 |
| | | tags: |
| | | - 系统设置/生丝定级标准 |
| | | /api-jl/v1/system/getWorkshopManageCar: |
| | | post: |
| | | parameters: |
| | | - description: token |
| | | in: header |
| | | name: Authorization |
| | | required: true |
| | | type: string |
| | | - description: 参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.GetWorkshopManageCar' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/util.ResponseList' |
| | | - properties: |
| | | data: |
| | | items: |
| | | items: |
| | | type: integer |
| | | type: array |
| | | type: array |
| | | type: object |
| | | summary: 获取车辆编号 |
| | | tags: |
| | | - 系统设置/车间管理 |
| | | /api-jl/v1/system/getWorkshopManageGroup/{number}: |
| | | get: |
| | | parameters: |
| | | - description: token |
| | | in: header |
| | | name: Authorization |
| | | required: true |
| | | type: string |
| | | - description: number |
| | | in: path |
| | | name: number |
| | | required: true |
| | | type: string |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/util.Response' |
| | | - properties: |
| | | data: |
| | | additionalProperties: |
| | | type: integer |
| | | type: object |
| | | type: object |
| | | summary: 获取车间组别 |
| | | tags: |
| | | - 系统设置/车间管理 |
| | | /api-jl/v1/system/getWorkshopManageList: |
| | | get: |
| | | parameters: |
| | |
| | | WorkshopManage struct { |
| | | gorm.Model |
| | | WorkshopNumber string `json:"workshopNumber" gorm:"type:varchar(255);comment:车间编号"` |
| | | WorkshopName string `json:"workshopName" gorm:"type:varchar(255);comment:车间名称"` |
| | | GroupNumber int `json:"groupNumber" gorm:"type:int(11);comment:组别"` |
| | | StartCarNumber int `json:"startCarNumber" gorm:"type:int(11);comment:开始车号"` |
| | | EndCarNumber int `json:"endCarNumber" gorm:"type:int(11);comment:结束车号"` |
| | |
| | | systemApi.GET("getRankStandardGrade", rawSilkController.GetRankStandardGrade) //获取生丝等级 |
| | | systemApi.POST("saveRankStandard", rawSilkController.SaveRankStandard) //保存生丝定级标准 |
| | | //车间管理 |
| | | systemApi.GET("getWorkshopManageList", workshopController.GetWorkshopManageList) //获取车间管理列表 |
| | | systemApi.POST("saveWorkshopManage", workshopController.SaveWorkshopManage) //保存车间管理 |
| | | systemApi.DELETE("deleteWorkshopManage/:id", workshopController.DeleteWorkshopManage) //删除车间管理 |
| | | systemApi.GET("getWorkshopManageList", workshopController.GetWorkshopManageList) //获取车间管理列表 |
| | | systemApi.POST("saveWorkshopManage", workshopController.SaveWorkshopManage) //保存车间管理 |
| | | systemApi.DELETE("deleteWorkshopManage/:id", workshopController.DeleteWorkshopManage) //删除车间管理 |
| | | systemApi.GET("getWorkshopManageGroup/:number", workshopController.GetWorkshopManageGroup) //获取车间组别 |
| | | systemApi.POST("getWorkshopManageCar", workshopController.GetWorkshopManageCar) //获取车辆编号 |
| | | } |
| | | |
| | | // 生产管理 |