private void LabDataExportBtn_Click(object sender, RoutedEventArgs e) { saveFileDialog.FileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; if ((bool)saveFileDialog.ShowDialog()) { List <ReportView> items = GetReportView(); string[] headers = { "员工工号", "姓名", "模具号", "操作时间" }; string[] pathes = { "OperatorID", "Name", "MoldID", "Date" }; if (items.Count > 0) { if (GenExcelHelper.GenExcel <ReportView>(saveFileDialog.FileName, ((EnumItem)ReportTypeCB.SelectedItem).Description + "数据", headers, pathes, items)) { MessageBox.Show("数据导出成功,请到保存路径查看"); } else { MessageBox.Show("数据导出失败(可能指定文件已经打开),请重试"); } } else { MessageBox.Show("不存在记录数据"); } } }
private void StoreDataExportBtn_Click(object sender, RoutedEventArgs e) { saveFileDialog.FileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; if ((bool)saveFileDialog.ShowDialog()) { List <StorageRecord> items = GetStoreRecordView(); string[] headers = { "员工工号", "操作员工号", "模具号", "源位置", "目标位置", "操作时间" }; string[] pathes = { "ApplicantId", "OperatorId", "TargetNR", "Source", "Destination", "Date" }; if (items.Count > 0) { if (GenExcelHelper.GenExcel <StorageRecord>(saveFileDialog.FileName, ((EnumItem)StorageRecordTypeCB.SelectedItem).Description + "数据", headers, pathes, items)) { MessageBox.Show("数据导出成功,请到保存路径查看"); } else { MessageBox.Show("数据导出失败(可能指定文件已经打开),请重试"); } } else { MessageBox.Show("不存在记录数据"); } } }
private void ExportBtn_Click(object sender, RoutedEventArgs e) { saveFileDialog.FileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; if ((bool)saveFileDialog.ShowDialog()) { MoldPartInfoServiceClient client = new MoldPartInfoServiceClient(); List <MoldWarnInfo> warnInfos = client.GetMoldWarnInfo((MoldWarnType)(int.Parse(WarnCB.SelectedValue.ToString()))); string[] headers = { "模具号", "借出员工", "成本中心", "当前位置", "维护周期", "借出时间", "应还时间", "相距时间" }; string[] pathes = { "MoldNR", "ApplicantId", "ProjectName", "CurrentPosition", "MaxLendHour", "LendTime", "ShouldReTime", "DisTimeText" }; if (warnInfos.Count > 0) { if (GenExcelHelper.GenExcel <MoldWarnInfo>(saveFileDialog.FileName, "超期数据", headers, pathes, warnInfos)) { MessageBox.Show("数据导出成功,请到保存路径查看"); } else { MessageBox.Show("数据导出失败(可能指定文件已经打开),请重试"); } } else { MessageBox.Show("不存在记录数据"); } } }