ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -964,6 +964,74 @@
    }
    #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任务
@@ -1258,7 +1326,7 @@
                            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,
@@ -1404,37 +1472,6 @@
        }
        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 å¤–部接口方法