using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmBcPipeManage.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.YdmBcPipeManage { public partial class FrmApplyCode : FrmBase { public FrmApplyCode() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmApplyCode_Load(object sender, EventArgs e) { DateTime now = DateTime.Now; DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天 DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天 this.cmbDate.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00"); this.cmbEndDate.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59"); EntityHelper.ShowGridCaption(this.ultraGrid1.DisplayLayout.Bands[0]); initJudgeResult(); } /// /// 加载判定结果 /// private void initJudgeResult() { BaseMethod.InitJudgeResult(utlJudgeResult,ob); BaseMethod.InitJudgeResult(utlJudgeToResult, ob); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQueryApplyJudge(); break; case "Scrap": scrap(); break; case "CancelScrap": cancelScrap(); break; case "Close": this.Close(); break; } } private void doQueryApplyJudge() { string jugeNo = ""; string startTim = ""; string endTim = ""; if (this.chkJudgeStoveNo.Checked && this.uteJudgeStoveNo.Text.Trim() != "") { jugeNo = this.uteJudgeStoveNo.Text.Trim(); } if (this.chkDate.Checked) { if (DateTime.Parse(cmbDate.Value.ToString()) > DateTime.Parse(this.cmbEndDate.Value.ToString())) { MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!"); return; } else { startTim = this.cmbDate.Value.ToString("yyyy-MM-dd HH:mm:ss"); endTim = this.cmbEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss"); } } string judgeResult = utlJudgeResult.Value.ToString2(); string judgeToResult = utlJudgeToResult.Value.ToString2(); ArrayList list = new ArrayList(); list.Add(jugeNo); list.Add(judgeResult); list.Add(judgeToResult); List listSource = EntityHelper.GetData( "com.steering.ydm.bc.FrmApplyCode.doQueryApplyJudge", new object[] { list, startTim, endTim }, this.ob); qcmZgJugdeApplyEntityBindingSource.DataSource = listSource; } private void scrap() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要作废的信息!"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow row in checkMagRows) { QcmZgJugdeApplyEntity qcmEntity = (QcmZgJugdeApplyEntity)row.ListObject; string qcmTity = JSONFormat.Format(qcmEntity); parmList.Add(qcmTity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.ydm.bc.FrmApplyCode"; ccp.MethodName = "scrap"; ccp.ServerParams = new object[] { parmList }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("作废成功!")) { doQueryApplyJudge(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void cancelScrap() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要作废的信息!"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow row in checkMagRows) { QcmZgJugdeApplyEntity qcmEntity = (QcmZgJugdeApplyEntity)row.ListObject; string qcmTity = JSONFormat.Format(qcmEntity); parmList.Add(qcmTity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.ydm.bc.FrmApplyCode"; ccp.MethodName = "cancelScrap"; ccp.ServerParams = new object[] { parmList }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("恢复成功!")) { doQueryApplyJudge(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void chkDate_CheckedChanged(object sender, EventArgs e) { this.cmbDate.Enabled = this.cmbEndDate.Enabled = chkDate.Checked; } private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e) { uteJudgeStoveNo.Enabled = chkJudgeStoveNo.Checked; } private void ultraGrid1_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e) { foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows) { if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) { uRow.Cells["CHK"].Value = true; } } } } }