using Masuit.Tools; using Newtonsoft.Json; using OfficeOpenXml.Drawing.Chart; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEA.Common; using WIDESEA_Common; using WIDESEA_Common.ZY; using WIDESEA_Core; using WIDESEA_Core.Enums; using WIDESEA_Model.Models; namespace WIDESEA_StoragIntegrationServices { public partial class ToCheckService { public WebResponseContent GetCheckInfo(object jsondata) { WebResponseContent content = new WebResponseContent(); try { //RequsetMsg requsetMsg = JsonConvert.DeserializeObject(jsondata.ToString()); //string cltm = requsetMsg.CLTM; //if (string.IsNullOrEmpty(cltm)) throw new Exception("请求车轮号不能为空"); Dt_Task task = _taskRepository.QueryFirst(x => /*x.PalletCode == cltm &&*/ x.TaskState == (int)TaskOutStatusEnum.Lien_Check); if (task == null) throw new Exception("未查询到任务"); if (!string.IsNullOrEmpty(task.task_bak1)) { CheckInfo checkInfo = JsonConvert.DeserializeObject(task.task_bak1); LogFactory.GetLog("测量设备获取轮盘数据").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("测量设备获取轮盘数据").Info(true, checkInfo.ToJsonString()); return content.OK(data: checkInfo); } else { string ipaddress = ZY_Interface + "/getCLInfostring"; CLInfo Info = new CLInfo { cltm = task.PalletCode }; 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}"); //CheckInfo checkInfo = new CheckInfo() //{ // CarType = "CR400AF", // MTType = "M", // CheckType = "1", // HubLevel = "等级1", // CLTM = task.PalletCode, // IsCheck = true, // Standards = "1" //}; string checkType = ""; if (task.TaskType == (int)TaskOutboundTypeEnum.OutWheels) { if (task.wheels_mttype == "M") checkType = "1"; else checkType = "2"; } else if (task.TaskType == (int)TaskOutboundTypeEnum.OutBrake) { checkType = "3"; } CheckInfo checkInfo = new CheckInfo() { CarType = inf2o.CHEXING, MTType = inf2o.MTTYPE, CheckType = checkType, HubLevel = inf2o.GKDJ, CLTM = task.PalletCode, IsCheck = task.IsCheck, Standards = inf2o.NEWOLD }; LogFactory.GetLog("测量设备获取轮盘数据").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("测量设备获取轮盘数据").Info(true, checkInfo.ToJsonString()); return content.OK(data: checkInfo); } } catch (Exception ex) { LogFactory.GetLog("测量设备获取轮盘数据").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("测量设备获取轮盘数据").Info(true, ex.Message); return content.Error($"获取测量信息失败:{ex.Message}"); } } //private string GetCheckType(TaskOutboundTypeEnum tasktype, string mtType) //{ // switch (TaskOutboundTypeEnum) // { // case // TaskOutboundTypeEnum.OutWheels: // default: // break; // } //} } }