using com.steering.mes.zgmil.entity; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.ZGMil.Common; using Core.StlMes.Client.ZGMil.Entity; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; 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; namespace Core.StlMes.Client.ZGMil.Report { public partial class FrmMilCheckDeatilSimple : FrmBase { private string departm = ""; private string plineCode = ""; private string[] plineCodes = { }; public FrmMilCheckDeatilSimple() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmMilCheckDeatilSimple_Load(object sender, EventArgs e) { cmbDate.Value = DateTime.Parse(DateTime.Today.ToString()); NativeMethodNew na = new NativeMethodNew(this.ob); departm = UserInfo.GetDepartment(); //plineCode = na.GetPCode(departm);//获取 用户 对应的产线 plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); DateTime now = DateTime.Now; DateTime date = new DateTime(now.Year, now.Month, 1); cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd")); cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")); //cmbEndDate.Value = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 06:59:59")); //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 07:00:00")); //TubeRoll.SetComboItemHeight(uteLotNo); //TubeRoll.SetComboItemHeight(cmbBz); //加载产线 //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getPlineNameZG", new object[] { plineCodes }, ob); //if (dt != null && dt.Rows.Count > 0) //{ // txt_PlinCode.DataSource = dt; // txt_PlinCode.ValueMember = "PLINE_CODE"; // txt_PlinCode.DisplayMember = "PLINE_NAME"; //} } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQuery(); break; case "Export": ExportData(); break; case "Update": doUpdate(); break; case "Close": this.Close(); break; } } /// /// 查询 /// private void doQuery() { string date = ""; string endDate = ""; string judgeStoveNo = ""; string LotNo = ""; string ContractNo = ""; if (chkDate.Checked) { if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0) { MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!"); return; } else { date = cmbDate.Value.ToString("yyyyMMdd0000"); endDate = cmbEndDate.Value.ToString("yyyyMMdd2359"); } } if (chkjudgeStoveNo.Checked) { judgeStoveNo = txtjudgeStoveNo.Text.ToString(); } List listSource = EntityHelper.GetData( "com.steering.mes.zgmil.report.FrmMilDateStatistics.getMilCheckDeatilSimple", new object[] { judgeStoveNo }, this.ob); bindingSource1.DataSource = listSource; GridHelper.RefreshAndAutoSize(this.ultraGrid1); } /// /// 查询条件 /// /// /// private void chkDate_CheckedChanged(object sender, EventArgs e) { if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; } if (chkjudgeStoveNo.Checked) { txtjudgeStoveNo.Enabled = true; } else { txtjudgeStoveNo.Enabled = false; } } /// /// 导出 /// private void ExportData() { GridHelper.ulGridToExcel(ultraGrid1, "调度停机统计"); } private void doUpdate() { this.ultraGrid1.UpdateData(); ArrayList list = new ArrayList(); IQueryable checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkRows.Count() == 0) { MessageUtil.ShowTips("请勾选要修改的信息"); return; } foreach (UltraGridRow row in checkRows) { MilCheckDeatilSimpleEntity hsEntity = (MilCheckDeatilSimpleEntity)row.ListObject; if (hsEntity.Validflag.Equals("有效")) { hsEntity.Validflag = "1"; } else if (hsEntity.Validflag.Equals("无效")) { hsEntity.Validflag = "0"; } string httEntity = JSONFormat.Format(hsEntity); list.Add(httEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.report.FrmMilDateStatistics"; ccp.MethodName = "doUpdateMilCheckDeatilSimple"; ccp.ServerParams = new object[] { list }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { doQuery(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } } }