FrmSubContractCheck.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. using Core.Mes.Client.Comm.Format;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.YdmStuffManage.Entity;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. namespace Core.StlMes.Client.YdmStuffManage
  16. {
  17. public partial class FrmSubContractCheck : FrmBase
  18. {
  19. public FrmSubContractCheck()
  20. {
  21. InitializeComponent();
  22. }
  23. private void FrmSubContractCheck_Load(object sender, EventArgs e)
  24. {
  25. DateTime now = DateTime.Now;
  26. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  27. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  28. this.StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  29. this.EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  30. EntityHelper.ShowGridCaption<FrgEntrustedBillEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  31. }
  32. /// <summary>
  33. /// 重写基类方法
  34. /// </summary>
  35. /// <param name="sender"></param>
  36. /// <param name="ToolbarKey"></param>
  37. public override void ToolBar_Click(object sender, string ToolbarKey)
  38. {
  39. switch (ToolbarKey)
  40. {
  41. case "Query":
  42. doQueryEntrust();
  43. break;
  44. case "CheckTrue":
  45. checkTrue();
  46. break;
  47. case "CheckFalse":
  48. checkFalse();
  49. break;
  50. case "CancelCheck":
  51. cancelCheck();
  52. break;
  53. case "Close":
  54. this.Close();
  55. break;
  56. }
  57. }
  58. /// <summary>
  59. /// 查询委托信息
  60. /// </summary>
  61. private void doQueryEntrust()
  62. {
  63. string subContractNo = "";
  64. string subContractLog = "";
  65. string startTim = "";
  66. string endTim = "";
  67. if (!CheckQuery())
  68. {
  69. return;
  70. }
  71. if(this.chkTim.Checked)
  72. {
  73. startTim = this.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  74. endTim = this.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  75. }
  76. if(this.chkSubContractNo.Checked)
  77. {
  78. subContractNo = this.txtSubContractNo.Text.Trim();
  79. }
  80. if(this.chkSubContractLog.Checked)
  81. {
  82. subContractLog = this.cmbSubContractLog.Value.ToString();
  83. }
  84. ArrayList parmList = new ArrayList();
  85. parmList.Add(subContractNo);
  86. parmList.Add(subContractLog);
  87. List<FrgEntrustedBillEntity> listSource = EntityHelper.GetData<FrgEntrustedBillEntity>(
  88. "Core.LgMes.Server.Stuffmanage.FrmSubContractCheck.doQueryEntrust", new object[] { parmList, startTim, endTim }, this.ob);
  89. FrgEntrustedBillEntitybindingSource.DataSource = listSource;
  90. }
  91. /// <summary>
  92. /// 数据验证
  93. /// </summary>
  94. /// <returns></returns>
  95. private bool CheckQuery()
  96. {
  97. if (this.chkSubContractNo.Checked && string.IsNullOrEmpty(this.txtSubContractNo.Text.Trim()))
  98. {
  99. MessageUtil.ShowWarning("请输入委托单号!");
  100. return false;
  101. }
  102. if (this.chkSubContractLog.Checked && string.IsNullOrEmpty(this.cmbSubContractLog.Text.Trim()))
  103. {
  104. MessageUtil.ShowTips("请选择委托单状态!");
  105. return false;
  106. }
  107. return true;
  108. }
  109. /// <summary>
  110. /// 审核通过
  111. /// </summary>
  112. private void checkTrue()
  113. {
  114. this.ultraGrid1.UpdateData();
  115. IQueryable<UltraGridRow> checkMags = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  116. if (checkMags.Count() == 0)
  117. {
  118. MessageUtil.ShowTips("请选择需要审核的委托信息");
  119. return;
  120. }
  121. ArrayList parmList = new ArrayList();
  122. foreach(UltraGridRow uRow in checkMags)
  123. {
  124. FrgEntrustedBillEntity frgEntity = (FrgEntrustedBillEntity)uRow.ListObject;
  125. string frgEntrustEntity = JSONFormat.Format(frgEntity);
  126. parmList.Add(frgEntrustEntity);
  127. }
  128. CoreClientParam ccp = new CoreClientParam();
  129. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmSubContractCheck";
  130. ccp.MethodName = "checkTrue";
  131. ccp.ServerParams = new object[] { parmList, UserInfo.GetUserName() };
  132. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  133. if (ccp.ReturnCode != -1)
  134. {
  135. if (ccp.ReturnInfo.Equals("审核通过!"))
  136. {
  137. doQueryEntrust();
  138. MessageUtil.ShowTips(ccp.ReturnInfo);
  139. }
  140. else
  141. {
  142. MessageUtil.ShowTips(ccp.ReturnInfo);
  143. }
  144. }
  145. }
  146. /// <summary>
  147. /// 审核不通过
  148. /// </summary>
  149. private void checkFalse()
  150. {
  151. this.ultraGrid1.UpdateData();
  152. IQueryable<UltraGridRow> checkMags = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  153. if (checkMags.Count() == 0)
  154. {
  155. MessageUtil.ShowTips("请选择需要审核的委托信息");
  156. return;
  157. }
  158. ArrayList parmList = new ArrayList();
  159. foreach (UltraGridRow uRow in checkMags)
  160. {
  161. FrgEntrustedBillEntity frgEntity = (FrgEntrustedBillEntity)uRow.ListObject;
  162. string frgEntrustEntity = JSONFormat.Format(frgEntity);
  163. parmList.Add(frgEntrustEntity);
  164. }
  165. CoreClientParam ccp = new CoreClientParam();
  166. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmSubContractCheck";
  167. ccp.MethodName = "checkFalse";
  168. ccp.ServerParams = new object[] { parmList, UserInfo.GetUserName() };
  169. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  170. if (ccp.ReturnCode != -1)
  171. {
  172. if (ccp.ReturnInfo.Equals("审核不通过!"))
  173. {
  174. doQueryEntrust();
  175. MessageUtil.ShowTips(ccp.ReturnInfo);
  176. }
  177. else
  178. {
  179. MessageUtil.ShowTips(ccp.ReturnInfo);
  180. }
  181. }
  182. }
  183. /// <summary>
  184. /// 撤销审核
  185. /// </summary>
  186. private void cancelCheck()
  187. {
  188. this.ultraGrid1.UpdateData();
  189. IQueryable<UltraGridRow> checkMags = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  190. if (checkMags.Count() == 0)
  191. {
  192. MessageUtil.ShowTips("请选择需要审核的委托信息");
  193. return;
  194. }
  195. ArrayList parmList = new ArrayList();
  196. foreach (UltraGridRow uRow in checkMags)
  197. {
  198. FrgEntrustedBillEntity frgEntity = (FrgEntrustedBillEntity)uRow.ListObject;
  199. string frgEntrustEntity = JSONFormat.Format(frgEntity);
  200. parmList.Add(frgEntrustEntity);
  201. }
  202. CoreClientParam ccp = new CoreClientParam();
  203. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmSubContractCheck";
  204. ccp.MethodName = "cancelCheck";
  205. ccp.ServerParams = new object[] { parmList};
  206. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  207. if (ccp.ReturnCode != -1)
  208. {
  209. if (ccp.ReturnInfo.Equals("撤销成功!"))
  210. {
  211. doQueryEntrust();
  212. MessageUtil.ShowTips(ccp.ReturnInfo);
  213. }
  214. else
  215. {
  216. MessageUtil.ShowTips(ccp.ReturnInfo);
  217. }
  218. }
  219. }
  220. private void chkTim_CheckedChanged(object sender, EventArgs e)
  221. {
  222. this.StartTime.Enabled = this.EndTime.Enabled = this.chkTim.Checked;
  223. }
  224. private void chkSubContractNo_CheckedChanged(object sender, EventArgs e)
  225. {
  226. this.txtSubContractNo.Enabled = this.chkSubContractNo.Checked;
  227. }
  228. private void chkSubContractLog_CheckedChanged(object sender, EventArgs e)
  229. {
  230. this.cmbSubContractLog.Enabled = this.chkSubContractLog.Checked;
  231. }
  232. }
  233. }