| | |
| | | if !ok { |
| | | return |
| | | } |
| | | oldProcessModel, _ := service.GetProcessModelByNumber(params.Number) |
| | | procedure, code := service.NewTaskService().GetProcedureById(params.ProcedureId) |
| | | if code != ecode.OK { |
| | | ctx.Fail(code) |
| | | return |
| | | } |
| | | |
| | | oldProcessModel, _ := service.GetProcessModelByNumber(procedure.ProcessModelNumber) |
| | | offset, limit, push := GetOffsetAndLimit(oldProcessModel, params.Page, params.PageSize) |
| | | list, total, err := service.GetProcessModelList(offset, limit, params.Number) |
| | | list, total, err := service.GetProcessModelList(offset, limit, procedure.ProcessModelNumber) |
| | | if err != nil { |
| | | ctx.Fail(ecode.DBErr) |
| | | return |
| | |
| | | } |
| | | for _, processModel := range list { |
| | | if processModel.Procedure == oldProcessModel.Procedure && processModel.Product == oldProcessModel.Product { |
| | | processModel.IsUpdate = processModel.Number != params.Number |
| | | processModel.IsUpdate = processModel.Number != procedure.ProcessModelNumber |
| | | } |
| | | if processModel.IsUpdate { |
| | | processModel.NewNumber, processModel.NewParamsMap = processModel.Number, processModel.ParamsMap |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/v1/system/problemList": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "系统" |
| | | ], |
| | | "summary": "问题诊断/问题列表", |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/problem.CheckResult" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/v1/task/countdown": { |
| | | "get": { |
| | | "produces": [ |
| | |
| | | "PlcStartAddressValueTypeInt" |
| | | ] |
| | | }, |
| | | "constvar.ProblemCode": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "service", |
| | | "network", |
| | | "db", |
| | | "serf", |
| | | "nsq", |
| | | "device", |
| | | "process_model", |
| | | "plc_config", |
| | | "plc_address_list", |
| | | "plc_process_model_address_list", |
| | | "plc_connect" |
| | | ], |
| | | "x-enum-comments": { |
| | | "ProblemCodeDB": "数据库连接错误", |
| | | "ProblemCodeDevice": "未绑定设备", |
| | | "ProblemCodeNetwork": "网络错误", |
| | | "ProblemCodeNsq": "未连接消息队列", |
| | | "ProblemCodePlcAddressList": "plc地址表缺失", |
| | | "ProblemCodePlcConfig": "plc配置缺失", |
| | | "ProblemCodePlcConnect": "plc连接失败", |
| | | "ProblemCodePlcProcessModelAddressList": "plc地址表缺失", |
| | | "ProblemCodeProcessModel": "工艺参数缺失", |
| | | "ProblemCodeSerf": "未加入serf集群", |
| | | "ProblemCodeService": "服务不可用" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "ProblemCodeService", |
| | | "ProblemCodeNetwork", |
| | | "ProblemCodeDB", |
| | | "ProblemCodeSerf", |
| | | "ProblemCodeNsq", |
| | | "ProblemCodeDevice", |
| | | "ProblemCodeProcessModel", |
| | | "ProblemCodePlcConfig", |
| | | "ProblemCodePlcAddressList", |
| | | "ProblemCodePlcProcessModelAddressList", |
| | | "ProblemCodePlcConnect" |
| | | ] |
| | | }, |
| | | "constvar.TaskMode": { |
| | | "type": "integer", |
| | | "enum": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "problem.CheckResult": { |
| | | "type": "object", |
| | | "properties": { |
| | | "checkResult": { |
| | | "type": "boolean" |
| | | }, |
| | | "itemCode": { |
| | | "$ref": "#/definitions/constvar.ProblemCode" |
| | | }, |
| | | "itemName": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddPlcBrand": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "response.ProductProgress": { |
| | | "type": "object", |
| | | "properties": { |
| | | "RealEndTime": { |
| | | "type": "integer" |
| | | }, |
| | | "RealStartTime": { |
| | | "type": "integer" |
| | | }, |
| | | "finishNumber": { |
| | | "type": "integer" |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/v1/system/problemList": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "系统" |
| | | ], |
| | | "summary": "问题诊断/问题列表", |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/problem.CheckResult" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/v1/task/countdown": { |
| | | "get": { |
| | | "produces": [ |
| | |
| | | "PlcStartAddressValueTypeInt" |
| | | ] |
| | | }, |
| | | "constvar.ProblemCode": { |
| | | "type": "string", |
| | | "enum": [ |
| | | "service", |
| | | "network", |
| | | "db", |
| | | "serf", |
| | | "nsq", |
| | | "device", |
| | | "process_model", |
| | | "plc_config", |
| | | "plc_address_list", |
| | | "plc_process_model_address_list", |
| | | "plc_connect" |
| | | ], |
| | | "x-enum-comments": { |
| | | "ProblemCodeDB": "数据库连接错误", |
| | | "ProblemCodeDevice": "未绑定设备", |
| | | "ProblemCodeNetwork": "网络错误", |
| | | "ProblemCodeNsq": "未连接消息队列", |
| | | "ProblemCodePlcAddressList": "plc地址表缺失", |
| | | "ProblemCodePlcConfig": "plc配置缺失", |
| | | "ProblemCodePlcConnect": "plc连接失败", |
| | | "ProblemCodePlcProcessModelAddressList": "plc地址表缺失", |
| | | "ProblemCodeProcessModel": "工艺参数缺失", |
| | | "ProblemCodeSerf": "未加入serf集群", |
| | | "ProblemCodeService": "服务不可用" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "ProblemCodeService", |
| | | "ProblemCodeNetwork", |
| | | "ProblemCodeDB", |
| | | "ProblemCodeSerf", |
| | | "ProblemCodeNsq", |
| | | "ProblemCodeDevice", |
| | | "ProblemCodeProcessModel", |
| | | "ProblemCodePlcConfig", |
| | | "ProblemCodePlcAddressList", |
| | | "ProblemCodePlcProcessModelAddressList", |
| | | "ProblemCodePlcConnect" |
| | | ] |
| | | }, |
| | | "constvar.TaskMode": { |
| | | "type": "integer", |
| | | "enum": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "problem.CheckResult": { |
| | | "type": "object", |
| | | "properties": { |
| | | "checkResult": { |
| | | "type": "boolean" |
| | | }, |
| | | "itemCode": { |
| | | "$ref": "#/definitions/constvar.ProblemCode" |
| | | }, |
| | | "itemName": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddPlcBrand": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "response.ProductProgress": { |
| | | "type": "object", |
| | | "properties": { |
| | | "RealEndTime": { |
| | | "type": "integer" |
| | | }, |
| | | "RealStartTime": { |
| | | "type": "integer" |
| | | }, |
| | | "finishNumber": { |
| | | "type": "integer" |
| | | }, |
| | |
| | | x-enum-varnames: |
| | | - PlcStartAddressValueTypeString |
| | | - PlcStartAddressValueTypeInt |
| | | constvar.ProblemCode: |
| | | enum: |
| | | - service |
| | | - network |
| | | - db |
| | | - serf |
| | | - nsq |
| | | - device |
| | | - process_model |
| | | - plc_config |
| | | - plc_address_list |
| | | - plc_process_model_address_list |
| | | - plc_connect |
| | | type: string |
| | | x-enum-comments: |
| | | ProblemCodeDB: 数据库连接错误 |
| | | ProblemCodeDevice: 未绑定设备 |
| | | ProblemCodeNetwork: 网络错误 |
| | | ProblemCodeNsq: 未连接消息队列 |
| | | ProblemCodePlcAddressList: plc地址表缺失 |
| | | ProblemCodePlcConfig: plc配置缺失 |
| | | ProblemCodePlcConnect: plc连接失败 |
| | | ProblemCodePlcProcessModelAddressList: plc地址表缺失 |
| | | ProblemCodeProcessModel: 工艺参数缺失 |
| | | ProblemCodeSerf: 未加入serf集群 |
| | | ProblemCodeService: 服务不可用 |
| | | x-enum-varnames: |
| | | - ProblemCodeService |
| | | - ProblemCodeNetwork |
| | | - ProblemCodeDB |
| | | - ProblemCodeSerf |
| | | - ProblemCodeNsq |
| | | - ProblemCodeDevice |
| | | - ProblemCodeProcessModel |
| | | - ProblemCodePlcConfig |
| | | - ProblemCodePlcAddressList |
| | | - ProblemCodePlcProcessModelAddressList |
| | | - ProblemCodePlcConnect |
| | | constvar.TaskMode: |
| | | enum: |
| | | - 1 |
| | |
| | | updatedAt: |
| | | type: string |
| | | type: object |
| | | problem.CheckResult: |
| | | properties: |
| | | checkResult: |
| | | type: boolean |
| | | itemCode: |
| | | $ref: '#/definitions/constvar.ProblemCode' |
| | | itemName: |
| | | type: string |
| | | type: object |
| | | request.AddPlcBrand: |
| | | properties: |
| | | createdAt: |
| | |
| | | type: object |
| | | response.ProductProgress: |
| | | properties: |
| | | RealEndTime: |
| | | type: integer |
| | | RealStartTime: |
| | | type: integer |
| | | finishNumber: |
| | | type: integer |
| | | plcStatus: |
| | |
| | | summary: 获取工艺模型列表 |
| | | tags: |
| | | - 工艺模型 |
| | | /v1/system/problemList: |
| | | get: |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/contextx.Response' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/problem.CheckResult' |
| | | type: array |
| | | type: object |
| | | summary: 问题诊断/问题列表 |
| | | tags: |
| | | - 系统 |
| | | /v1/task/countdown: |
| | | get: |
| | | produces: |
| | |
| | | // ProcessModelList 工艺参数列表请求参数 |
| | | type ProcessModelList struct { |
| | | PageInfo |
| | | ProcedureId uint `json:"procedureId" form:"procedureId" binding:"required"` //当前的工序id |
| | | Number string `json:"number" form:"number" binding:"required"` //当前正在使用的工艺参数编号 |
| | | ProcedureId uint `json:"procedureId" form:"procedureId" binding:"required"` //当前的工序id |
| | | } |
| | | |
| | | // TaskListByChannel 按channel返回任务列表请求参数 |
| | |
| | | deviceGroup.GET("setCurrentDeviceId", deviceApi.SetCurrentDeviceId) // 切换设备ID |
| | | } |
| | | |
| | | systemApi := new(v1.SystemApi) |
| | | systemGroup := v1Group.Group("system") |
| | | { |
| | | systemGroup.GET("problemList", systemApi.ProblemList) // 问题诊断列表 |
| | | } |
| | | |
| | | //eventsApi := new(v1.EventsApi) |
| | | //eventsGroup := v1Group.Group("events") |
| | | //{ |
| | |
| | | }) |
| | | } |
| | | mutex.Lock() |
| | | defer mutex.Unlock() |
| | | checkResultList = checkResultListTemp |
| | | mutex.Unlock() |
| | | |
| | | } |
| | | |
| | | func Get() []*CheckResult { |