FrmAddPhy.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. using Core.Mes.Client.Comm.Format;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.Lims.Data.PipeAndOutdec.封装类.实体类;
  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.Lims.Data.PipeAndOutdec
  16. {
  17. public partial class FrmAddPhy : FrmBase
  18. {
  19. private OpeBase _ob;
  20. private string _checkNo = "";
  21. public FrmAddPhy(OpeBase ob, string checkNo)
  22. {
  23. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  24. InitializeComponent();
  25. _ob = ob;
  26. _checkNo = checkNo;
  27. }
  28. private void FrmAddPhy_Load(object sender, EventArgs e)
  29. {
  30. EntityHelper.ShowGridCaption<PipeCheckconsignBaseinfoEntity>(this.ultraGrid5.DisplayLayout.Bands[0]);
  31. EntityHelper.ShowGridCaption<PipeCheckconsignDetailEntity>(this.ultraGrid1.DisplayLayout.Bands[0]);
  32. EntityHelper.ShowGridCaption<PipeCheckconsignPhydetailEntity>(this.ultraGrid2.DisplayLayout.Bands[0]);
  33. EntityHelper.ShowGridCaption<CraftOrdDesignStdPicEntity>(this.ultraGrid3.DisplayLayout.Bands[0]);
  34. EntityHelper.ShowGridCaption<CraftOrdDesignStdPicEntity>(this.ultraGrid4.DisplayLayout.Bands[0]);
  35. doQuery();
  36. }
  37. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  38. {
  39. switch (e.Tool.Key)
  40. {
  41. case"AddPhyMax":
  42. addPhyMax();
  43. break;
  44. case"DeletePhyMax":
  45. deletePhyMax();
  46. break;
  47. case "Add":
  48. addPhy();
  49. break;
  50. case"Delete":
  51. detePhy();
  52. break;
  53. case"UpdateRcl":
  54. updateRcl();
  55. break;
  56. case "UpdateTsRemark":
  57. updateTsRemark();
  58. break;
  59. case "Close":
  60. CloseForm();
  61. break;
  62. }
  63. }
  64. /// <summary>
  65. /// 加载数据
  66. /// </summary>
  67. private void doQuery()
  68. {
  69. List<PipeCheckconsignBaseinfoEntity> listSource = EntityHelper.GetData<PipeCheckconsignBaseinfoEntity>("com.steering.lims.data.pipe.FrmCheckConsignQuery.doQueryCheckNo", new object[] { _checkNo }, _ob);
  70. pipeCheckconsignBaseinfoEntityBindingSource.DataSource = listSource;
  71. }
  72. /// <summary>
  73. /// 新增试样组
  74. /// </summary>
  75. private void addPhyMax()
  76. {
  77. this.ultraGrid3.UpdateData();
  78. this.ultraGrid1.UpdateData();
  79. UltraGridRow mRow = this.ultraGrid5.ActiveRow;
  80. if (mRow == null) return;
  81. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  82. if (uRow == null) return;
  83. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid3.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  84. if (checkMagRows.Count() == 0)
  85. {
  86. MessageUtil.ShowTips("请选择新增的试样组!");
  87. return;
  88. }
  89. ArrayList parmList = new ArrayList();
  90. foreach (UltraGridRow row in checkMagRows)
  91. {
  92. CraftOrdDesignStdPicEntity craftPic = (CraftOrdDesignStdPicEntity)row.ListObject;
  93. string craftPicEntity = JSONFormat.Format(craftPic);
  94. parmList.Add(craftPicEntity);
  95. }
  96. PipeCheckconsignBaseinfoEntity pipeBase = (PipeCheckconsignBaseinfoEntity)mRow.ListObject;
  97. string pipeBaseEntity = JSONFormat.Format(pipeBase);
  98. PipeCheckconsignDetailEntity pipeDetailTity = (PipeCheckconsignDetailEntity)uRow.ListObject;
  99. string pipeDetailEntity = JSONFormat.Format(pipeDetailTity);
  100. CoreClientParam ccp = new CoreClientParam();
  101. ccp.ServerName = "com.steering.lims.data.pipe.FrmCheckConsignQuery";
  102. ccp.MethodName = "addPhyMax";
  103. ccp.ServerParams = new object[] {pipeBaseEntity, pipeDetailEntity, parmList };
  104. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  105. if (ccp.ReturnCode != -1)
  106. {
  107. if (ccp.ReturnInfo.Equals("新增成功!"))
  108. {
  109. doQuery();
  110. MessageUtil.ShowTips(ccp.ReturnInfo);
  111. }
  112. else
  113. {
  114. MessageUtil.ShowTips(ccp.ReturnInfo);
  115. }
  116. }
  117. }
  118. /// <summary>
  119. /// 增加检验项
  120. /// </summary>
  121. private void addPhy()
  122. {
  123. this.ultraGrid4.UpdateData();
  124. this.ultraGrid1.UpdateData();
  125. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  126. if (uRow == null) return;
  127. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid4.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  128. if (checkMagRows.Count() == 0)
  129. {
  130. MessageUtil.ShowTips("请选择新增的检验项!");
  131. return;
  132. }
  133. ArrayList parmList = new ArrayList();
  134. foreach(UltraGridRow row in checkMagRows)
  135. {
  136. CraftOrdDesignStdPicEntity craftPic = (CraftOrdDesignStdPicEntity)row.ListObject;
  137. string craftPicEntity = JSONFormat.Format(craftPic);
  138. parmList.Add(craftPicEntity);
  139. }
  140. PipeCheckconsignDetailEntity pipeDetailTity = (PipeCheckconsignDetailEntity)uRow.ListObject;
  141. string pipeDetailEntity = JSONFormat.Format(pipeDetailTity);
  142. CoreClientParam ccp = new CoreClientParam();
  143. ccp.ServerName = "com.steering.lims.data.pipe.FrmCheckConsignQuery";
  144. ccp.MethodName = "addPhy";
  145. ccp.ServerParams = new object[] { pipeDetailEntity, parmList };
  146. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  147. if (ccp.ReturnCode != -1)
  148. {
  149. if (ccp.ReturnInfo.Equals("新增成功!"))
  150. {
  151. doQuery();
  152. MessageUtil.ShowTips(ccp.ReturnInfo);
  153. }
  154. else
  155. {
  156. MessageUtil.ShowTips(ccp.ReturnInfo);
  157. }
  158. }
  159. }
  160. /// <summary>
  161. /// 删除检验项
  162. /// </summary>
  163. private void detePhy()
  164. {
  165. this.ultraGrid2.UpdateData();
  166. this.ultraGrid1.UpdateData();
  167. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  168. if (uRow == null) return;
  169. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  170. if (checkMagRows.Count() == 0)
  171. {
  172. MessageUtil.ShowTips("请选择删除的检验项!");
  173. return;
  174. }
  175. ArrayList parmList = new ArrayList();
  176. foreach (UltraGridRow row in checkMagRows)
  177. {
  178. PipeCheckconsignPhydetailEntity phyTity = (PipeCheckconsignPhydetailEntity)row.ListObject;
  179. string phyEntity = JSONFormat.Format(phyTity);
  180. parmList.Add(phyEntity);
  181. }
  182. PipeCheckconsignDetailEntity pipeDetailTity = (PipeCheckconsignDetailEntity)uRow.ListObject;
  183. string pipeDetailEntity = JSONFormat.Format(pipeDetailTity);
  184. CoreClientParam ccp = new CoreClientParam();
  185. ccp.ServerName = "com.steering.lims.data.pipe.FrmCheckConsignQuery";
  186. ccp.MethodName = "detePhy";
  187. ccp.ServerParams = new object[] { pipeDetailEntity,parmList };
  188. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  189. if (ccp.ReturnCode != -1)
  190. {
  191. if (ccp.ReturnInfo.Equals("删除成功!"))
  192. {
  193. doQuery();
  194. MessageUtil.ShowTips(ccp.ReturnInfo);
  195. }
  196. else
  197. {
  198. MessageUtil.ShowTips(ccp.ReturnInfo);
  199. }
  200. }
  201. }
  202. /// <summary>
  203. /// 删除试样组
  204. /// </summary>
  205. private void deletePhyMax()
  206. {
  207. this.ultraGrid1.UpdateData();
  208. this.ultraGrid5.UpdateData();
  209. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  210. UltraGridRow uRow5 = this.ultraGrid5.ActiveRow;
  211. if (uRow == null || uRow5 == null) return;
  212. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  213. if (checkMagRows.Count() == 0)
  214. {
  215. MessageUtil.ShowTips("请选择删除的试样组!");
  216. return;
  217. }
  218. ArrayList parmList = new ArrayList();
  219. foreach (UltraGridRow row in checkMagRows)
  220. {
  221. PipeCheckconsignDetailEntity phyTity = (PipeCheckconsignDetailEntity)row.ListObject;
  222. string phyEntity = JSONFormat.Format(phyTity);
  223. parmList.Add(phyEntity);
  224. }
  225. CoreClientParam ccp = new CoreClientParam();
  226. ccp.ServerName = "com.steering.lims.data.pipe.FrmCheckConsignQuery";
  227. ccp.MethodName = "deletePhyMax";
  228. ccp.ServerParams = new object[] { parmList, uRow5.Cells["HeatNo"].Text, uRow5.Cells["CraftSource"].Text };
  229. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  230. if (ccp.ReturnCode != -1)
  231. {
  232. if (ccp.ReturnInfo.Equals("删除成功!"))
  233. {
  234. doQuery();
  235. MessageUtil.ShowTips(ccp.ReturnInfo);
  236. }
  237. else
  238. {
  239. MessageUtil.ShowTips(ccp.ReturnInfo);
  240. }
  241. }
  242. }
  243. /// <summary>
  244. /// 小样热处理
  245. /// </summary>
  246. private void updateRcl()
  247. {
  248. this.ultraGrid1.UpdateData();
  249. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  250. if (uRow == null) return;
  251. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  252. if (checkMagRows.Count() == 0)
  253. {
  254. MessageUtil.ShowTips("请选择需要热处理试样!");
  255. return;
  256. }
  257. ArrayList parmList = new ArrayList();
  258. foreach (UltraGridRow row in checkMagRows)
  259. {
  260. PipeCheckconsignDetailEntity phyTity = (PipeCheckconsignDetailEntity)row.ListObject;
  261. string phyEntity = JSONFormat.Format(phyTity);
  262. parmList.Add(phyEntity);
  263. }
  264. CoreClientParam ccp = new CoreClientParam();
  265. ccp.ServerName = "com.steering.lims.data.pipe.FrmCheckConsignQuery";
  266. ccp.MethodName = "updateRcl";
  267. ccp.ServerParams = new object[] { parmList };
  268. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  269. if (ccp.ReturnCode != -1)
  270. {
  271. if (ccp.ReturnInfo.Equals("修改成功!"))
  272. {
  273. doQuery();
  274. MessageUtil.ShowTips(ccp.ReturnInfo);
  275. }
  276. else
  277. {
  278. MessageUtil.ShowTips(ccp.ReturnInfo);
  279. }
  280. }
  281. }
  282. /// <summary>
  283. /// 保存试样特殊要求备注
  284. /// </summary>
  285. private void updateTsRemark()
  286. {
  287. this.ultraGrid1.UpdateData();
  288. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  289. if (uRow == null) return;
  290. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  291. if (checkMagRows.Count() == 0)
  292. {
  293. MessageUtil.ShowTips("请选择需要保存的试样!");
  294. return;
  295. }
  296. ArrayList parmList = new ArrayList();
  297. foreach (UltraGridRow row in checkMagRows)
  298. {
  299. PipeCheckconsignDetailEntity phyTity = (PipeCheckconsignDetailEntity)row.ListObject;
  300. string phyEntity = JSONFormat.Format(phyTity);
  301. parmList.Add(phyEntity);
  302. }
  303. CoreClientParam ccp = new CoreClientParam();
  304. ccp.ServerName = "com.steering.lims.data.pipe.FrmCheckConsignQuery";
  305. ccp.MethodName = "updateTsRemark";
  306. ccp.ServerParams = new object[] { parmList };
  307. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  308. if (ccp.ReturnCode != -1)
  309. {
  310. if (ccp.ReturnInfo.Equals("修改成功!"))
  311. {
  312. doQuery();
  313. MessageUtil.ShowTips(ccp.ReturnInfo);
  314. }
  315. else
  316. {
  317. MessageUtil.ShowTips(ccp.ReturnInfo);
  318. }
  319. }
  320. }
  321. private void CloseForm()
  322. {
  323. this.Close();
  324. }
  325. private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
  326. {
  327. UltraGridRow uRow = this.ultraGrid5.ActiveRow;
  328. if (uRow == null) return;
  329. doQueryPhyMax(uRow);
  330. doQueryCraftFile(uRow);
  331. }
  332. /// <summary>
  333. /// 查询理化试样组信息
  334. /// </summary>
  335. private void doQueryCraftFile(UltraGridRow uRow)
  336. {
  337. PipeCheckconsignBaseinfoEntity baseTity = (PipeCheckconsignBaseinfoEntity)uRow.ListObject;
  338. string baseEntity = JSONFormat.Format(baseTity);
  339. List<CraftOrdDesignStdPicEntity> listSource = EntityHelper.GetData<CraftOrdDesignStdPicEntity>("com.steering.lims.data.pipe.FrmCheckConsignQuery.doQueryCraftFile", new object[] { baseEntity }, _ob);
  340. craftOrdDesignStdPicEntityBindingSource.DataSource = listSource;
  341. }
  342. /// <summary>
  343. /// 查询检验单下试样号、试样组信息
  344. /// </summary>
  345. /// <param name="uRow"></param>
  346. private void doQueryPhyMax(UltraGridRow uRow)
  347. {
  348. List<PipeCheckconsignDetailEntity> listSource = EntityHelper.GetData<PipeCheckconsignDetailEntity>("com.steering.lims.data.pipe.FrmCheckConsignQuery.doQuerySampleNo", new object[] { uRow.Cells["CheckNo"].Text }, _ob);
  349. pipeCheckconsignDetailEntityBindingSource.DataSource = listSource;
  350. }
  351. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  352. {
  353. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  354. if (uRow == null) return;
  355. doQueryPhy(uRow);
  356. }
  357. /// <summary>
  358. /// 查询检验项
  359. /// </summary>
  360. /// <param name="uRow"></param>
  361. private void doQueryPhy(UltraGridRow uRow)
  362. {
  363. List<PipeCheckconsignPhydetailEntity> listSource = EntityHelper.GetData<PipeCheckconsignPhydetailEntity>("com.steering.lims.data.pipe.FrmCheckConsignQuery.doQueryPhy", new object[] { uRow.Cells["CheckNo"].Text, uRow.Cells["SampleNo"].Text, uRow.Cells["PhyCodeMax"].Text }, _ob);
  364. pipeCheckconsignPhydetailEntityBindingSource.DataSource = listSource;
  365. }
  366. private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
  367. {
  368. UltraGridRow uRow = this.ultraGrid3.ActiveRow;
  369. UltraGridRow row = this.ultraGrid5.ActiveRow;
  370. if (uRow == null || row == null) return;
  371. doQueryCraftFilePhy(uRow,row);
  372. }
  373. /// <summary>
  374. /// 查询工艺试样组理化项
  375. /// </summary>
  376. /// <param name="uRow"></param>
  377. private void doQueryCraftFilePhy(UltraGridRow uRow,UltraGridRow row)
  378. {
  379. List<CraftOrdDesignStdPicEntity> listSource = EntityHelper.GetData<CraftOrdDesignStdPicEntity>("com.steering.lims.data.pipe.FrmCheckConsignQuery.doQueryCraftFilePhy", new object[] { uRow.Cells["DesginKey"].Text, uRow.Cells["ProcessCode"].Text, uRow.Cells["PhyCodeMin"].Text, uRow.Cells["CraftSource"].Text, row.Cells["Pic"].Text,row.Cells["IndexSeq"].Text }, _ob);
  380. craftOrdDesignStdPicEntityBindingSource1.DataSource = listSource;
  381. }
  382. private void ultraGrid4_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  383. {
  384. foreach (UltraGridRow uRow in ultraGrid4.Selected.Rows)
  385. {
  386. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  387. {
  388. uRow.Cells["CHK"].Value = true;
  389. }
  390. }
  391. }
  392. }
  393. }