zhangqian
2023-10-09 36a8d4505d6f2ce688f8d7df451adfa29ee9950c
docs/docs.go
@@ -16,7 +16,7 @@
    "host": "{{.Host}}",
    "basePath": "{{.BasePath}}",
    "paths": {
        "/v1/cc/nn": {
        "/v1/config/net": {
            "get": {
                "produces": [
                    "application/json"
@@ -49,7 +49,7 @@
                    }
                }
            },
            "put": {
            "post": {
                "produces": [
                    "application/json"
                ],
@@ -93,7 +93,7 @@
                }
            }
        },
        "/v1/config/net": {
        "/v1/config/plc": {
            "get": {
                "produces": [
                    "application/json"
@@ -101,7 +101,7 @@
                "tags": [
                    "Config"
                ],
                "summary": "获取网络配置",
                "summary": "获取plc配置",
                "responses": {
                    "200": {
                        "description": "成功",
@@ -114,10 +114,7 @@
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/definitions/model.NetConfig"
                                            }
                                            "$ref": "#/definitions/model.DevicePlc"
                                        }
                                    }
                                }
@@ -126,22 +123,52 @@
                    }
                }
            },
            "put": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Config"
                ],
                "summary": "设置网络配置",
                "summary": "更新plc配置",
                "parameters": [
                    {
                        "description": "参数",
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/model.NetConfig"
                            "$ref": "#/definitions/request.UpdatePlc"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/contextx.Response"
                        }
                    }
                }
            }
        },
        "/v1/plc/productProgress": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "生产数量"
                ],
                "summary": "获取生产进度",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.SendProcessParams"
                        }
                    }
                ],
@@ -157,14 +184,61 @@
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/definitions/response.ProcessParams"
                                            }
                                            "$ref": "#/definitions/response.ProductProgress"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/v1/plc/productProgressRealTime": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "生产数量"
                ],
                "summary": "实时获取生产进度",
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/contextx.Response"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.ProductProgress"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/v1/plc/setProductNumber": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "生产数量"
                ],
                "summary": "设置生产总量",
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/contextx.Response"
                        }
                    }
                }
@@ -292,6 +366,99 @@
                }
            }
        },
        "/v1/processModel/list": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "工艺模型"
                ],
                "summary": "获取工艺模型列表",
                "parameters": [
                    {
                        "type": "string",
                        "description": "当前正在使用的工艺参数编号",
                        "name": "number",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "description": "页码",
                        "name": "page",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "每页大小",
                        "name": "pageSize",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "当前的工序id",
                        "name": "procedureId",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/contextx.Response"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/definitions/model.ProcessModel"
                                            }
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/v1/task/countdown": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Task"
                ],
                "summary": "新任务倒计时",
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/contextx.Response"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.TaskCountdown"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/v1/task/finish/{id}": {
            "put": {
                "produces": [
@@ -329,6 +496,40 @@
                    "Task"
                ],
                "summary": "获取任务",
                "parameters": [
                    {
                        "type": "integer",
                        "description": "页码",
                        "name": "page",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "每页大小",
                        "name": "pageSize",
                        "in": "query"
                    },
                    {
                        "enum": [
                            1,
                            2,
                            3
                        ],
                        "type": "integer",
                        "x-enum-comments": {
                            "TaskModeCurrent": "未开始的和进行中的",
                            "TaskModeLastFinished": "上一个结束的",
                            "TaskModeUnStarted": "未开始的"
                        },
                        "x-enum-varnames": [
                            "TaskModeUnStarted",
                            "TaskModeCurrent",
                            "TaskModeLastFinished"
                        ],
                        "name": "taskMode",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
@@ -341,7 +542,7 @@
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.TaskData"
                                            "$ref": "#/definitions/response.TaskResponse"
                                        }
                                    }
                                }
