| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357 |
- 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;
- namespace Core.LZMes.Client.UIC
- {
- public partial class UIC020110 : FrmBase
- {
- public UIC020110()
- {
- 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("UIC020110_01.SELECT");
- al.Add(this.ultraComboEditor1.Text);//产线
- al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") );
- al.Add(this.ultraComboEditor2.Value.ToString());
- 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);
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["TJ_NAME"].Text.IndexOf("计划产量") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("日历时间") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("停轧时间") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("计划时间") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("1.计划检修") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("2.设备申请") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("3.计划换辊、刀") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("故障时间") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("1.酸轧车间") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("2.准备车间") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("3.新冶公司") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("4.自动化部") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("5.二十冶") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("6.设备部") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("7.停机时间") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("8.外部") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("2.新冶公司") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("3.自动化部") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("5.设备部") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("6.停机时间") != -1
- ||ugr.Cells["TJ_NAME"].Text.IndexOf("连退车间") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("5.宝冶") != -1
- ||ugr.Cells["TJ_NAME"].Text.IndexOf("停机水消耗(循环水)") != -1 ||ugr.Cells["TJ_NAME"].Text.IndexOf("停机开始时间") != -1 ||ugr.Cells["TJ_NAME"].Text.IndexOf("停机结束时间") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("4.福盈公司") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("停轧时间") != -1
- || ugr.Cells["TJ_NAME"].Text.IndexOf("电耗") != -1 || ugr.Cells["TJ_NAME"].Text.IndexOf("水消耗(循环水)") != -1)
- {
- ugr.Appearance.ForeColor = Color.Red;
- }
- else if (ugr.Cells["TJ_NAME"].Text.ToString() == "液压油" || ugr.Cells["TJ_NAME"].Text.ToString() == "润滑油220" || ugr.Cells["TJ_NAME"].Text.ToString() == "润滑油320")
- {
- ugr.Appearance.ForeColor = Color.Blue;
- }
-
- }
- if (this.ultraComboEditor1.Text == "热轧")
- {
- for (int a = 0; a < this.ultraGrid1.Rows.Count; a++)
- {
- if (a > 3 && a < 35)
- {
- this.ultraGrid1.Rows[a].Appearance.ForeColor = Color.Red;
- }
- }
- }
- }
- 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 void DoSave()
- {
- try
- {
- if (this.UserInfo.GetUserGroup() == 0 + "")
- {
- MessageBox.Show("常白班人员禁止对数据进行操作" ,"警告");
- return;
- }
-
- if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- ArrayList al = new ArrayList();
- ArrayList list = null;
- string num1 = "";//日历时间
- string num2 = "";//停轧时间
- string strBC = "";//班次
- string strTime = "";
- string strProdLine = "";
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["TJ_NAME"].Text == "日历时间")
- {
- num1 = ugr.Cells["TJ_RESULT"].Text.Trim();
- strBC = ugr.Cells["TJ_BC"].Value.ToString().Trim();
- }
- else if (ugr.Cells["TJ_NAME"].Text == "停轧时间")
- num2 = ugr.Cells["TJ_RESULT"].Text.Trim();
- 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("UIC020110_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["PROD_LINE"].Text.Trim());
- list.Add(ugr.Cells["TJ_DTIME"].Text.Trim());
- list.Add(ugr.Cells["TJ_BC"].Value.ToString().Trim());
- list.Add(ugr.Cells["TJ_NAME"].Text.Trim());
- al.Add(list);
- }
- }
- //对实际作业时间进行处理,日历时间-停轧时间
-
- list = new ArrayList();
- list.Add("UIC020110_01.UPDATE");
- if (num1 != "" && num2 != "")
- list.Add(double.Parse(num1) - double.Parse(num2));
- else
- list.Add("");
- list.Add("min");
- list.Add(this.UserInfo.GetUserName());
- list.Add(strProdLine);//产线
- list.Add(strTime);//时间
- list.Add(strBC);//班次
- list.Add("实际作业时间");
- 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);
- ccp = new CoreClientParam();
- Hashtable ht = new Hashtable();
- ht.Add("i1", this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"));
- ht.Add("o2", "");
- ccp.ServerName = "UIB.COM.ComDBProcedure";
- ccp.MethodName = "doXmlProcedure";
- ccp.ServerParams = new object[] { "UIC010001_02.CALL", ht };
- 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[] { "UIC020110_02.CALL", ht };
- // CoreClientParam ccpResult = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // }
-
- private void DoInsertRow()
- {
- try
- {
- if (this.UserInfo.GetUserGroup() == 0 + "")
- {
- MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
- return;
- }
-
- if (this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") == "" || this.ComboProdLine.Text == "")
- {
- MessageBox.Show("请在编辑区域选择正确的日期和产线");
- return;
- }
- if (MessageBox.Show("确认增加【" + strBC + "】的日志数据?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- CoreClientParam ccp = new CoreClientParam();
- Hashtable ht = new Hashtable();
- ht.Add("i1", this.ComboProdLine.Text);//产线
- ht.Add("i2", this.UserInfo.GetUserName());//用户名
- ht.Add("i3", this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") );
- ht.Add("i4", this.UserInfo.GetUserGroup());
- ht.Add("o5", "");
- ccp.ServerName = "UIB.COM.ComDBProcedure";
- ccp.MethodName = "doXmlProcedure";
- ccp.ServerParams = new object[] { "UIC020110_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(ComboProdLine .Text+ this.strBC + al[0].ToString(), "提示");
- return;
- }
- this.ultraDateTimeEditor1.Value = this.ultraDateTimeEditor3.Value.ToString();
- this.ultraComboEditor2.Value = this.UserInfo.GetUserGroup();
- this.ultraComboEditor1.Value = this.ComboProdLine.Value.ToString();
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- string strBC = "";//班组
- private void UIC020110_Load(object sender, EventArgs e)
- {
- try
- {
- this.ultraComboEditor1.SelectedIndex = 0;
- this.ultraComboEditor2.Value = this.UserInfo.GetUserGroup();//0;
- this.ComboProdLine.SelectedIndex = 0;
- 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();
- }
- }
- }
|