using Masuit.Tools;
using Newtonsoft.Json;
using WIDESEA.Common;
using WIDESEA_Common;
using WIDESEA_Common.ZY;
using WIDESEA_Core;
using WIDESEA_Core.Helper;
using WIDESEA_IStoragIntegrationServices;
namespace WIDESEA_StoragIntegrationServices
{
public partial class ToZYService
{
//public static string ZY_Interface = "http://172.21.1.117/barcode/Webservice/WebService_ZY/WebServiceZY.asmx";
//public static string POSTURL = "http://172.21.1.117/barcode/Webservice/WebService_ZY/Service_EQP.asmx";
///
/// 获取车轮信息接口
///
/// 车轮
///
public WebResponseContent ZY_GetCLInfo(SaveModel saveModel)
{
WebResponseContent content = new WebResponseContent();
try
{
string cltm = saveModel.MainData["cltm"].ToString();
//cltm = "L E1700844 0037";
if (string.IsNullOrEmpty(cltm)) throw new Exception("请求车轮号不能为空");
string ipaddress = ZY_Interface + "/getCLInfostring";
CLInfo Info = new CLInfo { cltm = cltm };
var dic = Info.ToDictionary();
var responStr = HttpsClient.PostXml(ipaddress, dic);
//CLInfo_ZY info = JsonConvert.DeserializeObject(responStr);
CLInfo_ZY inf2o = XMLSerializationTool.DeserializeXmlToObject(responStr);
if (inf2o.FLAG != "S") throw new Exception($"获取信息失败:接口返回失败:{inf2o.ERROR}");
//string info2 = XMLSerializationTool.SerializeObjectToXml(responStr);
//CLInfo_ZY info_ZY = new CLInfo_ZY() //测试数据
//{
// //level = "1",
// //InboundDate = "2020-04-10",
// //gkzjjz = "520.11",
// //gkjmz = "421.1",
// //czh = "100",
// //clh = "L E123-52 4A",
// //cartype = "CRH1A",
// //Ltype = "SDA",
// //lx = "DA",
// //mttype = "crh",
// //NewOrOld = "NEW",
// //psj = "动车组",
// //sx = "da",
// //xlh = "1",
// //ygljz = "121"
//};
//inf2o.CHEXING = "CRH1A";
//inf2o.MTTYPE = "M";
if (!string.IsNullOrEmpty(inf2o.NEWOLD)) //将数字转为新旧
{
inf2o.NEWOLD = inf2o.NEWOLD == "1" ? "旧" : "新";
}
//CLInfo_ZY info_ZY = XmlToJson(responStr);
content.OK(data: inf2o);
}
catch (Exception ex)
{
content.Error("获取车轮信息失败.异常:" + ex.Message);
}
finally
{
//LogRecord.WriteLog((int)LogEnum.Mes, $"组盘查询轴承信息结果:{resultString}");
}
return content;
}
}
}