private void btn_shipmentsearch_Click(object sender, EventArgs e) { dtgrw_ShipmentInfo.DataSource = null; object[][] param = new object[1][]; //DataTable dt = new DataTable(); string sql = @"select SHIPMENT_ID,CARRIER_NAME,POE,HAWB,SHIPMENT_TYPE,REGION,QTY from t_shipment_info where shipment_id=:shipment_id"; if (string.IsNullOrEmpty(cmbShipment.Text.Trim())) { MessageBox.Show("Nhập vào shipment ID để tìm kiếm"); } else { param[0] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "shipment_id", cmbShipment.Text.Trim() }; //param[1] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "dateto", dateto }; DataTable dt = ClientUtils.ExecuteSQL(sql, param).Tables[0]; if (dt.Rows.Count > 0) { dtgrw_ShipmentInfo.DataSource = dt; //cmbShipment.Text = dt.Rows[0]["SHIPMENT_ID"].ToString(); //for (int i = 1; i < dt.Rows.Count; i++) //{ // //DataGridViewRow dr = new DataGridViewRow(); // cmbShipment.Items.Add(dt.Rows[i]["SHIPMENT_ID"].ToString()); //} } else { MessageBox.Show("No shipment Found"); } } }
public static string GetID(string sTable, string sFieldID, string sFieldName, string sValue, string sEnabled) { //т逆ID if (string.IsNullOrEmpty(sValue)) { return("0"); } string sSQL = "select " + sFieldID + " from " + sTable + " " + "where " + sFieldName + " = '" + sValue + "' "; if (!string.IsNullOrEmpty(sEnabled)) { sSQL = sSQL + " and ENABLED = '" + sEnabled + "' "; } sSQL = sSQL + " and Rownum = 1 "; DataSet dsTemp = ClientUtils.ExecuteSQL(sSQL); if (dsTemp.Tables[0].Rows.Count > 0) { return(dsTemp.Tables[0].Rows[0][sFieldID].ToString()); } else { return("0"); } }
public String GetProcessName(String sProcessID) { DataSet dsTemp1 = new DataSet(); try { sSQL = "SELECT PROCESS_NAME " + " FROM SAJET.SYS_PROCESS " + " WHERE PROCESS_ID =:PROCESS_ID " + " AND ROWNUM = 1 "; object[][] sqlparams = new object[][] { new object[] { ParameterDirection.Input, OracleType.VarChar, "PROCESS_ID", sProcessID } }; dsTemp1 = ClientUtils.ExecuteSQL(sSQL, sqlparams); if (dsTemp1.Tables[0].Rows.Count > 0) { return(dsTemp1.Tables[0].Rows[0]["PROCESS_NAME"].ToString()); } else { return("0"); } } catch (Exception ex) { MessageBox.Show(ex.Message); return("0"); } }
private void button1_Click(object sender, EventArgs e) { string sSQL = string.Empty; StringBuilder sb = new StringBuilder(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { sSQL = string.Format(@"Insert into SAJET.G_QC_CHECK_RETURN VALUES('" + textBox1.Text.Trim() + "'," + "'" + dataGridView1.Rows[i].Cells["SN_NO"].Value.ToString() + "'," + "'Y'," + "'" + ClientUtils.UserPara1 + "',SYSDATE," + "'" + richTextBox1.Text.Trim() + "');"); sb.AppendLine(sSQL); } try { sSQL = string.Format(@"begin {0} end;", sb.ToString()); ClientUtils.ExecuteSQL(sSQL); } catch (Exception ex) { SajetCommon.Show_Message(ex.Message, 0); return; } dataGridView1.Rows.Clear(); tSN.Focus(); tSN.SelectAll(); RandomNum(); }
private void RandomNum() { string dateCode = "RE" + DateTime.Now.Year.ToString().Substring(2) + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0'); DataSet data = ClientUtils.ExecuteSQL("select sajet.SEQ_RETURN_QC_LOT.nextval from dual"); dateCode = dateCode + data.Tables[0].Rows[0][0].ToString().PadLeft(4, '0'); textBox1.Text = dateCode; }
public void ExecuteSQL(string strSQL, List <System.Data.Common.DbParameter> parms) { object[][] oParms = new object[parms.Count][]; for (int i = 0; i < parms.Count; i++) { oParms[i] = new object[] { parms[i].Direction, parms[i].DbType, parms[i].ParameterName, parms[i].Value }; } ClientUtils.ExecuteSQL(strSQL, oParms); }
public DataTable GetDataTable(string strSQL) { DataSet ds = ClientUtils.ExecuteSQL(strSQL); if (ds.Tables.Count == 0) { return(new DataTable()); } return(ds.Tables[0]); }
private void fMain_Load(object sender, EventArgs e) { panel1.BackgroundImage = ClientUtils.LoadImage("ImgMain.jpg"); panel1.BackgroundImageLayout = ImageLayout.Stretch; panel3.BackgroundImage = ClientUtils.LoadImage("ImgFilter.jpg"); panel3.BackgroundImageLayout = ImageLayout.Stretch; panel2.BackgroundImage = ClientUtils.LoadImage("ImgButton.jpg"); panel2.BackgroundImageLayout = ImageLayout.Stretch; g_sUserID = ClientUtils.UserPara1; g_sExeName = ClientUtils.fCurrentProject; g_sFunction = ClientUtils.fFunctionName; g_sProgram = ClientUtils.fProgramName; //== this.Text = this.Text + " (" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion.ToString() + ")"; SajetCommon.SetLanguageControl(this); check_privilege(); //Read Ini File SajetInifile sajetInifile1 = new SajetInifile(); g_sIniFactoryID = sajetInifile1.ReadIniFile(g_sIniFile, "System", "Factory", "0"); g_sTerminalID = sajetInifile1.ReadIniFile(g_sIniFile, g_sProgram, "Terminal", "0"); //Factory sSQL = "Select FACTORY_ID,FACTORY_CODE,FACTORY_NAME " + "From SAJET.SYS_FACTORY " + "Where ENABLED = 'Y' " + "Order By Factory_COde "; dsTemp = ClientUtils.ExecuteSQL(sSQL); string sFind = ""; for (int i = 0; i <= dsTemp.Tables[0].Rows.Count - 1; i++) { combFactory.Items.Add(dsTemp.Tables[0].Rows[i]["FACTORY_CODE"].ToString()); if (g_sIniFactoryID == dsTemp.Tables[0].Rows[i]["FACTORY_ID"].ToString()) { sFind = dsTemp.Tables[0].Rows[i]["FACTORY_CODE"].ToString(); } } if (sFind != "") { combFactory.SelectedIndex = combFactory.FindString(sFind); } else { combFactory.SelectedIndex = 0; } }
private void btn_CheckSN_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cmbStatus.Text.Trim())) { MessageBox.Show("Pls select Shipment Status first"); } else if (string.IsNullOrEmpty(txtShipment.Text.Trim())) { MessageBox.Show("Pls Input Shipment ID"); } else { if (cmbStatus.Text.Trim() == "ALL") { check_all(txtShipment.Text.Trim()); } else { grdvw_SN_data.DataSource = null; DAO inx = new DAO(); string strinsert = inx.insertData(txtShipment.Text.Trim(), cmbStatus.Text.Trim(), ""); //MessageBox.Show("execution OK..."); //grdvw_SN_data.Rows.Clear(); string sql = @"select carton_no, shipment, part_no, pick_pallet_no, sscc, pack_pallet_no, TRACKING_NO, BABYTRACKING_NO, location_no, delivery_no, pallet_no, COO, wc from PPS_OPERATE_DATA_TOTAL where shipment=:shipment and wc=:wc order by pallet_no"; object[][] param1 = new object[2][]; param1[0] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "shipment", txtShipment.Text.Trim() }; param1[1] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "wc", cmbStatus.Text.Trim() }; DataTable dt2 = ClientUtils.ExecuteSQL(sql, param1).Tables[0]; if (dt2.Rows.Count > 0) { grdvw_SN_data.DataSource = dt2; } else { MessageBox.Show("No data found"); } } } }
public DataTable GetDataTable(string strSQL, List <System.Data.Common.DbParameter> parms) { object[][] oParms = new object[parms.Count][]; for (int i = 0; i < parms.Count; i++) { oParms[i] = new object[] { parms[i].Direction, parms[i].DbType, parms[i].ParameterName, parms[i].Value }; } DataSet ds = ClientUtils.ExecuteSQL(strSQL, oParms); if (ds.Tables.Count == 0) { return(new DataTable()); } return(ds.Tables[0]); }
public static bool CheckEnabled(string sType, string sPrivilege) { try { string sSQL = " SELECT SAJET.SJ_PRIVILEGE_DEFINE('" + sType + "','" + sPrivilege + "') TENABLED from DUAL "; DataSet dsTemp = ClientUtils.ExecuteSQL(sSQL); string sRes = dsTemp.Tables[0].Rows[0]["TENABLED"].ToString(); return(sRes == "Y"); } catch (Exception ex) { SajetCommon.Show_Message("Function:SAJET.SJ_PRIVILEGE_DEFINE" + Environment.NewLine + ex.Message, 0); return(false); } }
private void cmbShipment_SelectedValueChanged(object sender, EventArgs e) { dtgrw_ShipmentInfo.DataSource = null; dtgrw_ShipmentInfo.Rows.Clear(); string strShipment = null; string strSql = @"select SHIPMENT_ID,CARRIER_NAME,POE,HAWB,SHIPMENT_TYPE,REGION,QTY from t_shipment_info where shipment_id=:shipment_id"; object[][] strpara = new object[1][]; if (!string.IsNullOrEmpty(cmbShipment.Text.Trim())) { strShipment = cmbShipment.Text.Trim(); strpara[0] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "shipment_id", strShipment }; DataTable dt = ClientUtils.ExecuteSQL(strSql, strpara).Tables[0]; dtgrw_ShipmentInfo.DataSource = dt; //DataGridViewRow dr = new DataGridViewRow(); //foreach (DataGridViewColumn c in dtgrd_CartonInfo.Columns) //{ // dr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); //} ////累加序号 ////dr.HeaderCell.Value = (i + 1).ToString(); //dr.Cells[0].Value = dt.Rows[0]["SHIPMENT_ID"].ToString(); //dr.Cells[1].Value = dt.Rows[0]["CARRIER_NAME"].ToString(); //dr.Cells[2].Value = dt.Rows[0]["POE"].ToString(); //dr.Cells[3].Value = dt.Rows[0]["HAWB"].ToString(); //dr.Cells[4].Value = dt.Rows[0]["SHIPMENT_TYPE"].ToString(); ////dr.Cells[5].Value = Convert.ToDateTime(db.Rows[i]["CDT"]).ToString("yyyy/MM/dd"); //dr.Cells[5].Value = dt.Rows[0]["REGION"].ToString(); //dr.Cells[6].Value = dt.Rows[0]["QTY"].ToString(); ////dr.Cells[7].Value = dt.Rows[0]["CARTON_QTY"].ToString(); //try //{ // dtgrw_ShipmentInfo.Invoke((MethodInvoker)delegate () // { // dtgrw_ShipmentInfo.Rows.Add(dr); // }); //} //catch (Exception e1) //{ // MessageBox.Show(e1.Message); // return; //} } }
public void check_all(string p_shipment_id) { grdvw_SN_data.DataSource = null; string sqlCheckall = @"SELECT DISTINCT a.carton_no, b.shipment_id, a.part_no, a.pick_pallet_no, a.sscc, a.pack_pallet_no, A.TRACKING_NO, A.BABYTRACKING_NO, a.location_no, b.delivery_no, d.pallet_no, D.COO, a.wc --a.customer_no FROM t_sn_status a INNER JOIN t_order_info b ON a.part_no = b.ictpn --inner join t_trolley_sn_status c --on b.delivery_no=c.delivery_no INNER JOIN t_pallet_order d ON b.shipment_id = d.shipment_id AND b.ictpn = d.ictpn AND a.coo = d.coo and b.mpn=d.mpn AND b.delivery_no = d.delivery_no and b.line_item=d.line_item --and A.PALLET_NO = D.PALLET_NO INNER JOIN t_shipment_pallet e ON d.pallet_no = e.pallet_no AND d.shipment_id = e.shipment_id WHERE b.shipment_id = :shipment_id ORDER BY a.wc"; object[][] param1 = new object[1][]; param1[0] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "shipment_id", p_shipment_id }; //param[1] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "dateto", dateto }; DataSet ds1 = ClientUtils.ExecuteSQL(sqlCheckall, param1); if (ds1.Tables[0].Rows.Count < 1) { MessageBox.Show("No data found!"); } else { grdvw_SN_data.DataSource = ds1.Tables[0]; } }
public string GetValue(string strSQL) { DataSet ds = ClientUtils.ExecuteSQL(strSQL); if (ds.Tables.Count == 0) { return(string.Empty); } if (ds.Tables[0].Rows.Count == 0) { return(string.Empty); } if (ds.Tables[0].Columns.Count == 0) { return(string.Empty); } return(ds.Tables[0].Rows[0][0].ToString()); }
public string Get_TerminalID() { sSQL = "Select a.Terminal_ID " + "from sajet.sys_terminal a " + " ,sajet.sys_process b " + " ,sajet.sys_pdline c " + "where a.terminal_name = '" + LabTerminal.Text + "' " + "and b.process_name = '" + LabProcess.Text + "' " + "and c.pdline_name = '" + LabLine.Text + "' " + "and a.process_id = b.process_id " + "and a.pdline_id = c.pdline_id "; dsTemp = ClientUtils.ExecuteSQL(sSQL); if (dsTemp.Tables[0].Rows.Count == 0) { MessageBox.Show("Terminal Data Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return("0"); } return(dsTemp.Tables[0].Rows[0]["TERMINAL_ID"].ToString()); }
/// <summary> /// 对输入大板号管控工单跨线别操作 /// </summary> /// <param name="sn"></param> /// <param name="userId"></param> /// <param name="terminalId"></param> /// <returns></returns> public static bool CheckWorkLineByPanel(string panelNo, string userId, string terminalId) { string str = " SELECT PDLINE_ID FROM SAJET.SYS_TERMINAL WHERE TERMINAL_ID = '" + terminalId + "'"; DataSet dsTemp = ClientUtils.ExecuteSQL(str); string pdline = dsTemp.Tables[0].Rows[0][0].ToString(); str = "SELECT DEFAULT_PDLINE_ID FROM SAJET.G_WO_BASE B,SAJET.G_SN_STATUS S WHERE B.WORK_ORDER=S.WORK_ORDER AND S.PANEL_NO='" + panelNo + "' "; dsTemp = ClientUtils.ExecuteSQL(str); //当前操作的sn不在工单所属的线别,并且没有跨线别操作的权限,则管控不允许操作 if (dsTemp.Tables[0] != null && dsTemp.Tables[0].Rows.Count > 0 && dsTemp.Tables[0].Rows[0][0].ToString() != pdline) { int g_iPrivilege = ClientUtils.GetPrivilege(userId, "Work Order By Line", "Data Center"); if (g_iPrivilege <= 0) //只有只读的操作权限 { Show_Message("没有跨线别操作的权限!", 0); return(false); } } return(true); }
public static string GetSysBaseData(string sProgram, string sParamName, ref string sErrorMsg) { //弄SYS_BASE砞﹚ string sSQL = ""; sSQL = " SELECT PARAM_VALUE " + " FROM SAJET.SYS_BASE " + " WHERE Upper(PROGRAM) = '" + sProgram.ToUpper() + "' " + " and Upper(PARAM_NAME) = '" + sParamName.ToUpper() + "' "; DataSet dsTemp = ClientUtils.ExecuteSQL(sSQL); if (dsTemp.Tables[0].Rows.Count > 0) { return(dsTemp.Tables[0].Rows[0]["PARAM_VALUE"].ToString()); } else { sErrorMsg = sErrorMsg + sParamName + Environment.NewLine; return(""); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { string sql = @"select * from PPSUSER.T_BASICLANGUAGE_INFO a where a.PRONAME = 'Weight' order by langcode asc"; //DataTable dt = new DataTable(); object[][] sqlparams = new object[0][]; DataSet dbs = ClientUtils.ExecuteSQL(sql, sqlparams); DataTable dt2 = dbs.Tables[0]; if (dt2.Rows.Count > 0) { tt = dtgrd_CartonInfo.CurrentCell.RowIndex.ToString(); rowtt = int.Parse(tt); //textBox1.Text = dt2.Rows[rowtt]["LANGCODE"].ToString(); } //else //{ // ShowDialog("no information on datagridview"); //} //dt2.Rows[rowtt]["LANGCODE"].ToString(); }
private void combFactory_SelectedIndexChanged(object sender, EventArgs e) { LabLine.Text = ""; LabStage.Text = ""; LabProcess.Text = ""; LabTerminal.Text = ""; g_sFCID = "0"; LabFactoryName.Text = ""; sSQL = "Select FACTORY_ID,FACTORY_NAME " + "From SAJET.SYS_FACTORY " + "Where FACTORY_CODE = '" + combFactory.Text + "' "; dsTemp = ClientUtils.ExecuteSQL(sSQL); if (dsTemp.Tables[0].Rows.Count > 0) { g_sFCID = dsTemp.Tables[0].Rows[0]["FACTORY_ID"].ToString(); LabFactoryName.Text = dsTemp.Tables[0].Rows[0]["FACTORY_NAME"].ToString(); } // Show_Terminal("Assembly"); Show_Terminal("Repair"); }
private void fMain_Load(object sender, EventArgs e) { SajetCommon.SetLanguageControl(this); this.Text = this.Text + "( " + SajetCommon.g_sFileVersion + " )"; tabControl1.SelectedIndex = 0; //Read Ini File SajetInifile sajetInifile1 = new SajetInifile(); g_sIniFactoryID = sajetInifile1.ReadIniFile(g_sIniFile, "System", "Factory", "0"); g_sTerminalID = sajetInifile1.ReadIniFile(g_sIniFile, g_sIniSection, "Terminal", "0"); //Factory sSQL = "SELECT FACTORY_ID,FACTORY_CODE,FACTORY_NAME " + "FROM SAJET.SYS_FACTORY " + "WHERE ENABLED = 'Y' " + "ORDER BY FACTORY_CODE "; dsTemp = ClientUtils.ExecuteSQL(sSQL); string sFind = ""; for (int i = 0; i <= dsTemp.Tables[0].Rows.Count - 1; i++) { combFactory.Items.Add(dsTemp.Tables[0].Rows[i]["FACTORY_CODE"].ToString()); if (g_sIniFactoryID == dsTemp.Tables[0].Rows[i]["FACTORY_ID"].ToString()) { sFind = dsTemp.Tables[0].Rows[i]["FACTORY_CODE"].ToString(); } } if (sFind != "") { combFactory.SelectedIndex = combFactory.FindString(sFind); } else { combFactory.SelectedIndex = 0; } }
public string Get_TerminalID() { sSQL = "SELECT A.TERMINAL_ID " + "FROM SAJET.SYS_TERMINAL A " + " ,SAJET.SYS_PROCESS B " + " ,SAJET.SYS_PDLINE C " + "WHERE A.TERMINAL_NAME =:TERMINAL_NAME " + "AND B.PROCESS_NAME =:PROCESS_NAME " + "AND C.PDLINE_NAME =: PDLINE_NAME " + "AND A.PROCESS_ID = B.PROCESS_ID " + "AND A.PDLINE_ID = C.PDLINE_ID "; object[][] sqlparams = new object[3][]; sqlparams[0] = new object[] { ParameterDirection.Input, OracleType.VarChar, "TERMINAL_NAME", LabTerminal.Text }; sqlparams[1] = new object[] { ParameterDirection.Input, OracleType.VarChar, "PROCESS_NAME", LabProcess.Text }; sqlparams[2] = new object[] { ParameterDirection.Input, OracleType.VarChar, "PDLINE_NAME", LabLine.Text }; dsTemp = ClientUtils.ExecuteSQL(sSQL, sqlparams); if (dsTemp.Tables[0].Rows.Count == 0) { MessageBox.Show("Terminal Data Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return("0"); } return(dsTemp.Tables[0].Rows[0]["TERMINAL_ID"].ToString()); }
public string GetValue(string strSQL, List <DbParameter> parms) { object[][] oParms = new object[parms.Count][]; for (int i = 0; i < parms.Count; i++) { oParms[i] = new object[] { parms[i].Direction, parms[i].DbType, parms[i].ParameterName, parms[i].Value }; } DataSet ds = ClientUtils.ExecuteSQL(strSQL, oParms); if (ds.Tables.Count == 0) { return("Could not find table"); } if (ds.Tables[0].Rows.Count == 0) { return("Could not find data row"); } if (ds.Tables[0].Columns.Count == 0) { return("Could not find data column"); } return(ds.Tables[0].Rows[0][0].ToString()); }
private void combFactory_SelectedIndexChanged(object sender, EventArgs e) { LabLine.Text = ""; LabStage.Text = ""; LabProcess.Text = ""; LabTerminal.Text = ""; g_sFCID = "0"; LabFactoryName.Text = ""; sSQL = "SELECT FACTORY_ID,FACTORY_NAME " + "FROM SAJET.SYS_FACTORY " + "WHERE FACTORY_CODE =:FACTORY_CODE "; object[][] sqlparams = new object[][] { new object[] { ParameterDirection.Input, OracleType.VarChar, "FACTORY_CODE", combFactory.Text } }; dsTemp = ClientUtils.ExecuteSQL(sSQL, sqlparams); if (dsTemp.Tables[0].Rows.Count > 0) { g_sFCID = dsTemp.Tables[0].Rows[0]["FACTORY_ID"].ToString(); LabFactoryName.Text = dsTemp.Tables[0].Rows[0]["FACTORY_NAME"].ToString(); } //Show_Terminal("INPUT"); Show_Terminal(ClientUtils.fParameter); }
private void btn_CheckCarton_Click(object sender, EventArgs e) { //grdvw_SN_data.Rows.Clear(); string strsql = @" SELECT DISTINCT a.carton_no, a.part_no, b.delivery_no, b.shipment_id, d.pallet_no, D.LINE_ITEM, D.ASSIGN_QTY, D.ASSIGN_CARTON, D.COO, a.pick_pallet_no, a.sscc, a.pack_pallet_no, a.wc FROM t_sn_status a INNER JOIN t_order_info b ON a.part_no = b.ictpn and a.delivery_no=b.delivery_no --inner join t_trolley_sn_status c --on b.delivery_no=c.delivery_no INNER JOIN t_pallet_order d ON b.shipment_id = d.shipment_id and b.ictpn=d.ictpn INNER JOIN t_shipment_pallet e ON d.pallet_no = e.pallet_no AND A.coo = d.coo WHERE a.carton_no=:carton_no ORDER BY a.carton_no"; object[][] prama = new object[1][]; if (rtxbx_CartonNo.Lines.Count() > 0) { var lines = rtxbx_CartonNo.Text.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); foreach (var line in lines) { prama[0] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "carton_no", line }; DataTable dt = ClientUtils.ExecuteSQL(strsql, prama).Tables[0]; //grdvw_SN_data.DataSource = dt; if (dt.Rows.Count > 0) { DataGridViewRow dr = new DataGridViewRow(); foreach (DataGridViewColumn c in dtgrd_CartonInfo.Columns) { dr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dr.Cells[0].Value = dt.Rows[0]["CARTON_NO"].ToString(); dr.Cells[1].Value = dt.Rows[0]["part_no"].ToString(); dr.Cells[2].Value = dt.Rows[0]["delivery_no"].ToString(); dr.Cells[3].Value = dt.Rows[0]["shipment_id"].ToString(); dr.Cells[4].Value = dt.Rows[0]["pallet_no"].ToString(); dr.Cells[5].Value = dt.Rows[0]["LINE_ITEM"].ToString(); dr.Cells[6].Value = dt.Rows[0]["ASSIGN_QTY"].ToString(); dr.Cells[7].Value = dt.Rows[0]["ASSIGN_CARTON"].ToString(); dr.Cells[8].Value = dt.Rows[0]["COO"].ToString(); dr.Cells[9].Value = dt.Rows[0]["pick_pallet_no"].ToString(); dr.Cells[10].Value = dt.Rows[0]["sscc"].ToString(); dr.Cells[11].Value = dt.Rows[0]["pack_pallet_no"].ToString(); dr.Cells[12].Value = dt.Rows[0]["wc"].ToString(); //dr.Cells[13].Value = dt.Rows[0]["OEM"].ToString(); try { dtgrd_CartonInfo.Invoke((MethodInvoker) delegate() { dtgrd_CartonInfo.Rows.Add(dr); }); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } } } else { MessageBox.Show("Pls input the carton no in the blank first"); } }
private void btnSearch_Click(object sender, EventArgs e) { dtgrw_ShipmentInfo.DataSource = null; datefrom = dtpStart.Value.ToString("yyyy/MM/dd") + " 00:00:00"; dateto = dtpEnd.Value.ToString("yyyy/MM/dd") + " 23:59:59"; object[][] param = new object[2][]; //DataTable dt = new DataTable(); string sql = @"select SHIPMENT_ID,CARRIER_NAME,POE,HAWB,SHIPMENT_TYPE,REGION,QTY from t_shipment_info where cdt between to_date(:datefrom,'YYYY/MM/DD HH24:MI:SS') and to_date(:dateto,'YYYY/MM/DD HH24:MI:SS')"; if (dtpEnd.Value.Date < dtpStart.Value.Date) { MessageBox.Show("The start time cannot greater than the end time, pls fix again"); } else { param[0] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "datefrom", datefrom }; param[1] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "dateto", dateto }; DataTable dt = ClientUtils.ExecuteSQL(sql, param).Tables[0]; if (dt.Rows.Count > 0) { dtgrw_ShipmentInfo.DataSource = dt; cmbShipment.Text = dt.Rows[0]["SHIPMENT_ID"].ToString(); for (int i = 1; i < dt.Rows.Count; i++) { //DataGridViewRow dr = new DataGridViewRow(); cmbShipment.Items.Add(dt.Rows[i]["SHIPMENT_ID"].ToString()); } } else { MessageBox.Show("No shipment Found"); } } //DataTable dt = dts.Tables[0]; //if (dt.Rows.Count > 0) //{ // for(int i=0;i<dt.Rows.Count;i++) // { // cmbShipment.Text = dt.Rows[0]["shipment_id"].ToString(); // DataGridViewRow dr = new DataGridViewRow(); // foreach (DataGridViewColumn c in dtgrd_CartonInfo.Columns) // { // dr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); // } // //累加序号 // //dr.HeaderCell.Value = (i + 1).ToString(); // dr.Cells[0].Value = dt.Rows[i]["SHIPMENT_ID"].ToString(); // dr.Cells[1].Value = dt.Rows[i]["CARRIER_NAME"].ToString(); // dr.Cells[2].Value = dt.Rows[i]["POE"].ToString(); // dr.Cells[3].Value = dt.Rows[i]["HAWB"].ToString(); // dr.Cells[4].Value = dt.Rows[i]["SHIPMENT_TYPE"].ToString(); // //dr.Cells[5].Value = Convert.ToDateTime(db.Rows[i]["CDT"]).ToString("yyyy/MM/dd"); // dr.Cells[5].Value = dt.Rows[i]["REGION"].ToString(); // dr.Cells[6].Value = dt.Rows[i]["QTY"].ToString(); // //dr.Cells[7].Value = dt.Rows[0]["CARTON_QTY"].ToString(); // //cmbShipment.Items.Add(dt.Rows[i]["shipment_id"].ToString()); // try // { // dtgrw_ShipmentInfo.Invoke((MethodInvoker)delegate () // { // dtgrw_ShipmentInfo.Rows.Add(dr); // }); // } // catch (Exception e1) // { // MessageBox.Show(e1.Message); // return; // } // } //} }
public void Show_Terminal(string sProcessType) { TVTerminal.Nodes.Clear(); sSQL = "SELECT b.pdline_name, c.stage_code, c.stage_name, d.process_code, d.process_name " + " ,a.terminal_id, a.terminal_name " + " FROM sajet.sys_terminal a " + " ,sajet.sys_pdline b " + " ,sajet.sys_stage c " + " ,sajet.sys_process d " + " ,sajet.sys_operate_type e " + " WHERE b.factory_id = '" + g_sFCID + "' " + " AND a.pdline_id = b.pdline_id " + " AND a.stage_id = c.stage_id " + " AND a.process_id = d.process_id " + " AND d.operate_id = e.operate_id " //+ " AND Upper(e.type_name) = '" + sProcessType.ToUpper() + "' " + " AND a.PROCESS_id in ('1000229') " + " AND a.enabled = 'Y' " + " AND b.enabled = 'Y' " + " AND c.enabled = 'Y' " + " AND d.enabled = 'Y' " + " ORDER BY b.pdline_name, c.stage_code, d.process_code, a.terminal_name "; dsTemp = ClientUtils.ExecuteSQL(sSQL); if (dsTemp.Tables[0].Rows.Count == 0) { return; } string sPreLine = ""; string sPreStage = ""; string sPreProcess = ""; for (int i = 0; i <= dsTemp.Tables[0].Rows.Count - 1; i++) { string sLine = dsTemp.Tables[0].Rows[i]["PDLINE_NAME"].ToString(); string sStage = dsTemp.Tables[0].Rows[i]["STAGE_NAME"].ToString(); string sProcess = dsTemp.Tables[0].Rows[i]["PROCESS_NAME"].ToString(); string sTerminal = dsTemp.Tables[0].Rows[i]["TERMINAL_NAME"].ToString(); if (sPreLine != sLine) { TVTerminal.Nodes.Add(sLine); int iNodeCount = TVTerminal.Nodes.Count - 1; TVTerminal.Nodes[iNodeCount].ImageIndex = 0; TVTerminal.Nodes[iNodeCount].Nodes.Add(sStage); TVTerminal.Nodes[iNodeCount].LastNode.ImageIndex = 1; TVTerminal.Nodes[iNodeCount].LastNode.Nodes.Add(sProcess); TVTerminal.Nodes[iNodeCount].LastNode.LastNode.ImageIndex = 2; TVTerminal.Nodes[iNodeCount].LastNode.LastNode.Nodes.Add(sTerminal); TVTerminal.Nodes[iNodeCount].LastNode.LastNode.LastNode.ImageIndex = 3; } else if (sPreStage != sStage) { int iNodeCount = TVTerminal.Nodes.Count - 1; TVTerminal.Nodes[iNodeCount].Nodes.Add(sStage); TVTerminal.Nodes[iNodeCount].LastNode.ImageIndex = 1; TVTerminal.Nodes[iNodeCount].LastNode.Nodes.Add(sProcess); TVTerminal.Nodes[iNodeCount].LastNode.LastNode.ImageIndex = 2; TVTerminal.Nodes[iNodeCount].LastNode.LastNode.Nodes.Add(sTerminal); TVTerminal.Nodes[iNodeCount].LastNode.LastNode.LastNode.ImageIndex = 3; } else if (sPreProcess != sProcess) { int iNodeCount = TVTerminal.Nodes.Count - 1; TVTerminal.Nodes[iNodeCount].LastNode.Nodes.Add(sProcess); TVTerminal.Nodes[iNodeCount].LastNode.LastNode.ImageIndex = 2; TVTerminal.Nodes[iNodeCount].LastNode.LastNode.Nodes.Add(sTerminal); TVTerminal.Nodes[iNodeCount].LastNode.LastNode.LastNode.ImageIndex = 3; } else { int iNodeCount = TVTerminal.Nodes.Count - 1; TVTerminal.Nodes[iNodeCount].LastNode.LastNode.Nodes.Add(sTerminal); TVTerminal.Nodes[iNodeCount].LastNode.LastNode.LastNode.ImageIndex = 3; } sPreLine = dsTemp.Tables[0].Rows[i]["PDLINE_NAME"].ToString(); sPreStage = dsTemp.Tables[0].Rows[i]["STAGE_NAME"].ToString(); sPreProcess = dsTemp.Tables[0].Rows[i]["PROCESS_NAME"].ToString(); //SajetIniい砞﹚Terminal if (g_sTerminalID == dsTemp.Tables[0].Rows[i]["TERMINAL_ID"].ToString()) { TVTerminal.SelectedNode = TVTerminal.Nodes[TVTerminal.Nodes.Count - 1].LastNode.LastNode.LastNode; TVTerminal.Focus(); } } }
public void ExecuteSQL(string strSQL) { ClientUtils.ExecuteSQL(strSQL); }