From f3ec4fe9c98a87b42b00b6ac4790fe156a32aa6b Mon Sep 17 00:00:00 2001 From: huanghongfeng <huanghongfeng@hnkhzn.com> Date: 星期四, 19 六月 2025 16:53:20 +0800 Subject: [PATCH] 最新 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/genAgvSchedulingTask.cs | 97 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 73 insertions(+), 24 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/genAgvSchedulingTask.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/genAgvSchedulingTask.cs" index 51d2775..6b5281c 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/genAgvSchedulingTask.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/genAgvSchedulingTask.cs" @@ -1,20 +1,16 @@ -锘縰sing MailKit; -using Mapster; -using Masuit.Tools; -using Masuit.Tools.Security; +锘縰sing 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 { @@ -25,40 +21,93 @@ /// </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浠诲姟涓嬪彂鐢宠鐩爣鍦板潃涓虹┖锛侊紒锛佽妫�鏌�"); } + //鏌ユ壘褰撳墠鍦ㄨ溅杞寸嚎鏈闇�瑕乤gv鎼繍鐨勮溅杞� + + 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浠诲姟姝e湪杩涜涓紝涓嬪彂澶辫触锛侊紒锛�"); } + + 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; - return content; + 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}"); } } -- Gitblit v1.9.3