using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmPipeManage; 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.YdmPipeReport { public partial class FrmSingleReview : FrmBase { public FrmSingleReview() { InitializeComponent(); } private void FrmSingleReview_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);//当月最后一天 StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00"); EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59"); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": DoQuery(); break; case "ReviewBy": DoReviewBy(); break; case "AuditBy": DoAuditBy(); break; case "Export"://导出 DoExport(); break; case "Close": this.Close(); break; } } /// /// 查询 /// private void DoQuery() { if (!CheckQuery()) return; string stratTime = "1999-01-01 00:00:00"; string endTime = "2999-12-31 23:59:59"; string orderNo = ""; string orderNoReal = ""; string orderStrats = ""; if (chkDate.Checked) { stratTime = StartTime.Value.ToString(); endTime = EndTime.Value.ToString(); } if (chkOrder.Checked) { orderNo = cmbOrder.Text.Trim(); } if (chkOrderNo.Checked) { orderNoReal = cmbOrderNo.Text.Trim(); } if (chkOrderstatus.Checked) { orderStrats = Txtorderstatus.Value.ToString(); } DataTable dt=new DataTable(); dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmSingleReview.getDoQueryRev", new object[] { stratTime, endTime, orderNo, orderNoReal, orderStrats }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true); if (dt.Rows.Count <= 0) { dt = new DataTable(); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); } } /// /// 评审通过 /// private void DoReviewBy() { UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) return; ultraGrid2.UpdateData(); int count = 0; ArrayList list = new ArrayList(); string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); foreach (UltraGridRow ugr in ultraGrid2.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { count += 1; ArrayList list1 = new ArrayList(); list1.Add(ugr.Cells["REVIEW_NO"].Value.ToString()); list1.Add("X"); list1.Add(this.UserInfo.GetUserName()); list1.Add(time); list.Add(list1); } } if (count == 0) { MessageUtil.ShowTips("请选择评审单主信息!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否评审通过?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); ccp.ServerName = "com.steering.pss.ydm.Report.FrmSingleReview"; ccp.MethodName = "doReviewBy"; ccp.ServerParams = new object[] { list }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception ex) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("评审通过!")) { DoQuery(); } } } /// /// 评审不通过 /// private void DoAuditBy() { UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) return; ultraGrid2.UpdateData(); int count = 0; ArrayList list = new ArrayList(); string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); foreach (UltraGridRow ugr in ultraGrid2.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { count += 1; ArrayList list1 = new ArrayList(); list1.Add(ugr.Cells["REVIEW_NO"].Value.ToString()); list1.Add("X"); list1.Add(this.UserInfo.GetUserName()); list1.Add(time); list.Add(list1); } } if (count == 0) { MessageUtil.ShowTips("请选择评审单主信息!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否评审不通过?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); ccp.ServerName = "com.steering.pss.ydm.Report.FrmSingleReview"; ccp.MethodName = "doAuditBy"; ccp.ServerParams = new object[] { list }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception ex) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("评审不通过成功!")) { DoQuery(); } } } ///查询时验证必填项 private bool CheckQuery() { if (DataTimeUtil.JudgeTime(DateTime.Parse(StartTime.Value.ToString()), DateTime.Parse(EndTime.Value.ToString())) == 0) { MessageUtil.ShowTips("开始时间不能大于结束时间!"); return false; } if (chkOrder.Checked && string.IsNullOrEmpty(cmbOrder.Text.Trim())) { MessageBox.Show("请输入评审单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (chkOrderstatus.Checked && string.IsNullOrEmpty(Txtorderstatus.Text.Trim())) { MessageBox.Show("请选择评审状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } return true; } private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { UltraGridRow urg = ultraGrid2.ActiveRow; DataTable dt; if (urg == null) return; dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmSingleReview.getDoQueryOrderRev", new object[] { urg.Cells["REVIEW_NO"].Value.ToString() }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); } private void DoExport() { GridHelper.ulGridToExcel(ultraGrid2, "合同注销评审主信息"); } private void chkDate_CheckedChanged(object sender, EventArgs e) { if (chkDate.Checked) { StartTime.Enabled = true; EndTime.Enabled = true; } else { StartTime.Enabled = false; EndTime.Enabled = false; } if (chkOrder.Checked) { cmbOrder.Enabled = true; } else { cmbOrder.Enabled = false; } if (chkOrderstatus.Checked) { Txtorderstatus.Enabled = true; } else { Txtorderstatus.Enabled = false; } if (chkOrderNo.Checked) { cmbOrderNo.Enabled = true; } else { cmbOrderNo.Enabled = false; } } } }