private void CallGetNewPart() { DateTime dt = DateTime.Parse(dtPicker.Text); var ds = PLM.GetNewPLMPart(new string[] { tboxPartNum.Text }, dt); RLD.DeleteAllNewPart(); foreach (var item in ds) { var obj = Utilities.MapTo <Entity.RossLive.Model.RossNewParts>(item); obj.SysTime = Convert.ToDateTime(item.PartRev_EffectiveDate); RLD.InsertOrUpdateNewPart(obj); } if (!string.IsNullOrEmpty(tboxKeywd.Text)) { ds = ds.Where(o => o.PartDescription.Contains(tboxKeywd.Text)).ToList(); } foreach (var it in ds) { it.PartPlant_NonStock = "FALSE"; //Utilities.CheckNonStock(it.PartNum).ToString().ToUpper(); } this.BeginInvoke(new Action(() => { dataGridViewMain.DataSource = ds; DataCount = ds.Count; tabControlMain.SelectedIndex = 0; tabControlMain.SelectedTab.Text = "PLM新物料数据"; CurrentDgv = dataGridViewMain; BtnGetNewPartMtl.Enabled = true; BtnGetNewMTL.Enabled = true; })); }
private void buttonOk_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBoxPartNums.Text)) { string contents = textBoxPartNums.Text.Trim(); string[] PartNums = contents.Split(new string[] { "\r\n" }, StringSplitOptions.None); var lists = new List <Entity.DTO.DTO_MPART>(); lists = PLM.GetNewPLMPart(PartNums, null); foreach (var item in lists) { if (!string.IsNullOrEmpty(textBoxPartRev.Text)) { item.PartRev_RevisionNum = textBoxPartRev.Text; item.PartRev_RevShortDesc = textBoxPartRev.Text; } if (dtPickerPartEff.Value != null) { item.PartRev_EffectiveDate = dtPickerPartEff.Value.ToShortDateString(); } } PART = Utilities.MapTo <List <ExportDto.MPART> >(lists); foreach (var part in PART) { part.TrackLots = "TRUE"; part.NonStock = Utilities.CheckNonStock(part.PartNum).ToString().ToUpper(); part.PartPlant_NonStock = part.NonStock; part.PartPlant_CostMethod = part.CostMethod; part.PartWhse_WarehouseCode = "YJK"; } dataGridViewMain.DataSource = PART; tabControl1.SelectedIndex = 0; } else { MessageBox.Show("请输入物料编码!"); } }
private async void BtnAutoUptMtl_Click(object sender, EventArgs e) { BtnAutoUptMtl.Enabled = false; await AutoCache(); var lists = PLM.GetNewPLMPart(null, LastUptTime); if (lists.Count > 0) { Mapper.Initialize(x => x.CreateMap <Entity.DTO.DTO_MPART, PART>()); UptParts = Mapper.Map <List <PART> >(lists); foreach (var it in UptParts) { it.NonStock = Utilities.CheckNonStock(it.PartNum).ToString().ToUpper(); it.PartPlant_NonStock = "FALSE"; it.TrackLots = "TRUE"; it.PartPlant_CostMethod = it.CostMethod; it.PartWhse_WarehouseCode = "YJK"; } DGVMain.DataSource = UptParts; var dt = Utility.ListToDataTable(UptParts, "_", "#"); Utility.ExportExcel(dt, SaveFolderPath + "\\PART_UPDATE.xls"); if (UptParts.Count > 0) { StartSync(); } } labelLoadDatas.Text = "就绪"; timerMain.Enabled = false; BtnAutoUptMtl.Enabled = true; tProgBar.Value = 0; }