| | |
| | | using MailKit; |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using Masuit.Tools.Security; |
| | | using Masuit.Tools; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using WIDESEA_Comm; |
| | | using WIDESEA_Comm.WCSInterface.Requst; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_IStoragIntegrationServices; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_StorageTaskRepository; |
| | | |
| | | |
| | | namespace WIDESEA_StoragIntegrationServices |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="jsondata"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent genAgvSchedulingTask(Dt_Task taskinfo) |
| | | public WebResponseContent genAgvSchedulingTask(RequestTaskDto input) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(input.Position)) { return content.Error($"agvä»»å¡ä¸åç³è¯·ç®æ å°å为空ï¼ï¼ï¼è¯·æ£æ¥"); } |
| | | |
| | | //æ¥æ¾å½åå¨è½¦è½´çº¿æ«ç«¯éè¦agvæ¬è¿ç车轴 |
| | | |
| | | List<Dt_CZInfo_mes> CZInfotlist = _task_CZInfoRepository.QueryData(x => x.CurrentStatue == "3" || x.CurrentStatue == "4" || x.CurrentStatue == "5" || x.CurrentStatue == "13"); |
| | | |
| | | if (CZInfotlist.Count >= 2) { return content.Error($"å·²æagv任塿£å¨è¿è¡ä¸ï¼ä¸å失败ï¼ï¼ï¼"); } |
| | | |
| | | Dt_CZInfo_mes CZInfot = CZInfotlist.FirstOrDefault(x => x.CurrentStatue == "3" || x.CurrentStatue == "13"); |
| | | if (CZInfot == null) { return content.Error($"æªæ¾å°ç°æè¾éçº¿å®æç车轴信æ¯"); } |
| | | |
| | | CZInfot.CurrentStatue = "4"; |
| | | |
| | | |
| | | //æ¥æ¾è½¦è½´å¯¹åºçè½¦è½®ä¿¡æ¯ |
| | | List<Dt_Task> tasks=_taskRepository.QueryData(x => x.task_CZInfo == CZInfot.CZH).ToList(); |
| | | if (tasks.Count > 0) |
| | | { |
| | | foreach (var task in tasks) |
| | | { |
| | | task.Towhereabouts = input.Position; |
| | | } |
| | | } |
| | | |
| | | string agvtarget = "F1"; |
| | | if (input.Position == "2033") |
| | | { |
| | | agvtarget = "F2"; |
| | | } |
| | | |
| | | //agvåæ°è°å |
| | | genAgvSchedulingTask schedulingTask = new genAgvSchedulingTask |
| | | { |
| | | reqCode = Guid.NewGuid().ToString().Replace("-", ""), |
| | | clientCode = "WMS", |
| | | //taskTyp = tasktype, |
| | | ctnrTyp = "2", |
| | | taskTyp = "BY", |
| | | ctnrTyp = "1", |
| | | //data = taskinfo.task_barcode, |
| | | positionCodePath = new List<position> |
| | | { |
| | | new position { positionCode = taskinfo.SourceAddress, type = "05" }, |
| | | new position { positionCode = taskinfo.TargetAddress, type = "05" }, |
| | | new position { positionCode = "Q", type = "00" }, |
| | | new position { positionCode = agvtarget, type = "00" }, //å°åå¾
æ´æ¹ä¸º F1 左边 F2 å³è¾¹ |
| | | }, |
| | | priority = "1", //ä¼å
级 |
| | | agvCode = "",//agvcode, |
| | | //taskCode = taskinfo.task_id.ToString(), |
| | | }; |
| | | |
| | | CZInfot.AGVaddres = input.Position; |
| | | |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Info(true, taskinfo.ToJsonString()); |
| | | //ç¼åè°åagvæ¥å£ |
| | | string ipaddress = AGV_Interface; |
| | | |
| | | var requestBindInfo = schedulingTask.ToDictionary(); |
| | | |
| | | var respon = HttpHelper.Post(ipaddress, JsonConvert.SerializeObject(schedulingTask)); |
| | | |
| | | |
| | | var responBase = JsonConvert.DeserializeObject<AGVResponBase>(respon); |
| | | |
| | | |
| | | |
| | | |
| | | if (responBase.code == "0") |
| | | { |
| | | _task_CZInfoRepository.UpdateData(CZInfot); |
| | | if (tasks.Count > 0) |
| | | { |
| | | _taskRepository.UpdateData(tasks); |
| | | } |
| | | |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Info(true, $"è°åagv任塿åï¼ä¿®æ¹äºè½¦è½´æ¡ç ï¼{CZInfot.CZTM}çç¶ææ¹è³ï¼{CZInfot.CurrentStatue}"); |
| | | content.OK($"agvä»»å¡ä¸åæå."); |
| | | return content; |
| | | } |
| | | else |
| | | { |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Error(true, $"è°åagvä»»å¡å¤±è´¥ï¼è¿åä¿¡æ¯ï¼{responBase.message}"); |
| | | return content.Error($"请æ±å¼å¸¸ï¼{responBase.message}"); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Info(true, ex.Message); |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Error(true, ex.Message); |
| | | return content.Error($"请æ±å¼å¸¸ï¼{ex.Message}"); |
| | | } |
| | | } |