private void FrmShowDay_Load(object sender, EventArgs e) { string AppFile = Application.StartupPath + "\\"; StringBuilder temp = new StringBuilder(255); CommFunction.GetPrivateProfileString("显示天数设置", "天数", "", temp, 255, AppFile + "ShowDay.ini"); textBox1.Text = temp.ToString(); CommFunction.GetPrivateProfileString("默认药品温度设置", "药品温度", "", temp, 255, AppFile + "ShowDay.ini"); textBox2.Text = temp.ToString(); CommFunction.GetPrivateProfileString("打印设置", "是否打印", "", temp, 255, AppFile + "ShowDay.ini"); string print = temp.ToString(); if (print == "") { print = "FALSE"; } checkBox1.Checked = Boolean.Parse(print.ToString()); if ((textBox1.Text.Trim() == "") || (textBox1.Text == null)) { textBox1.Text = "3"; } if ((textBox2.Text.Trim() == "") || (textBox2.Text == null)) { textBox2.Text = "0"; } }
private void Add_Click(object sender, EventArgs e) { if (tbKh.Text.Trim() == "") { MessageBox.Show("请输入 客户 !"); return; } string OutValue = ""; int showx, showy; showx = Left + tbKh.Left; showy = Top + tbKh.Top + tbKh.Height; if (CommFunction.ShowGetCodeForm(this.Handle, CommFunction.ConnectString, "select MISC_INSTR_CODE_2 as 货主客户代码,客户名称 from V_VENDOR_MASTER group by MISC_INSTR_CODE_2,客户名称", "MISC_INSTR_CODE_2,客户名称", tbKh.Text, "代码", 0, showx, showy, true, false, true, true, ref OutValue) && (OutValue != "")) { string[] sArray = OutValue.Split('|'); for (int i = 0; i < lvKh.Items.Count; i++) { if (lvKh.Items[i].SubItems[0].Text.ToString() == sArray[0].ToString()) { return; } } ListViewItem lvi = new ListViewItem(sArray[0].ToString()); lvi.SubItems.Add(sArray[1].ToString()); lvKh.Items.Add(lvi); } tbKh.Focus(); tbKh.SelectAll(); }
private void tbSku_id_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue != 13) { return; } if (tbSku_id.Text.Trim() == "") { MessageBox.Show("请输入 SKU_ID !"); return; } string OutValue = ""; int showx, showy; showx = Left + (sender as TextBox).Left; showy = Top + (sender as TextBox).Top + (sender as TextBox).Height; if (CommFunction.ShowGetCodeForm(this.Handle, CommFunction.ConnectString, "select sku_id,season as 货主代码,size_desc as 商品代码,sku_desc as 品名规格, " + " spl_instr_1||spl_instr_2 as 生产厂家,std_pack_qty as 件装数 from item_master@wmrdc " + " where sku_id='" + tbSku_id.Text.Trim() + "'", "sku_id,size_desc,sku_desc", (sender as TextBox).Text, "代码", 0, showx, showy, true, false, true, false, ref OutValue) && (OutValue != "")) { string[] sArray = OutValue.Split('|'); (sender as TextBox).Text = sArray[0]; cbHz.Text = sArray[1]; tbSpdm.Text = sArray[2]; tbPmgg.Text = sArray[3]; tbSccj.Text = sArray[4]; tbJzs.Text = sArray[5]; } }
private void button12_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); string aa = null; string d1 = SJ1.Value.ToString("yyyy-MM-dd 00:00:00"); string d2 = SJ2.Value.ToString("yyyy-MM-dd 23:59:59"); aa = "select c.pkunid as 跟踪表单号,c.sku_desc as 品名规格,c.batch_nbr as 商品批号,c.orig_pkt_qty as 商品数量,t.therm_id as 温度计编号,t.BACK_TIME as 温度计返回时间,t.FILE_PATH as 温度跟踪记录文件路径,t.PACK_MEMO as 温度计包装备注,t.TEMP_MEMO as 温度计温度备注,t.IF_BAD 温度计是否损坏 " + "from cc_cold_chain_c c left join cc_cold_chain_therm t on c.unid=t.pkunid " + "where c.pkunid like '%" + gzbdhrg.Text + "%' and c.create_date_time between (to_date('" + d1 + "','yyyy-mm-dd hh24:mi:ss')) " + "and (to_date('" + d2 + "','yyyy-mm-dd hh24:mi:ss')) order by c.size_desc "; OleDbDataAdapter adapater = new OleDbDataAdapter(aa, cn); DataTable table = new DataTable(); adapater.Fill(table); if (table.Rows.Count == 0) { MessageBox.Show("查询不到记录"); return; } CommFunction.LYData2Excel(this.Handle, CommFunction.ConnectString, aa, ""); }
private void toolStripButton1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } ResultSelect = ""; string sql = "select type as 类型,ysid as 代码,ysfs as 名称,pym as 拼音码,memo as 备注,reserve1 as 保留字段1,reserve2 as 保留字段2,reserve3 as 保留字段3," + "reserve4 as 保留字段4,reserve5 as 保留字段5,reserve6 as 保留字段6,reserve7 as 保留字段7,reserve8 as 保留字段8," + "reserve9 as 保留字段9,reserve10 as 保留字段10,create_date_time as 创建时间,user_name as 操作员,flag as 是否停用 " + "from ysfs order by type,ysid "; if (CommFunction.ShowQueryForm(this.Handle, CommFunction.ConnectString, sql, 3, ref ResultSelect) == false) { return; } OleDbDataAdapter sda = new OleDbDataAdapter(ResultSelect, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); }
private void toolStripButton3_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } CommFunction.LYData2Excel(this.Handle, CommFunction.ConnectString, ResultSelect, ""); }
private void button1_Click(object sender, EventArgs e) { string AppFile = Application.StartupPath + "\\"; CommFunction.WritePrivateProfileString("显示天数设置", "天数", textBox1.Text.Trim(), AppFile + "ShowDay.ini"); CommFunction.WritePrivateProfileString("打印设置", "是否打印", checkBox1.Checked.ToString(), AppFile + "ShowDay.ini"); CommFunction.WritePrivateProfileString("默认药品温度设置", "药品温度", textBox2.Text.Trim(), AppFile + "ShowDay.ini"); Close(); }
private void toolStripButton1_Click(object sender, EventArgs e) { //if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) return; ResultSelect = ""; string sql = "select sku_id,season as 货主,size_desc as 商品代码,sku_desc as 品名规格,cc_flag as 冷链标示,manufacturer as 生产厂家," + "storage_conditions as 存储条件,therm_company as 温度计所属单位,pym as 拼音码,create_date_time as 创建时间,user_name as 操作人员," + "std_pack_qty as 件装数,pack_type_z as 整件包装类型,pack_type_l as 零散包装类型,REPORT_FILE 跟踪报表名称 from cc_item_master "; if (CommFunction.ShowQueryForm(this.Handle, CommFunction.ConnectString, sql, 3, ref ResultSelect) == false) { return; } OleDbDataAdapter sda = new OleDbDataAdapter(ResultSelect, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); }
public static string WM_ConnString;//WM连接字符串 public static bool MakeDBConn_temp() { const string CryptStr = "sp"; bool result; result = false; string AppFile = Application.ExecutablePath;//应用程序路径(包括名称) AppFile = AppFile.ToLower(); AppFile = AppFile.Replace(".exe", ".ini"); labReadIni: StringBuilder temp = new StringBuilder(255); CommFunction.GetPrivateProfileString("temp连接数据库", "服务名", "", temp, 255, AppFile); string datasource = temp.ToString(); CommFunction.GetPrivateProfileString("temp连接数据库", "用户", "", temp, 255, AppFile); string user = temp.ToString(); CommFunction.GetPrivateProfileString("temp连接数据库", "口令", "", temp, 255, AppFile); string pwd = temp.ToString(); pwd = CommFunction.DeCryptStr(pwd, CryptStr); string newconnstr = ""; newconnstr = newconnstr + "data source=" + datasource + ";"; newconnstr = newconnstr + "User ID=" + user + ";"; newconnstr = newconnstr + "Password="******";"; newconnstr = newconnstr + "Provider=OraOLEDB.Oracle.1";//WIN7下一定要先这样,MSDAORA.1:才连得上,太怪了! OleDbConnection odbconn = new OleDbConnection(newconnstr); try { odbconn.Open(); result = true; } catch { result = false; } if (result == false) { string ss = "服务名" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + Convert.ToChar(0x3) + "用户" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + Convert.ToChar(0x3) + "口令" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "1" + CryptStr + Convert.ToChar(0x3); if (CommFunction.ShowOptionForm("temp连接数据库", "temp连接数据库", ss, AppFile)) { goto labReadIni; } else { Application.Exit(); } } return(true); }
///<summary> ///程序启动必需的WMS数据库连接设置 ///</summary> ///<param name=""></param> ///<returns></returns> public static bool MakeDBConn_HCWL() { const string CryptStr = "sp"; bool result; result = false; string AppFile = Application.ExecutablePath;//应用程序路径(包括名称) AppFile = AppFile.ToLower(); AppFile = AppFile.Replace(".exe", ".ini"); labReadIni: StringBuilder temp = new StringBuilder(255); CommFunction.GetPrivateProfileString("HCWL连接数据库", "服务名", "", temp, 255, AppFile); string datasource = temp.ToString(); CommFunction.GetPrivateProfileString("HCWL连接数据库", "用户", "", temp, 255, AppFile); string user = temp.ToString(); CommFunction.GetPrivateProfileString("HCWL连接数据库", "口令", "", temp, 255, AppFile); string pwd = temp.ToString(); pwd = CommFunction.DeCryptStr(pwd, CryptStr); string newconnstr = ""; newconnstr = newconnstr + "data source=" + datasource + ";"; newconnstr = newconnstr + "User ID=" + user + ";"; newconnstr = newconnstr + "Password="******";"; newconnstr = newconnstr + "Provider=MSDAORA.1:";//Unicode=True;//OraOleDb.Oracle OleDbConnection odbconn = new OleDbConnection(newconnstr); try { odbconn.Open(); result = true; CommFunction.cfServerName = datasource; CommFunction.cfUserID = user; CommFunction.cfPassword = pwd; LoginCs.LoginClass.ConnectString = newconnstr;//传递给登录模块以便登录 CommFunction.ConnectString = newconnstr; } catch { result = false; } if (result == false) { string ss = "服务名" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + Convert.ToChar(0x3) + "用户" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + Convert.ToChar(0x3) + "口令" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "1" + CryptStr + Convert.ToChar(0x3); if (CommFunction.ShowOptionForm("HCWL连接数据库", "HCWL连接数据库", ss, AppFile)) { goto labReadIni; } else { Application.Exit(); } } return(true); }
private void FrmMain_Load(object sender, EventArgs e) { CommFunction.MakeDBConn_HCWL(); LoginCs.frmLOG.ShowUniqueForm(true); tSLabel1.Text = " 当前用户:" + LoginCs.LoginClass.LogName; }
private void button2_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); string aa = null; string d1 = FHSJ1.Value.ToString("yyyy-MM-dd 00:00:00"); string d2 = FHSJ2.Value.ToString("yyyy-MM-dd 23:59:59"); string spzt; if ((SPZT.Text.Trim() == "") || (SPZT.Text == null)) { spzt = ""; } else if (SPZT.Text.Trim() == "已发货未复核确认") { spzt = " and (create_date_time is not null and check_date_time is null)"; } else if (SPZT.Text.Trim() == "已复核确认未收货") { spzt = " and (check_date_time is not null and sign_date_time is null )"; } else if (SPZT.Text.Trim() == "已收货") { spzt = " and sign_date_time is not null"; } else { spzt = ""; } string ywrg; if ((YWRG.Text.Trim() == "") || (YWRG.Text == null)) { ywrg = ""; } else if (YWRG.Text.Trim() == "有") { ywrg = " AND t.therm_id is not null "; } else if (YWRG.Text.Trim() == "无") { ywrg = " AND t.therm_id is null "; } else { ywrg = ""; } string pmgg; if ((PMGG.Text.Trim() == "") || (PMGG.Text == null)) { pmgg = ""; } else { pmgg = " and c.sku_desc like'%" + PMGG.Text + "%'"; } string khmc; if ((KHMC.Text.Trim() == "") || (KHMC.Text == null)) { khmc = ""; } else { khmc = " AND nvl(z.shipto_name,'*') like '%" + KHMC.Text + "%'"; } string gzbdh; if ((GZBDH.Text.Trim() == "") || (GZBDH.Text == null)) { gzbdh = ""; } else { gzbdh = " AND z.unid like '%" + GZBDH.Text + "%'"; } string wdjbh; if ((WDJBH.Text.Trim() == "") || (WDJBH.Text == null)) { wdjbh = ""; } else { wdjbh = " AND (nvl(t.therm_id ,'!@#$') like'%" + WDJBH.Text + "%' or nvl(wdmxgz.rgid,'!@#$') like '%" + WDJBH.Text + "%') "; } string fhdh; if ((FHDH.Text.Trim() == "") || (FHDH.Text == null)) { fhdh = ""; } else { fhdh = " AND nvl(c.assort_nbr,'!@#$') like '%" + FHDH.Text + "%'"; } string fhsj; fhsj = " and z.create_date_time between (to_date('" + d1 + "','yyyy-mm-dd hh24:mi:ss')) and (to_date('" + d2 + "','yyyy-mm-dd hh24:mi:ss')) "; string hz; if ((HZ.Text.Trim() == "") || (HZ.Text == null)) { hz = ""; } else { hz = " AND z.season= '" + HZ.Text + "'"; } aa = "select z.unid as 跟踪表单号,c.assort_nbr as 发货单号,c.sku_desc as 品名规格,c.batch_nbr as 商品批号," + "c.pack_tips_z as 整件冷链包装提示,c.pack_tips_l as 零散冷链包装提示,c.orig_pkt_qty as 商品数量,c.units as 单位,z.season as 货主,z.shipto_name as 客户名称," + "z.create_date_time as 发货时间,z.check_date_time as 复核时间,z.pack_date_time as 包装时间,z.carr_date_time as 提货时间," + "z.sign_date_time as 收货时间,z.user_name as 发货人,z.user_check as 复核人,z.user_pack as 包装人,z.user_carr as 提货人," + "z.sign_memo as 收货备注,z.user_sign as 收货人,t.therm_id as 温度计编号,z.user_therm as 温度计配附人,z.cur_temp_src as 发货天气温度," + "z.sign_temp_drugs as 收货时药品温度,z.sign_temp_envi as 收货时环境温度,z.carr_name as 承运商," + "case " + "when z.create_date_time is not null and check_date_time is null then '已发货未复核确认' " + "when check_date_time is not null and sign_date_time is null then '已复核确认未收货' " + "when sign_date_time is not null then '已收货' " + "else '' end as 状态," + "z.max_temp_src as 出发地最高温度,z.min_temp_src as 出发地最低温度,z.max_temp_dest as 目的地最高温度,z.min_temp_dest as 目的地最低温度,t.PACK_MEMO as 温度计包装备注,t.TEMP_MEMO as 温度计温度备注 " + "from cc_cold_chain_z z " + "left join cc_cold_chain_c c on z.unid=c.pkunid " + "left join cc_cold_chain_therm t on c.unid=t.pkunid where 1=1 " + spzt + ywrg + pmgg + khmc + gzbdh + wdjbh + fhdh + fhsj + hz + "order by z.create_date_time desc "; OleDbDataAdapter adapater = new OleDbDataAdapter(aa, cn); DataTable table = new DataTable(); adapater.Fill(table); if (table.Rows.Count == 0) { MessageBox.Show("查询不到记录"); return; } CommFunction.LYData2Excel(this.Handle, CommFunction.ConnectString, aa, ""); }