From eaa7c0d999c6dd7901bf4f0de79b861eae38e978 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期三, 08 十月 2025 22:51:28 +0800 Subject: [PATCH] 代码提交 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 116 ++++++---------------------------------------------------- 1 files changed, 12 insertions(+), 104 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index a9cdf85..d76dc75 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -1,5 +1,6 @@ 锘縰sing AutoMapper; using HslCommunication; +using LogLibrary.Log; using Mapster; using Newtonsoft.Json; using SqlSugar; @@ -25,8 +26,6 @@ using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Repository; using WIDESEAWCS_QuartzJob.Service; -using WIDESEAWCS_TaskInfoRepository; -using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; namespace WIDESEAWCS_TaskInfoService { @@ -138,36 +137,16 @@ // 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓哄叆搴撲换鍔� else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) { - var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue; - var valueList = value.Split(',').ToList(); - // 鍒ゆ柇婧愬湴鍧�鏄惁涓嶇瓑浜�"1359-4" - //if (task.SourceAddress != "1359-4" && task.SourceAddress != "1357-4") - if (!valueList.Contains(task.SourceAddress)) - { - // 鏌ヨ浠庢簮鍦板潃鍒扮洰鏍囧湴鍧�鐨勮矾鐢� - List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress); - if (routers.Count > 0) - { - // 璁剧疆浠诲姟鐘舵�佷负鍏ュ簱鏂板缓 - task.TaskState = (int)TaskInStatusEnum.InNew; - // 璁剧疆褰撳墠鍦板潃涓烘簮鍦板潃 - task.CurrentAddress = item.SourceAddress; - // 璁剧疆涓嬩竴涓湴鍧�涓虹涓�涓瓙浣嶇疆 - task.NextAddress = routers.FirstOrDefault().ChildPosi; - } - } + + task.CurrentAddress = string.Empty; + if (task.SourceAddress == "1325-6") + // 璁剧疆褰撳墠鍦板潃涓�"001-021-001" + task.CurrentAddress = "001-021-001"; else - { - task.CurrentAddress = string.Empty; - if (task.SourceAddress == "1325-6") - // 璁剧疆褰撳墠鍦板潃涓�"001-021-001" - task.CurrentAddress = "001-021-001"; - else - // 璁剧疆褰撳墠鍦板潃涓�"002-021-001" - task.CurrentAddress = "002-021-001"; - // 璁剧疆涓嬩竴涓湴鍧�涓虹洰鏍囧湴鍧� - task.NextAddress = item.TargetAddress; - } + // 璁剧疆褰撳墠鍦板潃涓�"002-021-001" + task.CurrentAddress = "002-021-001"; + // 璁剧疆涓嬩竴涓湴鍧�涓虹洰鏍囧湴鍧� + task.NextAddress = item.TargetAddress; } // 灏嗚浆鎹㈠悗鐨勪换鍔℃坊鍔犲埌浠诲姟鍒楄〃涓� tasks.Add(task); @@ -188,77 +167,6 @@ } // 杩斿洖缁撴灉 return content; - } - - /// <summary> - /// 鏍规嵁鎵樼洏鍙枫�佽捣濮嬪湴鍧�鍚慦MS璇锋眰浠诲姟 - /// </summary> - /// <param name="palletCode">鎵樼洏鍙�</param> - /// <param name="sourceAddress">璧峰鍦板潃</param> - /// <returns></returns> - public async Task<WebResponseContent> RequestWMSTask(string palletCode, string sourceAddress) - { - WebResponseContent content = new WebResponseContent(); - try - { - var hasTask = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode); - if (hasTask != null) - { - var taskExecuting = BaseDal.QueryFirst(x => x.PalletCode == palletCode && x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting); - - if (taskExecuting != null) - { - taskExecuting.ExceptionMessage = "鏈帴鏀跺埌绾夸綋瀹屾垚淇″彿绯荤粺鍐呴儴鑷姩瀹屾垚"; - Delete(taskExecuting); - } - ConsoleHelper.WriteErrorLine($"褰撳墠鎵樼洏瀛樺湪浠诲姟锛氥�恵palletCode}銆�"); - QuartzLogger.WriteLogToFile($"浠诲姟寮傚父鏈畬鎴�", $"褰撳墠鎵樼洏瀛樺湪浠诲姟锛氥�恵palletCode}銆憑Environment.NewLine}"); - } - - var wmsIpAddrss = string.Empty; - var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == sourceAddress); - if (stationManager.stationType == 5) - { - wmsIpAddrss = GetIpAddress(SysConfigKeyConst.WMSIP_BASE, SysConfigKeyConst.RequestInBoundTaskNG); - } - else - { - wmsIpAddrss = GetIpAddress(SysConfigKeyConst.WMSIP_BASE, SysConfigKeyConst.RequestTask); - } - - var result = await HttpHelper.PostAsync(wmsIpAddrss, new { Position = sourceAddress, PalletCode = palletCode, stationManager.productLine }.ToJsonString()); - content = JsonConvert.DeserializeObject<WebResponseContent>(result); - - if (!content.Status) - { - // wms澶辫触杩斿洖鍘籒G鍙d换鍔� - return content; - } - - var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); - if (task.TaskType == (int)TaskInboundTypeEnum.InNG) - { - var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == task.SourceAddress); - Dt_Task _Task = _mapper.Map<Dt_Task>(task); - _Task.TaskState = (int)TaskInStatusEnum.InNew; - _Task.CurrentAddress = task.SourceAddress; - _Task.NextAddress = station.stationNGChildCode; - _Task.TargetAddress = task.TargetAddress; - - BaseDal.AddData(_Task); - _taskExecuteDetailService.AddTaskExecuteDetail(_Task.TaskNum, "鎺ユ敹WMS浠诲姟"); - return content.OK(); - } - else - { - return ReceiveWMSTask(new List<WMSTaskDTO> { task }); - } - } - catch (Exception ex) - { - QuartzLogger.WriteLogToFile($"鎺ユ敹浠诲姟寮傚父", $"鎵樼洏鍙凤細銆恵palletCode}銆戣姹傜偣浣嶏細銆恵sourceAddress}銆戝紓甯镐俊鎭�恵ex.Message}銆戝紓甯歌銆恵ex.StackTrace}銆�"); - return WebResponseContent.Instance.Error(ex.Message); - } } /// <summary> @@ -838,9 +746,9 @@ catch (Exception ex) { content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�"); - QuartzLogger.WriteLogToFile($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆戝紓甯镐俊鎭�恵ex.Message}銆憑Environment.NewLine}寮傚父淇℃伅銆恵ex.StackTrace}銆憑Environment.NewLine}"); + LogFactory.WriteError($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�", ex); } - QuartzLogger.WriteLogToFile($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚,浠诲姟鍙�:銆恵taskNum}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}"); + LogFactory.WriteInfo($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚,浠诲姟鍙�:銆恵taskNum}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}"); return content; } -- Gitblit v1.9.3