private void utecInvName_EditorButtonClick(object sender, EditorButtonEventArgs e) { using (var brm = new SelectKisInventory(_dtRawMaterial, txtcInvCode.Text, false)) { if (brm.ShowDialog() == DialogResult.Yes) { _FitemId = brm.FitemId; txtcInvCode.Text = brm.InvCode; utecInvName.Text = brm.InvName; txtcInvStd.Text = brm.InvStd; txtcFullName.Text = brm.FullName; _FitemId = brm.FitemId; } } }
private void utecInvName_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { using (var brm = new SelectKisInventory(_dtRawMaterial, txtcInvCode.Text, false)) { if (brm.ShowDialog() == DialogResult.Yes) { _FitemId = brm.FitemId; txtcInvCode.Text = brm.InvCode; utecInvName.Text = brm.InvName; txtcInvStd.Text = brm.InvStd; txtcFullName.Text = brm.FullName; _FitemId = brm.FitemId; _DefaultLoc = brm.DefaultLoc; _DefaultSP = brm.DefalutSP; SetLotNoSourceAndRecentVendor(); } } }
private void uGridRawMaterial_ClickCellButton(object sender, CellEventArgs e) { if (e.Cell.Row.Index < 0) { return; } if (string.IsNullOrEmpty(txtcInvCode.Text) || string.IsNullOrEmpty(utecInvName.Text)) { MessageBox.Show(@"请先选择成品", @"失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } using (var brm = new SelectKisInventory(_dtRawMaterial, e.Cell.Row.Cells["cInvCode"].Value.ToString(), false)) { if (brm.ShowDialog() == DialogResult.Yes) { if (dataInventory.BomDetail.Rows.Cast <DataRow>().Any(iRow => iRow.RowState != DataRowState.Deleted && iRow["cInvCode"].ToString().Equals(brm.InvCode))) { MessageBox.Show(@"错误,子件已经存在", @"失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (brm.InvCode.Equals(txtcInvCode.Text)) { MessageBox.Show(@"错误,子件不能是自己本身", @"失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } e.Cell.Row.Cells["BomID"].Value = -1; e.Cell.Row.Cells["cFitemID"].Value = brm.FitemId; e.Cell.Row.Cells["cInvCode"].Value = brm.InvCode; e.Cell.Row.Cells["cInvName"].Value = brm.InvName; e.Cell.Row.Cells["cInvStd"].Value = brm.InvStd; e.Cell.Row.Cells["cFullName"].Value = brm.FullName; e.Cell.Row.Cells["cUnitID"].Value = brm.FUnitID; e.Cell.Row.Cells["cUnitName"].Value = brm.FUnitName; e.Cell.Row.Cells["dAddTime"].Value = DateTime.Now; } } }
private void biExcelLoad_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ResetNull(); SetControlEnable(); if (ofdMain.ShowDialog() != DialogResult.OK) return; var strSuccess=""; var strFail=""; var bSkip=false; var cRealSequence=""; var workbook = new Workbook(ofdMain.FileName); var cells = workbook.Worksheets[0].Cells; if (!cells[2, 0].StringValue.Equals("序号")) MessageBox.Show(@"Excel模板格式不正确"); for (var i = 3; i <= cells.MaxDataRow + 1; i++) { var cSequence = cells[i, 0].StringValue; var cInvCode = cells[i, 1].StringValue; if (bSkip && string.IsNullOrEmpty(cSequence)) { continue; } else { bSkip = false; } if (!string.IsNullOrEmpty(cSequence) && !string.IsNullOrEmpty(cInvCode)) { if (i != 3) { if (SaveWithoutMsg()) { strSuccess = strSuccess + " 序号:" + cRealSequence + "成功! "; } else { strFail = strFail + " 序号:" + cRealSequence + "失败,并跳过; "; } ResetNull(); } txtcInvCode.Text = cells[i, 1].StringValue; bSkip = false; cRealSequence = cSequence; } if (i == cells.MaxDataRow+1) { if (SaveWithoutMsg()) { strSuccess = strSuccess + " 序号:" + cRealSequence + "成功! "; } else { strFail = strFail + " 序号:" + cRealSequence + "失败,并跳过; "; } ResetNull(); break; } if (string.IsNullOrEmpty(cells[i, 0].StringValue) && !string.IsNullOrEmpty(cells[i, 1].StringValue)) { var cItemCode = cells[i, 1].StringValue; var cQuantity = cells[i, 5].StringValue; decimal iQuantity; if (!decimal.TryParse(cQuantity, out iQuantity)) { //数值转换失败跳过 bSkip = true; continue; } if (string.IsNullOrEmpty(txtcInvCode.Text) || string.IsNullOrEmpty(utecInvName.Text)) { //成品编码问题跳过 bSkip = true; continue; } using (var brm = new SelectKisInventory(_dtRawMaterial, cItemCode, true)) { if (brm.ShowDialog() == DialogResult.Yes) { if (dataInventory.BomDetail.Rows.Cast<DataRow>().Any(iRow => iRow.RowState != DataRowState.Deleted && iRow["cInvCode"].ToString().Equals(brm.InvCode))) { continue; } if (brm.InvCode.Equals(txtcInvCode.Text)) { continue; } var dr = dataInventory.BomDetail.NewBomDetailRow(); dr.BomID = -1; dr.cFitemID = brm.FitemId; dr.cInvCode= brm.InvCode; dr.cInvName = brm.InvName; dr.cInvStd = brm.InvStd; dr.cFullName= brm.FullName; dr.iQuantity = iQuantity; dr.cUnitID = brm.FUnitID; dr.cUnitName= brm.FUnitName; dr.dAddTime = DateTime.Now; dataInventory.BomDetail.Rows.Add(dr); } } } } MessageBox.Show(@"成功 " + strSuccess + @" " + @"失败 " + strFail); MessageBox.Show(@"失败 " + strFail); SetPanelVlaue("", "btnLast"); }
private void uGridRawMaterial_ClickCellButton(object sender, CellEventArgs e) { if (e.Cell.Row.Index < 0) return; if (string.IsNullOrEmpty(txtcInvCode.Text) || string.IsNullOrEmpty(utecInvName.Text)) { MessageBox.Show(@"请先选择成品", @"失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } using (var brm = new SelectKisInventory(_dtRawMaterial, e.Cell.Row.Cells["cInvCode"].Value.ToString(),false)) { if (brm.ShowDialog() == DialogResult.Yes) { if (dataInventory.BomDetail.Rows.Cast<DataRow>().Any(iRow => iRow.RowState!=DataRowState.Deleted&&iRow["cInvCode"].ToString().Equals(brm.InvCode))) { MessageBox.Show(@"错误,子件已经存在", @"失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (brm.InvCode.Equals(txtcInvCode.Text)) { MessageBox.Show(@"错误,子件不能是自己本身", @"失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } e.Cell.Row.Cells["BomID"].Value = -1; e.Cell.Row.Cells["cFitemID"].Value = brm.FitemId; e.Cell.Row.Cells["cInvCode"].Value = brm.InvCode; e.Cell.Row.Cells["cInvName"].Value = brm.InvName; e.Cell.Row.Cells["cInvStd"].Value = brm.InvStd; e.Cell.Row.Cells["cFullName"].Value = brm.FullName; e.Cell.Row.Cells["cUnitID"].Value = brm.FUnitID; e.Cell.Row.Cells["cUnitName"].Value = brm.FUnitName; e.Cell.Row.Cells["dAddTime"].Value = DateTime.Now; } } }
private void utecInvName_EditorButtonClick(object sender, EditorButtonEventArgs e) { using (var brm = new SelectKisInventory(_dtRawMaterial, txtcInvCode.Text,false)) { if (brm.ShowDialog() == DialogResult.Yes) { _FitemId = brm.FitemId; txtcInvCode.Text = brm.InvCode; utecInvName.Text = brm.InvName; txtcInvStd.Text = brm.InvStd; txtcFullName.Text = brm.FullName; _FitemId = brm.FitemId; } } }
private void biExcelLoad_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ResetNull(); SetControlEnable(); if (ofdMain.ShowDialog() != DialogResult.OK) { return; } var strSuccess = ""; var strFail = ""; var bSkip = false; var cRealSequence = ""; var workbook = new Workbook(ofdMain.FileName); var cells = workbook.Worksheets[0].Cells; if (!cells[2, 0].StringValue.Equals("序号")) { MessageBox.Show(@"Excel模板格式不正确"); } for (var i = 3; i <= cells.MaxDataRow + 1; i++) { var cSequence = cells[i, 0].StringValue; var cInvCode = cells[i, 1].StringValue; if (bSkip && string.IsNullOrEmpty(cSequence)) { continue; } else { bSkip = false; } if (!string.IsNullOrEmpty(cSequence) && !string.IsNullOrEmpty(cInvCode)) { if (i != 3) { if (SaveWithoutMsg()) { strSuccess = strSuccess + " 序号:" + cRealSequence + "成功! "; } else { strFail = strFail + " 序号:" + cRealSequence + "失败,并跳过; "; } ResetNull(); } txtcInvCode.Text = cells[i, 1].StringValue; bSkip = false; cRealSequence = cSequence; } if (i == cells.MaxDataRow + 1) { if (SaveWithoutMsg()) { strSuccess = strSuccess + " 序号:" + cRealSequence + "成功! "; } else { strFail = strFail + " 序号:" + cRealSequence + "失败,并跳过; "; } ResetNull(); break; } if (string.IsNullOrEmpty(cells[i, 0].StringValue) && !string.IsNullOrEmpty(cells[i, 1].StringValue)) { var cItemCode = cells[i, 1].StringValue; var cQuantity = cells[i, 5].StringValue; decimal iQuantity; if (!decimal.TryParse(cQuantity, out iQuantity)) { //数值转换失败跳过 bSkip = true; continue; } if (string.IsNullOrEmpty(txtcInvCode.Text) || string.IsNullOrEmpty(utecInvName.Text)) { //成品编码问题跳过 bSkip = true; continue; } using (var brm = new SelectKisInventory(_dtRawMaterial, cItemCode, true)) { if (brm.ShowDialog() == DialogResult.Yes) { if (dataInventory.BomDetail.Rows.Cast <DataRow>().Any(iRow => iRow.RowState != DataRowState.Deleted && iRow["cInvCode"].ToString().Equals(brm.InvCode))) { continue; } if (brm.InvCode.Equals(txtcInvCode.Text)) { continue; } var dr = dataInventory.BomDetail.NewBomDetailRow(); dr.BomID = -1; dr.cFitemID = brm.FitemId; dr.cInvCode = brm.InvCode; dr.cInvName = brm.InvName; dr.cInvStd = brm.InvStd; dr.cFullName = brm.FullName; dr.iQuantity = iQuantity; dr.cUnitID = brm.FUnitID; dr.cUnitName = brm.FUnitName; dr.dAddTime = DateTime.Now; dataInventory.BomDetail.Rows.Add(dr); } } } } MessageBox.Show(@"成功 " + strSuccess + @" " + @"失败 " + strFail); MessageBox.Show(@"失败 " + strFail); SetPanelVlaue("", "btnLast"); }
private void utecInvName_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { using (var brm = new SelectKisInventory(_dtRawMaterial,txtcInvCode.Text,false)) { if (brm.ShowDialog() == DialogResult.Yes) { _FitemId = brm.FitemId; txtcInvCode.Text = brm.InvCode; utecInvName.Text = brm.InvName; txtcInvStd.Text = brm.InvStd; txtcFullName.Text = brm.FullName; _FitemId = brm.FitemId; _DefaultLoc = brm.DefaultLoc; _DefaultSP = brm.DefalutSP; SetLotNoSourceAndRecentVendor(); } } }