| | |
| | | package constvar |
| | | |
| | | const ( |
| | | NsqTopicScheduleTask = "aps.%v.scheduleTask" //排程任务下发 |
| | | NsqTopicScheduleTask = "aps.%v.scheduleTask" //排程任务下发 |
| | | NsqTopicApsProcessParams = "aps.%v.aps.processParams" //有了新的工艺模型 |
| | | NsqTopicTaskProcedureStatusUpdate = "aps.%v.task.procedure.status" //工序状态更新 |
| | | NsqTopicSyncTaskProgress = "aps.%v.task.procedure.progress" //工序生产进度 |
| | | NsqTopicDeviceUpdate = "aps.%v.device.update" //设备信息更改 |
| | | NsqTopicPullDataRequest = "aps.%v.pull.data.request" //拉取数据请求 |
| | | NsqTopicPullDataResponse = "aps.%v.pull.data.response" //拉取数据响应 |
| | | NsqTopicApsClientReportData = "aps.%v.apsClient.report.data" //apsClient上报数据 |
| | | NsqTopicSendDashboardData = "aps.%v.apsClient.dashboard" //下发dashboard数据 |
| | | ) |
| | | |
| | | type PlcStartAddressType string |
| | | type PlcStartAddressType int |
| | | |
| | | const ( |
| | | PlcStartAddressTypeFinishNumber = "1" |
| | | PlcStartAddressTypeFinishNumber PlcStartAddressType = 1 |
| | | PlcStartAddressTypeTotalNumber PlcStartAddressType = 2 |
| | | PlcStartAddressTypeTotalNumberWrite PlcStartAddressType = 3 |
| | | ) |
| | | |
| | | type PlcStartAddressValueType string |
| | | |
| | | const ( |
| | | PlcStartAddressValueTypeString PlcStartAddressValueType = "string" |
| | | PlcStartAddressValueTypeInt16 PlcStartAddressValueType = "int16" |
| | | PlcStartAddressValueTypeInt32 PlcStartAddressValueType = "int32" |
| | | ) |
| | | |
| | | const ( |
| | | PlcAddressDataPath = "datafile/" |
| | | PlcAddressDataKeyFileName = "plc_address_key" |
| | | PlcAddressDataValueFileName = "plc_address_value" |
| | | ) |
| | | |
| | | type PlcMethod string |
| | | |
| | | const ( |
| | | PlcMethodModbusTCP PlcMethod = "modbusTCP" |
| | | PlcMethodModbusRTU PlcMethod = "modbusRTU" |
| | | PlcMethodSerial PlcMethod = "serial" |
| | | PlcMethodModbusTCPChinese PlcMethod = "网络" |
| | | PlcMethodSerialChinese PlcMethod = "串口" |
| | | ) |
| | | |
| | | func (slf *PlcMethod) ConvertToEnglish() { |
| | | if *slf == PlcMethodModbusTCPChinese { |
| | | *slf = PlcMethodModbusTCP |
| | | } |
| | | if *slf == PlcMethodSerialChinese { |
| | | *slf = PlcMethodSerial |
| | | } |
| | | } |
| | | |
| | | func (slf *PlcMethod) Valid() bool { |
| | | return *slf == PlcMethodModbusTCP || *slf == PlcMethodSerial || *slf == PlcMethodModbusRTU |
| | | } |
| | | |
| | | const ( |
| | | PlcCacheKeyFinishNumber = "finish_number" |
| | | PlcCacheKeyTotalNumber = "total_number" |
| | | ) |
| | | |
| | | const ( |
| | | PlcPackageApache = "apache" |
| | | PlcPackageGoBurrow = "goBurrow" |
| | | PlcPackageApacheLongConnection = "apacheLong" |
| | | ) |
| | | |
| | | type TaskMode int |
| | | |
| | | const ( |
| | | TaskModeUnStarted TaskMode = 1 //未开始的 |
| | | TaskModeCurrent TaskMode = 2 //未开始的和进行中的 |
| | | TaskModeLastFinished TaskMode = 3 //上一个结束的 |
| | | ) |
| | | |
| | | type Parity int |
| | | |
| | | const ( |
| | | ParityEven Parity = 1 //奇校验 |
| | | ParityOdd Parity = 2 //偶校验 |
| | | ParityNull Parity = 3 //无校验 |
| | | ) |
| | | |
| | | func (p Parity) ToString() string { |
| | | switch p { |
| | | case ParityEven: |
| | | return "E" |
| | | case ParityOdd: |
| | | return "O" |
| | | case ParityNull: |
| | | return "N" |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | const ( |
| | | SerfClusterStatusNull = "" //未加入集群 |
| | | SerfClusterStatusMaster = "master" //集群master |
| | | SerfClusterStatusSlave = "slave" //集群slave |
| | | ) |
| | | |
| | | type ProblemCode string |
| | | |
| | | const ( |
| | | ProblemCodeService ProblemCode = "service" //服务不可用 |
| | | ProblemCodeNetwork ProblemCode = "network" //网络错误 |
| | | ProblemCodeDB ProblemCode = "db" //数据库连接错误 |
| | | ProblemCodeSerf ProblemCode = "serf" //未加入serf集群 |
| | | ProblemCodeCloud ProblemCode = "cloud" //未连接云端 |
| | | ProblemCodeDevice ProblemCode = "device" //未绑定设备 |
| | | ProblemCodeProcessModel ProblemCode = "process_model" //工艺参数缺失 |
| | | ProblemCodePlcConfig ProblemCode = "plc_config" //plc配置缺失 |
| | | ProblemCodePlcAddressList ProblemCode = "plc_address_list" //plc地址表缺失 |
| | | ProblemCodePlcProcessModelAddressList ProblemCode = "plc_process_model_address_list" //plc地址表缺失 |
| | | ProblemCodePlcConnect ProblemCode = "plc_connect" //plc连接失败 |
| | | ) |
| | | |
| | | type SystemStatusKey string |
| | | |
| | | const ( |
| | | SystemStatusKeyNsq SystemStatusKey = "nsq" |
| | | ) |
| | | |
| | | type SystemStatusValue string |
| | | |
| | | const ( |
| | | SystemStatusValueNormal SystemStatusValue = "1" |
| | | SystemStatusValueUnNormal SystemStatusValue = "2" |
| | | ) |
| | | |
| | | type ReportType int //上报类型 |
| | | |
| | | const ( |
| | | ReportTypeSystemDeviceID ReportType = 1 |
| | | ReportTypeReportWork ReportType = 2 |
| | | ) |
| | | |
| | | type SyncStatus int //同步状态 |
| | | |
| | | const ( |
| | | SyncStatusWait SyncStatus = 1 //待同步 |
| | | SyncStatusOk SyncStatus = 2 //已完成 |
| | | ) |