| | |
| | | using AngleSharp.Dom; |
| | | using log4net.Core; |
| | | using Autofac.Core; |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using SixLabors.Fonts.Tables.AdvancedTypographic; |
| | | using System.Diagnostics; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_DTO.MOM; |
| | | using WIDESEA_DTO.WMS; |
| | | using WIDESEA_IServices; |
| | | using WIDESEA_IStoragIntegrationServices; |
| | | using WIDESEA_StorageBasicRepository; |
| | | using WIDESEA_StoragIntegrationServices; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | |
| | | |
| | | namespace WIDESEA_StorageTaskServices; |
| | | |
| | |
| | | ParameterDesc = parameterInfo.Description, |
| | | ParameterResult = "OK", //isNG.ToString(), |
| | | TargetValue = parameterInfo.TargetValue, |
| | | LowerLomit = parameterInfo.LowerSpecificationsLimit, |
| | | LowerLimit = parameterInfo.LowerSpecificationsLimit, |
| | | UpperLimit = parameterInfo.UpperSpecificationsLimit, |
| | | DefectCode = defectCode, |
| | | UOMCode = parameterInfo.UOMCode, |
| | |
| | | |
| | | if (result.SerialNos.Count <= 0) |
| | | { |
| | | return await RequestTrayInTaskAsync(input); |
| | | var config = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.InboundIsEmpty); |
| | | var strings = config.ConfigValue.Split(',').ToList(); |
| | | if (strings.Contains(input.Position)) |
| | | { |
| | | // todo送至NG口 |
| | | ConsoleHelper.WriteErrorLine($"当前位置不能入空托盘"); |
| | | return content.Error("当前位置不能入空托盘"); |
| | | } |
| | | else |
| | | return await RequestTrayInTaskAsync(input); |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | // 处理异常电芯情况 |
| | | var serialNosError = result.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); |
| | | if (serialNosError.Count > 0) |
| | |
| | | // 根据托盘类型查询库存信息 |
| | | DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound |
| | | ? areaCode != "CWSC1" ? await QueryStockInfoForRealTrayAsync(areaCode, areaCodes, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine) |
| | | : await QueryStockInfoForEmptyTrayAsync(areaCode); |
| | | : await QueryStockInfoForEmptyTrayAsync(areaCode, position); |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | |
| | | { |
| | | // 记录异常信息并抛出 |
| | | LogFactory.GetLog("请求托盘任务").Error(true, ex); |
| | | ConsoleHelper.WriteErrorLine("请求空/实托盘任务" + ex.Message); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => x.DeviceRemark == "1") |
| | | .ToList(); |
| | | var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | |
| | | var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // 预加载LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // 预加载StockInfoDetails |
| | | .Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // 过滤条件 |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && areaId.Contains(x.LocationInfo.AreaId) && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 过滤条件 |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.OutboundTime) // 排序 |
| | | .FirstAsync(); // 获取第一个元素 |
| | | |
| | |
| | | /// <summary> |
| | | /// 查询空盘库存信息 |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode) |
| | | private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode,string position) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | |
| | | ConsoleHelper.WriteColorLine(position + "..." + areaCode, ConsoleColor.Magenta); |
| | | var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == position && x.stationType == 17); |
| | | |
| | | ConsoleHelper.WriteColorLine(station.Roadway, ConsoleColor.Magenta); |
| | | var stackers = station.Roadway.Split(',').ToList(); |
| | | |
| | | |
| | | var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => stackers.Contains(x.DeviceCode)) |
| | | .ToList(); |
| | | |
| | | var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | |
| | | var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // 预加载LocationInfo |
| | |
| | | .Where(x => x.AreaCode == areaCode && x.IsFull == false) |
| | | .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "空托盘")) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 过滤条件 |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.CreateDate) // 排序 |
| | | .FirstAsync(); // 转换为列表 |
| | | |
| | |
| | | { |
| | | return new Dt_Task |
| | | { |
| | | Grade = tag == 104 ? 2 : 1, |
| | | 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, |
| | |
| | | |
| | | #endregion 外部接口方法 |
| | | |
| | | |
| | | |
| | | #region 内部调用方法 |
| | | |
| | | /// <summary> |
| | |
| | | taskHty.TaskId = 0; |
| | | taskHty.OperateType = isHand ? (int)OperateTypeEnum.人工删除 : (int)OperateTypeEnum.自动完成; |
| | | taskHty.SourceId = task.TaskId; |
| | | if (isHand) |
| | | { |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | } |
| | | taskHty.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt(); |
| | | return taskHty; |
| | | } |
| | |
| | | ParameterDesc = parameterInfo.Description, |
| | | ParameterResult = "OK", |
| | | TargetValue = parameterInfo.TargetValue, |
| | | LowerLomit = parameterInfo.LowerSpecificationsLimit, |
| | | LowerLimit = parameterInfo.LowerSpecificationsLimit, |
| | | UpperLimit = parameterInfo.UpperSpecificationsLimit, |
| | | DefectCode = defectCode, |
| | | } |