| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | private readonly ILocationInfoRepository _locationInfoRepository; |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | private readonly ILocationStatusChangeRecordService _locationStatusChangeRecordService; |
| | | private readonly IErrorInfoRepository _errorInfoRepository; |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | | { |
| | |
| | | |
| | | 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; |
| | |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _locationInfoService = locationInfoService; |
| | | _locationStatusChangeRecordService=locationStatusChangeRecordService; |
| | | _errorInfoRepository = errorInfoRepository; |
| | | } |
| | | static object lock_taskReceive = new object(); |
| | | /// <summary> |
| | |
| | | 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}åºåºç®æ æä½å°ä¸è½ä¸ºç©º"); |
| | |
| | | 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; |
| | |
| | | "Red" => "4", |
| | | _ => throw new Exception($"æªæ¾å°é¢è²å®ä¹") |
| | | }, |
| | | ORDERTYPE=taskSendLight.Mode.ToString(), |
| | | LIGHTTYPE="1", |
| | | ORDERTYPE="1", |
| | | LIGHTTYPE=taskSendLight.Mode.ToString(), |
| | | } |
| | | }; |
| | | EPLightContent pLightContent = PickOrderInfoRequest(lightSendDTOs); |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | | } |