FrmMakeCheck.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using System.Collections;
  11. using Core.Mes.Client.Comm.Tool;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.Mes.Client.Comm.Control;
  14. namespace Core.StlMes.Client.Lims.Data.PipeAndOutdec
  15. {
  16. public partial class FrmMakeCheck : FrmBase
  17. {
  18. private string arrId;//数据权限
  19. public FrmMakeCheck()
  20. {
  21. InitializeComponent();
  22. this.IsLoadUserView = true;
  23. }
  24. private void FrmMakeCheck_Load(object sender, EventArgs e)
  25. {
  26. RegStartTime.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM-dd"));
  27. arrId = UserInfo.GetDeptid();
  28. }
  29. /// <summary>
  30. /// 重写基类方法
  31. /// </summary>
  32. /// <param name="sender"></param>
  33. /// <param name="ToolbarKey"></param>
  34. public override void ToolBar_Click(object sender, string ToolbarKey)
  35. {
  36. switch (ToolbarKey)
  37. {
  38. case "Query":
  39. doQueryData();
  40. break;
  41. case "Check":
  42. autoCheck();
  43. break;
  44. case "HandCheck":
  45. handCheck();
  46. break;
  47. case "Export":
  48. ExportData();
  49. break;
  50. case "Print":
  51. DoPrint();
  52. break;
  53. case "Close":
  54. this.Close();
  55. break;
  56. }
  57. }
  58. /// <summary>
  59. /// 手动抽查
  60. /// </summary>
  61. private void handCheck()
  62. {
  63. string strRegStart = this.RegStartTime.Value.ToString("yyyy-MM-dd");
  64. string userName = this.UserInfo.GetUserName();
  65. string checkNo = this.ultraGrid2.ActiveRow.Cells["CHECK_NO"].Value.ToString();
  66. CoreClientParam ccp = new CoreClientParam();
  67. ccp.ServerName = "com.steering.lims.data.pipe.FrmMakeCheck";
  68. ccp.MethodName = "handCheck";
  69. ccp.ServerParams = new object[] { strRegStart, arrId, userName ,checkNo};
  70. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  71. if (ccp.ReturnCode != -1)
  72. {
  73. if (ccp.ReturnInfo.Equals("手动抽查成功!"))
  74. {
  75. doQueryData();
  76. MessageUtil.ShowTips(ccp.ReturnInfo);
  77. }
  78. else
  79. {
  80. MessageUtil.ShowTips(ccp.ReturnInfo);
  81. }
  82. }
  83. }
  84. /// <summary>
  85. /// 打印
  86. /// </summary>
  87. private void DoPrint()
  88. {
  89. string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPipeMakeCheck.cpt&op=view&DEPT_ID=" + arrId;
  90. FrmExcel fre = new FrmExcel(this.ob, url);
  91. fre.AutoSize = true;
  92. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  93. fre.WindowState = FormWindowState.Maximized;
  94. fre.Show();
  95. }
  96. /// <summary>
  97. /// 自动抽查
  98. /// </summary>
  99. private void autoCheck()
  100. {
  101. string strRegStart = this.RegStartTime.Value.ToString("yyyy-MM-dd");
  102. string userName = this.UserInfo.GetUserName();
  103. string checkCount = ""; //需要抽查的报告份数
  104. DataTable dt2 = Core.Mes.Client.Comm.Server.ServerHelper.GetData("com.steering.lims.data.pipe.FrmMakeCheck.doQueryCheckCount", new Object[] { strRegStart, arrId }, this.ob);
  105. checkCount = dt2.Rows[0]["checkCount"].ToString3();
  106. CoreClientParam ccp = new CoreClientParam();
  107. ccp.ServerName = "com.steering.lims.data.pipe.FrmMakeCheck";
  108. ccp.MethodName = "autoCheck";
  109. ccp.ServerParams = new object[] { strRegStart, arrId, userName, checkCount };
  110. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  111. if (ccp.ReturnCode != -1)
  112. {
  113. if (ccp.ReturnInfo.Equals("自动抽查成功!"))
  114. {
  115. doQueryData();
  116. MessageUtil.ShowTips(ccp.ReturnInfo);
  117. }
  118. else
  119. {
  120. MessageUtil.ShowTips(ccp.ReturnInfo);
  121. }
  122. }
  123. }
  124. /// <summary>
  125. /// 查询
  126. /// </summary>
  127. private void doQueryData()
  128. {
  129. this.dataTable1.Clear();
  130. string strRegStart = this.RegStartTime.Value.ToString("yyyy-MM-dd");
  131. string sumCount = ""; //发出的报告份数
  132. string checkCount = ""; //需要抽查的报告份数
  133. DataTable dt = ServerHelper.GetData("com.steering.lims.data.pipe.FrmMakeCheck.doQueryData", new Object[] { strRegStart,arrId }, this.ob);
  134. GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
  135. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  136. DataTable dt2 = ServerHelper.GetData("com.steering.lims.data.pipe.FrmMakeCheck.doQueryAuditData", new Object[] { strRegStart, arrId }, this.ob);
  137. GridHelper.CopyDataToDatatable(dt2, this.dataTable2, true);
  138. GridHelper.RefreshAndAutoSize(this.ultraGrid2);
  139. DataTable dt3 = ServerHelper.GetData("com.steering.lims.data.pipe.FrmMakeCheck.doQueryCheckCount", new Object[] { strRegStart, arrId }, this.ob);
  140. sumCount = dt3.Rows[0]["sumCount"].ToString3();
  141. checkCount = dt3.Rows[0]["checkCount"].ToString3();
  142. this.ultraLabel1.Text = strRegStart + "共发出报告" + sumCount + "份,共需抽检报告:" + checkCount + "份.";
  143. ultraLabel1.ForeColor = Color.Red;
  144. }
  145. /// <summary>
  146. /// 导出
  147. /// </summary>
  148. private void ExportData()
  149. {
  150. GridHelper.ulGridToExcel(ultraGrid1, "检验周期抽查");
  151. }
  152. }
  153. }