From b7f53ba61fbc1844d7b92ff852762b140d46ab54 Mon Sep 17 00:00:00 2001 From: huanghongfeng <huanghongfeng@hnkhzn.com> Date: 星期一, 23 六月 2025 19:58:16 +0800 Subject: [PATCH] 最新 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 411 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 377 insertions(+), 34 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index 2d0468e..6a7a5e1 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -20,6 +20,7 @@ using NetTaste; using Newtonsoft.Json; using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; +using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using SqlSugar; using System; @@ -40,14 +41,16 @@ using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_Core.Enums; +using WIDESEAWCS_Core.Utilities; using WIDESEAWCS_DTO.Enum; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; -using WIDESEAWCS_QuartzJob; using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Service; +using WIDESEAWCS_TaskInfoRepository; +using static Microsoft.IO.RecyclableMemoryStreamManager; namespace WIDESEAWCS_TaskInfoService { @@ -57,6 +60,7 @@ private readonly ITaskExecuteDetailService _taskExecuteDetailService; private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository; private readonly ITask_HtyService _task_HtyService; + private readonly ITask_HtyRepository _task_HtyRepository; private readonly IMapper _mapper; private Dictionary<string, OrderByType> _taskOrderBy = new() @@ -71,20 +75,23 @@ public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList(); - public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ITask_HtyService task_HtyService) : base(BaseDal) + public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ITask_HtyService task_HtyService, ITask_HtyRepository task_HtyRepository) : base(BaseDal) { _routerService = routerService; _taskExecuteDetailService = taskExecuteDetailService; _taskExecuteDetailRepository = taskExecuteDetailRepository; _task_HtyService = task_HtyService; + _task_HtyRepository = task_HtyRepository; _mapper = mapper; } public string urlWMSTask = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlWMSTask"]; public string urlTaskCompleted = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlTaskCompleted"]; public string urlWMSMovelibraryTask = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlWMSMovelibraryTask"]; - public string urlRelocationTaskCompleted = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlRelocationTaskCompleted"]; public string urlQueryinventory = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlQueryinventory"]; + public string urlEmptyOutbound = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlEmptyOutbound"]; + public string urlRawmaterialout = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlRawmaterialout"]; + public string urlPalletQueryinventory = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlPalletQueryinventory"]; /// <summary> /// 鎺ユ敹WMS浠诲姟淇℃伅 /// </summary> @@ -105,10 +112,12 @@ Dt_Task task = _mapper.Map<Dt_Task>(item); task.TaskState = (int)TaskOutStatusEnum.OutNew; task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; + task.CreateDate = DateTime.Now; tasks.Add(task); } BaseDal.AddData(tasks); _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "鎺ユ敹WMS浠诲姟"); + content = WebResponseContent.Instance.OK("鎴愬姛"); } catch (Exception ex) @@ -128,13 +137,31 @@ /// <param name="palletCode">鎵樼洏鍙�</param> /// <param name="sourceAddress">璧峰鍦板潃</param> /// <returns></returns> + public class GenerateInv + { + public string SourceAddress { get; set; } + public string PalletCode { get; set; } + } + + public class GenerateInv3 + { + + public string PalletCode { get; set; } + public int outCount { get; set; } + public string TargetAddress { get; set; } + } public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress) { WebResponseContent content = new WebResponseContent(); try { - palletCode = "6431-jdsda-jjal333-300"; - content = HttpHelper.Get<WebResponseContent>($"{urlWMSTask}?sourceAddress={sourceAddress}&palletCode={palletCode}"); + GenerateInv generate = new GenerateInv() + { + SourceAddress=sourceAddress, + PalletCode = palletCode + }; + content = HttpHelper.Post<WebResponseContent>($"{urlWMSTask}", generate); + WriteLog.GetLog("鍏ュ簱浠诲姟鎺ユ敹").Write(JsonConvert.SerializeObject(content), "鍏ュ簱浠诲姟鎺ユ敹"); Dt_Task task = new Dt_Task(); if (content != null) { @@ -144,37 +171,144 @@ task.TaskState = (int)TaskInStatusEnum.Line_InFinish; task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; BaseDal.AddData(task); + return content; } - else - { + } - return null; - } - } - else - { - return null; - } + return content = WebResponseContent.Instance.Error(); } catch (Exception ex) { - content = WebResponseContent.Instance.Error(ex.Message); + return content = WebResponseContent.Instance.Error(ex.Message); } - return content; } /// <summary> - /// 鏌ヨ搴撲綅 + /// 杩涜缁勭洏 /// </summary> /// <param name="palletCode"></param> /// <returns></returns> public WebResponseContent ToPlatform(string palletCode) { + try + { + WebResponseContent content = new WebResponseContent(); + GenerateInv generate = new GenerateInv() + { + SourceAddress = "", + PalletCode = palletCode + }; + + return content = HttpHelper.Post<WebResponseContent>($"{urlQueryinventory}", generate); + } + catch (Exception ex) + { + + throw; + } + } + + + + /// <summary> + /// 鏍规嵁鎵樼洏鍙枫�佽捣濮嬪湴鍧�鍚慦MS璇锋眰浠诲姟 + /// </summary> + /// <param name="palletCode">鎵樼洏鍙�</param> + /// <param name="sourceAddress">璧峰鍦板潃</param> + /// <returns></returns> + public WebResponseContent RequestWMSTask2(string palletCode,string sourceAddress) + { WebResponseContent content = new WebResponseContent(); - return content = HttpHelper.Get<WebResponseContent>($"{urlQueryinventory}?palletCode={palletCode}"); + try + { + GenerateInv generate = new GenerateInv() + { + SourceAddress = sourceAddress, + PalletCode = palletCode + }; + content = HttpHelper.Post<WebResponseContent>($"{urlEmptyOutbound}", generate); + Dt_Task task = new Dt_Task(); + if (content != null) + { + if (content.Status) + { + task = JsonConvert.DeserializeObject<Dt_Task>(content.Data.ToString()); + task.TaskState = (int)TaskOutStatusEnum.OutNew; + task.TaskType = (int)TaskOutboundTypeEnum.Outbound; + task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; + BaseDal.AddData(task); + return content = WebResponseContent.Instance.OK(); + } + else + { + WriteLog.GetLog("PLC鏃ュ織鍑哄簱鏃ュ織").Write($"绌烘墭鍑哄簱澶辫触锛岃鎯咃細{content.Message}", "闇�瑕佺┖鎵�"); + } + } + return content = WebResponseContent.Instance.Error(); + } + catch (Exception ex) + { + return content = WebResponseContent.Instance.Error(ex.Message); + } + } + + /// <summary> + /// 鏍规嵁鎵樼洏鍙枫�佽捣濮嬪湴鍧�鍚慦MS璇锋眰浠诲姟 + /// </summary> + /// <param name="palletCode">鎵樼洏鍙�</param> + /// <param name="sourceAddress">璧峰鍦板潃</param> + /// <returns></returns> + public WebResponseContent RequestWMSTask3(string palletCode, int outCount,string Loc) + { + WebResponseContent content = new WebResponseContent(); + try + { + if (outCount==0) + { + outCount = 1; + } + GenerateInv3 generate = new GenerateInv3() + { + PalletCode = palletCode, + outCount = outCount, + TargetAddress= Loc + }; + content = HttpHelper.Post<WebResponseContent>($"{urlRawmaterialout}", generate); + Dt_Task task = new Dt_Task(); + if (content != null) + { + if (content.Status) + { + task = JsonConvert.DeserializeObject<Dt_Task>(content.Data.ToString()); + task.TaskState = (int)TaskOutStatusEnum.OutNew; + task.TaskType = (int)TaskOutboundTypeEnum.Outbound; + task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; + BaseDal.AddData(task); + return content = WebResponseContent.Instance.OK(); + } + } + return content = WebResponseContent.Instance.Error(); + } + catch (Exception ex) + { + return content = WebResponseContent.Instance.Error(ex.Message); + } } + public WebResponseContent RequestWMSTask4() + { + WebResponseContent content = new WebResponseContent(); + try + { + + return content = HttpHelper.Get<WebResponseContent>($"{urlPalletQueryinventory}"); + } + catch (Exception ex) + { + return content = WebResponseContent.Instance.Error(ex.Message); + } + } /// <summary> /// 鏍规嵁娣卞簱浣嶅悜wms鐢宠鍒ゆ柇娴呭簱浣嶆槸鍚︽湁璐э紝鏄惁闇�瑕佽繘琛岀Щ搴撴搷浣� /// </summary> @@ -190,15 +324,63 @@ { if (content.Status) { - if (Convert.ToInt32(content.Data) != _Task.TaskNum) + if(content.Data != null) { task = JsonConvert.DeserializeObject<Dt_Task>(content.Data.ToString()); - task.TaskState = (int)TaskRelocationTypeEnum.Relocation; - task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; - task.Grade = 3; - BaseDal.AddData(task); - return task; + if (task.TaskNum != _Task.TaskNum) + { + WriteLog.GetLog("鎺ユ敹浠诲姟").Write("绉诲簱浠诲姟锛�"+JsonConvert.SerializeObject(task), "鎺ユ敹浠诲姟"); + task.TaskState = (int)TaskRelocationTypeEnum.Relocation; + task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; + task.TaskNum = task.TaskNum; + task.Grade = 3; + task.TaskType= (int)TaskRelocationTypeEnum.Relocation; + BaseDal.AddData(task); + return task; + } } + } + else + { + WriteLog.GetLog("PLC鏃ュ織").Write($"澶辫触淇℃伅锛歿content.Message}", "绉诲簱淇℃伅"); + return null; + + } + } + + return _Task; + } + + + public Dt_Task RequestWMSTaskMovelibrary2(Dt_Task _Task) + { + WebResponseContent content = new WebResponseContent(); + content = HttpHelper.Get<WebResponseContent>($"{urlWMSMovelibraryTask}?TaskNum={_Task.TaskNum}&SourceAddress={_Task.TargetAddress}"); + Dt_Task task = new Dt_Task(); + if (content != null) + { + if (content.Status) + { + if (content.Data != null) + { + task = JsonConvert.DeserializeObject<Dt_Task>(content.Data.ToString()); + if (task.TaskNum != _Task.TaskNum) + { + WriteLog.GetLog("鎺ユ敹浠诲姟").Write("绉诲簱浠诲姟锛�" + JsonConvert.SerializeObject(task), "鎺ユ敹浠诲姟"); + task.TaskState = (int)TaskOutStatusEnum.ResRestNet; + task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; + task.TaskNum = task.TaskNum; + task.Grade = 3; + task.TaskType = (int)TaskRelocationTypeEnum.Relocation; + BaseDal.AddData(task); + return task; + } + } + } + else + { + WriteLog.GetLog("PLC鏃ュ織").Write($"澶辫触淇℃伅锛歿content.Message}", "绉诲簱淇℃伅"); + return null; } } @@ -269,10 +451,36 @@ else return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.CurrentAddress == currentAddress && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy); } + + public List<Dt_Task> CraneTaskList(string deviceNo) + { + return BaseDal.QueryData(x => x.Roadway == deviceNo && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.OutNew),TaskOrderBy); + } + + public Dt_Task CutStackerCraneTask(string deviceNo) + { + Dt_Task dt_Task = BaseDal.QueryFirst(x => x.Roadway == deviceNo && (x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish || x.TaskState == (int)TaskInStatusEnum.SC_InExecuting || x.TaskState == (int)TaskInStatusEnum.SC_InFinish)); + return dt_Task; + } + public Dt_Task IngStackerCraneTask(string deviceNo) { - string deviceNot = deviceNo == "SC01" ? "1" : "2"; - return BaseDal.QueryFirst(x => x.Roadway == deviceNot && x.TaskState == (int)TaskInStatusEnum.SC_InExecuting); + //string deviceNot = deviceNo == "SC01" ? "1" : "2"; + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskState == (int)TaskInStatusEnum.SC_InExecuting); + } + + public Dt_Task IngStackerCraneTask2(string deviceNo) + { + //string deviceNot = deviceNo == "SC01" ? "1" : "2"; + try + { + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting); + } + catch (Exception ex) + { + + throw; + } } /// <summary> @@ -322,7 +530,12 @@ /// <returns>杩斿洖浠诲姟瀹炰綋瀵硅薄闆嗗悎锛屽彲鑳戒负null</returns> public List<Dt_Task> QueryStationIsOccupiedOutTasks(string deviceNo, string SourceAddress) { - return BaseDal.QueryData(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew && SourceAddress.Contains(x.SourceAddress), TaskOrderBy); + return BaseDal.QueryData(x => x.Roadway == deviceNo && SourceAddress.Contains(x.SourceAddress), TaskOrderBy); + } + + public List<Dt_Task> QueryStationIsOccupiedOutTasks2(string deviceNo, string TargetAddress) + { + return BaseDal.QueryData(x => x.Roadway == deviceNo && TargetAddress.Contains(x.SourceAddress), TaskOrderBy); } /// <summary> @@ -385,6 +598,19 @@ { Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�"); + + if(task.TaskType == (int)TaskRelocationTypeEnum.Relocation) + { + if (task.TaskState != (int)TaskOutStatusEnum.ResRestNet) + { + return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�"); + } + task.TaskState = (int)TaskOutStatusEnum.ResRest; //涓嬪彂绉诲簱浠诲姟 + task.ModifyDate = DateTime.Now; + task.Modifier = "System"; + BaseDal.UpdateData(task); + } + return UpdateTaskStatusToNext(task); } catch (Exception ex) @@ -522,6 +748,12 @@ /// </summary> /// <param name="taskNum">浠诲姟缂栧彿</param> /// <returns>杩斿洖澶勭悊缁撴灉</returns> + public class GenerateInv2 + { + public string PalletCode { get; set; } + public string SourceAddress { get; set; } + public string TargetAddress { get; set; } + } public WebResponseContent StackCraneTaskCompleted(int taskNum) { WebResponseContent content = new WebResponseContent(); @@ -534,9 +766,14 @@ { /*List<Dt_Router> routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress); if (!routers.Any()) return WebResponseContent.Instance.Error($"鏈壘鍒拌澶囪矾鐢变俊鎭�");*/ - - content = HttpHelper.Get<WebResponseContent>($"{urlTaskCompleted}?TaskNum={task.TaskNum}"); task.TaskState = (int)TaskOutStatusEnum.OutFinish; + BaseDal.UpdateData(task); + + + content = HttpHelper.Get<WebResponseContent>($"{urlTaskCompleted}?TaskNum={task.TaskNum}&HowWorks=2"); + + wcs_PLCto09("鍑哄簱浠诲姟", $"鏉$爜锛歿task.PalletCode},浠诲姟鍙凤細{task.TaskNum}", $"璋冨彇wms浠诲姟鍙嶉锛歿JsonConvert.SerializeObject(content)}"); + task.ModifyDate = DateTime.Now; BaseDal.DeleteData(task); _task_HtyService.AddTaskHty(task); @@ -547,10 +784,14 @@ } else if (task.TaskType == (int)TaskInboundTypeEnum.Inbound && task.TaskState == (int)TaskInStatusEnum.SC_InExecuting) { - content = HttpHelper.Get<WebResponseContent>($"{urlTaskCompleted}?TaskNum={task.TaskNum}"); + task.TaskState = (int)TaskInStatusEnum.InFinish; + BaseDal.UpdateData(task); + + content = HttpHelper.Get<WebResponseContent>($"{urlTaskCompleted}?TaskNum={task.TaskNum}&HowWorks=2"); + + wcs_PLCto09("鍏ュ簱浠诲姟", $"鏉$爜锛歿task.PalletCode},浠诲姟鍙凤細{task.TaskNum}", $"璋冨彇wms浠诲姟鍙嶉锛歿JsonConvert.SerializeObject(content)}"); //todo //int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>(); - task.TaskState = (int)TaskInStatusEnum.InFinish; task.ModifyDate = DateTime.Now; task.Modifier = "System"; BaseDal.DeleteData(task); @@ -560,8 +801,13 @@ } else if (task.TaskType == (int)TaskRelocationTypeEnum.Relocation) { - content = HttpHelper.Get<WebResponseContent>($"{urlRelocationTaskCompleted}?PalletCode={task.PalletCode}&SourceAddress ={ task.SourceAddress}TargetAddress ={task.TargetAddress}"); - task.TaskState = (int)TaskOutStatusEnum.SC_OutFinish; + task.TaskState = (int)TaskOutStatusEnum.OutRest; + BaseDal.UpdateData(task); + + content = HttpHelper.Get<WebResponseContent>($"{urlTaskCompleted}?TaskNum={task.TaskNum}&HowWorks=2"); + + wcs_PLCto09("鍏ュ簱浠诲姟", $"鏉$爜锛歿task.PalletCode},浠诲姟鍙凤細{task.TaskNum}", $"璋冨彇wms浠诲姟鍙嶉锛歿JsonConvert.SerializeObject(content)}"); + task.ModifyDate = DateTime.Now; BaseDal.DeleteData(task); _task_HtyService.AddTaskHty(task); @@ -579,9 +825,19 @@ } catch (Exception ex) { - content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�"); + content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆戯紝鍘熷洜锛歿ex.Message}"); } return content; + } + + public WebResponseContent StackCraneTashty(int taskNum) + { + WebResponseContent content = new WebResponseContent(); + int taskcount = _task_HtyRepository.QueryData(x =>x.TaskNum == taskNum && x.CreateDate >= DateTime.Now.AddMinutes(-30)).Count(); + + if (taskcount>0) return WebResponseContent.Instance.OK(); + + return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅锛屾椂闂翠笉鍦ㄨ寖鍥村唴,浠诲姟鍙蜂负锛歿taskNum}"); } /// <summary> @@ -674,5 +930,92 @@ } return content; } + + + /// <summary> + /// 鍒犻櫎鏁版嵁 + /// </summary> + /// <param name="keys">涓婚敭鏁扮粍</param> + /// <returns></returns> + public virtual WebResponseContent DeleteData(object[] keys) + { + try + { + List<Dt_Task> tasks = BaseDal.QureyDataByIds(keys); + foreach (Dt_Task task in tasks) + { + _task_HtyService.AddTaskHty(task); + } + + + if (typeof(Dt_Task).GetNavigatePro() == null) + return BaseDal.DeleteDataByIds(keys) ? WebResponseContent.Instance.OK() : WebResponseContent.Instance.Error(); + else + { + if (keys != null) + { + Type detailType = typeof(Dt_Task).GetDetailType(); + string name = typeof(Dt_Task).GetMainIdByDetail(); + List<object> dynamicDelKeys = new List<object>(); + + for (int i = 0; i < keys.Length; i++) + { + dynamicDelKeys.Add(keys[i]); + } + ((SqlSugarClient)BaseDal.Db).BeginTran(); + + if (dynamicDelKeys.Count > 0) + BaseDal.Db.Deleteable<object>().AS(detailType.Name).Where($"{name} in (@id)", new { id = dynamicDelKeys.ToArray() }).ExecuteCommandHasChange(); + + BaseDal.DeleteDataByIds(keys); + + ((SqlSugarClient)BaseDal.Db).CommitTran(); + + return WebResponseContent.Instance.OK(); + } + else + { + return WebResponseContent.Instance.Error("鍙傛暟閿欒"); + } + } + } + catch (Exception ex) + { + ((SqlSugarClient)BaseDal.Db).RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } + + public WebResponseContent ReceiveWCSTask(int tasknum) + { + Dt_Task tasks = BaseDal.QueryFirst(x => x.TaskNum == tasknum); + if(tasks == null) + { + return WebResponseContent.Instance.Error(); + } + else + { + try + { + _task_HtyService.AddTaskHty(tasks); + BaseDal.DeleteData(tasks); + WriteLog.Write_Log("WMS鎵嬪姩鍒犻櫎浠诲姟", "鍒犻櫎鎴愬姛", $"鐢宠鍒犻櫎鐨勬潯鐮侊細{tasks.TaskNum},鎵樼洏鏉$爜锛歿tasks.PalletCode}", new { 淇℃伅 = "鍒犻櫎鎴愬姛" }); + return WebResponseContent.Instance.OK(); + + } + catch (Exception ex) + { + WriteLog.Write_Log("WMS鎵嬪姩鍒犻櫎浠诲姟", "鍒犻櫎澶辫触", $"鐢宠鍒犻櫎鐨勬潯鐮侊細{tasks.TaskNum},鎵樼洏鏉$爜锛歿tasks.PalletCode}", new { 淇℃伅 = ex.Message }); + return WebResponseContent.Instance.Error(); + } + } + + } + + + public void wcs_PLCto09(string SCLLinStack, string Logtype, string Magessadd) + { + WriteLog.Write_Log("浠诲姟瀹屾垚浜や簰", SCLLinStack, Logtype, new { 淇℃伅 = Magessadd }); + } } } -- Gitblit v1.9.3