using System; using System.Collections; 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; namespace Core.LZMes.Client.UIF.UIF07 { public partial class UIF071020 : FrmBase { public UIF071020() { InitializeComponent(); } #region "ToolBar Event" public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Delete": Delete(); break; case "Send": Send(); break; case "UnSend": UnSend(); break; case "Exit": this.dataSet1.Dispose(); this.dataSet2.Dispose(); this.dataSet1 = null; this.dataSet2 = null; this.Close(); break; } } /// /// 查询轧辊单元计划信息 /// private void DoQuery() { try { this.dataSet1.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF07.UIF071020"; ccp.MethodName = "queryPkgPlan"; 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["L_TBF03_SPEC_PACK"]); tab0.TableName = "L_TBF03_SPEC_PACK"; this.dataSet1.Tables["L_TBF03_SPEC_PACK"].Merge(tab0); this.dataSet1.AcceptChanges(); }; } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } /// /// 删除轧辊单元计划 /// private void Delete() { try { this.ugrd_CalInfo.UpdateData(); System.Data.DataRow[] rows = this.dataSet1.Tables[0].Select("CHK='TRUE'"); if (rows.Length == 0) { MessageBox.Show("请选择你要下发的计划", Common.FixDBManager.MsgCaption); return; } string pkgNO = rows[0]["PKG_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", pkgNO); 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[] { "UIF071020.Del_PkgUnit", 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_CalInfo.UpdateData(); System.Data.DataRow[] rows = this.dataSet1.Tables[0].Select("CHK='TRUE'"); if (rows.Length == 0) { MessageBox.Show("请选择你要下发的计划", Common.FixDBManager.MsgCaption); return; } string pkgNO = rows[0]["PKG_NO"].ToString(); string ex = ""; #region "校验下发可行性" Hashtable paramHsmp = new Hashtable(); paramHsmp.Add("i1", pkgNO); paramHsmp.Add("o2", ex); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new Object[] { "UIF071020.Send_PkgUnit", 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); return; } #endregion //#region "执行下发" //paramHsmp = new Hashtable(); //paramHsmp.Add("i1", RollNO); //paramHsmp.Add("o2", ex); //ccp = new CoreClientParam(); //ccp.ServerName = "com.core.sip.xinyu.service.CalSendTelegramService"; //ccp.MethodName = "sendPlanByPlanNo"; //ccp.ServerParams = new Object[] { RollNO }; //obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); //if (Common.FixDBManager.CheckNullInt(obj.ReturnObject)<=0) //{ // MessageBox.Show("下发失败", Common.FixDBManager.MsgCaption); //} //else //{ DoQuery(); //} //#endregion } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } /// /// 对已下发(二级)的轧辊单元计划进行撤销 /// private void UnSend() { try { this.ugrd_CalInfo.UpdateData(); System.Data.DataRow[] rows = this.dataSet1.Tables[0].Select("CHK='TRUE'"); if (rows.Length == 0) { MessageBox.Show("请选择你要下发的计划", Common.FixDBManager.MsgCaption); return; } string pkgNO = rows[0]["PKG_NO"].ToString(); string ex = ""; #region "校验下发可行性" Hashtable paramHsmp = new Hashtable(); paramHsmp.Add("i1", pkgNO); paramHsmp.Add("i2", UserInfo.GetUserID()); paramHsmp.Add("o3", ex); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new Object[] { "UIF071020.Usd_PkgUnit", 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); return; } #endregion //#region "执行下发" //paramHsmp = new Hashtable(); //paramHsmp.Add("i1", RollNO); //paramHsmp.Add("o2", ex); //ccp = new CoreClientParam(); //ccp.ServerName = "com.core.sip.xinyu.service.CalSendTelegramService"; //ccp.MethodName = "canclePlanByPlanNo"; //ccp.ServerParams = new Object[] { RollNO }; //obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); //if (Common.FixDBManager.CheckNullInt(obj.ReturnObject) <= 0) //{ // MessageBox.Show("下发失败", Common.FixDBManager.MsgCaption); //} //else //{ DoQuery(); //} //#endregion } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #endregion private void UIF071020_Load(object sender, EventArgs e) { Init_Grid(); } private void Init_Grid() { try { Common.FixDBManager.SetGridCheckBox("CHK", "L_TBF03_SPEC_PACK", 0, this.ugrd_CalInfo); foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ugrd_CalInfo.DisplayLayout.Bands[0].Columns) { if (col.Key == "CHK") { Common.FixDBManager.SetCellActivation(col.Key, "L_TBF03_SPEC_PACK", this.ugrd_CalInfo, "ALLOWEDIT"); } else { Common.FixDBManager.SetCellActivation(col.Key, "L_TBF03_SPEC_PACK", this.ugrd_CalInfo, "ALLOWEDIT"); } } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }