From ef7ff6f2da6051b0a0db3babd61a29ed69e3e228 Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期三, 15 一月 2025 11:24:04 +0800 Subject: [PATCH] 增强API与状态管理,优化配置及文档 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerStationCrane.cs | 11 + Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json | 6 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs | 57 +++++++++-- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 45 +++++++- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MCS/MCSController.cs | 20 ++++ Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs | 24 ++++ Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs | 7 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 17 ++ 项目资料/通信协议/堆垛机通信协议.xlsx | 0 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequsetCellInfo.cs | 10 + Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs | 10 + Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs | 12 ++ Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoService.cs | 1 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 6 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/MCSService.cs | 6 + Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs | 2 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoController.cs | 6 + Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs | 24 ++++ 18 files changed, 220 insertions(+), 44 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs index bb6c121..c49543b 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs @@ -42,9 +42,15 @@ { #region Private Member - // 甯搁噺 + /// <summary> + /// 瀹屾垚淇″彿绛夊緟鏃堕棿 + /// </summary> private const int WaitTimeout = 20 * 6000; - private const int ReadTimeout = 1500; + + /// <summary> + /// 瀹屾垚淇″彿璇诲彇棰戠巼 + /// </summary> + private const int ReadTimeout = 100; /// <summary> /// 鍫嗗灈鏈洪�氳瀵硅薄 diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerStationCrane.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerStationCrane.cs index e597ca1..e9b9cf1 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerStationCrane.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerStationCrane.cs @@ -42,9 +42,16 @@ { #region Private Member - // 甯搁噺 + + /// <summary> + /// 瀹屾垚淇″彿绛夊緟鏃堕棿 + /// </summary> private const int WaitTimeout = 20 * 6000; - private const int ReadTimeout = 1500; + + /// <summary> + /// 瀹屾垚淇″彿璇诲彇棰戠巼 + /// </summary> + private const int ReadTimeout = 100; /// <summary> /// 鍫嗗灈鏈洪�氳瀵硅薄 diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs index 8b0cdd3..c29ab59 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs @@ -1,4 +1,5 @@ 锘�#region << 鐗� 鏈� 娉� 閲� >> + /*---------------------------------------------------------------- * 鍛藉悕绌洪棿锛歐IDESEAWCS_QuartzJob * 鍒涘缓鑰咃細鑳$搴� @@ -11,8 +12,9 @@ * 淇敼鏃堕棿锛� * 鐗堟湰锛歏1.0.1 * 淇敼璇存槑锛� - * + * *----------------------------------------------------------------*/ + #endregion << 鐗� 鏈� 娉� 閲� >> using System; @@ -105,6 +107,12 @@ PickUpCompleted, /// <summary> + /// 璇锋眰鏀捐揣 + /// </summary> + [Description("璇锋眰鏀捐揣")] + RequestPut, + + /// <summary> /// 鏀捐揣涓� /// </summary> [Description("鏀捐揣涓�")] @@ -123,6 +131,18 @@ WorkCompleted, /// <summary> + /// 绌哄嚭搴� + /// </summary> + [Description("绌哄嚭搴�")] + EmptyOutbound, + + /// <summary> + /// 閲嶅叆搴� + /// </summary> + [Description("閲嶅叆搴�")] + reInStock, + + /// <summary> /// 浠诲姟鎵ц閿欒 /// </summary> [Description("浠诲姟鎵ц閿欒")] @@ -134,4 +154,4 @@ [Description("鏈煡")] Unkonw } -} +} \ No newline at end of file diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs index 57266ce..3479aa7 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs @@ -473,7 +473,7 @@ private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, Platform platform) { var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode); - if (tasks.Count < index) + if (tasks.Count < platform.Capacity) { #region 璋冪敤WMS鑾峰彇鍑哄簱浠诲姟 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 501c327..25b0ab3 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs @@ -87,6 +87,8 @@ if (taskNum == 0) { ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″彿涓恒�恵0}銆�,浠诲姟鍙蜂笉涓�鑷村彲浠ヤ笅鍙戜换鍔�", ConsoleColor.DarkBlue); + + Thread.Sleep(1000); bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); if (sendFlag) { @@ -158,7 +160,9 @@ { if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { - string str = $"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆�"; + ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満浣滀笟鐘舵�侊細銆恵(int)commonStackerCrane.StackerCraneWorkStatusValue}銆戞椂闂淬�恵DateTime.Now}銆�", ConsoleColor.Magenta); + + string str = $"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�"; WriteInfo(commonStackerCrane.DeviceName, str); ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue); var task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum); @@ -200,7 +204,7 @@ _htyRepository.AddData(TASKHTY); } var isWorkType = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); - str = $"WMS|WCS浠诲姟瀹屾垚锛氥�恵content.Status}銆�,鍫嗗灈鏈哄畬鎴愪俊鍙峰啓鍏ワ細銆恵isWorkType}銆�,浠诲姟鍙凤細銆恵e.TaskNum}銆�,鎵樼洏鍙凤細銆恵task.PalletCode}銆�"; + str = $"{commonStackerCrane.DeviceName}銆慦MS|WCS浠诲姟瀹屾垚锛氥�恵content.Status}銆�,鍫嗗灈鏈哄畬鎴愪俊鍙峰啓鍏ワ細銆恵isWorkType}銆�,浠诲姟鍙凤細銆恵e.TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�"; WriteInfo(commonStackerCrane.DeviceName, str); ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue); } @@ -251,17 +255,22 @@ WriteInfo(commonStackerCrane.DeviceName, log); task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task.TaskId); + + if (task == null) + { + task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); + } } else { return task; } + } else if (task == null) { task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); } - return task; } @@ -479,7 +488,7 @@ } else { - if (task.TargetAddress == "002-021-001" && task.Roadway.Contains("JZ") && task.TaskType == (int)TaskOutboundTypeEnum.OutTray) + if ((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ")) { 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 b9db636..8e4d073 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using Quartz; using System.Diagnostics.CodeAnalysis; +using System.Text; using System.Threading.Tasks; using WIDESEAWCS_BasicInfoRepository; using WIDESEAWCS_Common.TaskEnum; @@ -76,9 +77,21 @@ StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); if (stackerCraneTaskCommand != null) { + Thread.Sleep(1000); bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); if (sendFlag) { + //commonStackerCrane.LastTaskType = task.TaskType; + //_taskService.UpdateTaskStatusToNext(task.TaskNum); + StringBuilder builder = new StringBuilder(); + builder.AppendLine(); + builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満鐘舵�侊細銆恵commonStackerCrane.StackerCraneStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�"); + builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戞墜鑷姩鐘舵�侊細銆恵commonStackerCrane.StackerCraneAutoStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�"); + builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戜綔涓氱姸鎬侊細銆恵commonStackerCrane.StackerCraneWorkStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�"); + builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戜笅鍙戜换鍔℃垚鍔�,銆恵JsonConvert.SerializeObject(stackerCraneTaskCommand, Formatting.Indented)}銆�"); + builder.AppendLine($"鏃堕棿锛氥�恵DateTime.Now}銆�"); + builder.AppendLine(); + ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue); commonStackerCrane.LastTaskType = task.TaskType; _taskService.UpdateTaskStatusToNext(task.TaskNum); } @@ -134,7 +147,9 @@ { if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { - string str = $"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆�"; + ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満浣滀笟鐘舵�侊細銆恵(int)commonStackerCrane.StackerCraneWorkStatusValue}銆戞椂闂淬�恵DateTime.Now}銆�", ConsoleColor.Magenta); + + string str = $"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�"; WriteInfo(commonStackerCrane.DeviceName, str); ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue); @@ -142,7 +157,7 @@ commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); var isWorkType = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); - str = $"WMS|WCS浠诲姟瀹屾垚锛氥�恵content.Status}銆�,鍫嗗灈鏈哄畬鎴愪俊鍙峰啓鍏ワ細銆恵isWorkType}銆�,浠诲姟鍙凤細銆恵e.TaskNum}銆�"; + str = $"{commonStackerCrane.DeviceName}銆慦MS|WCS浠诲姟瀹屾垚锛氥�恵content.Status}銆�,鍫嗗灈鏈哄畬鎴愪俊鍙峰啓鍏ワ細銆恵isWorkType}銆�,浠诲姟鍙凤細銆恵e.TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�"; WriteInfo(commonStackerCrane.DeviceName, str); ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue); } @@ -198,6 +213,11 @@ { return task; } + + if (task == null) + { + task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); + } } else if (task == null) { diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs index 1f8b3aa..7f0c418 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs @@ -30,6 +30,11 @@ /// MOM鎺ュ彛鍦板潃 /// </summary> public const string SYS_MOMIPAddress = "SYS_MOMIPAddress"; + + /// <summary> + /// 鐗规畩鍏ュ簱鍒嗛厤 + /// </summary> + public const string CONFIG_SYS_InStacker = "SYS_InStacker"; } /// <summary> @@ -66,6 +71,7 @@ /// 閭鍐呭鏍囬 /// </summary> public const string SMTP_ContentTitle = "smtpContentTitle"; + /// <summary> /// 閭鍐呭鏍囬 /// </summary> @@ -131,10 +137,14 @@ /// </summary> public const string ReceiveTask = "ReceiveTask"; - /// <summary> /// 璇锋眰WCS浠诲姟 /// </summary> public const string GetStation = "GetStation"; + + /// <summary> + /// 鏄惁鍏ュ簱绌烘墭鐩� + /// </summary> + public const string InboundIsEmpty = "InboundIsEmpty"; } } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoService.cs index 9f1ddfa..53e59ca 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoService.cs @@ -2,4 +2,5 @@ public interface IStockInfoService : IService<DtStockInfo> { + Task<Dictionary<string, int>> GetLocationByStockType(bool stockType, string areaCode); } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/MCSService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/MCSService.cs index daf0677..d224489 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/MCSService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/MCSService.cs @@ -4,10 +4,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using WIDESEA_IBusinessesRepository; using WIDESEA_IServices; using WIDESEA_IStorageBasicRepository; using WIDESEA_IStorageTaskRepository; using WIDESEA_IStoragIntegrationServices; +using WIDESEA_Repository; using WIDESEAWCS_BasicInfoRepository; namespace WIDESEA_StoragIntegrationServices @@ -19,15 +21,17 @@ private readonly IStockInfoRepository _stockInfoRepository; private readonly ISys_ConfigService _configService; private readonly IDt_StationManagerRepository _stationManagerRepository; + private readonly IDt_AreaInfoRepository _areaInfoRepository; private readonly LogFactory LogFactory = new LogFactory(); - public MCSService(ILocationInfoRepository locationRepository,IDt_TaskRepository taskRepository,IStockInfoRepository stockInfoRepository, ISys_ConfigService configService, IDt_StationManagerRepository stationManagerRepository) + public MCSService(ILocationInfoRepository locationRepository,IDt_TaskRepository taskRepository,IStockInfoRepository stockInfoRepository, ISys_ConfigService configService, IDt_StationManagerRepository stationManagerRepository,IDt_AreaInfoRepository dt_AreaInfoRepository) { _locationRepository = locationRepository; _taskRepository = taskRepository; _stockInfoRepository = stockInfoRepository; _configService = configService; _stationManagerRepository = stationManagerRepository; + _areaInfoRepository = dt_AreaInfoRepository; } } } diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequsetCellInfo.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequsetCellInfo.cs index 9ec1468..ea59c06 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequsetCellInfo.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequsetCellInfo.cs @@ -7,6 +7,8 @@ using System.Threading.Tasks; using WIDESEA_Core; using WIDESEA_DTO; +using WIDESEA_IBusinessesRepository; +using WIDESEA_Repository; namespace WIDESEA_StoragIntegrationServices { @@ -24,9 +26,13 @@ { if (string.IsNullOrEmpty(json.ToString())) throw new Exception("涓婁紶鍙傛暟涓虹┖"); + var result = JsonConvert.DeserializeObject<RequsetCellInfo>(json.ToString()); - var info = _stockInfoRepository.QueryFirst(x => x.LocationCode == result.LocationID); + var area = _areaInfoRepository.QueryFirst(x => x.AreaID == result.LocationArea); + + var info = _stockInfoRepository.QueryFirst(x => x.LocationCode == result.LocationID && x.AreaCode == area.AreaCode); + //todo if (info != null) { @@ -36,7 +42,7 @@ } else { - return new { code = 0, palletBarcode = "",message="搴撲綅鏃犲簱瀛樿褰�" }; + return new { code = 0, palletBarcode = "", message = "搴撲綅鏃犲簱瀛樿褰�" }; } } diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs index a4044f6..5ab2700 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs @@ -11,6 +11,11 @@ { } + /// <summary> + /// 鍒嗛〉 + /// </summary> + /// <param name="options"></param> + /// <returns></returns> public override PageGridData<DtStockInfo> GetPageData(PageDataOptions options) { var data = base.GetPageData(options); @@ -24,19 +29,51 @@ return data; } + /// <summary> + /// 鎵归噺鍒犻櫎 + /// </summary> + /// <param name="keys"></param> + /// <returns></returns> public override WebResponseContent DeleteData(object[] keys) { - List<DtStockInfo_Hty> stockInfos = new List<DtStockInfo_Hty>(); - foreach (var item in keys) + try { - var stock = BaseDal.QueryFirstNavAsync(x => x.Id == item.ObjToInt()).Result; - var stockHty = stock.Adapt<DtStockInfo_Hty>(); - stockInfos.Add(stockHty); - } - var hty = BaseDal.Db.InsertNav(stockInfos) - .Include(x => x.StockInfoDetails) - .ExecuteCommand(); - return base.DeleteData(keys); + List<DtStockInfo_Hty> stockInfos = new List<DtStockInfo_Hty>(); + List<DtLocationInfo> locationInfos = new List<DtLocationInfo>(); + foreach (var item in keys) + { + var stock = BaseDal.QueryFirstNavAsync(x => x.Id == item.ObjToInt()).Result; + var stockHty = stock.Adapt<DtStockInfo_Hty>(); + stockInfos.Add(stockHty); + + var location = SqlSugarHelper.DbWMS.Queryable<DtLocationInfo>().FirstAsync(x => x.Id == stock.LocationId).Result; + location.LocationStatus = (int)LocationEnum.Free; + locationInfos.Add(location); + } + + var hty = BaseDal.Db.InsertNav(stockInfos) + .Include(x => x.StockInfoDetails) + .ExecuteCommand(); + + var locationd = SqlSugarHelper.DbWMS.Updateable(locationInfos).ExecuteCommandHasChange(); + return base.DeleteData(keys); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + + // 鏍规嵁浼犲叆搴撳瓨绫诲瀷鑾峰彇涓嶅悓宸烽亾鐨勫簱瀛� + public async Task<Dictionary<string, int>> GetLocationByStockType(bool stockType,string areaCode) + { + var stockInfos = await BaseDal.Db.Queryable<DtStockInfo>().Where(x => x.IsFull == stockType && x.AreaCode == areaCode) + .Includes(x => x.LocationInfo).ToListAsync(); + + var result = stockInfos + .GroupBy(x => x.LocationInfo.RoadwayNo) + .ToDictionary(x => x.Key, x => x.Count()); + return result; } } \ No newline at end of file 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 88aa8f9..54cb5c1 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 @@ -1,4 +1,5 @@ -锘縰sing Mapster; +锘縰sing Autofac.Core; +using Mapster; using Masuit.Tools; using System.Text.RegularExpressions; using WIDESEA_Core.Const; @@ -992,12 +993,19 @@ if (result.SerialNos.Count <= 0) { - return await RequestTrayInTaskAsync(input); + var config = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.InboundIsEmpty); + var strings = config.ConfigValue.Split(',').ToList(); + if (strings.Contains(input.Position)) + { + // todo閫佽嚦NG鍙� + ConsoleHelper.WriteErrorLine($"褰撳墠浣嶇疆涓嶈兘鍏ョ┖鎵樼洏"); + return content.Error("褰撳墠浣嶇疆涓嶈兘鍏ョ┖鎵樼洏"); + } + else + return await RequestTrayInTaskAsync(input); } else { - - // 澶勭悊寮傚父鐢佃姱鎯呭喌 var serialNosError = result.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); if (serialNosError.Count > 0) @@ -1152,7 +1160,7 @@ // 鏍规嵁鎵樼洏绫诲瀷鏌ヨ搴撳瓨淇℃伅 DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound ? areaCode != "CWSC1" ? await QueryStockInfoForRealTrayAsync(areaCode, areaCodes, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine) - : await QueryStockInfoForEmptyTrayAsync(areaCode); + : await QueryStockInfoForEmptyTrayAsync(areaCode, position); if (stockInfo == null) { @@ -1192,6 +1200,7 @@ { // 璁板綍寮傚父淇℃伅骞舵姏鍑� LogFactory.GetLog("璇锋眰鎵樼洏浠诲姟").Error(true, ex); + ConsoleHelper.WriteErrorLine("璇锋眰绌�/瀹炴墭鐩樹换鍔�" + ex.Message); return content.Error(ex.Message); } } @@ -1231,12 +1240,19 @@ return null; } + var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() + .Where(x => x.DeviceStatus == "1") + .Where(x => x.DeviceRemark == "1") + .ToList(); + var deviceCode = devices.Select(x => x.DeviceCode).ToList(); + var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() .Includes(x => x.LocationInfo) // 棰勫姞杞絃ocationInfo .Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails .Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢 .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && areaId.Contains(x.LocationInfo.AreaId) && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢 + .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) .OrderBy(x => x.OutboundTime) // 鎺掑簭 .FirstAsync(); // 鑾峰彇绗竴涓厓绱� @@ -1249,9 +1265,23 @@ /// <summary> /// 鏌ヨ绌虹洏搴撳瓨淇℃伅 /// </summary> - private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode) + private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode,string position) { var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); + + ConsoleHelper.WriteColorLine(position + "..." + areaCode, ConsoleColor.Magenta); + var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == position && x.stationType == 17); + + ConsoleHelper.WriteColorLine(station.Roadway, ConsoleColor.Magenta); + var stackers = station.Roadway.Split(',').ToList(); + + + var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() + .Where(x => x.DeviceStatus == "1") + .Where(x => stackers.Contains(x.DeviceCode)) + .ToList(); + + var deviceCode = devices.Select(x => x.DeviceCode).ToList(); var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() .Includes(x => x.LocationInfo) // 棰勫姞杞絃ocationInfo @@ -1259,6 +1289,7 @@ .Where(x => x.AreaCode == areaCode && x.IsFull == false) .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "绌烘墭鐩�")) .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢 + .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) .OrderBy(x => x.CreateDate) // 鎺掑簭 .FirstAsync(); // 杞崲涓哄垪琛� @@ -1274,7 +1305,7 @@ { return new Dt_Task { - Grade = tag == 104 ? 2 : 1, + Grade = tag == 104 ? (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") ? 1 : 2) : (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") ? 2 : 1), Roadway = stockInfo.LocationInfo.RoadwayNo, TargetAddress = position, Dispatchertime = DateTime.Now, 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 4962235..40ef704 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 @@ -100,7 +100,7 @@ WMSTaskDTO taskDTO = new WMSTaskDTO() { TaskNum = task.TaskNum.Value, - Grade = 1, + Grade = task.Grade.Value, PalletCode = task.PalletCode, RoadWay = task.Roadway, SourceAddress = task.SourceAddress, @@ -532,7 +532,7 @@ var task = new Dt_Task { CurrentAddress = input.Position, - Grade = 1, + Grade = 2, Roadway = input.Roadways, TargetAddress = stationManager.stationLocation, Dispatchertime = DateTime.Now, @@ -859,7 +859,7 @@ var location = locations.OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault(); - var stockInfo = await QueryStockInfoForEmptyTrayAsync("CWSC1"); + var stockInfo = await QueryStockInfoForEmptyTrayAsync("CWSC1","10086"); if (stockInfo != null) { diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoController.cs index ddec94f..a4d285c 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoController.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoController.cs @@ -9,4 +9,10 @@ public StockInfoController(IStockInfoService service) : base(service) { } + + [HttpGet, AllowAnonymous, Route("GetLocationByStockType")] + public Task<Dictionary<string, int>> GetLocationByStockType(bool stockType, string areaCode) + { + return Service.GetLocationByStockType(stockType, areaCode); + } } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MCS/MCSController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MCS/MCSController.cs index c78b08b..eee0b1a 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MCS/MCSController.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MCS/MCSController.cs @@ -20,24 +20,44 @@ _MCSService = MCSService; } + /// <summary> + /// 鍒嗗娴嬭瘯瀹屾垚閫氱煡 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> [HttpPost, Route("NotifyFinishTest"), AllowAnonymous] public WebResponseContent NotifyFinishTest([FromBody] object input) { return _MCSService.NotifyFinishTest(input); } + /// <summary> + /// 璇锋眰绉诲簱 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> [HttpPost, Route("RequestChangeLocation"), AllowAnonymous] public WebResponseContent RequestChangeLocation([FromBody] object input) { return _MCSService.RequestChangeLocation(input); } + /// <summary> + /// 鍒嗗搴撲綅鍚屾 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> [HttpPost, Route("ModifyAccessStatus"), AllowAnonymous] public WebResponseContent ModifyAccessStatus([FromBody] object input) { return _MCSService.ModifyAccessStatus(input); } + /// <summary> + /// 鍒嗗鑾峰彇搴撲綅鎵樼洏 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> [HttpPost, Route("RequestCellInfo"), AllowAnonymous] public object RequsetCellInfo([FromBody] object input) { diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json index 9583158..8caca28 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json @@ -11,11 +11,11 @@ //杩炴帴瀛楃涓� //"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_WMS2F08;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_WMS2F08;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", + "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_WCS2F08;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_WCS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", //璺ㄥ煙 "Cors": { "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs index c85e30c..1cf4236 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // <auto-generated> -// 姝や唬鐮佺敱宸ュ叿鐢熸垚銆� -// 杩愯鏃剁増鏈�:4.0.30319.42000 +// This code was generated by a tool. // -// 瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋� -// 閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便�� +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\345\240\206\345\236\233\346\234\272\351\200\232\344\277\241\345\215\217\350\256\256.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\345\240\206\345\236\233\346\234\272\351\200\232\344\277\241\345\215\217\350\256\256.xlsx" new file mode 100644 index 0000000..0454962 --- /dev/null +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\345\240\206\345\236\233\346\234\272\351\200\232\344\277\241\345\215\217\350\256\256.xlsx" Binary files differ -- Gitblit v1.9.3