// //保存 // private void btn_Save_Click(object sender, RoutedEventArgs e) { Maticsoft.Model.ConsumableInfo _Consum = (Maticsoft.Model.ConsumableInfo)grd_ConsumableInfo.DataContext; if (IsAdd) //添加模式 { MCP_CS.ConsumableInfo.Add(_Consum); btn_Add.IsEnabled = true; My_MessageBox.My_MessageBox_Query("添加成功!"); grd_ConsumableInfo.DataContext = new Maticsoft.Model.ConsumableInfo(); } else //更新模式 { MCP_CS.ConsumableInfo.Update(_Consum); } MCP_CS.SetControl(grd_ConsumableInfo, false, false); //设置控件为不可编辑模式 }
//导出 private void btn_Export_Click(object sender, System.Windows.RoutedEventArgs e) { /* * if(_Yet_ProcessFlow.Count > 0) * { * string _ExcelPatch = "D:\\数据导出\\Report\\"+txb_SN_Or_Order.Text+".xlsx"; * System.IO.File.Copy("D:\\模板\\ProcessFlow.xlsx", _ExcelPatch,true); * ZhuifengLib.EXCEL.ExcelControl_Model _M_excel = new ZhuifengLib.EXCEL.ExcelControl_Model(); * _M_excel.ModelToExcel<Maticsoft.Model.e_ProcessFlow>(_Yet_ProcessFlow.ToList(), _ExcelPatch); * My_MessageBox.My_MessageBox_Query("导出完成!"); * } */ string _ExcelPatch = "D:\\数据导出\\Report\\" + txb_SN_Or_Order.Text + ".xlsx"; System.IO.File.Copy("D:\\模板\\ProcessFlow.xlsx", _ExcelPatch, true); ZhuifengLib.EXCEL.ExcelControlModel _M_excel = new ZhuifengLib.EXCEL.ExcelControlModel(); _M_excel.DataTabToExcel <Maticsoft.Model.e_ProcessFlow>(_Yet_ProcessFlow.ToList(), _ExcelPatch); My_MessageBox.My_MessageBox_Query("导出完成!"); }
//查找 private void btn_Search_Click(object sender, System.Windows.RoutedEventArgs e) { try { if (txb_SN_Or_Order_2.Text == "") { Maticsoft.BLL.ICls_Flow I_Flow = new Maticsoft.BLL.Cls_Flow(); //获取已保存工序 int MaxProcessOrder = 0; int YetOverFlowCount = 0; I_Flow.Get_Bar_YetOverFlow(txb_SN_Or_Order.Text, out MaxProcessOrder, out YetOverFlowCount, ref _Yet_ProcessFlow); } else { ExportProcessFlow(txb_SN_Or_Order.Text, txb_SN_Or_Order_2.Text); } } catch (Exception ex) { My_MessageBox.My_MessageBox_Query(ex.Message); } }
// //删除 // private void btn_Delete_Click(object sender, RoutedEventArgs e) { Maticsoft.Model.ConsumableInfo _Consum = (Maticsoft.Model.ConsumableInfo)grd_ConsumableInfo.DataContext; if (_Consum.Csm_ID > 0) { if (MCP_CS.ConsumableInfo.Delete(_Consum.Csm_ID)) { My_MessageBox.My_MessageBox_Query("删除成功!"); } else { My_MessageBox.My_MessageBox_Query("删除失败!"); } } else { My_MessageBox.My_MessageBox_Query("删除不合法,请确认操作是否正确!"); } }