| | |
| | | using Mapster; |
| | | using MapsterMapper; |
| | | using Microsoft.Extensions.Configuration; |
| | | using SqlSugar; |
| | | using System.DirectoryServices.Protocols; |
| | | using System.Text.Json; |
| | | using WIDESEA_Common.Constants; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Core; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.GradingMachine; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_DTO.Task; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | |
| | | public async Task<WebResponseContent> InOrOutCompletedAsync(GradingMachineInputDto input) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | if (string.IsNullOrWhiteSpace(input.PalletCode) || string.IsNullOrWhiteSpace(input.LocationCode)) |
| | | if (string.IsNullOrWhiteSpace(input.LocationCode)) |
| | | { |
| | | return content.Error($"托盘号或者货位编号不能为空"); |
| | | return content.Error($"货位编号不能为空"); |
| | | } |
| | | |
| | | try |
| | | { |
| | | var stockInfo = await _stockInfoService.GetStockInfoAsync(input.PalletCode, input.LocationCode); |
| | | var stockInfo = await _stockInfoService.GetStockInfoAsync(3, input.LocationCode); |
| | | |
| | | int locationStatus; |
| | | if (stockInfo == null) |
| | | { |
| | | var location = await _locationInfoService.GetLocationInfoAsync(input.LocationCode); |
| | | locationStatus = location?.LocationStatus == (int)LocationStatusEnum.InStock ? 10 : 0; |
| | | } |
| | | else |
| | | { |
| | | locationStatus = MapLocationStatus(stockInfo.StockStatus); |
| | | } |
| | | return content.Error("WMS未找到库存信息"); |
| | | locationStatus = MapLocationStatus(stockInfo.StockStatus); |
| | | |
| | | int MapLocationStatus(int stockStatus) => stockStatus switch |
| | | { |
| | |
| | | OutputDto outPutDto = new OutputDto() |
| | | { |
| | | LocationCode = input.LocationCode, |
| | | PalletCode = input.PalletCode, |
| | | PalletCode = stockInfo.PalletCode, |
| | | IsNormalProcedure = 1, |
| | | LocationStatus = locationStatus |
| | | }; |
| | |
| | | { |
| | | return content.Error("未找到对应的托盘"); |
| | | } |
| | | var outPutDtos = stockInfo.Details.Select(x => new OutputDto() |
| | | |
| | | var outPutDtos = new |
| | | { |
| | | LocationCode = input.LocationCode, |
| | | PalletCode = input.PalletCode, |
| | | input.LocationCode, |
| | | input.PalletCode, |
| | | IsNormalProcedure = 1, |
| | | LocationStatus = stockInfo.LocationDetails.LocationStatus, |
| | | CellCode = x.SerialNumber, |
| | | Channel = x.InboundOrderRowNo.ToString() |
| | | }).ToList(); |
| | | stockInfo.LocationDetails.LocationStatus, |
| | | Data = stockInfo.Details.Select(x => new CellCodeData |
| | | { |
| | | CellCode = x.SerialNumber, |
| | | Channel = x.InboundOrderRowNo.ToString() |
| | | }).ToList() |
| | | }; |
| | | return content.OK(data: outPutDtos); |
| | | } |
| | | catch (Exception ex) |