| | |
| | | { |
| | | try |
| | | { |
| | | WebResponseContent content = await GetTasksByPalletCodeAsync(taskDto.PalletCode); |
| | | WebResponseContent content = await GetTaskByPalletCodeAsync(taskDto.PalletCode); |
| | | if (content.Status) |
| | | { |
| | | return content; |
| | |
| | | { |
| | | try |
| | | { |
| | | WebResponseContent content = await GetTasksByPalletCodeAsync(taskDto.PalletCode); |
| | | WebResponseContent content = await GetTaskByPalletCodeAsync(taskDto.PalletCode); |
| | | if (content.Status) |
| | | { |
| | | return content; |
| | |
| | | }; |
| | | var taskDtos = task.Adapt<WMSTaskDTO>(); |
| | | |
| | | BaseDal.AddData(task); |
| | | return WebResponseContent.Instance.OK("查询成功", taskDtos); |
| | | var addResult = await BaseDal.AddDataAsync(task); |
| | | if (!addResult) |
| | | return WebResponseContent.Instance.Error("任务创建失败"); |
| | | return WebResponseContent.Instance.OK("任务创建成功", taskDtos); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | private async Task<WebResponseContent> GetTasksByPalletCodeAsync(string palletCode) |
| | | private async Task<WebResponseContent> GetTaskByPalletCodeAsync(string palletCode) |
| | | { |
| | | try |
| | | { |
| | | var tasks = await BaseDal.QueryFirstAsync(s => s.PalletCode == palletCode); |
| | | if (tasks == null) |
| | | var task = await BaseDal.QueryFirstAsync(s => s.PalletCode == palletCode); |
| | | if (task == null) |
| | | return WebResponseContent.Instance.Error("未找到对应的任务"); |
| | | var taskDtos = _mapper.Map<List<WMSTaskDTO>>(tasks); |
| | | return WebResponseContent.Instance.OK("查询成功", taskDtos); |
| | | var taskDto = _mapper.Map<WMSTaskDTO>(task); |
| | | return WebResponseContent.Instance.OK("查询成功", taskDto); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | try |
| | | { |
| | | var stockInfo = await _stockInfoService.GetStockInfoAsync(input.PalletCode, input.LocationCode); |
| | | |
| | | int locationStatus; |
| | | if (stockInfo == null) |
| | | { |
| | | var location = await _locationInfoService.GetLocationInfoAsync(input.LocationCode); |
| | | |
| | | OutputDto outPutDto = new OutputDto() |
| | | { |
| | | LocationCode = input.LocationCode, |
| | | PalletCode = input.PalletCode, |
| | | IsNormalProcedure = 1, |
| | | LocationStatus = location.LocationStatus |
| | | }; |
| | | content.OK(data: outPutDto); |
| | | locationStatus = location?.LocationStatus ?? 0; |
| | | } |
| | | else |
| | | { |
| | | OutputDto outPutDto = new OutputDto() |
| | | { |
| | | LocationCode = input.LocationCode, |
| | | PalletCode = input.PalletCode, |
| | | IsNormalProcedure = 1, |
| | | LocationStatus = stockInfo.LocationDetails.LocationStatus |
| | | }; |
| | | content.OK(data: outPutDto); |
| | | locationStatus = stockInfo.LocationDetails?.LocationStatus ?? 0; |
| | | } |
| | | |
| | | OutputDto outPutDto = new OutputDto() |
| | | { |
| | | LocationCode = input.LocationCode, |
| | | PalletCode = input.PalletCode, |
| | | IsNormalProcedure = 1, |
| | | LocationStatus = locationStatus |
| | | }; |
| | | return content.OK(data: outPutDto); |
| | | } |
| | | catch (Exception ex) |
| | | { |