FrmMchBatchSampleNew.cs 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Lims.Port.数据管理.实体类;
  5. using CoreFS.CA06;
  6. using Infragistics.Win;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.Lims.Port
  18. {
  19. public partial class FrmMchBatchSampleNew : FrmBase
  20. {
  21. public FrmMchBatchSampleNew()
  22. {
  23. InitializeComponent();
  24. }
  25. private string plineCode = "";//产线
  26. List<CraftSamplingMEntity> dtPlanM = null;//检验计划主信息
  27. List<CraftSamplingDetailEntity> dtPlanDetial = null;//检验计划从信息
  28. List<CraftSamplingMEntity> dtPlanM1 = null;//分批详细方案
  29. int minBatchNum = 0;//最小分批数量
  30. private Color color1 = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
  31. private Color color2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
  32. private string batchNoZ = "";//性能批号产线标识
  33. private void FrmMilBatchSampleNew_Load(object sender, EventArgs e)
  34. {
  35. DateTime now = DateTime.Now;
  36. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  37. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  38. this.RegStartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  39. this.RegEndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  40. EntityHelper.ShowGridCaption<PlnZyJgxMEntity>(this.ultraGrid1.DisplayLayout.Bands[0]);
  41. EntityHelper.ShowGridCaption<PlnZyJgxMEntity>(this.ultraGrid2.DisplayLayout.Bands[0]);
  42. EntityHelper.ShowGridCaption<PortMchBatchSampleResultEntity>(this.ultraGrid3.DisplayLayout.Bands[0]);
  43. EntityHelper.ShowGridCaption<PortMchBatchSampleResultEntity>(this.ultraGrid8.DisplayLayout.Bands[0]);
  44. EntityHelper.ShowGridCaption<PlnZyJgxMEntity>(this.ultraGrid5.DisplayLayout.Bands[0]);
  45. EntityHelper.ShowGridCaption<PlnZyJgxMEntity>(this.ultraGrid6.DisplayLayout.Bands[0]);
  46. EntityHelper.ShowGridCaption<PortMchBatchSampleResultEntity>(this.ultraGrid7.DisplayLayout.Bands[0]);
  47. EntityHelper.ShowGridCaption<PlnZyJgxMEntity>(this.ultraGrid9.DisplayLayout.Bands[0]);
  48. EntityHelper.ShowGridCaption<PlnZyJgxMEntity>(this.ultraGrid10.DisplayLayout.Bands[0]);
  49. EntityHelper.ShowGridCaption<PipeCheckconsignBaseinfoEntity>(this.ultraGrid12.DisplayLayout.Bands[0]);
  50. EntityHelper.ShowGridCaption<PlnZyJgxMEntity>(this.ultraGrid13.DisplayLayout.Bands[0]);
  51. EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid15.DisplayLayout.Bands[0]);
  52. EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid16.DisplayLayout.Bands[0]);
  53. EntityHelper.ShowGridCaption<PortMchBatchSampleResultEntity>(this.ultraGrid17.DisplayLayout.Bands[0]);
  54. EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid19.DisplayLayout.Bands[0]);
  55. EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid20.DisplayLayout.Bands[0]);
  56. plineCode = PublicPort.GetPCode(this.ValidDataPurviewIds, ob);
  57. cmbSampleType.SelectedIndex = 0;
  58. initPostion();
  59. }
  60. /// <summary>
  61. /// 加载基础取样位置
  62. /// </summary>
  63. private void initPostion()
  64. {
  65. DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPostion", new object[] { }, ob);
  66. if (ds != null && ds.Rows.Count > 0)
  67. {
  68. cmbPostion.DataSource = ds;
  69. cmbPostion.ValueMember = "BASECODE";
  70. cmbPostion1.DataSource = ds;
  71. cmbPostion1.ValueMember = "BASECODE";
  72. cmbPiecePostion.DataSource = ds;
  73. cmbPiecePostion.ValueMember = "BASECODE";
  74. }
  75. }
  76. /// <summary>
  77. /// 重写基类方法
  78. /// </summary>
  79. /// <param name="sender"></param>
  80. /// <param name="ToolbarKey"></param>
  81. public override void ToolBar_Click(object sender, string ToolbarKey)
  82. {
  83. switch (ToolbarKey)
  84. {
  85. case "Query":
  86. doQueryPlan();
  87. break;
  88. case "QueryRepeate":
  89. doQueryRepeate();
  90. break;
  91. case "GetSample":
  92. getSample();
  93. break;
  94. case"ComfrimComplete":
  95. comfrimComplete();
  96. break;
  97. case "CancelGetSample":
  98. cancelGetSample();
  99. break;
  100. case "Confirm":
  101. confirm();
  102. break;
  103. case "CancelConfirm":
  104. cancelConfirm();
  105. break;
  106. case "ReGetSample":
  107. reGetSample();
  108. break;
  109. case "CancelReGetSample":
  110. cancelReGetSample();
  111. break;
  112. case "RepeateFrim":
  113. repeateFrim();
  114. break;
  115. case "CancelRepeateFrim":
  116. cancelRepeateFrim();
  117. break;
  118. case "Print":
  119. printTrust();
  120. break;
  121. case "PrintLable":
  122. printLable();
  123. break;
  124. case "PrintReLable":
  125. printReLable();
  126. break;
  127. case "PrintRe":
  128. printReTrust();
  129. break;
  130. case "Close":
  131. close();
  132. break;
  133. }
  134. }
  135. /// <summary>
  136. /// 撤销复取样
  137. /// </summary>
  138. private void cancelReGetSample()
  139. {
  140. this.ultraGrid15.UpdateData();
  141. this.ultraGrid17.UpdateData();
  142. UltraGridRow uRow = this.ultraGrid15.ActiveRow;
  143. List<PortMchBatchSampleResultEntity> lists = portMchBatchSampleResultEntityBindingSource2.DataSource as List<PortMchBatchSampleResultEntity>;
  144. if (uRow == null || lists.Count <= 0)
  145. {
  146. return;
  147. }
  148. PipeCheckconsignNoqualifiedEntity milPlans = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
  149. string milPlanEntity = JSONFormat.Format(milPlans);
  150. List<string> portMilEntity = lists.Where(p => p.ResamplePipeLenA != "" || p.ResamplePipeLenB != "" || p.ResamplePipeLenC != "" || p.ResamplePipeLenD != "" || p.ResamplePipeLenM != "" || p.ResamplePipeLenE != "" || p.ResamplePipeLenF != "" || p.ResamplePipeLenP != "" || p.ResamplePipeLenQ != "").Select(JSONFormat.Format).ToList();
  151. CoreClientParam ccp = new CoreClientParam();
  152. ccp.ServerName = "com.steering.mes.port.vrp.FrmMchBatchSampleNew";
  153. ccp.MethodName = "cancelReGetSample";
  154. ccp.ServerParams = new object[] { milPlanEntity, portMilEntity };
  155. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  156. if (ccp.ReturnCode != -1)
  157. {
  158. if (ccp.ReturnInfo.Equals("撤销成功!"))
  159. {
  160. doQueryRepeate();
  161. MessageUtil.ShowTips(ccp.ReturnInfo);
  162. }
  163. else
  164. {
  165. MessageUtil.ShowTips(ccp.ReturnInfo);
  166. }
  167. }
  168. }
  169. /// <summary>
  170. /// 复取样
  171. /// </summary>
  172. private void reGetSample()
  173. {
  174. this.ultraGrid15.UpdateData();
  175. this.ultraGrid17.UpdateData();
  176. UltraGridRow uRow = this.ultraGrid15.ActiveRow;
  177. List<PortMchBatchSampleResultEntity> lists = portMchBatchSampleResultEntityBindingSource2.DataSource as List<PortMchBatchSampleResultEntity>;
  178. if (uRow == null || lists.Count <= 0)
  179. {
  180. return;
  181. }
  182. if (lists.Any(p => p.Chk == true && p.ResamplePipeLenA == "" && p.ResamplePipeLenB == "" && p.ResamplePipeLenC == "" && p.ResamplePipeLenD == "" && p.ResamplePipeLenE == "" && p.ResamplePipeLenF == "" && p.ResamplePipeLenP == "" && p.ResamplePipeLenQ == "" && p.ResamplePipeLenM == ""))
  183. {
  184. MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行复取样完成!");
  185. return;
  186. }
  187. if (lists.Any(p => p.Chk == true && !StringUtil.IsInt32(p.ResamplePipeLenA) && !StringUtil.IsInt32(p.ResamplePipeLenB) && !StringUtil.IsInt32(p.ResamplePipeLenC) && !StringUtil.IsInt32(p.ResamplePipeLenD) && !StringUtil.IsInt32(p.ResamplePipeLenE) && !StringUtil.IsInt32(p.ResamplePipeLenF) && !StringUtil.IsInt32(p.ResamplePipeLenP) && !StringUtil.IsInt32(p.ResamplePipeLenQ)&& !StringUtil.IsInt32(p.ResamplePipeLenM)))
  188. {
  189. MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!");
  190. return;
  191. }
  192. PipeCheckconsignNoqualifiedEntity milPlans = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
  193. string milPlanEntity = JSONFormat.Format(milPlans);
  194. List<string> portMilEntity = lists.Where(p => p.Chk).Select(JSONFormat.Format).ToList();
  195. CoreClientParam ccp = new CoreClientParam();
  196. ccp.ServerName = "com.steering.mes.port.vrp.FrmMchBatchSampleNew";
  197. ccp.MethodName = "reGetSample";
  198. ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder() };
  199. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  200. if (ccp.ReturnCode != -1)
  201. {
  202. if (ccp.ReturnInfo.Equals("复取样完成!"))
  203. {
  204. doQueryRepeate();
  205. MessageUtil.ShowTips(ccp.ReturnInfo);
  206. }
  207. else
  208. {
  209. MessageUtil.ShowTips(ccp.ReturnInfo);
  210. }
  211. }
  212. }
  213. /// <summary>
  214. /// 委托完成
  215. /// </summary>
  216. private void comfrimComplete()
  217. {
  218. this.ultraGrid1.UpdateData();
  219. UltraGridRow row = this.ultraGrid1.ActiveRow;
  220. if (row == null) return;
  221. PlnZyJgxMEntity planEntity = (PlnZyJgxMEntity)row.ListObject;
  222. string planTity = JSONFormat.Format(planEntity);
  223. CoreClientParam ccp = new CoreClientParam();
  224. ccp.ServerName = "com.steering.mes.port.vrp.FrmMchBatchSampleNew";
  225. ccp.MethodName = "comfrimComplete";
  226. ccp.ServerParams = new object[] { planTity };
  227. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  228. if (ccp.ReturnCode != -1)
  229. {
  230. if (ccp.ReturnInfo.Equals("委托完成!"))
  231. {
  232. doQueryPlan();
  233. MessageUtil.ShowTips(ccp.ReturnInfo);
  234. }
  235. else
  236. {
  237. MessageUtil.ShowTips(ccp.ReturnInfo);
  238. }
  239. }
  240. }
  241. /// <summary>
  242. /// 查询复取样信息
  243. /// </summary>
  244. private void doQueryRepeate()
  245. {
  246. string startTime = "";
  247. string endTim = "";
  248. string lotNo = "";
  249. string judgeNo = "";
  250. if (this.chkRegTime.Checked)
  251. {
  252. startTime = this.RegStartTime.Value.ToString();
  253. endTim = this.RegEndTime.Value.ToString();
  254. }
  255. if (chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
  256. {
  257. lotNo = this.txtLotNo.Text;
  258. }
  259. if (chkJudgeNo.Checked && this.txtJudgeNo.Text.Trim() != "")
  260. {
  261. judgeNo = this.txtJudgeNo.Text;
  262. }
  263. ArrayList parm = new ArrayList();
  264. parm.Add(startTime);
  265. parm.Add(endTim);
  266. parm.Add(lotNo);
  267. parm.Add(judgeNo);
  268. if (ultraTabControl1.SelectedTab.Key == "4")
  269. {
  270. parm.Add("0");
  271. }
  272. else if (ultraTabControl1.SelectedTab.Key == "5")
  273. {
  274. parm.Add("1");
  275. }
  276. List<PipeCheckconsignNoqualifiedEntity> listSource = EntityHelper.GetData<PipeCheckconsignNoqualifiedEntity>(
  277. "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeate", new object[] { parm, plineCode }, this.ob);
  278. if (ultraTabControl1.SelectedTab.Key == "4")
  279. {
  280. pipeCheckconsignNoqualifiedEntityBindingSource.DataSource = listSource;
  281. }
  282. else if (ultraTabControl1.SelectedTab.Key == "5")
  283. {
  284. pipeCheckconsignNoqualifiedEntityBindingSource3.DataSource = listSource;
  285. }
  286. }
  287. /// <summary>
  288. /// 复取样委托
  289. /// </summary>
  290. private void repeateFrim()
  291. {
  292. this.ultraGrid19.UpdateData();
  293. this.ultraGrid20.UpdateData();
  294. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  295. if (uRow == null) return;
  296. PipeCheckconsignNoqualifiedEntity pipeCheckEntity = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
  297. string pipeTity = JSONFormat.Format(pipeCheckEntity);
  298. List<List<string>> parmList = new List<List<string>>();
  299. foreach (UltraGridRow row in this.ultraGrid21.Rows)
  300. {
  301. List<string> list = new List<string>();
  302. list.Add(row.Cells["PHY_BATCH_NO"].Text);
  303. list.Add(row.Cells["MAT_NO"].Text);
  304. list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text);
  305. list.Add(row.Cells["SAMPLE_POSTION"].Text);
  306. for (int j = 5; j < dataTable5.Columns.Count; j++)
  307. {
  308. if (row.Cells[j].Value == "√")
  309. {
  310. list.Add(row.Cells[j].Column.Key);
  311. }
  312. }
  313. parmList.Add(list);
  314. }
  315. List<List<string>> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault()
  316. ).ToList();
  317. CoreClientParam ccp = new CoreClientParam();
  318. ccp.ServerName = "com.steering.mes.port.vrp.FrmMchBatchSampleNew";
  319. ccp.MethodName = "repeateFrim";
  320. ccp.ServerParams = new object[] { pipeTity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment() };
  321. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  322. if (ccp.ReturnCode != -1)
  323. {
  324. if (ccp.ReturnInfo.Equals("复取样委托成功!"))
  325. {
  326. doQueryRepeate();
  327. MessageUtil.ShowTips(ccp.ReturnInfo);
  328. }
  329. else
  330. {
  331. MessageUtil.ShowTips(ccp.ReturnInfo);
  332. }
  333. }
  334. }
  335. /// <summary>
  336. /// 撤销复取样委托
  337. /// </summary>
  338. private void cancelRepeateFrim()
  339. {
  340. this.ultraGrid19.UpdateData();
  341. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  342. if (uRow == null) return;
  343. PipeCheckconsignNoqualifiedEntity pipeNoTity = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
  344. string pipeNoEntity = JSONFormat.Format(pipeNoTity);
  345. CoreClientParam ccp = new CoreClientParam();
  346. ccp.ServerName = "com.steering.mes.port.vrp.FrmMchBatchSampleNew";
  347. ccp.MethodName = "cancelRepeateFrim";
  348. ccp.ServerParams = new object[] { pipeNoEntity };
  349. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  350. if (ccp.ReturnCode != -1)
  351. {
  352. if (ccp.ReturnInfo.Equals("撤销复取样委托成功!"))
  353. {
  354. doQueryRepeate();
  355. MessageUtil.ShowTips(ccp.ReturnInfo);
  356. }
  357. else
  358. {
  359. MessageUtil.ShowTips(ccp.ReturnInfo);
  360. }
  361. }
  362. }
  363. /// <summary>
  364. /// 打印复样标签
  365. /// </summary>
  366. private void printReLable()
  367. {
  368. this.ultraGrid19.UpdateData();
  369. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  370. if (uRow == null) return;
  371. string checkNo = "F" + uRow.Cells["CheckNo"].Text.Trim();
  372. string strurl = "";
  373. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepEntrustLabel.cpt" + "&CHECK_NO=" + checkNo;
  374. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  375. fBug.AutoSize = true;
  376. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  377. fBug.WindowState = FormWindowState.Maximized;
  378. fBug.Text = "样管号标签";
  379. fBug.Show();
  380. }
  381. /// <summary>
  382. /// 标签
  383. /// </summary>
  384. private void printLable()
  385. {
  386. this.ultraGrid12.UpdateData();
  387. UltraGridRow uRow = this.ultraGrid12.ActiveRow;
  388. if (uRow == null) return;
  389. string checkNo = uRow.Cells["CheckNo"].Text.Trim();
  390. string strurl = "";
  391. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepEntrustLabel.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo + "&JUDGE_STOVE_NO=" + uRow.Cells["HeatNo"].Text.Trim() + "&PROCESS_CODE=F";
  392. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  393. fBug.AutoSize = true;
  394. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  395. fBug.WindowState = FormWindowState.Maximized;
  396. fBug.Text = "样管号标签";
  397. fBug.Show();
  398. }
  399. /// <summary>
  400. /// 打印
  401. /// </summary>
  402. private void printTrust()
  403. {
  404. this.ultraGrid12.UpdateData();
  405. UltraGridRow uRow = this.ultraGrid12.ActiveRow;
  406. if (uRow == null) return;
  407. this.ultraGrid13.UpdateData();
  408. UltraGridRow uRow2 = this.ultraGrid13.ActiveRow;
  409. if (uRow2 == null) return;
  410. string checkNo = uRow.Cells["CheckNo"].Text.Trim();
  411. string orderNo = uRow2.Cells["OrderNo"].Text.Trim();
  412. string strurl = "";
  413. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPortCheckConsignOrder.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo + "&orderNo=" + orderNo;
  414. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  415. fBug.AutoSize = true;
  416. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  417. fBug.WindowState = FormWindowState.Maximized;
  418. fBug.Text = "检验委托单";
  419. fBug.Show();
  420. }
  421. /// <summary>
  422. /// 打印复样委托单
  423. /// </summary>
  424. private void printReTrust()
  425. {
  426. this.ultraGrid19.UpdateData();
  427. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  428. if (uRow == null) return;
  429. this.ultraGrid20.UpdateData();
  430. UltraGridRow uRow2 = this.ultraGrid20.ActiveRow;
  431. if (uRow2 == null) return;
  432. string checkNo = "F" + uRow.Cells["CheckNo"].Text.Trim();
  433. string strurl = "";
  434. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPortCheckConsignOrder.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo ;
  435. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  436. fBug.AutoSize = true;
  437. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  438. fBug.WindowState = FormWindowState.Maximized;
  439. fBug.Text = "检验委托单";
  440. fBug.Show();
  441. }
  442. private void close()
  443. {
  444. this.Close();
  445. }
  446. /// <summary>
  447. /// 取样完成
  448. /// </summary>
  449. private void getSample()
  450. {
  451. this.ultraGrid1.UpdateData();
  452. this.ultraGrid3.UpdateData();
  453. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  454. List<PortMchBatchSampleResultEntity> lists = portMchBatchSampleResultEntityBindingSource.DataSource as List<PortMchBatchSampleResultEntity>;
  455. if (uRow == null || lists.Count <= 0)
  456. {
  457. return;
  458. }
  459. if (lists.Any(p => p.Chk == true && p.SamplePipeLenA == "" && p.SamplePipeLenB == "" && p.SamplePipeLenC == "" && p.SamplePipeLenD == "" && p.SamplePipeLenM == "" && p.SamplePipeLenE == "" && p.SamplePipeLenF == "" && p.SamplePipeLenP == "" && p.SamplePipeLenQ == ""))
  460. {
  461. MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行取样完成!");
  462. return;
  463. }
  464. if (lists.Any(p => p.Chk == true && !StringUtil.IsInt32(p.SamplePipeLenA) && !StringUtil.IsInt32(p.SamplePipeLenB) && !StringUtil.IsInt32(p.SamplePipeLenC) && !StringUtil.IsInt32(p.SamplePipeLenD) && !StringUtil.IsInt32(p.SamplePipeLenM) && !StringUtil.IsInt32(p.SamplePipeLenE) && !StringUtil.IsInt32(p.SamplePipeLenF) && !StringUtil.IsInt32(p.SamplePipeLenP) && !StringUtil.IsInt32(p.SamplePipeLenQ)))
  465. {
  466. MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!");
  467. return;
  468. }
  469. PlnZyJgxMEntity milPlans = (PlnZyJgxMEntity)uRow.ListObject;
  470. string milPlanEntity = JSONFormat.Format(milPlans);
  471. List<string> portMilEntity = lists.Where(p => p.Chk).Select(JSONFormat.Format).ToList();
  472. CoreClientParam ccp = new CoreClientParam();
  473. ccp.ServerName = "com.steering.mes.port.vrp.FrmMchBatchSampleNew";
  474. ccp.MethodName = "getSample";
  475. ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder(), this.cmbSampleType.Value.ToString() };
  476. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  477. if (ccp.ReturnCode != -1)
  478. {
  479. if (ccp.ReturnInfo.Equals("取样完成!"))
  480. {
  481. doQueryPlan();
  482. MessageUtil.ShowTips(ccp.ReturnInfo);
  483. }
  484. else
  485. {
  486. MessageUtil.ShowTips(ccp.ReturnInfo);
  487. }
  488. }
  489. }
  490. /// <summary>
  491. /// 撤销取样完成
  492. /// </summary>
  493. private void cancelGetSample()
  494. {
  495. this.ultraGrid5.UpdateData();
  496. UltraGridRow uRow = this.ultraGrid5.ActiveRow;
  497. UltraGridRow row = this.ultraGrid8.ActiveRow;
  498. if (uRow == null || row == null) return;
  499. PlnZyJgxMEntity milPlans = (PlnZyJgxMEntity)uRow.ListObject;
  500. string milPlanEntity = JSONFormat.Format(milPlans);
  501. CoreClientParam ccp = new CoreClientParam();
  502. ccp.ServerName = "com.steering.mes.port.vrp.FrmMchBatchSampleNew";
  503. ccp.MethodName = "cancelGetSample";
  504. ccp.ServerParams = new object[] { milPlanEntity,row.Cells["PHY_BATCH_NO"].Text };
  505. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  506. if (ccp.ReturnCode != -1)
  507. {
  508. if (ccp.ReturnInfo.Equals("撤销成功!"))
  509. {
  510. doQueryPlan();
  511. MessageUtil.ShowTips(ccp.ReturnInfo);
  512. }
  513. else
  514. {
  515. MessageUtil.ShowTips(ccp.ReturnInfo);
  516. }
  517. }
  518. }
  519. /// <summary>
  520. /// 确认委托
  521. /// </summary>
  522. private void confirm()
  523. {
  524. this.ultraGrid9.UpdateData();
  525. this.ultraGrid10.UpdateData();
  526. this.ultraGrid11.UpdateData();
  527. this.ultraGrid18.UpdateData();
  528. UltraGrid ug = null;
  529. DataTable dataTable = null;
  530. string craftSource = "";
  531. if (ultraTabControl3.SelectedTab.Key == "0")
  532. {
  533. ug = ultraGrid11;
  534. dataTable = dataTable3;
  535. craftSource = "0";
  536. }
  537. else if (ultraTabControl3.SelectedTab.Key == "1")
  538. {
  539. ug = ultraGrid18;
  540. dataTable = dataTable5;
  541. craftSource = "1";
  542. }
  543. else if (ultraTabControl3.SelectedTab.Key == "2")
  544. {
  545. ug = ultraGrid23;
  546. dataTable = dataTable7;
  547. craftSource = "2";
  548. }
  549. UltraGridRow uRow = ultraGrid9.ActiveRow;
  550. if (uRow == null) return;
  551. // List<CraftOrdDesignStdCicEntity> chemSource = EntityHelper.GetData<CraftOrdDesignStdCicEntity>(
  552. //"com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryChem", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text.Substring(0, 6) }, this.ob);//查询成分详细信息
  553. // List<CraftOrdDesignStdPicEntity> phySource = EntityHelper.GetData<CraftOrdDesignStdPicEntity>(
  554. //"com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPhy", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text.Substring(0, 6) }, this.ob);//查询理化详细信息
  555. PlnZyJgxMEntity milTity = (PlnZyJgxMEntity)uRow.ListObject;
  556. milTity.CraftSource = craftSource;
  557. string milEntity = JSONFormat.Format(milTity);
  558. List<List<string>> parmList = new List<List<string>>();
  559. foreach(UltraGridRow row in ug.Rows)
  560. {
  561. int m = 0;
  562. List<string> list = new List<string>();
  563. list.Add(row.Cells["PHY_BATCH_NO"].Text);
  564. list.Add(row.Cells["MAT_NO"].Text);
  565. list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text);
  566. list.Add(row.Cells["SAMPLE_POSTION"].Text);
  567. for (int j = 5; j < dataTable.Columns.Count; j++)
  568. {
  569. if (row.Cells[j].Value == "√")
  570. {
  571. list.Add(row.Cells[j].Column.Key);
  572. m = m + 1;
  573. }
  574. }
  575. if (m > 0)
  576. {
  577. parmList.Add(list);
  578. }
  579. }
  580. List<List<string>> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault()
  581. ).ToList();
  582. CoreClientParam ccp = new CoreClientParam();
  583. ccp.ServerName = "com.steering.mes.port.vrp.FrmMchBatchSampleNew";
  584. ccp.MethodName = "confirm";
  585. ccp.ServerParams = new object[] { milEntity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment() };
  586. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  587. if (ccp.ReturnCode != -1)
  588. {
  589. if (ccp.ReturnInfo.Equals("委托成功!"))
  590. {
  591. doQueryPlan();
  592. MessageUtil.ShowTips(ccp.ReturnInfo);
  593. }
  594. else
  595. {
  596. MessageUtil.ShowTips(ccp.ReturnInfo);
  597. }
  598. }
  599. }
  600. /// <summary>
  601. /// 取消确认
  602. /// </summary>
  603. private void cancelConfirm()
  604. {
  605. this.ultraGrid14.UpdateData();
  606. UltraGridRow uRow = this.ultraGrid12.ActiveRow;
  607. if (uRow == null) return;
  608. PipeCheckconsignBaseinfoEntity milTity = (PipeCheckconsignBaseinfoEntity)uRow.ListObject;
  609. string milPlanEntity = JSONFormat.Format(milTity);
  610. CoreClientParam ccp = new CoreClientParam();
  611. ccp.ServerName = "com.steering.mes.port.vrp.FrmMchBatchSampleNew";
  612. ccp.MethodName = "cancelConfirm";
  613. ccp.ServerParams = new object[] { milPlanEntity };
  614. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  615. if (ccp.ReturnCode != -1)
  616. {
  617. if (ccp.ReturnInfo.Equals("撤销委托成功!"))
  618. {
  619. doQueryPlan();
  620. MessageUtil.ShowTips(ccp.ReturnInfo);
  621. }
  622. else
  623. {
  624. MessageUtil.ShowTips(ccp.ReturnInfo);
  625. }
  626. }
  627. }
  628. /// <summary>
  629. /// 查询炉计划
  630. /// </summary>
  631. private void doQueryPlan()
  632. {
  633. string startTime = "";
  634. string endTim = "";
  635. string lotNo = "";
  636. string judgeNo = "";
  637. List<PlnZyJgxMEntity> listSource = null;
  638. List<PipeCheckconsignBaseinfoEntity> listSource1 = null;
  639. if (this.chkRegTime.Checked)
  640. {
  641. startTime = this.RegStartTime.Value.ToString();
  642. endTim = this.RegEndTime.Value.ToString();
  643. }
  644. if (chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
  645. {
  646. lotNo = this.txtLotNo.Text;
  647. }
  648. if (chkJudgeNo.Checked && this.txtJudgeNo.Text.Trim() != "")
  649. {
  650. judgeNo = this.txtJudgeNo.Text;
  651. }
  652. ArrayList parm = new ArrayList();
  653. parm.Add(startTime);
  654. parm.Add(endTim);
  655. parm.Add(lotNo);
  656. parm.Add(judgeNo);
  657. if (this.ultraTabControl1.SelectedTab.Key == "0")
  658. {
  659. parm.Add("0");
  660. listSource = EntityHelper.GetData<PlnZyJgxMEntity>(
  661. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryPlan", new object[] { parm, plineCode }, this.ob);
  662. }
  663. else if (this.ultraTabControl1.SelectedTab.Key == "1")
  664. {
  665. parm.Add("2");
  666. listSource = EntityHelper.GetData<PlnZyJgxMEntity>(
  667. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryPlan", new object[] { parm, plineCode }, this.ob);
  668. }
  669. else if (this.ultraTabControl1.SelectedTab.Key == "2")
  670. {
  671. parm.Add("2");
  672. listSource = EntityHelper.GetData<PlnZyJgxMEntity>(
  673. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryPlan", new object[] { parm, plineCode }, this.ob);
  674. }
  675. else if (this.ultraTabControl1.SelectedTab.Key == "3")
  676. {
  677. parm.Add("3");
  678. listSource1= EntityHelper.GetData<PipeCheckconsignBaseinfoEntity>(
  679. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryPipeBaseInfo", new object[] { parm, plineCode }, this.ob);
  680. }
  681. if (this.ultraTabControl1.SelectedTab.Key == "0")
  682. {
  683. plnZyJgxMEntityBindingSource1.Clear();
  684. portMchBatchSampleResultEntityBindingSource.Clear();
  685. plnZyJgxMEntityBindingSource.DataSource = listSource;
  686. }
  687. else if (this.ultraTabControl1.SelectedTab.Key == "1")
  688. {
  689. plnZyJgxMEntityBindingSource3.Clear();
  690. portMchBatchSampleResultEntityBindingSource1.Clear();
  691. dataTable2.Clear();
  692. plnZyJgxMEntityBindingSource2.DataSource = listSource;
  693. }
  694. else if (this.ultraTabControl1.SelectedTab.Key == "2")
  695. {
  696. plnZyJgxMEntityBindingSource5.Clear();
  697. dataTable3.Clear();
  698. plnZyJgxMEntityBindingSource4.DataSource = listSource;
  699. }
  700. else if (this.ultraTabControl1.SelectedTab.Key == "3")
  701. {
  702. plnZyJgxMEntityBindingSource6.Clear();
  703. dataTable4.Clear();
  704. pipeCheckconsignBaseinfoEntityBindingSource.DataSource = listSource1;
  705. }
  706. }
  707. private void chkRegTime_CheckedChanged(object sender, EventArgs e)
  708. {
  709. this.RegStartTime.Enabled = this.RegEndTime.Enabled = this.chkRegTime.Checked;
  710. }
  711. private void chkLotNo_CheckedChanged(object sender, EventArgs e)
  712. {
  713. this.txtLotNo.Enabled = this.chkLotNo.Checked;
  714. }
  715. private void chkJudgeNo_CheckedChanged(object sender, EventArgs e)
  716. {
  717. this.txtJudgeNo.Enabled = this.chkJudgeNo.Checked;
  718. }
  719. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  720. {
  721. this.ultraGrid1.UpdateData();
  722. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  723. doQueryBasePlan(uRow);
  724. doQueryRack(uRow);
  725. }
  726. private void initBindTable(UltraGridRow row)
  727. {
  728. List<PortMchBatchSampleResultEntity> lists = portMchBatchSampleResultEntityBindingSource1.DataSource as List<PortMchBatchSampleResultEntity>;
  729. DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryHeadNum", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["JudgeStoveNo"].Text }, ob);
  730. dataTable2.Rows.Clear();
  731. if (lists == null || lists.Count() <= 0) return;
  732. foreach (var list in lists.Where(p => p.PhyBatchNo != "").GroupBy(p => p.PhyBatchNo))
  733. {
  734. DataRow newRow;
  735. newRow = dataTable2.NewRow();
  736. newRow["PHY_BATCH_NO"] = list.Key;
  737. newRow["START_SEQ"] = list.Min(p => int.Parse(p.Seq));
  738. newRow["END_SEQ"] = list.Max(p => int.Parse(p.Seq));
  739. newRow["NUM"] = list.Count();
  740. newRow["SAMPLE_NUM"] = list.Count(p => p.SamplePipeLenA != "" || p.SamplePipeLenB != "" || p.SamplePipeLenC != "" || p.SamplePipeLenD != "" || p.SamplePipeLenM != "" || p.SamplePipeLenE != "" || p.SamplePipeLenF != "" || p.SamplePipeLenP != "" || p.SamplePipeLenQ != "");
  741. if (ds.Rows.Count > 0)
  742. {
  743. for (int i = 0; i < ds.Rows.Count; i++)
  744. {
  745. if (ds.Rows[i]["BATCH_NO"].ToString() == list.Key)
  746. {
  747. newRow["HEAD_NUM"] = ds.Rows[i]["ACOUNT"].ToString();
  748. }
  749. }
  750. }
  751. dataTable2.Rows.Add(newRow);
  752. }
  753. ultraGrid8.Update();
  754. }
  755. /// <summary>
  756. /// 查询炉计划基础信息
  757. /// </summary>
  758. /// <param name="row"></param>
  759. private void doQueryBasePlan(UltraGridRow row)
  760. {
  761. List<PlnZyJgxMEntity> listSource = null;
  762. if (this.ultraTabControl1.SelectedTab.Key == "0")
  763. {
  764. listSource = EntityHelper.GetData<PlnZyJgxMEntity>(
  765. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryBasePlan", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["ZyBatchId"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
  766. plnZyJgxMEntityBindingSource1.DataSource = listSource;
  767. }
  768. else if (this.ultraTabControl1.SelectedTab.Key == "1")
  769. {
  770. listSource = EntityHelper.GetData<PlnZyJgxMEntity>(
  771. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryBasePlan", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["ZyBatchId"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
  772. plnZyJgxMEntityBindingSource3.DataSource = listSource;
  773. }
  774. else if (this.ultraTabControl1.SelectedTab.Key == "2")
  775. {
  776. listSource = EntityHelper.GetData<PlnZyJgxMEntity>(
  777. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryBasePlan", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["ZyBatchId"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
  778. plnZyJgxMEntityBindingSource5.DataSource = listSource;
  779. }else if(this.ultraTabControl1.SelectedTab.Key == "3")
  780. {
  781. listSource = EntityHelper.GetData<PlnZyJgxMEntity>(
  782. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryBasePlan", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["LotNo"].Text, row.Cells["HeatNo"].Text }, this.ob);
  783. plnZyJgxMEntityBindingSource6.DataSource = listSource;
  784. }
  785. }
  786. /// <summary>
  787. /// 查询管号队列
  788. /// </summary>
  789. /// <param name="row"></param>
  790. private void doQueryRack(UltraGridRow row)
  791. {
  792. List<PortMchBatchSampleResultEntity> listSource = null;
  793. if (this.ultraTabControl1.SelectedTab.Key == "0")
  794. {
  795. listSource = EntityHelper.GetData<PortMchBatchSampleResultEntity>(
  796. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryRackQ", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
  797. portMchBatchSampleResultEntityBindingSource.DataSource = listSource;
  798. }
  799. else if (this.ultraTabControl1.SelectedTab.Key == "1")
  800. {
  801. listSource = EntityHelper.GetData<PortMchBatchSampleResultEntity>(
  802. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryRack", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["JudgeStoveNo"].Text }, this.ob);
  803. List<PortMchBatchSampleResultEntity> lists = listSource as List<PortMchBatchSampleResultEntity>;
  804. lists.Where(p => p.IsSamplePipe == "1").ToList().ForEach(p => p.Chk = true);
  805. portMchBatchSampleResultEntityBindingSource1.DataSource = lists;
  806. initBindTable(row);
  807. }
  808. }
  809. private void ultraGrid3_CellChange(object sender, CellEventArgs e)
  810. {
  811. this.ultraGrid3.UpdateData();
  812. dataTable1.Rows.Clear();
  813. ultraGrid3.Update();
  814. ultraGrid3.UpdateData();
  815. List<PortMchBatchSampleResultEntity> lists = portMchBatchSampleResultEntityBindingSource.DataSource as List<PortMchBatchSampleResultEntity>;
  816. if (lists == null || lists.Count() <= 0) return;
  817. //foreach (var list in lists.Where(p => p.PhyBatchNo != "").GroupBy(p => p.PhyBatchNo))
  818. //{
  819. // DataRow newRow;
  820. // newRow = dataTable1.NewRow();
  821. // newRow["PHY_BATCH_NO"] = list.Key;
  822. // newRow["START_SEQ"] = list.Min(p => int.Parse(p.Seq));
  823. // newRow["END_SEQ"] = list.Max(p => int.Parse(p.Seq));
  824. // newRow["NUM"] = list.Count();
  825. // newRow["SAMPLE_NUM"] = list.Count(p => p.SamplePipeLenA != "" || p.SamplePipeLenB != "" || p.SamplePipeLenC != "" || p.SamplePipeLenD != "" || p.SamplePipeLenM != "" || p.SamplePipeLenE != "" || p.SamplePipeLenF != "" || p.SamplePipeLenP != "" || p.SamplePipeLenQ != "");
  826. // newRow["HEAD_NUM"] = list.Sum(p => (p.SamplePipeLenA == "" ? 0 : 1) + (p.SamplePipeLenB == "" ? 0 : 1) + (p.SamplePipeLenC == "" ? 0 : 1) + (p.SamplePipeLenD == "" ? 0 : 1) + (p.SamplePipeLenM == "" ? 0 : 1) + (p.SamplePipeLenE == "" ? 0 : 1) + (p.SamplePipeLenF == "" ? 0 : 1) + (p.SamplePipeLenP == "" ? 0 : 1) + (p.SamplePipeLenQ == "" ? 0 : 1));
  827. // dataTable1.Rows.Add(newRow);
  828. //}
  829. //ultraGrid4.Update();
  830. if (e != null && (e.Cell.Column.Key == "SamplePipeLenA" || e.Cell.Column.Key == "SamplePipeLenB" || e.Cell.Column.Key == "SamplePipeLenC" || e.Cell.Column.Key == "SamplePipeLenD" || e.Cell.Column.Key == "SamplePipeLenM"))
  831. {
  832. if (e.Cell.Row.Cells["Chk"].Value.ToString() == "False")
  833. {
  834. MessageUtil.ShowTips("输入长度前,请勾选样管!");
  835. return;
  836. }
  837. }
  838. if (e != null && e.Cell.Column.Key == "Chk")
  839. {
  840. if (e.Cell.Value.ToString() == "True")
  841. {
  842. e.Cell.Row.RowSelectorAppearance.BackColor = Color.Red;
  843. txtMatNo.Text = e.Cell.Row.Cells["MatNo"].Text;
  844. }
  845. else
  846. {
  847. e.Cell.Row.RowSelectorAppearance.BackColor = Color.Empty;
  848. }
  849. }
  850. }
  851. private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
  852. {
  853. this.ultraGrid5.UpdateData();
  854. UltraGridRow uRow = this.ultraGrid5.ActiveRow;
  855. if (uRow == null) return;
  856. doQueryRack(uRow);
  857. doQueryBasePlan(uRow);
  858. }
  859. DataTable dtChem = new DataTable();
  860. DataTable dtPhy = new DataTable();
  861. private void ultraGrid9_AfterRowActivate(object sender, EventArgs e)
  862. {
  863. this.ultraGrid9.UpdateData();
  864. UltraGridRow uRow = this.ultraGrid9.ActiveRow;
  865. if (uRow == null) return;
  866. doQuerySampleRack(uRow,"0");//查询正常样管信息
  867. doQuerySampleRack(uRow,"1");//查询首日检样管信息
  868. doQuerySampleRack(uRow, "2");//查询生产加样样管信息
  869. doQueryBasePlan(uRow);
  870. doQueryPhyChem(uRow,"0");//查询正常样成分、理化项目明细
  871. doQueryPhyChem(uRow,"1");//查询首日检成分、理化项目明细
  872. doQueryPhyChem(uRow, "2");//查询生产加样成分、理化项目明细
  873. //initBaseInfo(uRow);//加载已委托检验单
  874. }
  875. private void initBaseInfo(UltraGridRow row)
  876. {
  877. DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.initBaseInfo", new object[] { row.Cells["JudgeStoveNo"].Text, "F" }, ob);
  878. if (ds != null && ds.Rows.Count > 0)
  879. {
  880. //cmbCheckNo.DataSource = ds;
  881. //cmbCheckNo.ValueMember = "CHECK_NO_VALUE";
  882. }
  883. }
  884. private void ultraGrid12_AfterRowActivate(object sender, EventArgs e)
  885. {
  886. this.ultraGrid12.UpdateData();
  887. UltraGridRow uRow = this.ultraGrid12.ActiveRow;
  888. if (uRow == null) return;
  889. doQueryBasePlan(uRow);
  890. doQuerySampleNo(uRow);//查询试样号信息
  891. }
  892. /// <summary>
  893. /// 查询试样号信息
  894. /// </summary>
  895. /// <param name="uRow"></param>
  896. private void doQuerySampleNo(UltraGridRow uRow)
  897. {
  898. while (dataTable4.Columns.Count > 5)
  899. {
  900. dataTable4.Columns.RemoveAt(5);
  901. }
  902. DataTable dtSample = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryDetialSampleNo",
  903. new Object[] { uRow.Cells["CheckNo"].Text }, ob);
  904. dataTable4.Rows.Clear();
  905. dtSample.AsEnumerable().GroupBy(p => new { BatchNo = p["BATCH_NO"].ToString(), Sample = p["HEAD_MAT_NO"].ToString(),MatNo = p["MAT_NO"].ToString(),CheckNo = p["CHECK_NO"].ToString() }).ToList()
  906. .ForEach(p =>
  907. {
  908. foreach (DataRow row in p)
  909. {
  910. if (!dataTable4.Columns.Contains(row["PHY_CODE_MAX"].ToString()))
  911. {
  912. DataColumn phyCloum = new DataColumn();
  913. phyCloum.ColumnName = row["PHY_CODE_MAX"].ToString();
  914. phyCloum.Caption = row["PHY_NAME_MAX"].ToString();
  915. dataTable4.Columns.Add(phyCloum);
  916. }
  917. }
  918. DataRow dr = dataTable4.NewRow();
  919. dr["PHY_BATCH_NO"] = p.Key.BatchNo;
  920. dr["HEAD_MAT_NO"] = p.Key.Sample;
  921. dr["SAMPLE_LEN"] = p.Max(q => q["SAMPLE_LEN"]);
  922. dr["MAT_NO"] = p.Key.MatNo;
  923. dr["CHECK_NO"] = p.Key.CheckNo;
  924. foreach (DataRow row in p)
  925. {
  926. dr[row["PHY_CODE_MAX"].ToString()] = row["SAMPLE_COUNT"].ToString();
  927. }
  928. dataTable4.Rows.Add(dr);
  929. });
  930. ultraGrid14.DataBind();
  931. GridHelper.RefreshAndAutoSize(ultraGrid14);
  932. }
  933. /// <summary>
  934. /// 查询成分理化项目明细
  935. /// </summary>
  936. /// <param name="uRow"></param>
  937. private void doQueryPhyChem(UltraGridRow uRow,string sampleType)
  938. {
  939. DataTable dataTable = null;
  940. UltraGrid ug = null;
  941. string craftSource = "";
  942. if (sampleType == "0")
  943. {
  944. dataTable = dataTable3;
  945. ug = ultraGrid11;
  946. craftSource = "0";
  947. }
  948. else if (sampleType == "1")
  949. {
  950. dataTable = dataTable5;
  951. ug = ultraGrid18;
  952. craftSource = "2";
  953. ultraLabel1.Text = "";
  954. }
  955. else if (sampleType == "2")
  956. {
  957. dataTable = dataTable7;
  958. ug = ultraGrid23;
  959. craftSource = "0";
  960. }
  961. while (dataTable.Columns.Count > 5)
  962. {
  963. dataTable.Columns.RemoveAt(5);
  964. }
  965. dtChem = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryChem", new Object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text.Substring(0, 6), craftSource }, ob);//查询成分明细
  966. if (dtChem.Rows.Count > 0)
  967. {
  968. DataColumn hxCloum = new DataColumn();
  969. hxCloum.ColumnName = "HX";
  970. hxCloum.Caption = "化学";
  971. dataTable.Columns.Add(hxCloum);
  972. }
  973. dtPhy = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryPhy", new Object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text.Substring(0, 6), craftSource }, ob);//查询理化明细
  974. string[] phyMaxCode = null;
  975. ultraLabel4.Text = "";
  976. List<string> list = new List<string>();
  977. if (dtPhy.Rows.Count > 0)
  978. {
  979. dtPhy.AsEnumerable().Select(p => new { Code = p["PHY_CODE_MIN"].ToString(), Name = p["PHY_NAME_MIN"].ToString(), rate = p["RATE"].ToString(), rateName = p["DESC_RATE"].ToString(), common = p["COMMON"].ToString() }).Distinct().ToList()
  980. .ForEach(p =>
  981. {
  982. DataColumn phyCloum = new DataColumn();
  983. phyCloum.ColumnName = p.Code;
  984. phyCloum.Caption = p.Name;
  985. dataTable.Columns.Add(phyCloum);
  986. if (p.rate.Equals("408601") || p.rate.Equals("408608"))
  987. {
  988. ultraLabel4.Text = ultraLabel4.Text + p.Name + " 取样频次:" + p.rateName;
  989. list.Add(p.Code);
  990. }
  991. if (sampleType == "1")
  992. {
  993. if (p.common.Equals("1"))
  994. {
  995. ultraLabel1.Text = ultraLabel1.Text + p.Name + " (共样) ";
  996. }
  997. }
  998. });
  999. }
  1000. foreach (DataRow dr in dataTable.Rows)
  1001. {
  1002. string[] phyCodeGroup = dr["PHY_CODE_GROUP"].ToString().Split(',');
  1003. for (int i = 5; i < dataTable.Columns.Count; i++)
  1004. {
  1005. if (phyCodeGroup.Contains(dataTable.Columns[i].ColumnName))
  1006. {
  1007. dr[i] = "√";
  1008. }
  1009. }
  1010. }
  1011. phyMaxCode = list.ToArray();
  1012. ug.DataBind();
  1013. GridHelper.RefreshAndAutoSize(ug);
  1014. ultraLabel4.ForeColor = Color.Red;
  1015. ultraLabel1.ForeColor = Color.Red;
  1016. }
  1017. private void doQueryPhyCodeMax(string[] phyMaxCode, string lotNo)
  1018. {
  1019. List<PipeCheckconsignDetailEntity> listSource = EntityHelper.GetData<PipeCheckconsignDetailEntity>(
  1020. "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPhyCodeMax", new object[] { lotNo, phyMaxCode }, this.ob);
  1021. pipeCheckconsignDetailEntityBindingSource.DataSource = listSource;
  1022. }
  1023. /// <summary>
  1024. /// 查询正常样管信息
  1025. /// </summary>
  1026. private void doQuerySampleRack(UltraGridRow uRow, string sampleType)
  1027. {
  1028. DataTable dtBatchNo = null;
  1029. if (sampleType == "0")
  1030. {
  1031. dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQuerySampleInfo",
  1032. new Object[] { uRow.Cells["HeatPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, sampleType }, ob);
  1033. }else if(sampleType == "1")
  1034. {
  1035. dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQuerySampleInfo",
  1036. new Object[] { uRow.Cells["HeatPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "1" }, ob);
  1037. }
  1038. else if (sampleType == "2")
  1039. {
  1040. dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQuerySampleInfo",
  1041. new Object[] { uRow.Cells["HeatPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "2" }, ob);
  1042. }
  1043. if (sampleType == "0")
  1044. {
  1045. GridHelper.CopyDataToDatatable(dtBatchNo, dataTable3, true);
  1046. }
  1047. else if (sampleType == "1")
  1048. {
  1049. GridHelper.CopyDataToDatatable(dtBatchNo, dataTable5, true);
  1050. }
  1051. else if (sampleType == "2")
  1052. {
  1053. GridHelper.CopyDataToDatatable(dtBatchNo, dataTable7, true);
  1054. }
  1055. }
  1056. private void ultraGrid11_ClickCell(object sender, ClickCellEventArgs e)
  1057. {
  1058. this.ultraGrid9.UpdateData();
  1059. UltraGridRow uRow = this.ultraGrid9.ActiveRow;
  1060. if (uRow == null) return;
  1061. string craftSource = "";
  1062. if (ultraTabControl3.SelectedTab.Key == "0")
  1063. {
  1064. craftSource = "0";
  1065. }
  1066. else if (ultraTabControl3.SelectedTab.Key == "1")
  1067. {
  1068. craftSource = "2";
  1069. }
  1070. else
  1071. {
  1072. craftSource = "0";
  1073. }
  1074. if (e.Cell.Column.Key != "PHY_BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION")
  1075. {
  1076. if (e.Cell.Text.Trim() == "")
  1077. {
  1078. DataTable ds = new DataTable();
  1079. if (e.Cell.Column.Key == "C0004" || e.Cell.Column.Key == "C0100" || e.Cell.Column.Key == "C0103" || e.Cell.Column.Key == "C0107")
  1080. {
  1081. if(ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0030")){
  1082. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030" }, ob);
  1083. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1084. {
  1085. e.Cell.Row.Cells["C0030"].Value = "√";
  1086. }
  1087. }
  1088. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0033"))
  1089. {
  1090. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033" }, ob);
  1091. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1092. {
  1093. e.Cell.Row.Cells["C0033"].Value = "√";
  1094. }
  1095. }
  1096. }
  1097. else if (e.Cell.Column.Key == "C0030")
  1098. {
  1099. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030" }, ob);
  1100. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1101. {
  1102. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107"))
  1103. {
  1104. e.Cell.Row.Cells["C0107"].Value = "√";
  1105. }
  1106. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103"))
  1107. {
  1108. e.Cell.Row.Cells["C0103"].Value = "√";
  1109. }
  1110. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100"))
  1111. {
  1112. e.Cell.Row.Cells["C0100"].Value = "√";
  1113. }
  1114. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004"))
  1115. {
  1116. e.Cell.Row.Cells["C0004"].Value = "√";
  1117. }
  1118. }
  1119. }
  1120. else if (e.Cell.Column.Key == "C0033")
  1121. {
  1122. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033" }, ob);
  1123. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1124. {
  1125. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107"))
  1126. {
  1127. e.Cell.Row.Cells["C0107"].Value = "√";
  1128. }
  1129. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103"))
  1130. {
  1131. e.Cell.Row.Cells["C0103"].Value = "√";
  1132. }
  1133. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100"))
  1134. {
  1135. e.Cell.Row.Cells["C0100"].Value = "√";
  1136. }
  1137. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004"))
  1138. {
  1139. e.Cell.Row.Cells["C0004"].Value = "√";
  1140. }
  1141. }
  1142. }
  1143. e.Cell.Value = "√";
  1144. }
  1145. else
  1146. {
  1147. e.Cell.Value = "";
  1148. }
  1149. }
  1150. }
  1151. private void FrmMilBatchSampleNew_Shown(object sender, EventArgs e)
  1152. {
  1153. if (toolMenu == null || toolMenu.Toolbars == null) return;
  1154. if (toolMenu.Toolbars[0].Tools.Exists("Confirm"))
  1155. {
  1156. toolMenu.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = DefaultableBoolean.False;
  1157. }
  1158. if (toolMenu.Toolbars[0].Tools.Exists("CancelConfirm"))
  1159. {
  1160. toolMenu.Toolbars[0].Tools["CancelConfirm"].InstanceProps.Visible = DefaultableBoolean.False;
  1161. }
  1162. if (toolMenu.Toolbars[0].Tools.Exists("Print"))
  1163. {
  1164. toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = DefaultableBoolean.False;
  1165. }
  1166. if (toolMenu.Toolbars[0].Tools.Exists("PrintLable"))
  1167. {
  1168. toolMenu.Toolbars[0].Tools["PrintLable"].InstanceProps.Visible = DefaultableBoolean.False;
  1169. }
  1170. if (toolMenu.Toolbars[0].Tools.Exists("CancelGetSample"))
  1171. {
  1172. toolMenu.Toolbars[0].Tools["CancelGetSample"].InstanceProps.Visible = DefaultableBoolean.False;
  1173. }
  1174. if (toolMenu.Toolbars[0].Tools.Exists("QueryRepeate"))
  1175. {
  1176. toolMenu.Toolbars[0].Tools["QueryRepeate"].InstanceProps.Visible = DefaultableBoolean.False;
  1177. }
  1178. if (toolMenu.Toolbars[0].Tools.Exists("ReGetSample"))
  1179. {
  1180. toolMenu.Toolbars[0].Tools["ReGetSample"].InstanceProps.Visible = DefaultableBoolean.False;
  1181. }
  1182. if (toolMenu.Toolbars[0].Tools.Exists("CancelReGetSample"))
  1183. {
  1184. toolMenu.Toolbars[0].Tools["CancelReGetSample"].InstanceProps.Visible = DefaultableBoolean.False;
  1185. }
  1186. if (toolMenu.Toolbars[0].Tools.Exists("RepeateFrim"))
  1187. {
  1188. toolMenu.Toolbars[0].Tools["RepeateFrim"].InstanceProps.Visible = DefaultableBoolean.False;
  1189. }
  1190. if (toolMenu.Toolbars[0].Tools.Exists("CancelRepeateFrim"))
  1191. {
  1192. toolMenu.Toolbars[0].Tools["CancelRepeateFrim"].InstanceProps.Visible = DefaultableBoolean.False;
  1193. }
  1194. if (toolMenu.Toolbars[0].Tools.Exists("PrintRe"))
  1195. {
  1196. toolMenu.Toolbars[0].Tools["PrintRe"].InstanceProps.Visible = DefaultableBoolean.False;
  1197. }
  1198. if (toolMenu.Toolbars[0].Tools.Exists("PrintReLable"))
  1199. {
  1200. toolMenu.Toolbars[0].Tools["PrintReLable"].InstanceProps.Visible = DefaultableBoolean.False;
  1201. }
  1202. }
  1203. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  1204. {
  1205. if (toolMenu == null || toolMenu.Toolbars == null) return;
  1206. if (toolMenu.Toolbars[0].Tools.Exists("Query")) { toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 || this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.False : DefaultableBoolean.True; }
  1207. if (toolMenu.Toolbars[0].Tools.Exists("GetSample")) { toolMenu.Toolbars[0].Tools["GetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1208. if (toolMenu.Toolbars[0].Tools.Exists("ComfrimComplete")) { toolMenu.Toolbars[0].Tools["ComfrimComplete"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1209. if (toolMenu.Toolbars[0].Tools.Exists("CancelGetSample")) { toolMenu.Toolbars[0].Tools["CancelGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 1 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1210. if (toolMenu.Toolbars[0].Tools.Exists("Confirm")) { toolMenu.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 2 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1211. if (toolMenu.Toolbars[0].Tools.Exists("CancelConfirm")) { toolMenu.Toolbars[0].Tools["CancelConfirm"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1212. if (toolMenu.Toolbars[0].Tools.Exists("Print")) { toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1213. if (toolMenu.Toolbars[0].Tools.Exists("PrintLable")) { toolMenu.Toolbars[0].Tools["PrintLable"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1214. if (toolMenu.Toolbars[0].Tools.Exists("ReGetSample")) { toolMenu.Toolbars[0].Tools["ReGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1215. if (toolMenu.Toolbars[0].Tools.Exists("CancelReGetSample")) { toolMenu.Toolbars[0].Tools["CancelReGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1216. if (toolMenu.Toolbars[0].Tools.Exists("QueryRepeate")) { toolMenu.Toolbars[0].Tools["QueryRepeate"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 || this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1217. if (toolMenu.Toolbars[0].Tools.Exists("RepeateFrim")) { toolMenu.Toolbars[0].Tools["RepeateFrim"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1218. if (toolMenu.Toolbars[0].Tools.Exists("CancelRepeateFrim")) { toolMenu.Toolbars[0].Tools["CancelRepeateFrim"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1219. if (toolMenu.Toolbars[0].Tools.Exists("PrintRe")) { toolMenu.Toolbars[0].Tools["PrintRe"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1220. if (toolMenu.Toolbars[0].Tools.Exists("PrintReLable")) { toolMenu.Toolbars[0].Tools["PrintReLable"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  1221. }
  1222. /// <summary>
  1223. /// 逐支取样
  1224. /// </summary>
  1225. /// <param name="sender"></param>
  1226. /// <param name="e"></param>
  1227. private void pipeceButtonStd_Click(object sender, EventArgs e)
  1228. {
  1229. this.ultraGrid1.UpdateData();
  1230. this.ultraGrid3.UpdateData();
  1231. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  1232. if (uRow == null) return;
  1233. string len = "";
  1234. List<PortMchBatchSampleResultEntity> lists = portMchBatchSampleResultEntityBindingSource.DataSource as List<PortMchBatchSampleResultEntity>;
  1235. var m = lists.Where(p => p.PhyBatchNo != "").ToList();//判断是否还未分配性能批号集合数据
  1236. if (m.Count == 0)
  1237. {
  1238. return;
  1239. }
  1240. if (this.txtPieceLen.Text == "")
  1241. {
  1242. MessageUtil.ShowTips("请输入逐支取样长度!");
  1243. return;
  1244. }
  1245. if (!StringUtil.IsInt(this.txtPieceLen.Text.Trim().ToString3()))
  1246. {
  1247. MessageUtil.ShowTips("逐支取样长度需输入正整数!");
  1248. return;
  1249. }
  1250. len = this.txtPieceLen.Text.Trim();
  1251. DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryPhyMaxPipece", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, this.cmbSampleType.Value.ToString() }, ob);
  1252. if (ds.Rows.Count == 0)
  1253. {
  1254. MessageUtil.ShowTips("无逐支取样试样组,不允许一键取样!");
  1255. return;
  1256. }
  1257. var status = new List<string> { };
  1258. status = this.cmbPiecePostion.CheckedItems.Select(p => p.DataValue.ToString()).ToList();
  1259. if (!status.Any()) status = new List<string> { "401201", "401202", "401217", "401218", "401219", "401220", "401221", "401222", "401223" };
  1260. List<PipeCheckconsignDetailEntity> listS = EntityHelper.GetData<PipeCheckconsignDetailEntity>(
  1261. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQuerySampleMatNo", new object[] { uRow.Cells["JudgeStoveNo"].Text, this.cmbSampleType.Value.ToString() }, this.ob);
  1262. for (int i = 0; i < lists.Count; i++)
  1263. {
  1264. var p = lists[i];
  1265. if (status.ToArray().Length == 1)
  1266. {
  1267. var listD = listS.Where(q => q.MatNo == p.MatNo).ToList();
  1268. if (listD.Any()) return;
  1269. if (status.Contains("401201") || status.Contains("401202"))
  1270. {
  1271. if (i == 0)
  1272. {
  1273. p.SamplePipeLenA = len;
  1274. }
  1275. else
  1276. {
  1277. var LastlistD = listS.Where(q => q.MatNo == lists[i - 1].MatNo).ToList();
  1278. if (LastlistD.Any())
  1279. {
  1280. if (LastlistD[0].Postion == "A")
  1281. {
  1282. p.SamplePipeLenB = len;
  1283. }
  1284. else
  1285. {
  1286. p.SamplePipeLenA = len;
  1287. }
  1288. }
  1289. else
  1290. {
  1291. if (lists[i - 1].SamplePipeLenA == "")
  1292. {
  1293. p.SamplePipeLenA = len;
  1294. }
  1295. else
  1296. {
  1297. p.SamplePipeLenB = len;
  1298. }
  1299. }
  1300. }
  1301. }
  1302. if (status.Contains("401217"))
  1303. {
  1304. p.SamplePipeLenC = len;
  1305. }
  1306. if (status.Contains("401218"))
  1307. {
  1308. p.SamplePipeLenD = len;
  1309. }
  1310. if (status.Contains("401219"))
  1311. {
  1312. p.SamplePipeLenM = len;
  1313. }
  1314. if (status.Contains("401220"))
  1315. {
  1316. p.SamplePipeLenE = len;
  1317. }
  1318. if (status.Contains("401221"))
  1319. {
  1320. p.SamplePipeLenF = len;
  1321. }
  1322. if (status.Contains("401222"))
  1323. {
  1324. p.SamplePipeLenP = len;
  1325. }
  1326. if (status.Contains("401223"))
  1327. {
  1328. p.SamplePipeLenQ = len;
  1329. }
  1330. }
  1331. else
  1332. {
  1333. var listD = listS.Where(q => q.MatNo == p.MatNo).ToList();
  1334. if (listD.Any()) return;
  1335. if (status.Contains("401201"))
  1336. {
  1337. p.SamplePipeLenA = len;
  1338. }
  1339. if (status.Contains("401202"))
  1340. {
  1341. p.SamplePipeLenB = len;
  1342. }
  1343. if (status.Contains("401217"))
  1344. {
  1345. p.SamplePipeLenC = len;
  1346. }
  1347. if (status.Contains("401218"))
  1348. {
  1349. p.SamplePipeLenD = len;
  1350. }
  1351. if (status.Contains("401219"))
  1352. {
  1353. p.SamplePipeLenM = len;
  1354. }
  1355. if (status.Contains("401220"))
  1356. {
  1357. p.SamplePipeLenE = len;
  1358. }
  1359. if (status.Contains("401221"))
  1360. {
  1361. p.SamplePipeLenF = len;
  1362. }
  1363. if (status.Contains("401222"))
  1364. {
  1365. p.SamplePipeLenP = len;
  1366. }
  1367. if (status.Contains("401223"))
  1368. {
  1369. p.SamplePipeLenQ = len;
  1370. }
  1371. }
  1372. //p.ChemResultCode = "1";
  1373. p.Chk = true;
  1374. }
  1375. ultraGrid3.Update();
  1376. ultraGrid3.DataBind();
  1377. ultraGrid3_CellChange(null, null);
  1378. }
  1379. private void ultraGrid3_InitializeRow(object sender, InitializeRowEventArgs e)
  1380. {
  1381. PortMchBatchSampleResultEntity portHttBatchSampleResultEntity = e.Row.ListObject as PortMchBatchSampleResultEntity;
  1382. if (portHttBatchSampleResultEntity.PhyBatchNo == "") return;
  1383. if (portHttBatchSampleResultEntity.IsSamplePipe == "1")
  1384. {
  1385. ultraGrid3.Rows[e.Row.Index].RowSelectorAppearance.BackColor = Color.Red;
  1386. }
  1387. if (e.Row.Index == 0)
  1388. {
  1389. e.Row.Appearance.BackColor = color1;
  1390. }
  1391. else
  1392. {
  1393. PortMchBatchSampleResultEntity lastList = ultraGrid3.Rows[e.Row.Index - 1].ListObject as PortMchBatchSampleResultEntity;
  1394. if (portHttBatchSampleResultEntity.PhyBatchNo == lastList.PhyBatchNo)
  1395. {
  1396. e.Row.Appearance.BackColor = ultraGrid3.Rows[e.Row.Index - 1].Appearance.BackColor;
  1397. }
  1398. else
  1399. {
  1400. e.Row.Appearance.BackColor = ultraGrid3.Rows[e.Row.Index - 1].Appearance.BackColor == color1 ? color2 : color1;
  1401. }
  1402. }
  1403. }
  1404. private void txtLen_ValueChanged(object sender, EventArgs e)
  1405. {
  1406. if (!StringUtil.IsInt(this.txtLen.Text)) return;
  1407. List<PortMchBatchSampleResultEntity> list1 = null;
  1408. list1 = portMchBatchSampleResultEntityBindingSource.DataSource as List<PortMchBatchSampleResultEntity>;
  1409. if (list1.Any())
  1410. {
  1411. if (this.cmbPostion.Value.ToString().Equals("401201"))//A端
  1412. {
  1413. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenA = txtLen.Text);
  1414. }
  1415. else if (this.cmbPostion.Value.ToString().Equals("401202"))
  1416. {
  1417. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenB = txtLen.Text);
  1418. }
  1419. else if (this.cmbPostion.Value.ToString().Equals("401217"))
  1420. {
  1421. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenC = txtLen.Text);
  1422. }
  1423. else if (this.cmbPostion.Value.ToString().Equals("401218"))
  1424. {
  1425. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenD = txtLen.Text);
  1426. }
  1427. else if (this.cmbPostion.Value.ToString().Equals("401219"))
  1428. {
  1429. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenM = txtLen.Text);
  1430. }
  1431. else if (this.cmbPostion.Value.ToString().Equals("401220"))
  1432. {
  1433. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenE = txtLen.Text);
  1434. }
  1435. else if (this.cmbPostion.Value.ToString().Equals("401221"))
  1436. {
  1437. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenF = txtLen.Text);
  1438. }
  1439. else if (this.cmbPostion.Value.ToString().Equals("401222"))
  1440. {
  1441. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenP = txtLen.Text);
  1442. }
  1443. else if (this.cmbPostion.Value.ToString().Equals("401223"))
  1444. {
  1445. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenQ = txtLen.Text);
  1446. }
  1447. }
  1448. ultraGrid3_CellChange(null, null);
  1449. GridHelper.RefreshAndAutoSize(ultraGrid3);
  1450. }
  1451. private void ultraGrid15_AfterRowActivate(object sender, EventArgs e)
  1452. {
  1453. this.ultraGrid15.UpdateData();
  1454. UltraGridRow uRow = this.ultraGrid15.ActiveRow;
  1455. if (uRow == null) return;
  1456. List<PipeCheckconsignNoqualifiedEntity> listSource = EntityHelper.GetData<PipeCheckconsignNoqualifiedEntity>(
  1457. "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeateInformation", new object[] { uRow.Cells["CheckNo"].Text, uRow.Cells["JudgeStoveNo"].Text }, this.ob);
  1458. pipeCheckconsignNoqualifiedEntityBindingSource2.DataSource = listSource;
  1459. List<PortMchBatchSampleResultEntity> listSource1 = EntityHelper.GetData<PortMchBatchSampleResultEntity>(
  1460. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryRepeatRack", new object[] { uRow.Cells["JudgeStoveNo"].Text }, this.ob);
  1461. portMchBatchSampleResultEntityBindingSource2.DataSource = listSource1;
  1462. foreach (UltraGridRow row in this.ultraGrid17.Rows)
  1463. {
  1464. if (row.Cells["IsSamplePipe"].Text == "1")
  1465. {
  1466. row.RowSelectorAppearance.BackColor = Color.Red;
  1467. }
  1468. }
  1469. }
  1470. private void ultraGrid19_AfterRowActivate(object sender, EventArgs e)
  1471. {
  1472. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  1473. if (uRow == null) return;
  1474. List<PipeCheckconsignNoqualifiedEntity> listSource = EntityHelper.GetData<PipeCheckconsignNoqualifiedEntity>(
  1475. "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeateInformation", new object[] { uRow.Cells["CheckNo"].Text, uRow.Cells["JudgeStoveNo"].Text }, this.ob);
  1476. pipeCheckconsignNoqualifiedEntityBindingSource4.DataSource = listSource;
  1477. doQueryResampleRck(uRow);
  1478. doQueryChemPhy(uRow);
  1479. doQueryResampleNo(uRow);//复取样委托信息
  1480. }
  1481. private void doQueryResampleNo(UltraGridRow uRow)
  1482. {
  1483. while (dataTable6.Columns.Count > 3)
  1484. {
  1485. dataTable6.Columns.RemoveAt(3);
  1486. }
  1487. DataTable dtSample = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryReDetialSampleNo",
  1488. new Object[] { uRow.Cells["CheckNo"].Text, "2", "F" }, ob);
  1489. dataTable6.Rows.Clear();
  1490. dtSample.AsEnumerable().GroupBy(p => new { BatchNo = p["BATCH_NO"].ToString(), Sample = p["HEAD_MAT_NO"].ToString() }).ToList()
  1491. .ForEach(p =>
  1492. {
  1493. foreach (DataRow row in p)
  1494. {
  1495. if (!dataTable6.Columns.Contains(row["PHY_CODE_MAX"].ToString()))
  1496. {
  1497. DataColumn phyCloum = new DataColumn();
  1498. phyCloum.ColumnName = row["PHY_CODE_MAX"].ToString();
  1499. phyCloum.Caption = row["PHY_NAME_MAX"].ToString();
  1500. dataTable6.Columns.Add(phyCloum);
  1501. }
  1502. }
  1503. DataRow dr = dataTable6.NewRow();
  1504. dr["PHY_BATCH_NO"] = p.Key.BatchNo;
  1505. dr["HEAD_MAT_NO"] = p.Key.Sample;
  1506. dr["SAMPLE_LEN"] = p.Max(q => q["SAMPLE_LEN"]);
  1507. foreach (DataRow row in p)
  1508. {
  1509. dr[row["PHY_CODE_MAX"].ToString()] = row["SAMPLE_COUNT"].ToString();
  1510. }
  1511. dataTable6.Rows.Add(dr);
  1512. });
  1513. ultraGrid21.DataBind();
  1514. GridHelper.RefreshAndAutoSize(ultraGrid21);
  1515. }
  1516. private void doQueryChemPhy(UltraGridRow uRow)
  1517. {
  1518. while (dataTable5.Columns.Count > 5)
  1519. {
  1520. dataTable5.Columns.RemoveAt(5);
  1521. }
  1522. dtPhy = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryReChemPhy", new Object[] { uRow.Cells["LotNo"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["CheckNo"].Text }, ob);//查询复取样试样组
  1523. List<string> list = new List<string>();
  1524. if (dtPhy.Rows.Count > 0)
  1525. {
  1526. dtPhy.AsEnumerable().Select(p => new { Code = p["PHY_CODE_MAX"].ToString(), Name = p["PHY_NAME_MAX"].ToString() }).Distinct().ToList()
  1527. .ForEach(p =>
  1528. {
  1529. DataColumn phyCloum = new DataColumn();
  1530. phyCloum.ColumnName = p.Code;
  1531. phyCloum.Caption = p.Name;
  1532. dataTable5.Columns.Add(phyCloum);
  1533. });
  1534. }
  1535. ultraGrid20.DataBind();
  1536. GridHelper.RefreshAndAutoSize(ultraGrid20);
  1537. }
  1538. private void doQueryResampleRck(UltraGridRow uRow)
  1539. {
  1540. DataTable dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryResampleInfo",
  1541. new Object[] { uRow.Cells["JudgeStoveNo"].Text, "F" + uRow.Cells["CheckNo"].Text }, ob);
  1542. dataTable5.Rows.Clear();
  1543. foreach (DataRow row in dtBatchNo.Rows)
  1544. {
  1545. if (row["RESAMPLE_PIPE_LEN_A"] != null && row["RESAMPLE_PIPE_LEN_A"].ToString() != "")
  1546. {
  1547. DataRow newRowA = dataTable5.NewRow();
  1548. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1549. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1550. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_A"].ToString();
  1551. newRowA["SAMPLE_POSTION"] = "A端";
  1552. newRowA["PHY_CODE_GROUP"] = "";
  1553. dataTable5.Rows.Add(newRowA);
  1554. }
  1555. if (row["RESAMPLE_PIPE_LEN_B"] != null && row["RESAMPLE_PIPE_LEN_B"].ToString() != "")
  1556. {
  1557. DataRow newRowA = dataTable5.NewRow();
  1558. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1559. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1560. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_B"].ToString();
  1561. newRowA["SAMPLE_POSTION"] = "B端";
  1562. newRowA["PHY_CODE_GROUP"] = "";
  1563. dataTable5.Rows.Add(newRowA);
  1564. }
  1565. if (row["RESAMPLE_PIPE_LEN_C"] != null && row["RESAMPLE_PIPE_LEN_C"].ToString() != "")
  1566. {
  1567. DataRow newRowA = dataTable5.NewRow();
  1568. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1569. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1570. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_C"].ToString();
  1571. newRowA["SAMPLE_POSTION"] = "C端";
  1572. newRowA["PHY_CODE_GROUP"] = "";
  1573. dataTable5.Rows.Add(newRowA);
  1574. }
  1575. if (row["RESAMPLE_PIPE_LEN_D"] != null && row["RESAMPLE_PIPE_LEN_D"].ToString() != "")
  1576. {
  1577. DataRow newRowA = dataTable5.NewRow();
  1578. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1579. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1580. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_D"].ToString();
  1581. newRowA["SAMPLE_POSTION"] = "D端";
  1582. newRowA["PHY_CODE_GROUP"] = "";
  1583. dataTable5.Rows.Add(newRowA);
  1584. }
  1585. if (row["RESAMPLE_PIPE_LEN_E"] != null && row["RESAMPLE_PIPE_LEN_E"].ToString() != "")
  1586. {
  1587. DataRow newRowA = dataTable5.NewRow();
  1588. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1589. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1590. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_E"].ToString();
  1591. newRowA["SAMPLE_POSTION"] = "E端";
  1592. newRowA["PHY_CODE_GROUP"] = "";
  1593. dataTable5.Rows.Add(newRowA);
  1594. }
  1595. if (row["RESAMPLE_PIPE_LEN_F"] != null && row["RESAMPLE_PIPE_LEN_F"].ToString() != "")
  1596. {
  1597. DataRow newRowA = dataTable5.NewRow();
  1598. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1599. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1600. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_F"].ToString();
  1601. newRowA["SAMPLE_POSTION"] = "F端";
  1602. newRowA["PHY_CODE_GROUP"] = "";
  1603. dataTable5.Rows.Add(newRowA);
  1604. }
  1605. if (row["RESAMPLE_PIPE_LEN_P"] != null && row["RESAMPLE_PIPE_LEN_P"].ToString() != "")
  1606. {
  1607. DataRow newRowA = dataTable5.NewRow();
  1608. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1609. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1610. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_P"].ToString();
  1611. newRowA["SAMPLE_POSTION"] = "P端";
  1612. newRowA["PHY_CODE_GROUP"] = "";
  1613. dataTable5.Rows.Add(newRowA);
  1614. }
  1615. if (row["RESAMPLE_PIPE_LEN_Q"] != null && row["RESAMPLE_PIPE_LEN_Q"].ToString() != "")
  1616. {
  1617. DataRow newRowA = dataTable5.NewRow();
  1618. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1619. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1620. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_Q"].ToString();
  1621. newRowA["SAMPLE_POSTION"] = "Q端";
  1622. newRowA["PHY_CODE_GROUP"] = "";
  1623. dataTable5.Rows.Add(newRowA);
  1624. }
  1625. }
  1626. GridHelper.RefreshAndAutoSize(ultraGrid20);
  1627. }
  1628. private void ultraGrid17_CellChange(object sender, CellEventArgs e)
  1629. {
  1630. this.ultraGrid17.UpdateData();
  1631. ultraGrid17.Update();
  1632. if (e.Cell.Column.Key == "Chk")
  1633. {
  1634. if (e.Cell.Value.ToString() == "True")
  1635. {
  1636. e.Cell.Row.RowSelectorAppearance.BackColor = Color.Red;
  1637. txtMatNo1.Text = e.Cell.Row.Cells["MatNo"].Text;
  1638. }
  1639. else
  1640. {
  1641. e.Cell.Row.RowSelectorAppearance.BackColor = Color.Empty;
  1642. }
  1643. }
  1644. }
  1645. private void txtLen1_ValueChanged(object sender, EventArgs e)
  1646. {
  1647. if (!StringUtil.IsInt(this.txtLen1.Text)) return;
  1648. List<PortMchBatchSampleResultEntity> list1 = null;
  1649. list1 = portMchBatchSampleResultEntityBindingSource2.DataSource as List<PortMchBatchSampleResultEntity>;
  1650. if (list1.Any())
  1651. {
  1652. if (this.cmbPostion1.Value.ToString().Equals("401201"))//A端
  1653. {
  1654. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenA = txtLen1.Text);
  1655. }
  1656. else if (this.cmbPostion1.Value.ToString().Equals("401202"))
  1657. {
  1658. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenB = txtLen1.Text);
  1659. }
  1660. else if (this.cmbPostion1.Value.ToString().Equals("401217"))
  1661. {
  1662. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenC = txtLen1.Text);
  1663. }
  1664. else if (this.cmbPostion1.Value.ToString().Equals("401218"))
  1665. {
  1666. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenD = txtLen1.Text);
  1667. }
  1668. else if (this.cmbPostion1.Value.ToString().Equals("401219"))
  1669. {
  1670. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenM = txtLen1.Text);
  1671. }
  1672. else if (this.cmbPostion1.Value.ToString().Equals("401220"))
  1673. {
  1674. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenE = txtLen1.Text);
  1675. }
  1676. else if (this.cmbPostion1.Value.ToString().Equals("401221"))
  1677. {
  1678. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenF = txtLen1.Text);
  1679. }
  1680. else if (this.cmbPostion1.Value.ToString().Equals("401222"))
  1681. {
  1682. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenP = txtLen1.Text);
  1683. }
  1684. else if (this.cmbPostion1.Value.ToString().Equals("401223"))
  1685. {
  1686. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenQ = txtLen1.Text);
  1687. }
  1688. }
  1689. GridHelper.RefreshAndAutoSize(ultraGrid17);
  1690. }
  1691. private void ultraGrid21_ClickCell(object sender, ClickCellEventArgs e)
  1692. {
  1693. if (e.Cell.Column.Key != "PHY_BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION")
  1694. {
  1695. if (e.Cell.Text.Trim() == "")
  1696. {
  1697. e.Cell.Value = "√";
  1698. }
  1699. else
  1700. {
  1701. e.Cell.Value = "";
  1702. }
  1703. }
  1704. }
  1705. private void ultraGrid18_ClickCell(object sender, ClickCellEventArgs e)
  1706. {
  1707. if (e.Cell.Column.Key != "PHY_BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION")
  1708. {
  1709. if (e.Cell.Text.Trim() == "")
  1710. {
  1711. e.Cell.Value = "√";
  1712. }
  1713. else
  1714. {
  1715. e.Cell.Value = "";
  1716. }
  1717. }
  1718. }
  1719. private void ultraGrid8_AfterRowActivate(object sender, EventArgs e)
  1720. {
  1721. this.ultraGrid5.UpdateData();
  1722. this.ultraGrid8.UpdateData();
  1723. UltraGridRow uRow = this.ultraGrid5.ActiveRow;
  1724. UltraGridRow row = this.ultraGrid8.ActiveRow;
  1725. doQueryBatchRack(uRow,row);
  1726. }
  1727. /// <summary>
  1728. /// 按批查管号队列
  1729. /// </summary>
  1730. /// <param name="uRow"></param>
  1731. /// <param name="row"></param>
  1732. private void doQueryBatchRack(UltraGridRow uRow, UltraGridRow row)
  1733. {
  1734. List<PortMchBatchSampleResultEntity> listSource = EntityHelper.GetData<PortMchBatchSampleResultEntity>(
  1735. "com.steering.mes.port.vrp.FrmMchBatchSampleNew.doQueryBatchRack", new object[] { uRow.Cells["HeatPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, row.Cells["PHY_BATCH_NO"].Text }, this.ob);
  1736. portMchBatchSampleResultEntityBindingSource1.DataSource = listSource;
  1737. }
  1738. private void ultraGrid23_ClickCell(object sender, ClickCellEventArgs e)
  1739. {
  1740. if (e.Cell.Column.Key != "PHY_BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION")
  1741. {
  1742. if (e.Cell.Text.Trim() == "")
  1743. {
  1744. e.Cell.Value = "√";
  1745. }
  1746. else
  1747. {
  1748. e.Cell.Value = "";
  1749. }
  1750. }
  1751. }
  1752. }
  1753. }