FrmHandleJuge.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.YdmBcPipeManage.Entity;
  5. using CoreFS.CA06;
  6. using Infragistics.Win.UltraWinGrid;
  7. using System;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace Core.StlMes.Client.YdmBcPipeManage
  17. {
  18. public partial class FrmHandleJuge : FrmBase
  19. {
  20. public FrmHandleJuge()
  21. {
  22. InitializeComponent();
  23. this.IsLoadUserView = true;
  24. }
  25. public override void ToolBar_Click(object sender, string ToolbarKey)
  26. {
  27. switch (ToolbarKey)
  28. {
  29. case "Query":
  30. doQueryApplyJudge();
  31. break;
  32. case "Juge":
  33. doHandleJuge();
  34. break;
  35. case"CancelJuge":
  36. doCancelHandleJuge();
  37. break;
  38. case"Comfirm":
  39. doComfirmPipe();
  40. break;
  41. case "CancelComfirm":
  42. doCancelComfirmPipe();
  43. break;
  44. case"Export":
  45. exportData();
  46. break;
  47. case "Close":
  48. this.Close();
  49. break;
  50. }
  51. }
  52. /// <summary>
  53. /// 导出
  54. /// </summary>
  55. private void exportData()
  56. {
  57. GridHelper.ulGridToExcel(this.ultraGrid1, "申请判定信息");
  58. }
  59. /// <summary>
  60. /// 查询申请判定信息
  61. /// </summary>
  62. private void doQueryApplyJudge()
  63. {
  64. string jugeNo = "";
  65. string startTim = "";
  66. string endTim = "";
  67. string valueFlag = "";
  68. if (this.chkJudgeStoveNo.Checked && this.uteJudgeStoveNo.Text.Trim() != "")
  69. {
  70. jugeNo = this.uteJudgeStoveNo.Text.Trim();
  71. }
  72. if (this.chkDate.Checked)
  73. {
  74. if (DateTime.Parse(cmbDate.Value.ToString()) > DateTime.Parse(this.cmbEndDate.Value.ToString()))
  75. {
  76. MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
  77. return;
  78. }
  79. else
  80. {
  81. startTim = this.cmbDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
  82. endTim = this.cmbEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
  83. }
  84. }
  85. valueFlag = this.ultraOptionSet1.CheckedItem.DataValue.ToString();
  86. ArrayList list = new ArrayList();
  87. list.Add(jugeNo);
  88. List<QcmZgJugdeApplyEntity> listSource = EntityHelper.GetData<QcmZgJugdeApplyEntity>(
  89. "com.steering.pss.ydm.pipemanage.FrmHandleJuge.doQueryApplyJudge", new object[] { list, startTim, endTim, valueFlag }, this.ob);
  90. QcmZgJugdeApplyEntity1bindingSource.DataSource = listSource;
  91. }
  92. /// <summary>
  93. /// 手工判定
  94. /// </summary>
  95. private void doHandleJuge()
  96. {
  97. this.ultraGrid1.UpdateData();
  98. UltraGridRow Row = this.ultraGrid2.ActiveRow;
  99. UltraGridRow row = this.ultraGrid1.ActiveRow;
  100. if (Row == null) return;
  101. if (!Row.Cells["PlineCode"].Text.Equals("C065") &&!Row.Cells["PlineCode"].Text.Equals("C066"))
  102. {
  103. MessageUtil.ShowTips("不是外购管的不允许手工判定!");
  104. return;
  105. }
  106. ArrayList parm = new ArrayList();
  107. foreach(UltraGridRow uRow in this.ultraGrid1.Rows)
  108. {
  109. QcmZgJugdeApplyEntity qcmZgTity = (QcmZgJugdeApplyEntity)uRow.ListObject;
  110. string qcmZgEntity = JSONFormat.Format(qcmZgTity);
  111. parm.Add(qcmZgEntity);
  112. }
  113. if (MessageUtil.ShowYesNoAndQuestion("是否确认进行手工判定?") == DialogResult.No) return;
  114. CoreClientParam ccp = new CoreClientParam();
  115. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmHandleJuge";
  116. ccp.MethodName = "doHandleApply";
  117. ccp.ServerParams = new object[] { parm,UserInfo.GetUserName() };
  118. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  119. if (ccp.ReturnCode != -1)
  120. {
  121. if (ccp.ReturnInfo.Equals("判定成功!"))
  122. {
  123. doQueryApplyJudge();
  124. MessageUtil.ShowTips(ccp.ReturnInfo);
  125. }
  126. else
  127. {
  128. MessageUtil.ShowTips(ccp.ReturnInfo);
  129. }
  130. }
  131. }
  132. /// <summary>
  133. /// 撤销手工判定
  134. /// </summary>
  135. private void doCancelHandleJuge()
  136. {
  137. this.ultraGrid2.UpdateData();
  138. UltraGridRow row = this.ultraGrid2.ActiveRow;
  139. if (row == null) return;
  140. if (!row.Cells["PlineCode"].Text.Equals("C065") && !row.Cells["PlineCode"].Text.Equals("C066"))
  141. {
  142. MessageUtil.ShowTips("不是外购管的不允许撤销判定!");
  143. return;
  144. }
  145. ArrayList parm = new ArrayList();
  146. foreach (UltraGridRow uRow in this.ultraGrid1.Rows)
  147. {
  148. QcmZgJugdeApplyEntity qcmZgTity = (QcmZgJugdeApplyEntity)uRow.ListObject;
  149. string qcmZgEntity = JSONFormat.Format(qcmZgTity);
  150. parm.Add(qcmZgEntity);
  151. }
  152. if (MessageUtil.ShowYesNoAndQuestion("是否确认进行撤销判定?") == DialogResult.No) return;
  153. CoreClientParam ccp = new CoreClientParam();
  154. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmHandleJuge";
  155. ccp.MethodName = "doCancelHandleApply";
  156. ccp.ServerParams = new object[] { parm };
  157. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  158. if (ccp.ReturnCode != -1)
  159. {
  160. if (ccp.ReturnInfo.Equals("撤销判定成功!"))
  161. {
  162. doQueryApplyJudge();
  163. MessageUtil.ShowTips(ccp.ReturnInfo);
  164. }
  165. else
  166. {
  167. MessageUtil.ShowTips(ccp.ReturnInfo);
  168. }
  169. }
  170. }
  171. /// <summary>
  172. /// 确认缴库
  173. /// </summary>
  174. private void doComfirmPipe()
  175. {
  176. this.ultraGrid1.UpdateData();
  177. this.ultraGrid2.UpdateData();
  178. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  179. if (uRow == null)
  180. {
  181. MessageUtil.ShowTips("请选择需要确认的主信息!");
  182. return;
  183. }
  184. ArrayList parm = new ArrayList();
  185. foreach (UltraGridRow row in this.ultraGrid1.Rows)
  186. {
  187. QcmZgJugdeApplyEntity qcmZgTity = (QcmZgJugdeApplyEntity)row.ListObject;
  188. string qcmZgEntity = JSONFormat.Format(qcmZgTity);
  189. parm.Add(qcmZgEntity);
  190. }
  191. CoreClientParam ccp = new CoreClientParam();
  192. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmHandleJuge";
  193. ccp.MethodName = "doComfirm";
  194. ccp.ServerParams = new object[] { parm,this.UserInfo.GetUserName() };
  195. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  196. if (ccp.ReturnCode != -1)
  197. {
  198. if (ccp.ReturnInfo.Equals("确认成功!"))
  199. {
  200. doQueryApplyJudge();
  201. MessageUtil.ShowTips(ccp.ReturnInfo);
  202. }
  203. else
  204. {
  205. MessageUtil.ShowTips(ccp.ReturnInfo);
  206. }
  207. }
  208. }
  209. /// <summary>
  210. /// 撤销缴库确认
  211. /// </summary>
  212. private void doCancelComfirmPipe()
  213. {
  214. this.ultraGrid1.UpdateData();
  215. this.ultraGrid2.UpdateData();
  216. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  217. if (uRow == null)
  218. {
  219. MessageUtil.ShowTips("请选择需要撤销确认的主信息!");
  220. return;
  221. }
  222. ArrayList parm = new ArrayList();
  223. QcmZgJugdeApplyEntity qcmZgTity = (QcmZgJugdeApplyEntity)uRow.ListObject;
  224. string qcmZgEntity = JSONFormat.Format(qcmZgTity);
  225. parm.Add(qcmZgEntity);
  226. if (MessageUtil.ShowYesNoAndQuestion("是否撤销缴库确认?") == DialogResult.No) return;
  227. CoreClientParam ccp = new CoreClientParam();
  228. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmHandleJuge";
  229. ccp.MethodName = "doCancelComfirm";
  230. ccp.ServerParams = new object[] { parm,this.UserInfo.GetUserName() };
  231. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  232. if (ccp.ReturnCode != -1)
  233. {
  234. if (ccp.ReturnInfo.Equals("撤销成功!"))
  235. {
  236. doQueryApplyJudge();
  237. MessageUtil.ShowTips(ccp.ReturnInfo);
  238. }
  239. else
  240. {
  241. MessageUtil.ShowTips(ccp.ReturnInfo);
  242. }
  243. }
  244. }
  245. private void FrmHandleJuge_Load(object sender, EventArgs e)
  246. {
  247. //base.isLoadStlye = false;
  248. DateTime now = DateTime.Now;
  249. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  250. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  251. this.cmbDate.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  252. this.cmbEndDate.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  253. EntityHelper.ShowGridCaption<QcmZgJugdeApplyEntity>(this.ultraGrid1.DisplayLayout.Bands[0]);
  254. EntityHelper.ShowGridCaption<QcmZgJugdeApplyEntity>(this.ultraGrid2.DisplayLayout.Bands[0]);
  255. }
  256. private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e)
  257. {
  258. this.uteJudgeStoveNo.Enabled = this.chkJudgeStoveNo.Checked;
  259. }
  260. private void chkDate_CheckedChanged(object sender, EventArgs e)
  261. {
  262. this.cmbDate.Enabled = this.cmbEndDate.Enabled = this.chkDate.Checked;
  263. }
  264. private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  265. {
  266. foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
  267. {
  268. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  269. {
  270. uRow.Cells["CHK"].Value = true;
  271. }
  272. }
  273. }
  274. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  275. {
  276. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  277. if(uRow == null)
  278. {
  279. return;
  280. }
  281. ArrayList list = new ArrayList();
  282. list.Add(uRow.Cells["JugdeApplyCode"].Text.ToString());
  283. list.Add(uRow.Cells["JudgeStoveNo"].Text.ToString());
  284. List<QcmZgJugdeApplyEntity> listSource = EntityHelper.GetData<QcmZgJugdeApplyEntity>(
  285. "com.steering.pss.ydm.pipemanage.FrmHandleJuge.doQueryApplyData", new object[] { list }, this.ob);
  286. QcmZgJugdeApplyEntitybindingSource.DataSource = listSource;
  287. }
  288. }
  289. }