/// <summary> /// pumpID 转 成 ProductID /// </summary> /// <param name="pumpID"></param> /// <returns></returns> public static ProductID PumpID2ProductID(PumpID pumpID) { ProductID pid = ProductID.None; switch (pumpID) { case PumpID.GrasebyC8: pid = ProductID.GrasebyC8; break; case PumpID.GrasebyF8: pid = ProductID.GrasebyF8; break; case PumpID.GrasebyF8_2: pid = ProductID.GrasebyF8; break; case PumpID.GrasebyC6: pid = ProductID.GrasebyC6; break; case PumpID.GrasebyF6: pid = ProductID.GrasebyF6; break; case PumpID.GrasebyC6T: pid = ProductID.GrasebyC6T; break; case PumpID.Graseby2100: pid = ProductID.Graseby2100; break; case PumpID.WZ50C6: pid = ProductID.GrasebyC6; break; case PumpID.WZS50F6: pid = ProductID.GrasebyF6; break; case PumpID.WZ50C6T: pid = ProductID.GrasebyC6T; break; case PumpID.GrasebyF6_2: pid = ProductID.GrasebyF6; break; case PumpID.WZS50F6_2: pid = ProductID.GrasebyF6; break; default: pid = ProductID.None; break; } return(pid); }
/// <summary> /// 按照不同语言添加不同的品牌名称 /// </summary> /// <param name="lang">语言</param> /// <param name="brand">品牌</param> /// <param name="name">此语言下的品牌名称</param> public void Add(PumpID pid, OcclusionLevel level, int syringeSize, float mid) { if (!m_HashProductPressure.ContainsKey(pid)) { LevelPressure lp = new LevelPressure(level); lp.Add(syringeSize, mid); ProductPressure pp = new ProductPressure(pid); pp.Add(lp); m_HashProductPressure.Add(pid, pp); } else { ProductPressure pp = m_HashProductPressure[pid] as ProductPressure; LevelPressure lp = pp.Find(level); if (lp != null) { lp.Add(syringeSize, mid); } else { lp = new LevelPressure(level); lp.Add(syringeSize, mid); pp.Add(lp); } } }
private void InitPumpType() { cbPumpType.Items.Clear(); cbPumpType.Items.AddRange(ProductIDConvertor.GetAllPumpIDString().ToArray()); cbPumpType.SelectedIndex = 0; m_LocalPid = ProductIDConvertor.String2PumpID(cbPumpType.Items[cbPumpType.SelectedIndex].ToString()); SyncProductID(); }
private void InitPumpType() { cbPumpType.Items.Clear(); cbPumpType.Items.AddRange(ProductIDConvertor.GetAllPumpIDString().ToArray()); cbPumpType.SelectedIndex = 0; m_LocalPid = ProductIDConvertor.String2PumpID(cbPumpType.Items[cbPumpType.SelectedIndex].ToString()); chart1.SetPid(m_LocalPid); chart2.SetPid(m_LocalPid); chart1.SetChannel(1); chart2.SetChannel(2); }
/// <summary> /// 将泵类型字符串换成枚举 /// </summary> /// <param name="strPumpID"></param> /// <returns></returns> public static PumpID String2PumpID(string strPumpID) { PumpID pid = PumpID.None; switch (strPumpID) { case "GrasebyC6": pid = PumpID.GrasebyC6; break; case "GrasebyF6单道": pid = PumpID.GrasebyF6; break; case "GrasebyC6T": pid = PumpID.GrasebyC6T; break; case "Graseby2100": pid = PumpID.Graseby2100; break; case "Graseby2000": pid = PumpID.Graseby2000; break; case "WZ50C6": pid = PumpID.GrasebyC6; break; case "WZS50F6单道": pid = PumpID.GrasebyF6; break; case "WZ50C6T": pid = PumpID.GrasebyC6T; break; case "GrasebyF6双道": pid = PumpID.GrasebyF6_2; break; case "WZS50F6双道": pid = PumpID.WZS50F6_2; break; default: pid = PumpID.None; break; } return(pid); }
private void cbPumpType_SelectedIndexChanged(object sender, EventArgs e) { m_LocalPid = ProductIDConvertor.String2PumpID(cbPumpType.Items[cbPumpType.SelectedIndex].ToString()); #if DEBUG chart2.Enabled = true; #else if (m_LocalPid == PumpID.GrasebyF6 || m_LocalPid == PumpID.WZS50F6 || m_LocalPid == PumpID.GrasebyF6_2 || m_LocalPid == PumpID.WZS50F6_2) { chart2.Enabled = true; } else { chart2.Enabled = false; } #endif chart1.SetPid(m_LocalPid); chart2.SetPid(m_LocalPid); chart1.SetChannel(1); chart2.SetChannel(2); }
/// <summary> /// 取某类型泵的某个压力等级下某个尺寸的最大压力配置值 /// </summary> /// <param name="pid"></param> /// <param name="size"></param> /// <param name="level"></param> /// <returns></returns> public float GetMaxBySizeLevel(PumpID pid, int size, OcclusionLevel level) { ProductPressure pp = GetPressureByProductID(pid); if (pp == null) { return(0); } LevelPressure lp = pp.Find(level); if (lp == null) { return(0); } SizePressure sp = lp.Find(size); if (sp == null) { return(0); } return(sp.m_Mid); }
public ProductPressure GetPressureByProductID(PumpID pid) { //switch (pid) //{ // case PumpID.GrasebyF6_2: // pid = PumpID.GrasebyF6; // break; // case PumpID.WZS50F6_2: // pid = PumpID.WZS50F6; // break; // default: // break; //} if (m_HashProductPressure.ContainsKey(pid)) { return(m_HashProductPressure[pid] as ProductPressure); } else { return(null); } }
private void cbPumpType_SelectedIndexChanged(object sender, EventArgs e) { m_LocalPid = ProductIDConvertor.String2PumpID(cbPumpType.Items[cbPumpType.SelectedIndex].ToString()); SyncProductID(); if (m_LocalPid == PumpID.GrasebyF8 || m_LocalPid == PumpID.GrasebyF8_2 || m_LocalPid == PumpID.GrasebyF6 || m_LocalPid == PumpID.WZS50F6 || m_LocalPid == PumpID.GrasebyF6_2 || m_LocalPid == PumpID.WZS50F6_2) { chart1.Enabled = true; chart2.Enabled = true; } else { chart1.Enabled = true; chart2.Enabled = false; } chart2.SetPid(m_LocalPid); chart1.SetPid(m_LocalPid); //chart2.SetChannel(2); //chart1.SetChannel(1); SyringBrandProcess.InitializeBrands(m_SyringeBrands, m_ProductModel, "zh"); SyringBrandProcess.GetBrandNames(m_SyringeBrands, m_ProductModel, "zh"); chart2.InitBrandList(m_SyringeBrands); chart1.InitBrandList(m_SyringeBrands); }
public ProductPressure(PumpID pid) { m_Pid = pid; }
/// <summary> /// 双道泵测量数据统一放进m_SampleDataList中,第一道数据索引为0,第二道为1 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnChartSamplingComplete(object sender, DoublePumpDataArgs e) { Chart chart = sender as Chart; if (e.SampleDataList != null) { if (chart.Name == "chart1") { if (hashSampleData.ContainsKey(1)) { hashSampleData[1] = e.SampleDataList; } else { hashSampleData.Add(1, e.SampleDataList); } } else { if (hashSampleData.ContainsKey(2)) { hashSampleData[2] = e.SampleDataList; } else { hashSampleData.Add(2, e.SampleDataList); } } } if (hashSampleData.Count >= 2) { //写入excel,调用chart类中函数 string path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(PressureForm)).Location) + "\\数据导出"; PumpID pid = PumpID.None; switch (m_LocalPid) { case PumpID.GrasebyF6_2: pid = PumpID.GrasebyF6; break; case PumpID.WZS50F6_2: pid = PumpID.WZS50F6; break; default: pid = m_LocalPid; break; } string fileName = string.Format("{0}_{1}_{2}", pid.ToString(), tbPumpNo.Text, DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss")); if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } string saveFileName = path + "\\" + fileName + ".xlsx"; string path2 = Path.GetDirectoryName(Assembly.GetAssembly(typeof(PressureForm)).Location) + "\\数据导出备份"; string fileName2 = string.Format("{0}_{1}_{2}", pid.ToString(), tbPumpNo.Text, DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss")); if (!System.IO.Directory.Exists(path2)) { System.IO.Directory.CreateDirectory(path2); } string saveFileName2 = path2 + "\\" + fileName2 + ".xlsx"; List <List <PressureCalibrationParameter> > sampleDataList = new List <List <PressureCalibrationParameter> >(); if (hashSampleData.ContainsKey(1)) { sampleDataList.Add(hashSampleData[1] as List <PressureCalibrationParameter>); } if (hashSampleData.ContainsKey(2)) { sampleDataList.Add(hashSampleData[2] as List <PressureCalibrationParameter>); } if (sampleDataList.Count == 2) { chart1.GenDoublePunmpReport(saveFileName, sampleDataList, tbToolingNo2.Text, saveFileName2); } else { Logger.Instance().ErrorFormat("双道泵保存数据异常,由于结果数量不等于2,无法保存Count={0}", sampleDataList.Count); } Thread.Sleep(2000); hashSampleData.Clear(); } }
public void ReadGrasebyPumpPressureSettings(PumpID pid, Misc.OcclusionLevel level) { string section = string.Empty; #region section switch (pid) { case PumpID.GrasebyC6: section = "GrasebyC6"; break; case PumpID.Graseby2000: section = "Graseby2000"; break; case PumpID.Graseby2100: section = "Graseby2100"; break; case PumpID.GrasebyC6T: section = "GrasebyC6T"; break; case PumpID.WZ50C6: section = "WZ50C6"; break; case PumpID.WZ50C6T: section = "WZ50C6T"; break; case PumpID.GrasebyF6: section = "GrasebyF6_1"; break; case PumpID.GrasebyF6_2: section = "GrasebyF6_2"; break; case PumpID.WZS50F6: section = "WZS50F6_1"; break; case PumpID.WZS50F6_2: section = "WZS50F6_2"; break; default: section = "GrasebyC6"; break; } #endregion string val = GetString(section, level.ToString()).Trim(); string[] arrSyringeSizePValue = val.Split('|'); if (arrSyringeSizePValue.Length == 0) { return; } int size = 0; float p = 0; foreach (string pair in arrSyringeSizePValue) { string[] arrSizePValuePair = pair.Trim().Split(','); if (arrSizePValuePair.Length != 2) { continue; } if (int.TryParse(arrSizePValuePair[0].Trim(), out size) && float.TryParse(arrSizePValuePair[1].Trim(), out p)) { PressureManager.Instance().Add(pid, level, size, p); } } }
private void OnChart2SamplingComplete(object sender, DoublePumpDataArgs e) { Chart chart = sender as Chart; if (!e.IsPass) { #region 合格 TestAgainDialog againDlg = new TestAgainDialog(2); var result = againDlg.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { //不合格结束测试 m_SampleDataList.Add(e.Data); if (m_SampleDataList.Count == 2 && m_SampleDataList[0].Channel == 1 && m_SampleDataList[1].Channel == 2) { #region //结束了 chart1.Enabled = true; chart2.Enabled = true; chart1.Close(); chart2.Close(); //写入excel,调用chart类中函数 string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\压力数据Pressure Data\\Data"; string path2 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\压力数据Pressure Data\\Data Copy"; PumpID pid = PumpID.None; switch (m_LocalPid) { case PumpID.GrasebyF8: pid = PumpID.GrasebyF8; break; case PumpID.GrasebyF8_2: pid = PumpID.GrasebyF8; break; case PumpID.GrasebyF6: pid = PumpID.GrasebyF6; break; case PumpID.GrasebyF6_2: pid = PumpID.GrasebyF6; break; case PumpID.WZS50F6_2: pid = PumpID.WZS50F6; break; default: pid = m_LocalPid; break; } string fileName = string.Format("{0}_{1}_{2}", pid.ToString(), tbPumpNo.Text, DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss")); if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } string saveFileName = path + "\\" + fileName + ".xlsx"; if (!System.IO.Directory.Exists(path2)) { System.IO.Directory.CreateDirectory(path2); } string saveFileName2 = path2 + "\\" + fileName + ".xlsx"; //生成表格,两份 GenDualReport(saveFileName, saveFileName2); if (m_LocalPid == PumpID.GrasebyF8_2 || m_LocalPid == PumpID.GrasebyF6_2 || m_LocalPid == PumpID.WZS50F6_2) { if (m_SampleDataList.Count >= 2) { tbPumpNo.Clear(); } } else { tbPumpNo.Clear(); } //导出后就可以清空 m_SampleDataList.Clear(); string strError = ""; bool ch1 = true, ch2 = true; if (chart1.IsAuto()) { ch1 = chart1.IsPassAuto(ref strError); } else { ch1 = chart1.IsPassManual(ref strError); } if (chart2.IsAuto()) { ch2 = chart2.IsPassAuto(ref strError); } else { ch2 = chart2.IsPassManual(ref strError); } #endregion } else { Logger.Instance().ErrorFormat("OnChart2SamplingComplete()函数被调用,结果不合格,m_SampleDataList.Count={0},m_SampleDataList[0].Channel={1},m_SampleDataList[1].Channel={2}", m_SampleDataList.Count, m_SampleDataList[0].Channel, m_SampleDataList[1].Channel); CompleteTestBecauseError(); ErrorDialog dlg = new ErrorDialog("测量结果异常,请重新测试!"); dlg.ShowDialog(); } } else if (result == System.Windows.Forms.DialogResult.Cancel) { #region //重新测试 chart2.Close(); chart2.ClearTestData(); chart2.Enabled = true; Thread.Sleep(1000); chart2.Start(); #endregion } else { return; } return; #endregion } else { #region 合格 m_SampleDataList.Add(e.Data); if (m_SampleDataList.Count == 2 && m_SampleDataList[0].Channel == 1 && m_SampleDataList[1].Channel == 2) { #region chart1.Enabled = true; chart2.Enabled = true; chart1.Close(); chart2.Close(); //写入excel,调用chart类中函数 string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\压力数据Pressure Data\\Data"; string path2 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\压力数据Pressure Data\\Data Copy"; PumpID pid = PumpID.None; switch (m_LocalPid) { case PumpID.GrasebyF8: pid = PumpID.GrasebyF8; break; case PumpID.GrasebyF8_2: pid = PumpID.GrasebyF8; break; case PumpID.GrasebyF6_2: pid = PumpID.GrasebyF6; break; case PumpID.WZS50F6_2: pid = PumpID.WZS50F6; break; default: pid = m_LocalPid; break; } string fileName = string.Format("{0}_{1}_{2}", pid.ToString(), tbPumpNo.Text, DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss")); if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } string saveFileName = path + "\\" + fileName + ".xlsx"; if (!System.IO.Directory.Exists(path2)) { System.IO.Directory.CreateDirectory(path2); } string saveFileName2 = path2 + "\\" + fileName + ".xlsx"; //生成表格,两份 GenDualReport(saveFileName, saveFileName2); if (m_LocalPid == PumpID.GrasebyF8_2) { if (m_SampleDataList.Count >= 2) #if DEBUG {; } #else { tbPumpNo.Clear(); } #endif } else #if DEBUG {; } #else { tbPumpNo.Clear(); } #endif //导出后就可以清空 m_SampleDataList.Clear(); string strError1 = "", strError2 = ""; bool ch1 = true, ch2 = true; if (chart1.IsAuto()) { ch1 = chart1.IsPassAuto(ref strError1); } else { ch1 = chart1.IsPassManual(ref strError1); } if (chart2.IsAuto()) { ch2 = chart2.IsPassAuto(ref strError2); } else { ch2 = chart2.IsPassManual(ref strError2); } if (!string.IsNullOrEmpty(strError1)) { strError1 = "通道1失败:" + strError1; } if (!string.IsNullOrEmpty(strError2)) { strError2 = "通道2失败:" + strError2; } //双道泵是否通过测试,弹出框 if (ch1 && ch2) { ResultDialogPass dlg = new ResultDialogPass(ch1 && ch2); dlg.ShowDialog(); } else { ResultDialogFail dlg = new ResultDialogFail(ch1 && ch2, strError1 + strError2); dlg.ShowDialog(); } #endregion } else { Logger.Instance().ErrorFormat("OnChart2SamplingComplete()函数被调用,结果合格,m_SampleDataList.Count={0},m_SampleDataList[0].Channel={1},m_SampleDataList[1].Channel={2}", m_SampleDataList.Count, m_SampleDataList[0].Channel, m_SampleDataList[1].Channel); CompleteTestBecauseError(); ErrorDialog dlg = new ErrorDialog("测量结果异常,请重新测试!"); dlg.ShowDialog(); } #endregion } }
public override int GetHashCode() { return(PumpID.GetHashCode()); }
private void Detail_VisibleChanged(object sender, EventArgs e) { PumpID pid = PumpID.None; if (this.m_Channel == 1) { switch (m_LocalPid) { case PumpID.GrasebyF6_2: pid = PumpID.GrasebyF6; break; case PumpID.WZS50F6_2: pid = PumpID.WZS50F6; break; default: pid = m_LocalPid; break; } } else { pid = m_LocalPid; } if (this.Visible) { lbP0.Text = "P0=" + this.m_P0.ToString("F0"); PressureCalibrationParameter para = null; para = m_CaliParameters.Find((x) => { return(x.m_SyringeSize == 10); }); if (para != null) { lbL10Right.Text = (para.m_PressureL * 100).ToString("F0"); lbC10Right.Text = (para.m_PressureC * 100).ToString("F0"); lbH10Right.Text = (para.m_PressureH * 100).ToString("F0"); lbL10Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 10, Misc.OcclusionLevel.L).ToString("F2"); lbC10Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 10, Misc.OcclusionLevel.C).ToString("F2"); lbH10Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 10, Misc.OcclusionLevel.H).ToString("F2"); } para = m_CaliParameters.Find((x) => { return(x.m_SyringeSize == 20); }); if (para != null) { lbL20Right.Text = (para.m_PressureL * 100).ToString("F0"); lbC20Right.Text = (para.m_PressureC * 100).ToString("F0"); lbH20Right.Text = (para.m_PressureH * 100).ToString("F0"); lbL20Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 20, Misc.OcclusionLevel.L).ToString("F2"); lbC20Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 20, Misc.OcclusionLevel.C).ToString("F2"); lbH20Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 20, Misc.OcclusionLevel.H).ToString("F2"); } para = m_CaliParameters.Find((x) => { return(x.m_SyringeSize == 30); }); if (para != null) { lbL30Right.Text = (para.m_PressureL * 100).ToString("F0"); lbC30Right.Text = (para.m_PressureC * 100).ToString("F0"); lbH30Right.Text = (para.m_PressureH * 100).ToString("F0"); lbL30Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 30, Misc.OcclusionLevel.L).ToString("F2"); lbC30Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 30, Misc.OcclusionLevel.C).ToString("F2"); lbH30Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 30, Misc.OcclusionLevel.H).ToString("F2"); } para = m_CaliParameters.Find((x) => { return(x.m_SyringeSize == 50); }); if (para != null) { lbL50Right.Text = (para.m_PressureL * 100).ToString("F0"); lbC50Right.Text = (para.m_PressureC * 100).ToString("F0"); lbH50Right.Text = (para.m_PressureH * 100).ToString("F0"); lbL50Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 50, Misc.OcclusionLevel.L).ToString("F2"); lbC50Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 50, Misc.OcclusionLevel.C).ToString("F2"); lbH50Left.Text = PressureManager.Instance().GetMidBySizeLevel(pid, 50, Misc.OcclusionLevel.H).ToString("F2"); } } }