/// <summary> /// 确认按钮单击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnConfirm_Click(object sender, EventArgs e) { if (this.weightResultTree.SelectedNode == null) { return; } int i = Convert.ToInt16(this.weightResultTree.SelectedNode.ToolTipText); if (flag == 0) { WeightArithmetic wa = mainForm.designProjectData.lstWeightArithmetic[i]; ((WeightAssessmentForm)this.Owner).saveWeightDataGridView(wa.ExportDataToWeightSort(), 1); } else if (flag == 1) { WeightAdjustmentResultData ward = mainForm.designProjectData.lstAdjustmentResultData[i]; ((WeightAssessmentForm)this.Owner).saveWeightDataGridView(ward.weightAdjustData, 1); } else if (flag == 2) { WeightSortData wsd = WeightSortData.clsStringToWeightSortData(lstTypeWeight[i].MainSystem_Name); ((WeightAssessmentForm)this.Owner).saveWeightDataGridView(wsd, 1); } else if (flag == 3) { WeightSortData wsd = WeightSortData.clsStringToWeightSortData(lstWeightDesign[i].MainSystem_Name); ((WeightAssessmentForm)this.Owner).saveWeightDataGridView(wsd, 1); } this.Close(); }
public ReusltIssueDBForm(string str_Type, WeightAdjustmentResultData _adjustData) { InitializeComponent(); strType = str_Type; adjustData = _adjustData; SetTitle(); txtDesignDataName.Text = adjustData.WeightAdjustName; }
public WeightAdjustmentForm(MainForm _mainForm, WeightAdjustmentResultData _weightAdjustment) { InitializeComponent(); mainForm = _mainForm; weightAdjustment = _weightAdjustment; BindSelData(); //初始化基础重量数据表 dgvBaseWeight.Rows.Add(); dgvBaseWeight.Rows[0].Cells[0].Value = "重量数值"; dgvBaseWeight.Rows[0].Cells[0].ReadOnly = true; }
/// <summary> /// 导出重量调整结果为对应的SyswareDataObject.xml /// </summary> /// <param name="result"></param> /// <param name="isAddChildren"></param> /// <returns></returns> public static string saveWeightAdjustDataObjectToXml(WeightAdjustmentResultData adjustResult, bool isAddChildren) { string path = null; try { SyswareDataObject sdo = new SyswareDataObject(); SyswareDataObject subSdo = new SyswareDataObject(); if (isAddChildren) { subSdo.name = adjustResult.WeightAdjustName; sdo = subSdo; } else { sdo.name = "重量调整结果"; subSdo.name = adjustResult.WeightAdjustName; sdo.children.Add(subSdo); } //基础重量 SyswareDataObject basicSdo = new SyswareDataObject(); basicSdo.name = "基础重量"; basicSdo.children = transFormWeightArithmeticToDataObject(-1, adjustResult.basicWeightData.lstWeightData); subSdo.children.Add(basicSdo); //调整重量 SyswareDataObject adjustSdo = new SyswareDataObject(); adjustSdo.name = "调整重量"; adjustSdo.children = transFormWeightArithmeticToDataObject(-1, adjustResult.weightAdjustData.lstWeightData); subSdo.children.Add(adjustSdo); XmlDocument myXmlDoc = saveSyswareDataObjectToXML(null, null, sdo); path = System.IO.Path.GetTempPath() + System.IO.Path.GetRandomFileName() + ".xml"; //将xml文件保存到临时路径下 myXmlDoc.Save(path); } catch { //XLog.Write("无法保存重量设计XML." + e.Message); return(null); } return(path); }
/// <summary> /// 计算 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCalculation_Click(object sender, EventArgs e) { if (txtAdjustmentDataName.Text == string.Empty) { MessageBox.Show("请输入调整数据名称"); return; } else { if (Verification.IsCheckString(txtAdjustmentDataName.Text)) { MessageBox.Show("调整数据名称不能输入非法字符"); return; } } if (basicWeightData == null) { MessageBox.Show("请导入基础重量数据"); return; } if (cmbCurrentSel.Text == "校核因子" || cmbCurrentSel.Text == "校核因子和技术因子") { if (lstJHRatio == null || lstJHRatio.Count == 0) { MessageBox.Show("请导入校核因子"); return; } } if (cmbCurrentSel.Text == "技术因子" || cmbCurrentSel.Text == "校核因子和技术因子") { if (lstTeachRatio == null || lstTeachRatio.Count == 0) { MessageBox.Show("请导入技术因子"); return; } } //调整后的重量数据 modifyWeightSortData = getWeightModified(basicWeightData, lstRatio); //重量调整数据 if (weightAdjustment == null) { weightAdjustment = new WeightAdjustmentResultData(); } weightAdjustment.WeightAdjustName = txtAdjustmentDataName.Text; weightAdjustment.SortName = basicWeightData.sortName; weightAdjustment.basicWeightData = basicWeightData; weightAdjustment.weightAdjustData = modifyWeightSortData; weightAdjustment.technologyFactor = lstTeachRatio; weightAdjustment.checkFactor = lstJHRatio; //关联主页面 if (mainForm.designProjectData == null) { mainForm.designProjectData = new DesignProjectData(); } if (mainForm.designProjectData.lstAdjustmentResultData == null) { mainForm.designProjectData.lstAdjustmentResultData = new List<WeightAdjustmentResultData>(); } //重新计算 if (IsReCal) { mainForm.SetWeightAdjustmentResult(weightAdjustment); XLog.Write("重量调整数据\"" + txtAdjustmentDataName.Text + "\"重新计算完成!"); } else { mainForm.designProjectData.lstAdjustmentResultData.Add(weightAdjustment); mainForm.BindProjectTreeData(mainForm.designProjectData); mainForm.SetWeightAdjustTab(weightAdjustment, mainForm.designProjectData.lstAdjustmentResultData.Count - 1); XLog.Write("重量调整数据\"" + txtAdjustmentDataName.Text + "\"计算完成!"); } this.Close(); }