private void InputScanData() { int _Total = 0; switch (dataGridEmp.Rows[0].Cells[2].Value.ToString()) { case "E": dataGridEsn.Rows.Add(InputStr, InputData.Rows.Count.ToString()); listBoxEsn.Items.Add(InputStr); for (int j = 1; j < dataGridEsn.Rows.Count; j++) { _Total += Convert.ToInt32(dataGridEsn.Rows[j].Cells[1].Value.ToString()); dataGridEsn.Rows[0].Cells[1].Value = _Total.ToString(); } break; case "T": dataGridTray.Rows.Add(InputStr, InputData.Rows.Count.ToString()); listBoxTray.Items.Add(InputStr); for (int j = 1; j < dataGridEsn.Rows.Count; j++) { _Total += Convert.ToInt32(dataGridTray.Rows[j].Cells[1].Value.ToString()); dataGridTray.Rows[0].Cells[1].Value = _Total.ToString(); } break; case "C": dataGridCarton.Rows.Add(InputStr, InputData.Rows.Count.ToString()); listBoxCarton.Items.Add(InputStr); for (int j = 1; j < dataGridEsn.Rows.Count; j++) { _Total += Convert.ToInt32(dataGridCarton.Rows[j].Cells[1].Value.ToString()); dataGridCarton.Rows[0].Cells[1].Value = _Total.ToString(); } break; case "P": dataGridPallet.Rows.Add(InputStr, InputData.Rows.Count.ToString()); listBoxPallet.Items.Add(InputStr); for (int j = 1; j < dataGridPallet.Rows.Count; j++) { _Total += Convert.ToInt32(dataGridPallet.Rows[j].Cells[1].Value.ToString()); dataGridPallet.Rows[0].Cells[1].Value = _Total.ToString(); } break; } cdbAccess cda = new cdbAccess(); cda.ExecuteOleDbCommand(string.Format("insert into T_CHECK_SAP (WOID,PARTNUMBER,DATA_NO,DATA_QTY) VALUES ('{0}','{1}','{2}','{3}')", InputData.Rows[0]["WOID"].ToString(), InputData.Rows[0]["PARTNUMBER"].ToString(), InputStr, InputData.Rows.Count)); }
private void ClearData() { dataGridEsn.Rows.Clear(); dataGridEsn.Rows.Add("Toatal", "0"); dataGridTray.Rows.Clear(); dataGridTray.Rows.Add("Toatal", "0"); dataGridCarton.Rows.Clear(); dataGridCarton.Rows.Add("Toatal", "0"); dataGridPallet.Rows.Clear(); dataGridPallet.Rows.Add("Toatal", "0"); listBoxEsn.Items.Clear(); listBoxTray.Items.Clear(); listBoxCarton.Items.Clear(); listBoxPallet.Items.Clear(); cdbAccess cda = new cdbAccess(); cda.ExecuteOleDbCommand("delete from T_CHECK_SAP"); }
private void Frm_StockingIn_Load(object sender, EventArgs e) { if (!Directory.Exists("C:\\SFIS")) { Directory.CreateDirectory("C:\\SFIS"); } FileVersionInfo myFileVersion = FileVersionInfo.GetVersionInfo(System.Windows.Forms.Application.ExecutablePath); this.Text = string.Format("{0} Version:{1} (Build Date:{2})", "Stockin_In", myFileVersion.FileVersion, System.IO.File.GetLastWriteTime(System.Windows.Forms.Application.ExecutablePath).ToShortDateString()); string _StrErr = string.Empty; if (!OperateDB.Check_Version("STOCKIN", System.Windows.Forms.Application.ProductVersion, null, null, null, out _StrErr)) { if (_StrErr == "OK") { RunFile(System.Windows.Forms.Application.StartupPath + @"\", "AutoUpdate.exe", appfilename); MessageBox.Show("该程序为版本不是最新版\r\n请更新后运行"); string FileName = System.IO.Path.GetFileName(System.Windows.Forms.Application.ExecutablePath); Process[] prc = Process.GetProcessesByName(FileName.Substring(0, FileName.LastIndexOf('.'))); if (prc.Length > 0) { foreach (Process pc in prc) { pc.Kill(); } } return; } else { MessageBox.Show("检查版本失败:" + _StrErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } } Line_Name = IniReadValue("STOCKIN", "LINE", IniFilePath); MYGROUP = IniReadValue("STOCKIN", "MYGROUP", IniFilePath); SetStation(); dataGridEsn.Columns.Add("ESN", "ESN"); dataGridEsn.Columns.Add("Toatal", "Toatal Qty"); dataGridEsn.Rows.Add("Toatal", "0"); dataGridTray.Columns.Add("Tray", "Tray"); dataGridTray.Columns.Add("Toatal", "Toatal Qty"); dataGridTray.Rows.Add("Toatal", "0"); dataGridCarton.Columns.Add("CARTON", "CARTON"); dataGridCarton.Columns.Add("Toatal", "Toatal Qty"); dataGridCarton.Rows.Add("Toatal", "0"); dataGridPallet.Columns.Add("Pallet", "PALLET"); dataGridPallet.Columns.Add("Toatal", "Toatal Qty"); dataGridPallet.Rows.Add("Toatal", "0"); SetdataGridWidth(); dataGridEmp.Rows.Add("", "", "0"); SetStation(); if (!Directory.Exists(Application.StartupPath + @"\Database")) { Directory.CreateDirectory(Application.StartupPath + @"\Database"); } if (File.Exists(Application.StartupPath + @"\Database\dbtemp.mdb")) { File.Delete(Application.StartupPath + @"\Database\dbtemp.mdb"); } CreateAccessDb CDB = new CreateAccessDb(); CDB._CreateMDB(); CDB._Create_T_CHECK_SAP(); cdbAccess cda = new cdbAccess(); cda.ExecuteOleDbCommand("delete from T_CHECK_SAP"); txt_InputStr.Focus(); }