From 5cf8be1f30878aeb2af568f471949d0b9190036a Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 19 十二月 2025 16:12:12 +0800
Subject: [PATCH] CTU故障信息接口查询,故障上报至WMS,任务下发优化

---
 项目代码/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs |   42 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 36 insertions(+), 6 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 4dc25f7..4010c1c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -18,6 +18,8 @@
 using Microsoft.AspNetCore.Mvc;
 using Newtonsoft.Json;
 using NPOI.SS.Formula.Functions;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
 using SqlSugar;
 using System.Diagnostics.CodeAnalysis;
 using System.DirectoryServices.Protocols;
@@ -30,6 +32,7 @@
 using WIDESEAWCS_BasicInfoService;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.APIEnum;
+using WIDESEAWCS_Common.Helper;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseRepository;
@@ -66,6 +69,7 @@
         private readonly ILocationInfoRepository _locationInfoRepository;
         private readonly ILocationInfoService _locationInfoService;
         private readonly ILocationStatusChangeRecordService _locationStatusChangeRecordService;
+        private readonly IErrorInfoRepository _errorInfoRepository;
 
         private Dictionary<string, OrderByType> _taskOrderBy = new()
             {
@@ -83,7 +87,7 @@
 
         public List<int> TaskRelocationTypes => typeof(TaskTypeEnum).GetEnumIndexList().Where(x => x >= 900 && x < 1000).ToList();
 
-        public TaskService(ITaskRepository BaseDal, IMapper mapper, ICacheService cacheService, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IApiInfoRepository apiInfoRepository,ILocationInfoRepository locationInfoRepository,IUnitOfWorkManage unitOfWorkManage, ILocationInfoService locationInfoService,ILocationStatusChangeRecordService locationStatusChangeRecordService) : base(BaseDal)
+        public TaskService(ITaskRepository BaseDal, IMapper mapper, ICacheService cacheService, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IApiInfoRepository apiInfoRepository,ILocationInfoRepository locationInfoRepository,IUnitOfWorkManage unitOfWorkManage, ILocationInfoService locationInfoService,ILocationStatusChangeRecordService locationStatusChangeRecordService,IErrorInfoRepository errorInfoRepository) : base(BaseDal)
         {
             _mapper = mapper;
             _cacheService = cacheService;
@@ -97,6 +101,7 @@
             _unitOfWorkManage = unitOfWorkManage;
             _locationInfoService = locationInfoService;
             _locationStatusChangeRecordService=locationStatusChangeRecordService;
+            _errorInfoRepository = errorInfoRepository;
         }
         static object lock_taskReceive = new object();
         /// <summary>
@@ -116,8 +121,8 @@
                     List<Dt_Task> taskOlds = BaseDal.QueryData(x=> taskDTO.Tasks.Select(x => x.TaskDescribe.ContainerCode).Contains(x.PalletCode));
                     List<Dt_LocationInfo> locationInfos = _locationInfoRepository.GetCanOut(taskDTO.Tasks.Select(x=>x.TaskDescribe.ContainerCode).ToList());
                     List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData();
-                    //涓嬪彂浠诲姟缁�
-                    string taskGroup= taskDTO.TaskGroupCode.IsNullOrEmpty() ? Guid.NewGuid().ToString().Replace("-","") : taskDTO.TaskGroupCode;
+                    ////涓嬪彂浠诲姟缁�
+                    //string taskGroup= taskDTO.TaskGroupCode.IsNullOrEmpty() ? Guid.NewGuid().ToString().Replace("-","") : taskDTO.TaskGroupCode;
                     foreach (var item in taskDTO.Tasks.OrderBy(x=>x.TaskDescribe.ToStationCode))
                     {
                         if (item.TaskDescribe.ToStationCode.IsNullOrEmpty()) throw new Exception($"浠诲姟{item.TaskCode}鍑哄簱鐩爣鎿嶄綔鍙颁笉鑳戒负绌�");
@@ -150,7 +155,7 @@
                         task.CurrentAddress = locationInfo.LocationCode;
                         task.NextAddress = stationManger.PickStationCode;
                         task.TargetAddress = stationManger.PickStationCode;
-                        task.GroupId = taskGroup;
+                        //task.GroupId = taskGroup;
                         task.TaskType = TaskTypeEnum.Outbound.ObjToInt();
                         task.Roadway = locationInfo.RoadwayNo;
                         task.DeviceCode = stationManger.CraneCode;
@@ -315,8 +320,8 @@
                                 "Red" => "4",
                                 _ => throw new Exception($"鏈壘鍒伴鑹插畾涔�")
                             },
-                            ORDERTYPE=taskSendLight.Mode.ToString(),
-                            LIGHTTYPE="1",
+                            ORDERTYPE="1",
+                            LIGHTTYPE=taskSendLight.Mode.ToString(),
                         }
                     };
                     EPLightContent pLightContent = PickOrderInfoRequest(lightSendDTOs);
@@ -793,5 +798,30 @@
             }
             return content;
         }
+        public override WebResponseContent Export(PageDataOptions options)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string savePath = AppDomain.CurrentDomain.BaseDirectory + "ExcelExport";
+
+                // 纭繚鐩綍瀛樺湪
+                if (!Directory.Exists(savePath))
+                    Directory.CreateDirectory(savePath);
+
+                // 鑾峰彇鏁版嵁
+                ISugarQueryable<Dt_Task> query = BaseDal.Db.Queryable<Dt_Task>();
+                var dataList = query.ToList();
+                var properties = typeof(Dt_Task).GetProperties();
+
+                string filePath = TExportHelper.GetExport(savePath, properties, dataList);
+                return WebResponseContent.Instance.OK(data: filePath);
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
+        }
     }
 }

--
Gitblit v1.9.3