using System;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using MainForm.ClassFile.XiaomiAPI_MES;
using static MainForm.ClassFile.XiaomiAPI_AGV.XiaomiAGVHttp_Response;
using System.Collections.Generic;
namespace MainForm.ClassFile.XiaomiAPI_AGV
{
///
/// 小米AGV(x5协议)- SMT半成品⼊库接⼝
/// SMT⽣产完毕,满载物料的容器下线,AGV配送物料⼊库。
/// 如:‘Tray盘下料装备’站 下料
/// 接⼝地址:cm.test.mi.com/ms/x5/smt/inbound
/// 接口方法:smtInbound
///
public class XiaomiAGVHttp_CallFullContainer : XiaomiMESHttp_X5
{
#region 变量
///
/// 接口地址
///
protected new static string MESUrl { set; get; } = string.Format($"{0}/x5/smt/inbound",
GlobalContext.AGVHttpHost);
///
/// 接口方法
///
protected new static string Method { set; get; } = "smtInbound";
#endregion 变量
///
/// 请求空容器补给
///
public XiaomiAGVHttp_Response Call(XmAGVCallFullContainerUnLoadingRequest_Body body)
{
XiaomiAGVHttp_Response agvResponse = new XiaomiAGVHttp_Response();
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; // 接⼝地址
dynamic request = new { header = header, body = bodyJson };
request.header = header;
request.body = bodyJson;
string data = JsonConvert.SerializeObject(request);
XiaomiMES_X5Response response = Post(MESUrl, data);
// ZS保存日志
agvResponse.header = response.header;
string responseBody = response.body;
agvResponse.body = JsonConvert.DeserializeObject(responseBody);
return agvResponse;
}
#region 入参
///
/// SMT半成品⼊库接⼝ - 入参
///
public class XmAGVCallFullContainerUnLoadingRequest_Body
{
///
/// 流⽔号
/// X520230908006
///
public string billNo { set; get; } = string.Empty;
///
/// 设备号
///
public string deviceCode { set; get; } = string.Empty;
///
/// 料站位
/// L2_TX V2_11-1-11-6-0-0
///
public string slotNo { set; get; } = string.Empty;
///
/// 容器号
///
public string containerCode { set; get; } = string.Empty;
///
/// ⼊库类型;0 半成品
///
public int inboundType { set; get; } = 0;
///
/// 质量状态;0 良品 1 不良品
///
public int qualityStatus { set; get; } = 0;
///
/// 创建时间;格式:yyyy-MM-dd HH:mm:ss
///
public string createTime { set; get; } = string.Empty;
///
/// 明细数据;不可为空
///
public ItemList itemList { set; get; } = new ItemList();
public class ItemList
{
///
/// 序号; 1,2,3,..
///
public int serial { set; get; }
///
/// 料盘编号;非必填
///
public string tray { set; get; } = string.Empty;
///
/// 主板SN;非必填
/// PSN202303300003
///
public string unitSn { set; get; } = string.Empty;
///
/// ⼩板SN;非必填
/// SN202303300003
///
public string childSn { set; get; } = string.Empty;
///
/// 备注;非必填
///
public string remark { set; get; } = string.Empty;
}
}
#endregion 入参
}
}