using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmStuffManage.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.YdmStuffManage { public partial class FrmSubContractCheck : FrmBase { public FrmSubContractCheck() { InitializeComponent(); } private void FrmSubContractCheck_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.StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00"); this.EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59"); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQueryEntrust(); break; case "CheckTrue": checkTrue(); break; case "CheckFalse": checkFalse(); break; case "CancelCheck": cancelCheck(); break; case "Close": this.Close(); break; } } /// /// 查询委托信息 /// private void doQueryEntrust() { string subContractNo = ""; string subContractLog = ""; string startTim = ""; string endTim = ""; if (!CheckQuery()) { return; } if(this.chkTim.Checked) { startTim = this.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); endTim = this.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } if(this.chkSubContractNo.Checked) { subContractNo = this.txtSubContractNo.Text.Trim(); } if(this.chkSubContractLog.Checked) { subContractLog = this.cmbSubContractLog.Value.ToString(); } ArrayList parmList = new ArrayList(); parmList.Add(subContractNo); parmList.Add(subContractLog); List listSource = EntityHelper.GetData( "Core.LgMes.Server.Stuffmanage.FrmSubContractCheck.doQueryEntrust", new object[] { parmList, startTim, endTim }, this.ob); FrgEntrustedBillEntitybindingSource.DataSource = listSource; } /// /// 数据验证 /// /// private bool CheckQuery() { if (this.chkSubContractNo.Checked && string.IsNullOrEmpty(this.txtSubContractNo.Text.Trim())) { MessageUtil.ShowWarning("请输入委托单号!"); return false; } if (this.chkSubContractLog.Checked && string.IsNullOrEmpty(this.cmbSubContractLog.Text.Trim())) { MessageUtil.ShowTips("请选择委托单状态!"); return false; } return true; } /// /// 审核通过 /// private void checkTrue() { this.ultraGrid1.UpdateData(); IQueryable checkMags = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMags.Count() == 0) { MessageUtil.ShowTips("请选择需要审核的委托信息"); return; } ArrayList parmList = new ArrayList(); foreach(UltraGridRow uRow in checkMags) { FrgEntrustedBillEntity frgEntity = (FrgEntrustedBillEntity)uRow.ListObject; string frgEntrustEntity = JSONFormat.Format(frgEntity); parmList.Add(frgEntrustEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmSubContractCheck"; ccp.MethodName = "checkTrue"; ccp.ServerParams = new object[] { parmList, UserInfo.GetUserName() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("审核通过!")) { doQueryEntrust(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 审核不通过 /// private void checkFalse() { this.ultraGrid1.UpdateData(); IQueryable checkMags = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMags.Count() == 0) { MessageUtil.ShowTips("请选择需要审核的委托信息"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow uRow in checkMags) { FrgEntrustedBillEntity frgEntity = (FrgEntrustedBillEntity)uRow.ListObject; string frgEntrustEntity = JSONFormat.Format(frgEntity); parmList.Add(frgEntrustEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmSubContractCheck"; ccp.MethodName = "checkFalse"; ccp.ServerParams = new object[] { parmList, UserInfo.GetUserName() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("审核不通过!")) { doQueryEntrust(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 撤销审核 /// private void cancelCheck() { this.ultraGrid1.UpdateData(); IQueryable checkMags = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMags.Count() == 0) { MessageUtil.ShowTips("请选择需要审核的委托信息"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow uRow in checkMags) { FrgEntrustedBillEntity frgEntity = (FrgEntrustedBillEntity)uRow.ListObject; string frgEntrustEntity = JSONFormat.Format(frgEntity); parmList.Add(frgEntrustEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmSubContractCheck"; ccp.MethodName = "cancelCheck"; ccp.ServerParams = new object[] { parmList}; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销成功!")) { doQueryEntrust(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void chkTim_CheckedChanged(object sender, EventArgs e) { this.StartTime.Enabled = this.EndTime.Enabled = this.chkTim.Checked; } private void chkSubContractNo_CheckedChanged(object sender, EventArgs e) { this.txtSubContractNo.Enabled = this.chkSubContractNo.Checked; } private void chkSubContractLog_CheckedChanged(object sender, EventArgs e) { this.cmbSubContractLog.Enabled = this.chkSubContractLog.Checked; } } }