FrmApplyRoval.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  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.PlnSaleOrd
  16. {
  17. public partial class FrmApplyRoval : FrmBase
  18. {
  19. public FrmApplyRoval()
  20. {
  21. InitializeComponent();
  22. }
  23. private void FrmApplyRoval_Load(object sender, EventArgs e)
  24. {
  25. DateTime now = DateTime.Now;
  26. DateTime d1 = new DateTime(now.Year, now.Month, 1);
  27. DateTime d2 = d1.AddMonths(1).AddSeconds(-1);
  28. txtStratTime.Value = d1;
  29. txtEndTime.Value = d2;
  30. }
  31. public override void ToolBar_Click(object sender, string ToolbarKey)
  32. {
  33. base.ToolBar_Click(sender, ToolbarKey);
  34. switch (ToolbarKey)
  35. {
  36. case "Query"://查询
  37. Query();
  38. break;
  39. case "AppThrough"://审批通过
  40. AppThrough();
  41. break;
  42. case "AppNotThrough"://审批不通过
  43. AppNotThrough();
  44. break;
  45. case "CancelThrough"://取消审批
  46. CancelThrough();
  47. break;
  48. case"Export":
  49. exportData();
  50. break;
  51. case "Close": //关闭
  52. this.Close();
  53. break;
  54. default:
  55. break;
  56. }
  57. }
  58. /// <summary>
  59. /// 导出
  60. /// </summary>
  61. private void exportData()
  62. {
  63. GridHelper.ulGridToExcel(ultraGrid1, "合同推荐长度审批汇总");
  64. }
  65. /// <summary>
  66. /// 查询
  67. /// </summary>
  68. private void Query()
  69. {
  70. string orderNo = "";
  71. string strat = "";
  72. string startTime = "";
  73. string endTime = "";
  74. if (chcOrderNo.Checked)
  75. {
  76. if (txtOrderNo.Text.Equals(""))
  77. {
  78. MessageUtil.ShowTips("请输入合同号!");
  79. return;
  80. }
  81. else
  82. {
  83. orderNo = txtOrderNo.Text.ToString().Trim();
  84. }
  85. }
  86. if (chcStrat.Checked)
  87. {
  88. strat = comStrat.Value.ToString();
  89. }
  90. if (chcTime.Checked)
  91. {
  92. startTime = txtStratTime.Value.ToString();
  93. endTime = txtEndTime.Value.ToString();
  94. }
  95. string supp = this.CustomInfo.Contains("120504") ? "120504" : "";
  96. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.order.FrmApplyRoval.queryApplyNo", new object[] { orderNo, strat, startTime, endTime, this.ValidDataPurviewIds, this.UserInfo.GetUserName(), supp }, this.ob);
  97. GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
  98. }
  99. /// <summary>
  100. /// 审批通过
  101. /// </summary>
  102. private void AppThrough()
  103. {
  104. ultraGrid1.UpdateData();
  105. IQueryable<UltraGridRow> chcRows = ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  106. if (chcRows == null || chcRows.Count() == 0)
  107. {
  108. MessageUtil.ShowTips("请选择申请单!");
  109. return;
  110. }
  111. ArrayList List = new ArrayList();
  112. foreach (UltraGridRow urow in chcRows)
  113. {
  114. ArrayList jsonList = new ArrayList();
  115. jsonList.Add(urow.Cells["APPLY_NO"].Value.ToString());
  116. jsonList.Add(urow.Cells["ORD_LN_PK"].Value.ToString());
  117. jsonList.Add(urow.Cells["ORD_LN_DLY_PK"].Value.ToString());
  118. jsonList.Add(urow.Cells["LENGTH_MIN_N"].Value.ToString());
  119. jsonList.Add(urow.Cells["LENGTH_MAX_N"].Value.ToString());
  120. jsonList.Add(urow.Cells["LENGTHDISC_N"].Text.ToString());
  121. jsonList.Add(urow.Cells["SHRT_STOVE_N"].Text.ToString());
  122. jsonList.Add(urow.Cells["ORDER_NO"].Value.ToString());
  123. jsonList.Add(urow.Cells["ORDER_SEQ"].Value.ToString());
  124. jsonList.Add(urow.Cells["DELIVERY_NO"].Value.ToString());
  125. jsonList.Add(urow.Cells["ISSUED_MEMO"].Text.ToString().Trim());
  126. jsonList.Add(urow.Cells["LEN_NO_N"].Text.ToString());
  127. List.Add(jsonList);
  128. }
  129. if (MessageUtil.ShowYesNoAndQuestion("是否审批通过?") == DialogResult.No)
  130. {
  131. return;
  132. }
  133. PlanComm.WaitFromOpen(this.Cursor);
  134. CoreClientParam ccp = new CoreClientParam();
  135. ccp.ServerName = "com.steering.pss.plnsaleord.order.FrmApplyRoval";
  136. ccp.MethodName = "appThrough";
  137. ccp.ServerParams = new object[] { List,this.UserInfo.GetUserName() };
  138. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  139. PlanComm.WaitFromColse(this.Cursor);
  140. if (ccp.ReturnCode == -1) return;
  141. MessageUtil.ShowTips(ccp.ReturnInfo);
  142. if (ccp.ReturnInfo.Equals("审批通过成功!"))
  143. {
  144. Query();
  145. }
  146. }
  147. /// <summary>
  148. /// 审批不通过
  149. /// </summary>
  150. private void AppNotThrough()
  151. {
  152. ultraGrid1.UpdateData();
  153. IQueryable<UltraGridRow> chcRows = ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  154. if (chcRows == null || chcRows.Count() == 0)
  155. {
  156. MessageUtil.ShowTips("请选择申请单!");
  157. return;
  158. }
  159. ArrayList List = new ArrayList();
  160. foreach (UltraGridRow urow in chcRows)
  161. {
  162. ArrayList jsonList = new ArrayList();
  163. jsonList.Add(urow.Cells["APPLY_NO"].Value.ToString());
  164. jsonList.Add(urow.Cells["ORD_LN_PK"].Value.ToString());
  165. jsonList.Add(urow.Cells["ORD_LN_DLY_PK"].Value.ToString());
  166. jsonList.Add(urow.Cells["LENGTH_MIN_N"].Value.ToString());
  167. jsonList.Add(urow.Cells["LENGTH_MAX_N"].Value.ToString());
  168. jsonList.Add(urow.Cells["LENGTHDISC_N"].Text.ToString());
  169. jsonList.Add(urow.Cells["SHRT_STOVE_N"].Text.ToString());
  170. jsonList.Add(urow.Cells["ORDER_NO"].Value.ToString());
  171. jsonList.Add(urow.Cells["ORDER_SEQ"].Value.ToString());
  172. jsonList.Add(urow.Cells["DELIVERY_NO"].Value.ToString());
  173. jsonList.Add(urow.Cells["ISSUED_MEMO"].Text.ToString().Trim());
  174. jsonList.Add(urow.Cells["LEN_NO_N"].Text.ToString());
  175. List.Add(jsonList);
  176. }
  177. if (MessageUtil.ShowYesNoAndQuestion("是否审批不通过?") == DialogResult.No)
  178. {
  179. return;
  180. }
  181. PlanComm.WaitFromOpen(this.Cursor);
  182. CoreClientParam ccp = new CoreClientParam();
  183. ccp.ServerName = "com.steering.pss.plnsaleord.order.FrmApplyRoval";
  184. ccp.MethodName = "appNotThrough";
  185. ccp.ServerParams = new object[] { List,this.UserInfo.GetUserName() };
  186. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  187. PlanComm.WaitFromColse(this.Cursor);
  188. if (ccp.ReturnCode == -1) return;
  189. MessageUtil.ShowTips(ccp.ReturnInfo);
  190. if (ccp.ReturnInfo.Equals("审批不通过成功!"))
  191. {
  192. Query();
  193. }
  194. }
  195. /// <summary>
  196. /// 撤销审批
  197. /// </summary>
  198. private void CancelThrough()
  199. {
  200. ultraGrid1.UpdateData();
  201. IQueryable<UltraGridRow> chcRows = ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  202. if (chcRows == null || chcRows.Count() == 0)
  203. {
  204. MessageUtil.ShowTips("请选择申请单!");
  205. return;
  206. }
  207. ArrayList List = new ArrayList();
  208. foreach (UltraGridRow urow in chcRows)
  209. {
  210. ArrayList jsonList = new ArrayList();
  211. jsonList.Add(urow.Cells["APPLY_NO"].Value.ToString());
  212. jsonList.Add(urow.Cells["ORD_LN_PK"].Value.ToString());
  213. jsonList.Add(urow.Cells["ORD_LN_DLY_PK"].Value.ToString());
  214. jsonList.Add(urow.Cells["LENGTH_MIN_N"].Value.ToString());
  215. jsonList.Add(urow.Cells["LENGTH_MAX_N"].Value.ToString());
  216. jsonList.Add(urow.Cells["LENGTHDISC_N"].Text.ToString());
  217. jsonList.Add(urow.Cells["SHRT_STOVE_N"].Text.ToString());
  218. jsonList.Add(urow.Cells["ORDER_NO"].Value.ToString());
  219. jsonList.Add(urow.Cells["ORDER_SEQ"].Value.ToString());
  220. jsonList.Add(urow.Cells["DELIVERY_NO"].Value.ToString());
  221. jsonList.Add(urow.Cells["ISSUED_MEMO"].Text.ToString().Trim());
  222. jsonList.Add(urow.Cells["LEN_NO_N"].Text.ToString());
  223. List.Add(jsonList);
  224. }
  225. if (MessageUtil.ShowYesNoAndQuestion("是否撤销审批?") == DialogResult.No)
  226. {
  227. return;
  228. }
  229. PlanComm.WaitFromOpen(this.Cursor);
  230. CoreClientParam ccp = new CoreClientParam();
  231. ccp.ServerName = "com.steering.pss.plnsaleord.order.FrmApplyRoval";
  232. ccp.MethodName = "cancelThrough";
  233. ccp.ServerParams = new object[] { List, this.UserInfo.GetUserName() };
  234. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  235. PlanComm.WaitFromColse(this.Cursor);
  236. if (ccp.ReturnCode == -1) return;
  237. MessageUtil.ShowTips(ccp.ReturnInfo);
  238. if (ccp.ReturnInfo.Equals("撤销审批成功!"))
  239. {
  240. Query();
  241. }
  242. }
  243. private void chcOrderNo_CheckedChanged(object sender, EventArgs e)
  244. {
  245. if (chcOrderNo.Checked) { txtOrderNo.Enabled = true; } else { txtOrderNo.Enabled = false; }
  246. if (chcStrat.Checked) { comStrat.Enabled = true; } else { comStrat.Enabled = false; }
  247. if (chcTime.Checked) { txtStratTime.Enabled = true; txtEndTime.Enabled = true; } else { txtStratTime.Enabled = false; txtEndTime.Enabled = false; }
  248. }
  249. }
  250. }