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;
namespace Core.LZMes.Client.UIF
{
public partial class UIF042020 : FrmBase
{
public UIF042020()
{
InitializeComponent();
}
#region "ToolBar Event"
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
this.DoQuery();
break;
case "Save":
this.Save();
break;
case "Delete":
Delete();
break;
case "Send":
Send();
break;
case "UnSend":
UnSend();
break;
case "Exit":
this.Close();
break;
}
}
///
/// 查询轧辊单元计划信息
///
private void DoQuery()
{
try
{
this.dataSet1.Tables[0].Clear();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIF.UIF04.UIF042020";
ccp.MethodName = "QueryRollPlan";
ccp.ServerParams = new object[] { };
ccp.SourceDataTable = this.dataSet1.Tables[0];
CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
if (obj.ReturnInfo.Length == 0)
{
System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["C_TBF03_SPEC_ROLL"]);
tab0.TableName = "C_TBF03_SPEC_ROLL";
this.dataSet1.Tables["C_TBF03_SPEC_ROLL"].Merge(tab0);
this.dataSet1.AcceptChanges();
};
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
///
/// 保存轧辊单元计划的顺序调整
///
private void Save()
{
try
{
string rollNO = Convert.ToString(Common.FixDBManager.CheckNullStr(this.textTarget.Text));
string pos = Convert.ToString(Common.FixDBManager.CheckNullStr(this.comboPosition.Value));
string type = Convert.ToString(Common.FixDBManager.CheckNullStr(this.optionBF.Value));
if (rollNO == "" || pos == "" || type == "")
{
MessageBox.Show(" 条件不能为空! ");
}
string ex = "";
Hashtable paramHsmp = new Hashtable();
paramHsmp.Add("i1", rollNO);
paramHsmp.Add("i2", pos);
paramHsmp.Add("i3", type);
paramHsmp.Add("o4", ex);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIB.COM.ComDBProcedure";
ccp.MethodName = "doXmlProcedure";
ccp.ServerParams = new Object[] { "UIF042020.Adj_RollUnit", paramHsmp };
CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
{
MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
}
else
{
DoQuery();
}
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
///
/// 删除轧辊单元计划
///
private void Delete()
{
try
{
this.ugrd_RollInfo.UpdateData();
System.Data.DataRow[] rows = this.dataSet1.Tables[0].Select("CHK='TRUE'");
if (rows.Length == 0)
{
MessageBox.Show("请选择你要下发的计划", Common.FixDBManager.MsgCaption);
return;
}
string RollNO = rows[0]["ROLL_MANA_NO"].ToString();
System.Windows.Forms.DialogResult rt = MessageBox.Show("是否确认删除所选轧制单元计划?", Common.FixDBManager.MsgCaption, MessageBoxButtons.YesNo);
if (rt == DialogResult.No)
{
return;
}
string Ex = "";
Hashtable paramHsmp = new Hashtable();
paramHsmp.Add("i1", RollNO);
paramHsmp.Add("i2", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
paramHsmp.Add("o3", Ex);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIB.COM.ComDBProcedure";
ccp.MethodName = "doXmlProcedure";
ccp.ServerParams = new Object[] { "UIF042020.Del_RollUnit", paramHsmp };
CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
{
MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
}
else
{
DoQuery();
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
///
/// 轧辊单元计划指令下发(二级)
/// 支持≤2调计划指令下发
///
private void Send()
{
try
{
this.ugrd_RollInfo.UpdateData();
System.Data.DataRow[] rows = this.dataSet1.Tables[0].Select("CHK='TRUE'");
if (rows.Length == 0)
{
MessageBox.Show("请选择你要下发的计划", Common.FixDBManager.MsgCaption);
return;
}
string RollNO = rows[0]["ROLL_MANA_NO"].ToString();
string ex = "";
Hashtable paramHsmp = new Hashtable();
paramHsmp.Add("i1", RollNO);
paramHsmp.Add("o2", ex);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIB.COM.ComDBProcedure";
ccp.MethodName = "doXmlProcedure";
ccp.ServerParams = new Object[] { "UIF042020.Sed_RollUnit", paramHsmp };
CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
{
MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
}
else
{
DoQuery();
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
///
/// 对已下发(二级)的轧辊单元计划进行撤销
///
private void UnSend()
{
try
{
this.ugrd_RollInfo.UpdateData();
System.Data.DataRow[] rows = this.dataSet1.Tables[0].Select("CHK='TRUE'");
if (rows.Length == 0)
{
MessageBox.Show("请选择你要下发的计划", Common.FixDBManager.MsgCaption);
return;
}
string RollNO = rows[0]["ROLL_MANA_NO"].ToString();
string ex = "";
Hashtable paramHsmp = new Hashtable();
paramHsmp.Add("i1", RollNO);
paramHsmp.Add("i2", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
paramHsmp.Add("o3", ex);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIB.COM.ComDBProcedure";
ccp.MethodName = "doXmlProcedure";
ccp.ServerParams = new Object[] { "UIF042020.Usd_RollUnit", paramHsmp };
CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
{
MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
}
else
{
DoQuery();
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
#endregion
#region "Init"
private void UIF042020_Load(object sender, EventArgs e)
{
try
{
GetInitData();
Init_Grid();
Common.FixDBManager.Init_ComboControl(this.comboPosition, "SCM_BASE_INFO", "NAME_", "ID_", ref dataSet2);
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
private void GetInitData()
{
try
{
this.dataSet2.Tables[0].Clear();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIF.UIF04.UIF042020";
ccp.MethodName = "queryInitdata";
ccp.ServerParams = new object[] { };
ccp.SourceDataTable = this.dataSet2.Tables[0];
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
dataSet2.Tables[0].TableName = "SCM_BASE_INFO";
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
private void Init_Grid()
{
try
{
Common.FixDBManager.SetGridCheckBox("CHK", "C_TBF03_SPEC_ROLL", 0, this.ugrd_RollInfo);
foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ugrd_RollInfo.DisplayLayout.Bands[0].Columns)
{
if (col.Key == "CHK")
{
Common.FixDBManager.SetCellActivation(col.Key, "C_TBF03_SPEC_ROLL", this.ugrd_RollInfo, "ALLOWEDIT");
}
else
{
Common.FixDBManager.SetCellActivation(col.Key, "C_TBF03_SPEC_ROLL", this.ugrd_RollInfo, "ALLOWEDIT");
}
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
#endregion
#region "Grid Event"
private void ugrd_RollInfo_AfterRowActivate(object sender, EventArgs e)
{
try
{
this.textTarget.Text = Convert.ToString(this.ugrd_RollInfo.ActiveRow.Cells["ROLL_MANA_NO"].Value);
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
private void ugrd_RollInfo_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
{
try
{
this.ugrd_RollInfo.UpdateData();
if (e.Cell.Column.Key == "CHK")
{
if (e.Cell.Value.ToString().ToUpper() == "TRUE")
{
string RollNO = e.Cell.Row.Cells["ROLL_MANA_NO"].Value.ToString();
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_RollInfo.Rows)
{
if (row.Cells["ROLL_MANA_NO"].Value.ToString() != RollNO)
{
row.Cells["CHK"].Value = "FALSE";
}
}
this.ugrd_RollInfo.UpdateData();
}
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
#endregion
}
}