| | |
| | | private readonly IDt_AreaInfoRepository _areaInfoRepository; //åºå |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ISys_ConfigService _configService; |
| | | private readonly ISimpleCacheService _simpleCacheService; |
| | | |
| | | public Dt_TaskService(IDt_TaskRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | |
| | | IDt_AreaInfoRepository areaInfoRepository, |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IDt_StationManagerRepository stationManagerRepository, |
| | | ISys_ConfigService configService, |
| | | ISimpleCacheService simpleCacheService) : base(BaseDal) |
| | | ISys_ConfigService configService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoRepository = stockInfoRepository; |
| | |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _configService = configService; |
| | | _simpleCacheService = simpleCacheService; |
| | | } |
| | | |
| | | #region å¤é¨æ¥å£æ¹æ³ |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | task.TaskState = (int)TaskOutStatusEnum.OutFinish; |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.äººå·¥å®æ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | return content; |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion åºåºä»»å¡å®æ |
| | | |
| | | #region ç§»åºä»»å¡å®æ |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="saveModel">任塿°æ®åé</param> |
| | | /// <returns>è¿åç»æé</returns> |
| | | public async Task<WebResponseContent> CompleteTransferTaskAsync(Dt_Task task, DtStockInfo stock) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | // æ´æ°è´§ä½ååºåä¿¡æ¯ |
| | | (DtStockInfo updateStock, DtLocationInfo locationInForm, DtLocationInfo locationInfoTo) = UpdateStockLocation(stock, task); |
| | | var taskHty = CreateHistoricalTask(task); |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "ç§»åºä»»å¡å®æ", $"è´§ä½å°åï¼{task.TargetAddress},ä¿®æ¹ååºåæ°æ®ï¼{JsonConvert.SerializeObject(updateStock)}ï¼åå
è´§ä½æ°æ®ï¼{locationInForm}"); |
| | | |
| | | // æ§è¡æ°æ®åºäºå¡ |
| | | bool isResult = false; |
| | | if (isResult) |
| | | content.OK("ç§»åºä»»å¡å®ææå"); |
| | | else |
| | | content.Error("ç§»åºä»»å¡å®æå¤±è´¥"); |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | Console.WriteLine(err.Message.ToString()); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | #endregion ç§»åºä»»å¡å®æ |
| | | |
| | | #region å
¥åºä»»å¡å®æ |
| | | |
| | | /// <summary> |
| | | /// 宿å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="task">任塿°æ®åé</param> |
| | | /// <returns>è¿åç»æé</returns> |
| | | public async Task<WebResponseContent> CompleteInboundTaskAsync(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | task.TaskState = (int)TaskInStatusEnum.InFinish; |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.äººå·¥å®æ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | #endregion å
¥åºä»»å¡å®æ |
| | | |
| | | #region AGVæ¬è¿ä»»å¡å®æ |
| | | public async Task<WebResponseContent> CompleteCarryTaskAsync(Dt_Task task,DtStockInfo stockInfo) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | task.TaskState = (int)TaskAGVCarryStatusEnum.CarryFinish; |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.äººå·¥å®æ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region AGV跨楼å±ä»»å¡å®æ |
| | | public async Task<WebResponseContent> CompleteAcrossFloorTaskAsync(Dt_Task task, DtStockInfo stockInfo) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryFinish; |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.äººå·¥å®æ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ä»»å¡å®æ |
| | | |
| | | /// <summary> |
| | | /// å®æä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡ç¼å·</param> |
| | | /// <returns>è¿åç»æé</returns> |
| | | public async Task<WebResponseContent> CompleteAsync(int taskNum) |
| | | { |
| | | // åå§åååºå
容 |
| | | WebResponseContent content = new WebResponseContent(); |
| | | |
| | | // æå任塿°æ® |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "æå任塿°æ®", $"ä»»å¡å·ï¼{taskNum}"); |
| | | |
| | | // éªè¯ä»»å¡æ¯å¦åå¨ |
| | | var task = await GetByTaskNum(taskNum); |
| | | if (task == null) |
| | | { |
| | | return content.Error("ä»»å¡ä¸åå¨"); |
| | | } |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "éªè¯ä»»å¡æ¯å¦åå¨", JsonConvert.SerializeObject(task)); |
| | | |
| | | |
| | | // éªè¯åºåæ¯å¦åå¨ |
| | | var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode); |
| | | |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | return await CompleteOutboundTaskAsync(task, stock); |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | return await CompleteInboundTaskAsync(task); |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | | return await CompleteTransferTaskAsync(task, stock); |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.CarryGroup) |
| | | { |
| | | return await CompleteCarryTaskAsync(task, stock); |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.AcrossFloorGroup) |
| | | { |
| | | return await CompleteAcrossFloorTaskAsync(task, stock); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("æªæ¾å°ä»»å¡ç±»å"); |
| | | } |
| | | } |
| | | |
| | | #endregion ä»»å¡å®æ |
| | | |
| | | #region 请æ±ä»»å¡å
¥åº |
| | | |
| | | public async Task<WebResponseContent> RequestTaskAsync(RequestTaskDto taskDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | |
| | | try |
| | | { |
| | | var task = await GetByTaskAddress(taskDto.Position, taskDto.TargetAddress); |
| | | if (task != null) |
| | | { |
| | | return content.Error("èµ·ç¹æç»ç¹åå¨ä»»å¡"); |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1"); |
| | | |
| | | Dt_Task taskNew = new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Roadway = "SC1", |
| | | TargetAddress = taskDto.TargetAddress, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = station.stationChildCode, |
| | | OrderNo = null, |
| | | PalletCode = taskDto.PalletCode, |
| | | SourceAddress = taskDto.Position, |
| | | CurrentAddress = taskDto.Position, |
| | | TaskState = (int)TaskInStatusEnum.InNew, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | AGVTaskNum = GenerateUniqueId(), |
| | | Floor = "1F", |
| | | }; |
| | | var taskDTO = CreateListTaskDTO(taskNew); |
| | | |
| | | return content = await SendWCSTask(taskDTO); |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | content.Error(err.Message); |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡è´§ä½ |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> UpdateExistingTask(RequestTaskDto input) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode); |
| | | if (task == null) |
| | | return content.Error($"ææªæ¾å°ã{input.PalletCode}ãçä»»å¡"); |
| | | |
| | | return content = await UpdateExistingTask(input, task); |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | return content.Error(err.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion 请æ±ä»»å¡å
¥åº |
| | | |
| | | #region 请æ±åºåº |
| | | |
| | | /// <summary> |
| | | /// è¯·æ±æçä»»å¡ |
| | | /// </summary> |
| | | /// <param name="position">ç®æ ä½ç½®</param> |
| | | /// <param name="tag">æçç±»åï¼1ï¼å®çï¼2ï¼ç©ºçï¼</param> |
| | | /// <param name="areaCode">åºåç¼ç </param> |
| | | /// <param name="roadways">å··éç¼ç éå</param> |
| | | /// <returns>è¿åç»æé</returns> |
| | | public async Task<WebResponseContent> RequestOutTaskAsync(RequestTaskDto taskDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = await GetByTaskAddress(taskDto.Position, taskDto.TargetAddress); |
| | | if (task != null) |
| | | { |
| | | return content.Error("èµ·ç¹æç»ç¹åå¨ä»»å¡"); |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1"); |
| | | |
| | | Dt_Task taskNew = new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Roadway = "SC1", |
| | | TargetAddress = taskDto.TargetAddress, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = station.stationChildCode, |
| | | OrderNo = null, |
| | | PalletCode = taskDto.PalletCode, |
| | | SourceAddress = taskDto.Position, |
| | | CurrentAddress = taskDto.Position, |
| | | TaskState = (int)TaskOutStatusEnum.OutNew, |
| | | TaskType = (int)TaskOutboundTypeEnum.Outbound, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | AGVTaskNum = GenerateUniqueId(), |
| | | Floor = "1F", |
| | | }; |
| | | var taskDTO = CreateListTaskDTO(taskNew); |
| | | |
| | | return content = await SendWCSTask(taskDTO); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion 请æ±åºåºï¼å®ç&空çï¼ |
| | | |
| | | #region 请æ±è·¨æ¥¼å±2ä»»å¡ |
| | | /// <summary> |
| | | /// 请æ±è·¨æ¥¼å±2ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDto"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> AcrossFloorTaskAsync(RequestAcrossFloorTaskDto taskDto) |
| | | { |
| | | WebResponseContent content=new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = BaseDal.QueryFirst(x => x.TaskNum == Convert.ToInt32(taskDto.TaskNum) && x.PalletCode == taskDto.PalletCode); |
| | | if(task == null) |
| | | return content.Error("æªæ¾å°ä»»å¡"); |
| | | Dt_Task taskNew = new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Roadway = "AGV", |
| | | TargetAddress = task.TargetAddress, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = taskDto.NextAddress, |
| | | OrderNo = null, |
| | | PalletCode = task.PalletCode, |
| | | SourceAddress = taskDto.NextAddress, |
| | | CurrentAddress = taskDto.NextAddress, |
| | | TaskState = (int)TaskAcrossFloorStatusEnum.SecondCarry, |
| | | TaskType = (int)TaskAcrossFloorTypeEnum.AcrossFloorCarry, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | AGVTaskNum = GenerateUniqueId(), |
| | | Floor = "", |
| | | }; |
| | | var taskDTO = CreateTaskDTO(taskNew); |
| | | |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.äººå·¥å®æ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | | return content.OK(data: taskDTO); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 请æ±è·¨æ¥¼å±ä»»å¡ |
| | | public async Task<WebResponseContent> RequestAcrossFloorTaskAsync(RequestTaskDto taskDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = await GetByTaskAddress(taskDto.Position, taskDto.TargetAddress); |
| | | if (task != null) |
| | | { |
| | | return content.Error("èµ·ç¹æç»ç¹åå¨ä»»å¡"); |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == taskDto.Position); |
| | | |
| | | if (station != null) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | Dt_Task taskNew = new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Roadway = "AGV", |
| | | TargetAddress = taskDto.TargetAddress, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = next.stationChildCode, |
| | | OrderNo = null, |
| | | PalletCode = taskDto.PalletCode, |
| | | SourceAddress = taskDto.Position, |
| | | CurrentAddress = taskDto.Position, |
| | | TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew, |
| | | TaskType = (int)TaskAcrossFloorTypeEnum.AcrossFloorCarry, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | AGVTaskNum = GenerateUniqueId(), |
| | | Floor = station.stationFloor, |
| | | }; |
| | | var taskDTO = CreateListTaskDTO(taskNew); |
| | | |
| | | return content = await SendWCSTask(taskDTO); |
| | | } |
| | | return content.Error("æªæ¾å°æåæºç«ç¹"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 请æ±AGVæ¬è¿ä»»å¡ |
| | | public async Task<WebResponseContent> RequestAGVCarryTaskAsync(RequestTaskDto taskDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = await GetByTaskAddress(taskDto.Position,taskDto.TargetAddress); |
| | | if (task != null) |
| | | { |
| | | return content.Error("èµ·ç¹æç»ç¹åå¨ä»»å¡"); |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == taskDto.Position); |
| | | Dt_Task taskNew = new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Roadway = "AGV", |
| | | TargetAddress = taskDto.TargetAddress, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = taskDto.TargetAddress, |
| | | OrderNo = null, |
| | | PalletCode = taskDto.PalletCode, |
| | | SourceAddress = taskDto.Position, |
| | | CurrentAddress = taskDto.Position, |
| | | TaskState = (int)TaskAGVCarryStatusEnum.CarryNew, |
| | | TaskType = (int)TaskAGVCarryTypeEnum.Carry, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | AGVTaskNum = GenerateUniqueId(), |
| | | Floor = station.stationFloor, |
| | | }; |
| | | var taskDTO = CreateListTaskDTO(taskNew); |
| | | |
| | | return content = await SendWCSTask(taskDTO); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ä»»å¡ç¶ææ´æ¹ |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡ç¶æ&åºåºè§£ç |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="taskState"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> UpdateTaskStatus(int taskNum, int taskState) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = await BaseDal.QueryFirstAsync(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | return content.Error("æªæ¾å°ä»»å¡"); |
| | | |
| | | if (taskState == (int)TaskOutStatusEnum.Line_OutFinish || taskState == (int)TaskInStatusEnum.SC_InFinish) |
| | | { |
| | | var taskHty = CreateHistoricalTask(task); |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | var asb = await BaseDal.DeleteDataByIdAsync(task.TaskId); |
| | | var asbHty = await _task_HtyRepository.AddDataAsync(taskHty) > 0; |
| | | if (asb && asbHty) |
| | | content.OK(); |
| | | else |
| | | throw new Exception(); |
| | | }); |
| | | content.OK(); |
| | | } |
| | | else |
| | | { |
| | | task.TaskState = taskState; |
| | | var asb = await BaseDal.UpdateDataAsync(task); |
| | | if (asb) |
| | | content.OK(); |
| | | else |
| | | content.Error(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | #endregion ä»»å¡ç¶ææ´æ¹ |
| | | |
| | | #region è·åAGVä»»å¡å· |
| | | |
| | | private static readonly Random _random = new Random(); |
| | | |
| | | public static string GenerateUniqueId() |
| | | { |
| | | // è·åå½å毫ç§çº§æ¶é´æ³ |
| | | long timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(); |
| | | |
| | | // çæ4ä½éæºæ°ï¼0000-9999ï¼ |
| | | int randomNumber = _random.Next(0, 10000); |
| | | string randomPart = randomNumber.ToString("D4"); // è¡¥é¶å°4ä½ |
| | | |
| | | return $"{timestamp}{randomPart}"; |
| | | } |
| | | #endregion |
| | | |
| | | #endregion å¤é¨æ¥å£æ¹æ³ |
| | | |
| | | #region è°ç¨WCSæ¥å£ |
| | | private string GetAGVIPAddress(string baseIp, string name) |
| | | { |
| | | var configz = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wcsBasez = configz.Where(x => x.ConfigKey == baseIp).FirstOrDefault()?.ConfigValue; |
| | | var address = configz.Where(x => x.ConfigKey == name).FirstOrDefault()?.ConfigValue; |
| | | if (wcsBasez == null || address == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP æªé
ç½®"); |
| | | } |
| | | return wcsBasez + address; |
| | | } |
| | | public async Task<WebResponseContent> SendWCSTask(List<WMSTaskDTO> taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | var AgvSendTaskAddrss = GetAGVIPAddress(SysConfigConst.WCSIPAddress, SysConfigConst.ReceiveTask); |
| | | // åé请æ±å¹¶çå¾
ååº |
| | | var result = await HttpHelper.PostAsync(AgvSendTaskAddrss, taskDTO.ToJsonString()); |
| | | |
| | | content = JsonConvert.DeserializeObject<WebResponseContent>(result.ToString()); |
| | | |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | #region å
é¨è°ç¨æ¹æ³ |
| | | |
| | | /// <summary> |
| | | /// å建任å¡DTO |
| | | /// </summary> |
| | | private List<WMSTaskDTO> CreateListTaskDTO(Dt_Task task) |
| | | { |
| | | return new List<WMSTaskDTO> { new WMSTaskDTO |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = task.Grade.Value, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | | TargetAddress = task.TargetAddress, |
| | | TaskState = task.TaskState.Value, |
| | | Id = 0, |
| | | TaskType = task.TaskType, |
| | | AGVTaskNum = task.AGVTaskNum, |
| | | } }; |
| | | } |
| | | |
| | | private WMSTaskDTO CreateTaskDTO(Dt_Task task) |
| | | { |
| | | return new WMSTaskDTO |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = task.Grade.Value, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | | TargetAddress = task.TargetAddress, |
| | | TaskState = task.TaskState.Value, |
| | | Id = 0, |
| | | TaskType = task.TaskType, |
| | | AGVTaskNum = task.AGVTaskNum, |
| | | }; |
| | | } |
| | | private async Task DeleteStockInfoAsync(int stockId) |
| | | { |
| | | var isStockUpdated = await _stockInfoRepository.DeleteDataByIdAsync(stockId); |
| | |
| | | } |
| | | } |
| | | |
| | | #endregion åºåºä»»å¡å®æ |
| | | |
| | | #region ç§»åºä»»å¡å®æ |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="saveModel">任塿°æ®åé</param> |
| | | /// <returns>è¿åç»æé</returns> |
| | | public async Task<WebResponseContent> CompleteTransferTaskAsync(Dt_Task task, DtStockInfo stock) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | // æ´æ°è´§ä½ååºåä¿¡æ¯ |
| | | (DtStockInfo updateStock, DtLocationInfo locationInForm, DtLocationInfo locationInfoTo) = UpdateStockLocation(stock, task); |
| | | var taskHty = CreateHistoricalTask(task); |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "ç§»åºä»»å¡å®æ", $"è´§ä½å°åï¼{task.TargetAddress},ä¿®æ¹ååºåæ°æ®ï¼{JsonConvert.SerializeObject(updateStock)}ï¼åå
è´§ä½æ°æ®ï¼{locationInForm}"); |
| | | |
| | | // æ§è¡æ°æ®åºäºå¡ |
| | | bool isResult = false; |
| | | if (isResult) |
| | | content.OK("ç§»åºä»»å¡å®ææå"); |
| | | else |
| | | content.Error("ç§»åºä»»å¡å®æå¤±è´¥"); |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | Console.WriteLine(err.Message.ToString()); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | #endregion ç§»åºä»»å¡å®æ |
| | | |
| | | #region å
¥åºä»»å¡å®æ |
| | | |
| | | /// <summary> |
| | | /// 宿å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="task">任塿°æ®åé</param> |
| | | /// <returns>è¿åç»æé</returns> |
| | | public async Task<WebResponseContent> CompleteInboundTaskAsync(Dt_Task task) |
| | | { |
| | | // åå§åååºå
容 |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | #endregion å
¥åºä»»å¡å®æ |
| | | |
| | | #region ä»»å¡å®æ |
| | | |
| | | /// <summary> |
| | | /// å®æä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡ç¼å·</param> |
| | | /// <returns>è¿åç»æé</returns> |
| | | public async Task<WebResponseContent> CompleteAsync(int taskNum) |
| | | { |
| | | // åå§åååºå
容 |
| | | WebResponseContent content = new WebResponseContent(); |
| | | |
| | | // æå任塿°æ® |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "æå任塿°æ®", $"ä»»å¡å·ï¼{taskNum}"); |
| | | |
| | | // éªè¯ä»»å¡æ¯å¦åå¨ |
| | | var task = await GetByTaskNum(taskNum); |
| | | if (task == null) |
| | | { |
| | | return content.Error("ä»»å¡ä¸åå¨"); |
| | | } |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "éªè¯ä»»å¡æ¯å¦åå¨", JsonConvert.SerializeObject(task)); |
| | | |
| | | |
| | | // éªè¯åºåæ¯å¦åå¨ |
| | | var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode); |
| | | // æ ¹æ®ä»»å¡ç±»åè°ç¨ç¸åºç宿任塿¹æ³ |
| | | switch (task.TaskType) |
| | | { |
| | | case (int)TaskInboundTypeEnum.Inbound: |
| | | case (int)TaskInboundTypeEnum.InTray: |
| | | case (int)TaskInboundTypeEnum.InNG: |
| | | case (int)TaskInboundTypeEnum.InQuality: |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "å
¥åºä»»å¡", ""); |
| | | return await CompleteInboundTaskAsync(task); |
| | | |
| | | case (int)TaskOutboundTypeEnum.OutTray: |
| | | case (int)TaskOutboundTypeEnum.Outbound: |
| | | case (int)TaskOutboundTypeEnum.OutNG: |
| | | |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "åºåºä»»å¡", ""); |
| | | return await CompleteOutboundTaskAsync(task, stock); |
| | | |
| | | case (int)TaskRelocationTypeEnum.Relocation: |
| | | return await CompleteTransferTaskAsync(task, stock); |
| | | default: |
| | | return content.Error("ä»»å¡ç±»åä¸åå¨"); |
| | | } |
| | | } |
| | | |
| | | #endregion ä»»å¡å®æ |
| | | |
| | | #region 请æ±ä»»å¡å
¥åº |
| | | |
| | | public async Task<WebResponseContent> RequestTaskAsync(RequestTaskDto input) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | |
| | | try |
| | | { |
| | | |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | // æ´è¯¦ç»çå¼å¸¸å¤çï¼å¯ä»¥æ ¹æ®å¼å¸¸ç±»åè®°å½ä¸åçé误æ¥å¿ç |
| | | content.Error(err.Message); |
| | | Console.WriteLine(err.Message); |
| | | LogFactory.GetLog($"请æ±å
¥åºå¼å¸¸").Info(true, $"å¼å¸¸ä¿¡æ¯ã{err.Message}ãå¼å¸¸è¡ã{err.StackTrace}ã"); |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡è´§ä½ |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> UpdateExistingTask(RequestTaskDto input) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode); |
| | | if (task == null) |
| | | return content.Error($"ææªæ¾å°ã{input.PalletCode}ãçä»»å¡"); |
| | | |
| | | return content = await UpdateExistingTask(input, task); |
| | | } |
| | | catch (Exception err) |
| | | { |
| | | return content.Error(err.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æçå
¥åºç³è¯· |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> RequestTrayInTaskAsync(RequestTaskDto input) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | #endregion 请æ±ä»»å¡å
¥åº |
| | | |
| | | #region 请æ±åºåºï¼å®ç&空çï¼ |
| | | |
| | | /// <summary> |
| | | /// è¯·æ±æçä»»å¡ |
| | | /// </summary> |
| | | /// <param name="position">ç®æ ä½ç½®</param> |
| | | /// <param name="tag">æçç±»åï¼1ï¼å®çï¼2ï¼ç©ºçï¼</param> |
| | | /// <param name="areaCode">åºåç¼ç </param> |
| | | /// <param name="roadways">å··éç¼ç éå</param> |
| | | /// <returns>è¿åç»æé</returns> |
| | | public async Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, List<string> areaCodes, string productionLine) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | |
| | | // è¿åæåååº |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // è®°å½å¼å¸¸ä¿¡æ¯å¹¶æåº |
| | | LogFactory.GetLog("è¯·æ±æçä»»å¡").Error(true, ex); |
| | | ConsoleHelper.WriteErrorLine("请æ±ç©º/宿çä»»å¡" + ex.Message + "\r\n" + ex.StackTrace); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å建任å¡å®ä¾ |
| | | /// </summary> |
| | | private Dt_Task CreateTask(DtStockInfo stockInfo, string position, int tag) |
| | | { |
| | | return new Dt_Task |
| | | { |
| | | 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, |
| | | MaterialNo = "", |
| | | NextAddress = position, |
| | | OrderNo = null, |
| | | PalletCode = stockInfo.PalletCode, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | TaskState = (int)TaskOutStatusEnum.OutNew, |
| | | TaskType = tag, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | Creater = "System", // ä¿®æ£æ¼åé误 |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | ProductionLine = stockInfo.ProductionLine, |
| | | ProcessCode = stockInfo.ProcessCode, |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å建任å¡DTO |
| | | /// </summary> |
| | | private WMSTaskDTO CreateTaskDTO(Dt_Task task) |
| | | { |
| | | return new WMSTaskDTO |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = task.Grade.Value, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | | TargetAddress = task.TargetAddress, |
| | | TaskState = task.TaskState.Value, |
| | | Id = 0, |
| | | TaskType = task.TaskType, |
| | | ProductionLine = task.ProductionLine, |
| | | }; |
| | | } |
| | | |
| | | #endregion 请æ±åºåºï¼å®ç&空çï¼ |
| | | |
| | | #region ä»»å¡ç¶ææ´æ¹ |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡ç¶æ&åºåºè§£ç |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="taskState"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> UpdateTaskStatus(int taskNum, int taskState) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = await BaseDal.QueryFirstAsync(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | return content.Error("æªæ¾å°ä»»å¡"); |
| | | |
| | | if (taskState == (int)TaskOutStatusEnum.Line_OutFinish || taskState == (int)TaskInStatusEnum.SC_InFinish) |
| | | { |
| | | var taskHty = CreateHistoricalTask(task); |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | var asb = await BaseDal.DeleteDataByIdAsync(task.TaskId); |
| | | var asbHty = await _task_HtyRepository.AddDataAsync(taskHty) > 0; |
| | | if (asb && asbHty) |
| | | content.OK(); |
| | | else |
| | | throw new Exception(); |
| | | }); |
| | | content.OK(); |
| | | } |
| | | else |
| | | { |
| | | task.TaskState = taskState; |
| | | var asb = await BaseDal.UpdateDataAsync(task); |
| | | if (asb) |
| | | content.OK(); |
| | | else |
| | | content.Error(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | #endregion ä»»å¡ç¶ææ´æ¹ |
| | | |
| | | #endregion å¤é¨æ¥å£æ¹æ³ |
| | | |
| | | #region å
é¨è°ç¨æ¹æ³ |
| | | |
| | | public override WebResponseContent DeleteData(object[] key) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | { |
| | | return await BaseDal.QueryFirstAsync(x => x.TaskNum == taskNum); |
| | | } |
| | | |
| | | public async Task<Dt_Task> GetByTaskAddress(string SourceAddress, string TargetAddress) |
| | | { |
| | | return await BaseDal.QueryFirstAsync(x => x.SourceAddress == SourceAddress|| x.TargetAddress== TargetAddress); |
| | | } |
| | | #endregion å
é¨è°ç¨æ¹æ³ |
| | | |
| | | #region private å
鍿¹æ³ |
| | |
| | | |
| | | return isResult && isUpdateLo && isTaskDetail; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å建æ°ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="input">è¯·æ±æ¨¡å</param> |
| | | /// <param name="process">å··é</param> |
| | | /// <param name="flag">æ è¯ï¼0-å
¥åºï¼1-空æçå
¥åºï¼2-NGå
¥åºï¼3-åºåºï¼</param> |
| | | /// <returns></returns> |
| | | private async Task<WebResponseContent> CreateNewTask(RequestTaskDto input, string productionLine, string processCode, List<string> process = null, int flag = 0) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | |
| | | // è·åç®æ å°å |
| | | //string ToAddress = await GetRoadWayAsync(process); |
| | | string ToAddress = string.Empty; |
| | | if (flag < 2) |
| | | ToAddress = await GetRoadWayAsync(process); |
| | | else |
| | | ToAddress = process[0]; |
| | | if (string.IsNullOrEmpty(ToAddress)) |
| | | { |
| | | return content.Error("æ æ³è·åç®æ å°å"); |
| | | } |
| | | // å建æ°ä»»å¡å®ä¾ |
| | | var task = new Dt_Task |
| | | { |
| | | CurrentAddress = input.Position, |
| | | Grade = 1, |
| | | Roadway = ToAddress, |
| | | TargetAddress = ToAddress, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = ToAddress, |
| | | OrderNo = null, |
| | | PalletCode = input.PalletCode, |
| | | SourceAddress = input.Position, |
| | | TaskState = flag == 3 ? (int)TaskOutStatusEnum.OutNew : (int)TaskInStatusEnum.InNew, |
| | | TaskType = flag == 0 ? (int)TaskInboundTypeEnum.Inbound : flag == 1 ? (int)TaskInboundTypeEnum.InTray : flag == 2 ? (int)TaskInboundTypeEnum.InNG : (int)TaskOutboundTypeEnum.Outbound, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "System", |
| | | ProductionLine = productionLine, |
| | | ProcessCode = processCode |
| | | }; |
| | | |
| | | // å°è¯æ·»å æ°ä»»å¡ |
| | | var taskId = await BaseDal.AddDataAsync(task); |
| | | bool isResult = taskId > 0; |
| | | if (isResult) |
| | | { |
| | | task.TaskId = taskId; |
| | | isResult = await _taskExecuteDetailRepository.AddDetailAsync(task, false, TaskDescription.GetTaskUpdateDescription(input.PalletCode, input.Position, ToAddress, TaskInStatusEnum.InNew.GetIntegralRuleTypeEnumDesc())); |
| | | |
| | | //var location = _locationRepository.QueryFirst(x => x.RoadwayNo == task.Roadway && x.LocationCode == task.TargetAddress); |
| | | //location.LocationStatus = (int)LocationEnum.Lock; |
| | | //var isLocation = _locationRepository.UpdateData(location); |
| | | |
| | | if (isResult) |
| | | { |
| | | // å建WMSä»»å¡ |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = 1, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | | TargetAddress = task.TargetAddress, |
| | | TaskState = task.TaskState.Value, |
| | | Id = 0, |
| | | TaskType = task.TaskType, |
| | | ProductionLine = task.ProductionLine |
| | | }; |
| | | content.OK(data: taskDTO); |
| | | } |
| | | else |
| | | content.Error("æ·»å ä»»å¡å¤±è´¥"); |
| | | } |
| | | else |
| | | content.Error("æ·»å ä»»å¡å¤±è´¥"); |
| | | return content; |
| | | } |
| | | |
| | | private static readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); |
| | | private static List<LocationCache> locationCaches = new List<LocationCache>(); |
| | | |
| | | /// <summary> |
| | | /// è·åè´§ä½å· |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task<DtLocationInfo> GetEmptyLocation(string roadWay) |
| | | { |
| | | await _semaphore.WaitAsync(); |
| | | try |
| | | { |
| | | List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList();//æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]);//ç§»é¤æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | } |
| | | |
| | | List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<DtLocationInfo> LocationInfoList = await _locationRepository.QueryDataAsync(x => x.RoadwayNo == roadWay && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == EnableEnum.Enable.ObjToInt()); |
| | | |
| | | List<DtLocationInfo> LocationInfoResult = new List<DtLocationInfo>(); |
| | |
| | | throw new Exception("å½å空é²è´§ä½ä¸è¶³ï¼"); |
| | | } |
| | | |
| | | return LocationInfoResult.Where(x => !lockLocations.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Column).ThenBy(x => x.Layer).FirstOrDefault(); |
| | | return LocationInfoResult.OrderByDescending(x => x.Depth).ThenBy(x => x.Column).ThenBy(x => x.Layer).FirstOrDefault(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _semaphore.Release(); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æ ¹æ®å··éè·åå··éæç«å° |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task<string> GetRoadWayAsync(List<string> process) |
| | | { |
| | | var deviceCode = await SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == 1.ToString() && process.Contains(x.DeviceCode)) |
| | | .Select(x => x.DeviceCode).ToListAsync(); |
| | | |
| | | var minGroup = _locationRepository.QueryData(x => deviceCode.Contains(x.RoadwayNo) && x.LocationStatus == (int)LocationEnum.Free) |
| | | .GroupBy(x => x.RoadwayNo) |
| | | .OrderByDescending(g => g.Count()) // æ ¹æ®æ¯ä¸ªç»çå
ç´ æ°éæåº |
| | | .ToList(); // ååºæ°éæå¤çç» |
| | | |
| | | Dictionary<string, int> result = new Dictionary<string, int>(); |
| | | foreach (var item in minGroup) |
| | | { |
| | | var number = BaseDal.QueryData(x => x.TargetAddress == item.Key && x.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup).Count(); |
| | | result.Add(item.Key, item.Count() - number); |
| | | } |
| | | |
| | | string minRoadwayNo = result.OrderByDescending(x => x.Value).FirstOrDefault().Key; // æ°éæå¤çç»çKey |
| | | |
| | | return minRoadwayNo; |
| | | } |
| | | |
| | | #endregion ä»»å¡è¯·æ±æ¹æ³ |