FrmMilQualityEvaluation.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using CoreFS.CA06;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using Core.StlMes.Client.ZGMil.Entity;
  11. using Core.StlMes.Client.ZGMil.Signature;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.Mes.Client.Comm.Control;
  14. using System.Collections;
  15. using Core.Mes.Client.Comm.Tool;
  16. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  17. using Infragistics.Win.UltraWinGrid;
  18. using Core.StlMes.Client.ZGMil.Common;
  19. using com.steering.mes.zgmil.entity;
  20. using Core.Mes.Client.Comm.Format;
  21. namespace Core.StlMes.Client.ZGMil.Report
  22. {
  23. /// <summary>
  24. /// 在线外观检验质量原始记录
  25. /// </summary>
  26. public partial class FrmMilQualityEvaluation : FrmBase
  27. {
  28. private string departm = "";
  29. private string plineCode = "";
  30. private string[] plineCodes = { };
  31. private string heatNo = "";
  32. public FrmMilQualityEvaluation()
  33. {
  34. InitializeComponent();
  35. this.IsLoadUserView = true;
  36. }
  37. private void FrmMilQualityEvaluation_Load(object sender, EventArgs e)
  38. {
  39. NativeMethodNew na = new NativeMethodNew(this.ob);
  40. departm = UserInfo.GetDepartment();
  41. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  42. plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob);
  43. cmbEndDate.Value = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 20:59:59"));
  44. cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 21:00:00"));
  45. TubeRoll.SetComboItemHeight(cmbBc);
  46. TubeRoll.SetComboItemHeight(cmbBz);
  47. }
  48. /// <summary>
  49. /// 重写基类方法
  50. /// </summary>
  51. /// <param name="sender"></param>
  52. /// <param name="ToolbarKey"></param>
  53. public override void ToolBar_Click(object sender, string ToolbarKey)
  54. {
  55. switch (ToolbarKey)
  56. {
  57. case "Query":
  58. doQuery();
  59. break;
  60. case "Save":
  61. doSave();
  62. break;
  63. case "Export":
  64. doExport();
  65. break;
  66. case "DoPrint":
  67. doPrint();
  68. break;
  69. case "Close":
  70. this.Close();
  71. break;
  72. }
  73. }
  74. /// <summary>
  75. /// 导出
  76. /// </summary>
  77. private void doPrint()
  78. {
  79. GridHelper.ulGridToExcel(ultraGrid1, "在线外观检验台账");
  80. }
  81. private void chkDate_CheckedChanged(object sender, EventArgs e)
  82. {
  83. if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
  84. if (chkBc.Checked) { cmbBc.Enabled = true; } else { cmbBc.Enabled = false; }
  85. if (chkBz.Checked) { cmbBz.Enabled = true; } else { cmbBz.Enabled = false; }
  86. }
  87. /// <summary>
  88. /// 查询
  89. /// </summary>
  90. private void doQuery()
  91. {
  92. ArrayList list = new ArrayList();
  93. string date = "";
  94. string endDate = "";
  95. string bc = "";
  96. string bz = "";
  97. string JudgeStoveNo = "";
  98. if (chkDate.Checked)
  99. {
  100. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  101. {
  102. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  103. return;
  104. }
  105. else
  106. {
  107. date = cmbDate.Value.ToString();
  108. endDate = cmbEndDate.Value.ToString();
  109. }
  110. }
  111. if (chkBz.Checked)
  112. {
  113. if (cmbBz.Text.Trim() == "")
  114. {
  115. //MessageUtil.ShowTips("班组不能为空!");
  116. //return;
  117. bz = "";
  118. }
  119. else
  120. {
  121. bz = cmbBz.Value.ToString();
  122. }
  123. }
  124. if (chkBc.Checked)
  125. {
  126. if (cmbBc.Text.Trim() == "")
  127. {
  128. //MessageUtil.ShowTips("班次不能为空!");
  129. //return;
  130. bc = "";
  131. }
  132. else
  133. {
  134. bc = cmbBc.Value.ToString();
  135. }
  136. }
  137. if (chkJudgeStoveNo.Checked)
  138. {
  139. if (uteJudgeStoveNo.Text.Trim() == "")
  140. {
  141. JudgeStoveNo = "";
  142. }
  143. else
  144. {
  145. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  146. }
  147. }
  148. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilQualityEvaluation.queryMinResult", new Object[] { date, endDate, bc, bz,JudgeStoveNo, plineCodes }, this.ob);
  149. GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
  150. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  151. this.dtSize.Clear();
  152. this.dtDefectS.Clear();
  153. }
  154. /// <summary>
  155. /// 修改
  156. /// </summary>
  157. private void doSave()
  158. {
  159. this.ultraGrid1.UpdateData();
  160. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  161. if (checkMagRows.Count() == 0)
  162. {
  163. MessageUtil.ShowTips("请选择需要修改的信息!");
  164. return;
  165. }
  166. ArrayList parm = new ArrayList();
  167. foreach (UltraGridRow uRow in checkMagRows)
  168. {
  169. FeedSawResultEntity matZcTity = new FeedSawResultEntity();
  170. matZcTity.JudgeStoveNo = uRow.Cells["JUDGE_STOVE_NO"].Text.ToString();
  171. matZcTity.PlineCode = uRow.Cells["PLINE_CODE"].Text.ToString();
  172. if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("早班"))
  173. {
  174. matZcTity.ColShift = "1";
  175. }
  176. else if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("中班"))
  177. {
  178. matZcTity.ColShift = "2";
  179. }
  180. else if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("夜班"))
  181. {
  182. matZcTity.ColShift = "3";
  183. }
  184. else if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("常白班"))
  185. {
  186. matZcTity.ColShift = "0";
  187. }
  188. else
  189. {
  190. matZcTity.ColShift = uRow.Cells["COL_SHIFT"].Value.ToString();
  191. }
  192. if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("甲"))
  193. {
  194. matZcTity.ColGroup = "1";
  195. }
  196. else if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("乙"))
  197. {
  198. matZcTity.ColGroup = "2";
  199. }
  200. else if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("丙"))
  201. {
  202. matZcTity.ColGroup = "3";
  203. }
  204. else if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("丁"))
  205. {
  206. matZcTity.ColGroup = "4";
  207. }
  208. else
  209. {
  210. matZcTity.ColGroup = uRow.Cells["COL_GROUP"].Value.ToString();
  211. }
  212. matZcTity.StartTime = uRow.Cells["END_TIME"].Text.ToString();
  213. matZcTity.ColUser = uRow.Cells["COL_USER"].Text.ToString();
  214. matZcTity.Remark = "人工质检";
  215. string matTity = JSONFormat.Format(matZcTity);
  216. parm.Add(matTity);
  217. }
  218. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return;
  219. CoreClientParam ccp = new CoreClientParam();
  220. ccp.ServerName = "com.steering.mes.zgmil.report.FrmFeedSaw";
  221. ccp.MethodName = "doSave";
  222. ccp.ServerParams = new object[] { parm };
  223. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  224. if (ccp.ReturnCode != -1)
  225. {
  226. if (ccp.ReturnInfo.Equals("修改成功!"))
  227. {
  228. doQuery();
  229. MessageUtil.ShowTips(ccp.ReturnInfo);
  230. }
  231. else
  232. {
  233. MessageUtil.ShowTips(ccp.ReturnInfo);
  234. }
  235. }
  236. }
  237. /// <summary>
  238. /// 打印
  239. /// </summary>
  240. private void doExport()
  241. {
  242. string date = "";
  243. string endDate = "";
  244. string bc = "";
  245. string bz = "";
  246. //if (!chkDate.Checked)
  247. //{
  248. // MessageUtil.ShowTips("请选择生产日期!");
  249. // return;
  250. //}
  251. if (!chkBz.Checked)
  252. {
  253. MessageUtil.ShowTips("请选择班组!");
  254. return;
  255. }
  256. if (!chkBc.Checked)
  257. {
  258. MessageUtil.ShowTips("请选择班次!");
  259. return;
  260. }
  261. if (chkDate.Checked)
  262. {
  263. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  264. {
  265. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  266. return;
  267. }
  268. else
  269. {
  270. date = cmbDate.Value.ToString();
  271. endDate = cmbEndDate.Value.ToString();
  272. }
  273. }
  274. if (heatNo == null)
  275. {
  276. MessageUtil.ShowTips("请选择炉号!");
  277. return;
  278. }
  279. if (chkBz.Checked)
  280. {
  281. if (cmbBz.Text.Trim() == "")
  282. {
  283. //MessageUtil.ShowTips("班组不能为空!");
  284. //return;
  285. bz = "";
  286. }
  287. else
  288. {
  289. bz = cmbBz.Value.ToString();
  290. }
  291. }
  292. if (chkBc.Checked)
  293. {
  294. if (cmbBc.Text.Trim() == "")
  295. {
  296. //MessageUtil.ShowTips("班次不能为空!");
  297. //return;
  298. bc = "";
  299. }
  300. else
  301. {
  302. bc = cmbBc.Value.ToString();
  303. }
  304. }
  305. //doQuery();
  306. ColUserName colU = new ColUserName();
  307. colU.Ob = this.ob;
  308. colU.PlineCode = plineCode;
  309. colU.ColGroup = bz;
  310. colU.ColOrder = bc;
  311. colU.StationId = "9";
  312. if (plineCode.Equals("C017"))
  313. {
  314. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation460.cpt&format=pdf&__bypagesize__=false&JUDGE_STOVE_NO=" + heatNo;
  315. }
  316. else if (plineCode.Equals("C010"))
  317. {
  318. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation168.cpt&format=pdf&__bypagesize__=false&JUDGE_STOVE_NO=" + heatNo;
  319. }
  320. else if (plineCode.Equals("C009"))
  321. {
  322. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation258.cpt&format=pdf&__bypagesize__=false&JUDGE_STOVE_NO=" + heatNo;
  323. //colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepTechOrderLineCraft.cpt&format=pdf&__bypagesize__=false&format=pdf&__embed__=true&desgin_key=8a4d6fd1109a46f892ed9882d91a5935";
  324. }
  325. else if (plineCode.Equals("C008"))
  326. {
  327. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation250.cpt&format=pdf&__bypagesize__=false&JUDGE_STOVE_NO=" + heatNo;
  328. }
  329. else if (plineCode.Equals("C072"))
  330. {
  331. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation508.cpt&__bypagesize__=false&JUDGE_STOVE_NO=" + heatNo;
  332. }
  333. colU.StartTim = date;
  334. colU.EndTim = endDate;
  335. colU.StrText = "在线外观检验质量原始记录报表";
  336. colU.Flag = "0";
  337. colU.ShowDialog();
  338. //string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult.cpt&__bypagesize__=false&SHIFT=" + bc + "&GROUP=" + bz + "&DATE=" + date + "&DATE2=" + endDate + "&PLINECODE=" + plineCode;
  339. //FrmRepExcel fre = new FrmRepExcel(this.ob,url);
  340. ////fre.AutoSize = true;
  341. //fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  342. //fre.Text = "上料锯切报表";
  343. //fre.ShowDialog();
  344. }
  345. ///// <summary>
  346. ///// 查询上料管号队列
  347. ///// </summary>
  348. //public void GetFeedRack()
  349. //{
  350. // UltraGridRow ugr = ultraGrid1.ActiveRow;
  351. // if (ugr != null)
  352. // {
  353. // string JudgeStoveNo = "";
  354. // JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  355. // DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.report.SurfaceInspectionResult.getSurfaceRackSeq", new object[] { JudgeStoveNo, "1" }, this.ob);
  356. // dtMatSeq_3.Clear();
  357. // GridHelper.CopyDataToDatatable(ref dt1, ref dtMatSeq_3, true);
  358. // }
  359. // ChangeGridColor();
  360. //}
  361. /// <summary>
  362. /// 获取指定炉号的缺陷项
  363. /// </summary>
  364. private void getDefectData()
  365. {
  366. UltraGridRow ugr = ultraGrid1.ActiveRow;
  367. if (ugr != null)
  368. {
  369. string jugeNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  370. DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilQualityEvaluation.getDefectData", new object[] { jugeNo }, this.ob);
  371. this.dtDefectS.Clear();
  372. GridHelper.CopyDataToDatatable(ref ds, ref this.dtDefectS, true);
  373. }
  374. }
  375. /// <summary>
  376. /// 查询抽检管记录
  377. /// </summary>
  378. /// <param name="JudgeStoveNo"></param>
  379. private void SizeCheckQuery()
  380. {
  381. UltraGridRow ugr = ultraGrid1.ActiveRow;
  382. if (ugr != null)
  383. {
  384. string jugeNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  385. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilQualityEvaluation.sizeCheckQuery", new object[] { jugeNo }, this.ob);
  386. this.dtSize.Clear();
  387. GridHelper.CopyDataToDatatable(ref dt, ref this.dtSize, true);
  388. }
  389. }
  390. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  391. {
  392. if (this.dataTable1.Rows.Count > 0)
  393. {
  394. UltraGridRow ugr = ultraGrid1.ActiveRow;
  395. if (ugr != null)
  396. {
  397. heatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  398. }
  399. //GetFeedRack();//查询上料管号队列
  400. SizeCheckQuery();
  401. getDefectData();
  402. }
  403. }
  404. }
  405. }