@@ -351,7 +552,7 @@
                }
            }
        },
        "/v1/task/sendProcessParams/{id}": {
        "/v1/task/sendProcessParams": {
            "post": {
                "produces": [
                    "application/json"
@@ -359,14 +560,16 @@
                "tags": [
                    "Task"
                ],
                "summary": "下发工艺参数",
                "summary": "下发工艺参数(开始任务)",
                "parameters": [
                    {
                        "type": "integer",
                        "description": "工序id",
                        "name": "id",
                        "in": "path",
                        "required": true
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.SendProcessParams"
                        }
                    }
                ],
                "responses": {
@@ -387,7 +590,7 @@
                "tags": [
                    "Task"
                ],
                "summary": "任务开始",
                "summary": "任务开始(获取工艺参数)",
                "parameters": [
                    {
                        "type": "integer",
@@ -409,14 +612,41 @@
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/definitions/response.ProcessParams"
                                            }
                                            "$ref": "#/definitions/response.ProcessParamsResponse"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/v1/task/updateProcessParams": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Task"
                ],
                "summary": "更新工艺参数(进行中的任务)",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.SendProcessParams"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/contextx.Response"
                        }
                    }
                }
@@ -464,6 +694,17 @@
        "common.ProductProcedure": {
            "type": "object",
            "properties": {
                "allProcedureNames": {
                    "description": "所属工单工序列表",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "channel": {
                    "description": "通道序号",
                    "type": "integer"
                },
                "deviceId": {
                    "type": "string"
                },
@@ -479,6 +720,12 @@
                    "items": {
                        "$ref": "#/definitions/common.ProcedureMaterial"
                    }
                },
                "nextProcedureId": {
                    "type": "string"
                },
                "nextProcedureName": {
                    "type": "string"
                },
                "outputMaterials": {
                    "description": "输出物料列表",
@@ -508,6 +755,72 @@
                }
            }
        },
        "conf.Prompt": {
            "type": "object",
            "properties": {
                "plcNotConnected": {
                    "type": "string"
                },
                "safeProduce": {
                    "type": "string"
                }
            }
        },
        "constvar.PlcMethod": {
            "type": "string",
            "enum": [
                "modbusTCP",
                "serial",
                "网络",
                "串口"
            ],
            "x-enum-varnames": [
                "PlcMethodModbusTCP",
                "PlcMethodSerial",
                "PlcMethodModbusTCPChinese",
                "PlcMethodSerialChinese"
            ]
        },
        "constvar.PlcStartAddressType": {
            "type": "integer",
            "enum": [
                1,
                2
            ],
            "x-enum-varnames": [
                "PlcStartAddressTypeFinishNumber",
                "PlcStartAddressTypeTotalNumber"
            ]
        },
        "constvar.PlcStartAddressValueType": {
            "type": "string",
            "enum": [
                "string",
                "int"
            ],
            "x-enum-varnames": [
                "PlcStartAddressValueTypeString",
                "PlcStartAddressValueTypeInt"
            ]
        },
        "constvar.TaskMode": {
            "type": "integer",
            "enum": [
                1,
                2,
                3
            ],
            "x-enum-comments": {
                "TaskModeCurrent": "未开始的和进行中的",
                "TaskModeLastFinished": "上一个结束的",
                "TaskModeUnStarted": "未开始的"
            },
            "x-enum-varnames": [
                "TaskModeUnStarted",
                "TaskModeCurrent",
                "TaskModeLastFinished"
            ]
        },
        "contextx.Response": {
            "type": "object",
            "properties": {
@@ -517,6 +830,78 @@
                "data": {},
                "msg": {
                    "type": "string"
                }
            }
        },
        "model.DevicePlc": {
            "type": "object",
            "properties": {
                "address": {
                    "description": "PortName   string ` + "`" + `gorm:\"type:varchar(191);comment:端口名称\" json:\"portName\"` + "`" + `\nFrequency  int    ` + "`" + `gorm:\"comment:数据更新频率 0-实时更新 1-1次/秒\" json:\"frequency\"` + "`" + `",
                    "type": "string"
                },
                "baudRate": {
                    "description": "串口波特率, method = serial时 用",
                    "type": "integer"
                },
                "brand": {
                    "type": "string"
                },
                "details": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.DevicePlcAddress"
                    }
                },
                "id": {
                    "type": "integer"
                },
                "isOpen": {
                    "type": "boolean"
                },
                "method": {
                    "$ref": "#/definitions/constvar.PlcMethod"
                },
                "port": {
                    "description": "plc 端口号,  method =  modbusTCP用",
                    "type": "integer"
                },
                "serialName": {
                    "description": "串口名称,method = serial时 用",
                    "type": "string"
                }
            }
        },
        "model.DevicePlcAddress": {
            "type": "object",
            "properties": {
                "channel": {
                    "description": "数据起始地址",
                    "type": "integer"
                },
                "fieldName": {
                    "description": "对应系统字段",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.PlcStartAddressType"
                        }
                    ]
                },
                "length": {
                    "description": "数据长度",
                    "type": "integer"
                },
                "startAddress": {
                    "description": "数据起始地址",
                    "type": "integer"
                },
                "type": {
                    "description": "数据类型",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.PlcStartAddressValueType"
                        }
                    ]
                }
            }
        },
@@ -626,10 +1011,12 @@
            "type": "integer",
            "enum": [
                1,
                2
                2,
                3
            ],
            "x-enum-varnames": [
                "OrderStatusUnFinished",
                "OrderStatusWaitProcess",
                "OrderStatusProcessing",
                "OrderStatusFinished"
            ]
        },
