using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MainForm.ClassFile.XiaomiAPI_MES
{
///
/// 小米MES - 进站接⼝
/// 接口地址:
/// 接口方法:UnitConfirmDataSetIn
///
public class XiaomiMESHttp_StationInbound : XiaomiMESHttp_X5
{
#region 变量
///
/// 接口地址
///
protected new static string MESUrl { set; get; } = GlobalContext.StationInMESUrl;
///
/// 接口方法
///
protected new static string Method { set; get; } = "UnitConfirmDataSetIn";
#endregion 变量
///
/// 小米MES - 进站
///
///
///
public static XmMES_StationInResponse StationIn(XmMES_StationInRequest_Body body)
{
XmMES_StationInResponse stationInResponse = new XmMES_StationInResponse();
string bodyJson = JsonConvert.SerializeObject(body);
XiaomiMES_X5RequestHeader header = new XiaomiMES_X5RequestHeader();
header.AppId = Appid; // 系统分配的应⽤ID
header.Method = Method; // API接⼝名称
header.Sign = GetSign_Up(Appid, bodyJson, Appkey); // md5签名
header.Url = MESUrl; // 接⼝地址
XmMES_StationInRequest request = new XmMES_StationInRequest();
request.header = header;
request.body = body;
string data = JsonConvert.SerializeObject(request);
XiaomiMES_X5Response response = Post(MESUrl, data);
// ZS保存日志
stationInResponse.header = response.header;
string responseBody = response.body;
stationInResponse.body = JsonConvert.DeserializeObject(responseBody);
return stationInResponse;
}
#region 入参
///
/// 进站接⼝ - 入参
///
public class XmMES_StationInRequest
{
///
/// 进站接⼝ - 入参 - header
///
public XiaomiMES_X5RequestHeader header { get; set; } = new XiaomiMES_X5RequestHeader();
///
/// 进站接⼝ - 入参 - body
///
public XmMES_StationInRequest_Body body { get; set; } = new XmMES_StationInRequest_Body();
}
///
/// 进站接⼝ - 入参 - Body 实体
///
public class XmMES_StationInRequest_Body
{
///
/// 装备id(可配置)
///
public string machineId { get; set; } = string.Empty;
///
/// ⼯位ID(可配置)
///
public string stationId { get; set; } = string.Empty;
///
/// 客⼾端本机MAC地址,格式:XX-XX-XX-XX-XX-XX
///
public string clientMac { get; set; } = string.Empty;
///
/// 客⼾端请求时间,格式yyyy-MM-dd HH:mm:ss.fff
///
public string clientTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
///
/// 产品SN
///
public string unitSn { get; set; } = string.Empty;
///
/// ⽤⼾ID,如果接⼊了MES⽤⼾才需要传⼊;非必填
///
public string userId { get; set; } = string.Empty;
///
/// ⼯⼚id;非必填
///
public string factoryId { get; set; } = string.Empty;
}
#endregion 入参
#region 出参
///
/// 进站接⼝ - 出参
///
public class XmMES_StationInResponse
{
///
/// header字段描述
///
public XiaomiMES_X5ResponseHeader header { get; set; } = new XiaomiMES_X5ResponseHeader();
///
/// body字段描述
///
public XmMESStationIn_Body body { get; set; } = new XmMESStationIn_Body();
}
///
/// 进站接⼝ - 出参 - Body
///
public class XmMESStationIn_Body
{
///
/// 响应时间戳
///
public string serverTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
///
/// 关键参数列表
///
public List keyParamList { get; set; } = new List();
///
/// 过站回溯结果
///
public XmMESStationIn_BackResult backResult { get; set; } = new XmMESStationIn_BackResult();
//public string requestTime { get; set; } = "0";
//public string processTime { get; set; } = "0";
}
///
/// 进站接⼝ - 出参 - Body - 关键参数
///
public class XmMESStationIn_KeyParam
{
///
/// 关键参数代码
///
public string paramCode { get; set; } = string.Empty;
///
/// 关键参数Name【mitool读取】
///
public string key { get; set; } = string.Empty;
///
/// 关键参数值,如果是⽂件,这⾥是下载⽂件的url
///
public string paramValue { get; set; } = string.Empty;
}
///
/// 进站接⼝ - 出参- Body - 过站回溯结果
///
public class XmMESStationIn_BackResult
{
///
/// 回溯结果
/// PASS/FAIL
///
public string result { get; set; } = string.Empty;
///
/// 不良点位信息说明
///
public List inspectionPointDataList { get; set; } = new List();
}
///
/// 进站接⼝ - 出参- Body - 过站回溯结果 - 不良点位信息说明
///
public class XmMESStationIn_InspPointData
{
///
/// 测试顺序号
///
public string no { get; set; } = string.Empty;
///
/// 回溯结果
/// PASS/FAIL
///
public string result { get; set; } = string.Empty;
///
/// 不良项
///
public string defectCode { get; set; } = string.Empty;
///
/// 不良说明
///
public string defectDesc { get; set; } = string.Empty;
///
/// 不良位置
///
public string location { get; set; } = string.Empty;
///
/// ⼩板序号
///
public string panelNo { get; set; } = string.Empty;
}
#endregion 出参
}
}