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; using Common; namespace Core.LZMes.Client.UIF { public partial class UIF051020 : CoreFS.CA06.FrmBase { public UIF051020() { InitializeComponent(); } #region "Init" private void UIF051020_Load(object sender, EventArgs e) { ultraComboEditor1.SelectedIndex = 0; try { Get_BaseData(); InitGrid(); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void Get_BaseData() { try { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF05.UIF051020"; ccp.MethodName = "Query_BaseData"; 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["TAB_PM"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(rtnobj[0] as System.Collections.ArrayList, this.dataSet1.Tables["TAB_PM"]); tab0.TableName = "TAB_PM"; this.dataSet1.Tables["TAB_PM"].Merge(tab0); } if (rtnobj[1] != null) { this.dataSet1.Tables["TAB_YY"].Clear(); System.Data.DataTable tab1 = Common.FixDBManager.ConvertToDataTable(rtnobj[1] as System.Collections.ArrayList, this.dataSet1.Tables["TAB_YY"]); tab1.TableName = "TAB_YY"; this.dataSet1.Tables["TAB_YY"].Merge(tab1); //this.dataSet1.Tables["TAB_YY2"] = this.dataSet1.Tables["TAB_YY"].Copy(); } } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void InitGrid() { try { Common.FixDBManager.SetGridCheckBox("FLAG", "TAB_CCOILLIST", 25, this.ugrd_CoilList); string ColumnName = ""; for (int i = 0; i < this.ugrd_CoilList.DisplayLayout.Bands[0].Columns.Count; i++) { ColumnName = this.ugrd_CoilList.DisplayLayout.Bands[0].Columns[i].Key; if (ColumnName == "FLAG") { Common.FixDBManager.SetCellActivation(ColumnName, "TAB_CCOILLIST", this.ugrd_CoilList, "ALLOWEDIT"); } else { Common.FixDBManager.SetCellActivation(ColumnName, "TAB_CCOILLIST", this.ugrd_CoilList, "ACTIVATEONLY"); } } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #endregion #region "ToolBar Event" public override void ToolBar_Click(object sender, string ToolbarKey) { try { switch (ToolbarKey.ToString()) { case "CQuery": CQuery(); break; case "DQuery": DQuery(); break; case "Declare": Declare(); break; case "Delete": Delete(); break; } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } public void CQuery() { try { string condition = GetCondition("1"); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF05.UIF051020"; ccp.MethodName = "Get_CCoilData"; ccp.ServerParams = new object[] { condition }; CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (obj.ReturnInfo.Length == 0) { this.dataSet1.Tables["TAB_CCOILLIST"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_CCOILLIST"]); tab0.TableName = "TAB_CCOILLIST"; this.dataSet1.Tables["TAB_CCOILLIST"].Merge(tab0); this.dataSet1.AcceptChanges(); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } public void DQuery() { try { string condition = GetCondition("0"); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF05.UIF051020"; ccp.MethodName = "Get_DCLData"; ccp.ServerParams = new object[] { condition }; CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (obj.ReturnInfo.Length == 0) { this.dataSet1.Tables["L_TBF03_CAL_DECLARE"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["L_TBF03_CAL_DECLARE"]); tab0.TableName = "L_TBF03_CAL_DECLARE"; this.dataSet1.Tables["L_TBF03_CAL_DECLARE"].Merge(tab0); this.dataSet1.AcceptChanges(); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } public void Declare() { try { this.ugrd_CoilList.UpdateData(); System.Data.DataRow[] rows = this.dataSet1.Tables["TAB_CCOILLIST"].Select("FLAG='TRUE'"); if (rows.Length == 0) { MessageBox.Show("您还未选择冷卷卷,请选择"); return; } string CoilNOS = ""; string ex = ""; for (int i = 0; i < this.ugrd_CoilList.Rows.Count; i++) { if (Common.FixDBManager.CheckNullStr(ugrd_CoilList.Rows[i].Cells["FLAG"].Value).ToUpper() == "TRUE") { CoilNOS = CoilNOS + ugrd_CoilList.Rows[i].Cells["COIL_NO"].Value.ToString() + ";"; } } CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1); string dclRs = Cmb_DLCReason.Text.Trim(); string dclMemo = txt_DCLMemo.Text.Trim(); string dclType = ultraComboEditor1.Value.ToString(); Hashtable paramHsmp = new Hashtable(); paramHsmp.Add("i1", CoilNOS); paramHsmp.Add("i2", rows.Length.ToString()); paramHsmp.Add("i3", UserInfo.GetUserID()); paramHsmp.Add("i4", UserInfo.GetUserOrder()); paramHsmp.Add("i5", UserInfo.GetUserGroup()); paramHsmp.Add("i6", dclRs); paramHsmp.Add("i7", dclMemo); paramHsmp.Add("i8", dclType); paramHsmp.Add("o9", ex); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new Object[] { "UIF051020.Add", 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 { //Get_CALPlan_Info(); //Get_CALPlan_List(); for (int i = rows.Length - 1; i >= 0; i--) { this.dataSet1.Tables["TAB_CCOILLIST"].Rows.Remove(rows[i]); } this.dataSet1.Tables["TAB_CCOILLIST"].AcceptChanges(); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } public void Delete() { } private string GetCondition(string type) { string condition = ""; try { string[] height = txt_Height.Text.Split('~'); string min_height = height[0].Replace(" ", ""); min_height = min_height == "." ? "0" : min_height; string max_height = height[1].Replace(" ", ""); max_height = max_height == "." ? "99" : max_height; string[] width = txt_Width.Text.Split('~'); string min_width = width[0].Replace(" ", "").Length == 0 ? "0" : width[0]; string max_width = width[1].Replace(" ", "").Length == 0 ? "1500" : width[1]; if (type == "1") { if (txt_CCoilNO.Text.Trim().Length > 0) condition = " AND A.OLD_SAMPL_NO LIKE '" + txt_CCoilNO.Text.Trim() + "%' "; if (Cmb_STL.Text.Trim().Length > 0) condition += " AND A.SPEC_STL_GRD LIKE '" + Cmb_STL.Text.Trim() + "%' "; condition += " AND A.COIL_THK BETWEEN " + min_height + " AND " + max_height; condition += " AND A.COIL_WTH BETWEEN " + min_width + " AND " + max_width; } else { if (txt_CCoilNO.Text.Trim().Length > 0) condition = " AND A.COIL_NO LIKE '" + txt_CCoilNO.Text.Trim() + "%' "; if (Cmb_STL.Text.Trim().Length > 0) condition += " AND F.SPEC_STL_GRD LIKE '" + Cmb_STL.Text.Trim() + "%' "; condition += " AND F.COIL_THK BETWEEN " + min_height + " AND " + max_height; condition += " AND F.COIL_WTH BETWEEN " + min_width + " AND " + max_width; if (Common.FixDBManager.CheckNullStr(Cmb_QDCLReason.Value).Length > 0) condition += " AND F.DCL_REASON='" + Common.FixDBManager.CheckNullStr(Cmb_QDCLReason.Value) + "'"; } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } return condition; } #endregion } }