@@ -648,16 +1035,25 @@
            "type": "integer",
            "enum": [
                1,
                2
                2,
                3
            ],
            "x-enum-varnames": [
                "ProcedureStatusUnFinished",
                "ProcedureStatusWaitProcess",
                "ProcedureStatusProcessing",
                "ProcedureStatusFinished"
            ]
        },
        "model.Procedures": {
            "type": "object",
            "properties": {
                "channel": {
                    "description": "通道",
                    "type": "integer"
                },
                "deviceId": {
                    "type": "string"
                },
                "endTime": {
                    "type": "integer"
                },
@@ -672,11 +1068,57 @@
                        }
                    ]
                },
                "procedureId": {
                    "type": "string"
                },
                "processModelNumber": {
                    "description": "工艺模型编号",
                    "type": "string"
                },
                "startTime": {
                    "type": "integer"
                },
                "status": {
                    "$ref": "#/definitions/model.ProcedureStatus"
                }
            }
        },
        "model.ProcessModel": {
            "type": "object",
            "properties": {
                "deviceId": {
                    "description": "用于过滤获取nsq消息",
                    "type": "string"
                },
                "isUpdate": {
                    "description": "前端用",
                    "type": "boolean"
                },
                "newNumber": {
                    "type": "string"
                },
                "newParamsMap": {
                    "type": "object",
                    "additionalProperties": true
                },
                "number": {
                    "description": "工艺模型编号",
                    "type": "string"
                },
                "params": {
                    "type": "string"
                },
                "paramsMap": {
                    "type": "object",
                    "additionalProperties": true
                },
                "procedure": {
                    "description": "工序",
                    "type": "string"
                },
                "product": {
                    "description": "产品名称",
                    "type": "string"
                }
            }
        },
@@ -687,6 +1129,56 @@
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "request.SendProcessParams": {
            "type": "object",
            "required": [
                "procedureId"
            ],
            "properties": {
                "procedureId": {
                    "type": "integer"
                }
            }
        },
        "request.UpdatePlc": {
            "type": "object",
            "properties": {
                "address": {
                    "description": "PortName   string ` + "`" + `gorm:\"type:varchar(191);comment:端口名称\" json:\"portName\"` + "`" + `\nFrequency  int    ` + "`" + `gorm:\"comment:数据更新频率 0-实时更新 1-1次/秒\" json:\"frequency\"` + "`" + `",
                    "type": "string"
                },
                "baudRate": {
                    "description": "串口波特率, method = serial时 用",
                    "type": "integer"
                },
                "brand": {
                    "type": "string"
                },
                "details": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.DevicePlcAddress"
                    }
                },
                "id": {
                    "type": "integer"
                },
                "isOpen": {
                    "type": "boolean"
                },
                "method": {
                    "$ref": "#/definitions/constvar.PlcMethod"
                },
                "port": {
                    "description": "plc 端口号,  method =  modbusTCP用",
                    "type": "integer"
                },
                "serialName": {
                    "description": "串口名称,method = serial时 用",
                    "type": "string"
                }
            }
@@ -726,17 +1218,70 @@
                "value": {}
            }
        },
        "response.ProcessParamsResponse": {
            "type": "object",
            "properties": {
                "number": {
                    "type": "string"
                },
                "params": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/response.ProcessParams"
                    }
                }
            }
        },
        "response.ProductProgress": {
            "type": "object",
            "properties": {
                "finishNumber": {
                    "type": "integer"
                },
                "plcStatus": {
                    "type": "integer"
                },
                "totalNumber": {
                    "type": "integer"
                }
            }
        },
        "response.TaskCountdown": {
            "type": "object",
            "properties": {
                "countDownHour": {
                    "description": "倒计时 时",
                    "type": "integer"
                },
                "countDownMinute": {
                    "description": "倒计时 分",
                    "type": "integer"
                },
                "showCountDown": {
                    "description": "是否展示倒计时",
                    "type": "boolean"
                }
            }
        },
        "response.TaskData": {
            "type": "object",
            "properties": {
                "deviceName": {
                    "type": "string"
                "allProcedures": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "deviceStatus": {
                    "type": "string"
                "canStarted": {
                    "description": "是否可以开始生产",
                    "type": "boolean"
                },
                "nextProcedure": {
                    "$ref": "#/definitions/model.Procedures"
                "channel": {
                    "description": "当前任务在设备第几个通道",
                    "type": "integer"
                },
                "currentProcedureIndex": {
                    "type": "integer"
                },
                "order": {
                    "$ref": "#/definitions/model.Order"
@@ -745,6 +1290,41 @@
                    "$ref": "#/definitions/model.Procedures"
                }
            }
        },
        "response.TaskResponse": {
            "type": "object",
            "properties": {
                "channelAmount": {
                    "description": "通道数量",
                    "type": "integer"
                },
                "prompt": {
                    "description": "提示语",
                    "allOf": [
                        {
                            "$ref": "#/definitions/conf.Prompt"
                        }
                    ]
                },
                "taskCount": {
                    "description": "任务数量",
                    "type": "integer"
                },
                "tasks": {
                    "description": "任务列表",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/response.TaskData"
                    }
                },
                "workers": {
                    "description": "人员列表",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/common.ProcedureWorker"
                    }
                }
            }
        }
    }
}`