| | |
| | | } |
| | | #endregion 请æ±åºåºï¼å®ç&空çï¼ |
| | | |
| | | #region 请æ±ç§»åºä»»å¡ |
| | | public async Task<WebResponseContent> RequestRelocationTaskAsync(string SourceAddress,string TargetAddress) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var startLocation = await _locationRepository.QueryFirstAsync(x => x.LocationCode == SourceAddress); |
| | | var endLocation = await _locationRepository.QueryFirstAsync(x => x.LocationCode == TargetAddress); |
| | | |
| | | if (!startLocation.IsNotEmptyOrNull() || !endLocation.IsNotEmptyOrNull()) |
| | | { |
| | | return content.Error("åºä½ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | if (endLocation.LocationStatus != (int)LocationEnum.Free) |
| | | { |
| | | return content.Error($"ç»ç¹åºä½{endLocation.LocationCode}æªå¤äºç©ºé²ç¶æï¼è¯·äººå·¥ç¡®è®¤åºä½ç¶æ"); |
| | | } |
| | | if ((startLocation.AreaId == 1 || endLocation.AreaId == 1) && startLocation.AreaId != endLocation.AreaId) |
| | | { |
| | | return content.Error("ç§»åºèµ·ç¹åºä½ä¸ç»ç¹åºä½ä¸å¨åä¸åºå"); |
| | | } |
| | | if (startLocation.Floor != endLocation.Floor) |
| | | { |
| | | return content.Error("ç§»åºèµ·ç¹åºä½ä¸ç»ç¹åºä½ä¸å¨å䏿¥¼å±"); |
| | | } |
| | | |
| | | var stock = await _stockInfoRepository.QueryFirstAsync(x => x.LocationCode == startLocation.LocationCode); |
| | | var taskNew = new Dt_Task |
| | | { |
| | | Grade = startLocation.Floor == "1F" ? 10 : 1, |
| | | Roadway = endLocation.RoadwayNo, |
| | | TargetAddress = endLocation.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = endLocation.LocationCode, |
| | | OrderNo = null, |
| | | PalletCode = stock == null ? "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000) : stock.PalletCode, |
| | | SourceAddress = startLocation.LocationCode, |
| | | CurrentAddress = startLocation.LocationCode, |
| | | TaskState = startLocation.AreaId == 1 ? (int)TaskRelocationStatusEnum.RelocationNew : (int)TaskRelocationStatusEnum.RelocationNewAGV, |
| | | TaskType = (int)TaskRelocationTypeEnum.Relocation, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | AGVTaskNum = GenerateUniqueId(), |
| | | Floor = startLocation.Floor, |
| | | }; |
| | | |
| | | |
| | | var result = AddTaskAsync(new List<Dt_Task>() { taskNew }); |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(result.Item2); |
| | | await _locationRepository.UpdateDataAsync(result.Item1); |
| | | await BaseDal.AddDataAsync(taskNew); |
| | | }); |
| | | await SendWCSTask(CreateListTaskDTO(taskNew)); |
| | | return content.OK("æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 请æ±è·¨æ¥¼å±2ä»»å¡ |
| | | /// <summary> |
| | | /// 请æ±è·¨æ¥¼å±2ä»»å¡ |
| | |
| | | PalletCode = stock == null ? "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000) : stock.PalletCode, |
| | | SourceAddress = item.LocationCode, |
| | | CurrentAddress = item.LocationCode, |
| | | TaskState = (int)TaskAGVCarryStatusEnum.CarryNew, |
| | | TaskState = (int)TaskRelocationStatusEnum.RelocationNewAGV, |
| | | TaskType = (int)TaskRelocationTypeEnum.Relocation, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | CreateDate = DateTime.Now, |
| | |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | #region è·å任塿°æ® |
| | | public async Task<WebResponseContent> GetTaskData() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = await BaseDal.QueryDataAsync(x => true); |
| | | var taskData = new List<TaskData> |
| | | { |
| | | new TaskData { Status = "已忶", Count = task.Count+50 }, |
| | | new TaskData { Status = "已宿", Count = 735 } |
| | | }; |
| | | |
| | | // æå»ºç¬¦åè¦æ±çæ ¼å¼ |
| | | var result = taskData.Select(item => new |
| | | { |
| | | value = item.Count, |
| | | name = item.Status, |
| | | itemStyle = new { color = item.Status == "已忶" ? "#FF0000" : "#00FF00" } |
| | | }).ToList(); |
| | | |
| | | return content.OK(data: result); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion å¤é¨æ¥å£æ¹æ³ |