| | |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using NewLife.Log; |
| | | using SqlSugar; |
| | | using System.Text.RegularExpressions; |
| | | using WIDESEA_Cache; |
| | |
| | | ConsoleHelper.WriteErrorLine("MOM通报点芯NG"); |
| | | return content.Error("MOM通报点芯NG"); |
| | | } |
| | | |
| | | // 更新库存状态和任务状态 |
| | | (var loc, var tas) = UpdateStockAndTaskStatus(stock, task); |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = (int)OperateTypeEnum.自动完成; |
| | | taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.人工完成 : (int)OperateTypeEnum.自动完成; |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | |
| | | DtStockInfo_Hty stockInfo_Hty = stock.Adapt<DtStockInfo_Hty>(); |
| | | stockInfo_Hty.ModifyDate = DateTime.Now; |
| | |
| | | }); |
| | | try |
| | | { |
| | | using(_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) |
| | | { |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { stock.PalletCode }); |
| | | } |
| | | //using (_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) |
| | | //{ |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { stock.PalletCode }); |
| | | //} |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog("删除缓存失败").Error(true, $"{stock.PalletCode}_删除缓存失败,异常信息:{ex.Message}"); |
| | | using(_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) |
| | | { |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { stock.PalletCode }); |
| | | } |
| | | //using (_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) |
| | | //{ |
| | | //} |
| | | } |
| | | |
| | | return content.OK("任务完成成功", task.Remark); |
| | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(locationInf, lastStatus, (int)StatusChangeTypeEnum.AutomaticStorage, task.TaskNum); |
| | | |
| | | stock.StockInfoDetails = new List<DtStockInfoDetail>() { { stock.StockInfoDetails[0] } }; |
| | | using(_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) |
| | | stock.LocationInfo = locationInf; |
| | | //using(_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) |
| | | //{ |
| | | try |
| | | { |
| | | _simpleCacheService.HashAdd(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, stock.PalletCode, stock); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog("添加缓存失败").Error(true, $"{stock.PalletCode}_添加缓存失败,异常信息:{ex.Message}"); |
| | | } |
| | | |
| | | content.OK("入库任务完成成功"); |
| | |
| | | { |
| | | isFull = respone.SpecialParameterDuration.IsNullOrEmpty(); |
| | | } |
| | | if (respone.ProductionLine == null || respone.ParameterInfos == null) |
| | | if (respone.ProductionLine == null || respone.ParameterInfos == null|| respone.ParameterInfos.IsNullOrEmpty()) |
| | | { |
| | | throw new Exception("MOM数据返回错误"); |
| | | throw new Exception($"MOM数据返回错误,产线{respone.ProductionLine},ParameterInfos{respone.ParameterInfos}"); |
| | | } |
| | | stock.LinedProcessFeedbackTime = respone.LinedProcessFeedbackTime; |
| | | stock.SpecialParameterDuration = respone.SpecialParameterDuration; |
| | |
| | | { |
| | | // 创建WMS任务 |
| | | WMSTaskDTO taskDTO = CreateTaskDTO(task); |
| | | //WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | //{ |
| | | // TaskNum = task.TaskNum.Value, |
| | | // Grade = 1, |
| | | // PalletCode = task.PalletCode, |
| | | // RoadWay = task.Roadway, |
| | | // SourceAddress = task.SourceAddress, |
| | | // TargetAddress = task.Roadway, |
| | | // TaskState = task.TaskState.Value, |
| | | // Id = 0, |
| | | // TaskType = task.TaskType, |
| | | //}; |
| | | return content.OK(data: task); |
| | | } |
| | | |
| | |
| | | { |
| | | // 记录异常信息并抛出 |
| | | LogFactory.GetLog("请求托盘任务").Error(true, ex); |
| | | ConsoleHelper.WriteErrorLine("请求空/实托盘任务" + ex.Message); |
| | | ConsoleHelper.WriteErrorLine("请求空/实托盘任务" + ex.Message + "\r\n" + ex.StackTrace); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> devices, string productionLine) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | if (area == null) |
| | | try |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"查询实盘库存信息时,未找到区域代码为{areaCode}的数据"); |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | if (area == null) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"查询实盘库存信息时,未找到区域代码为{areaCode}的数据"); |
| | | return null; |
| | | } |
| | | |
| | | var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | List<string>? materielCodes = outBoundMateriel.Count != 0 |
| | | ? outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == area.AreaCode) |
| | | .Select(x => x.MaterielCode) |
| | | .ToList() |
| | | : null; |
| | | |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | var result = new DtStockInfo(); |
| | | |
| | | //if (stockInfoList.IsNullOrEmpty()) |
| | | //{ |
| | | // stockInfoList = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | // .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).IncludesAllFirstLayer().ToListAsync(); |
| | | //} |
| | | |
| | | result = stockInfoList.Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull) |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) |
| | | .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) |
| | | .FirstOrDefault(); |
| | | |
| | | if (result != null) |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); |
| | | else |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayAsync查询实盘库存信息失败:未找到符合条件的数据"); |
| | | |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayAsync查询实盘库存信息失败:" + ex.Message + "\r\n" + ex.StackTrace); |
| | | return null; |
| | | } |
| | | |
| | | var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | List<string>? materielCodes = outBoundMateriel.Count != 0 |
| | | ? outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == area.AreaCode) |
| | | .Select(x => x.MaterielCode) |
| | | .ToList() |
| | | : null; |
| | | |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | var result = new DtStockInfo(); |
| | | |
| | | //if (stockInfoList.IsNullOrEmpty()) |
| | | //{ |
| | | // stockInfoList = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | // .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).IncludesAllFirstLayer().ToListAsync(); |
| | | //} |
| | | |
| | | result = stockInfoList.Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull) |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) |
| | | .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) |
| | | .FirstOrDefault(); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayCWAsync(List<string> areaCodes, string productionLine) |
| | | { |
| | | var areaId = (await _areaInfoRepository.QueryDataAsync(x => areaCodes.Contains(x.AreaCode))).Select(x => x.AreaID).ToList(); |
| | | if (areaId.Count == 0) |
| | | try |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"查询常温实盘库存信息时,未找到区域代码为{JsonConvert.SerializeObject(areaCodes)}的数据"); |
| | | var areaId = (await _areaInfoRepository.QueryDataAsync(x => areaCodes.Contains(x.AreaCode))).Select(x => x.AreaID).ToList(); |
| | | if (areaId.Count == 0) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"查询常温实盘库存信息时,未找到区域代码为{JsonConvert.SerializeObject(areaCodes)}的数据"); |
| | | return null; |
| | | } |
| | | |
| | | //var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | //List<string> materielCodes = null; |
| | | //if (outBoundMateriel.Count != 0) |
| | | //{ |
| | | // materielCodes = outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == areaCodes[0]).Select(x => x.MaterielCode).ToList(); |
| | | //} |
| | | |
| | | var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | List<string>? materielCodes = outBoundMateriel.Count != 0 |
| | | ? outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == areaCodes[0]) |
| | | .Select(x => x.MaterielCode) |
| | | .ToList() |
| | | : null; |
| | | |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => x.DeviceCode.Contains("CWSC")) |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | //var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | var result = stockInfoList.Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // 过滤条件 |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo != null && 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)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) // 排序 |
| | | .FirstOrDefault(); // 获取第一个元素 |
| | | |
| | | if (result != null) |
| | | { |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); |
| | | } |
| | | else |
| | | { |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayCWAsync查询常温实盘库存信息失败:未找到符合条件的数据"); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayCWAsync查询实盘库存信息失败:" + ex.Message + "\r\n" + ex.StackTrace); |
| | | return null; |
| | | } |
| | | |
| | | //var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | //List<string> materielCodes = null; |
| | | //if (outBoundMateriel.Count != 0) |
| | | //{ |
| | | // materielCodes = outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == areaCodes[0]).Select(x => x.MaterielCode).ToList(); |
| | | //} |
| | | |
| | | var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel"); |
| | | List<string>? materielCodes = outBoundMateriel.Count != 0 |
| | | ? outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == areaCodes[0]) |
| | | .Select(x => x.MaterielCode) |
| | | .ToList() |
| | | : null; |
| | | |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => x.DeviceCode.Contains("CWSC")) |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | //var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | var result = stockInfoList.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)) |
| | | .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode))) |
| | | .OrderBy(x => x.OutboundTime) // 排序 |
| | | .FirstOrDefault(); // 获取第一个元素 |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode, string position) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | try |
| | | { |
| | | 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(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(); |
| | | ConsoleHelper.WriteColorLine(station.Roadway, ConsoleColor.Magenta); |
| | | var stackers = station.Roadway.Split(',').ToList(); |
| | | |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => stackers.Contains(x.DeviceCode)) |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => stackers.Contains(x.DeviceCode)) |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | var result = stockInfoList.Where(x => x.ProductionLine == station.productLine) |
| | | .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) // 排序 |
| | | .FirstOrDefault(); // 转换为列表 |
| | | var result = stockInfoList.Where(x => x.ProductionLine == station.productLine) |
| | | .Where(x => x.AreaCode == areaCode && x.IsFull == false) |
| | | .Where(x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => y.MaterielCode == "空托盘")) |
| | | .Where(x => x.LocationInfo != null && 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) // 排序 |
| | | .FirstOrDefault(); // 转换为列表 |
| | | |
| | | //if (result != null) |
| | | //{ |
| | | // stockInfoList = stockInfoList.Where(x => x != result).ToList(); |
| | | // _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); |
| | | //} |
| | | if (result != null) |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); |
| | | else |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForEmptyTrayAsync查询空盘库存信息失败:未找到符合条件的数据"); |
| | | |
| | | return result; |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ConsoleHelper.WriteErrorLine("QueryStockInfoForEmptyTrayAsync查询实盘库存信息失败:" + ex.Message + "\r\n" + ex.StackTrace); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskInboundTypeEnum.InTray, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = result.ProductionLine, |
| | | ProcessCode = result.ProcessCode, |
| | | }; |
| | |
| | | var taskHty = _mapper.Map<Dt_Task_Hty>(task); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.TaskId = 0; |
| | | taskHty.OperateType = isHand ? (int)OperateTypeEnum.人工删除 : (int)OperateTypeEnum.自动完成; |
| | | taskHty.OperateType = isHand ? (int)OperateTypeEnum.人工删除 : App.User.UserName != null ? (int)OperateTypeEnum.人工完成 : (int)OperateTypeEnum.自动完成; |
| | | taskHty.SourceId = task.TaskId; |
| | | if (isHand) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | if (stock.IsFull) |
| | | { |
| | | // 查询符合条件的库存信息 |
| | | var stocks = _stockInfoRepository.QueryData(x => x.AreaCode == stock.AreaCode && x.ProductionLine == stock.ProductionLine && x.SpecialParameterDuration != stock.SpecialParameterDuration); |
| | | #region 更新库存信息(暂时不需要) |
| | | //if (stock.IsFull) |
| | | //{ |
| | | // // 查询符合条件的库存信息 |
| | | // var stocks = _stockInfoRepository.QueryData(x => x.AreaCode == stock.AreaCode && x.ProductionLine == stock.ProductionLine && x.SpecialParameterDuration != stock.SpecialParameterDuration); |
| | | |
| | | // 查询任务信息 |
| | | var tasks = BaseDal.QueryData(x => x.PalletCode != stock.PalletCode && x.ProductionLine == stock.ProductionLine).Select(x => x.PalletCode).ToList(); |
| | | // // 查询任务信息 |
| | | // var tasks = BaseDal.QueryData(x => x.PalletCode != stock.PalletCode && x.ProductionLine == stock.ProductionLine).Select(x => x.PalletCode).ToList(); |
| | | |
| | | if (stocks != null && stocks.Count > 0) |
| | | { |
| | | // 过滤出需要更新的库存信息 |
| | | var stocksToUpdate = stocks.Where(item => !tasks.Contains(item.PalletCode)).ToList(); |
| | | foreach (var item in stocksToUpdate) |
| | | { |
| | | // 更新库存信息的特定参数 |
| | | item.SpecialParameterDuration = stock.SpecialParameterDuration; |
| | | item.ParameterInfos = stock.ParameterInfos; |
| | | item.OutboundTime = Convert.ToDateTime(item.LinedProcessFeedbackTime == null ? item.CreateDate : item.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(stock.SpecialParameterDuration)); |
| | | } |
| | | if (stocksToUpdate.Count > 0) |
| | | { |
| | | // 异步更新库存信息 |
| | | var isUpdates = await _stockInfoRepository.UpdateDataAsync(stocksToUpdate); |
| | | } |
| | | } |
| | | } |
| | | // if (stocks != null && stocks.Count > 0) |
| | | // { |
| | | // // 过滤出需要更新的库存信息 |
| | | // var stocksToUpdate = stocks.Where(item => !tasks.Contains(item.PalletCode)).ToList(); |
| | | // foreach (var item in stocksToUpdate) |
| | | // { |
| | | // // 更新库存信息的特定参数 |
| | | // item.SpecialParameterDuration = stock.SpecialParameterDuration; |
| | | // item.ParameterInfos = stock.ParameterInfos; |
| | | // item.OutboundTime = Convert.ToDateTime(item.LinedProcessFeedbackTime == null ? item.CreateDate : item.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(stock.SpecialParameterDuration)); |
| | | // } |
| | | // if (stocksToUpdate.Count > 0) |
| | | // { |
| | | // // 异步更新库存信息 |
| | | // var isUpdates = await _stockInfoRepository.UpdateDataAsync(stocksToUpdate); |
| | | // } |
| | | // } |
| | | //} |
| | | #endregion |
| | | |
| | | // 添加历史任务 |
| | | var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0; |
| | |
| | | TaskState = flag == 3 ? (int)TaskOutStatusEnum.OutNew : (int)TaskInStatusEnum.InNew, |
| | | TaskType = flag == 0 ? (int)TaskInboundTypeEnum.Inbound : flag == 1 ? (int)TaskInboundTypeEnum.InTray : flag == 2 ? (int)TaskInboundTypeEnum.InNG : (int)TaskOutboundTypeEnum.Outbound, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | Creater = "System", |
| | | ProductionLine = productionLine, |
| | | ProcessCode = processCode |
| | | }; |