FrmMilBatchSampleNew.cs 89 KB

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