From a8f4641741af34ffbe5fd565003cc5d55bbec119 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <1247017146@qq.com> Date: 星期五, 25 四月 2025 09:49:50 +0800 Subject: [PATCH] 添加火警任务 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs | 1 .gitignore | 1 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 37 ++++++ Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs | 5 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs | 1 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 8 + Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs | 2 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs | 3 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 7 + Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs | 8 + Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 12 + /dev/null | 53 -------- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/CustomModels/DTSEmergencyTask.cs | 5 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs | 5 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs | 6 + Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 191 +++++++++++++++++-------------- 16 files changed, 197 insertions(+), 148 deletions(-) diff --git a/.gitignore b/.gitignore index d040b8d..0f30c21 100644 --- a/.gitignore +++ b/.gitignore @@ -1710,3 +1710,4 @@ /Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.13.439.2385/CodeChunks.db-wal /Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.13.439.2385/SemanticSymbols.db-shm /Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.13.439.2385/SemanticSymbols.db-wal +/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs index 9002bcf..0b6da43 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs @@ -89,6 +89,12 @@ /// </summary> [Description("鐩存帴鍑哄簱")] InToOut = 106, + + /// <summary> + /// 鐏鍑哄簱 + /// </summary> + [Description("鐏鍑哄簱")] + OutFireAlarm = 500, } public enum TaskRelocationTypeEnum diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs index be5deb7..ceb29f7 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs @@ -306,5 +306,12 @@ /// <param name="deviceNo"></param> /// <returns></returns> Dt_Task QueryRelocationTask(string deviceNo); + + /// <summary> + /// 鏌ヨ鏄惁瀛樺湪鐏浠诲姟 + /// </summary> + /// <param name="deviceNo"></param> + /// <returns></returns> + Dt_Task QueryOutFireAlarmTask(string deviceNo); } } \ No newline at end of file diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs index 0a1a0fe..6195eb6 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs @@ -676,7 +676,7 @@ catch (Exception ex) { content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�"); - QuartzLogger.WriteLogToFile($"Info_鍒嗗浠诲姟瀹屾垚", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆戝紓甯镐俊鎭�恵ex.Message}銆憑Environment.NewLine}{Environment.NewLine}"); + QuartzLogger.WriteLogToFile($"Info_鍒嗗浠诲姟瀹屾垚", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆戝紓甯镐俊鎭�恵ex.StackTrace}銆憑Environment.NewLine}{Environment.NewLine}"); } QuartzLogger.WriteLogToFile($"Info_鍒嗗浠诲姟瀹屾垚", $"浠诲姟瀹屾垚,浠诲姟鍙�:銆恵taskNum}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}"); return content; diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs index 3d3b6b5..6c2258f 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs @@ -94,7 +94,7 @@ if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { // 鍒ゆ柇浠诲姟鐩爣鍦板潃鍜岃矾寰勬槸鍚︽弧瓒崇壒瀹氭潯浠� - if ((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ")) + if (((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ"))|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm) { // 璁剧疆浠诲姟鐘舵�佷负鍑哄簱鏂板缓 task.TaskState = (int)TaskOutStatusEnum.OutNew; @@ -791,7 +791,7 @@ catch (Exception ex) { content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�"); - QuartzLogger.WriteLogToFile($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆戝紓甯镐俊鎭�恵ex.Message}銆憑Environment.NewLine}{Environment.NewLine}"); + QuartzLogger.WriteLogToFile($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆戝紓甯镐俊鎭�恵ex.StackTrace}銆憑Environment.NewLine}{Environment.NewLine}"); } QuartzLogger.WriteLogToFile($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚,浠诲姟鍙�:銆恵taskNum}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}"); return content; @@ -891,6 +891,10 @@ { return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskType == (int)TaskRelocationTypeEnum.Relocation && x.TaskState == (int)TaskStatus.Created); } + public Dt_Task QueryOutFireAlarmTask(string deviceNo) + { + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm && x.TaskState == (int)TaskOutStatusEnum.OutNew); + } public Dt_Task QueryExecutingTaskByBarcode(string barcode, string nextAddress) { diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs index 3445fb0..4db8ead 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs @@ -352,6 +352,7 @@ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, stationManager.stationNGChildCode, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); ConsoleHelper.WriteErrorLine($"銆恵conveyorLine.DeviceName}銆戞墭鐩樺彿锛氥�恵command.ConveyorLineBarcode}銆戣姹傜偣浣嶏細銆恵childDeviceCode}銆戝紓甯镐俊鎭�恵content.Message}銆�"); + WriteInfo(conveyorLine.DeviceName, $"銆恵conveyorLine.DeviceName}銆戞墭鐩樺彿锛氥�恵command.ConveyorLineBarcode}銆戣姹傜偣浣嶏細銆恵childDeviceCode}銆戝紓甯镐俊鎭�恵content.Message}銆�"); //_taskRepository.AddData(taskGW); } } diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs index 5deef7f..2d64804 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs @@ -198,7 +198,7 @@ Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); _taskService.UpdateData(newTask); } - if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && (task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001")) + if ((task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && (task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001"))|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm) { var TASKHTY = task.Adapt<Dt_Task_Hty>(); _taskRepository.DeleteData(task); @@ -220,6 +220,12 @@ private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) { Dt_Task task; + task = _taskService.QueryOutFireAlarmTask(commonStackerCrane.DeviceCode); + if (task != null) + { + return task; + } + if (commonStackerCrane.LastTaskType == null) { task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); @@ -476,7 +482,7 @@ } else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - if (task.Roadway.Contains("GW")) + if (task.Roadway.Contains("GW")|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm) { string[] endCodes = task.NextAddress.Split("-"); stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]); @@ -489,7 +495,7 @@ } else { - if ((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ")) + if (((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ")) || task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm) { string[] endCodes = task.NextAddress.Split("-"); stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]); diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs index 73152f9..61a8389 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs @@ -176,6 +176,11 @@ private Dt_Task? GetTask(CommonStackerStationCrane commonStackerCrane) { Dt_Task task; + task = _taskService.QueryOutFireAlarmTask(commonStackerCrane.DeviceCode); + if (task != null) + { + return task; + } task = _taskService.QueryRelocationTask(commonStackerCrane.DeviceCode); if (task != null) diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/CustomModels/DTSEmergencyTask.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/CustomModels/DTSEmergencyTask.cs index 5ee1b40..82884de 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/CustomModels/DTSEmergencyTask.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/CustomModels/DTSEmergencyTask.cs @@ -30,5 +30,10 @@ /// 宸烽亾 /// </summary> public string Roadway { get; set; } + + /// <summary> + /// 璐т綅ID + /// </summary> + public string LocationCode { get; set; } } } diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs index 8c0f2a0..8a4b227 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs @@ -192,6 +192,12 @@ /// </summary> [Description("鐩存帴鍑哄簱")] InToOut = 106, + + /// <summary> + /// 鐏鍑哄簱 + /// </summary> + [Description("鐏鍑哄簱")] + OutFireAlarm = 500, } public enum TaskRelocationTypeEnum @@ -273,7 +279,7 @@ /// <summary> /// 搴撳绉诲簱 /// </summary> - RelocationOut = 302 + RelocationOut = 302, } #endregion 浠诲姟绫诲瀷 diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs index bfd2724..9eb993d 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs @@ -34,6 +34,9 @@ if (string.IsNullOrEmpty(result?.PalletBarcode)) throw new Exception("涓婁紶鎵樼洏鍙蜂负绌�"); + LogFactory.GetLog("鍒嗗娴嬭瘯瀹屾垚閫氱煡").Info(true, $"\r\r--------------------------------------"); + LogFactory.GetLog("鍒嗗娴嬭瘯瀹屾垚閫氱煡").Info(true, result.ToJsonString()); + var location = _locationRepository.QueryFirst(x => x.AreaId == result.LocationArea && x.LocationCode == result.LocationID); if (location == null) throw new Exception("鏈煡搴撲綅"); diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs index bc5d0c0..274b956 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs @@ -2,6 +2,7 @@ using Masuit.Tools; using SqlSugar; using System.Text.RegularExpressions; +using System.Threading.Tasks; using WIDESEA_Cache; using WIDESEA_Core.Const; using WIDESEA_DTO.MOM; @@ -280,6 +281,36 @@ } #endregion 鍑哄簱浠诲姟瀹屾垚 + + #region 鐏浠诲姟瀹屾垚 + public async Task<WebResponseContent> CompleteOutFireAlarmTaskAsync(Dt_Task task, DtStockInfo stock) + { + WebResponseContent content = new WebResponseContent(); + (var loc, var tas) = UpdateStockAndTaskStatus(stock, task); + var taskHty = task.Adapt<Dt_Task_Hty>(); + taskHty.FinishTime = DateTime.Now; + taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.浜哄伐瀹屾垚 : (int)OperateTypeEnum.鑷姩瀹屾垚; + taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; + + DtStockInfo_Hty stockInfo_Hty = stock.Adapt<DtStockInfo_Hty>(); + stockInfo_Hty.ModifyDate = DateTime.Now; + + // 浜嬪姟澶勭悊 + await _unitOfWorkManage.UseTranAsync(async () => + { + if (task.TaskType != (int)TaskOutboundTypeEnum.OutQuality) + { + await DeleteStockInfoAsync(stock.Id); + await DeleteStockInfoDetailsAsync(stock.StockInfoDetails); + await AddStockInfoHtyAsync(stockInfo_Hty); + await UpdateLocationAsync(loc); //璐ㄦ浠诲姟闇�瑕佹寔缁攣瀹氬簱浣� + } + await DeleteTaskAsync(task.TaskId); + await AddTaskHtyAsync(taskHty); + }); + return content.OK("浠诲姟瀹屾垚鎴愬姛", task.Remark); + } + #endregion #region 绉诲簱浠诲姟瀹屾垚 @@ -599,9 +630,15 @@ case (int)TaskOutboundTypeEnum.OutTray: case (int)TaskOutboundTypeEnum.Outbound: case (int)TaskOutboundTypeEnum.OutNG: + LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", ""); return await CompleteStackTaskAsync(task, stock); + case (int)TaskOutboundTypeEnum.OutFireAlarm: + + LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鐏浠诲姟", ""); + return await CompleteOutFireAlarmTaskAsync(task, stock); + case (int)TaskRelocationTypeEnum.Relocation: return await CompleteTransferTaskAsync(task, stock); diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs index b4ea154..b046cae 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs @@ -1050,6 +1050,7 @@ .ToList() : null; + #region //// 浠庣紦瀛樹腑鑾峰彇搴撳瓨淇℃伅 //IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); //List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); @@ -1069,6 +1070,7 @@ // .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) // .FirstOrDefault(); // 淇敼鍚庣殑鏌ヨ浠g爜 + #endregion var stockInfo = await _stockInfoRepository.Db.Queryable<DtStockInfo>() .Includes(x => x.LocationInfo) .Includes(x => x.StockInfoDetails) @@ -1145,100 +1147,119 @@ if (emergencyTask == null) throw new Exception("鐏鍙傛暟涓虹┖"); - DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.Row == emergencyTask.row && x.Column == emergencyTask.column && x.Layer == emergencyTask.layer && x.AreaId == emergencyTask.zone); - if (locationInfo == null) + string[] strings = emergencyTask.LocationCode.Split("-"); + + string[] Roadways = strings[0].Select(x => x.ToString()).ToArray(); + string Roadway = string.Empty; + switch (Roadways[0]) { - throw new Exception("鏈煡搴撲綅"); + case "J": + Roadway = "JZSC" + Roadways[1]; + break; + case "G": + Roadway = "GWSC" + Roadways[1]; + break; + case "C": + Roadway = "CWSC" + Roadways[1]; + break; + default: throw new Exception("鏈瘑鍒簱浣嶇紪鐮�"); } - //鏌ユ壘娑堥槻绔欏彴 - var station = _stationManagerRepository.QueryFirst(t => t.Roadway == locationInfo.RoadwayNo - && t.stationType == (int)StationManager.FireStation - /*&& t. == "Enable"*/); - if (station == null) + for (int i = 0; i < 2; i++) { - throw new Exception("娑堥槻绔欏彴鏈厤缃�!"); - } - - //鏌ユ壘搴撳瓨淇℃伅 - var stockInfo = _stockInfoRepository.QueryFirst(x => x.LocationCode == locationInfo.LocationCode && x.LocationInfo.RoadwayNo == locationInfo.RoadwayNo); - //鎵樼洏鐮� - string barcode = string.Empty; - if (stockInfo != null) - { - barcode = stockInfo.PalletCode; - } - else - { - //鏃犲簱瀛樹俊鎭紝鐢熸垚闅忔満鎵樼洏鐮� - barcode = "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000); - } - - Dt_Task fireTask = BaseDal.QueryFirst(x => x.TaskType == 500 && x.SourceAddress == locationInfo.LocationCode && x.Roadway == station.Roadway); - - if (fireTask != null) - { - throw new Exception("宸叉坊鍔犵伀璀﹀嚭搴撲换鍔�"); - } - - int taskNum = BaseDal.GetTaskNo().Result; - Dt_Task task = new Dt_Task - { - CreateDate = DateTime.Now, - Creater = "DTS", - CurrentAddress = locationInfo.LocationCode, - Grade = 1, - Dispatchertime = DateTime.Now, - PalletCode = barcode, - Roadway = station.Roadway, - SourceAddress = locationInfo.LocationCode, - TaskState = (int)TaskOutStatusEnum.OutNew, - TaskType = 500, - TargetAddress = station.stationLocation, - NextAddress = station.stationChildCode, - TaskNum = taskNum, //_taskRepository.GetTaskNo().Result, - TaskId = 0, - }; - - // 灏濊瘯娣诲姞鏂颁换鍔� - WMSTaskDTO taskDTO = new WMSTaskDTO() - { - TaskNum = task.TaskNum.Value, - Grade = 1, - PalletCode = task.PalletCode, - RoadWay = task.Roadway, - SourceAddress = task.SourceAddress, - TargetAddress = task.TargetAddress, - TaskState = task.TaskState.Value, - Id = 0, - TaskType = 500, - }; - - var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); - var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue; - var ReceiveByWMSTask = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ReceiveByWMSTask)?.ConfigValue; - if (ReceiveByWMSTask == null || ipAddress == null) - { - throw new Exception("WMS IP 鏈厤缃�"); - } - var wmsIpAddrss = ipAddress + ReceiveByWMSTask; - - var respon = HttpHelper.Post(wmsIpAddrss, JsonConvert.SerializeObject(taskDTO)); - if (respon != null) - { - WebResponseContent respone = JsonConvert.DeserializeObject<WebResponseContent>(respon.ToString()); - if (respone.Status) + DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.Row == Convert.ToInt16(strings[1]) && x.Column == Convert.ToInt16(strings[2]) && x.Layer == (i == 0 ? Convert.ToInt16(strings[3]) * 2 - 1 : Convert.ToInt16(strings[3]) * 2) && x.RoadwayNo == Roadway); + if (locationInfo == null) { - var taskId = BaseDal.AddData(task); + throw new Exception("鏈煡搴撲綅"); + } + + //鏌ユ壘娑堥槻绔欏彴 + var station = _stationManagerRepository.QueryFirst(t => t.Roadway == locationInfo.RoadwayNo && t.stationType == (int)StationManager.FireStation); + if (station == null) + { + throw new Exception("娑堥槻绔欏彴鏈厤缃�!"); + } + + //鏌ユ壘搴撳瓨淇℃伅 + var stockInfo = _stockInfoRepository.QueryFirst(x => x.LocationCode == locationInfo.LocationCode && x.LocationInfo.RoadwayNo == locationInfo.RoadwayNo); + //鎵樼洏鐮� + string barcode = string.Empty; + if (stockInfo != null) + { + barcode = stockInfo.PalletCode; } else { - throw new Exception("WCS澶勭悊澶辫触:" + respone.Message); + //鏃犲簱瀛樹俊鎭紝鐢熸垚闅忔満鎵樼洏鐮� + barcode = "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000); } - } - else - { - throw new Exception("璇锋眰澶勭悊澶辫触"); + + Dt_Task fireTask = BaseDal.QueryFirst(x => x.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm && x.SourceAddress == locationInfo.LocationCode && x.Roadway == station.Roadway); + + if (fireTask != null) + { + throw new Exception("宸叉坊鍔犵伀璀﹀嚭搴撲换鍔�"); + } + + int taskNum = BaseDal.GetTaskNo().Result; + Dt_Task task = new Dt_Task + { + CreateDate = DateTime.Now, + Creater = "DTS", + CurrentAddress = locationInfo.LocationCode, + Grade = i == 0 ? 5 : 3, + Dispatchertime = DateTime.Now, + PalletCode = barcode, + Roadway = station.Roadway, + SourceAddress = locationInfo.LocationCode, + TaskState = (int)TaskOutStatusEnum.OutNew, + TaskType = (int)TaskOutboundTypeEnum.OutFireAlarm, + TargetAddress = station.stationLocation, + NextAddress = station.stationLocation, + TaskNum = taskNum, //_taskRepository.GetTaskNo().Result, + TaskId = 0, + }; + + // 灏濊瘯娣诲姞鏂颁换鍔� + WMSTaskDTO taskDTO = new WMSTaskDTO() + { + TaskNum = task.TaskNum.Value, + Grade = 1, + PalletCode = task.PalletCode, + RoadWay = task.Roadway, + SourceAddress = task.SourceAddress, + TargetAddress = task.TargetAddress, + TaskState = task.TaskState.Value, + Id = 0, + TaskType = task.TaskType, + }; + + var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); + var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue; + var ReceiveByWMSTask = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ReceiveByWMSTask)?.ConfigValue; + if (ReceiveByWMSTask == null || ipAddress == null) + { + throw new Exception("WMS IP 鏈厤缃�"); + } + var wmsIpAddrss = ipAddress + ReceiveByWMSTask; + + var respon = HttpHelper.Post(wmsIpAddrss, JsonConvert.SerializeObject(taskDTO)); + if (respon != null) + { + WebResponseContent respone = JsonConvert.DeserializeObject<WebResponseContent>(respon.ToString()); + if (respone.Status) + { + var taskId = BaseDal.AddData(task); + } + else + { + throw new Exception("WCS澶勭悊澶辫触:" + respone.Message); + } + } + else + { + throw new Exception("璇锋眰澶勭悊澶辫触"); + } } LogFactory.GetLog("DTS鐏鍑哄簱").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("DTS鐏鍑哄簱").Info(true, obj.ToJsonString()); diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs index c4f6241..91b0125 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs @@ -3,6 +3,7 @@ using WIDESEA_Core.Const; using WIDESEA_DTO.MOM; using WIDESEA_DTO.WMS; +using WIDESEA_StorageTaskRepository; //using WIDESEAWCS_Model.Models; @@ -78,8 +79,8 @@ // TODO 鍒ゆ柇鍦ㄩ�旀暟閲� - var needBarcode = await SqlSugarHelper.DbWCS.Queryable<dt_needBarcode>().FirstAsync(x => x.productLine == STATION.productLine); - var needCount = needBarcode.inLineNum; + var needBarcode = await SqlSugarHelper.DbWCS.Queryable<dt_needBarcode>().FirstAsync(x => x.productLine == STATION.productLine && x.fromArea == "CW"); + var needCount = needBarcode.inLineNum = BaseDal.QueryData(x => x.TargetAddress == STATION.stationChildCode).Count(); //var count = BaseDal.QueryData(x => x.TargetAddress == stationManagers[0].Roadway).Count; if (needCount < needBarcode.cacheNum) { diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs index cd1bff6..ef8ccf0 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs @@ -174,7 +174,6 @@ /// <param name="input">璇锋眰鏁版嵁</param> /// <returns></returns> [HttpPost, AllowAnonymous, Route("EmergencyTask")] - [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5绉掕妭娴� public WebResponseContent EmergencyTask([FromBody] object input) { return Service.EmergencyTask(input); diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json deleted file mode 100644 index 068f2b0..0000000 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*", - "urls": "http://*:5000", - "MainDB": "DB_WIDESEA", //褰撳墠椤圭洰鐨勪富搴擄紝鎵�瀵瑰簲鐨勮繛鎺ュ瓧绗︿覆鐨凟nabled蹇呴』涓簍rue - //杩炴帴瀛楃涓� - //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=", - //"ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", - "ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", - //"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", - //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", - //"ConnectionStringWCS": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", - "ConnectionStringWCS": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", - //璺ㄥ煙 - "Cors": { - "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О - "EnableAllIPs": true, //褰撲负true鏃讹紝寮�鏀炬墍鏈塈P鍧囧彲璁块棶銆� - // 鏀寔澶氫釜鍩熷悕绔彛锛屾敞鎰忕鍙e彿鍚庝笉瑕佸甫/鏂滄潌锛氭瘮濡俵ocalhost:8000/锛屾槸閿欑殑 - // 娉ㄦ剰锛宧ttp://127.0.0.1:1818 鍜� http://localhost:1818 鏄笉涓�鏍风殑 - "IPs": "http://127.0.0.1:8080,http://localhost:8080,http://127.0.0.1:8081,http://localhost:8081" - }, - - //缂撳瓨璁剧疆 - "CacheSettings": { - "UseRedis": false, //鍚敤redis - "RedisSettings": { - "Address": "127.0.0.1:6379", //鍦板潃 - "Password": "123456", //Redis鏈嶅姟瀵嗙爜 - "Db": 9, //榛樿搴� - "ClearRedis": true //鏄惁姣忔鍚姩閮芥竻闄edis缂撳瓨 - } - }, - - "ApiName": "WIDESEA", - "ExpMinutes": 120, - - // 闇�瑕佺Щ搴撶殑琛� - "TransfertRows": "1,4,5,8", - - // 鍏佽鍑哄簱鐨勭紪鐮� - "OutBoundMateriel": [ - { - "MaterielCode": "CC01050001523", - "ProductionLine": "ZJ-7", - "ProcessCode": "CH001" - } - ] -} -- Gitblit v1.9.3