| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.IO;
- using System.Diagnostics;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using System.Collections;
- using Core.Mes.Client.Common;
- namespace Core.LgMes.Client.LgIntegrationQuery
- {
- public partial class frmOperateRule : Core.Mes.Client.Common.frmStyleBase
- {
- OpenFileDialog Ofd = new OpenFileDialog();
- string type = "";
- public frmOperateRule()
- {
- InitializeComponent();
- }
- private string directoryPath = "C:\\";//质保书临时存放
- string strErr = "";
- private void frmOperateRule_Load(object sender, EventArgs e)
- {
- type = this.CustomInfo.ToString();
- ultraComboEditor1.Visible = true;
- label7.Visible = true;
- if (type.Equals("MESSAGE"))
- {
- ultraComboEditor1.Visible = false;
- label7.Visible = false;
- this.ulGridMain.DisplayLayout.Bands[0].Columns["DOCTYPE"].Hidden = true;
- }
- this.ckbGX.Checked = true;
- Init();
- doQuery();
- SteelBind();
-
- /*try
- {
- InitCombox();
- }
- catch
- { }*/
- }
- void Init()
- {
- ArrayList arry = new ArrayList();
- arry.Add("GetProcessInfo1.Query");
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this.ob;
- DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arry, out strErr);
- if (strErr == "" && ds.Tables[0].Rows.Count > 0)
- {
- urlCb_devNo.Items.Clear();
- Core.Mes.Client.Common.Globals.FillUltraComboItems(urlCb_devNo, ds);
- this.FillUltraComboItems(urlCb_BM,ds);
- }
- else
- MessageBox.Show("初使化失败!原因:" + strErr, "提示");
- ArrayList arry1 = new ArrayList();
- arry1.Add("GetProcessInfo2.Query");
- CommonClientToServer cctos1 = new CommonClientToServer();
- cctos1.ob = this.ob;
- DataSet ds1 = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arry1, out strErr);
- if (strErr == "" && ds.Tables[0].Rows.Count > 0)
- {
- ultraComboEditor1.Items.Clear();
- Core.Mes.Client.Common.Globals.FillUltraComboItems(ultraComboEditor1, ds1);
- }
- else
- MessageBox.Show("初使化失败!原因:" + strErr, "提示");
- try
- {
- Core.Mes.Client.Common.UltraGridMgt.SetGridRowFilter(ref this.ulGridMain, true);
- }
- catch
- { }
- }
- void SteelBind()
- {
- string strErr = "";
- //全部牌号
- ArrayList arrySteel = new ArrayList();
- arrySteel.Add("GetZLSteel.Query");
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this.ob;
- DataSet dsSteel = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arrySteel, out strErr);
- //DataSet dsSteel = (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("LGZL", "Core.XgMes.Server.Zlgl.Lg.CraftStandard", "getSteel", new object[] { }, out err);
- if (strErr == "")
- {
- Core.Mes.Client.Common.Globals.FillUltraComboItems(ulteSteel, dsSteel);
- }
- }
- void doRefresh()
- {
- try
- {
- this.txt_DocNo.Clear();
- this.txt_RuName.Clear();
- this.txt_RuNo.Clear();
- this.txt_RuScript.Clear();
- ulteSteel.Text = ulteSteelCode.Text = "";
- this.urlCb_devNo.Text = "";
- ArrayList arry = new ArrayList();
- arry.Add("RefreshData.Query");
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this.ob;
- DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arry, out strErr);
- dataSet1.Clear();
- try
- {
- SetScmOperateRuleDs();
- }
- catch
- { }
- if (strErr == "" && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
- {
- foreach (DataRow Dr in ds.Tables[0].Rows)
- {
- DataRow dr1 = dataSet1.Tables[0].NewRow();
- dr1["RULEID"] = Dr["RULEID"].ToString();
- dr1["RULENAME"] = Dr["RULENAME"].ToString();
- dr1["DESCRIPTION"] = Dr["DESCRIPTION"].ToString();
- dr1["DEVICENO"] = Dr["DEVICENO"].ToString();
- dr1["STEELCODE"] = Dr["STEELCODE"].ToString();
- dr1["INPUTTIME"] = Dr["INPUTTIME"].ToString();
- dr1["POSITTION"] = Dr["POSITTION"].ToString();
- dr1["RECORDER"] = Dr["RECORDER"].ToString();
- dr1["DESCRIPTIONNAME"] = Dr["DESCRIPTIONNAME"].ToString();
- if (!this.isCorrectRuleId(Dr["RULEID"].ToString()))
- continue;
- dataSet1.Tables[0].Rows.Add(dr1);
- }
- }
- //if (strErr == "")
- // ulGridMain.DataSource = ds;
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private byte[] FileConvertByte(string filePath)
- {
- byte[] bytContent = null;
- System.IO.FileStream fs = null;
- System.IO.BinaryReader br = null;
- try
- {
- fs = new FileStream(filePath, System.IO.FileMode.Open);
- br = new BinaryReader(fs);
- bytContent = br.ReadBytes((Int32)fs.Length);
- }
- catch
- {
- fs.Close();
- fs.Dispose();
- }
- return bytContent;
- }
- private void ByteConvertFile(string filePath, byte[] data)
- {
- FileStream fs;
- if (System.IO.File.Exists(filePath))
- {
- fs = new FileStream(filePath, FileMode.Truncate);
- }
- else
- {
- fs = new FileStream(filePath, FileMode.CreateNew);
- }
- BinaryWriter br = new BinaryWriter(fs);
- br.Write(data, 0, data.Length);
- br.Close();
- fs.Close();
- }
- void doAdd()
- {
- try
- {
- string filePathName = this.txt_DocNo.Text.ToString();
- if (!File.Exists(filePathName))
- {
- MessageBox.Show("文件不存在");
- return;
- }
- if (string.IsNullOrEmpty(txt_RuNo.Text.Trim()))
- {
- MessageBox.Show("请输入文件编号");
- return;
- }
- //if (ulteSteelCode.Text == "")
- //{
- // MessageBox.Show(this, "请选择牌号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- // ulteSteel.Focus();
- // return;
- //}
- //if (urlCb_devNo.SelectedIndex == -1)
- //{
- // MessageBox.Show(this, "工序输入错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- // urlCb_devNo.Focus();
- // return;
- //}
- byte[] sByte;
- string strSqlID = "OperaterRule.add";
- object[] sArgs = new object[10];
- sArgs[0] = txt_RuNo.Text.ToString();
- sArgs[1] = txt_RuName.Text.ToString();
- sArgs[2] = txt_RuScript.Text.ToString();
- try
- {
- sArgs[3] = (urlCb_devNo.Text.Trim() != null) ? urlCb_devNo.Text.ToString() : "";
- }
- catch { }
- sArgs[4] = ulteSteel.Text;
- sArgs[5] = this.UserInfo.GetUserName();
- //byte[] bytes = File.ReadAllBytes(txt_DocNo.Text.ToString());
- //File.WriteAllBytes("c:\\123.txt", bytes);
- //StreamReader reader = new StreamReader(txt_DocNo.Text.ToString(), true);
- //string filePath = this.txt_DocNo.Text.ToString();
- //byte[] sByte = FileConvertByte(filePath);
- //ByteConvertFile("c:\\" + txt_RuScript.Text + ".doc", sByte);
- using (FileStream fsTream = new FileStream(txt_DocNo.Text.ToString(), FileMode.Open, FileAccess.Read))
- {
- if (fsTream.Length > 0)
- {
- sByte = new byte[fsTream.Length];
- fsTream.Read(sByte, 0, sByte.Length);
- fsTream.Close();
- }
- else
- {
- sByte = new byte[1];
- sByte[0] = 32;
- }
- }
- sArgs[6] = sByte;
- //sArgs[7] = Ofd.SafeFileName;
- sArgs[7] = Ofd.FileName.Substring(Ofd.FileName.LastIndexOf(@"\") + 1);
- sArgs[8] = ultraComboEditor1.Value == null ? "" : ultraComboEditor1.SelectedItem.ToString();
- sArgs[9] = type;
- Hashtable hashtb = new Hashtable();
- hashtb.Add("I1", sArgs[0]);
- hashtb.Add("I2", sArgs[1]);
- hashtb.Add("I3", sArgs[2]);
- hashtb.Add("I4", sArgs[3]);
- hashtb.Add("I5", sArgs[4]);
- hashtb.Add("I6", sArgs[5]);
- hashtb.Add("I7", sArgs[7]);
- //hashtb.Add("I7", sArgs[6]);
- hashtb.Add("I8",sArgs[8]);
- hashtb.Add("I9", sArgs[9]);
- hashtb.Add("O1", "");
- hashtb.Add("O2", "");
- CommonClientToServer ccTs = new CommonClientToServer();
- ccTs.ob = ob;
- string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.lgIntegrationQuery.PerformanceLog",
- "BaseDataManage", strSqlID, hashtb, out strErr);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.lgIntegrationQuery.PerformanceLog";
- ccp.MethodName = "UpdateBolob";
- ccp.ServerParams = new object[] { sByte, txt_RuNo.Text };
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- //ArrayList all = new ArrayList();
- //all.Add(sByte);
- //all.Add(txt_RuNo.Text);
- //ccTs.NoQueryFunctions("Core.LgMes.Server.lgIntegrationQuery.PerformanceLog", "UpdateBolob", all, out strErr);
- if (strErr == "")
- {
- //UpdateContextType();
- doQuery();
- activeRow(sArgs[0].ToString());
-
- }
- else
- {
- MessageBox.Show(strErr);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- return;
- }
- }
- void doEdit()
- {
- try
- {
- string filePathName = this.txt_DocNo.Text.ToString();
- string rr = System.AppDomain.CurrentDomain.BaseDirectory;
- if (!File.Exists(filePathName))
- {
- MessageBox.Show("文件不存在");
- return;
- }
- if (ulteSteelCode.Text == "")
- {
- MessageBox.Show(this, "请选择牌号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- ulteSteel.Focus();
- return;
- }
- if (urlCb_devNo.SelectedIndex == -1)
- {
- MessageBox.Show(this, "工序输入错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- urlCb_devNo.Focus();
- return;
- }
- byte[] sByte;
- string strSqlID = "OperaterRule.Edit";
- object[] sArgs = new object[8];
- sArgs[0] = txt_RuNo.Text.ToString();
- sArgs[1] = txt_RuName.Text.ToString();
- sArgs[2] = txt_RuScript.Text.ToString();
- //sArgs[3] = "";
- sArgs[3] = (urlCb_devNo.Text.Trim() != null) ? urlCb_devNo.Text.ToString() : "";
- sArgs[4] = ulteSteelCode.Text;
- sArgs[5] = this.UserInfo.GetUserName();
- using (FileStream fsTream = new FileStream(txt_DocNo.Text.ToString(), FileMode.Open, FileAccess.Read))
- {
- if (fsTream.Length > 0)
- {
- sByte = new byte[fsTream.Length];
- fsTream.Read(sByte, 0, sByte.Length);
- fsTream.Close();
- }
- else
- {
- sByte = new byte[1];
- sByte[0] = 32;
- }
- }
- sArgs[6] = sByte;
- sArgs[7] = txt_DocNo.Text;
- string msg = "";
- Hashtable hashtb = new Hashtable();
- hashtb.Add("I1", sArgs[0]);
- hashtb.Add("I2", sArgs[1]);
- hashtb.Add("I3", sArgs[2]);
- hashtb.Add("I4", sArgs[3]);
- hashtb.Add("I5", sArgs[4]);
- hashtb.Add("I6", sArgs[5]);
- hashtb.Add("I7", sArgs[7]);
- hashtb.Add("O1", "");
- hashtb.Add("O2", "");
- CommonClientToServer ccTs = new CommonClientToServer();
- ccTs.ob = ob;
- string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.lgblobIntegrationQuery.PerformanceLog",
- "BaseDataManage", strSqlID, hashtb, out strErr);
- if (strErr == "")
- {
- doQuery();
- activeRow(sArgs[0].ToString());
- UpdateContextType();
- }
- else
- MessageBox.Show(strErr);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- void doDelete()
- {
- try
- {
- if (ulGridMain.ActiveRow == null)
- return;
- if (MessageBox.Show(this, "是否删除本记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
- return;
- string strSqlID = "OperaterRule.Del";
- string[] sArgs = new string[1];
- string rr = "";
- sArgs[0] = this.ulGridMain.ActiveRow.Cells["RULEID"].Value.ToString();
- Hashtable hashtb = new Hashtable();
- hashtb.Add("I1", sArgs[0]);
- hashtb.Add("O1", "");
- hashtb.Add("O2", "");
- CommonClientToServer ccTs = new CommonClientToServer();
- ccTs.ob = ob;
- string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.lgIntegrationQuery.PerformanceLog",
- "BaseDataManage", strSqlID, hashtb, out strErr);
- if (strErr == "")
- {
- doQuery();
- }
- else
- MessageBox.Show(strErr);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- //打开文件
- private void ulGridMain_DoubleClickCell(object sender, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs e)
- {
- doDownLoad();
- }
- void doDownLoad()
- {
- try
- {
- if (ulGridMain.ActiveRow == null)
- return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.lgIntegrationQuery.PerformanceLog";
- ccp.MethodName = "downLoadFile";
- ccp.ServerParams = new object[] { ulGridMain.ActiveRow.Cells["RULEID"].Text };
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- byte[] sBytes = (byte[])ccp.ReturnObject;
- if (strErr == "")
- {
- SaveFileDialog sFile = new SaveFileDialog();
- sFile.Title = "操作规程文件保存";
- sFile.AddExtension = true;
- sFile.CheckPathExists = true;
- sFile.CreatePrompt = true;
- sFile.FileName = ulGridMain.ActiveRow.Cells["DESCRIPTIONNAME"].Text;
- //sFile.FileName = ds.Tables[0].Rows[0]["DESCRIPTIONNAME"].ToString();
- sFile.Filter = "Word文件(*.doc)|*.doc";
- sFile.DefaultExt = ".doc";
- System.DateTime dt = System.DateTime.Now;
- string TimeNow = string.Format("{0:yyyyMMddHHmmssffff}", dt);
- string sFile1 = "", strTemplateName="";
- //strTemplateName= Application.StartupPath + "\\Report\\" + strTemplateName + ".xls";
- if (ulGridMain.ActiveRow.Cells["DESCRIPTIONNAME"].Text.Contains(".xls"))
- {
- sFile1 = Application.StartupPath + "\\Report\\" + ulGridMain.ActiveRow.Cells["DESCRIPTION"].Text + ".xls";
- }
- else if (ulGridMain.ActiveRow.Cells["DESCRIPTIONNAME"].Text.Contains(".pdf"))
- {
- sFile1 = Application.StartupPath + "\\Report\\" + ulGridMain.ActiveRow.Cells["DESCRIPTION"].Text + ".pdf";
- }
- else if (ulGridMain.ActiveRow.Cells["DESCRIPTIONNAME"].Text.Contains(".et"))
- {
- sFile1 = Application.StartupPath + "\\Report\\" + ulGridMain.ActiveRow.Cells["DESCRIPTION"].Text + ".et";
- }
- else if (ulGridMain.ActiveRow.Cells["DESCRIPTIONNAME"].Text.Contains(".wps"))
- {
- sFile1 = Application.StartupPath + "\\Report\\" + ulGridMain.ActiveRow.Cells["DESCRIPTION"].Text + ".wps";
- }
- else
- sFile1 = Application.StartupPath + "\\Report\\" + ulGridMain.ActiveRow.Cells["DESCRIPTION"].Text + ".doc";
- if (!File.Exists(strTemplateName))
- {
- System.IO.Directory.CreateDirectory(Application.StartupPath + "\\Report\\");
- }
- FileStream fs = new FileStream(sFile1, FileMode.OpenOrCreate, FileAccess.Write);
- fs.Write(sBytes, 0, sBytes.Length);
- fs.Close();
- ProcessStartInfo p = new ProcessStartInfo(sFile1);
- p.WorkingDirectory = Path.GetDirectoryName(sFile1);
- Process.Start(p);
- }
- else
- MessageBox.Show(strErr, "提示");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- void activeRow(string strRuID)
- {
- try
- {
- for (int i = 0; i < ulGridMain.Rows.Count; i++)
- {
- if (ulGridMain.Rows[i].Cells["RULEID"].Text == strRuID)
- {
- ulGridMain.Rows[i].Activated = true;
- ulGridMain.Rows[i].Selected = true;
- break;
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>根据条件查询信息
- /// 根据条件查询信息
- /// </summary>
- private void doQuery()
- {
-
- string strPostion = "";
- string description = "";
- this.txt_DocNo.Clear();
- this.txt_RuName.Clear();
- this.txt_RuNo.Clear();
- this.txt_RuScript.Clear();
- ulteSteel.Text = ulteSteelCode.Text = "";
- this.urlCb_devNo.Text = "";
- if (ckbGX.Checked )
- {
- strPostion = Convert.ToString(urlCb_BM.Text.Trim());
- }
- if (ckbGCMS.Checked)
- {
- description = Convert.ToString(textBox1.Text.Trim());
- }
- /*if (strPostion == "" && description == "")
- {
- this.doQuery();
- return;
- }*/
- DataSet ds = new DataSet();
- ArrayList arry = new ArrayList();
- if (strPostion != "" && description == "")
- {
- arry.Add("GetGywjByPosittion.Query");
- arry.Add("%" + strPostion + "%");
- arry.Add(type);
- //arry.Add(strPostion);
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this.ob;
- ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arry, out strErr);
- }
- if (strPostion == "" && description != "")
- {
- arry.Add("GetGywjByPosittion2.Query");
- arry.Add("%" + description + "%");
- arry.Add(type);
- //arry.Add(strPostion);
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this.ob;
- ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arry, out strErr);
- }
- if (strPostion != "" && description != "")
- {
- arry.Add("GetGywjByPosittion3.Query");
- arry.Add("%" + strPostion + "%");
- arry.Add("%" + description + "%");
- arry.Add(type);
- //arry.Add(strPostion);
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this.ob;
- ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arry, out strErr);
- }
- if (strPostion == "" && description == "")
- {
- arry.Add("GetGywjByPosittion4.Query");
- arry.Add(type);
- //arry.Add(strPostion);
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this.ob;
- ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arry, out strErr);
- }
-
- dataSet1.Clear();
- if (strErr == "" && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
- {
- foreach (DataRow Dr in ds.Tables[0].Rows)
- {
- DataRow dr1 = dataSet1.Tables[0].NewRow();
- dr1["RULEID"] = Dr["RULEID"].ToString();
- dr1["RULENAME"] = Dr["RULENAME"].ToString();
- dr1["DESCRIPTION"] = Dr["DESCRIPTION"].ToString();
- dr1["DEVICENO"] = Dr["DEVICENO"].ToString();
- dr1["STEELCODE"] = Dr["STEELCODE"].ToString();
- dr1["INPUTTIME"] = Dr["INPUTTIME"].ToString();
- dr1["POSITTION"] = Dr["POSITTION"].ToString();
- dr1["RECORDER"] = Dr["RECORDER"].ToString();
- dr1["DESCRIPTIONNAME"] = Dr["DESCRIPTIONNAME"].ToString();
- dr1["DOCTYPE"] = Dr["DOCTYPE"].ToString();
- dataSet1.Tables[0].Rows.Add(dr1);
- }
- }
- //if (strErr == "")
- // ulGridMain.DataSource = ds;
-
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Update":
- doEdit();
- break;
- case "Add":
- doAdd();
- break;
- case "Delete":
- doDelete();
- break;
- case "Exit":
- Close();
- break;
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- Ofd.Title = "打开文件";
- Ofd.Filter = "文件 (*.doc;*.xls;*.rtf;*.htm;*.txt;*.wps;*.pdf;)|*.doc;*.xls;*.rtf;*.htm;*.txt;*.wps;*.pdf;";
- if (type.Equals("MESSAGE"))
- {
- ArrayList arry = new ArrayList();
- arry.Add("GetMaxRULEID.Query");
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this.ob;
- DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arry, out strErr);
- this.txt_RuNo.Text = ds.Tables[0].Rows[0][0].ToString();
- }
- else
- this.txt_RuNo.Text = "";
- if (Ofd.ShowDialog() == DialogResult.OK)
- {
- //this.txt_DocNo.Text = Ofd.FileNames ;
- this.txt_DocNo.Text = Ofd.FileName;
- char Flag = '.';
- //string[] sArgs = Ofd.SafeFileName.Split(Flag);
- string[] sArgs = Ofd.FileName.Substring(Ofd.FileName.LastIndexOf(@"\") + 1).Split(Flag);
- txt_RuScript.Text = sArgs[0];
- txt_RuName.Text = sArgs[0];
- }
- }
- catch { }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- if (ulGridMain.ActiveRow != null)
- {
- this.txt_RuNo.Text = ulGridMain.ActiveRow.Cells[0].Value.ToString();
- this.txt_RuName.Text = ulGridMain.ActiveRow.Cells[1].Value.ToString();
- this.txt_RuScript.Text = ulGridMain.ActiveRow.Cells[2].Value.ToString();
- this.txt_DocNo.Text = "";
- ulteSteelCode.Text = ulGridMain.ActiveRow.Cells["STEELCODE"].Value.ToString();
- ulteSteel.Text = ulGridMain.ActiveRow.Cells["STEELCODE"].Value.ToString();
- this.urlCb_devNo.Value = ulGridMain.ActiveRow.Cells["DEVICENO"].Value.ToString();
- }
- }
- private void ulteSteel_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- }
- private void ckbGX_CheckedChanged(object sender, EventArgs e)
- {
- urlCb_BM.Enabled = ckbGX.Checked;
- this.checkBox1.Checked = !this.ckbGX.Checked;
- //doQuery();
- }
- private void InitCombox()
- {
- this.ultraComboEditor1.DataSource = this.GetDocType();
- this.ultraComboEditor1.DisplayMember = "name_";
- this.ultraComboEditor1.ValueMember = "id_";
- this.ultraComboEditor1.SelectedIndex = 0;
-
- }
- private DataTable GetDocType()
- {
- DataTable dt = new DataTable();
- DataColumn dcId = new DataColumn("id_",System.Type.GetType("System.String"));
- DataColumn dcName = new DataColumn("name_", System.Type.GetType("System.String"));
- dt.Columns.AddRange(new DataColumn[] { dcId, dcName });
- dt.Rows.Add(new object[] { "0", "工艺文件" });
- dt.Rows.Add(new object[] { "1", "工艺考核通报" });
- return dt;
- }
- private void UpdateContextType()
- {
- try
- {
- ClientParamWithSqlConditionAndOpenBase param = new ClientParamWithSqlConditionAndOpenBase();
- string str = this.ultraComboEditor1.Value.ToString();
- object[] obj = new object[] { str, this.txt_RuNo.Text.ToString().Trim() };
- param.ob = this.ob;
- param.param = obj;
- Core.LgMes.Client.lgBll.LgScmOpeateRuleMgt.LgScmOpeateRuleMgt.UpdateScmOperateRuleContextType(param);
- }
- catch
- {
- }
-
- }
- private Boolean isCorrectRuleId(string ruleId)
- {
- try
- {
- DataRow[] drs = this._ds.Tables[0].Select(string.Format("RULEID = '{0}'",ruleId));
- if (drs.Length == 0)
- return true;
- if (this.checkBox1.Checked)
- {
- return drs[0]["DOCTYPE"].ToString() == "1";
- }
- if (this.ckbGX.Checked)
- {
- return drs[0]["DOCTYPE"].ToString() == "0";
- }
- }
- catch
- {
-
- }
- return true;
-
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- this.ckbGX.Checked = !this.checkBox1.Checked;
- this.ckbGCMS.Checked = !this.checkBox1.Checked;
- }
- private void SetScmOperateRuleDs()
- {
- this._ds = Core.LgMes.Client.lgBll.LgScmOpeateRuleMgt.LgScmOpeateRuleMgt.GetScmOperateRuleDs(new ClientParamWithSqlConditionAndOpenBase("",this.ob));
-
- }
- public void FillUltraComboItems(Infragistics.Win.UltraWinEditors.UltraComboEditor ulcme, DataSet dset)
- {
- if (dset.Tables.Count > 0 && dset.Tables[0].Columns.Count > 1)
- {
- for (int i = 0; i < dset.Tables[0].Rows.Count; i++)
-
- if (i == 0)
- ulcme.Items.Add(null, null);
-
- else
- ulcme.Items.Add(dset.Tables[0].Rows[i][0].ToString(), dset.Tables[0].Rows[i][1].ToString());
- }
- }
- private DataSet _ds = null;
- private void ckbGCMS_CheckedChanged(object sender, EventArgs e)
- {
- textBox1.Enabled = ckbGCMS.Checked;
- //doQuery();
- }
- }
- }
|