| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- 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<FrgEntrustedBillEntity>(ultraGrid1.DisplayLayout.Bands[0]);
-
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- 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;
- }
- }
- /// <summary>
- /// 查询委托信息
- /// </summary>
- 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<FrgEntrustedBillEntity> listSource = EntityHelper.GetData<FrgEntrustedBillEntity>(
- "Core.LgMes.Server.Stuffmanage.FrmSubContractCheck.doQueryEntrust", new object[] { parmList, startTim, endTim }, this.ob);
- FrgEntrustedBillEntitybindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 数据验证
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 审核通过
- /// </summary>
- private void checkTrue()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> 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);
- }
- }
- }
- /// <summary>
- /// 审核不通过
- /// </summary>
- private void checkFalse()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> 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);
- }
- }
- }
- /// <summary>
- /// 撤销审核
- /// </summary>
- private void cancelCheck()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> 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;
- }
- }
- }
|