123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- namespace MainForm.ClassFile.XiaomiAPI
- {
- /// <summary>
- /// 小米 MqttClient类 - API拓展方法
- /// 过站明细
- /// 过站明细指的是与该产品的加⼯/检测相关的数据,其包括:
- /// ◦ 产品加⼯过程中的⼯艺参数(实际值)
- /// ◦ 具体测试项的明细(如果有),针对检测装备
- /// ◦ 治具信息,如载具、保压治具等
- /// ◦ 物料信息
- /// ◦ 软件版本
- ///
- /// • 加⼯站:需要上报⽣产过程所有关键⼯艺参数,除此之外,有的加⼯站会对结果进⾏检查,需要提供检测明细数据,检测规则,以及判断结果
- /// • 测试站:详细的测试结果,需要提供检测明细数据,检测规则,以及判断结果
- /// </summary>
- public partial class XiaomiMqttClient_Extend : XiaomiMqttClient
- {
- /// <summary>
- /// 过站明细- 事件Id
- /// </summary>
- private static string PassStationLogId { get; set; } = "pass_details_log/passing_station_log";
- /// <summary>
- /// 过站明细- 事件方法
- /// </summary>
- /// <param name="msg">事件数据;Json</param>
- /// <param name="dataId">自定义事件Id;如:guid</param>
- /// <returns></returns>
- public static int Write_PassStationLog(List<PassStationLogRequest> request, string dataId = "")
- {
- int result = 0;
- string msg = JsonConvert.SerializeObject(request);
- byte[] bytes = ToUTF8(msg);
- // 发送
- if (string.IsNullOrEmpty(dataId))
- result = Write(PassStationLogId, bytes);
- else
- result = WriteWithDataId(PassStationLogId, bytes, dataId);
- return result;
- }
- /// <summary>
- /// 过站明细- 参数
- /// ◦ function_name是对test_item进⾏分类聚合,同⼀类的test_item对应同⼀个function_name名称。
- /// ◦ test_item可以是装备作业过程中的检测项、算法参数、⼯艺参数等
- /// ◦ result_val可以是检测值/算法的输出值/⼯艺参数值
- /// ◦ description填写对应test_item的中⽂描述,⽤于描述这条数据的含义
- /// </summary>
- public class PassStationLogRequest
- {
- /// <summary>
- /// 过站唯⼀标识(36位)
- /// string[1,64]
- /// 要确保唯⼀性,每次过站时⽣成的ID必须唯⼀。
- /// • 对于同⼀次过站⽽⾔,过站明细中的pass_station_id字段值与过站结果中的pass_station_id字段值是⼀样的。
- /// • 与mes中的过站明细uuid字段uuidInspection要求⼀致(这两个值需确保是⼀致的,以MES为主,如果关闭MES⽣产,则此项传空字符串)
- /// </summary>
- public string pass_station_id { get; set; } = string.Empty;
- /// <summary>
- /// 产品SN
- /// string[1,64]
- /// </summary>
- public string sn { get; set; } = string.Empty;
- /// <summary>
- /// 槽位
- /// string[1,64]
- /// </summary>
- public string slot { get; set; } = string.Empty;
- /// <summary>
- /// 测试项序号
- /// string[1,32]
- /// ⽰例:1,2,递增
- /// </summary>
- public string test_item_num { get; set; } = string.Empty;
- /// <summary>
- /// 功能名称
- /// string[1,64]
- /// ⼤类(可以是检测⼤类或加⼯项⼤类),枚举值如下:
- /// • Machine_加⼯模块,加⼯相关的⼯艺参
- /// • Test_测试模块,检测项相关
- /// • Fixture_Process,治具信息
- /// • Material_Process,物料信息
- /// • Tool_Process,软件版本信息
- /// • File_Process,⽂件相关信息
- ///
- /// 命名要求(英文):
- /// ◦ 加⼯类命名要求:Machine_加⼯模块
- /// ◦ 检测类命名要求:Test_测试模块
- /// 例如:Machine_Attach、Test_Acc
- /// </summary>
- public string function_name { get; set; } = string.Empty;
- /// <summary>
- /// 测试项
- /// string[1,32]
- /// key(⼩类,可以是检测项名称或⼯艺参数名称);英文
- /// </summary>
- public string test_item { get; set; } = string.Empty;
- /// <summary>
- /// 测试值/输出值
- /// string[1,32]
- /// value(和测试项对应的值,可以是检测值/算法的输出值/⼯艺参数值)
- /// </summary>
- public string result_val { get; set; } = string.Empty;
- /// <summary>
- /// 上限值
- /// string[1,32]
- /// </summary>
- public string hi_limit { get; set; } = string.Empty;
- /// <summary>
- /// 下限值
- /// string[1,32]
- /// </summary>
- public string low_limit { get; set; } = string.Empty;
- /// <summary>
- /// 测试状态
- /// string[1,32]
- /// PASS/FAIL
- /// </summary>
- public string status { get; set; } = "PASS";
- /// <summary>
- /// 单项测试时间
- /// string[1,32]
- /// 格式:0.000000
- /// </summary>
- public string test_time { get; set; } = string.Empty;
- /// <summary>
- /// 错误码
- /// string[1,32]
- /// </summary>
- public string error_code { get; set; } = string.Empty;
- /// <summary>
- /// 描述
- /// string[1,32]
- /// 中⽂描述或说明备注信息
- /// </summary>
- public string project_code { get; set; } = string.Empty;
- }
- }
- }
|