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.UIF07 { public partial class UIF071010 : FrmBase { public UIF071010() { InitializeComponent(); } private void Get_PKGPlan_Info() { try { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF07.UIF071010"; ccp.MethodName = "queryPkgData"; CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (obj.ReturnInfo.Length == 0) { this.dataSet1.Tables["TAB_CALINFO"].Clear(); System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_CALINFO"]); tab0.TableName = "TAB_CALINFO"; this.dataSet1.Tables["TAB_CALINFO"].Merge(tab0); this.dataSet1.AcceptChanges(); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void Get_PKGPlan_List() { try { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF07.UIF071010"; ccp.MethodName = "queryPkgList"; CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (obj.ReturnInfo.Length == 0) { this.dataSet1.Tables["TAB_CALLIST"].Clear(); System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_CALLIST"]); tab0.TableName = "TAB_CALLIST"; this.dataSet1.Tables["TAB_CALLIST"].Merge(tab0); this.dataSet1.AcceptChanges(); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #region "ToolBar Event" public override void ToolBar_Click(object sender, string ToolbarKey) { try { switch (ToolbarKey) { case "Query": this.dataSet1.Tables["TAB_CCOILLIST"].Clear(); Query(""); break; case "Add": Add(); break; case "Delete": Delete(); break; case "Save": Save(); break; case "Exit": this.dataSet1.Dispose(); this.dataSet1 = null; this.Close(); break; } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void Query(string where) { try { string Condition = GetCondition(where); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF07.UIF071010"; ccp.MethodName = "queryCalCoil"; ccp.ServerParams = new object[] { Condition }; CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (obj.ReturnInfo.Length == 0) { System.Data.DataTable tab0 = 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()); } } private void Add() { 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 paras = ";;"; string paran = "3"; Hashtable paramHsmp = new Hashtable(); paramHsmp.Add("i1", CoilNOS); paramHsmp.Add("i2", rows.Length.ToString()); paramHsmp.Add("i3", paras); paramHsmp.Add("i4", paran); paramHsmp.Add("o5", ex); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new Object[] { "UIF071010.Add_PkgPlan", 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_PKGPlan_Info(); Get_PKGPlan_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()); } } private void Delete() { try { if (this.ugrd_CalList.Selected.Rows.Count == 0) { MessageBox.Show("请选择您要移除的记录"); return; } string pgkNO = this.ugrd_CalList.Rows[0].Cells["PKG_NO"].Value.ToString(); string CoilNOS = ""; string Condition = ""; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_CalList.Selected.Rows) { CoilNOS = CoilNOS + Common.FixDBManager.CheckNullStr(row.Cells["COIL_NO"].Value) + ";"; Condition = Condition + "'" + Common.FixDBManager.CheckNullStr(row.Cells["COIL_NO"].Value) + "',"; } CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1); Condition = Condition.Substring(0, Condition.Length - 1); Condition = " AND A.OLD_SAMPL_NO IN(" + Condition + ") "; Hashtable paramHsmp = new Hashtable(); paramHsmp.Add("i1", pgkNO); paramHsmp.Add("i2", CoilNOS); paramHsmp.Add("i3", this.ugrd_CalList.Selected.Rows.Count.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new Object[] { "UIF071010.Del_PkgPlan", 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_PKGPlan_Info(); Get_PKGPlan_List(); Query(Condition); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void Save() { try { string chk_flag = "00000"; string pgkNO = this.ugrd_CalList.Rows[0].Cells["PKG_NO"].Value.ToString(); //if (this.CHK_CHEM.Checked) // chk_flag = "1"; //else // chk_flag = "0"; //if (this.CHK_PHY.Checked) // chk_flag = chk_flag + "1"; //else // chk_flag = chk_flag + "0"; //chk_flag=chk_flag + "000"; string ex = ""; string chk_ex = ""; Hashtable paramHsmp = new Hashtable(); paramHsmp.Add("i1", pgkNO); paramHsmp.Add("i2", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()); paramHsmp.Add("i3", chk_flag); paramHsmp.Add("o4", chk_ex); paramHsmp.Add("o5", ex); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new Object[] { "UIF071010.Affirm_PkgPlan", 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); if (err.Count > 1 && Common.FixDBManager.CheckNullStr(err[1]) != "1") { MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption); } } else { Get_PKGPlan_Info(); Get_PKGPlan_List(); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #endregion private string GetCondition(string InitCondition) { return ""; //try //{ // if (InitCondition.Length > 0) // return InitCondition; // string Condition = ""; // string tmp = ""; // if (FixDBManager.CheckNullStr(this.Cmb_BM.Text).Length > 0) // { // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.Cmb_BM.CheckedRows) // { // tmp += "'" + row.Cells["SM_CD"].Value.ToString() + "',"; // } // tmp = tmp.Substring(0, tmp.Length - 1); // Condition += " AND B.C_EXTSHAPE_REQ IN(" + tmp + ") "; // } // if (FixDBManager.CheckNullStr(this.Cmb_PM.Text).Length > 0) // { // tmp = ""; // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.Cmb_PM.CheckedRows) // { // tmp += "'" + row.Cells["SM_CD"].Value.ToString() + "',"; // } // tmp = tmp.Substring(0, tmp.Length - 1); // Condition += " AND B.PRODNM_CD IN(" + tmp + ") "; // } // 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; // Condition += " AND B.C_ORD_THK BETWEEN " + min_height + " AND " + 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]; // Condition += " AND B.C_ORD_WTH BETWEEN " + min_width + " AND " + max_width; // string[] senddate = mtx_SendDate.Text.Split('~'); // string min_senddate = senddate[0].Replace(" ", "") == "--" ? "2010-01-01" : senddate[0]; // string max_senddate = senddate[1].Replace(" ", "") == "--" ? "2099-01-01" : senddate[1]; // Condition += " AND B.DEL_TO_DATE BETWEEN TO_CHAR(TO_DATE('" + min_senddate + "','YYYY-MM-DD'),'YYYYMMDD') " // + " AND TO_CHAR(TO_DATE('" + max_senddate + "','YYYY-MM-DD'),'YYYYMMDD') "; // return Condition; //} //catch (System.Exception ex) //{ // System.Diagnostics.Debug.WriteLine(ex.ToString()); // return ""; //} } private void UIF071010_Load(object sender, EventArgs e) { try { Get_PKGPlan_Info(); Get_PKGPlan_List(); 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"); } } this.ugrd_CalList.DisplayLayout.Override.SupportDataErrorInfo = Infragistics.Win.UltraWinGrid.SupportDataErrorInfo.RowsAndCells; } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } /// /// 修改钢卷计划包装等级 /// /// /// private void button1_Click(object sender, EventArgs e) { string coilNo = textBox3.Text.Trim(); if (coilNo != null && coilNo != "") { string pkgLevel = ultraComboEditor2.Value != null ? ultraComboEditor2.Value.ToString() : "1"; string pgkNO = this.ugrd_CalList.Rows[0].Cells["PKG_NO"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF07.UIF071010"; ccp.MethodName = "updatePkgLevel"; ccp.ServerParams = new Object[] { coilNo,pgkNO,pkgLevel }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); Get_PKGPlan_List(); } else { MessageBox.Show("请选择需要修改包装等级的钢卷!"); } } private void ugrd_CalList_AfterRowActivate(object sender, EventArgs e) { textBox3.Text = ugrd_CalList.ActiveRow.Cells["COIL_NO"].Value.ToString(); ultraComboEditor2.Text = ugrd_CalList.ActiveRow.Cells["PACK_METHOD"].Value.ToString(); } } }