| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- 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 Common;
- namespace Core.LZMes.Client.UIF
- {
- public partial class UIF041050 : CoreFS.CA06.FrmBase
- {
- public UIF041050()
- {
- InitializeComponent();
- }
- #region "ToolBar Event"
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- try
- {
- switch (ToolbarKey)
- {
- case "Query":
- Query_GrpInfo();
- break;
- case "Add":
- Add_GrpInfo();
- break;
- case "Edit":
- Edit_GrpInfo();
- break;
- case "Delete":
- Del_GrpInfo();
- break;
- case "Exit":
- this.Close();
- break;
- }
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void Query_GrpInfo()
- {
- try
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIF.UIF04.UIF041050";
- ccp.MethodName = "Query_GrpLen_Info";
- ccp.ServerParams = new object[] { this.cmb_GrpType.Value.ToString() };
- CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
- if (obj.ReturnInfo.Length == 0)
- {
- this.dataSet1.Tables["TBF02_ROLL_GRP"].Clear();
- System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TBF02_ROLL_GRP"]);
- tab0.TableName = "TBF02_ROLL_GRP";
- this.dataSet1.Tables["TBF02_ROLL_GRP"].Merge(tab0);
- this.dataSet1.AcceptChanges();
- if (this.cmb_GrpType.Value.ToString() == "厚度")
- {
- this.ugrd_GrpLen.DisplayLayout.Bands[0].Columns["GRP_CD"].Header.Caption = "厚度组";
- }
- else
- {
- this.ugrd_GrpLen.DisplayLayout.Bands[0].Columns["GRP_CD"].Header.Caption = "厚度组";
- }
- }
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void Add_GrpInfo()
- {
- try
- {
- if (!CheckValue())
- return;
- string sql = "";
- if (this.cmb_GrpType.Value.ToString() == "厚度")
- {
- sql = "INSERT INTO TBF02_ROLL_THK(PLT,STL_GRP_CD,THK_GRP_CD,MINI,MAXI,REG_DTIME,REG_ID,MOD_DTIME,MOD_ID,C_STL_GRP_CD) "
- + "VALUES('C','NULL',"
- + "'" + this.cmb_GrpName.Text.Trim() + "',"
- + FixDBManager.CheckNullStr(FixDBManager.CheckNullDecimal(this.txt_LMini.Text)) + ","
- + FixDBManager.CheckNullStr(this.txt_LMaxi.Text) + ","
- + "TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
- + "'" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "',"
- + "NULL,"
- + "NULL,"
- + "'NULL'"
- + ")";
- }
- else
- {
- sql = "INSERT INTO TBF02_ROLL_WTH(PLT,STL_GRP_CD,WTH_GRP_CD,MINI,MAXI,REG_DTIME,REG_ID,MOD_DTIME,MOD_ID,C_STL_GRP_CD) "
- + "VALUES('C','NULL',"
- + "'" + this.cmb_GrpName.Text.Trim() + "',"
- + FixDBManager.CheckNullStr(FixDBManager.CheckNullDecimal(this.txt_LMini.Text)) + ","
- + FixDBManager.CheckNullStr(this.txt_LMaxi.Text) + ","
- + "TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
- + "'" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "',"
- + "NULL,"
- + "NULL,"
- + "'NULL'"
- + ")";
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIF.UIF04.UIF041050";
- ccp.MethodName = "Commit_GrpLen_Info";
- ccp.ServerParams = new object[] { sql };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if(ccp.ReturnInfo.Length == 0)
- Query_GrpInfo();
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void Edit_GrpInfo()
- {
- try
- {
- if (this.ugrd_GrpLen.ActiveRow == null)
- {
- MessageBox.Show("请选择您要修改的记录行");
- return;
- }
- if (!CheckValue())
- return;
- string sql = "";
- if (this.cmb_GrpType.Value.ToString() == "厚度")
- {
- sql = "UPDATE TBF02_ROLL_THK SET THK_GRP_CD='" + this.cmb_GrpName.Text.Trim() + "',"
- + "MINI=" + FixDBManager.CheckNullStr(FixDBManager.CheckNullDecimal(this.txt_LMini.Text)) + ","
- + "MAXI=" + FixDBManager.CheckNullStr(this.txt_LMaxi.Text) + ","
- + "MOD_DTIME=TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
- + "MOD_ID='" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' "
- + "WHERE PLT='C' AND THK_GRP_CD='" + FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value) + "'";
- }
- else
- {
- sql = "UPDATE TBF02_ROLL_WTH SET WTH_GRP_CD='" + this.cmb_GrpName.Text.Trim() + "',"
- + "MINI=" + FixDBManager.CheckNullStr(FixDBManager.CheckNullDecimal(this.txt_LMini.Text)) + ","
- + "MAXI=" + FixDBManager.CheckNullStr(this.txt_LMaxi.Text) + ","
- + "MOD_DTIME=TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
- + "MOD_ID='" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' "
- + "WHERE PLT='C' AND WTH_GRP_CD='" + FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value) + "'";
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIF.UIF04.UIF041050";
- ccp.MethodName = "Commit_GrpLen_Info";
- ccp.ServerParams = new object[] { sql };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if(ccp.ReturnInfo.Length == 0)
- Query_GrpInfo();
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void Del_GrpInfo()
- {
- try
- {
- if (this.ugrd_GrpLen.ActiveRow == null)
- {
- MessageBox.Show("请选择您要删除的记录行");
- return;
- }
- string sql = "";
- if (this.cmb_GrpType.Value.ToString() == "厚度")
- {
- sql = "DELETE FROM TBF02_ROLL_THK WHERE PLT='C' AND THK_GRP_CD='" + FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value) + "'";
- }
- else
- {
- sql = "DELETE FROM TBF02_ROLL_WTH WHERE PLT='C' AND WTH_GRP_CD='" + FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value) + "'";
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIF.UIF04.UIF041030";
- ccp.MethodName = "Delete_Group_Info";
- ccp.ServerParams = new object[] { sql };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if(ccp.ReturnInfo.Length ==0)
- Query_GrpInfo();
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private bool CheckValue()
- {
- if (this.cmb_GrpName.Text.Trim().Length == 0)
- {
- MessageBox.Show("请您确认组名");
- return false;
- }
-
- if (this.txt_LMaxi.Text.Trim().Length == 0)
- {
- MessageBox.Show("请您确认轧制单元编制长度的上限值");
- return false;
- }
- return true;
- }
- #endregion
- #region "ComboBox Event"
- private void cmb_GrpType_ValueChanged(object sender, EventArgs e)
- {
- try
- {
- this.dataSet1.Tables["TBF02_ROLL_GRP"].Clear();
- this.dataSet1.AcceptChanges();
- if (this.cmb_GrpType.Value.ToString() == "厚度")
- {
- this.ugrd_GrpLen.DisplayLayout.Bands[0].Columns["GRP_CD"].Header.Caption = "厚度组";
- FixDBManager.Init_ComboControl(this.cmb_GrpName, "TBF02_ROLL_THK_GRP", "GRP_CD", "GRP_CD", ref this.dataSet1);
- this.txt_Mini.Mask = "9.999";
- this.txt_Maxi.Mask = "9.999";
- }
- else
- {
- this.ugrd_GrpLen.DisplayLayout.Bands[0].Columns["GRP_CD"].Header.Caption = "宽度组";
- FixDBManager.Init_ComboControl(this.cmb_GrpName, "TBF02_ROLL_WTH_GRP", "GRP_CD", "GRP_CD", ref this.dataSet1);
- this.txt_Maxi.Mask = "9999";
- this.txt_Mini.Mask = "9999";
- }
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void cmb_GrpName_ValueChanged(object sender, EventArgs e)
- {
- try
- {
- if (this.cmb_GrpName.Value != null)
- {
- this.txt_Mini.Text = FixDBManager.CheckNullStr(this.cmb_GrpName.SelectedRow.Cells["MINI"].Value);
- this.txt_Maxi.Text = FixDBManager.CheckNullStr(this.cmb_GrpName.SelectedRow.Cells["MAXI"].Value);
- }
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- #endregion
- #region "Grid Event"
- private void ugrd_GrdLen_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- if (this.ugrd_GrpLen.ActiveRow == null)
- return;
- this.cmb_GrpName.Value = this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value.ToString();
- this.txt_Mini.Text = FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["MINI"].Value);
- this.txt_Maxi.Text = FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["MAXI"].Value);
- this.txt_LMini.Text = FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["LMINI"].Value);
- this.txt_LMaxi.Text = FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["LMAXI"].Value);
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- #endregion
- #region "Init"
- private void UIF041050_Load(object sender, EventArgs e)
- {
- try
- {
- GetBindData();
- this.cmb_GrpType.DisplayLayout.Bands[0].Columns[0].Band.ColHeadersVisible = false;
- this.cmb_GrpType.DisplayLayout.Bands[0].Columns[0].Width = this.cmb_GrpType.Width;
- this.cmb_GrpType.Value = "厚度";
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void GetBindData()
- {
- try
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIF.UIF04.UIF041050";
- ccp.MethodName = "Query_GRP_DATA";
- //ccp.ServerParams = new object[] { "PL/TCM" };
- CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
- if (obj.ReturnInfo.Length == 0)
- {
- System.Collections.ArrayList rtnobj = obj.ReturnObject as System.Collections.ArrayList;
- if (rtnobj[0] != null)
- {
- this.dataSet1.Tables["TBF02_ROLL_THK_GRP"].Clear();
- System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(rtnobj[0] as System.Collections.ArrayList, this.dataSet1.Tables["TBF02_ROLL_THK_GRP"]);
- tab0.TableName = "TBF02_ROLL_THK_GRP";
- this.dataSet1.Tables["TBF02_ROLL_THK_GRP"].Merge(tab0);
- }
- if (rtnobj[1] != null)
- {
- this.dataSet1.Tables["TBF02_ROLL_WTH_GRP"].Clear();
- System.Data.DataTable tab1 = FixDBManager.ConvertToDataTable(rtnobj[1] as System.Collections.ArrayList, this.dataSet1.Tables["TBF02_ROLL_WTH_GRP"]);
- tab1.TableName = "TBF02_ROLL_WTH_GRP";
- this.dataSet1.Tables["TBF02_ROLL_WTH_GRP"].Merge(tab1);
- }
- this.dataSet1.AcceptChanges();
- }
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- #endregion
- }
- }
|