private void SaveChangeBladeDate(bool isNew = false) { if (CheckValueIsValid())//检查值是否有效 { SaveDefaultBldData(); if (isNew && firstCreate) { bladeData = bladeData.CreateNewBladeData();//创建一个新的数据类 firstCreate = false; bladeData.ReadyTest = false; Globals.TestedHeight = false;//清除当前测高标志 更换刀具后需要重新进行测高 Common.ReportCmdKeyProgress(CmdKey.B0013); } if (usedHandTest.SelectedIndex != 0) { Globals.TestHeightValue = handTestValue.Value; Globals.TestedHeight = true; bladeData.TestHeightValue = handTestValue.Value;//手动输入测高值 Common.ReportCmdKeyProgress(CmdKey.B0014); } Globals.AppCfg.BladeFileName = string.Format("QS{0}{1}.drs", bladeData.ReplaceTime.ToString("yyyyMM"), bladeData.Number.ToString("D4")); this.bladeData.SaveBladeDataFile(Globals.AppCfg.BladeFileFullName); Globals.AppCfg.SaveDefaultSysConfigFile(); Globals.BldData = this.bladeData; } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string s = string.Empty; foreach (var item in filePath) { s = Path.GetFileNameWithoutExtension(item); BldData d = Serialize.XmlDeSerialize <BldData>(File.ReadAllText(item)); bldDataList.Add(s, d); } }
private void pathView_AfterSelect(object sender, TreeViewEventArgs e) { switch (e.Node.ImageIndex) { case 0: { if (e.Node.Tag != null) //显示当年刀具信息 { tabControlEx1.SelectedIndex = 1; } } break; case 1: { if (e.Node.Tag != null) //显示当月刀具信息 { tabControlEx1.SelectedIndex = 2; } } break; case 2: { if (e.Node.Tag != null) //显示当前刀具信息 { BldData d = bldDataList[e.Node.Tag.ToString()]; this.bldDataBindingSource.DataSource = d; //bldModel.Text = d.BldModel; //bldType.SelectedIndex = d.BldType; //bldDiameter.Text = d.BldDiameter.ToString(); //bldTickness.Text = d.BldTickness.ToString(); //bldTime.Text = d.ReplaceTime.ToString("yyyy/MM/dd HH:mm:ss"); //testHeightTick.Text = d.TestTick.ToString(); //testHeight.Text = d.TestHeightValue.ToString(); //bldLouchuValue.Text = d.SafetyMargin.ToString(); //piecesCut.Text = d.PieceAfterReplace.ToString(); //linesCut.Text = d.LinesAfterReplace.ToString(); //repalceResult.SelectedIndex = d.ReplaceReason; //lengthCut.Text = d.LenAfterReplace.ToString(); //lossValue.Text = d.BldLossAfterRepalce.ToString(); //bldLouValue.Text = d.BldRemainder.ToString("0.###"); tabControlEx1.SelectedIndex = 0; } } break; default: break; } }
private void BladeRepalceManager_Load(object sender, EventArgs e) { if (!DesignMode) { if (Globals.BldData != null) { bladeData = Globals.BldData.CreateNewBladeData(true);//克隆一个新的数据类 } else { bladeData = new BldData(); } LoadDefalutBldData(bladeData); CheckValueIsValid(); } }
private void LoadDefalutBldData(BldData bld) { bldModelEdit.Text = bld.BldModel; bldNumEdit.Text = bld.BldNum; bldTypeEdit.SelectedIndex = bld.BldType; bldTicknessEdit.Value = bld.BldTickness; bldDiameter.Value = bld.BldDiameter; flangeDiameter.Value = bld.FlangeDiameter; maxCutLenEdit.Value = bld.MaxSafeLength; maxCutLineEdit.Value = bld.MaxSafeLines; selfWarnEdit.Value = bld.SafetyMargin; repalceResult.SelectedIndex = bld.ReplaceReason; depthCompensatedMode.SelectedIndex = bld.DepthCompensatedMode; depthCompensatedLines.Value = bld.DepthCompensatedLines; depthCompensatedLen.Value = bld.DepthCompensatedLen; depthCompensatedValue.Value = bld.DepthCompensatedValue; usedHandTest.SelectedIndex = bld.UsedHandTest?1:0; handTestValue.Value = bld.TestHeightValue; }
public void LoadBladeData(BldData data) { bldData = data; this.bldDataBindingSource.DataSource = bldData; panel1.Visible = Globals.NoTouchTest; if (Globals.NoTouchTest) { ncsOffset.Text = Globals.TabData.NcsOffset.ToString(format); ncsTestHeight.Text = Globals.TabData.NcsTestValue.ToString(format); } testingSpdSpeed.Text = Globals.TabData.SpdSpeed.ToString(); if (Globals.DoubleCap) { label4.Text = "刀痕偏移Lo/Hi(mm):"; bladeOffsetLo.Text = bldData.KnifeMarksOffsetHi.ToString(format) + "/" + bldData.KnifeMarksOffsetLo.ToString(format); } else { label4.Text = "刀痕偏移值(mm):"; bladeOffsetLo.Text = bldData.KnifeMarksOffsetHi.ToString(format); } bladeDiameter.Text = bldData.BldDiameter.ToString(format) + "/" + bldData.FlangeDiameter.ToString(format); }
private void SaveDefaultBldData() { BldData bld = bladeData; bld.BldModel = bldModelEdit.Text; bld.BldNum = bldNumEdit.Text; bld.BldType = (byte)bldTypeEdit.SelectedIndex; bld.BldTickness = bldTicknessEdit.Value; bld.BldDiameter = bldDiameter.Value; bld.FlangeDiameter = flangeDiameter.Value; bld.MaxSafeLength = maxCutLenEdit.Value; bld.MaxSafeLines = maxCutLineEdit.Int; bld.SafetyMargin = selfWarnEdit.Value; bld.ReplaceReason = (byte)repalceResult.SelectedIndex; bld.DepthCompensatedMode = (byte)depthCompensatedMode.SelectedIndex; bld.DepthCompensatedLines = depthCompensatedLines.Value; bld.DepthCompensatedLen = depthCompensatedLen.Value; bld.DepthCompensatedValue = depthCompensatedValue.Value; bld.UsedHandTest = usedHandTest.SelectedIndex > 0; if (bld.UsedHandTest) { bld.TestHeightValue = handTestValue.Value; } }