private void BadShape(RollPosition roll) { var layerLabels = LableCode.GetLableCodesOfRecentFloor(roll.ToLocation, roll.PanelNo, roll.Floor); if (LayerShape.IsSlope(layerLabels) || LayerShape.IsVshape(layerLabels)) { FrmMain.logOpt.Write($"!{roll.RealLocation} 第{roll.Floor}层 形状不规则。板号{roll.PanelNo}", LogType.ROBOT_STACK); } }
private void BadShape(RollPosition roll) { var layerLabels = LableCode.GetLableCodesOfRecentFloor(roll.ToLocation, roll.PanelNo, roll.Floor); if (LayerShape.IsSlope(layerLabels) || LayerShape.IsVshape(layerLabels)) { lock (client) { PlcHelper.NotifyBadLayerShape(client, param, roll.RealLocation); } log($"!{roll.RealLocation}/{roll.Floor}形状不规则。板号{roll.PanelNo}", LogType.ROBOT_STACK); } }
public static CalResult AreaBCalculate(LableCode lc, string dateShiftNo, IEnumerable <LableCode> cacheq, Action <string> onlog) { var cre = new CacheResult { CResult = new CalResult(CacheState.Cache, lc, null) }; // 创建新板号 var pinfo = GetPanelNo(cre.CResult.CodeCome, dateShiftNo); var fp = FloorPerformance.None; List <LableCode> layerLabels; // 解决在缓存位,同一交地出现多个不同板号的情况. if (pinfo == null) { pinfo = new PanelInfo(cre.CResult.CodeCome.PanelNo); cre.CResult.CodeCome.PanelNo = pinfo.PanelNo; cre.CResult.CodeCome.Floor = pinfo.CurrFloor; } #region 缓存布卷板号和层号的修正 var cachedRolls = FrmMain.taskQ.CacheSide.Where(x => x.labelcode != null && x.labelcode.ToLocation == lc.ToLocation) .Select(x => x.labelcode) .ToList(); foreach (LableCode tmp in cachedRolls) { tmp.PanelNo = pinfo.PanelNo; tmp.Floor = pinfo.CurrFloor; } #endregion // 取当前交地、当前板、当前层所有标签。 layerLabels = LableCode.GetLableCodesOfRecentFloor(cre.CResult.CodeCome.ToLocation, pinfo.PanelNo, pinfo.CurrFloor); cre = CalculateCacheState(cre.CResult, pinfo, layerLabels, onlog); if (cre.SideState.state == SideFullState.FULL || cre.SideState.state == SideFullState.EXCEED) { fp = SetFullFlag(CalculateFloorIndex(layerLabels), pinfo); } var msg = $""; switch (cre.CResult.state) { case CacheState.Go: CalculatePosition(layerLabels, cre.CResult.CodeCome, cre.SideState == null ? SideFullState.NO_FULL : cre.SideState.state); break; case CacheState.GetThenCache: case CacheState.CacheAndGet: CalculatePosition(layerLabels, cre.CResult.CodeFromCache, cre.SideState == null ? SideFullState.NO_FULL : cre.SideState.state); break; case CacheState.GoThenGet: //计算位置坐标, 赋予层号 cre.CResult.CodeCome.Floor = cre.CResult.CodeFromCache.Floor; CalculatePosition(layerLabels, cre.CResult.CodeCome, cre.CResult.CodeFromCache, cre.SideState == null ? SideFullState.NO_FULL : cre.SideState.state); break; case CacheState.GetThenGo: cre.CResult.CodeCome.Floor = cre.CResult.CodeFromCache.Floor; CalculatePosition(layerLabels, cre.CResult.CodeFromCache, cre.CResult.CodeCome, cre.SideState == null ? SideFullState.NO_FULL : cre.SideState.state); break; case CacheState.Cache: var cancachesum = (pinfo.OddStatus ? 0 : 1) + (pinfo.EvenStatus ? 0 : 1); var cachelcs = FrmMain.taskQ.CacheSide.Count(x => x.labelcode != null && x.labelcode.ToLocation == lc.ToLocation); var go = CanIgo(cacheq, cre.CResult, cancachesum - cachelcs); if (go) { cre.CResult.state = CacheState.Go; bool isfull = IsPanelFull(cre.CResult.CodeCome); CalculatePosition(layerLabels, cre.CResult.CodeCome, isfull ? SideFullState.FULL : SideFullState.NO_FULL); if (isfull) { fp = SetFullFlag(cre.CResult.CodeCome.FloorIndex, pinfo); } msg = $"cache change go"; } break; default: break; } // 记录层最后一卷 if (fp == FloorPerformance.BothFinish) { if (cre.CResult.state == CacheState.Go) { // 在没有缓存的情况下满板。 cre.CResult.CodeCome.Status = (int)LableState.FloorLastRoll; cre.CResult.CodeCome.Remark = $"{cre.CResult.CodeCome.Remark} floor last roll"; } else if (cre.CResult.state == CacheState.GetThenGo) { cre.CResult.CodeCome.Status = (int)LableState.FloorLastRoll; cre.CResult.CodeCome.Remark = $"{cre.CResult.CodeCome.Remark} floor last roll"; } else if (cre.SideState.state == SideFullState.EXCEED) { if (cre.CResult.CodeFromCache != null) { cre.CResult.CodeFromCache.Status = (int)LableState.FloorLastRoll; cre.CResult.CodeFromCache.Remark = $"{cre.CResult.CodeFromCache.Remark} floor last roll"; } else { cre.CResult.CodeCome.Status = (int)LableState.FloorLastRoll; cre.CResult.CodeCome.Remark = $"{cre.CResult.CodeCome.Remark} floor last roll*{cre.CResult.state}"; } } else { cre.CResult.CodeFromCache.Status = (int)LableState.FloorLastRoll; cre.CResult.CodeFromCache.Remark = $"{cre.CResult.CodeFromCache.Remark} floor last roll"; } } if (!PanelGen.HasPanelNo(pinfo.PanelNo)) { LableCode.Update(cre.CResult.CodeCome); } if (cre.SideState.state == SideFullState.EXCEED) { msg = $"{msg} EXCEED"; pinfo.HasExceed = true; } if (cre.CResult.CodeFromCache != null) { if (fp == FloorPerformance.BothFinish && cre.SideState.state == SideFullState.EXCEED) //层满上超出处理 { LableCode.UpdateEdgeExceed(fp, pinfo, cre.CResult.CodeCome, cre.CResult.CodeFromCache); } else { LableCode.Update(fp, pinfo, cre.CResult.CodeCome, cre.CResult.CodeFromCache); } } else { LableCode.Update(fp, pinfo, cre.CResult.CodeCome); } cre.CResult.message = msg; return(cre.CResult); }