using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Threading.Tasks; using WIDESEA_Comm; using WIDESEA_Comm.LogInfo; using WIDESEA_Comm.MES_Info; using WIDESEA_Comm.MES_Info.Request; using WIDESEA_Common; using WIDESEA_Core.ManageUser; using WIDESEA_Core.Utilities; using WIDESEA_Entity.DomainModels; using WIDESEA_Entity.DomainModels.Mes; using WIDESEA_WMS.Common; using static WIDESEA_Comm.MES_Info.BasicSN; namespace WIDESEA_WMS { public partial class ToMesServer { /// /// PDA移库交接 /// /// /// public WebResponseContent agvTransferList(SaveModel saveModel) { WebResponseContent content = new WebResponseContent(); try { string sn = saveModel.MainData["sn"].ToString(); string user = saveModel.MainData["creator"].ToString(); //工单号生成 string jobID = "TW" + DateTime.Now.ToString("HH-mm-ss-ff"); //根据库存查询车轮信息 dt_inventory inventory = freeDB.Select().Where(x => x.SN.Contains(sn)).First(); if (inventory == null) { return content.Error($"无此车轮{sn}SN号,请核查库存记录!"); } List list = new List(); //车轮信息 foreach (var item in inventory.SN.Split(",")) { detail detail = new detail(); detail.sn = item; list.Add(detail); } agvTransferListPara listPara = new agvTransferListPara { details = list, transferListID = jobID, toWarehouse = "毛轮库", fromWarehouse = "AGV库", updateTime = DateTime.Now.ToString(), drawingNoVer = "", materialCode = "", Operator = user == null ? "admin" : user }; var postJson = JsonConvert.SerializeObject(listPara); string mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + "agvTransferList"); var requestMes = JsonConvert.DeserializeObject(mesData); if (requestMes.code == "200" && requestMes.Type == "success") { return content.OK("移库交接成功!"); //日志记录上传数据成功 } } catch (Exception ex) { content.Error(ex.Message); } return content; } } }