From 225d11e2ddaa55d1d482201cb4d89c9486cdba69 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期五, 20 六月 2025 12:27:52 +0800 Subject: [PATCH] 更新代码 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index 47af224..74051e8 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -196,9 +196,12 @@ { bool flag = false; List<Dt_Task> tasks = new List<Dt_Task>(); + List<Dt_Task> tasksOld= BaseDal.QueryData(); + List<Dt_Router> routersAll = _routerRepository.QueryData(); + List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(); foreach (var item in taskDTOs) { - if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum || x.PalletCode == item.PalletCode) != null) + if (tasksOld.FirstOrDefault(x => x.TaskNum == item.TaskNum || x.PalletCode == item.PalletCode) != null) { flag = true; continue; @@ -213,13 +216,13 @@ TaskTypeGroup taskTypeGroup = item.TaskType.GetTaskTypeGroup(); if (string.IsNullOrEmpty(item.AGVArea)) { - Dt_StationManger stationManger; + Dt_StationManger? stationManger; if (taskTypeGroup == TaskTypeGroup.InboundGroup) { - stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress); + stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress); if (stationManger==null && task.TaskType==TaskTypeEnum.InProduct.ObjToInt()) { - stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode==task.SourceAddress); + stationManger = stationMangers.FirstOrDefault(x => x.StackerCraneCode==task.SourceAddress); //杞崲鎴愬搧浠撹捣鐐圭珯鍙� item.SourceAddress = stationManger.StationCode; task.CurrentAddress = stationManger.StationCode; @@ -228,14 +231,14 @@ } else { - stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode == item.RoadWay || x.Remark==item.RoadWay); + stationManger = stationMangers.FirstOrDefault(x => x.StackerCraneCode == item.RoadWay || x.Remark==item.RoadWay); } if (stationManger == null) { return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃俊鎭�"); } - List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi /*|| item.RoadWay == x.ChildPosiDeviceCode || item.RoadWay == x.ChildPosi*/)); + List<Dt_Router> routers = routersAll.Where(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi /*|| item.RoadWay == x.ChildPosiDeviceCode || item.RoadWay == x.ChildPosi*/)).ToList(); router = routers.FirstOrDefault(); if (router == null) { @@ -263,7 +266,7 @@ { task.NextAddress = router.NextPosi; task.DeviceCode = stationManger.StackerCraneCode; - if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() && task.TargetAddress== "SCUTL-001") + if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() && (task.TargetAddress== "SCUTL-001" || task.TargetAddress == "SCUTL-002" || task.TargetAddress == "SCUTL_04-001")) { task.TaskState = TaskStatusEnum.MesPending.ObjToInt(); } @@ -305,7 +308,7 @@ { if (item.RoadWay=="AGV_CP") { - Dt_Router routerSelect = _routerRepository.QueryFirst(x => x.InOutType == item.TaskType && item.RoadWay == x.StartPosi && x.NextPosi==item.TargetAddress); + Dt_Router? routerSelect = routersAll.FirstOrDefault(x => x.InOutType == item.TaskType && item.RoadWay == x.StartPosi && x.NextPosi==item.TargetAddress); if (routerSelect != null) { task.NextAddress = routerSelect.NextPosi; @@ -338,7 +341,7 @@ if (taskTypeGroup == TaskTypeGroup.OutbondGroup) { task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; - List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi); + List<Dt_Router> routers = routersAll.Where(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi).ToList(); if (routers.FirstOrDefault() == null) { return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�"); @@ -361,13 +364,13 @@ { task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; } - List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi); + List<Dt_Router> routers = routersAll.Where(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi).ToList(); if (routers.FirstOrDefault() == null) { return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�"); } router = routers.FirstOrDefault(); - Dt_StationManger? stationManger = _stationMangerRepository.QueryData(x => true).FirstOrDefault(x=>x.StationCode== router?.NextPosi); + Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x=>x.StationCode== router?.NextPosi); if (stationManger == null) { return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃俊鎭�"); -- Gitblit v1.9.3