| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using System.Collections;
- using Infragistics.Win.UltraWinGrid;
- using System.Text.RegularExpressions;
- namespace Core.LZMes.Client.UIC
- {
- public partial class UIC020111 : FrmBase
- {
- public UIC020111()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Save":
- this.DoSave();
- break;
- case "Export":
- this.DoExport();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void DoQuery()
- {
- try
- {
- CoreClientParam ccp = new CoreClientParam();
- //查询
- this.dataSet1.Tables[0].Clear();
- ArrayList al = new ArrayList();
- al.Add("UIC020111_01.SELECT");
-
- al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") );
-
- ccp = new CoreClientParam();
- ccp.ServerName = "UIB.COM.ComDBQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { al };
- ccp.IfShowErrMsg = false;
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void DoExport()
- {
- try
- {
- if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
- {
- string fileName = this.saveFileDialog1.FileName;
- ultraGridExcelExporter1.Export(ultraGrid1, fileName);
- System.Diagnostics.Process.Start(fileName);
- }
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- private class TT
- {
- public bool b(string s)
- {
- string pattern = "^([0-9]{1,}[.][0-9]*)$";
- Regex rx = new Regex(pattern);
- return rx.IsMatch(s);
- }
- public bool b2(string s)
- {
- string pattern = "^([0-9]{1,})$";
- Regex rx = new Regex(pattern);
- return rx.IsMatch(s);
- }
- }
- private void DoSave()
- {
- try
- {
-
- if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- ArrayList al = new ArrayList();
- ArrayList list = null;
- int num2 ;//停轧时间
- string strTime = "";
- string strProdLine = "";
- TT t =new TT();
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
-
- if (ugr.Cells["MODIFY_FLAG"].Text == "Y")
- {
- strTime = ugr.Cells["TJ_DTIME"].Text.Trim();
- strProdLine = ugr.Cells["PROD_LINE"].Text.Trim();
- list = new ArrayList();
- list.Add("UIC020111_01.UPDATE");
- list.Add(ugr.Cells["TJ_RESULT"].Text.Trim());
- list.Add(ugr.Cells["TJ_DEMO"].Text.Trim());
- list.Add(this.UserInfo.GetUserName());
- list.Add(ugr.Cells["TJ_DTIME"].Text.Trim());
- list.Add(ugr.Cells["TJ_NAME"].Text.Trim());
- if (!t.b(ugr.Cells["TJ_RESULT"].Text.Trim()) && !t.b2(ugr.Cells["TJ_RESULT"].Text.Trim()))//如果转换失败(为false)时输出括号内容
- {
- MessageBox.Show("请正确输入数字");
- return;
- }
- al.Add(list);
- }
- }
-
-
- if (al.Count == 0)
- {
- MessageBox.Show("没有修改的数据,保存无效", "提示");
- return;
- }
-
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.COM.ComDBSave";
- ccp.MethodName = "doXmlSave";
- ccp.ServerParams = new object[] { al };
- ccp.IfShowErrMsg = false;
- ccp =this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
-
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统发生异常,请与管理员联系", "提示");
- }
- }
- //private string checkSJZYSJ(string date)
- // private void checkSJZYSJ()
- // {
- // CoreClientParam ccp = new CoreClientParam();
- // Hashtable ht = new Hashtable();
- // ht.Add("i1", this.ComboProdLine.Text);//产线
- // ht.Add("i2", this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"));//录入时间
- // ht.Add("i3",this.ultraComboEditor2.Value.ToString());//班组
- // ht.Add("o4", "");
- // ccp.ServerName = "UIB.COM.ComDBProcedure";
- // ccp.MethodName = "doXmlProcedure";
- // ccp.ServerParams = new object[] { "UIC020111_02.CALL", ht };
- // CoreClientParam ccpResult = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // }
-
- private void DoInsertRow()
- {
- try
- {
-
- if (this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") == "" )
- {
- MessageBox.Show("请在编辑区域选择正确的日期");
- return;
- }
- if (MessageBox.Show("确认增加【" + this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") + "】的日志数据?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- CoreClientParam ccp = new CoreClientParam();
- Hashtable ht = new Hashtable();
- ht.Add("i1", "");//产线
- ht.Add("i2", this.UserInfo.GetUserName());//用户名
- ht.Add("i3", this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") );
-
- ht.Add("o4", "");
- ccp.ServerName = "UIB.COM.ComDBProcedure";
- ccp.MethodName = "doXmlProcedure";
- ccp.ServerParams = new object[] { "UIC020111_01.CALL", ht };
- CoreClientParam ccpResult = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ArrayList al = ccpResult.ReturnObject as ArrayList;
- if (al[0].ToString() != "YY")
- {
- //ugr.Cells["CHEM_CD"].Appearance.BackColor = Color.Blue;
- MessageBox.Show(al[0].ToString(), "提示");
- return;
- }
- this.ultraDateTimeEditor1.Value = this.ultraDateTimeEditor3.Value.ToString();
-
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- string strBC = "";//班组
- private void UIC020111_Load(object sender, EventArgs e)
- {
- try
- {
-
- if (this.UserInfo.GetUserGroup() == 0 + "")
- strBC = "常白班";
- else if (this.UserInfo.GetUserGroup() == 1 + "")
- strBC = "甲班";
- else if (this.UserInfo.GetUserGroup() == 2 + "")
- strBC = "乙班";
- else if (this.UserInfo.GetUserGroup() == 3 + "")
- strBC = "丙班";
- else if (this.UserInfo.GetUserGroup() == 4 + "")
- strBC = "丁班";
- //this.labelBC.Text = "提醒:当前登录班组为" + strBC + ",非" + strBC + "人员禁止增加该班的数据。";
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- try
- {
- this.ultraGrid1.ActiveRow.Appearance.ForeColor = Color.Red;//红色
- this.ultraGrid1.ActiveRow.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;//设置为粗体
- this.ultraGrid1.ActiveRow.Cells["MODIFY_FLAG"].Value = "Y";
- this.ultraGrid1.Update();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void ultraGrid1_KeyUp(object sender, KeyEventArgs e)
- {
- try
- {
- if(e.KeyCode != Keys.Enter)
- return;
- if (this.ultraGrid1.ActiveCell == null)
- return;
- string keyName = this.ultraGrid1.ActiveCell.Column.Key;
- this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
- this.ultraGrid1.ActiveRow.Cells[keyName].Activated = true;
- this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- this.DoInsertRow();
- }
- }
- }
|