From 2aec0a99e559fb11b7046b148e5f357b3208cb66 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期五, 12 九月 2025 10:06:22 +0800 Subject: [PATCH] 推送最新代码 --- 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/原料库/ConveyorLineJob_YL1ndFloor.cs | 1 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 104 ++------- 项目代码/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs | 73 +------ 项目代码/WMS/WMSServices/WIDESEA_BasicService/Service/LocationInfoService_Common.cs | 5 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs | 126 ------------ 项目代码/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs | 126 ------------ 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPB.cs | 4 项目代码/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs | 36 --- 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 65 ------ 项目代码/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 33 --- 10 files changed, 49 insertions(+), 524 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs" index 1d949ca..272a583 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs" @@ -219,39 +219,6 @@ void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = "", int heightType = 0); /// <summary> - /// 璇锋眰鍒嗛厤宸烽亾 - /// </summary> - /// <param name="taskNum"></param> - /// <param name="roadwayNos"></param> - /// <returns></returns> - WebResponseContent RequestWMSAssignRoadway(int taskNum, List<string> roadwayNos); - - /// <summary> - /// - /// </summary> - /// <param name="roadwayNos"></param> - /// <param name="palletCode"></param> - /// <param name="heightType"></param> - /// <returns></returns> - WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, string palletCode, int heightType); - - /// <summary> - /// - /// </summary> - /// <param name="roadwayNos"></param> - /// <param name="taskNum"></param> - /// <param name="heightType"></param> - /// <returns></returns> - WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, int taskNum, int heightType); - - /// <summary> - /// - /// </summary> - /// <param name="roadwayNos"></param> - /// <returns></returns> - WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos); - - /// <summary> /// /// </summary> /// <param name="agvPodModel"></param> diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" index 7088e2c..4e8aac9 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -495,132 +495,6 @@ // return content; //} - - /// <summary> - /// 鍒嗛厤宸烽亾 - /// </summary> - /// <param name="taskNum"></param> - /// <param name="roadwayNos"></param> - /// <returns></returns> - public WebResponseContent RequestWMSAssignRoadway(int taskNum, List<string> roadwayNos) - { - WebResponseContent content = new WebResponseContent(); - try - { - string address = AppSettings.Get("WMSApiAddress"); - if (string.IsNullOrEmpty(address)) - { - return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃"); - } - string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}", roadwayNos.Serialize()); - WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); - if (responseContent != null && responseContent.Status && responseContent.Data != null) - { - return responseContent; - } - - } - catch (Exception ex) - { - content = WebResponseContent.Instance.Error(ex.Message); - } - return content; - } - - /// <summary> - /// - /// </summary> - /// <param name="roadwayNos"></param> - /// <param name="palletCode"></param> - /// <param name="heightType"></param> - /// <returns></returns> - public WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, string palletCode, int heightType) - { - WebResponseContent content = new WebResponseContent(); - try - { - string address = AppSettings.Get("WMSApiAddress"); - if (string.IsNullOrEmpty(address)) - { - return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃"); - } - string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadwayByHeightAndCode?palletCode={palletCode}&heightType={heightType}", roadwayNos.Serialize()); - WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); - if (responseContent != null && responseContent.Status && responseContent.Data != null) - { - return responseContent; - } - - } - catch (Exception ex) - { - content = WebResponseContent.Instance.Error(ex.Message); - } - return content; - } - - /// <summary> - /// 鍒嗛厤宸烽亾 - /// </summary> - /// <param name="roadwayNos"></param> - /// <param name="taskNum"></param> - /// <param name="heightType"></param> - /// <returns></returns> - public WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, int taskNum, int heightType) - { - WebResponseContent content = new WebResponseContent(); - try - { - string address = AppSettings.Get("WMSApiAddress"); - if (string.IsNullOrEmpty(address)) - { - return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃"); - } - string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}&heightType={heightType}", roadwayNos.Serialize()); - WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); - if (responseContent != null && responseContent.Status && responseContent.Data != null) - { - return responseContent; - } - - } - catch (Exception ex) - { - content = WebResponseContent.Instance.Error(ex.Message); - } - return content; - } - - /// <summary> - /// 鍒嗛厤宸烽亾 - /// </summary> - /// <param name="roadwayNos"></param> - /// <returns></returns> - public WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos) - { - WebResponseContent content = new WebResponseContent(); - try - { - string address = AppSettings.Get("WMSApiAddress"); - if (string.IsNullOrEmpty(address)) - { - return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃"); - } - string responseStr = HttpHelper.Post($"{address}/api/Task/SingleAssignRoadway", roadwayNos.Serialize()); - WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); - if (responseContent != null && responseContent.Status && responseContent.Data != null) - { - return responseContent; - } - - } - catch (Exception ex) - { - content = WebResponseContent.Instance.Error(ex.Message); - } - return content; - } - /// <summary> /// 鍚慦MS鐢宠鍒嗛厤璐т綅 /// </summary> diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/ConveyorLineJob_YL1ndFloor.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/ConveyorLineJob_YL1ndFloor.cs" index 5c75d56..5f30cca 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/ConveyorLineJob_YL1ndFloor.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/ConveyorLineJob_YL1ndFloor.cs" @@ -105,6 +105,7 @@ { device.SetValue(WR_CLineYLDB.WR_Task, task.TaskNum, item.StationCode); device.SetValue(WR_CLineYLDB.WR_ToHode, task.NextAddress, item.StationCode); + device.SetValue(WR_CLineYLDB.WR_Width, task.TaskLength, item.StationCode); device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode); _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); WriteInfo(item.StationCode, $"{conveyorLineInfoRead.Serialize()}"); diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" index f802375..9b27ab8 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" @@ -142,9 +142,9 @@ } } else if (item.StationType == StationTypeEnum.StationType_StackingPlates.ObjToInt() && deviceProRead != null && deviceProWrite != null) - { + {//鍙犵洏鏈哄伐浣嶅彨鏂� R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); - //鍙犵洏鏈哄伐浣嶅彨鏂� + if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 7 && conveyorLineInfoRead.TaskNo <= 0) { Dt_Task task = _taskRepository.QueryFirst(x => x.TargetAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType)); diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" index 4d4397a..beb22ff 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" @@ -85,6 +85,10 @@ return BaseDal.QueryFirst(x => x.RoadwayNo == roadwayNo && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && !lockLocations.Contains(x.LocationCode), orderBy);//鏌ヨ绌鸿揣浣嶄俊鎭苟鎺掗櫎5鍒嗛挓鍐呭垎閰嶇殑璐т綅,鏍规嵁灞傘�佸垪銆佹繁搴︺�佽鎺掑簭 } } + /// <summary> + /// 鍘熸枡鍒嗛厤璐т綅 + /// </summary> + /// <returns></returns> public Dt_LocationInfo? AssignLocationYL(string roadwayNo, Dt_PalletTypeInfo palletTypeInfo) { lock (_AssignLocationYL) @@ -129,6 +133,7 @@ if (nearLocation1!=null && nearLocation2!=null) { locationInfo = item; + break; } } return locationInfo; diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs" index 798ecbc..d6667fd 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs" @@ -92,17 +92,9 @@ /// <param name="palletType">鎵樼洏绫诲瀷</param> /// <returns></returns> WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo); - /// <summary> - /// - /// </summary> - /// <param name="taskNum"></param> - /// <param name="roadwayNo"></param> - /// <param name="heightType"></param> - /// <returns></returns> - WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType); /// <summary> - /// + /// 浠诲姟瀹屾垚 /// </summary> /// <param name="taskNum"></param> /// <returns></returns> @@ -124,30 +116,6 @@ WebResponseContent Outbound(int id); /// <summary> - /// - /// </summary> - /// <param name="roadwayNos"></param> - /// <param name="taskNum"></param> - /// <param name="heightType"></param> - /// <returns></returns> - WebResponseContent AssignRoadwayByHeight(List<string> roadwayNos, int taskNum, int heightType = 0); - - /// <summary> - /// 鍒嗛厤宸烽亾 - /// </summary> - /// <param name="taskNum"></param> - /// <param name="roadwayNos"></param> - /// <returns></returns> - WebResponseContent AssignRoadway(int taskNum, List<string> roadwayNos, int heightType); - - /// <summary> - /// - /// </summary> - /// <param name="roadwayNos"></param> - /// <returns></returns> - WebResponseContent SingleAssignRoadway(List<string> roadwayNos); - - /// <summary> /// 淇敼浠诲姟鐘舵�� /// </summary> /// <param name="task"></param> @@ -163,7 +131,7 @@ WebResponseContent EmptyBackTask(string barCode, string startPoint); /// <summary> - /// 杈呮枡鍏ュ簱 + /// 杈呮枡/鎴愬搧涓存椂鍏ュ簱 /// </summary> /// <returns></returns> WebResponseContent InboundFLOrCPTask(string barCode, string startPoint, string matCode, int matCount); diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs" index deee875..5f81491 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs" @@ -18,131 +18,7 @@ { public partial class TaskService { - /// <summary> - /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="roadwayNos">宸烽亾鍙�</param> - /// <returns></returns> - public WebResponseContent AssignRoadwayByHeight(List<string> roadwayNos, int taskNum, int heightType = 0) - { - try - { - if (heightType == 0 || heightType > 3) - { - return WebResponseContent.Instance.Error($"楂樺害閿欒"); - } - - Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); - if (task == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒拌鍏ュ簱浠诲姟"); - } - - if (_basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress) != null) - { - return WebResponseContent.Instance.OK(data: task.TargetAddress); - } - string roadwayNo = ""; - if (heightType == 1) - { - List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer <= 3).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); - roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; - } - else if (heightType == 2) - { - List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 4).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); - roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; - } - else if (heightType == 3) - { - List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 5).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); - roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; - } - - return !string.IsNullOrEmpty(roadwayNo) ? WebResponseContent.Instance.OK(data: roadwayNo) : WebResponseContent.Instance.Error("鏈壘鍒板彲鍒嗛厤宸烽亾"); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } - - - /// <summary> - /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="roadwayNos">宸烽亾鍙�</param> - /// <returns></returns> - public WebResponseContent AssignRoadway(int taskNum, List<string> roadwayNos, int heightType) - { - try - { - Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); - if (task == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒拌鍏ュ簱浠诲姟"); - } - - if (_basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress) != null) - { - return WebResponseContent.Instance.OK(data: task.TargetAddress); - } - bool IsBCS = task.PalletType == PalletTypeEnum.SmallPallet.ObjToInt(); - //鑾峰彇姣忎釜宸烽亾1-3灞傦紝4灞傦紝5灞傜殑璐т綅 - List<LocationCount> locationCounts = new List<LocationCount>(); - if (heightType == 1) - { - locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || (IsBCS ? false : x.LocationType == LocationTypeEnum.Undefined.ObjToInt())) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && (IsBCS ? !IsBCS : ("SC01_BC".Contains(x.RoadwayNo) ? x.Column % 2 == 0 : x.Column % 2 == 1)) && x.Layer <= 3 && roadwayNos.Contains(x.RoadwayNo)).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); - } - else if(heightType == 2) - { - locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || (IsBCS ? false : x.LocationType == LocationTypeEnum.Undefined.ObjToInt())) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && (IsBCS ? !IsBCS : ("SC01_BC".Contains(x.RoadwayNo) ? x.Column % 2 == 0 : x.Column % 2 == 1)) && x.Layer == 4 && roadwayNos.Contains(x.RoadwayNo)).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); - } - else if(heightType == 3) - { - locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || (IsBCS ? false : x.LocationType == LocationTypeEnum.Undefined.ObjToInt())) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && (IsBCS ? !IsBCS : ("SC01_BC".Contains(x.RoadwayNo) ? x.Column % 2 == 0 : x.Column % 2 == 1)) && x.Layer == 5 && roadwayNos.Contains(x.RoadwayNo)).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); - } - string roadwayNo=string.Empty; - foreach (var location in locationCounts.OrderBy(x => x.Count)) - { - if (location.Count <= 2) - continue; - roadwayNo = location?.RoadwayNo ?? ""; - break; - } - return !string.IsNullOrEmpty(roadwayNo) ? WebResponseContent.Instance.OK(data: roadwayNo) : WebResponseContent.Instance.Error("鏈壘鍒板彲鍒嗛厤宸烽亾"+ $"锛歿locationCounts.Serialize()}"); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } - - /// <summary> - /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 - /// </summary> - /// <param name="roadwayNos">宸烽亾鍙�</param> - /// <returns></returns> - public WebResponseContent SingleAssignRoadway(List<string> roadwayNos) - { - try - { - List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo)).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); - - string roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; - - return !string.IsNullOrEmpty(roadwayNo) ? WebResponseContent.Instance.OK(data: roadwayNo) : WebResponseContent.Instance.Error("鏈壘鍒板彲鍒嗛厤宸烽亾"); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } + } public class LocationCount diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" index ed643cb..4b35f88 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" @@ -141,6 +141,7 @@ { return content.Error($"鏈壘鍒板彲鍒嗛厤宸烽亾"); } + //鐢熸垚浠诲姟 Dt_Task newTask = new Dt_Task() { CurrentAddress = stationCode, @@ -154,6 +155,7 @@ TaskStatus = TaskStatusEnum.New.ObjToInt(), WarehouseId = stockInfo.WarehouseId, PalletType = stockInfo.PalletType, + TaskLength = (int)stockInfo.MaterielWide }; if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) @@ -281,31 +283,18 @@ if (stockInfo.MaterielInvOrgId==MaterielInvOrgEnum.鏂板巶.ObjToInt()) { //闄愬埗鐩村緞 - if (stockInfo.MaterielThickness <= 1200) + if (stockInfo.MaterielThickness <= 1250) { //鑾峰彇鍒嗛厤 List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.RoadwayNo.Contains("YLDual")).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); - //宸烽亾浠诲姟鍒嗛厤鏁伴噺 - List<LocationCount> useLocationCounts = Db.Queryable<Dt_Task>().Where(x => x.WarehouseId == warehouse.WarehouseId - && locationCounts.Select(j => j.RoadwayNo).Contains(x.Roadway) - && TaskInboundTypes.Contains(x.TaskType)).GroupBy(x => x.Roadway).Select(x => new LocationCount { RoadwayNo = x.Roadway, Count = SqlFunc.AggregateCount(x) }).ToList(); - - foreach (var item in locationCounts) - { - LocationCount? count = useLocationCounts.FirstOrDefault(x => x.RoadwayNo == item.RoadwayNo); - if (count != null) - { - item.Count -= count.Count; - } - } - roadwayNo = locationCounts.OrderByDescending(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; + roadwayNo = HandleRoadway(locationCounts, warehouse); } } else { //闄愬埗鐩村緞 - if (stockInfo.MaterielThickness >= 800 && stockInfo.MaterielThickness <= 1500) + if (stockInfo.MaterielThickness >= 800 && stockInfo.MaterielThickness <= 1450) { //鑾峰彇鍒嗛厤 List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.RoadwayNo.Contains("YL") && !x.RoadwayNo.Contains("YLDual")).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); @@ -314,19 +303,7 @@ locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.RoadwayNo == "SC02_YL").GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); } - //宸烽亾浠诲姟鍒嗛厤鏁伴噺 - List<LocationCount> useLocationCounts = Db.Queryable<Dt_Task>().Where(x => x.WarehouseId == warehouse.WarehouseId - && locationCounts.Select(j => j.RoadwayNo).Contains(x.Roadway) - && TaskInboundTypes.Contains(x.TaskType)).GroupBy(x => x.Roadway).Select(x => new LocationCount { RoadwayNo = x.Roadway, Count = SqlFunc.AggregateCount(x) }).ToList(); - foreach (var item in locationCounts) - { - LocationCount? count = useLocationCounts.FirstOrDefault(x => x.RoadwayNo == item.RoadwayNo); - if (count != null) - { - item.Count -= count.Count; - } - } - roadwayNo = locationCounts.OrderByDescending(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; + roadwayNo = HandleRoadway(locationCounts, warehouse); } } @@ -337,6 +314,23 @@ _unitOfWorkManage.RollbackTran(); throw new Exception(ex.Message); } + } + //澶勭悊鍒嗛厤宸烽亾 浠诲姟鏁伴噺 + public string HandleRoadway(List<LocationCount> locationCounts, Dt_Warehouse warehouse) + { + //宸烽亾浠诲姟鍒嗛厤鏁伴噺 + List<LocationCount> useLocationCounts = Db.Queryable<Dt_Task>().Where(x => x.WarehouseId == warehouse.WarehouseId + && locationCounts.Select(j => j.RoadwayNo).Distinct().Contains(x.Roadway) + && TaskInboundTypes.Contains(x.TaskType)).GroupBy(x => x.Roadway).Select(x => new LocationCount { RoadwayNo = x.Roadway, Count = SqlFunc.AggregateCount(x) }).ToList(); + foreach (var item in locationCounts) + { + LocationCount? count = useLocationCounts.FirstOrDefault(x => x.RoadwayNo == item.RoadwayNo); + if (count != null) + { + item.Count -= count.Count; + } + } + return locationCounts.OrderByDescending(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; } /// <summary> /// 鍏ュ簱瀹屾垚 @@ -527,7 +521,6 @@ task.TaskStatus = TaskStatusEnum.SC_Execute.ObjToInt(); } - LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; //鏇存柊閿佸畾璐т綅 _unitOfWorkManage.BeginTran(); @@ -543,54 +536,7 @@ return WebResponseContent.Instance.Error(ex.Message); } } - - /// <summary> - /// - /// </summary> - /// <param name="taskNum"></param> - /// <param name="roadwayNo"></param> - /// <param name="heightType"></param> - /// <returns></returns> - public WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType) - { - try - { - Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); - if (task == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒拌鍏ュ簱浠诲姟"); - } - - if (_basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress) != null) - { - return WebResponseContent.Instance.OK(data: task.TargetAddress); - } - - Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, task.PalletType, task.WarehouseId, heightType: heightType); - if (locationInfo == null) - { - return WebResponseContent.Instance.Error($"璐т綅鍒嗛厤澶辫触,鏈壘鍒板彲鍒嗛厤璐т綅"); - } - - task.Roadway = roadwayNo; - task.TargetAddress = locationInfo.LocationCode; - task.TaskStatus = TaskStatusEnum.SC_Execute.ObjToInt(); - - LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; - - _unitOfWorkManage.BeginTran(); - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); - _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); - BaseDal.UpdateData(task); - _unitOfWorkManage.CommitTran(); - return WebResponseContent.Instance.OK(data: locationInfo.LocationCode); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } + /// <summary> /// 绌烘鍥炲簱 /// </summary> @@ -671,7 +617,7 @@ } private readonly static object _lockerFLorCP = new object(); /// <summary> - /// 杈呮枡鎴愬搧鍏ュ簱 + /// 杈呮枡/鎴愬搧涓存椂鍏ュ簱 /// </summary> /// <returns></returns> public WebResponseContent InboundFLOrCPTask(string barCode, string startPoint,string matCode,int matCount) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs" index ae4290d..23241b2 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs" @@ -298,70 +298,7 @@ } return content; } - /// <summary> - /// 鏃犵汉甯冨嚭搴� - /// </summary> - /// <param name="Count"></param> - /// <returns></returns> - //public WebResponseContent RequestWFBWMSTaskOut(int Count) - //{ - // WebResponseContent content = new WebResponseContent(); - // try - // { - // List<Dt_AGVStationInfo> aGVStationInfos = _agvStationInfoRepository.QueryData(x => x.StationArea == AGVStationAreaEnum.AreaC.ObjToInt() && x.IsOccupied == WhetherEnum.False.ObjToInt()); - // if (aGVStationInfos.Count < Count) - // { - // return content.Error($"鍙敤缂撳瓨鏁颁笉瓒�"); - // } - // List<Dt_ProStockInfo> stockInfos = _stockRepository.ProStockInfoRepository.QueryData(x => x.ProStockAttribute == ProStockAttributeEnum.杈呮枡澶囦欢.ObjToInt() && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()).OrderBy(x => x.CreateDate).Take(Count).ToList(); - // List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => stockInfos.Select(x => x.LocationCode).Contains(x.LocationCode)); - // if (stockInfos.Count < Count) - // { - // return content.Error($"搴撳瓨鏁伴噺涓嶈冻"); - // } - // foreach (var item in stockInfos) - // { - // Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode); - // if (locationInfo != null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) - // { - // item.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt(); - // } - // else - // { - // return content.Error($"璐т綅鐘舵�佷笉姝g‘"); - // } - // } - // List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutWFB); - // if (tasks == null || tasks.Count <= 0) - // { - // return content.Error($"鐢熸垚浠诲姟澶辫触"); - // } - // for (int i = 0; i < tasks.Count; i++) - // { - // aGVStationInfos[i].IsOccupied = WhetherEnum.True.ObjToInt(); - // tasks[i].TargetAddress = aGVStationInfos[i].AGVStationCode; - // } - // //鍒ゆ柇鏄惁鏈夊嚭搴撳崟淇℃伅 - // _unitOfWorkManage.BeginTran(); - // //鏇存柊搴撳瓨鐘舵�� - // _stockRepository.ProStockInfoRepository.UpdateData(stockInfos); - // _agvStationInfoRepository.UpdateData(aGVStationInfos); - // //鏇存柊璐т綅鐘舵�� - // _basicRepository.LocationInfoRepository.UpdateLocationStatus(locationInfos, LocationStatusEnum.Lock); - // //鍔犲叆璐т綅鍙樺姩璁板綍 - // _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, taskNums: tasks.Select(x => x.TaskNum).ToList()); - // //鏂板缓浠诲姟 - // BaseDal.AddData(tasks); - // _unitOfWorkManage.CommitTran(); - // PushTasksToWCS(tasks); - // content.OK(); - // } - // catch (Exception ex) - // { - // content.Error(ex.Message); - // } - // return content; - //} + /// <summary> /// 鍘熸枡鍑哄簱浠诲姟 /// </summary> diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" index e3ea19a..fa01688 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" @@ -21,6 +21,7 @@ public TaskController(ITaskService service) : base(service) { } + /// <summary> /// WCS鐢宠鍏ュ簱浠诲姟(涓嶅垎閰嶈揣浣�) /// </summary> @@ -44,19 +45,6 @@ { return Service.AssignInboundTaskLocation(taskNum, roadwayNo); } - - /// <summary> - /// - /// </summary> - /// <param name="taskNum"></param> - /// <param name="roadwayNo"></param> - /// <param name="heightType"></param> - /// <returns></returns> - [HttpPost, HttpGet, Route("AssignInboundTaskLocationByHeight"), AllowAnonymous] - public WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType) - { - return Service.AssignInboundTaskLocationByHeight(taskNum, roadwayNo, heightType); - } /// <summary> /// 鎴愬搧绌烘鍥炲簱 @@ -71,7 +59,7 @@ } /// <summary> - /// 杈呮枡鍏ュ簱 + /// 杈呮枡/鎴愬搧涓存椂鍏ュ簱 /// </summary> /// <returns></returns> [HttpPost, HttpGet, Route("InboundFLTask"), AllowAnonymous] @@ -114,6 +102,7 @@ { return Service.PushTasksToWCSSingle(taskNum, agvDescription); } + /// <summary> /// 閫夋嫨搴撳瓨鐢熸垚鍑哄簱浠诲姟 /// </summary> @@ -126,42 +115,6 @@ } /// <summary> - /// 鍒嗛厤宸烽亾(甯︿换鍔″彿鍙婇珮搴�) - /// </summary> - /// <param name="roadwayNos"></param> - /// <param name="taskNum"></param> - /// <param name="heightType"></param> - /// <returns></returns> - [HttpPost, Route("AssignRoadwayByHeight"), AllowAnonymous] - public WebResponseContent AssignRoadwayByHeight([FromBody] List<string> roadwayNos, int taskNum, int heightType = 0) - { - return Service.AssignRoadwayByHeight(roadwayNos, taskNum, heightType); - } - - /// <summary> - /// 鍒嗛厤宸烽亾(甯︿换鍔″彿) - /// </summary> - /// <param name="taskNum"></param> - /// <param name="roadwayNos"></param> - /// <returns></returns> - [HttpPost, Route("AssignRoadway"), AllowAnonymous] - public WebResponseContent AssignRoadway(int taskNum, [FromBody] List<string> roadwayNos,int heightType) - { - return Service.AssignRoadway(taskNum, roadwayNos, heightType); - } - - /// <summary> - /// 鍒嗛厤宸烽亾 - /// </summary> - /// <param name="roadwayNos"></param> - /// <returns></returns> - [HttpPost, Route("SingleAssignRoadway"), AllowAnonymous] - public WebResponseContent SingleAssignRoadway([FromBody] List<string> roadwayNos) - { - return Service.SingleAssignRoadway(roadwayNos); - } - - /// <summary> /// 淇敼浠诲姟鐘舵�� /// </summary> /// <param name="task"></param> @@ -171,6 +124,7 @@ { return Service.UpdateTaskInfo(task); } + /// <summary> /// 鍘熸枡鍏ュ簱浠诲姟璇锋眰 /// </summary> @@ -182,8 +136,9 @@ { return Service.RequestYLWMSTaskSimple(stationCode,palletCode); } + /// <summary> - /// 鍘熸枡鍏ュ簱鐢宠 + /// 鍘熸枡鍏ュ簱鐢宠(骞冲彴/鑰佸巶鍖�) /// </summary> /// <param name="palletCode">鏉$爜</param> /// <returns></returns> @@ -192,6 +147,7 @@ { return Service.YLPurchaseBoxing(palletCode); } + /// <summary> /// 鍒嗛厤鍘熸枡鍏ュ簱宸烽亾 /// </summary> @@ -232,16 +188,6 @@ return Service.RequestCPWMSTaskOut(materialCode, Count, targetId); } - ///// <summary> - ///// 鏃犵汉甯冨嚭搴� - ///// </summary> - ///// <returns></returns> - //[HttpPost, HttpGet, Route("RequestWFBWMSTaskOut"), AllowAnonymous] - //public WebResponseContent RequestWFBWMSTaskOut(int Count) - //{ - // return Service.RequestWFBWMSTaskOut(Count); - //} - /// <summary> /// 鍘熸枡鍑哄簱浠诲姟 /// </summary> @@ -253,6 +199,7 @@ { return Service.RequestYLWMSTaskOut(materielCode, materielWide, count, address); } + /// <summary> /// 鍘熸枡绉诲簱浠诲姟 /// </summary> @@ -274,6 +221,7 @@ { return Service.RelocationRoadWay(roadWay, Count); } + /// <summary> /// 鍒嗛厤鎴愬搧宸烽亾 /// </summary> @@ -283,6 +231,7 @@ { return Service.AssignCPRoadwayNo(); } + /// <summary> /// 鍗板埛浣欐枡閫�鏂欎换鍔� /// </summary> @@ -293,6 +242,7 @@ { return Service.PrintBackInbound(saveModel); } + /// <summary> /// 鍗板埛涓嬫枡浠诲姟 /// </summary> @@ -303,6 +253,7 @@ { return Service.PrintInbound(saveModel); } + /// <summary> /// 鍒涘缓鍘熺焊鐢熶骇鎺掔▼鍑哄簱浠诲姟 /// </summary> -- Gitblit v1.9.3