/// <summary> /// 开始入板 /// </summary> /// <param name="currentRoller"></param> /// <param name="product"></param> private void start(RollerDesignerItemViewModel currentRoller, ProductBase product) { if (product == null) { return; } RunningProductVo runningProduct = new RunningProductVo { Product = product }; lock (_lockRunningProducts) _runningProducts.Add(runningProduct); var beginRoller = _runningRollers.FirstOrDefault(a => a.RollerKey == currentRoller.Key); if (beginRoller == null) { throw new Exception($"起点({currentRoller.Key})不在运行时中"); } beginRoller.BandProduct = runningProduct; // 获取默认路径 runningProduct.TargetNode = getAutoTargetNode(currentRoller.Key); if (string.IsNullOrWhiteSpace(runningProduct.TargetNode)) { throw new Exception($"{currentRoller.Key}目标路径路由信息为空!"); } runningProduct.TargetPath = findPath(runningProduct.CurrentRollerKey, runningProduct.TargetNode); }
private void running2_sub(NodeCommunicationResult result, RunningProductVo runningProduct) { if (result.IsAllowGo == false) { runningProduct.IsPause = true; return; } runningProduct.IsPause = false; // 没有返回一个目标时 if (string.IsNullOrWhiteSpace(runningProduct.TargetNode)) { if (string.IsNullOrWhiteSpace(runningProduct.NextNode)) { var nextRollerKey = getAutoTargetNode(runningProduct.CurrentRollerKey); if (false == string.IsNullOrWhiteSpace(nextRollerKey)) { runningProduct.TargetNode = nextRollerKey; runningProduct.TargetPath = findPath(runningProduct.CurrentRollerKey, runningProduct.TargetNode); } } } // if (false == string.IsNullOrWhiteSpace(result.TargetNode) && result.TargetNode != runningProduct.TargetNode) { runningProduct.TargetNode = result.TargetNode; var path = findPath(runningProduct.CurrentRollerKey, result.TargetNode); if (path == null || path.Length <= 0) { throw new Exception($"currentNode({runningProduct.CurrentRollerKey})to targetNode({result.TargetNode})路径查找为空!"); } runningProduct.TargetPath = path; } // 是否NG if (runningProduct.Product.StatusBase == ProductBase.StatusEnum.NG1 || runningProduct.Product.StatusBase == ProductBase.StatusEnum.NG2) { runningProduct.IsNg = true; } }