/// <summary> /// 获取版本删除数据 /// </summary> private void CallGetDataDelRev(List <ExportDto.MPART> PartDatas, bool IsOnly) { DataDelPartRev = new DataTable(); if (!IsOnly) { List <ExportDto.PARTREV_DEL> data = new List <ExportDto.PARTREV_DEL>(); var items = PartDatas.Where(o => o.TypeCode == "M").ToList(); foreach (var item in items) { ExportDto.PARTREV_DEL obj = new ExportDto.PARTREV_DEL(); obj.Company = "001"; obj.AltMethod = ""; obj.PartNum = item.PartNum; obj.RevisionNum = item.PartRev_RevisionNum; data.Add(obj); } DataDelPartRev = Utility.ListToDataTable(data, "_", "#"); } Utility.ExportExcel(DataDelPartRev, SaveFolderPath + "\\PART_REV_DEL.xls"); pecentExe += 20; lblStatus = "版本删除数据已就绪..."; }
private void buttonStartSync_Click(object sender, EventArgs e) { buttonStartSync.Enabled = false; labelSyncStatus.Text = "开始同步"; buttonOk_Click(sender, e); buttonGetBOO_Click(sender, e); buttonGetBOM_Click(sender, e); string MM = DateTime.Now.ToString("yyyyMMddhhmmss"); FileHelper.CreateDir("DMT" + MM, Application.StartupPath + @"\ExcelImport"); SaveFolderPath = Application.StartupPath + @"\ExcelImport\DMT" + MM; var partA = BOM.Select(o => o.MtlPartNum).Distinct().ToList(); var partB = BOM.Select(o => o.PartNum).Distinct().ToList(); var part = partA.Union(partB).ToArray(); var lists = PLM.GetNewPLMPart(part, null); var PARTBOM = Utilities.MapTo <List <ExportDto.MPART> >(lists); PART = PART.Union(PARTBOM).Distinct().ToList(); foreach (var item in PART) { item.TrackLots = "TRUE"; item.NonStock = Utilities.CheckNonStock(item.PartNum).ToString().ToUpper(); item.PartPlant_NonStock = item.NonStock; item.PartPlant_CostMethod = item.CostMethod; item.PartWhse_WarehouseCode = "YJK"; item.PartRev_RevisionNum = item.TypeCode == "M" ? textBoxPartRev.Text : ""; item.PartRev_RevShortDesc = item.PartRev_RevisionNum; } foreach (var item in BOO) { item.ECOGroupID = "usersync"; } foreach (var item in BOM) { item.ECOGroupID = "usersync"; } DataTable dt = Utility.ListToDataTable(PART, "_", "#"); Utility.ExportExcel(dt, SaveFolderPath + "\\PART.xls"); dt = Utility.ListToDataTable(BOO, "_", "#"); Utility.ExportExcel(dt, SaveFolderPath + "\\BOO.xls"); dt = Utility.ListToDataTable(BOM, "_", "#"); Utility.ExportExcel(dt, SaveFolderPath + "\\BOM.xls"); List <ExportDto.PARTREV_DEL> part_rev_del = new List <ExportDto.PARTREV_DEL>(); var items = PART.Where(o => o.TypeCode == "M").ToList(); foreach (var item in items) { ExportDto.PARTREV_DEL obj = new ExportDto.PARTREV_DEL(); obj.Company = "001"; obj.AltMethod = ""; obj.PartNum = item.PartNum; obj.RevisionNum = item.PartRev_RevisionNum; part_rev_del.Add(obj); } dt = Utility.ListToDataTable(part_rev_del, "_", "#"); Utility.ExportExcel(dt, SaveFolderPath + "\\PART_REV_DEL.xls"); StartSync(); }