/// <summary> /// 为每个巷道准备执行器。 /// </summary> void PrepareExecutors() { using (GeelyPtlEntities dbContext = new GeelyPtlEntities()) { List <CFG_Channel> cfgChannels = dbContext.CFG_Channels .ToList(); foreach (CFG_Channel cfgChannel in cfgChannels) { AssortingExecutor assortingExecutor = new AssortingExecutor(cfgChannel.Id); this.executorByChannelId.Add(cfgChannel.Id, assortingExecutor); } } }
/// <summary> /// 显式或定时刷新。 /// </summary> public void Refresh() { lock (this.refreshSyncRoot) { using (GeelyPtlEntities dbContext = new GeelyPtlEntities()) { List <AST_PalletTask> astPalletTasks = dbContext.AST_PalletTasks .Where(t => t.PickStatus != PickStatus.Finished) .ToList(); foreach (AST_PalletTask astPalletTask in astPalletTasks) { AssortingExecutor assortingExecutor = this.executorByChannelId[astPalletTask.CFG_ChannelId]; if (assortingExecutor.CurrentAstPalletTaskId == null) { assortingExecutor.Start(astPalletTask.Id); } } } } }
/// <summary> /// 尝试引发显示屏确认事件。 /// </summary> /// <param name="cfgChannelId">巷道的主键。</param> public void TryRaisePtlPublisherAssortingPressed(int cfgChannelId) { AssortingExecutor assortingExecutor = AssortingExecutorLoader.Instance.GetByChannelId(cfgChannelId); assortingExecutor.TryRaisePtlPublisherPressed(); }
/// <summary> /// 尝试引发 900U 分拣事件。 /// </summary> /// <param name="cfgChannelId">巷道的主键。</param> /// <param name="cartPosition">料车储位。</param> public void TryRaisePtl900UAssortingPressed(int cfgChannelId, int cartPosition) { AssortingExecutor assortingExecutor = AssortingExecutorLoader.Instance.GetByChannelId(cfgChannelId); assortingExecutor.TryRaisePtl900UPressed(cartPosition); }
/// <summary> /// 查询当前任务。 /// </summary> /// <param name="cfgChannelId">巷道的主键。</param> public AndroidPdaTaskInfo QueryCurrentTaskInfo(int cfgChannelId) { AssortingExecutor assortingExecutor = AssortingExecutorLoader.Instance.GetByChannelId(cfgChannelId); AndroidPdaTaskInfo result = new AndroidPdaTaskInfo(); result.CFG_ChannelId = cfgChannelId; using (GeelyPtlEntities dbContext = new GeelyPtlEntities()) { if (assortingExecutor.CurrentCfgCartId != null) { CFG_Cart cfgCart = dbContext.CFG_Carts .First(c => c.Id == assortingExecutor.CurrentCfgCartId.Value); result.CFG_CartId = cfgCart.Id; result.CartName = cfgCart.Name; result.CartOnLine = cfgCart.OnLine; } if (assortingExecutor.CurrentAstCartTaskItemId == null) { if (assortingExecutor.CurrentAstPalletTaskItemId != null) { AST_PalletTaskItem currentAstPalletTaskItem = dbContext.AST_PalletTaskItems .First(pti => pti.Id == assortingExecutor.CurrentAstPalletTaskItemId.Value); List <CFG_CartCurrentMaterial> cfgCartCurrentMaterials = dbContext.CFG_CartCurrentMaterials .Where(ccm => ccm.CFG_CartId == assortingExecutor.CurrentCfgCartId.Value) .ToList(); foreach (CFG_CartCurrentMaterial cfgCartCurrentMaterial in cfgCartCurrentMaterials) { if (cfgCartCurrentMaterial.AST_CartTaskItemId == null) { //整层大件需要同层的两个空库位 if (currentAstPalletTaskItem.IsBig) { if ((cfgCartCurrentMaterial.Position == 1 && cfgCartCurrentMaterials[1].Usability != CartPositionUsability.Enable) || (cfgCartCurrentMaterial.Position == 2 && cfgCartCurrentMaterials[0].Usability != CartPositionUsability.Enable) || (cfgCartCurrentMaterial.Position == 3 && cfgCartCurrentMaterials[3].Usability != CartPositionUsability.Enable) || (cfgCartCurrentMaterial.Position == 4 && cfgCartCurrentMaterials[2].Usability != CartPositionUsability.Enable) || (cfgCartCurrentMaterial.Position == 5 && cfgCartCurrentMaterials[5].Usability != CartPositionUsability.Enable) || (cfgCartCurrentMaterial.Position == 6 && cfgCartCurrentMaterials[4].Usability != CartPositionUsability.Enable) || (cfgCartCurrentMaterial.Position == 7 && cfgCartCurrentMaterials[7].Usability != CartPositionUsability.Enable) || (cfgCartCurrentMaterial.Position == 8 && cfgCartCurrentMaterials[6].Usability != CartPositionUsability.Enable)) { continue; } } result.CartPositions.Add(cfgCartCurrentMaterial.Position); } } } } else { AST_CartTaskItem astCartTaskItem = dbContext.AST_CartTaskItems .First(cti => cti.Id == assortingExecutor.CurrentAstCartTaskItemId.Value); result.CartPositions.Add(astCartTaskItem.CartPosition); result.PickedQuantity = astCartTaskItem.AssortedQuantity; result.AssortingStatus = astCartTaskItem.AssortingStatus; } if (assortingExecutor.CurrentAstPalletTaskItemId != null) { AST_PalletTaskItem astPalletTaskItem = dbContext.AST_PalletTaskItems .First(pti => pti.Id == assortingExecutor.CurrentAstPalletTaskItemId.Value); result.MaterialCode = astPalletTaskItem.MaterialCode; result.MaterialName = astPalletTaskItem.MaterialName; result.ToPickQuantity = astPalletTaskItem.ToPickQuantity; } } return(result); }