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