FrmLikuExamine.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. using Core.Mes.Client.Comm.Format;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.YdmPipeManage.Entity;
  5. using Core.StlMes.Client.YdmPipeManage.Tool;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinEditors;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Generic;
  12. using System.ComponentModel;
  13. using System.Data;
  14. using System.Drawing;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Windows.Forms;
  18. using Core.StlMes.Client.YdmPipeManage;
  19. using Core.Mes.Client.Comm.Control;
  20. namespace Core.StlMes.Client.YdmPipeManage
  21. {
  22. public partial class FrmLikuExamine : FrmBase
  23. {
  24. public FrmLikuExamine()
  25. {
  26. InitializeComponent();
  27. this.IsLoadUserView = true;
  28. }
  29. string[] arr = null;
  30. private void txtMemo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  31. {
  32. UltraTextEditor textEditor = (UltraTextEditor)sender;
  33. PopupTextBox popupText = new PopupTextBox(textEditor.Text, 500);
  34. if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  35. {
  36. textEditor.Text = popupText.TextInfo.Trim();
  37. }
  38. this.ultraGrid1.ActiveCell.Value = textEditor.Text;
  39. this.ultraGrid1.ActiveRow.Update();
  40. }
  41. private void FrmLikuExamine_Load(object sender, EventArgs e)
  42. {
  43. DateTime now = DateTime.Now;
  44. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  45. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  46. this.cmbDate.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  47. this.cmbEndDate.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  48. EntityHelper.ShowGridCaption<QcmLkJudgeChangeEntity>(this.ultraGrid1.DisplayLayout.Bands[0]);
  49. arr = this.CustomInfo.Contains("XS")?new string[]{}:this.ValidDataPurviewIds;
  50. }
  51. /// <summary>
  52. /// 重写基类方法
  53. /// </summary>
  54. /// <param name="sender"></param>
  55. /// <param name="ToolbarKey"></param>
  56. public override void ToolBar_Click(object sender, string ToolbarKey)
  57. {
  58. switch (ToolbarKey)
  59. {
  60. case "Query":
  61. doQueryApply();
  62. break;
  63. case "Audit":
  64. auditCross();
  65. break;
  66. case"AuditNo":
  67. auditNoCross();
  68. break;
  69. case"CancelAudit":
  70. cancelAudit();
  71. break;
  72. case "Export":
  73. GridHelper.ulGridToExcel(ultraGrid1, "成品利库申请信息");;
  74. break;
  75. case "Close":
  76. this.Close();
  77. break;
  78. }
  79. }
  80. /// <summary>
  81. /// 查询
  82. /// </summary>
  83. private void doQueryApply()
  84. {
  85. string startTim = "";
  86. string endTim = "";
  87. string judgeNo = "";
  88. string orderNo = "";
  89. string valueFlag = "";
  90. if (this.chkJudgeStoveNo.Checked && this.uteJudgeStoveNo.Text.Trim() != "")
  91. {
  92. judgeNo = this.uteJudgeStoveNo.Text.Trim();
  93. }
  94. if(this.chkOrderNo.Checked && this.cmbOrderNo.Text.Trim() != "")
  95. {
  96. orderNo = this.cmbOrderNo.Text.Trim();
  97. }
  98. if (this.chkDate.Checked)
  99. {
  100. if (DateTime.Parse(cmbDate.Value.ToString()) > DateTime.Parse(this.cmbEndDate.Value.ToString()))
  101. {
  102. MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
  103. return;
  104. }
  105. else
  106. {
  107. startTim = this.cmbDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
  108. endTim = this.cmbEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
  109. }
  110. }
  111. valueFlag = this.ultraOptionSet1.CheckedItem.DataValue.ToString();
  112. ArrayList parmList = new ArrayList();
  113. parmList.Add(startTim);
  114. parmList.Add(endTim);
  115. parmList.Add(judgeNo);
  116. parmList.Add(orderNo);
  117. parmList.Add(valueFlag);
  118. String supp = this.CustomInfo.Contains("120504") ? "120504" : "";
  119. List<QcmLkJudgeChangeEntity> listSource = EntityHelper.GetData<QcmLkJudgeChangeEntity>(
  120. "com.steering.pss.ydm.pipemanage.FrmLikuExamine.doQueryApply", new object[] { parmList, arr, supp }, this.ob);
  121. qcmLkJudgeChangeEntityBindingSource.DataSource = listSource;
  122. }
  123. /// <summary>
  124. /// 审批通过
  125. /// </summary>
  126. private void auditCross()
  127. {
  128. this.ultraGrid1.UpdateData();
  129. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  130. if (checkMagRows.Count() == 0)
  131. {
  132. MessageUtil.ShowTips("请选择需要审批的信息!");
  133. return;
  134. }
  135. ArrayList parmList = new ArrayList();
  136. foreach (UltraGridRow uRow in checkMagRows)
  137. {
  138. QcmLkJudgeChangeEntity qcmTity = (QcmLkJudgeChangeEntity)uRow.ListObject;
  139. qcmTity.AgreeName = UserInfo.GetUserName();
  140. if (qcmTity.IndexSeq.Equals(""))
  141. {
  142. MessageUtil.ShowTips("审批通过时请选择制程号!");
  143. return;
  144. }
  145. if(qcmTity.Cic.Equals(""))
  146. {
  147. MessageUtil.ShowTips("审批时请选择CIC!");
  148. return;
  149. }
  150. string qcmLkEntity = JSONFormat.Format(qcmTity);
  151. parmList.Add(qcmLkEntity);
  152. }
  153. CoreClientParam ccp = new CoreClientParam();
  154. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmLikuExamine";
  155. ccp.MethodName = "auditCross";
  156. ccp.ServerParams = new object[] { parmList };
  157. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  158. if (ccp.ReturnCode != -1)
  159. {
  160. if (ccp.ReturnInfo.Equals("审批成功!"))
  161. {
  162. doQueryApply();
  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 auditNoCross()
  175. {
  176. this.ultraGrid1.UpdateData();
  177. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  178. if (checkMagRows.Count() == 0)
  179. {
  180. MessageUtil.ShowTips("请选择需要审批的信息!");
  181. return;
  182. }
  183. ArrayList parmList = new ArrayList();
  184. foreach(UltraGridRow uRow in checkMagRows)
  185. {
  186. QcmLkJudgeChangeEntity qcmTity = (QcmLkJudgeChangeEntity)uRow.ListObject;
  187. qcmTity.AgreeName = UserInfo.GetUserName();
  188. string qcmLkEntity = JSONFormat.Format(qcmTity);
  189. parmList.Add(qcmLkEntity);
  190. }
  191. CoreClientParam ccp = new CoreClientParam();
  192. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmLikuExamine";
  193. ccp.MethodName = "auditNoCross";
  194. ccp.ServerParams = new object[] { parmList };
  195. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  196. if (ccp.ReturnCode != -1)
  197. {
  198. if (ccp.ReturnInfo.Equals("审批成功!"))
  199. {
  200. doQueryApply();
  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 cancelAudit()
  213. {
  214. this.ultraGrid1.UpdateData();
  215. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  216. if (checkMagRows.Count() == 0)
  217. {
  218. MessageUtil.ShowTips("请选择需要撤销审批的信息!");
  219. return;
  220. }
  221. ArrayList parmList = new ArrayList();
  222. foreach (UltraGridRow uRow in checkMagRows)
  223. {
  224. QcmLkJudgeChangeEntity qcmTity = (QcmLkJudgeChangeEntity)uRow.ListObject;
  225. string qcmLkEntity = JSONFormat.Format(qcmTity);
  226. parmList.Add(qcmLkEntity);
  227. }
  228. CoreClientParam ccp = new CoreClientParam();
  229. ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmLikuExamine";
  230. ccp.MethodName = "cancelAudit";
  231. ccp.ServerParams = new object[] { parmList };
  232. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  233. if (ccp.ReturnCode != -1)
  234. {
  235. if (ccp.ReturnInfo.Equals("撤销成功!"))
  236. {
  237. doQueryApply();
  238. MessageUtil.ShowTips(ccp.ReturnInfo);
  239. }
  240. else
  241. {
  242. MessageUtil.ShowTips(ccp.ReturnInfo);
  243. }
  244. }
  245. }
  246. private void chkDate_CheckedChanged(object sender, EventArgs e)
  247. {
  248. this.cmbDate.Enabled = this.cmbEndDate.Enabled = this.chkDate.Checked;
  249. }
  250. private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e)
  251. {
  252. this.uteJudgeStoveNo.Enabled = this.chkJudgeStoveNo.Checked;
  253. }
  254. private void chkOrderNo_CheckedChanged(object sender, EventArgs e)
  255. {
  256. cmbOrderNo.Enabled = this.chkOrderNo.Checked;
  257. }
  258. private void cmbIndexSeq_EditorButtonClick(object sender, EditorButtonEventArgs e)
  259. {
  260. this.ultraGrid1.UpdateData();
  261. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmLikuExamine.doQueryIndexSeq",
  262. new object[] { this.ultraGrid1.ActiveRow.Cells["OrdLnPk"].Text }, ob);
  263. dt.Columns["INDEX_SEQ"].Caption = "制程号";
  264. BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "INDEX_SEQ", "INDEX_CODE");
  265. baseInfo.Shown += new EventHandler((a, b) =>
  266. {
  267. var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
  268. c => c.GetValue("INDEX_CODE") == this.cmbIndexSeq.Tag.ToString2()
  269. ).FirstOrDefault();
  270. if (actRow != null) actRow.Activate();
  271. });
  272. if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  273. {
  274. this.ultraGrid1.ActiveCell.Value = baseInfo.ChoicedRow.GetValue("INDEX_SEQ");
  275. this.ultraGrid1.ActiveCell.Row.Cells["IndexSeq"].Value = baseInfo.ChoicedRow.GetValue("INDEX_CODE");
  276. }
  277. }
  278. private void cmbCic_EditorButtonClick(object sender, EditorButtonEventArgs e)
  279. {
  280. this.ultraGrid1.UpdateData();
  281. if (this.ultraGrid1.ActiveRow.Cells["IndexSeq"].Text == "")
  282. {
  283. MessageUtil.ShowTips("选择CIC索引码时请先选择制程号!");
  284. return;
  285. }
  286. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmLikuExamine.doQueryCic",
  287. new object[] { this.ultraGrid1.ActiveRow.Cells["CraftSeq"].Text, this.ultraGrid1.ActiveRow.Cells["OrdLnPk"].Text, this.ultraGrid1.ActiveRow.Cells["IndexSeq"].Text }, ob);
  288. dt.Columns["CIC"].Caption = "CIC";
  289. BaseInfoPopup1 baseInfo = new BaseInfoPopup1(dt, "CIC", "CIC_CODE");
  290. baseInfo.Shown += new EventHandler((a, b) =>
  291. {
  292. var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
  293. c => c.GetValue("CIC_CODE") == this.cmbCic.Tag.ToString2()).FirstOrDefault();
  294. if (actRow != null) actRow.Activate();
  295. });
  296. if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  297. {
  298. this.ultraGrid1.ActiveCell.Value = baseInfo.ChoicedRow.GetValue("CIC");
  299. this.ultraGrid1.ActiveCell.Row.Cells["Cic"].Value = baseInfo.ChoicedRow.GetValue("CIC_CODE");
  300. }
  301. }
  302. private void ultraTextEditor5_EditorButtonClick(object sender, EditorButtonEventArgs e)
  303. {
  304. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  305. if (uRow.Cells["CraftNo"].Text.Trim() == "" || uRow.Cells["CraftPath"].Text.Trim() == "")
  306. {
  307. return;
  308. }
  309. BaseMethod.ViewCarft_No(uRow.Cells["CraftPath"].Text.Trim());
  310. }
  311. }
  312. }