/// <summary> /// 初始化运行时变量 /// </summary> /// <param name="multiInfo"></param> public void Restet(MultiPasteInfo multiInfo) { RUN_CamMarkIsDone = false; RUN_CamBadmarkIsDone = false; RUN_CamPanelIsDone = false; RUN_CamCodeIsDone = false; RUN_NzData = new ConcurrentDictionary <Nozzle, NZ_RunData>(); RUN_PCBData = new List <Board_RunData>(); for (Nozzle nz = Nozzle.Nz1; nz <= Nozzle.Nz4; ++nz) { RUN_NzData.TryAdd(nz, new NZ_RunData()); } for (int i = 0; i < multiInfo.PasteInfos.Count; ++i) { RUN_PCBData.Add(new Board_RunData()); RUN_PCBData[i].MarkData = new Mark_RunData(); RUN_PCBData[i].PcsData = new Pcs_RunData[multiInfo.PasteInfos[i].PasteList.Count]; for (int j = 0; j < multiInfo.PasteInfos[i].PasteList.Count; ++j) { RUN_PCBData[i].PcsData[j] = new Pcs_RunData(); if (!multiInfo.PasteInfos[i].PasteList[j].CanPaste) { RUN_PCBData[i].PcsData[j].iPasteState = 3; } RUN_PCBData[i][j].UpPastePt = multiInfo.PasteInfos[i].PasteList[j].Pos; } } ChangePasteRegion?.Invoke(this.module); UpdateChart?.Invoke(this.module); }
/// <summary> /// 安装流程 /// </summary> /// <param name="program"></param> /// <returns></returns> public string InstallProgram(ProgramFlow program) { this.Program = program.ConvertToInfo(); this.RunData = new MachineRunDataHelper(this.Module); this.RunData.Restet(this.Program); return(string.Empty); }
/// <summary> /// 转化为程式参数 /// </summary> public MultiPasteInfo ConvertToInfo() { MultiPasteInfo info = new MultiPasteInfo(); info.PasteName = this.PCB.FlowName; info.LocFidMark = this.PCB.Pos; info.EnableBadmark = this.PCB.EnableBadmark; info.EnableReadPanel = this.PCB.EnableReadPanelCode; info.EnableReadPCS = this.PCB.EnableReadPcsCode; info.NzUsed = this.NzUsed; info.NzOffset = this.NzOffset; info.NzUOffset = this.NzUOffset; foreach (NodeParam pcsNode in this.PCB.Nodes) { if (pcsNode.GetType() == typeof(ReadCodeParam)) { info.ReadPanel = pcsNode as ReadCodeParam; if (!info.VisionList.Contains(info.ReadPanel.VisionName)) { info.VisionList.Add(info.ReadPanel.VisionName); } } else if (pcsNode.GetType() == typeof(PCSParam)) { var pasteInfo = new PasteInfo(); pasteInfo.BaseAngle = (pcsNode as PCSParam).BaseAngle; #region 读取小板信息 foreach (NodeParam childNode in pcsNode.Nodes) { if (childNode.GetType() == typeof(MarkParam)) { var mark = childNode as MarkParam; pasteInfo.MarkPtList.Add(mark); if (!info.VisionList.Contains(mark.VisionName)) { info.VisionList.Add(mark.VisionName); } } else if (childNode.GetType() == typeof(BadmarkListNode)) { foreach (NodeParam badmark in childNode.Nodes) { var temp = badmark as BadmarkParam; pasteInfo.BadmarkList.Add(temp); if (!info.VisionList.Contains(temp.VisionName)) { info.VisionList.Add(temp.VisionName); } } } else if (childNode.GetType() == typeof(PasteListNode)) { for (int pasteIndex = 0; pasteIndex < childNode.Nodes.Count; ++pasteIndex) { var temp = childNode.Nodes[pasteIndex] as PasteParam; pasteInfo.PasteList.Add(temp); } } else if (childNode.GetType() == typeof(ReadCodeListNode)) { foreach (NodeParam readcode in childNode.Nodes) { var temp = readcode as ReadCodeParam; pasteInfo.ReadPcsList.Add(temp); if (!info.VisionList.Contains(temp.VisionName)) { info.VisionList.Add(temp.VisionName); } } } } #endregion info.PasteInfos.Add(pasteInfo); } } return(info); }