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 Infragistics.Win.UltraWinEditors; using Core.StlMes.Client.ZGMil.Signature; using Core.StlMes.Client.ZGMil.Entity; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Tool; using Core.Mes.Client.Comm.Server; using CoreFS.SA06; using System.Collections; using Infragistics.Win; using System.IO; namespace Core.StlMes.Client.ZGMil { public partial class FrmReportManage : FrmBase { private string departm = ""; UltraComboEditor ucePline = new UltraComboEditor();//产线名称 private string plineCode; public FrmReportManage() { InitializeComponent(); } private void FrmTubeRollFileManage_Load(object sender, EventArgs e) { NativeMethodNew na = new NativeMethodNew(this.ob); departm = UserInfo.GetDepartment(); plineCode = na.GetPCode(departm);//获取 用户 对应的产线 //plineCode = na.GetPCodePline(this.ValidDataPurviewIds);//获取产线方法 TubeRoll.InitComboEditorValue(ucePline, "com.steering.mes.signature.FrmTubeRollFileManage.queryPlineCode", "PLINE_CODE", this.ob, false, plineCode); TubeRoll.BindColumn(ucePline, "PLINE_CODE", this.Controls, this.ultraGrid1, 0); //ultraPlineCode.Items.Remove() DoQuery(); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": DoQuery(); break; case "Add": DoAdd(); break; case "Delete": DoDelete(); break; case "Update": DoUpdare(); break; case "Close": this.Close(); break; } } /// /// 查询 /// private void DoQuery() { DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmReportManage.queryReportManage", new Object[] { plineCode, this.UserInfo.GetUserName() }, ob); GridHelper.CopyDataToDatatable(dt, this.dataTable1, true); foreach (UltraGridRow ugr in ultraGrid1.Rows) { ugr.Cells["PLINE_CODE"].Appearance.BackColor =Color.Transparent; ugr.Cells["PLINE_CODE"].Appearance.BackHatchStyle = BackHatchStyle.Default; ugr.Cells["PLINE_CODE"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; //ugr.Cells["COL_GROUP"].Appearance.BackColor = Color.Transparent; //ugr.Cells["COL_GROUP"].Appearance.BackHatchStyle = BackHatchStyle.Default; //ugr.Cells["COL_GROUP"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; } } /// /// 新增 /// private void DoAdd() { ultraGrid1.UpdateData(); ArrayList list1 = new ArrayList(); string pline = ""; string reportNo = ""; string reportNoNew = ""; string reportNoTime = ""; //int count = 0; IQueryable uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (uGrid.Count() == 0) { MessageUtil.ShowTips("请选择要新增的数据!"); return; } foreach (UltraGridRow ugr in uGrid) { pline = ugr.Cells["PLINE_CODE"].Value.ToString(); reportNo = ugr.Cells["REPORT_NO"].Value.ToString(); reportNoNew = ugr.Cells["REPORT_NO_NEW"].Value.ToString(); if (ugr.Cells["REPORT_NO_TIME"].Value.ToString().Equals("")) { MessageUtil.ShowTips("请选择生效日期!"); return; } reportNoTime = Convert.ToDateTime(ugr.Cells["REPORT_NO_TIME"].Value.ToString()).ToString("yyyyMMdd"); if (pline == "") { MessageUtil.ShowTips("产线不能为空!"); return; } if (reportNo == "") { MessageUtil.ShowTips("报表不能为空!"); return; } if (reportNoNew == "") { MessageUtil.ShowTips("生效编号不能为空!"); return; } if (reportNo == "") { MessageUtil.ShowTips("旧编号不能为空!"); return; } //if (ugr.Cells["PROCESS_NO"].Text.Trim()!= "") { //MessageUtil.ShowTips("工序名称不能为空!"); return; // gx = ugr.Cells["PROCESS_NO"].Value.ToString(); //} //DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmTubeRollFileManage.queryMinStgnature2", new object[] {ugr.Cells["USER_ID"].Text.Trim()}, ob); //if (dt.Rows.Count > 0) { MessageUtil.ShowTips("已存在数据,不能进行此操作!"); return; } ArrayList list = new ArrayList(); list.Add(pline); list.Add(reportNo); list.Add(reportNoNew); list.Add(reportNoTime); list.Add(ugr.Cells["REPORT_NAME"].Value.ToString()); list.Add(ugr.Cells["REMARK"].Text.Trim()); list.Add(UserInfo.GetUserName()); list.Add(ugr.Cells["GENERATE_STATION"].Text.Trim()); list.Add(ugr.Cells["RECEIVING_STATION"].Text.Trim()); list.Add(ugr.Cells["SAVE_STATION"].Text.Trim()); list.Add(ugr.Cells["STORAGE_LIFE"].Text.Trim()); list.Add(ugr.Cells["INTERMEDIARY"].Text.Trim()); list1.Add(list); } //if (MessageUtil.ShowYesNoAndQuestion("是否保存签名?") == System.Windows.Forms.DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.signature.FrmReportManage"; ccp.MethodName = "addReportManage"; ccp.ServerParams = new object[] { list1 }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("新增成功!")) { DoQuery(); } } } /// /// 删除 /// private void DoDelete() { ultraGrid1.UpdateData(); ArrayList pram1 = new ArrayList(); IQueryable uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (uGrid.Count() == 0) { MessageUtil.ShowTips("请选择要删除的数据!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确认删除信息?") == System.Windows.Forms.DialogResult.No) { return; } foreach (UltraGridRow ugr in uGrid) { ArrayList pram = new ArrayList(); pram.Add(ugr.Cells["PLINE_CODE"].Value.ToString()); pram.Add(ugr.Cells["REPORT_NAME"].Value.ToString()); pram1.Add(pram); } int countinsert = ServerHelper.SetData("com.steering.mes.signature.FrmReportManage.deleteReportManage", new Object[] { pram1 }, this.ob); if (countinsert > 0) { MessageUtil.ShowTips("删除成功!"); } else { MessageUtil.ShowTips("删除失败!"); return; } DoQuery(); } /// /// 修改 /// private void DoUpdare() { ultraGrid1.UpdateData(); string pline = ""; string reportNo = ""; string reportNoNew = ""; string reportNoTime = ""; //int count = 0; ArrayList pram1 = new ArrayList(); IQueryable uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (uGrid.Count() == 0) { MessageUtil.ShowTips("请选择修改的数据!"); return; } foreach (UltraGridRow ugr in uGrid) { pline = ugr.Cells["PLINE_CODE"].Value.ToString(); reportNo = ugr.Cells["REPORT_NO"].Value.ToString(); reportNoNew = ugr.Cells["REPORT_NO_NEW"].Value.ToString(); if (ugr.Cells["REPORT_NO_TIME"].Value.ToString().Equals("")) { MessageUtil.ShowTips("请选择生效日期!"); return; } reportNoTime = Convert.ToDateTime(ugr.Cells["REPORT_NO_TIME"].Value.ToString()).ToString("yyyyMMdd"); if (pline == "") { MessageUtil.ShowTips("产线不能为空!"); return; } if (reportNo == "") { MessageUtil.ShowTips("报表不能为空!"); return; } if (reportNoNew == "") { MessageUtil.ShowTips("生效编号不能为空!"); return; } if (reportNo == "") { MessageUtil.ShowTips("旧编号不能为空!"); return; } ArrayList list = new ArrayList(); list.Add(reportNo); list.Add(reportNoNew); list.Add(reportNoTime); list.Add(UserInfo.GetUserName()); list.Add(ugr.Cells["REMARK"].Text.Trim()); list.Add(ugr.Cells["GENERATE_STATION"].Text.Trim()); list.Add(ugr.Cells["RECEIVING_STATION"].Text.Trim()); list.Add(ugr.Cells["SAVE_STATION"].Text.Trim()); list.Add(ugr.Cells["STORAGE_LIFE"].Text.Trim()); list.Add(ugr.Cells["INTERMEDIARY"].Text.Trim()); list.Add(pline); list.Add(ugr.Cells["REPORT_NAME"].Value.ToString()); pram1.Add(list); } if (MessageUtil.ShowYesNoAndQuestion("是否修报表信息?") == System.Windows.Forms.DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.signature.FrmReportManage"; ccp.MethodName = "updateReportManage"; ccp.ServerParams = new object[] { pram1 }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("修改成功!")) { DoQuery(); } } } private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { try { ultraGrid1.UpdateData(); foreach (UltraGridRow r in ultraGrid1.Rows) { r.Cells["CHK"].Value = r.Selected; } } catch { } } } }