FrmZjResult.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Globalization;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using Core.Mes.Client.Comm.Tool;
  11. using Core.StlMes.Client.Mcp.Control.Entity;
  12. using CoreFS.CA06;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Core.Mes.Client.Comm.Server;
  15. using Core.Mes.Client.Comm.Control;
  16. using System.Collections;
  17. using Core.StlMes.Client.Mcp.Mch.McmZj;
  18. using Core.Mes.Client.Comm.Format;
  19. namespace Core.StlMes.Client.Mcp.Mch.MchResult
  20. {
  21. public partial class FrmZjResult : FrmBase
  22. {
  23. private string _judgeStove = "";
  24. private string _batchNo = "";
  25. protected override void OnLoad(EventArgs e)
  26. {
  27. base.OnLoad(e);
  28. ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  29. baseinfoZj1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  30. informationZj1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  31. ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  32. foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
  33. {
  34. ugc.SortIndicator = SortIndicator.Disabled;
  35. }
  36. //PanelSizeFlag = 0;
  37. }
  38. public FrmZjResult()
  39. {
  40. InitializeComponent();
  41. //GridHelper.InitCardGrid(dataSet1, ultraGridPlan);//显示人工质检主信息界面
  42. }
  43. /// <summary>
  44. /// ToolBar按钮
  45. /// </summary>
  46. /// <param name="sender"></param>
  47. /// <param name="ToolbarKey"></param>
  48. public override void ToolBar_Click(object sender, string ToolbarKey)
  49. {
  50. switch (ToolbarKey)
  51. {
  52. case "DoQuery":
  53. PlanQuery();
  54. break;
  55. case "DoAdd":
  56. ResultSave();
  57. break;
  58. case "DoDelete":
  59. DoDelete();
  60. break;
  61. case "Exp":
  62. Doexp();
  63. break;
  64. case "Close":
  65. this.Dispose();
  66. this.Close();
  67. break;
  68. }
  69. }
  70. /// <summary>
  71. /// 获取grid 所有勾选的行
  72. /// </summary>
  73. /// <param name="grid"></param>
  74. /// <param name="columnName">复选框所在列名</param>
  75. /// <returns></returns>
  76. public static List<UltraGridRow> UltraGridGetChooseRows(UltraGrid grid)
  77. {
  78. grid.UpdateData();
  79. List<UltraGridRow> list = new List<UltraGridRow>();
  80. RowsCollection rows = grid.Rows;
  81. foreach (var item in rows)
  82. {
  83. try
  84. {
  85. if (Convert.ToBoolean(item.Cells["check"].Value) == true)
  86. {
  87. list.Add(item);
  88. }
  89. }
  90. catch { }
  91. }
  92. return list;
  93. }
  94. public List<ArrayList> getplnZyZjc()
  95. {
  96. List<ArrayList> ls = new List<ArrayList>();
  97. this.ultraGrid1.UpdateData();
  98. List<UltraGridRow> listRow = UltraGridGetChooseRows(ultraGrid1);
  99. foreach (UltraGridRow ultraGridRow in listRow)
  100. {
  101. ArrayList plnZyZjc = new ArrayList();
  102. string heatPlanSqe = ultraGridRow.Cells["HEAT_PLAN_SQE"].Value.ToString();
  103. string judgeStoveNo = ultraGridRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
  104. string pipeEndOd1 = ultraGridRow.Cells["PIPE_END_OD1"].Value.ToString();
  105. string pipeEndOd2 = ultraGridRow.Cells["PIPE_END_OD2"].Value.ToString();
  106. string pipeEndOutOfRoundness = ultraGridRow.Cells["PIPE_END_OUT_OF_ROUNDNESS"].Value.ToString();
  107. string pipeEndMm = ultraGridRow.Cells["PIPE_END_MM"].Value.ToString();
  108. string pipeEndS1 = ultraGridRow.Cells["PIPE_END_S1"].Value.ToString();
  109. string pipeEndS2 = ultraGridRow.Cells["PIPE_END_S2"].Value.ToString();
  110. string pipeEndS3 = ultraGridRow.Cells["PIPE_END_S3"].Value.ToString();
  111. string pipeEndS4 = ultraGridRow.Cells["PIPE_END_S4"].Value.ToString();
  112. string pipeEndBevel = ultraGridRow.Cells["PIPE_END_BEVEL"].Value.ToString();
  113. string pipeEndRootFace = ultraGridRow.Cells["PIPE_END_ROOT_FACE"].Value.ToString();
  114. string pipeEndOutOfSquareness = ultraGridRow.Cells["PIPE_END_OUT_OF_SQUARENESS"].Value.ToString();
  115. string pipeEndResiMag = ultraGridRow.Cells["PIPE_END_RESI_MAG"].Value.ToString();
  116. string pipeBodyOd1 = ultraGridRow.Cells["PIPE_BODY_OD1"].Value.ToString();
  117. string pipeBodyOd2 = ultraGridRow.Cells["PIPE_BODY_OD2"].Value.ToString();
  118. string pipeBodyOutOfRoundness = ultraGridRow.Cells["PIPE_BODY_OUT_OF_ROUNDNESS"].Value.ToString();
  119. string pipeBodyMm = ultraGridRow.Cells["PIPE_BODY_MM"].Value.ToString();
  120. string isDecide = ultraGridRow.Cells["IS_DECIDE"].Value.ToString();
  121. string pipeBodyLengs = ultraGridRow.Cells["PIPE_BODY_LENGS"].Value.ToString();
  122. string pipeEndOd1B = ultraGridRow.Cells["PIPE_END_OD1_B"].Value.ToString();
  123. string pipeEndOd2B = ultraGridRow.Cells["PIPE_END_OD2_B"].Value.ToString();
  124. string pipeEndOutOfRoundnessB = ultraGridRow.Cells["PIPE_END_OUT_OF_ROUNDNESS_B"].Value.ToString();
  125. string pipeEndMmB = ultraGridRow.Cells["PIPE_END_MM_B"].Value.ToString();
  126. string pipeEndS1B = ultraGridRow.Cells["PIPE_END_S1_B"].Value.ToString();
  127. string pipeEndS2B = ultraGridRow.Cells["PIPE_END_S2_B"].Value.ToString();
  128. string pipeEndS3B = ultraGridRow.Cells["PIPE_END_S3_B"].Value.ToString();
  129. string pipeEndS4B = ultraGridRow.Cells["PIPE_END_S4_B"].Value.ToString();
  130. string pipeEndBevelB = ultraGridRow.Cells["PIPE_END_BEVEL_B"].Value.ToString();
  131. string pipeEndRootFaceB = ultraGridRow.Cells["PIPE_END_ROOT_FACE_B"].Value.ToString();
  132. string pipeEndOutOfSquarenessB = ultraGridRow.Cells["PIPE_END_OUT_OF_SQUARENESS_B"].Value.ToString();
  133. string pipeEndResiMagB = ultraGridRow.Cells["PIPE_END_RESI_MAG_B"].Value.ToString();
  134. string pipeEndResiMag2 = ultraGridRow.Cells["PIPE_END_RESI_MAG_2"].Value.ToString();
  135. string pipeEndResiMag3 = ultraGridRow.Cells["PIPE_END_RESI_MAG_3"].Value.ToString();
  136. string pipeEndResiMag4 = ultraGridRow.Cells["PIPE_END_RESI_MAG_4"].Value.ToString();
  137. string pipeEndResiMag2B = ultraGridRow.Cells["PIPE_END_RESI_MAG_2_B"].Value.ToString();
  138. string pipeEndResiMag3B = ultraGridRow.Cells["PIPE_END_RESI_MAG_3_B"].Value.ToString();
  139. string pipeEndResiMag4B = ultraGridRow.Cells["PIPE_END_RESI_MAG_4_B"].Value.ToString();
  140. plnZyZjc.Add(heatPlanSqe);
  141. plnZyZjc.Add(judgeStoveNo);
  142. plnZyZjc.Add(pipeEndOd1);
  143. plnZyZjc.Add(pipeEndOd2);
  144. plnZyZjc.Add(pipeEndOutOfRoundness);
  145. plnZyZjc.Add(pipeEndMm);
  146. plnZyZjc.Add(pipeEndS1);
  147. plnZyZjc.Add(pipeEndS2);
  148. plnZyZjc.Add(pipeEndS3);
  149. plnZyZjc.Add(pipeEndS4);
  150. plnZyZjc.Add(pipeEndBevel);
  151. plnZyZjc.Add(pipeEndRootFace);
  152. plnZyZjc.Add(pipeEndOutOfSquareness);
  153. plnZyZjc.Add(pipeEndResiMag);
  154. plnZyZjc.Add(pipeBodyOd1);
  155. plnZyZjc.Add(pipeBodyOd2);
  156. plnZyZjc.Add(pipeBodyOutOfRoundness);
  157. plnZyZjc.Add(isDecide);
  158. plnZyZjc.Add(pipeBodyLengs);
  159. plnZyZjc.Add(pipeBodyMm);
  160. plnZyZjc.Add(pipeEndOd1B);
  161. plnZyZjc.Add(pipeEndOd2B);
  162. plnZyZjc.Add(pipeEndOutOfRoundnessB);
  163. plnZyZjc.Add(pipeEndMmB);
  164. plnZyZjc.Add(pipeEndS1B);
  165. plnZyZjc.Add(pipeEndS2B);
  166. plnZyZjc.Add(pipeEndS3B);
  167. plnZyZjc.Add(pipeEndS4B);
  168. plnZyZjc.Add(pipeEndBevelB);
  169. plnZyZjc.Add(pipeEndRootFaceB);
  170. plnZyZjc.Add(pipeEndOutOfSquarenessB);
  171. plnZyZjc.Add(pipeEndResiMagB);
  172. plnZyZjc.Add(pipeEndResiMag2);
  173. plnZyZjc.Add(pipeEndResiMag3);
  174. plnZyZjc.Add(pipeEndResiMag4);
  175. plnZyZjc.Add(pipeEndResiMag2B);
  176. plnZyZjc.Add(pipeEndResiMag3B);
  177. plnZyZjc.Add(pipeEndResiMag4B);
  178. ls.Add(plnZyZjc);
  179. }
  180. return ls;
  181. }
  182. public void CopyDataToDatatableplnZyZjc(string judgeStoveNo)
  183. {
  184. if (judgeStoveNo == null)
  185. {
  186. return;
  187. }
  188. dtPipeSize.Rows.Clear();
  189. DataTable dtDtail = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmZjResult.getQueryZjc", new object[] { judgeStoveNo }, this.ob);
  190. GridHelper.CopyDataToDatatable(ref dtDtail, ref dtPipeSize, true);
  191. }
  192. /// <summary>
  193. /// 计划查询
  194. /// </summary>
  195. public void PlanQuery()
  196. {
  197. string PrimaKey = txtJudgeStoveNo.Text.ToString();
  198. //查询计划记录
  199. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmZjResult.getQueryZjBaseInfo", new object[] { PrimaKey }, this.ob);
  200. if (dt.Rows.Count == 0)
  201. {
  202. if (ShowMessageFlag == 0)
  203. {
  204. MessageBox.Show("未查询到匹配的数据,请重新查询!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  205. }
  206. return;
  207. }
  208. GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
  209. _judgeStove = dt.Rows[0]["JUDGE_STOVE_NO"].ToString();
  210. baseinfoZj1.CopyDataToDatatableBseinfo(dt);
  211. informationZj1.CopyDataToDatatableplnZyZjDtail(dt,this.ob);
  212. CopyDataToDatatableplnZyZjc(dt.Rows[0]["JUDGE_STOVE_NO"].ToString());
  213. }
  214. /// <summary>
  215. /// 保存
  216. /// </summary>
  217. public void ResultSave()
  218. {
  219. //基础信息
  220. ArrayList plnZyZjm = getplinZyZjm();
  221. //详情表
  222. ArrayList plnZyZjcDtail = informationZj1.getplinZyZjdetal();
  223. //管号详情表
  224. List<ArrayList> plnZyZjc = getplnZyZjc();
  225. if (informationZj1.isReturn == false)
  226. {
  227. MessageBox.Show("输入支数错误", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  228. return;
  229. }
  230. if (MessageUtil.ShowYesNoAndQuestion("是否保存?") == DialogResult.No)
  231. return;
  232. var ccp = new CoreClientParam();
  233. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmZjResult";
  234. ccp.MethodName = "doSaveZjRusult";
  235. ccp.ServerParams = new object[]
  236. {
  237. plnZyZjm, plnZyZjcDtail,plnZyZjc
  238. };
  239. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  240. if (ccp.ReturnCode != -1)
  241. {
  242. MessageUtil.ShowTips(ccp.ReturnInfo);
  243. PlanQuery();
  244. }
  245. }
  246. private void Doexp()
  247. {
  248. UltraGridRow row = ultraGridPlan.ActiveRow;
  249. string jugeNo = row.Cells["JUDGE_STOVE_NO"].Value.ToString();
  250. string zjid = row.Cells["ZJID"].Value.ToString();
  251. if (zjid.Equals("")) return;
  252. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?op=write&viewlet=SteelPipeFinalInspectionReport.cpt&zjId=" + zjid + "&stoNo=" + jugeNo;
  253. if (zjid.Equals("")) return;
  254. var fre = new FrmRepExcel(ob, strurl);
  255. fre.AutoSize = true;
  256. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  257. fre.WindowState = FormWindowState.Maximized;
  258. fre.Show();
  259. }
  260. public ArrayList getplinZyZjm()
  261. {
  262. ArrayList plnZyZjm = new ArrayList();
  263. baseinfoZj1.UltraGrid4.UpdateData();
  264. UltraGridRow ultraGridPlans = ultraGridPlan.ActiveRow;
  265. UltraGridRow ultraGridBaseinfo = baseinfoZj1.UltraGrid4.ActiveRow;
  266. //基础信息
  267. string judgeStove = ultraGridPlans.Cells["JUDGE_STOVE_NO"].Value.ToString();
  268. string orderNo = ultraGridPlans.Cells["ORDER_NO"].Value.ToString();
  269. string specName = ultraGridPlans.Cells["SPEC_NAME"].Value.ToString();
  270. string gradename = ultraGridPlans.Cells["GRADENAME"].Value.ToString();
  271. string steelname = ultraGridPlans.Cells["STEELNAME"].Value.ToString();
  272. string producname = ultraGridPlans.Cells["PRODUCNAME"].Value.ToString();
  273. string stdName = ultraGridPlans.Cells["STD_NAME"].Value.ToString();
  274. string length = ultraGridBaseinfo.Cells["LENGTH"].Value.ToString();
  275. string coating = ultraGridBaseinfo.Cells["COATING"].Value.ToString();
  276. string protector = ultraGridBaseinfo.Cells["PROTECTOR"].Value.ToString();
  277. string marking = ultraGridBaseinfo.Cells["MARKING"].Value.ToString();
  278. string bachNo = ultraGridBaseinfo.Cells["lotNo"].Value.ToString();
  279. string resiMag = ultraGridBaseinfo.Cells["Resimag"].Value.ToString();
  280. string zjid = ultraGridPlans.Cells["ZJID"].Value.ToString();
  281. _batchNo = bachNo;
  282. plnZyZjm.Add(judgeStove);
  283. plnZyZjm.Add(bachNo);
  284. plnZyZjm.Add(specName);
  285. plnZyZjm.Add(gradename);
  286. plnZyZjm.Add(steelname);
  287. plnZyZjm.Add(orderNo);
  288. plnZyZjm.Add(producname);
  289. plnZyZjm.Add(stdName);
  290. plnZyZjm.Add(length);
  291. plnZyZjm.Add(coating);
  292. plnZyZjm.Add(protector);
  293. plnZyZjm.Add(marking);
  294. plnZyZjm.Add(resiMag);
  295. plnZyZjm.Add(zjid);
  296. return plnZyZjm;
  297. }
  298. private void DoDelete()
  299. {
  300. UltraGridRow row = ultraGridPlan.ActiveRow;
  301. string stoveNo = row.Cells["JUDGE_STOVE_NO"].Value.ToString();
  302. if (stoveNo.Equals("") || stoveNo == null) return;
  303. if (MessageUtil.ShowYesNoAndQuestion("是否删除?") == DialogResult.No)
  304. return;
  305. CoreClientParam ccp = new CoreClientParam();
  306. try
  307. {
  308. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmZjResult";
  309. ccp.MethodName = "DoDelete";
  310. ccp.ServerParams = new object[] { stoveNo };
  311. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  312. if (ccp.ReturnCode != -1)
  313. {
  314. MessageUtil.ShowTips(ccp.ReturnInfo);
  315. PlanQuery();
  316. }
  317. }
  318. catch (Exception ex)
  319. {
  320. MessageUtil.ShowTips("操作失败");
  321. }
  322. if (ccp.ReturnCode != -1)
  323. {
  324. MessageUtil.ShowTips(ccp.ReturnInfo);
  325. ccp.ReturnInfo.Equals("删除成功");
  326. PlanQuery();
  327. }
  328. }
  329. public int ShowMessageFlag { get; set; }
  330. private void ultraComboEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  331. {
  332. List<String> ls = new List<string>();
  333. List<UltraGridRow> listRow = UltraGridGetChooseRows(ultraGrid1);
  334. RowsCollection rows = ultraGrid1.Rows;
  335. foreach (var item in rows)
  336. {
  337. try
  338. {
  339. //if (Convert.ToBoolean(item.Cells["check"].Value) == true)
  340. //{
  341. // list.Add(item);
  342. //}
  343. string heatPlanSqe = item.Cells["MAT_NO"].Value.ToString();
  344. ls.Add(heatPlanSqe);
  345. }
  346. catch { }
  347. }
  348. using (FrmMesureData MesureData = new FrmMesureData(_judgeStove, _batchNo, ob, this.UserInfo.GetUserName(), false, ls))
  349. {
  350. MesureData.ShowDialog();
  351. CopyDataToDatatableplnZyZjc(_judgeStove);
  352. ultraGrid1.UpdateData();
  353. ultraGrid1.Refresh();
  354. //ultraGrid1.ActiveCell.Value = (decimal)MesureData.list.Where(p => p.Flag == "00").Select(p => p.MatNo).Distinct().Count();
  355. //portMchBatchControl1.Query(ActiveRow.HeatPlanNo, ActiveRow.BatchNo, Gx, ActiveRow.ProducType == "C" || ActiveRow.ProducType == "E");
  356. }
  357. }
  358. private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)
  359. {
  360. if (this.ultraGrid1.ActiveCell == null)
  361. return;
  362. string strKey = this.ultraGrid1.ActiveCell.Column.ToString();
  363. if (!(e.KeyChar == '\b') && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length >= 6)
  364. {
  365. e.Handled = true;
  366. }
  367. if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.'))
  368. {
  369. e.Handled = true;
  370. }
  371. if (e.KeyChar == '.')
  372. {
  373. char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
  374. if (arrary.Length == 0)
  375. {
  376. ultraGrid1.ActiveRow.Cells[strKey].Value = "0.";
  377. ultraGrid1.ActiveRow.Cells[strKey].SelStart = ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length;
  378. e.Handled = true;
  379. }
  380. else
  381. {
  382. for (int i = 0; i < arrary.Length; i++)
  383. {
  384. if (arrary[i] == '.')
  385. e.Handled = true;
  386. }
  387. }
  388. }
  389. }
  390. private void chkHeatNo_CheckedChanged(object sender, EventArgs e)
  391. {
  392. txtJudgeStoveNo.Enabled = chkHeatNo.Checked;
  393. }
  394. }
  395. }