FrmHttBatchSampleNew.cs 154 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344
  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 FrmHttBatchSampleNew : FrmBase
  21. {
  22. public FrmHttBatchSampleNew()
  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 Color color1 = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
  32. private Color color2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
  33. private string batchNoZ = "";//性能批号产线标识
  34. private void FrmMilBatchSampleNew_Load(object sender, EventArgs e)
  35. {
  36. DateTime now = DateTime.Now;
  37. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  38. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  39. this.RegStartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  40. this.RegEndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  41. EntityHelper.ShowGridCaption<PlnZyRclMEntity>(this.ultraGrid1.DisplayLayout.Bands[0]);
  42. EntityHelper.ShowGridCaption<PlnZyRclMEntity>(this.ultraGrid2.DisplayLayout.Bands[0]);
  43. EntityHelper.ShowGridCaption<PortHttBatchSampleResultEntity>(this.ultraGrid3.DisplayLayout.Bands[0]);
  44. EntityHelper.ShowGridCaption<PortHttBatchSampleResultEntity>(this.ultraGrid8.DisplayLayout.Bands[0]);
  45. EntityHelper.ShowGridCaption<PlnZyRclMEntity>(this.ultraGrid5.DisplayLayout.Bands[0]);
  46. EntityHelper.ShowGridCaption<PlnZyRclMEntity>(this.ultraGrid6.DisplayLayout.Bands[0]);
  47. EntityHelper.ShowGridCaption<PortHttBatchSampleResultEntity>(this.ultraGrid7.DisplayLayout.Bands[0]);
  48. EntityHelper.ShowGridCaption<PlnZyRclMEntity>(this.ultraGrid9.DisplayLayout.Bands[0]);
  49. EntityHelper.ShowGridCaption<PlnZyRclMEntity>(this.ultraGrid10.DisplayLayout.Bands[0]);
  50. EntityHelper.ShowGridCaption<PlnZyRclMEntity>(this.ultraGrid12.DisplayLayout.Bands[0]);
  51. EntityHelper.ShowGridCaption<PlnZyRclMEntity>(this.ultraGrid13.DisplayLayout.Bands[0]);
  52. EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid15.DisplayLayout.Bands[0]);
  53. EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid16.DisplayLayout.Bands[0]);
  54. EntityHelper.ShowGridCaption<PortHttBatchSampleResultEntity>(this.ultraGrid17.DisplayLayout.Bands[0]);
  55. EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid19.DisplayLayout.Bands[0]);
  56. EntityHelper.ShowGridCaption<PipeCheckconsignNoqualifiedEntity>(this.ultraGrid20.DisplayLayout.Bands[0]);
  57. plineCode = PublicPort.GetPCode(this.ValidDataPurviewIds, ob);
  58. cmbSampleType.SelectedIndex = 0;
  59. initPostion();
  60. }
  61. /// <summary>
  62. /// 加载基础取样位置
  63. /// </summary>
  64. private void initPostion()
  65. {
  66. DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPostion", new object[] { }, ob);
  67. if (ds != null && ds.Rows.Count > 0)
  68. {
  69. cmbPostion.DataSource = ds;
  70. cmbPostion.ValueMember = "BASECODE";
  71. cmbPostion1.DataSource = ds;
  72. cmbPostion1.ValueMember = "BASECODE";
  73. cmbPiecePostion.DataSource = ds;
  74. cmbPiecePostion.ValueMember = "BASECODE";
  75. }
  76. }
  77. /// <summary>
  78. /// 重写基类方法
  79. /// </summary>
  80. /// <param name="sender"></param>
  81. /// <param name="ToolbarKey"></param>
  82. public override void ToolBar_Click(object sender, string ToolbarKey)
  83. {
  84. switch (ToolbarKey)
  85. {
  86. case "Query":
  87. doQueryPlan();
  88. break;
  89. case "QueryRepeate":
  90. doQueryRepeate();
  91. break;
  92. case "BatchSeting":
  93. batchSeting();
  94. break;
  95. case "CancelBatchSeting":
  96. cancelBatchSeting();
  97. break;
  98. case "OprocessBatch":
  99. oprocessBatch();
  100. break;
  101. case "CancelOprocessBatch":
  102. cancelBatch();
  103. break;
  104. case "GetSample":
  105. getSample();
  106. break;
  107. case"GetSamplePipece":
  108. getSamplePipece();
  109. break;
  110. case"ComfrimComplete":
  111. comfrimComplete();
  112. break;
  113. case "CancelGetSample":
  114. cancelGetSample();
  115. break;
  116. case"Approval":
  117. approval();
  118. break;
  119. case "Confirm":
  120. confirm();
  121. break;
  122. case "CancelConfirm":
  123. cancelConfirm();
  124. break;
  125. case"MergerConfrim":
  126. mergerConfrim();
  127. break;
  128. case "ReGetSample":
  129. reGetSample();
  130. break;
  131. case "CancelReGetSample":
  132. cancelReGetSample();
  133. break;
  134. case "RepeateFrim":
  135. repeateFrim();
  136. break;
  137. case "CancelRepeateFrim":
  138. cancelRepeateFrim();
  139. break;
  140. case "Print":
  141. printTrust();
  142. break;
  143. case "PrintLable":
  144. printLable();
  145. break;
  146. case "PrintReLable":
  147. printReLable();
  148. break;
  149. case "PrintRe":
  150. printReTrust();
  151. break;
  152. case "Close":
  153. close();
  154. break;
  155. }
  156. }
  157. /// <summary>
  158. /// 撤销复取样
  159. /// </summary>
  160. private void cancelReGetSample()
  161. {
  162. this.ultraGrid15.UpdateData();
  163. this.ultraGrid17.UpdateData();
  164. UltraGridRow uRow = this.ultraGrid15.ActiveRow;
  165. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource2.DataSource as List<PortHttBatchSampleResultEntity>;
  166. if (uRow == null || lists.Count <= 0)
  167. {
  168. return;
  169. }
  170. PipeCheckconsignNoqualifiedEntity milPlans = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
  171. string milPlanEntity = JSONFormat.Format(milPlans);
  172. 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();
  173. CoreClientParam ccp = new CoreClientParam();
  174. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  175. ccp.MethodName = "cancelReGetSample";
  176. ccp.ServerParams = new object[] { milPlanEntity, portMilEntity };
  177. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  178. if (ccp.ReturnCode != -1)
  179. {
  180. if (ccp.ReturnInfo.Equals("撤销成功!"))
  181. {
  182. doQueryRepeate();
  183. MessageUtil.ShowTips(ccp.ReturnInfo);
  184. }
  185. else
  186. {
  187. MessageUtil.ShowTips(ccp.ReturnInfo);
  188. }
  189. }
  190. }
  191. /// <summary>
  192. /// 复取样
  193. /// </summary>
  194. private void reGetSample()
  195. {
  196. this.ultraGrid15.UpdateData();
  197. this.ultraGrid17.UpdateData();
  198. UltraGridRow uRow = this.ultraGrid15.ActiveRow;
  199. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource2.DataSource as List<PortHttBatchSampleResultEntity>;
  200. if (uRow == null || lists.Count <= 0)
  201. {
  202. return;
  203. }
  204. 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 == ""))
  205. {
  206. MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行复取样完成!");
  207. return;
  208. }
  209. 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)))
  210. {
  211. MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!");
  212. return;
  213. }
  214. PipeCheckconsignNoqualifiedEntity milPlans = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
  215. string milPlanEntity = JSONFormat.Format(milPlans);
  216. List<string> portMilEntity = lists.Where(p => p.Chk).Select(JSONFormat.Format).ToList();
  217. CoreClientParam ccp = new CoreClientParam();
  218. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  219. ccp.MethodName = "reGetSample";
  220. ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder() };
  221. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  222. if (ccp.ReturnCode != -1)
  223. {
  224. if (ccp.ReturnInfo.Equals("复取样完成!"))
  225. {
  226. doQueryRepeate();
  227. MessageUtil.ShowTips(ccp.ReturnInfo);
  228. }
  229. else
  230. {
  231. MessageUtil.ShowTips(ccp.ReturnInfo);
  232. }
  233. }
  234. }
  235. /// <summary>
  236. /// 委托完成
  237. /// </summary>
  238. private void comfrimComplete()
  239. {
  240. this.ultraGrid1.UpdateData();
  241. UltraGridRow row = this.ultraGrid1.ActiveRow;
  242. if (row == null) return;
  243. PlnZyRclMEntity planEntity = (PlnZyRclMEntity)row.ListObject;
  244. string planTity = JSONFormat.Format(planEntity);
  245. CoreClientParam ccp = new CoreClientParam();
  246. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  247. ccp.MethodName = "comfrimComplete";
  248. ccp.ServerParams = new object[] { planTity };
  249. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  250. if (ccp.ReturnCode != -1)
  251. {
  252. if (ccp.ReturnInfo.Equals("委托完成!"))
  253. {
  254. doQueryPlan();
  255. MessageUtil.ShowTips(ccp.ReturnInfo);
  256. }
  257. else
  258. {
  259. MessageUtil.ShowTips(ccp.ReturnInfo);
  260. }
  261. }
  262. }
  263. /// <summary>
  264. /// 拆批
  265. /// </summary>
  266. private void approval()
  267. {
  268. this.ultraGrid3.UpdateData();
  269. int startSeq = int.Parse(this.ultraSTART_PIPE_NO.Text);
  270. int endSeq = int.Parse(this.ultraEND_PIPE_NO.Text);
  271. if (startSeq > endSeq)
  272. {
  273. MessageUtil.ShowTips("起始序号不允许大于结束序号!");
  274. return;
  275. }
  276. List<PortHttBatchSampleResultEntity> list = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  277. List<string> a = list.Skip(startSeq - 1).Take(endSeq - startSeq + 1).ToList().Select(JSONFormat.Format).ToList();
  278. if (MessageUtil.ShowYesNoAndQuestion("是否确定将序号" + startSeq + "至" + endSeq + "总共" + (endSeq - startSeq+1)+ "支管材进行拆批 ?") == DialogResult.No)
  279. {
  280. return;
  281. }
  282. CoreClientParam ccp = new CoreClientParam();
  283. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  284. ccp.MethodName = "approval";
  285. ccp.ServerParams = new object[] { a };
  286. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  287. if (ccp.ReturnCode != -1)
  288. {
  289. if (ccp.ReturnInfo.Equals("拆批成功!"))
  290. {
  291. doQueryPlan();
  292. MessageUtil.ShowTips(ccp.ReturnInfo);
  293. }
  294. else
  295. {
  296. MessageUtil.ShowTips(ccp.ReturnInfo);
  297. }
  298. }
  299. }
  300. /// <summary>
  301. /// 查询复取样信息
  302. /// </summary>
  303. private void doQueryRepeate()
  304. {
  305. string startTime = "";
  306. string endTim = "";
  307. string lotNo = "";
  308. string judgeNo = "";
  309. if (this.chkRegTime.Checked)
  310. {
  311. startTime = this.RegStartTime.Value.ToString();
  312. endTim = this.RegEndTime.Value.ToString();
  313. }
  314. if (chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
  315. {
  316. lotNo = this.txtLotNo.Text;
  317. }
  318. if (chkJudgeNo.Checked && this.txtJudgeNo.Text.Trim() != "")
  319. {
  320. judgeNo = this.txtJudgeNo.Text;
  321. }
  322. ArrayList parm = new ArrayList();
  323. parm.Add(startTime);
  324. parm.Add(endTim);
  325. parm.Add(lotNo);
  326. parm.Add(judgeNo);
  327. if (ultraTabControl1.SelectedTab.Key == "4")
  328. {
  329. parm.Add("0");
  330. }
  331. else if (ultraTabControl1.SelectedTab.Key == "5")
  332. {
  333. parm.Add("1");
  334. }
  335. List<PipeCheckconsignNoqualifiedEntity> listSource = EntityHelper.GetData<PipeCheckconsignNoqualifiedEntity>(
  336. "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeate", new object[] { parm, plineCode }, this.ob);
  337. if (ultraTabControl1.SelectedTab.Key == "4")
  338. {
  339. pipeCheckconsignNoqualifiedEntityBindingSource.DataSource = listSource;
  340. }
  341. else if (ultraTabControl1.SelectedTab.Key == "5")
  342. {
  343. pipeCheckconsignNoqualifiedEntityBindingSource3.DataSource = listSource;
  344. }
  345. }
  346. /// <summary>
  347. /// 复取样委托
  348. /// </summary>
  349. private void repeateFrim()
  350. {
  351. this.ultraGrid19.UpdateData();
  352. this.ultraGrid20.UpdateData();
  353. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  354. if (uRow == null) return;
  355. PipeCheckconsignNoqualifiedEntity pipeCheckEntity = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
  356. string pipeTity = JSONFormat.Format(pipeCheckEntity);
  357. List<List<string>> parmList = new List<List<string>>();
  358. foreach (UltraGridRow row in this.ultraGrid21.Rows)
  359. {
  360. List<string> list = new List<string>();
  361. list.Add(row.Cells["PHY_BATCH_NO"].Text);
  362. list.Add(row.Cells["MAT_NO"].Text);
  363. list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text);
  364. list.Add(row.Cells["SAMPLE_POSTION"].Text);
  365. for (int j = 5; j < dataTable5.Columns.Count; j++)
  366. {
  367. if (row.Cells[j].Value == "√")
  368. {
  369. list.Add(row.Cells[j].Column.Key);
  370. }
  371. }
  372. parmList.Add(list);
  373. }
  374. List<List<string>> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault()
  375. ).ToList();
  376. CoreClientParam ccp = new CoreClientParam();
  377. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  378. ccp.MethodName = "repeateFrim";
  379. ccp.ServerParams = new object[] { pipeTity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment(), this.txtRemark2.Text.ToString().Trim() };
  380. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  381. if (ccp.ReturnCode != -1)
  382. {
  383. if (ccp.ReturnInfo.Equals("复取样委托成功!"))
  384. {
  385. doQueryRepeate();
  386. MessageUtil.ShowTips(ccp.ReturnInfo);
  387. }
  388. else
  389. {
  390. MessageUtil.ShowTips(ccp.ReturnInfo);
  391. }
  392. }
  393. }
  394. /// <summary>
  395. /// 撤销复取样委托
  396. /// </summary>
  397. private void cancelRepeateFrim()
  398. {
  399. this.ultraGrid19.UpdateData();
  400. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  401. if (uRow == null) return;
  402. PipeCheckconsignNoqualifiedEntity pipeNoTity = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject;
  403. string pipeNoEntity = JSONFormat.Format(pipeNoTity);
  404. CoreClientParam ccp = new CoreClientParam();
  405. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  406. ccp.MethodName = "cancelRepeateFrim";
  407. ccp.ServerParams = new object[] { pipeNoEntity };
  408. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  409. if (ccp.ReturnCode != -1)
  410. {
  411. if (ccp.ReturnInfo.Equals("撤销复取样委托成功!"))
  412. {
  413. doQueryRepeate();
  414. MessageUtil.ShowTips(ccp.ReturnInfo);
  415. }
  416. else
  417. {
  418. MessageUtil.ShowTips(ccp.ReturnInfo);
  419. }
  420. }
  421. }
  422. /// <summary>
  423. /// 打印复样标签
  424. /// </summary>
  425. private void printReLable()
  426. {
  427. this.ultraGrid19.UpdateData();
  428. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  429. if (uRow == null) return;
  430. string checkNo = "F" + uRow.Cells["CheckNo"].Text.Trim();
  431. string strurl = "";
  432. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepEntrustLabelHTT.cpt" + "&CHECK_NO=" + checkNo;
  433. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  434. fBug.AutoSize = true;
  435. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  436. fBug.WindowState = FormWindowState.Maximized;
  437. fBug.Text = "样管号标签";
  438. fBug.Show();
  439. }
  440. /// <summary>
  441. /// 标签
  442. /// </summary>
  443. private void printLable()
  444. {
  445. this.ultraGrid12.UpdateData();
  446. UltraGridRow uRow = this.ultraGrid12.ActiveRow;
  447. if (uRow == null) return;
  448. string checkNo = uRow.Cells["CheckNo"].Text.Trim();
  449. string strurl = "";
  450. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepEntrustLabelHTT.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo + "&JUDGE_STOVE_NO=" + uRow.Cells["JudgeStoveNo"].Text.Trim() + "&PROCESS_CODE=F";
  451. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  452. fBug.AutoSize = true;
  453. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  454. fBug.WindowState = FormWindowState.Maximized;
  455. fBug.Text = "样管号标签";
  456. fBug.Show();
  457. }
  458. /// <summary>
  459. /// 打印
  460. /// </summary>
  461. private void printTrust()
  462. {
  463. this.ultraGrid12.UpdateData();
  464. UltraGridRow uRow = this.ultraGrid12.ActiveRow;
  465. if (uRow == null) return;
  466. this.ultraGrid13.UpdateData();
  467. UltraGridRow uRow2 = this.ultraGrid13.ActiveRow;
  468. if (uRow2 == null) return;
  469. string checkNo = uRow.Cells["CheckNo"].Text.Trim();
  470. string orderNo = uRow2.Cells["OrderNo"].Text.Trim();
  471. string strurl = "";
  472. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPortCheckConsignOrder.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo + "&orderNo=" + orderNo;
  473. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  474. fBug.AutoSize = true;
  475. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  476. fBug.WindowState = FormWindowState.Maximized;
  477. fBug.Text = "检验委托单";
  478. fBug.Show();
  479. }
  480. /// <summary>
  481. /// 打印复样委托单
  482. /// </summary>
  483. private void printReTrust()
  484. {
  485. this.ultraGrid19.UpdateData();
  486. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  487. if (uRow == null) return;
  488. this.ultraGrid20.UpdateData();
  489. UltraGridRow uRow2 = this.ultraGrid20.ActiveRow;
  490. if (uRow2 == null) return;
  491. string checkNo = "F" + uRow.Cells["CheckNo"].Text.Trim();
  492. string strurl = "";
  493. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPortCheckConsignOrder.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo ;
  494. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  495. fBug.AutoSize = true;
  496. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  497. fBug.WindowState = FormWindowState.Maximized;
  498. fBug.Text = "检验委托单";
  499. fBug.Show();
  500. }
  501. private void close()
  502. {
  503. this.Close();
  504. }
  505. /// <summary>
  506. /// 分批取样完成
  507. /// </summary>
  508. private void batchSeting()
  509. {
  510. this.ultraGrid1.UpdateData();
  511. this.ultraGrid3.UpdateData();
  512. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  513. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  514. if (uRow == null || lists.Count <= 0)
  515. {
  516. return;
  517. }
  518. //if (lists.Any(p => p.PhyBatchNo == ""))
  519. //{
  520. // MessageUtil.ShowTips("还有未分配批号管材,不允许进行分批完成!");
  521. // return;
  522. //}
  523. 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 == ""))
  524. {
  525. MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行分批完成!");
  526. return;
  527. }
  528. 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)))
  529. {
  530. MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!");
  531. return;
  532. }
  533. PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject;
  534. string milPlanEntity = JSONFormat.Format(milPlans);
  535. List<string> portMilEntity = lists.Select(JSONFormat.Format).ToList();
  536. CoreClientParam ccp = new CoreClientParam();
  537. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  538. ccp.MethodName = "batchSeting";
  539. ccp.ServerParams = new object[] { milPlanEntity, portMilEntity,UserInfo.GetUserName(),UserInfo.GetUserGroup(),UserInfo.GetUserOrder(),this.cmbSampleType.Value.ToString() };
  540. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  541. if (ccp.ReturnCode != -1)
  542. {
  543. if (ccp.ReturnInfo.Equals("分批取样完成!"))
  544. {
  545. doQueryPlan();
  546. MessageUtil.ShowTips(ccp.ReturnInfo);
  547. }
  548. else
  549. {
  550. MessageUtil.ShowTips(ccp.ReturnInfo);
  551. }
  552. }
  553. }
  554. /// <summary>
  555. /// 撤销分批取样
  556. /// </summary>
  557. private void cancelBatchSeting()
  558. {
  559. this.ultraGrid5.UpdateData();
  560. UltraGridRow uRow = this.ultraGrid5.ActiveRow;
  561. if (uRow == null) return;
  562. PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject;
  563. string milPlanEntity = JSONFormat.Format(milPlans);
  564. CoreClientParam ccp = new CoreClientParam();
  565. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  566. ccp.MethodName = "cancelBatchSeting";
  567. ccp.ServerParams = new object[] { milPlanEntity};
  568. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  569. if (ccp.ReturnCode != -1)
  570. {
  571. if (ccp.ReturnInfo.Equals("撤销成功!"))
  572. {
  573. doQueryPlan();
  574. MessageUtil.ShowTips(ccp.ReturnInfo);
  575. }
  576. else
  577. {
  578. MessageUtil.ShowTips(ccp.ReturnInfo);
  579. }
  580. }
  581. }
  582. /// <summary>
  583. /// 分批完成
  584. /// </summary>
  585. private void oprocessBatch()
  586. {
  587. this.ultraGrid1.UpdateData();
  588. this.ultraGrid3.UpdateData();
  589. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  590. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  591. if (uRow == null || lists.Count <= 0)
  592. {
  593. return;
  594. }
  595. //if (lists.Any(p => p.PhyBatchNo == ""))
  596. //{
  597. // MessageUtil.ShowTips("还有未分配批号管材,不允许进行分批完成!");
  598. // return;
  599. //}
  600. PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject;
  601. string milPlanEntity = JSONFormat.Format(milPlans);
  602. List<string> portMilEntity = lists.Select(JSONFormat.Format).ToList();
  603. CoreClientParam ccp = new CoreClientParam();
  604. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  605. ccp.MethodName = "oprocessBatch";
  606. ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder() };
  607. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  608. if (ccp.ReturnCode != -1)
  609. {
  610. if (ccp.ReturnInfo.Equals("分批完成!"))
  611. {
  612. doQueryPlan();
  613. MessageUtil.ShowTips(ccp.ReturnInfo);
  614. }
  615. else
  616. {
  617. MessageUtil.ShowTips(ccp.ReturnInfo);
  618. }
  619. }
  620. }
  621. /// <summary>
  622. /// 撤销分批
  623. /// </summary>
  624. private void cancelBatch()
  625. {
  626. this.ultraGrid1.UpdateData();
  627. this.ultraGrid3.UpdateData();
  628. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  629. UltraGridRow row = this.ultraGrid4.ActiveRow;
  630. if (uRow == null || row == null) return;
  631. PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject;
  632. string milPlanEntity = JSONFormat.Format(milPlans);
  633. CoreClientParam ccp = new CoreClientParam();
  634. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  635. ccp.MethodName = "cancelBatch";
  636. ccp.ServerParams = new object[] { milPlanEntity, row.Cells["PHY_BATCH_NO"].Text };
  637. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  638. if (ccp.ReturnCode != -1)
  639. {
  640. if (ccp.ReturnInfo.Equals("撤销成功!"))
  641. {
  642. doQueryPlan();
  643. MessageUtil.ShowTips(ccp.ReturnInfo);
  644. }
  645. else
  646. {
  647. MessageUtil.ShowTips(ccp.ReturnInfo);
  648. }
  649. }
  650. }
  651. /// <summary>
  652. /// 撤销取样完成
  653. /// </summary>
  654. private void cancelGetSample()
  655. {
  656. this.ultraGrid5.UpdateData();
  657. UltraGridRow uRow = this.ultraGrid5.ActiveRow;
  658. UltraGridRow row = this.ultraGrid8.ActiveRow;
  659. if (uRow == null || row == null) return;
  660. PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject;
  661. string milPlanEntity = JSONFormat.Format(milPlans);
  662. CoreClientParam ccp = new CoreClientParam();
  663. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  664. ccp.MethodName = "cancelGetSample";
  665. ccp.ServerParams = new object[] { milPlanEntity,row.Cells["PHY_BATCH_NO"].Text };
  666. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  667. if (ccp.ReturnCode != -1)
  668. {
  669. if (ccp.ReturnInfo.Equals("撤销成功!"))
  670. {
  671. doQueryPlan();
  672. MessageUtil.ShowTips(ccp.ReturnInfo);
  673. }
  674. else
  675. {
  676. MessageUtil.ShowTips(ccp.ReturnInfo);
  677. }
  678. }
  679. }
  680. /// <summary>
  681. /// 取样完成
  682. /// </summary>
  683. private void getSample()
  684. {
  685. this.ultraGrid1.UpdateData();
  686. this.ultraGrid3.UpdateData();
  687. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  688. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  689. if (uRow == null || lists.Count <= 0)
  690. {
  691. return;
  692. }
  693. //if (lists.Any(p => p.PhyBatchNo == ""))
  694. //{
  695. // MessageUtil.ShowTips("还有未进行分批的管材,不允许进行取样!");
  696. // return;
  697. //}
  698. 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 == ""))
  699. {
  700. MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行取样完成!");
  701. return;
  702. }
  703. 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)))
  704. {
  705. MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!");
  706. return;
  707. }
  708. PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject;
  709. string milPlanEntity = JSONFormat.Format(milPlans);
  710. List<string> portMilEntity = lists.Where(p=>p.Chk).Select(JSONFormat.Format).ToList();
  711. CoreClientParam ccp = new CoreClientParam();
  712. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  713. ccp.MethodName = "getSample";
  714. ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder(),this.cmbSampleType.Value.ToString() };
  715. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  716. if (ccp.ReturnCode != -1)
  717. {
  718. if (ccp.ReturnInfo.Equals("取样完成!"))
  719. {
  720. doQueryPlan();
  721. MessageUtil.ShowTips(ccp.ReturnInfo);
  722. }
  723. else
  724. {
  725. MessageUtil.ShowTips(ccp.ReturnInfo);
  726. }
  727. }
  728. }
  729. /// <summary>
  730. /// 逐支取样
  731. /// </summary>
  732. private void getSamplePipece()
  733. {
  734. this.ultraGrid1.UpdateData();
  735. this.ultraGrid3.UpdateData();
  736. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  737. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  738. if (uRow == null || lists.Count <= 0)
  739. {
  740. return;
  741. }
  742. PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject;
  743. string milPlanEntity = JSONFormat.Format(milPlans);
  744. List<string> portMilEntity = lists.Where(p => p.Chk).Select(JSONFormat.Format).ToList();
  745. List<string> batchList = lists.Select(p => p.PhyBatchNo).Distinct().ToList();
  746. CoreClientParam ccp = new CoreClientParam();
  747. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  748. ccp.MethodName = "getSamplePipece";
  749. ccp.ServerParams = new object[] { milPlanEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder(),this.cmbSampleType.Value.ToString() };
  750. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  751. if (ccp.ReturnCode != -1)
  752. {
  753. if (ccp.ReturnInfo.Equals("逐支取样成功!"))
  754. {
  755. doQueryPlan();
  756. MessageUtil.ShowTips(ccp.ReturnInfo);
  757. }
  758. else
  759. {
  760. MessageUtil.ShowTips(ccp.ReturnInfo);
  761. }
  762. }
  763. }
  764. /// <summary>
  765. /// 确认委托
  766. /// </summary>
  767. private void confirm()
  768. {
  769. this.ultraGrid9.UpdateData();
  770. this.ultraGrid10.UpdateData();
  771. this.ultraGrid11.UpdateData();
  772. this.ultraGrid18.UpdateData();
  773. UltraGrid ug = null;
  774. DataTable dataTable = null;
  775. string craftSource = "";
  776. if (ultraTabControl3.SelectedTab.Key == "0")
  777. {
  778. ug = ultraGrid11;
  779. dataTable = dataTable3;
  780. craftSource = "0";
  781. }
  782. else if (ultraTabControl3.SelectedTab.Key == "1")
  783. {
  784. ug = ultraGrid18;
  785. dataTable = dataTable5;
  786. craftSource = "1";
  787. }
  788. else if (ultraTabControl3.SelectedTab.Key == "2")
  789. {
  790. ug = ultraGrid23;
  791. dataTable = dataTable7;
  792. craftSource = "2";
  793. }
  794. if (ultraGrid10.ActiveRow.Cells["Cic"].Text == "" && ultraGrid10.ActiveRow.Cells["IfProduct"].Text.Trim() == "1")
  795. {
  796. MessageUtil.ShowTips("缺少成分索引码,不能确认委托!");
  797. return;
  798. }
  799. UltraGridRow uRow = ultraGrid9.ActiveRow;
  800. if (uRow == null) return;
  801. // List<CraftOrdDesignStdCicEntity> chemSource = EntityHelper.GetData<CraftOrdDesignStdCicEntity>(
  802. //"com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryChem", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text.Replace("-.*", "") }, this.ob);//查询成分详细信息
  803. // List<CraftOrdDesignStdPicEntity> phySource = EntityHelper.GetData<CraftOrdDesignStdPicEntity>(
  804. //"com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPhy", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text.Replace("-.*", "") }, this.ob);//查询理化详细信息
  805. PlnZyRclMEntity milTity = (PlnZyRclMEntity)uRow.ListObject;
  806. milTity.CraftSource = craftSource;
  807. string milEntity = JSONFormat.Format(milTity);
  808. List<List<string>> parmList = new List<List<string>>();
  809. foreach(UltraGridRow row in ug.Rows)
  810. {
  811. int m = 0;
  812. List<string> list = new List<string>();
  813. list.Add(row.Cells["PHY_BATCH_NO"].Text);
  814. list.Add(row.Cells["MAT_NO"].Text);
  815. list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text);
  816. list.Add(row.Cells["SAMPLE_POSTION"].Text);
  817. for (int j = 5; j < dataTable.Columns.Count; j++)
  818. {
  819. if (row.Cells[j].Value == "√")
  820. {
  821. list.Add(row.Cells[j].Column.Key);
  822. m = m + 1;
  823. }
  824. }
  825. if (m > 0)
  826. {
  827. parmList.Add(list);
  828. }
  829. }
  830. List<List<string>> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault()
  831. ).ToList();
  832. CoreClientParam ccp = new CoreClientParam();
  833. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  834. ccp.MethodName = "confirm";
  835. ccp.ServerParams = new object[] { milEntity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment(),this.txtConMemo.Text.Trim() };
  836. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  837. if (ccp.ReturnCode != -1)
  838. {
  839. if (ccp.ReturnInfo.Equals("委托成功!"))
  840. {
  841. doQueryPlan();
  842. MessageUtil.ShowTips(ccp.ReturnInfo);
  843. }
  844. else
  845. {
  846. MessageUtil.ShowTips(ccp.ReturnInfo);
  847. }
  848. }
  849. }
  850. /// <summary>
  851. /// 并单委托
  852. /// </summary>
  853. private void mergerConfrim()
  854. {
  855. this.ultraGrid9.UpdateData();
  856. this.ultraGrid10.UpdateData();
  857. this.ultraGrid11.UpdateData();
  858. this.ultraGrid18.UpdateData();
  859. UltraGrid ug = null;
  860. DataTable dataTable = null;
  861. string craftSource = "";
  862. if (ultraTabControl3.SelectedTab.Key == "0")
  863. {
  864. ug = ultraGrid11;
  865. dataTable = dataTable3;
  866. craftSource = "0";
  867. }
  868. else if (ultraTabControl3.SelectedTab.Key == "1")
  869. {
  870. ug = ultraGrid18;
  871. dataTable = dataTable5;
  872. craftSource = "1";
  873. }
  874. UltraGridRow uRow = ultraGrid9.ActiveRow;
  875. if (uRow == null) return;
  876. PlnZyRclMEntity milTity = (PlnZyRclMEntity)uRow.ListObject;
  877. milTity.CraftSource = craftSource;
  878. string milEntity = JSONFormat.Format(milTity);
  879. List<List<string>> parmList = new List<List<string>>();
  880. foreach (UltraGridRow row in ug.Rows)
  881. {
  882. int m = 0;
  883. List<string> list = new List<string>();
  884. list.Add(row.Cells["PHY_BATCH_NO"].Text);
  885. list.Add(row.Cells["MAT_NO"].Text);
  886. list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text);
  887. list.Add(row.Cells["SAMPLE_POSTION"].Text);
  888. for (int j = 5; j < dataTable.Columns.Count; j++)
  889. {
  890. if (row.Cells[j].Value == "√")
  891. {
  892. list.Add(row.Cells[j].Column.Key);
  893. m = m + 1;
  894. }
  895. }
  896. if (m > 0)
  897. {
  898. parmList.Add(list);
  899. }
  900. }
  901. List<List<string>> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault()
  902. ).ToList();
  903. CoreClientParam ccp = new CoreClientParam();
  904. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  905. ccp.MethodName = "mergerConfrim";
  906. ccp.ServerParams = new object[] { milEntity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment() };
  907. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  908. if (ccp.ReturnCode != -1)
  909. {
  910. if (ccp.ReturnInfo.Equals("委托成功!"))
  911. {
  912. doQueryPlan();
  913. MessageUtil.ShowTips(ccp.ReturnInfo);
  914. }
  915. else
  916. {
  917. MessageUtil.ShowTips(ccp.ReturnInfo);
  918. }
  919. }
  920. }
  921. /// <summary>
  922. /// 取消确认
  923. /// </summary>
  924. private void cancelConfirm()
  925. {
  926. this.ultraGrid14.UpdateData();
  927. UltraGridRow uRow = this.ultraGrid12.ActiveRow;
  928. if (uRow == null) return;
  929. PlnZyRclMEntity milTity = (PlnZyRclMEntity)uRow.ListObject;
  930. string milPlanEntity = JSONFormat.Format(milTity);
  931. //ArrayList parmList = new ArrayList();
  932. //IQueryable<UltraGridRow> checkMag = this.ultraGrid14.Rows.AsQueryable().Where(" CHK = 'True'");
  933. //if (checkMag.Count() == 0)
  934. //{
  935. // return;
  936. //}
  937. //foreach (UltraGridRow row in checkMag)
  938. //{
  939. // PortHttBatchSampleResultEntity portHttTity = new PortHttBatchSampleResultEntity();
  940. // portHttTity.MatNo = row.Cells["MAT_NO"].Text;
  941. // portHttTity.PhyBatchNo = row.Cells["PHY_BATCH_NO"].Text;
  942. // portHttTity.CheckNo = row.Cells["CHECK_NO"].Text;
  943. // string portEntity = JSONFormat.Format(portHttTity);
  944. // parmList.Add(portEntity);
  945. //}
  946. CoreClientParam ccp = new CoreClientParam();
  947. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  948. ccp.MethodName = "cancelConfirm";
  949. ccp.ServerParams = new object[] { milPlanEntity };
  950. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  951. if (ccp.ReturnCode != -1)
  952. {
  953. if (ccp.ReturnInfo.Equals("撤销委托成功!"))
  954. {
  955. doQueryPlan();
  956. MessageUtil.ShowTips(ccp.ReturnInfo);
  957. }
  958. else
  959. {
  960. MessageUtil.ShowTips(ccp.ReturnInfo);
  961. }
  962. }
  963. }
  964. /// <summary>
  965. /// 查询炉计划
  966. /// </summary>
  967. private void doQueryPlan()
  968. {
  969. string startTime = "";
  970. string endTim = "";
  971. string lotNo = "";
  972. string judgeNo = "";
  973. List<PlnZyRclMEntity> listSource = null;
  974. if (this.chkRegTime.Checked)
  975. {
  976. startTime = this.RegStartTime.Value.ToString();
  977. endTim = this.RegEndTime.Value.ToString();
  978. }
  979. if (chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
  980. {
  981. lotNo = this.txtLotNo.Text;
  982. }
  983. if (chkJudgeNo.Checked && this.txtJudgeNo.Text.Trim() != "")
  984. {
  985. judgeNo = this.txtJudgeNo.Text;
  986. }
  987. ArrayList parm = new ArrayList();
  988. parm.Add(startTime);
  989. parm.Add(endTim);
  990. parm.Add(lotNo);
  991. parm.Add(judgeNo);
  992. if (this.ultraTabControl1.SelectedTab.Key == "0")
  993. {
  994. parm.Add("0");
  995. listSource = EntityHelper.GetData<PlnZyRclMEntity>(
  996. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPlan", new object[] { parm, plineCode }, this.ob);
  997. }
  998. else if (this.ultraTabControl1.SelectedTab.Key == "1")
  999. {
  1000. parm.Add("2");
  1001. listSource = EntityHelper.GetData<PlnZyRclMEntity>(
  1002. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPlan", new object[] { parm, plineCode }, this.ob);
  1003. }
  1004. else if (this.ultraTabControl1.SelectedTab.Key == "2")
  1005. {
  1006. parm.Add("2");
  1007. listSource = EntityHelper.GetData<PlnZyRclMEntity>(
  1008. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPlan", new object[] { parm, plineCode }, this.ob);
  1009. }
  1010. else if (this.ultraTabControl1.SelectedTab.Key == "3")
  1011. {
  1012. parm.Add("3");
  1013. listSource = EntityHelper.GetData<PlnZyRclMEntity>(
  1014. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPipeBaseInfo", new object[] { parm, plineCode }, this.ob);
  1015. }
  1016. if (this.ultraTabControl1.SelectedTab.Key == "0")
  1017. {
  1018. plnZyRclMEntityBindingSource1.Clear();
  1019. portHttBatchSampleResultEntityBindingSource.Clear();
  1020. dataTable1.Clear();
  1021. plnZyRclMEntityBindingSource.DataSource = listSource;
  1022. }
  1023. else if (this.ultraTabControl1.SelectedTab.Key == "1")
  1024. {
  1025. plnZyRclMEntityBindingSource3.Clear();
  1026. portHttBatchSampleResultEntityBindingSource1.Clear();
  1027. dataTable2.Clear();
  1028. plnZyRclMEntityBindingSource2.DataSource = listSource;
  1029. }
  1030. else if (this.ultraTabControl1.SelectedTab.Key == "2")
  1031. {
  1032. plnZyRclMEntityBindingSource5.Clear();
  1033. dataTable3.Clear();
  1034. plnZyRclMEntityBindingSource4.DataSource = listSource;
  1035. }
  1036. else if (this.ultraTabControl1.SelectedTab.Key == "3")
  1037. {
  1038. plnZyRclMEntityBindingSource7.Clear();
  1039. dataTable4.Clear();
  1040. plnZyRclMEntityBindingSource6.DataSource = listSource;
  1041. }
  1042. }
  1043. private void chkRegTime_CheckedChanged(object sender, EventArgs e)
  1044. {
  1045. this.RegStartTime.Enabled = this.RegEndTime.Enabled = this.chkRegTime.Checked;
  1046. }
  1047. private void chkLotNo_CheckedChanged(object sender, EventArgs e)
  1048. {
  1049. this.txtLotNo.Enabled = this.chkLotNo.Checked;
  1050. }
  1051. private void chkJudgeNo_CheckedChanged(object sender, EventArgs e)
  1052. {
  1053. this.txtJudgeNo.Enabled = this.chkJudgeNo.Checked;
  1054. }
  1055. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  1056. {
  1057. this.ultraGrid1.UpdateData();
  1058. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  1059. batchNoZ = doQueryBacthPline(uRow);
  1060. doQueryBasePlan(uRow);
  1061. doQueryRack(uRow);
  1062. dtPlanDetial = doQueryCheckPlanDetila(uRow);
  1063. if (dtPlanDetial != null && dtPlanDetial.Count() > 0)
  1064. {
  1065. var s = dtPlanDetial.Where(p => p.Rate == "408601" || p.Rate == "408608").ToList();
  1066. if (s.Any())
  1067. {
  1068. dtPlanM = doQueryCheckPlan(uRow, "1");
  1069. }
  1070. else
  1071. {
  1072. dtPlanM = doQueryCheckPlan(uRow, "0");
  1073. }
  1074. }
  1075. ultraGrid3.Update();
  1076. ultraGrid3.DataBind();
  1077. ultraGrid3_CellChange(null, null);
  1078. if (dtPlanM == null || dtPlanDetial == null || dtPlanM.Count == 0 || dtPlanDetial.Count == 0)
  1079. {
  1080. txt_BatchMax.Text = "";
  1081. txtBATCH_MIN.Text = this.txtPIPE_NUM.Text;//参考批数;
  1082. return;
  1083. }
  1084. //bool isFlag = dtPlanDetial.Any(p => p.Rate == "408607" || p.Rate == "408608" || p.Rate == "408601");
  1085. //if (isFlag)
  1086. //{
  1087. //}
  1088. //else
  1089. //{
  1090. // if (int.Parse(uRow.Cells["IsBatch"].Text) >= 1)
  1091. // {
  1092. // //txt_BatchMax.Text = this.ultraGrid4.Rows[0].Cells["NUM"].Text;
  1093. // if (this.txt_BatchMax.Text == "")
  1094. // {
  1095. // txtBATCH_MIN.Text = this.txtPIPE_NUM.Text;//参考批数;
  1096. // }
  1097. // else
  1098. // {
  1099. // txtBATCH_MIN.Text = (Math.Ceiling(double.Parse(this.txtPIPE_NUM.Text) / int.Parse(this.txt_BatchMax.Text.ToString3()))).ToString();
  1100. // }
  1101. // }
  1102. // else
  1103. // {
  1104. minBatchNum = dtPlanDetial.Min(p => p.BatchCnt == null ? int.Parse(this.txtPIPE_NUM.Text) : (int)(p.BatchCnt));//检验计划最小分批数量
  1105. txt_BatchMax.Text = minBatchNum.ToString();//分批上限
  1106. txtREMARK.Text = dtPlanM.Select(p => p.Remark).Distinct().Aggregate((a, b) => a + " " + b);
  1107. if (minBatchNum == 0)
  1108. {
  1109. txtBATCH_MIN.Text = "0";
  1110. }
  1111. else
  1112. {
  1113. txtBATCH_MIN.Text = (Math.Ceiling(double.Parse(this.txtPIPE_NUM.Text) / minBatchNum)).ToString();//参考批数
  1114. }
  1115. ultraGrid3.Update();
  1116. ultraGrid3.DataBind();
  1117. ultraGrid3_CellChange(null, null);
  1118. //}
  1119. //}
  1120. }
  1121. private string doQueryBacthPline(UltraGridRow uRow)
  1122. {
  1123. string ss = "";
  1124. DataTable ds = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryBacthNo",new object[]{uRow.Cells["PlineCode"].Text},ob);
  1125. if(ds.Rows.Count >0)
  1126. {
  1127. ss = ds.Rows[0][0].ToString();
  1128. }
  1129. return ss;
  1130. }
  1131. private void initBindTable(UltraGridRow row)
  1132. {
  1133. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource1.DataSource as List<PortHttBatchSampleResultEntity>;
  1134. DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryHeadNum", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["JudgeStoveNo"].Text }, ob);
  1135. dataTable2.Rows.Clear();
  1136. if (lists == null || lists.Count() <= 0) return;
  1137. foreach (var list in lists.Where(p => p.PhyBatchNo != "").GroupBy(p => p.PhyBatchNo))
  1138. {
  1139. DataRow newRow;
  1140. newRow = dataTable2.NewRow();
  1141. newRow["PHY_BATCH_NO"] = list.Key;
  1142. newRow["START_SEQ"] = list.Min(p => int.Parse(p.Seq));
  1143. newRow["END_SEQ"] = list.Max(p => int.Parse(p.Seq));
  1144. newRow["NUM"] = list.Count();
  1145. newRow["SAMPLE_NUM"] = list.Count(p => p.SamplePipeLenA != "" || p.SamplePipeLenB != "" || p.SamplePipeLenC != "" || p.SamplePipeLenD != "" || p.SamplePipeLenM != "" || p.SamplePipeLenE != "" || p.SamplePipeLenF != "" || p.SamplePipeLenP != "" || p.SamplePipeLenQ != "");
  1146. if (ds.Rows.Count > 0)
  1147. {
  1148. for (int i = 0; i < ds.Rows.Count; i++)
  1149. {
  1150. if (ds.Rows[i]["BATCH_NO"].ToString() == list.Key)
  1151. {
  1152. newRow["HEAD_NUM"] = ds.Rows[i]["ACOUNT"].ToString();
  1153. }
  1154. }
  1155. }
  1156. //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));
  1157. dataTable2.Rows.Add(newRow);
  1158. }
  1159. ultraGrid8.Update();
  1160. }
  1161. /// <summary>
  1162. /// 自动分批
  1163. /// </summary>
  1164. /// <param name="sender"></param>
  1165. /// <param name="e"></param>
  1166. private void btnAuto_Click(object sender, EventArgs e)
  1167. {
  1168. this.ultraGrid4.UpdateData();
  1169. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  1170. if (lists==null || lists.Count<=0)
  1171. {
  1172. MessageUtil.ShowTips("不存在有效管号队列,不允许进行分批!");
  1173. return;
  1174. }
  1175. if (dtPlanM.Count <= 0)
  1176. {
  1177. MessageUtil.ShowTips("检验计划未确认,不能自动分批!");
  1178. return;
  1179. }
  1180. int maxBacthNum = int.Parse(this.txt_BatchMax.Text);//分批上限
  1181. int maxBacth = dtPlanM.Max(p => p.BatchNo == null ? 1 : (int)(p.BatchNo));//取主表最大方案
  1182. string sampleLen = "";//样管长度
  1183. string sampleCount = "";//样管数量
  1184. //为批号赋值
  1185. for (int i = 0; i < int.Parse(this.txtBATCH_MIN.Text);i++)
  1186. {
  1187. var list = dtPlanM1.Where(p => p.BatchNo == (i+1 > maxBacth ? maxBacth : i+1)).ToList();
  1188. var listA = list.Where(p => p.Position == "401201").ToList();
  1189. var listB = list.Where(p => p.Position == "401202").ToList();
  1190. var listC = list.Where(p => p.Position == "401217").ToList();
  1191. var listD = list.Where(p => p.Position == "401218").ToList();
  1192. var listM = list.Where(p => p.Position == "401219").ToList();
  1193. var listE = list.Where(p => p.Position == "401220").ToList();
  1194. var listF = list.Where(p => p.Position == "401221").ToList();
  1195. var listP = list.Where(p => p.Position == "401222").ToList();
  1196. var listQ = list.Where(p => p.Position == "401223").ToList();
  1197. int m = 0;
  1198. for (int k = 0; k < listA.Count; k++)
  1199. {
  1200. var crft = listA[k];
  1201. int a = (int)crft.SampleCount;//样管数量
  1202. for (int j = 0; j < a; j++,m++)
  1203. {
  1204. if (lists.Count > m + i * maxBacthNum)
  1205. {
  1206. lists[m + i * maxBacthNum].SamplePipeLenA = crft.SampleLength.ToString();
  1207. lists[m + i * maxBacthNum].PhyCodeGroup = crft.PhyCodeGroup.ToString();
  1208. lists[m + i * maxBacthNum].Chk = true;
  1209. }
  1210. }
  1211. }
  1212. m = 0;
  1213. for (int k = 0; k < listB.Count; k++)
  1214. {
  1215. var crft = listB[k];
  1216. int a = (int)crft.SampleCount;//样管数量
  1217. for (int j = 0; j < a; j++, m++)
  1218. {
  1219. if (lists.Count > m + i * maxBacthNum)
  1220. {
  1221. lists[m + i * maxBacthNum].SamplePipeLenB = crft.SampleLength.ToString();
  1222. lists[m + i * maxBacthNum].PhyCodeGroupb = crft.PhyCodeGroup.ToString();
  1223. lists[m + i * maxBacthNum].Chk = true;
  1224. }
  1225. }
  1226. }
  1227. m = 0;
  1228. for (int k = 0; k < listC.Count; k++)
  1229. {
  1230. var crft = listC[k];
  1231. int a = (int)crft.SampleCount;//样管数量
  1232. for (int j = 0; j < a; j++, m++)
  1233. {
  1234. if (lists.Count > m + i * maxBacthNum)
  1235. {
  1236. lists[m + i * maxBacthNum].SamplePipeLenC = crft.SampleLength.ToString();
  1237. lists[m + i * maxBacthNum].PhyCodeGroupc = crft.PhyCodeGroup.ToString();
  1238. lists[m + i * maxBacthNum].Chk = true;
  1239. }
  1240. }
  1241. }
  1242. m = 0;
  1243. for (int k = 0; k < listD.Count; k++)
  1244. {
  1245. var crft = listD[k];
  1246. int a = (int)crft.SampleCount;//样管数量
  1247. for (int j = 0; j < a; j++, m++)
  1248. {
  1249. if (lists.Count > m + i * maxBacthNum)
  1250. {
  1251. lists[m + i * maxBacthNum].SamplePipeLenD = crft.SampleLength.ToString();
  1252. lists[m + i * maxBacthNum].PhyCodeGroupd = crft.PhyCodeGroup.ToString();
  1253. lists[m + i * maxBacthNum].Chk = true;
  1254. }
  1255. }
  1256. }
  1257. m = 0;
  1258. for (int k = 0; k < listM.Count; k++)
  1259. {
  1260. var crft = listM[k];
  1261. int a = (int)crft.SampleCount;//样管数量
  1262. for (int j = 0; j < a; j++, m++)
  1263. {
  1264. if (lists.Count > m + i * maxBacthNum)
  1265. {
  1266. lists[m + i * maxBacthNum].SamplePipeLenD = crft.SampleLength.ToString();
  1267. lists[m + i * maxBacthNum].PhyCodeGroupd = crft.PhyCodeGroup.ToString();
  1268. lists[m + i * maxBacthNum].Chk = true;
  1269. }
  1270. }
  1271. }
  1272. m = 0;
  1273. for (int k = 0; k < listE.Count; k++)
  1274. {
  1275. var crft = listE[k];
  1276. int a = (int)crft.SampleCount;//样管数量
  1277. for (int j = 0; j < a; j++, m++)
  1278. {
  1279. if (lists.Count > m + i * maxBacthNum)
  1280. {
  1281. lists[m + i * maxBacthNum].SamplePipeLenE = crft.SampleLength.ToString();
  1282. lists[m + i * maxBacthNum].PhyCodeGroupe = crft.PhyCodeGroup.ToString();
  1283. lists[m + i * maxBacthNum].Chk = true;
  1284. }
  1285. }
  1286. }
  1287. m = 0;
  1288. for (int k = 0; k < listF.Count; k++)
  1289. {
  1290. var crft = listF[k];
  1291. int a = (int)crft.SampleCount;//样管数量
  1292. for (int j = 0; j < a; j++, m++)
  1293. {
  1294. if (lists.Count > m + i * maxBacthNum)
  1295. {
  1296. lists[m + i * maxBacthNum].SamplePipeLenF = crft.SampleLength.ToString();
  1297. lists[m + i * maxBacthNum].PhyCodeGroupf = crft.PhyCodeGroup.ToString();
  1298. lists[m + i * maxBacthNum].Chk = true;
  1299. }
  1300. }
  1301. }
  1302. m = 0;
  1303. for (int k = 0; k < listP.Count; k++)
  1304. {
  1305. var crft = listP[k];
  1306. int a = (int)crft.SampleCount;//样管数量
  1307. for (int j = 0; j < a; j++, m++)
  1308. {
  1309. if (lists.Count > m + i * maxBacthNum)
  1310. {
  1311. lists[m + i * maxBacthNum].SamplePipeLenP = crft.SampleLength.ToString();
  1312. lists[m + i * maxBacthNum].PhyCodeGroupp = crft.PhyCodeGroup.ToString();
  1313. lists[m + i * maxBacthNum].Chk = true;
  1314. }
  1315. }
  1316. }
  1317. m = 0;
  1318. for (int k = 0; k < listQ.Count; k++)
  1319. {
  1320. var crft = listQ[k];
  1321. int a = (int)crft.SampleCount;//样管数量
  1322. for (int j = 0; j < a; j++, m++)
  1323. {
  1324. if (lists.Count > m + i * maxBacthNum)
  1325. {
  1326. lists[m + i * maxBacthNum].SamplePipeLenQ = crft.SampleLength.ToString();
  1327. lists[m + i * maxBacthNum].PhyCodeGroupq = crft.PhyCodeGroup.ToString();
  1328. lists[m + i * maxBacthNum].Chk = true;
  1329. }
  1330. }
  1331. }
  1332. lists.Skip(i * maxBacthNum).Take((i + 1) * maxBacthNum).ToList().ForEach(p => p.PhyBatchNo = batchNoZ + (i + 1).ToString("000"));
  1333. }
  1334. ultraGrid3.Update();
  1335. ultraGrid3.DataBind();
  1336. ultraGrid3_CellChange(null, null);
  1337. }
  1338. /// <summary>
  1339. /// 人工分批
  1340. /// </summary>
  1341. /// <param name="sender"></param>
  1342. /// <param name="e"></param>
  1343. private void btnConfirm_Click(object sender, EventArgs e)
  1344. {
  1345. this.ultraGrid4.UpdateData();
  1346. int sampleNum = 0;
  1347. if (!StringUtil.IsInt32(this.txt_SampleNum.Text.Trim().ToString3()))
  1348. {
  1349. MessageUtil.ShowTips("样管数量需输入正整数!");
  1350. return;
  1351. }
  1352. else
  1353. {
  1354. sampleNum = int.Parse(this.txt_SampleNum.Text.Trim().ToString3());
  1355. }
  1356. if (!StringUtil.IsInt32(txt_BatchMax.Text.ToString3()) || int.Parse(txt_BatchMax.Text.ToString3()) <= 0)
  1357. {
  1358. MessageUtil.ShowTips("人工分批输入的分批上限需为正整数!");
  1359. return;
  1360. }
  1361. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  1362. var m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据
  1363. if (m.Count == 0)
  1364. {
  1365. return;
  1366. }
  1367. int Bathno = 1;
  1368. for (int k = 0; k < int.Parse(this.txtBATCH_MIN.Text.ToString3()); k++)
  1369. {
  1370. int startSeq = int.Parse(ultraSTART_PIPE_NO.Text);//开始序号
  1371. int endSeq = int.Parse(ultraEND_PIPE_NO.Text);//结束序号
  1372. var lists1 = lists.Where(p => p.PhyBatchNo != "").ToList();
  1373. if (lists1.Any())
  1374. {
  1375. Bathno = lists1.Max(p => int.Parse(p.PhyBatchNo.Substring(2, 3))) + 1;
  1376. }
  1377. m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.PhyBatchNo = batchNoZ + Bathno.ToString("000"));//赋值批号
  1378. m.Take(sampleNum).ToList().ForEach(p => p.Chk = true);
  1379. ultraSTART_PIPE_NO.Text = m.First().Seq.ToString();//初始序号 跳过已赋值批号数据
  1380. ultraEND_PIPE_NO.Text = m.Take(int.Parse(txt_BatchMax.Text)).Last().Seq.ToString();//结束序号
  1381. ultraGrid3.Update();
  1382. ultraGrid3.DataBind();
  1383. ultraGrid3_CellChange(null, null);
  1384. m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据
  1385. if (m.Count == 0)
  1386. {
  1387. return;
  1388. }
  1389. }
  1390. }
  1391. /// <summary>
  1392. /// 查询检验计划子表
  1393. /// </summary>
  1394. /// <param name="uRow"></param>
  1395. /// <returns></returns>
  1396. private List<CraftSamplingDetailEntity> doQueryCheckPlanDetila(UltraGridRow uRow)
  1397. {
  1398. List<CraftSamplingDetailEntity> listSource = EntityHelper.GetData<CraftSamplingDetailEntity>(
  1399. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryCheckPlanDetial", new object[] { uRow.Cells["OrdLnPk"].Text, uRow.Cells["CraftFileNo"].Text, uRow.Cells["CraftSeq"].Text }, this.ob);//查询检验计划主表
  1400. return listSource;
  1401. }
  1402. /// <summary>
  1403. /// 查询检验计划主表
  1404. /// </summary>
  1405. /// <param name="uRow"></param>
  1406. private List<CraftSamplingMEntity> doQueryCheckPlan(UltraGridRow uRow,String flag)
  1407. {
  1408. List<CraftSamplingMEntity> listSource = EntityHelper.GetData<CraftSamplingMEntity>(
  1409. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryCheckPlan", new object[] { uRow.Cells["OrdLnPk"].Text, uRow.Cells["CraftFileNo"].Text, uRow.Cells["CraftSeq"].Text, flag }, this.ob);//查询检验计划主表
  1410. return listSource;
  1411. }
  1412. /// <summary>
  1413. /// 查询炉计划基础信息
  1414. /// </summary>
  1415. /// <param name="row"></param>
  1416. private void doQueryBasePlan(UltraGridRow row)
  1417. {
  1418. List<PlnZyRclMEntity> listSource = EntityHelper.GetData<PlnZyRclMEntity>(
  1419. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryBasePlan", new object[] { row.Cells["ZyBatchId"].Text, row.Cells["JudgeStoveNo"].Text, row.Cells["HeatPlanNo"].Text }, this.ob);
  1420. if (this.ultraTabControl1.SelectedTab.Key == "0")
  1421. {
  1422. plnZyRclMEntityBindingSource1.DataSource = listSource;
  1423. }
  1424. else if (this.ultraTabControl1.SelectedTab.Key == "1")
  1425. {
  1426. plnZyRclMEntityBindingSource3.DataSource = listSource;
  1427. }
  1428. else if (this.ultraTabControl1.SelectedTab.Key == "2")
  1429. {
  1430. plnZyRclMEntityBindingSource5.DataSource = listSource;
  1431. }else if(this.ultraTabControl1.SelectedTab.Key == "3")
  1432. {
  1433. plnZyRclMEntityBindingSource7.DataSource = listSource;
  1434. }
  1435. }
  1436. /// <summary>
  1437. /// 查询管号队列
  1438. /// </summary>
  1439. /// <param name="row"></param>
  1440. private void doQueryRack(UltraGridRow row)
  1441. {
  1442. List<PortHttBatchSampleResultEntity> lists1 = null;
  1443. List<PortHttBatchSampleResultEntity> listSource = null;
  1444. if (this.ultraTabControl1.SelectedTab.Key == "0")
  1445. {
  1446. listSource = EntityHelper.GetData<PortHttBatchSampleResultEntity>(
  1447. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryRackQ", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["JudgeStoveNo"].Text, row.Cells["IfMatchOdd"].Text, row.Cells["HeatPlanNoOld"].Text }, this.ob);
  1448. portHttBatchSampleResultEntityBindingSource.DataSource = listSource;
  1449. txtPIPE_NUM.Text = listSource.Count.ToString();
  1450. lists1 = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  1451. GridHelper.RefreshAndAutoSize(ultraGrid3);
  1452. }
  1453. else if (this.ultraTabControl1.SelectedTab.Key == "1")
  1454. {
  1455. listSource = EntityHelper.GetData<PortHttBatchSampleResultEntity>(
  1456. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryRack", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["JudgeStoveNo"].Text, row.Cells["IfMatchOdd"].Text, row.Cells["HeatPlanNoOld"].Text }, this.ob);
  1457. List<PortHttBatchSampleResultEntity> lists = listSource as List<PortHttBatchSampleResultEntity>;
  1458. lists.Where(p => p.IsSamplePipe == "1").ToList().ForEach(p => p.Chk = true);
  1459. portHttBatchSampleResultEntityBindingSource1.DataSource = lists;
  1460. initBindTable(row);
  1461. lists1 = portHttBatchSampleResultEntityBindingSource1.DataSource as List<PortHttBatchSampleResultEntity>;
  1462. }
  1463. var k = lists1.Where(p => p.PhyBatchNo == "").ToList();
  1464. if (k.Count() == 0)
  1465. {
  1466. ultraSTART_PIPE_NO.Text = this.txtPIPE_NUM.Text;
  1467. }
  1468. else
  1469. {
  1470. ultraSTART_PIPE_NO.Text = k.First().Seq.ToString();//初始序号 跳过已赋值批号数据
  1471. }
  1472. if (lists1.Count() > 0)
  1473. {
  1474. ultraEND_PIPE_NO.DataSource = lists1;
  1475. ultraEND_PIPE_NO.DisplayMember = "Seq";
  1476. ultraEND_PIPE_NO.ValueMember = "Seq";
  1477. ultraEND_PIPE_NO.SelectedIndex = lists1.Count - 1;
  1478. ultraSTART_PIPE_NO.DataSource = lists1;
  1479. ultraSTART_PIPE_NO.DisplayMember = "Seq";
  1480. ultraSTART_PIPE_NO.ValueMember = "Seq";
  1481. }
  1482. }
  1483. private void txt_BatchMax_ValueChanged(object sender, EventArgs e)
  1484. {
  1485. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  1486. if (uRow == null) return;
  1487. if (!StringUtil.IsInt32(this.txt_BatchMax.Text.Trim()))
  1488. {
  1489. return;
  1490. }
  1491. doQueryRack(uRow);
  1492. dataTable1.Clear();
  1493. if (int.Parse(this.txt_BatchMax.Text) == 0)
  1494. {
  1495. txtBATCH_MIN.Text = "0";
  1496. }else
  1497. {
  1498. txtBATCH_MIN.Text = (Math.Ceiling(double.Parse(this.txtPIPE_NUM.Text) / int.Parse(this.txt_BatchMax.Text))).ToString();
  1499. }
  1500. if (dtPlanDetial.Count > 0)
  1501. {
  1502. //bool isBacthFlag = dtPlanDetial.Any(p => p.Rate == "408601" || p.Rate == "408608");//判断是否试样组有生产批
  1503. //if (isBacthFlag)
  1504. //{
  1505. //}
  1506. //else
  1507. //{
  1508. int maxBacth = dtPlanM.Max(p => p.BatchNum == null ? 1 : (int)(p.BatchNum));//取主表最大方案
  1509. int batchNum = int.Parse(txtBATCH_MIN.Text);//实际批数
  1510. dtPlanM1 = dtPlanM.Where(p => p.BatchNum == (batchNum > maxBacth ? maxBacth : batchNum)).ToList();//取具体方案
  1511. //}
  1512. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  1513. if (lists == null || lists.Count() == 0)
  1514. {
  1515. return;
  1516. }
  1517. var lists1 = lists.Where(p => p.PhyBatchNo == "").ToList();
  1518. if (lists1.Any())
  1519. {
  1520. ultraSTART_PIPE_NO.Text = lists1.First().Seq.ToString();
  1521. ultraEND_PIPE_NO.Text =
  1522. lists1.Take(int.Parse(txt_BatchMax.Text)).Last().Seq.ToString();
  1523. }
  1524. else
  1525. {
  1526. ultraSTART_PIPE_NO.Text = (lists.Count()).ToString();
  1527. ultraEND_PIPE_NO.Text = (lists.Count()).ToString();
  1528. }
  1529. /* ultraSTART_PIPE_NO.Text = lists.Where(p => p.BatchNo == "").First().Seq.ToString();
  1530. ultraEND_PIPE_NO.Text = lists.Where(p => p.BatchNo == "").Take(int.Parse(txt_BatchMax.Text)).Last().Seq.ToString();*/
  1531. }
  1532. else
  1533. {
  1534. ultraSTART_PIPE_NO.Text = "1";
  1535. ultraEND_PIPE_NO.Text = this.txt_BatchMax.Text;
  1536. }
  1537. }
  1538. private void ultraGrid3_CellChange(object sender, CellEventArgs e)
  1539. {
  1540. this.ultraGrid3.UpdateData();
  1541. dataTable1.Rows.Clear();
  1542. ultraGrid3.Update();
  1543. ultraGrid3.UpdateData();
  1544. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  1545. if (lists == null || lists.Count() <= 0) return;
  1546. foreach (var list in lists.Where(p => p.PhyBatchNo != "").GroupBy(p => p.PhyBatchNo))
  1547. {
  1548. DataRow newRow;
  1549. newRow = dataTable1.NewRow();
  1550. newRow["PHY_BATCH_NO"] = list.Key;
  1551. newRow["START_SEQ"] = list.Min(p => int.Parse(p.Seq));
  1552. newRow["END_SEQ"] = list.Max(p => int.Parse(p.Seq));
  1553. newRow["NUM"] = list.Count();
  1554. newRow["SAMPLE_NUM"] = list.Count(p => p.SamplePipeLenA != "" || p.SamplePipeLenB != "" || p.SamplePipeLenC != "" || p.SamplePipeLenD != "" || p.SamplePipeLenM != "" || p.SamplePipeLenE != "" || p.SamplePipeLenF != "" || p.SamplePipeLenP != "" || p.SamplePipeLenQ != "");
  1555. 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));
  1556. dataTable1.Rows.Add(newRow);
  1557. }
  1558. ultraGrid4.Update();
  1559. 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"))
  1560. {
  1561. if (e.Cell.Row.Cells["Chk"].Value.ToString() == "False")
  1562. {
  1563. MessageUtil.ShowTips("输入长度前,请勾选样管!");
  1564. return;
  1565. }
  1566. }
  1567. if (e != null && e.Cell.Column.Key == "Chk")
  1568. {
  1569. if (e.Cell.Value.ToString() == "True")
  1570. {
  1571. e.Cell.Row.RowSelectorAppearance.BackColor = Color.Red;
  1572. txtMatNo.Text = e.Cell.Row.Cells["MatNo"].Text;
  1573. }
  1574. else
  1575. {
  1576. e.Cell.Row.RowSelectorAppearance.BackColor = Color.Empty;
  1577. }
  1578. }
  1579. }
  1580. private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
  1581. {
  1582. this.ultraGrid5.UpdateData();
  1583. UltraGridRow uRow = this.ultraGrid5.ActiveRow;
  1584. if (uRow == null) return;
  1585. doQueryRack(uRow);
  1586. doQueryBasePlan(uRow);
  1587. }
  1588. DataTable dtChem = new DataTable();
  1589. DataTable dtPhy = new DataTable();
  1590. private void ultraGrid9_AfterRowActivate(object sender, EventArgs e)
  1591. {
  1592. this.ultraGrid9.UpdateData();
  1593. UltraGridRow uRow = this.ultraGrid9.ActiveRow;
  1594. if (uRow == null) return;
  1595. doQuerySampleRack(uRow,"0");//查询正常样管信息
  1596. doQuerySampleRack(uRow,"1");//查询首日检样管信息
  1597. doQuerySampleRack(uRow, "2");//查询生产加样样管信息
  1598. doQueryBasePlan(uRow);
  1599. doQueryPhyChem(uRow,"0");//查询正常样成分、理化项目明细
  1600. doQueryPhyChem(uRow,"1");//查询首日检成分、理化项目明细
  1601. doQueryPhyChem(uRow, "2");//查询生产加样成分、理化项目明细
  1602. initBaseInfo(uRow);//加载已委托检验单
  1603. }
  1604. private void initBaseInfo(UltraGridRow row)
  1605. {
  1606. DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.initBaseInfo", new object[] { row.Cells["JudgeStoveNo"].Text, "F" }, ob);
  1607. if (ds != null && ds.Rows.Count > 0)
  1608. {
  1609. //cmbCheckNo.DataSource = ds;
  1610. //cmbCheckNo.ValueMember = "CHECK_NO_VALUE";
  1611. }
  1612. }
  1613. private void ultraGrid12_AfterRowActivate(object sender, EventArgs e)
  1614. {
  1615. this.ultraGrid12.UpdateData();
  1616. UltraGridRow uRow = this.ultraGrid12.ActiveRow;
  1617. if (uRow == null) return;
  1618. doQueryBasePlan(uRow);
  1619. doQuerySampleNo(uRow);//查询试样号信息
  1620. }
  1621. /// <summary>
  1622. /// 查询试样号信息
  1623. /// </summary>
  1624. /// <param name="uRow"></param>
  1625. private void doQuerySampleNo(UltraGridRow uRow)
  1626. {
  1627. while (dataTable4.Columns.Count > 5)
  1628. {
  1629. dataTable4.Columns.RemoveAt(5);
  1630. }
  1631. DataTable dtSample = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryDetialSampleNo",
  1632. new Object[] { uRow.Cells["CheckNo"].Text }, ob);
  1633. dataTable4.Rows.Clear();
  1634. 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()
  1635. .ForEach(p =>
  1636. {
  1637. foreach (DataRow row in p)
  1638. {
  1639. if (!dataTable4.Columns.Contains(row["PHY_CODE_MAX"].ToString()))
  1640. {
  1641. DataColumn phyCloum = new DataColumn();
  1642. phyCloum.ColumnName = row["PHY_CODE_MAX"].ToString();
  1643. phyCloum.Caption = row["PHY_NAME_MAX"].ToString();
  1644. dataTable4.Columns.Add(phyCloum);
  1645. }
  1646. }
  1647. DataRow dr = dataTable4.NewRow();
  1648. dr["PHY_BATCH_NO"] = p.Key.BatchNo;
  1649. dr["HEAD_MAT_NO"] = p.Key.Sample;
  1650. dr["SAMPLE_LEN"] = p.Max(q => q["SAMPLE_LEN"]);
  1651. dr["MAT_NO"] = p.Key.MatNo;
  1652. dr["CHECK_NO"] = p.Key.CheckNo;
  1653. foreach (DataRow row in p)
  1654. {
  1655. dr[row["PHY_CODE_MAX"].ToString()] = row["SAMPLE_COUNT"].ToString();
  1656. }
  1657. dataTable4.Rows.Add(dr);
  1658. });
  1659. ultraGrid14.DataBind();
  1660. GridHelper.RefreshAndAutoSize(ultraGrid14);
  1661. }
  1662. /// <summary>
  1663. /// 查询成分理化项目明细
  1664. /// </summary>
  1665. /// <param name="uRow"></param>
  1666. private void doQueryPhyChem(UltraGridRow uRow,string sampleType)
  1667. {
  1668. DataTable dataTable = null;
  1669. UltraGrid ug = null;
  1670. string craftSource = "";
  1671. if (sampleType == "0")
  1672. {
  1673. dataTable = dataTable3;
  1674. ug = ultraGrid11;
  1675. craftSource = "0";
  1676. }
  1677. else if (sampleType == "1")
  1678. {
  1679. dataTable = dataTable5;
  1680. ug = ultraGrid18;
  1681. craftSource = "2";
  1682. ultraLabel17.Text = "";
  1683. }
  1684. else if (sampleType == "2")
  1685. {
  1686. dataTable = dataTable7;
  1687. ug = ultraGrid23;
  1688. craftSource = "0";
  1689. }
  1690. while (dataTable.Columns.Count > 5)
  1691. {
  1692. dataTable.Columns.RemoveAt(5);
  1693. }
  1694. dtChem = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryChem", new Object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, BaseMethod.getJudgeStoveNo(uRow.Cells["JudgeStoveNo"].Text), craftSource, uRow.Cells["HeatPlanNo"].Text }, ob);//查询成分明细
  1695. if (dtChem.Rows.Count > 0)
  1696. {
  1697. DataColumn hxCloum = new DataColumn();
  1698. hxCloum.ColumnName = "HX";
  1699. hxCloum.Caption = "化学";
  1700. dataTable.Columns.Add(hxCloum);
  1701. }
  1702. dtPhy = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPhy", new Object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text,BaseMethod.getJudgeStoveNo(uRow.Cells["JudgeStoveNo"].Text) , craftSource,uRow.Cells["Pic"].Text }, ob);//查询理化明细
  1703. string[] phyMaxCode = null;
  1704. ultraLabel4.Text = "";
  1705. List<string> list = new List<string>();
  1706. if (dtPhy.Rows.Count > 0)
  1707. {
  1708. 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()
  1709. .ForEach(p =>
  1710. {
  1711. DataColumn phyCloum = new DataColumn();
  1712. phyCloum.ColumnName = p.Code;
  1713. phyCloum.Caption = p.Name;
  1714. try
  1715. {
  1716. dataTable.Columns.Add(phyCloum);
  1717. }
  1718. catch
  1719. { };
  1720. if (p.rate.Equals("408601") || p.rate.Equals("408608"))
  1721. {
  1722. ultraLabel4.Text = ultraLabel4.Text + p.Name + " 取样频次:" + p.rateName;
  1723. list.Add(p.Code);
  1724. }
  1725. if (sampleType == "1")
  1726. {
  1727. if (p.common.Equals("1"))
  1728. {
  1729. ultraLabel17.Text = ultraLabel17.Text + p.Name + " (共样) ";
  1730. }
  1731. }
  1732. });
  1733. }
  1734. foreach (DataRow dr in dataTable.Rows)
  1735. {
  1736. string[] phyCodeGroup = dr["PHY_CODE_GROUP"].ToString().Split(',');
  1737. for (int i = 5; i < dataTable.Columns.Count; i++)
  1738. {
  1739. if (phyCodeGroup.Contains(dataTable.Columns[i].ColumnName))
  1740. {
  1741. dr[i] = "√";
  1742. }
  1743. }
  1744. }
  1745. phyMaxCode = list.ToArray();
  1746. ug.DataBind();
  1747. GridHelper.RefreshAndAutoSize(ug);
  1748. ultraLabel4.ForeColor = Color.Red;
  1749. ultraLabel17.ForeColor = Color.Red;
  1750. //if (phyMaxCode.Length > 0)
  1751. //{
  1752. // doQueryPhyCodeMax(phyMaxCode, uRow.Cells["LotNo"].Text);
  1753. //}
  1754. }
  1755. private void doQueryPhyCodeMax(string[] phyMaxCode, string lotNo)
  1756. {
  1757. List<PipeCheckconsignDetailEntity> listSource = EntityHelper.GetData<PipeCheckconsignDetailEntity>(
  1758. "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPhyCodeMax", new object[] { lotNo, phyMaxCode }, this.ob);
  1759. pipeCheckconsignDetailEntityBindingSource.DataSource = listSource;
  1760. }
  1761. /// <summary>
  1762. /// 查询正常样管信息
  1763. /// </summary>
  1764. private void doQuerySampleRack(UltraGridRow uRow, string sampleType)
  1765. {
  1766. DataTable dtBatchNo = null;
  1767. if (sampleType == "0")
  1768. {
  1769. dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQuerySampleInfo",
  1770. new Object[] { uRow.Cells["ZyBatchId"].Text, uRow.Cells["JudgeStoveNo"].Text, sampleType }, ob);
  1771. }else if(sampleType == "1")
  1772. {
  1773. dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQuerySampleInfo",
  1774. new Object[] { uRow.Cells["ZyBatchId"].Text, uRow.Cells["JudgeStoveNo"].Text, "1" }, ob);
  1775. }
  1776. else if (sampleType == "2")
  1777. {
  1778. dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQuerySampleInfo",
  1779. new Object[] { uRow.Cells["ZyBatchId"].Text, uRow.Cells["JudgeStoveNo"].Text, "2" }, ob);
  1780. }
  1781. if (sampleType == "0")
  1782. {
  1783. GridHelper.CopyDataToDatatable(dtBatchNo, dataTable3, true);
  1784. }
  1785. else if (sampleType == "1")
  1786. {
  1787. GridHelper.CopyDataToDatatable(dtBatchNo, dataTable5, true);
  1788. }
  1789. else if (sampleType == "2")
  1790. {
  1791. GridHelper.CopyDataToDatatable(dtBatchNo, dataTable7, true);
  1792. }
  1793. //DataTable dataTable = null;
  1794. //UltraGrid ug = null;
  1795. //if (sampleType == "0")
  1796. //{
  1797. // dataTable = dataTable3;
  1798. // ug = ultraGrid11;
  1799. //}
  1800. //else if (sampleType == "1")
  1801. //{
  1802. // dataTable = dataTable5;
  1803. // ug = ultraGrid18;
  1804. //}
  1805. //dataTable.Rows.Clear();
  1806. //foreach (DataRow row in dtBatchNo.Rows)
  1807. //{
  1808. // if (row["SAMPLE_PIPE_LEN_A"] != null && row["SAMPLE_PIPE_LEN_A"].ToString() != "")
  1809. // {
  1810. // DataRow newRowA = dataTable.NewRow();
  1811. // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1812. // newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1813. // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_A"].ToString();
  1814. // newRowA["SAMPLE_POSTION"] = "A端";
  1815. // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUP"].ToString();
  1816. // dataTable.Rows.Add(newRowA);
  1817. // }
  1818. // if (row["SAMPLE_PIPE_LEN_B"] != null && row["SAMPLE_PIPE_LEN_B"].ToString() != "")
  1819. // {
  1820. // DataRow newRowA = dataTable.NewRow();
  1821. // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1822. // newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1823. // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_B"].ToString();
  1824. // newRowA["SAMPLE_POSTION"] = "B端";
  1825. // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPB"].ToString();
  1826. // dataTable.Rows.Add(newRowA);
  1827. // }
  1828. // if (row["SAMPLE_PIPE_LEN_C"] != null && row["SAMPLE_PIPE_LEN_C"].ToString() != "")
  1829. // {
  1830. // DataRow newRowA = dataTable.NewRow();
  1831. // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1832. // newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1833. // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_C"].ToString();
  1834. // newRowA["SAMPLE_POSTION"] = "C端";
  1835. // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPC"].ToString();
  1836. // dataTable.Rows.Add(newRowA);
  1837. // }
  1838. // if (row["SAMPLE_PIPE_LEN_D"] != null && row["SAMPLE_PIPE_LEN_D"].ToString() != "")
  1839. // {
  1840. // DataRow newRowA = dataTable.NewRow();
  1841. // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1842. // newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1843. // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_D"].ToString();
  1844. // newRowA["SAMPLE_POSTION"] = "D端";
  1845. // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPD"].ToString();
  1846. // dataTable.Rows.Add(newRowA);
  1847. // }
  1848. // if (row["SAMPLE_PIPE_LEN_M"] != null && row["SAMPLE_PIPE_LEN_M"].ToString() != "")
  1849. // {
  1850. // DataRow newRowA = dataTable.NewRow();
  1851. // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1852. // newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1853. // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_M"].ToString();
  1854. // newRowA["SAMPLE_POSTION"] = "M端";
  1855. // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPM"].ToString();
  1856. // dataTable.Rows.Add(newRowA);
  1857. // }
  1858. // if (row["SAMPLE_PIPE_LEN_E"] != null && row["SAMPLE_PIPE_LEN_E"].ToString() != "")
  1859. // {
  1860. // DataRow newRowA = dataTable.NewRow();
  1861. // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1862. // newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1863. // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_E"].ToString();
  1864. // newRowA["SAMPLE_POSTION"] = "E端";
  1865. // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPE"].ToString();
  1866. // dataTable.Rows.Add(newRowA);
  1867. // }
  1868. // if (row["SAMPLE_PIPE_LEN_F"] != null && row["SAMPLE_PIPE_LEN_F"].ToString() != "")
  1869. // {
  1870. // DataRow newRowA = dataTable.NewRow();
  1871. // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1872. // newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1873. // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_F"].ToString();
  1874. // newRowA["SAMPLE_POSTION"] = "F端";
  1875. // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPF"].ToString();
  1876. // dataTable.Rows.Add(newRowA);
  1877. // }
  1878. // if (row["SAMPLE_PIPE_LEN_P"] != null && row["SAMPLE_PIPE_LEN_P"].ToString() != "")
  1879. // {
  1880. // DataRow newRowA = dataTable.NewRow();
  1881. // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1882. // newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1883. // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_P"].ToString();
  1884. // newRowA["SAMPLE_POSTION"] = "P端";
  1885. // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPP"].ToString();
  1886. // dataTable.Rows.Add(newRowA);
  1887. // }
  1888. // if (row["SAMPLE_PIPE_LEN_Q"] != null && row["SAMPLE_PIPE_LEN_Q"].ToString() != "")
  1889. // {
  1890. // DataRow newRowA = dataTable.NewRow();
  1891. // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  1892. // newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  1893. // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_Q"].ToString();
  1894. // newRowA["SAMPLE_POSTION"] = "Q端";
  1895. // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPQ"].ToString();
  1896. // dataTable.Rows.Add(newRowA);
  1897. // }
  1898. //}
  1899. //GridHelper.RefreshAndAutoSize(ug);
  1900. }
  1901. private void ultraGrid11_ClickCell(object sender, ClickCellEventArgs e)
  1902. {
  1903. this.ultraGrid9.UpdateData();
  1904. UltraGridRow uRow = this.ultraGrid9.ActiveRow;
  1905. if (uRow == null) return;
  1906. string craftSource = "";
  1907. if (ultraTabControl3.SelectedTab.Key == "0")
  1908. {
  1909. craftSource = "0";
  1910. }
  1911. else if (ultraTabControl3.SelectedTab.Key == "1")
  1912. {
  1913. craftSource = "2";
  1914. }
  1915. else
  1916. {
  1917. craftSource = "0";
  1918. }
  1919. 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")
  1920. {
  1921. if (e.Cell.Text.Trim() == "")
  1922. {
  1923. DataTable ds = new DataTable();
  1924. if (e.Cell.Column.Key == "C0004" || e.Cell.Column.Key == "C0100" || e.Cell.Column.Key == "C0103" || e.Cell.Column.Key == "C0107")
  1925. {
  1926. if(ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0030")){
  1927. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030", uRow.Cells["Pic"].Text }, ob);
  1928. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1929. {
  1930. e.Cell.Row.Cells["C0030"].Value = "√";
  1931. }
  1932. }
  1933. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0033"))
  1934. {
  1935. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033", uRow.Cells["Pic"].Text }, ob);
  1936. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1937. {
  1938. e.Cell.Row.Cells["C0033"].Value = "√";
  1939. }
  1940. } if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0133"))
  1941. {
  1942. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0133", uRow.Cells["Pic"].Text }, ob);
  1943. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1944. {
  1945. e.Cell.Row.Cells["C0133"].Value = "√";
  1946. }
  1947. }
  1948. }
  1949. else if (e.Cell.Column.Key == "C0030")
  1950. {
  1951. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030", uRow.Cells["Pic"].Text }, ob);
  1952. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1953. {
  1954. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107"))
  1955. {
  1956. e.Cell.Row.Cells["C0107"].Value = "√";
  1957. }
  1958. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103"))
  1959. {
  1960. e.Cell.Row.Cells["C0103"].Value = "√";
  1961. }
  1962. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100"))
  1963. {
  1964. e.Cell.Row.Cells["C0100"].Value = "√";
  1965. }
  1966. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004"))
  1967. {
  1968. e.Cell.Row.Cells["C0004"].Value = "√";
  1969. }
  1970. }
  1971. }
  1972. else if (e.Cell.Column.Key == "C0033")
  1973. {
  1974. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033", uRow.Cells["Pic"].Text }, ob);
  1975. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1976. {
  1977. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107"))
  1978. {
  1979. e.Cell.Row.Cells["C0107"].Value = "√";
  1980. }
  1981. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103"))
  1982. {
  1983. e.Cell.Row.Cells["C0103"].Value = "√";
  1984. }
  1985. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100"))
  1986. {
  1987. e.Cell.Row.Cells["C0100"].Value = "√";
  1988. }
  1989. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004"))
  1990. {
  1991. e.Cell.Row.Cells["C0004"].Value = "√";
  1992. }
  1993. }
  1994. }
  1995. else if (e.Cell.Column.Key == "C0133")
  1996. {
  1997. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0133", uRow.Cells["Pic"].Text }, ob);
  1998. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  1999. {
  2000. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107"))
  2001. {
  2002. e.Cell.Row.Cells["C0107"].Value = "√";
  2003. }
  2004. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103"))
  2005. {
  2006. e.Cell.Row.Cells["C0103"].Value = "√";
  2007. }
  2008. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100"))
  2009. {
  2010. e.Cell.Row.Cells["C0100"].Value = "√";
  2011. }
  2012. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004"))
  2013. {
  2014. e.Cell.Row.Cells["C0004"].Value = "√";
  2015. }
  2016. }
  2017. }
  2018. e.Cell.Value = "√";
  2019. }
  2020. else
  2021. {
  2022. DataTable ds = new DataTable();
  2023. if (e.Cell.Column.Key == "C0004" || e.Cell.Column.Key == "C0100" || e.Cell.Column.Key == "C0103" || e.Cell.Column.Key == "C0107")
  2024. {
  2025. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0030"))
  2026. {
  2027. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030", uRow.Cells["Pic"].Text }, ob);
  2028. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  2029. {
  2030. e.Cell.Row.Cells["C0030"].Value = "";
  2031. }
  2032. }
  2033. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0033"))
  2034. {
  2035. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033", uRow.Cells["Pic"].Text }, ob);
  2036. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  2037. {
  2038. e.Cell.Row.Cells["C0033"].Value = "";
  2039. }
  2040. } if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0133"))
  2041. {
  2042. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0133", uRow.Cells["Pic"].Text }, ob);
  2043. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  2044. {
  2045. e.Cell.Row.Cells["C0133"].Value = "";
  2046. }
  2047. }
  2048. }
  2049. else if (e.Cell.Column.Key == "C0030")
  2050. {
  2051. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030", uRow.Cells["Pic"].Text }, ob);
  2052. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  2053. {
  2054. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107"))
  2055. {
  2056. e.Cell.Row.Cells["C0107"].Value = "";
  2057. }
  2058. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103"))
  2059. {
  2060. e.Cell.Row.Cells["C0103"].Value = "";
  2061. }
  2062. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100"))
  2063. {
  2064. e.Cell.Row.Cells["C0100"].Value = "";
  2065. }
  2066. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004"))
  2067. {
  2068. e.Cell.Row.Cells["C0004"].Value = "";
  2069. }
  2070. }
  2071. }
  2072. else if (e.Cell.Column.Key == "C0033")
  2073. {
  2074. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033", uRow.Cells["Pic"].Text }, ob);
  2075. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  2076. {
  2077. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107"))
  2078. {
  2079. e.Cell.Row.Cells["C0107"].Value = "";
  2080. }
  2081. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103"))
  2082. {
  2083. e.Cell.Row.Cells["C0103"].Value = "";
  2084. }
  2085. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100"))
  2086. {
  2087. e.Cell.Row.Cells["C0100"].Value = "";
  2088. }
  2089. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004"))
  2090. {
  2091. e.Cell.Row.Cells["C0004"].Value = "";
  2092. }
  2093. }
  2094. }
  2095. else if (e.Cell.Column.Key == "C0133")
  2096. {
  2097. ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0133", uRow.Cells["Pic"].Text }, ob);
  2098. if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902"))
  2099. {
  2100. if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107"))
  2101. {
  2102. e.Cell.Row.Cells["C0107"].Value = "";
  2103. }
  2104. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103"))
  2105. {
  2106. e.Cell.Row.Cells["C0103"].Value = "";
  2107. }
  2108. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100"))
  2109. {
  2110. e.Cell.Row.Cells["C0100"].Value = "";
  2111. }
  2112. else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004"))
  2113. {
  2114. e.Cell.Row.Cells["C0004"].Value = "";
  2115. }
  2116. }
  2117. }
  2118. e.Cell.Value = "";
  2119. }
  2120. }
  2121. }
  2122. private void FrmMilBatchSampleNew_Shown(object sender, EventArgs e)
  2123. {
  2124. if (toolMenu == null || toolMenu.Toolbars == null) return;
  2125. if (toolMenu.Toolbars[0].Tools.Exists("CancelBatchSeting"))
  2126. {
  2127. toolMenu.Toolbars[0].Tools["CancelBatchSeting"].InstanceProps.Visible = DefaultableBoolean.False;
  2128. }
  2129. if (toolMenu.Toolbars[0].Tools.Exists("Confirm"))
  2130. {
  2131. toolMenu.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = DefaultableBoolean.False;
  2132. }
  2133. if (toolMenu.Toolbars[0].Tools.Exists("CancelConfirm"))
  2134. {
  2135. toolMenu.Toolbars[0].Tools["CancelConfirm"].InstanceProps.Visible = DefaultableBoolean.False;
  2136. }
  2137. if (toolMenu.Toolbars[0].Tools.Exists("Print"))
  2138. {
  2139. toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = DefaultableBoolean.False;
  2140. }
  2141. if (toolMenu.Toolbars[0].Tools.Exists("PrintLable"))
  2142. {
  2143. toolMenu.Toolbars[0].Tools["PrintLable"].InstanceProps.Visible = DefaultableBoolean.False;
  2144. }
  2145. if (toolMenu.Toolbars[0].Tools.Exists("CancelGetSample"))
  2146. {
  2147. toolMenu.Toolbars[0].Tools["CancelGetSample"].InstanceProps.Visible = DefaultableBoolean.False;
  2148. }
  2149. if (toolMenu.Toolbars[0].Tools.Exists("QueryRepeate"))
  2150. {
  2151. toolMenu.Toolbars[0].Tools["QueryRepeate"].InstanceProps.Visible = DefaultableBoolean.False;
  2152. }
  2153. if (toolMenu.Toolbars[0].Tools.Exists("ReGetSample"))
  2154. {
  2155. toolMenu.Toolbars[0].Tools["ReGetSample"].InstanceProps.Visible = DefaultableBoolean.False;
  2156. }
  2157. if (toolMenu.Toolbars[0].Tools.Exists("CancelReGetSample"))
  2158. {
  2159. toolMenu.Toolbars[0].Tools["CancelReGetSample"].InstanceProps.Visible = DefaultableBoolean.False;
  2160. }
  2161. if (toolMenu.Toolbars[0].Tools.Exists("RepeateFrim"))
  2162. {
  2163. toolMenu.Toolbars[0].Tools["RepeateFrim"].InstanceProps.Visible = DefaultableBoolean.False;
  2164. }
  2165. if (toolMenu.Toolbars[0].Tools.Exists("CancelRepeateFrim"))
  2166. {
  2167. toolMenu.Toolbars[0].Tools["CancelRepeateFrim"].InstanceProps.Visible = DefaultableBoolean.False;
  2168. }
  2169. if (toolMenu.Toolbars[0].Tools.Exists("PrintRe"))
  2170. {
  2171. toolMenu.Toolbars[0].Tools["PrintRe"].InstanceProps.Visible = DefaultableBoolean.False;
  2172. }
  2173. if (toolMenu.Toolbars[0].Tools.Exists("PrintReLable"))
  2174. {
  2175. toolMenu.Toolbars[0].Tools["PrintReLable"].InstanceProps.Visible = DefaultableBoolean.False;
  2176. }
  2177. btnConfirm.Visible = false;
  2178. btnAuto.Visible = false;
  2179. buttonBatchNo.Visible = false;
  2180. buttonGetSample.Visible = false;
  2181. buttonSd.Visible = true;
  2182. txt_BatchMax.ReadOnly = true;
  2183. }
  2184. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  2185. {
  2186. if (toolMenu == null || toolMenu.Toolbars == null) return;
  2187. 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; }
  2188. if (toolMenu.Toolbars[0].Tools.Exists("BatchSeting")) { toolMenu.Toolbars[0].Tools["BatchSeting"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2189. if (toolMenu.Toolbars[0].Tools.Exists("CancelBatchSeting")) { toolMenu.Toolbars[0].Tools["CancelBatchSeting"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 1 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2190. if (toolMenu.Toolbars[0].Tools.Exists("OprocessBatch")) { toolMenu.Toolbars[0].Tools["OprocessBatch"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2191. if (toolMenu.Toolbars[0].Tools.Exists("CancelOprocessBatch")) { toolMenu.Toolbars[0].Tools["CancelOprocessBatch"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2192. if (toolMenu.Toolbars[0].Tools.Exists("GetSample")) { toolMenu.Toolbars[0].Tools["GetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2193. if (toolMenu.Toolbars[0].Tools.Exists("Approval")) { toolMenu.Toolbars[0].Tools["Approval"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2194. if (toolMenu.Toolbars[0].Tools.Exists("ComfrimComplete")) { toolMenu.Toolbars[0].Tools["ComfrimComplete"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2195. if (toolMenu.Toolbars[0].Tools.Exists("CancelGetSample")) { toolMenu.Toolbars[0].Tools["CancelGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 1 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2196. if (toolMenu.Toolbars[0].Tools.Exists("Confirm")) { toolMenu.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 2 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2197. if (toolMenu.Toolbars[0].Tools.Exists("CancelConfirm")) { toolMenu.Toolbars[0].Tools["CancelConfirm"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2198. if (toolMenu.Toolbars[0].Tools.Exists("Print")) { toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2199. if (toolMenu.Toolbars[0].Tools.Exists("PrintLable")) { toolMenu.Toolbars[0].Tools["PrintLable"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2200. if (toolMenu.Toolbars[0].Tools.Exists("ReGetSample")) { toolMenu.Toolbars[0].Tools["ReGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2201. if (toolMenu.Toolbars[0].Tools.Exists("CancelReGetSample")) { toolMenu.Toolbars[0].Tools["CancelReGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2202. 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; }
  2203. if (toolMenu.Toolbars[0].Tools.Exists("RepeateFrim")) { toolMenu.Toolbars[0].Tools["RepeateFrim"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2204. if (toolMenu.Toolbars[0].Tools.Exists("CancelRepeateFrim")) { toolMenu.Toolbars[0].Tools["CancelRepeateFrim"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2205. if (toolMenu.Toolbars[0].Tools.Exists("PrintRe")) { toolMenu.Toolbars[0].Tools["PrintRe"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2206. if (toolMenu.Toolbars[0].Tools.Exists("PrintReLable")) { toolMenu.Toolbars[0].Tools["PrintReLable"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; }
  2207. }
  2208. /// <summary>
  2209. /// 纯手工分批
  2210. /// </summary>
  2211. /// <param name="sender"></param>
  2212. /// <param name="e"></param>
  2213. private void buttonSd_Click(object sender, EventArgs e)
  2214. {
  2215. this.ultraGrid4.UpdateData();
  2216. UltraGridRow row = this.ultraGrid1.ActiveRow;
  2217. if (row == null) return;
  2218. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  2219. var m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据
  2220. if (m.Count == 0)
  2221. {
  2222. return;
  2223. }
  2224. int Bathno = 1;
  2225. int tsBatchNo = 0;//探伤最大批号
  2226. int pipeBatchNo = 0;//检验最大批号
  2227. int sampleNum = int.Parse(this.txt_SampleNum.Text.ToString3());
  2228. int startSeq = int.Parse(ultraSTART_PIPE_NO.Text);//开始序号
  2229. int endSeq = int.Parse(ultraEND_PIPE_NO.Text);//结束序号
  2230. if(this.txt_BatchMax.Text.Trim() != "")
  2231. {
  2232. if (endSeq - startSeq + 1 > int.Parse(this.txt_BatchMax.Text.ToString3()))
  2233. {
  2234. MessageUtil.ShowTips("分批数量不能大于工艺要求分批上限!");
  2235. return;
  2236. }
  2237. }
  2238. var lists1 = lists.Where(p => p.PhyBatchNo != "").ToList();
  2239. if (lists1.Any())
  2240. {
  2241. Bathno = lists1.Max(p => int.Parse(p.PhyBatchNo.Substring(2, 3))) + 1;
  2242. }
  2243. DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryMaxBatchNo", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["PlineCode"].Text }, ob);//查询探伤实绩最大的批号
  2244. if (ds.Rows.Count > 0)
  2245. {
  2246. tsBatchNo = int.Parse(ds.Rows[0][0].ToString());
  2247. }
  2248. DataTable dsPipe = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryMaxBatchNoPipe", new object[] { row.Cells["JudgeStoveNo"].Text, row.Cells["PlineCode"].Text }, ob);//查询探检验最大的批号
  2249. if (dsPipe.Rows.Count > 0)
  2250. {
  2251. pipeBatchNo = int.Parse(dsPipe.Rows[0][0].ToString());
  2252. }
  2253. if (pipeBatchNo > Bathno)
  2254. {
  2255. Bathno = pipeBatchNo;
  2256. }
  2257. //if (tsBatchNo > pipeBatchNo)
  2258. //{
  2259. // if (tsBatchNo > Bathno)
  2260. // {
  2261. // Bathno = tsBatchNo;
  2262. // }
  2263. //}
  2264. //else
  2265. //{
  2266. // if (pipeBatchNo > Bathno)
  2267. // {
  2268. // Bathno = pipeBatchNo;
  2269. // }
  2270. //}
  2271. m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.PhyBatchNo = batchNoZ + Bathno.ToString("000"));//赋值批号
  2272. //m.Take(sampleNum).ToList().ForEach(p => p.Chk = true);
  2273. List<PortHttBatchSampleResultEntity> lists2 = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  2274. var k = lists2.Where(p =>p.PhyBatchNo == "").ToList();
  2275. if (k.Count() > 0)
  2276. {
  2277. ultraSTART_PIPE_NO.Text = k.First().Seq.ToString();//初始序号 跳过已赋值批号数据
  2278. }
  2279. else
  2280. {
  2281. ultraSTART_PIPE_NO.Text = (lists2.Count()).ToString();
  2282. }
  2283. ultraEND_PIPE_NO.Text = (lists2.Count()).ToString();//结束序号
  2284. ultraGrid3.Update();
  2285. ultraGrid3.DataBind();
  2286. ultraGrid3_CellChange(null, null);
  2287. for (int i = 0; i < this.ultraGrid3.Rows.Count();i++)
  2288. {
  2289. if (this.ultraGrid3.Rows[i].Cells["PhyBatchNo"].Value.ToString2() == "") return;
  2290. if (ultraGrid3.Rows[0].Cells["SamplePipeLenA"].Value.ToString2() != "" || ultraGrid3.Rows[0].Cells["SamplePipeLenB"].Value.ToString2() != "" || ultraGrid3.Rows[0].Cells["SamplePipeLenC"].Value.ToString2() != "" || ultraGrid3.Rows[0].Cells["SamplePipeLenD"].Value.ToString2() != "" || ultraGrid3.Rows[0].Cells["SamplePipeLenM"].Value.ToString2() != "")
  2291. {
  2292. this.ultraGrid3.Rows[0].RowSelectorAppearance.BackColor = Color.Red;
  2293. }
  2294. if (i == 0)
  2295. {
  2296. this.ultraGrid3.Rows[0].Appearance.BackColor = color1;
  2297. }
  2298. else
  2299. {
  2300. PortHttBatchSampleResultEntity lastList = ultraGrid3.Rows[ultraGrid3.Rows[i - 1].Index].ListObject as PortHttBatchSampleResultEntity;
  2301. if ((this.ultraGrid3.Rows[i].Cells["PhyBatchNo"].Value.ToString2() == lastList.PhyBatchNo))
  2302. {
  2303. this.ultraGrid3.Rows[i].Appearance.BackColor = ultraGrid3.Rows[ultraGrid3.Rows[i - 1].Index].Appearance.BackColor;
  2304. }
  2305. else
  2306. {
  2307. this.ultraGrid3.Rows[i].Appearance.BackColor = ultraGrid3.Rows[ultraGrid3.Rows[i - 1].Index].Appearance.BackColor == color1 ? color2 : color1;
  2308. }
  2309. }
  2310. }
  2311. }
  2312. /// <summary>
  2313. /// 仅分批
  2314. /// </summary>
  2315. /// <param name="sender"></param>
  2316. /// <param name="e"></param>
  2317. private void buttonBatchNo_Click(object sender, EventArgs e)
  2318. {
  2319. this.ultraGrid4.UpdateData();
  2320. if (!StringUtil.IsInt32(txt_BatchMax.Text.ToString3()) || int.Parse(txt_BatchMax.Text.ToString3()) <= 0)
  2321. {
  2322. MessageUtil.ShowTips("人工分批输入的分批上限需为正整数!");
  2323. return;
  2324. }
  2325. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  2326. var m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据
  2327. if (m.Count == 0)
  2328. {
  2329. return;
  2330. }
  2331. int Bathno = 1;
  2332. int sampleNum = 0;
  2333. for (int k = 0; k < int.Parse(this.txtBATCH_MIN.Text.ToString3()); k++)
  2334. {
  2335. int startSeq = int.Parse(ultraSTART_PIPE_NO.Text);//开始序号
  2336. int endSeq = int.Parse(ultraEND_PIPE_NO.Text);//结束序号
  2337. var lists1 = lists.Where(p => p.PhyBatchNo != "").ToList();
  2338. if (lists1.Any())
  2339. {
  2340. Bathno = lists1.Max(p => int.Parse(p.PhyBatchNo.Substring(2, 3))) + 1;
  2341. }
  2342. m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.PhyBatchNo = batchNoZ + Bathno.ToString("000"));//赋值批号
  2343. m.Take(sampleNum).ToList().ForEach(p => p.Chk = true);
  2344. ultraSTART_PIPE_NO.Text = m.First().Seq.ToString();//初始序号 跳过已赋值批号数据
  2345. ultraEND_PIPE_NO.Text = m.Take(int.Parse(txt_BatchMax.Text.ToString3())).Last().Seq.ToString();//结束序号
  2346. ultraGrid3.Update();
  2347. ultraGrid3.DataBind();
  2348. ultraGrid3_CellChange(null, null);
  2349. m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据
  2350. if (m.Count == 0)
  2351. {
  2352. return;
  2353. }
  2354. }
  2355. }
  2356. /// <summary>
  2357. /// 逐支取样
  2358. /// </summary>
  2359. /// <param name="sender"></param>
  2360. /// <param name="e"></param>
  2361. private void pipeceButtonStd_Click(object sender, EventArgs e)
  2362. {
  2363. this.ultraGrid1.UpdateData();
  2364. this.ultraGrid3.UpdateData();
  2365. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  2366. if (uRow == null) return;
  2367. string len = "";
  2368. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  2369. var m = lists.Where(p => p.PhyBatchNo != "").ToList();//判断是否还未分配性能批号集合数据
  2370. if (m.Count == 0)
  2371. {
  2372. return;
  2373. }
  2374. if (this.txtPieceLen.Text == "")
  2375. {
  2376. MessageUtil.ShowTips("请输入逐支取样长度!");
  2377. return;
  2378. }
  2379. if (!StringUtil.IsInt(this.txtPieceLen.Text.Trim().ToString3()))
  2380. {
  2381. MessageUtil.ShowTips("逐支取样长度需输入正整数!");
  2382. return;
  2383. }
  2384. len = this.txtPieceLen.Text.Trim();
  2385. DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPhyMaxPipece", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, this.cmbSampleType.Value.ToString() }, ob);
  2386. if (ds.Rows.Count == 0)
  2387. {
  2388. MessageUtil.ShowTips("无逐支取样试样组,不允许一键取样!");
  2389. return;
  2390. }
  2391. var status = new List<string> { };
  2392. status = this.cmbPiecePostion.CheckedItems.Select(p => p.DataValue.ToString()).ToList();
  2393. if (!status.Any()) status = new List<string> { "401201", "401202", "401217", "401218", "401219", "401220", "401221", "401222", "401223" };
  2394. List<PipeCheckconsignDetailEntity> listS = EntityHelper.GetData<PipeCheckconsignDetailEntity>(
  2395. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQuerySampleMatNo", new object[] { uRow.Cells["JudgeStoveNo"].Text, this.cmbSampleType.Value.ToString() }, this.ob);
  2396. for (int i = 0; i < lists.Count; i++)
  2397. {
  2398. var p = lists[i];
  2399. if (status.ToArray().Length == 1)
  2400. {
  2401. var listD = listS.Where(q => q.MatNo == p.MatNo).ToList();
  2402. if (listD.Any()) return;
  2403. if (status.Contains("401201") || status.Contains("401202"))
  2404. {
  2405. if (i == 0)
  2406. {
  2407. p.SamplePipeLenA = len;
  2408. }
  2409. else
  2410. {
  2411. var LastlistD = listS.Where(q => q.MatNo == lists[i - 1].MatNo).ToList();
  2412. if (LastlistD.Any())
  2413. {
  2414. if (LastlistD[0].Postion == "A")
  2415. {
  2416. p.SamplePipeLenB = len;
  2417. }
  2418. else
  2419. {
  2420. p.SamplePipeLenA = len;
  2421. }
  2422. }
  2423. else
  2424. {
  2425. if (lists[i - 1].SamplePipeLenA == "")
  2426. {
  2427. p.SamplePipeLenA = len;
  2428. }
  2429. else
  2430. {
  2431. p.SamplePipeLenB = len;
  2432. }
  2433. }
  2434. }
  2435. }
  2436. if (status.Contains("401217"))
  2437. {
  2438. p.SamplePipeLenC = len;
  2439. }
  2440. if (status.Contains("401218"))
  2441. {
  2442. p.SamplePipeLenD = len;
  2443. }
  2444. if (status.Contains("401219"))
  2445. {
  2446. p.SamplePipeLenM = len;
  2447. }
  2448. if (status.Contains("401220"))
  2449. {
  2450. p.SamplePipeLenE = len;
  2451. }
  2452. if (status.Contains("401221"))
  2453. {
  2454. p.SamplePipeLenF = len;
  2455. }
  2456. if (status.Contains("401222"))
  2457. {
  2458. p.SamplePipeLenP = len;
  2459. }
  2460. if (status.Contains("401223"))
  2461. {
  2462. p.SamplePipeLenQ = len;
  2463. }
  2464. }
  2465. else
  2466. {
  2467. var listD = listS.Where(q => q.MatNo == p.MatNo).ToList();
  2468. if (listD.Any()) return;
  2469. if (status.Contains("401201"))
  2470. {
  2471. p.SamplePipeLenA = len;
  2472. }
  2473. if (status.Contains("401202"))
  2474. {
  2475. p.SamplePipeLenB = len;
  2476. }
  2477. if (status.Contains("401217"))
  2478. {
  2479. p.SamplePipeLenC = len;
  2480. }
  2481. if (status.Contains("401218"))
  2482. {
  2483. p.SamplePipeLenD = len;
  2484. }
  2485. if (status.Contains("401219"))
  2486. {
  2487. p.SamplePipeLenM = len;
  2488. }
  2489. if (status.Contains("401220"))
  2490. {
  2491. p.SamplePipeLenE = len;
  2492. }
  2493. if (status.Contains("401221"))
  2494. {
  2495. p.SamplePipeLenF = len;
  2496. }
  2497. if (status.Contains("401222"))
  2498. {
  2499. p.SamplePipeLenP = len;
  2500. }
  2501. if (status.Contains("401223"))
  2502. {
  2503. p.SamplePipeLenQ = len;
  2504. }
  2505. }
  2506. p.ChemResultCode = "1";
  2507. p.Chk = true;
  2508. }
  2509. ultraGrid3.Update();
  2510. ultraGrid3.DataBind();
  2511. ultraGrid3_CellChange(null, null);
  2512. }
  2513. /// <summary>
  2514. /// 仅取样
  2515. /// </summary>
  2516. /// <param name="sender"></param>
  2517. /// <param name="e"></param>
  2518. private void buttonGetSample_Click(object sender, EventArgs e)
  2519. {
  2520. this.ultraGrid4.UpdateData();
  2521. int sampleNum = 0;
  2522. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  2523. var m = lists.Where(p => p.PhyBatchNo != "").ToList();//判断是否还未分配性能批号集合数据
  2524. if (m.Count == 0)
  2525. {
  2526. return;
  2527. }
  2528. if (!StringUtil.IsInt32(this.txt_SampleNum.Text.Trim().ToString3()))
  2529. {
  2530. MessageUtil.ShowTips("样管数量需输入正整数!");
  2531. return;
  2532. }
  2533. if (int.Parse(this.txt_SampleNum.Text.Trim().ToString3()) <= 0)
  2534. {
  2535. MessageUtil.ShowTips("取样时每批样管数应大于0");
  2536. return;
  2537. }
  2538. else
  2539. {
  2540. sampleNum = int.Parse(this.txt_SampleNum.Text.Trim().ToString3());
  2541. }
  2542. if (dtPlanM1 == null || dtPlanM1.Count() == 0)
  2543. {
  2544. foreach (var item in m.GroupBy(p => p.PhyBatchNo))
  2545. {
  2546. item.Take(sampleNum).ToList().ForEach(p => p.Chk = true);
  2547. }
  2548. }
  2549. else
  2550. {
  2551. int maxBacthNum = int.Parse(this.ultraGrid4.Rows[0].Cells["NUM"].Text);//分批上限
  2552. int maxBacth = dtPlanM.Max(p => p.BatchNo == null ? 1 : (int)(p.BatchNo));//取主表最大方案
  2553. for (int i = 0; i < m.GroupBy(p => p.PhyBatchNo).Count(); i++)
  2554. {
  2555. var list = dtPlanM1.Where(p => p.BatchNo == (i + 1 > maxBacth ? maxBacth : i + 1)).ToList();
  2556. var listA = list.Where(p => p.Position == "401201").ToList();
  2557. var listB = list.Where(p => p.Position == "401202").ToList();
  2558. var listC = list.Where(p => p.Position == "401217").ToList();
  2559. var listD = list.Where(p => p.Position == "401218").ToList();
  2560. int s = 0;
  2561. for (int k = 0; k < listA.Count; k++)
  2562. {
  2563. var crft = list[k];
  2564. int a = (int)crft.SampleCount;//样管数量
  2565. for (int j = 0; j < a; j++, s++)
  2566. {
  2567. if (lists.Count > s + i * maxBacthNum)
  2568. {
  2569. lists[s + i * maxBacthNum].SamplePipeLenA = crft.SampleLength.ToString();
  2570. lists[s + i * maxBacthNum].PhyCodeGroup = crft.PhyCodeGroup.ToString();
  2571. lists[s + i * maxBacthNum].Chk = true;
  2572. }
  2573. }
  2574. }
  2575. s = 0;
  2576. for (int k = 0; k < listB.Count; k++)
  2577. {
  2578. var crft = list[k];
  2579. int a = (int)crft.SampleCount;//样管数量
  2580. for (int j = 0; j < a; j++, s++)
  2581. {
  2582. if (lists.Count > s + i * maxBacthNum)
  2583. {
  2584. lists[s + i * maxBacthNum].SamplePipeLenB = crft.SampleLength.ToString();
  2585. lists[s + i * maxBacthNum].PhyCodeGroupb = crft.PhyCodeGroup.ToString();
  2586. lists[s + i * maxBacthNum].Chk = true;
  2587. }
  2588. }
  2589. }
  2590. s = 0;
  2591. for (int k = 0; k < listC.Count; k++)
  2592. {
  2593. var crft = list[k];
  2594. int a = (int)crft.SampleCount;//样管数量
  2595. for (int j = 0; j < a; j++, s++)
  2596. {
  2597. if (lists.Count > s + i * maxBacthNum)
  2598. {
  2599. lists[s + i * maxBacthNum].SamplePipeLenC = crft.SampleLength.ToString();
  2600. lists[s + i * maxBacthNum].PhyCodeGroupc = crft.PhyCodeGroup.ToString();
  2601. lists[s + i * maxBacthNum].Chk = true;
  2602. }
  2603. }
  2604. }
  2605. s = 0;
  2606. for (int k = 0; k < listD.Count; k++)
  2607. {
  2608. var crft = list[k];
  2609. int a = (int)crft.SampleCount;//样管数量
  2610. for (int j = 0; j < a; j++, s++)
  2611. {
  2612. if (lists.Count > s + i * maxBacthNum)
  2613. {
  2614. lists[s + i * maxBacthNum].SamplePipeLenD = crft.SampleLength.ToString();
  2615. lists[s + i * maxBacthNum].PhyCodeGroupd = crft.PhyCodeGroup.ToString();
  2616. lists[s + i * maxBacthNum].Chk = true;
  2617. }
  2618. }
  2619. }
  2620. }
  2621. }
  2622. ultraGrid3.Update();
  2623. ultraGrid3.DataBind();
  2624. ultraGrid3_CellChange(null, null);
  2625. }
  2626. private void txtBATCH_MIN_ValueChanged(object sender, EventArgs e)
  2627. {
  2628. if (txtBATCH_MIN.Text == "") return;
  2629. if (dtPlanM == null || dtPlanDetial == null || dtPlanM.Count == 0 || dtPlanDetial.Count == 0)
  2630. {
  2631. return;
  2632. }
  2633. //bool isBacthFlag = dtPlanDetial.Any(p => p.Rate == "408601" || p.Rate == "408608");//判断是否试样组有生产批
  2634. //if (isBacthFlag)
  2635. //{
  2636. //}
  2637. //else
  2638. //{
  2639. int maxBacth = dtPlanM.Max(p => p.BatchNum == null ? 1 : (int)(p.BatchNum));//取主表最大方案
  2640. int batchNum = int.Parse(txtBATCH_MIN.Text.ToString3());//实际批数
  2641. dtPlanM1 = dtPlanM.Where(p => p.BatchNum == (batchNum > maxBacth ? maxBacth : batchNum)).ToList();//取具体方案
  2642. //}
  2643. }
  2644. private void ultraTabControl2_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  2645. {
  2646. if (ultraTabControl2.SelectedTab.Key == "0")
  2647. {
  2648. btnConfirm.Visible = false;
  2649. btnAuto.Visible = false;
  2650. buttonBatchNo.Visible = false;
  2651. buttonGetSample.Visible = false;
  2652. buttonSd.Visible = true;
  2653. pipeceButtonStd.Visible = true;
  2654. txt_BatchMax.ReadOnly = true;
  2655. ultraLabel3.Visible = true;
  2656. txtBatchCount.Visible = true;
  2657. this.ultraSTART_PIPE_NO.ReadOnly = true;
  2658. }
  2659. else if (ultraTabControl2.SelectedTab.Key == "1")
  2660. {
  2661. btnConfirm.Visible = true;
  2662. btnAuto.Visible = true;
  2663. buttonBatchNo.Visible = true;
  2664. buttonGetSample.Visible = true;
  2665. buttonSd.Visible = false;
  2666. pipeceButtonStd.Visible = false;
  2667. txt_BatchMax.ReadOnly = false;
  2668. ultraLabel3.Visible = false;
  2669. txtBatchCount.Visible = false;
  2670. this.ultraSTART_PIPE_NO.ReadOnly = true;
  2671. }
  2672. else if (ultraTabControl2.SelectedTab.Key == "2")
  2673. {
  2674. btnConfirm.Visible = false;
  2675. btnAuto.Visible = false;
  2676. buttonBatchNo.Visible = false;
  2677. buttonGetSample.Visible = false;
  2678. pipeceButtonStd.Visible = false;
  2679. buttonSd.Visible = false;
  2680. ultraLabel3.Visible = false;
  2681. txtBatchCount.Visible = false;
  2682. txt_BatchMax.ReadOnly = true;
  2683. this.ultraSTART_PIPE_NO.ReadOnly = false;
  2684. }
  2685. }
  2686. private void txtBatchCount_ValueChanged(object sender, EventArgs e)
  2687. {
  2688. List<PortHttBatchSampleResultEntity> lists = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  2689. if (!StringUtil.IsInt32(txtBatchCount.Text.ToString3()))
  2690. {
  2691. MessageUtil.ShowTips("分批数量请输入整数!");
  2692. return;
  2693. }
  2694. if ((int.Parse(ultraSTART_PIPE_NO.Text.ToString3()) + Math.Abs(int.Parse(txtBatchCount.Text.ToString3())) - 1) > lists.Max(p => int.Parse(p.Seq)))
  2695. {
  2696. ultraEND_PIPE_NO.Text = lists.Max(p =>int.Parse(p.Seq)).ToString();
  2697. }
  2698. else
  2699. {
  2700. ultraEND_PIPE_NO.Text = (int.Parse(ultraSTART_PIPE_NO.Text.ToString3()) + Math.Abs(int.Parse(txtBatchCount.Text.ToString3())) - 1).ToString();
  2701. }
  2702. }
  2703. private void ultraGrid3_InitializeRow(object sender, InitializeRowEventArgs e)
  2704. {
  2705. PortHttBatchSampleResultEntity portHttBatchSampleResultEntity = e.Row.ListObject as PortHttBatchSampleResultEntity;
  2706. if (portHttBatchSampleResultEntity.PhyBatchNo == "") return;
  2707. if (portHttBatchSampleResultEntity.IsSamplePipe == "1")
  2708. {
  2709. ultraGrid3.Rows[e.Row.Index].RowSelectorAppearance.BackColor = Color.Red;
  2710. }
  2711. if (e.Row.Index == 0)
  2712. {
  2713. e.Row.Appearance.BackColor = color1;
  2714. }
  2715. else
  2716. {
  2717. PortHttBatchSampleResultEntity lastList = ultraGrid3.Rows[e.Row.Index - 1].ListObject as PortHttBatchSampleResultEntity;
  2718. if (portHttBatchSampleResultEntity.PhyBatchNo == lastList.PhyBatchNo)
  2719. {
  2720. e.Row.Appearance.BackColor = ultraGrid3.Rows[e.Row.Index - 1].Appearance.BackColor;
  2721. }
  2722. else
  2723. {
  2724. e.Row.Appearance.BackColor = ultraGrid3.Rows[e.Row.Index - 1].Appearance.BackColor == color1 ? color2 : color1;
  2725. }
  2726. }
  2727. }
  2728. private void txtLen_ValueChanged(object sender, EventArgs e)
  2729. {
  2730. if (!StringUtil.IsInt(this.txtLen.Text)) return;
  2731. List<PortHttBatchSampleResultEntity> list1 = null;
  2732. //if (ultraTabControl3.SelectedTab.Key == "0")
  2733. //{
  2734. list1 = portHttBatchSampleResultEntityBindingSource.DataSource as List<PortHttBatchSampleResultEntity>;
  2735. if (list1.Any())
  2736. {
  2737. if (this.cmbPostion.Value.ToString().Equals("401201"))//A端
  2738. {
  2739. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p =>p.SamplePipeLenA = txtLen.Text);
  2740. }
  2741. else if (this.cmbPostion.Value.ToString().Equals("401202"))
  2742. {
  2743. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenB = txtLen.Text);
  2744. }
  2745. else if (this.cmbPostion.Value.ToString().Equals("401217"))
  2746. {
  2747. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenC = txtLen.Text);
  2748. }
  2749. else if (this.cmbPostion.Value.ToString().Equals("401218"))
  2750. {
  2751. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenD = txtLen.Text);
  2752. }
  2753. else if (this.cmbPostion.Value.ToString().Equals("401219"))
  2754. {
  2755. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenM = txtLen.Text);
  2756. }
  2757. else if (this.cmbPostion.Value.ToString().Equals("401220"))
  2758. {
  2759. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenE = txtLen.Text);
  2760. }
  2761. else if (this.cmbPostion.Value.ToString().Equals("401221"))
  2762. {
  2763. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenF = txtLen.Text);
  2764. }
  2765. else if (this.cmbPostion.Value.ToString().Equals("401222"))
  2766. {
  2767. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenP = txtLen.Text);
  2768. }
  2769. else if (this.cmbPostion.Value.ToString().Equals("401223"))
  2770. {
  2771. list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenQ = txtLen.Text);
  2772. }
  2773. }
  2774. ultraGrid3_CellChange(null, null);
  2775. ultraGrid3.Refresh();
  2776. //}
  2777. //else if (ultraTabControl3.SelectedTab.Key == "1")
  2778. //{
  2779. // list1 = portHttBatchSampleResultEntityBindingSource2.DataSource as List<PortHttBatchSampleResultEntity>;
  2780. //}
  2781. }
  2782. private void ultraGrid15_AfterRowActivate(object sender, EventArgs e)
  2783. {
  2784. this.ultraGrid15.UpdateData();
  2785. UltraGridRow uRow = this.ultraGrid15.ActiveRow;
  2786. if (uRow == null) return;
  2787. List<PipeCheckconsignNoqualifiedEntity> listSource = EntityHelper.GetData<PipeCheckconsignNoqualifiedEntity>(
  2788. "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeateInformation", new object[] { uRow.Cells["CheckNo"].Text, uRow.Cells["JudgeStoveNo"].Text }, this.ob);
  2789. pipeCheckconsignNoqualifiedEntityBindingSource2.DataSource = listSource;
  2790. List<PortHttBatchSampleResultEntity> listSource1 = EntityHelper.GetData<PortHttBatchSampleResultEntity>(
  2791. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryRepeatRack", new object[] { uRow.Cells["JudgeStoveNo"].Text }, this.ob);
  2792. portHttBatchSampleResultEntityBindingSource2.DataSource = listSource1;
  2793. foreach (UltraGridRow row in this.ultraGrid17.Rows)
  2794. {
  2795. if (row.Cells["IsSamplePipe"].Text == "1")
  2796. {
  2797. row.RowSelectorAppearance.BackColor = Color.Red;
  2798. }
  2799. }
  2800. }
  2801. private void ultraGrid19_AfterRowActivate(object sender, EventArgs e)
  2802. {
  2803. UltraGridRow uRow = this.ultraGrid19.ActiveRow;
  2804. if (uRow == null) return;
  2805. List<PipeCheckconsignNoqualifiedEntity> listSource = EntityHelper.GetData<PipeCheckconsignNoqualifiedEntity>(
  2806. "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeateInformation", new object[] { uRow.Cells["CheckNo"].Text, uRow.Cells["JudgeStoveNo"].Text }, this.ob);
  2807. pipeCheckconsignNoqualifiedEntityBindingSource4.DataSource = listSource;
  2808. doQueryResampleRck(uRow);
  2809. doQueryChemPhy(uRow);
  2810. doQueryResampleNo(uRow);//复取样委托信息
  2811. }
  2812. private void doQueryResampleNo(UltraGridRow uRow)
  2813. {
  2814. while (dataTable6.Columns.Count > 3)
  2815. {
  2816. dataTable6.Columns.RemoveAt(3);
  2817. }
  2818. DataTable dtSample = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryReDetialSampleNo",
  2819. new Object[] { uRow.Cells["CheckNo"].Text, "2", "F" }, ob);
  2820. dataTable6.Rows.Clear();
  2821. dtSample.AsEnumerable().GroupBy(p => new { BatchNo = p["BATCH_NO"].ToString(), Sample = p["HEAD_MAT_NO"].ToString() }).ToList()
  2822. .ForEach(p =>
  2823. {
  2824. foreach (DataRow row in p)
  2825. {
  2826. if (!dataTable6.Columns.Contains(row["PHY_CODE_MAX"].ToString()))
  2827. {
  2828. DataColumn phyCloum = new DataColumn();
  2829. phyCloum.ColumnName = row["PHY_CODE_MAX"].ToString();
  2830. phyCloum.Caption = row["PHY_NAME_MAX"].ToString();
  2831. dataTable6.Columns.Add(phyCloum);
  2832. }
  2833. }
  2834. DataRow dr = dataTable6.NewRow();
  2835. dr["PHY_BATCH_NO"] = p.Key.BatchNo;
  2836. dr["HEAD_MAT_NO"] = p.Key.Sample;
  2837. dr["SAMPLE_LEN"] = p.Max(q => q["SAMPLE_LEN"]);
  2838. foreach (DataRow row in p)
  2839. {
  2840. dr[row["PHY_CODE_MAX"].ToString()] = row["SAMPLE_COUNT"].ToString();
  2841. }
  2842. dataTable6.Rows.Add(dr);
  2843. });
  2844. ultraGrid21.DataBind();
  2845. GridHelper.RefreshAndAutoSize(ultraGrid21);
  2846. }
  2847. private void doQueryChemPhy(UltraGridRow uRow)
  2848. {
  2849. while (dataTable5.Columns.Count > 5)
  2850. {
  2851. dataTable5.Columns.RemoveAt(5);
  2852. }
  2853. 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);//查询复取样试样组
  2854. List<string> list = new List<string>();
  2855. if (dtPhy.Rows.Count > 0)
  2856. {
  2857. dtPhy.AsEnumerable().Select(p => new { Code = p["PHY_CODE_MAX"].ToString(), Name = p["PHY_NAME_MAX"].ToString() }).Distinct().ToList()
  2858. .ForEach(p =>
  2859. {
  2860. DataColumn phyCloum = new DataColumn();
  2861. phyCloum.ColumnName = p.Code;
  2862. phyCloum.Caption = p.Name;
  2863. dataTable5.Columns.Add(phyCloum);
  2864. });
  2865. }
  2866. ultraGrid20.DataBind();
  2867. GridHelper.RefreshAndAutoSize(ultraGrid20);
  2868. }
  2869. private void doQueryResampleRck(UltraGridRow uRow)
  2870. {
  2871. DataTable dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryResampleInfo",
  2872. new Object[] { uRow.Cells["JudgeStoveNo"].Text, "F" + uRow.Cells["CheckNo"].Text }, ob);
  2873. dataTable5.Rows.Clear();
  2874. foreach (DataRow row in dtBatchNo.Rows)
  2875. {
  2876. if (row["RESAMPLE_PIPE_LEN_A"] != null && row["RESAMPLE_PIPE_LEN_A"].ToString() != "")
  2877. {
  2878. DataRow newRowA = dataTable5.NewRow();
  2879. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  2880. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  2881. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_A"].ToString();
  2882. newRowA["SAMPLE_POSTION"] = "A端";
  2883. newRowA["PHY_CODE_GROUP"] = "";
  2884. dataTable5.Rows.Add(newRowA);
  2885. }
  2886. if (row["RESAMPLE_PIPE_LEN_B"] != null && row["RESAMPLE_PIPE_LEN_B"].ToString() != "")
  2887. {
  2888. DataRow newRowA = dataTable5.NewRow();
  2889. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  2890. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  2891. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_B"].ToString();
  2892. newRowA["SAMPLE_POSTION"] = "B端";
  2893. newRowA["PHY_CODE_GROUP"] = "";
  2894. dataTable5.Rows.Add(newRowA);
  2895. }
  2896. if (row["RESAMPLE_PIPE_LEN_C"] != null && row["RESAMPLE_PIPE_LEN_C"].ToString() != "")
  2897. {
  2898. DataRow newRowA = dataTable5.NewRow();
  2899. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  2900. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  2901. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_C"].ToString();
  2902. newRowA["SAMPLE_POSTION"] = "C端";
  2903. newRowA["PHY_CODE_GROUP"] = "";
  2904. dataTable5.Rows.Add(newRowA);
  2905. }
  2906. if (row["RESAMPLE_PIPE_LEN_D"] != null && row["RESAMPLE_PIPE_LEN_D"].ToString() != "")
  2907. {
  2908. DataRow newRowA = dataTable5.NewRow();
  2909. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  2910. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  2911. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_D"].ToString();
  2912. newRowA["SAMPLE_POSTION"] = "D端";
  2913. newRowA["PHY_CODE_GROUP"] = "";
  2914. dataTable5.Rows.Add(newRowA);
  2915. }
  2916. if (row["RESAMPLE_PIPE_LEN_E"] != null && row["RESAMPLE_PIPE_LEN_E"].ToString() != "")
  2917. {
  2918. DataRow newRowA = dataTable5.NewRow();
  2919. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  2920. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  2921. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_E"].ToString();
  2922. newRowA["SAMPLE_POSTION"] = "E端";
  2923. newRowA["PHY_CODE_GROUP"] = "";
  2924. dataTable5.Rows.Add(newRowA);
  2925. }
  2926. if (row["RESAMPLE_PIPE_LEN_F"] != null && row["RESAMPLE_PIPE_LEN_F"].ToString() != "")
  2927. {
  2928. DataRow newRowA = dataTable5.NewRow();
  2929. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  2930. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  2931. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_F"].ToString();
  2932. newRowA["SAMPLE_POSTION"] = "F端";
  2933. newRowA["PHY_CODE_GROUP"] = "";
  2934. dataTable5.Rows.Add(newRowA);
  2935. }
  2936. if (row["RESAMPLE_PIPE_LEN_P"] != null && row["RESAMPLE_PIPE_LEN_P"].ToString() != "")
  2937. {
  2938. DataRow newRowA = dataTable5.NewRow();
  2939. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  2940. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  2941. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_P"].ToString();
  2942. newRowA["SAMPLE_POSTION"] = "P端";
  2943. newRowA["PHY_CODE_GROUP"] = "";
  2944. dataTable5.Rows.Add(newRowA);
  2945. }
  2946. if (row["RESAMPLE_PIPE_LEN_Q"] != null && row["RESAMPLE_PIPE_LEN_Q"].ToString() != "")
  2947. {
  2948. DataRow newRowA = dataTable5.NewRow();
  2949. newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString();
  2950. newRowA["MAT_NO"] = row["MAT_NO"].ToString();
  2951. newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_Q"].ToString();
  2952. newRowA["SAMPLE_POSTION"] = "Q端";
  2953. newRowA["PHY_CODE_GROUP"] = "";
  2954. dataTable5.Rows.Add(newRowA);
  2955. }
  2956. }
  2957. GridHelper.RefreshAndAutoSize(ultraGrid20);
  2958. }
  2959. private void ultraGrid17_CellChange(object sender, CellEventArgs e)
  2960. {
  2961. this.ultraGrid17.UpdateData();
  2962. ultraGrid17.Update();
  2963. if (e.Cell.Column.Key == "Chk")
  2964. {
  2965. if (e.Cell.Value.ToString() == "True")
  2966. {
  2967. e.Cell.Row.RowSelectorAppearance.BackColor = Color.Red;
  2968. txtMatNo1.Text = e.Cell.Row.Cells["MatNo"].Text;
  2969. }
  2970. else
  2971. {
  2972. e.Cell.Row.RowSelectorAppearance.BackColor = Color.Empty;
  2973. }
  2974. }
  2975. }
  2976. private void txtLen1_ValueChanged(object sender, EventArgs e)
  2977. {
  2978. if (!StringUtil.IsInt(this.txtLen1.Text)) return;
  2979. List<PortHttBatchSampleResultEntity> list1 = null;
  2980. list1 = portHttBatchSampleResultEntityBindingSource2.DataSource as List<PortHttBatchSampleResultEntity>;
  2981. if (list1.Any())
  2982. {
  2983. if (this.cmbPostion1.Value.ToString().Equals("401201"))//A端
  2984. {
  2985. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenA = txtLen1.Text);
  2986. }
  2987. else if (this.cmbPostion1.Value.ToString().Equals("401202"))
  2988. {
  2989. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenB = txtLen1.Text);
  2990. }
  2991. else if (this.cmbPostion1.Value.ToString().Equals("401217"))
  2992. {
  2993. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenC = txtLen1.Text);
  2994. }
  2995. else if (this.cmbPostion1.Value.ToString().Equals("401218"))
  2996. {
  2997. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenD = txtLen1.Text);
  2998. }
  2999. else if (this.cmbPostion1.Value.ToString().Equals("401219"))
  3000. {
  3001. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenM = txtLen1.Text);
  3002. }
  3003. else if (this.cmbPostion1.Value.ToString().Equals("401220"))
  3004. {
  3005. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenE = txtLen1.Text);
  3006. }
  3007. else if (this.cmbPostion1.Value.ToString().Equals("401221"))
  3008. {
  3009. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenF = txtLen1.Text);
  3010. }
  3011. else if (this.cmbPostion1.Value.ToString().Equals("401222"))
  3012. {
  3013. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenP = txtLen1.Text);
  3014. }
  3015. else if (this.cmbPostion1.Value.ToString().Equals("401223"))
  3016. {
  3017. list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenQ = txtLen1.Text);
  3018. }
  3019. }
  3020. GridHelper.RefreshAndAutoSize(ultraGrid17);
  3021. }
  3022. private void ultraGrid21_ClickCell(object sender, ClickCellEventArgs e)
  3023. {
  3024. 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")
  3025. {
  3026. if (e.Cell.Text.Trim() == "")
  3027. {
  3028. e.Cell.Value = "√";
  3029. }
  3030. else
  3031. {
  3032. e.Cell.Value = "";
  3033. }
  3034. }
  3035. }
  3036. private void ultraGrid18_ClickCell(object sender, ClickCellEventArgs e)
  3037. {
  3038. 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")
  3039. {
  3040. if (e.Cell.Text.Trim() == "")
  3041. {
  3042. e.Cell.Value = "√";
  3043. }
  3044. else
  3045. {
  3046. e.Cell.Value = "";
  3047. }
  3048. }
  3049. }
  3050. private void ultraGrid8_AfterRowActivate(object sender, EventArgs e)
  3051. {
  3052. this.ultraGrid5.UpdateData();
  3053. this.ultraGrid8.UpdateData();
  3054. UltraGridRow uRow = this.ultraGrid5.ActiveRow;
  3055. UltraGridRow row = this.ultraGrid8.ActiveRow;
  3056. doQueryBatchRack(uRow,row);
  3057. }
  3058. /// <summary>
  3059. /// 按批查管号队列
  3060. /// </summary>
  3061. /// <param name="uRow"></param>
  3062. /// <param name="row"></param>
  3063. private void doQueryBatchRack(UltraGridRow uRow, UltraGridRow row)
  3064. {
  3065. List<PortHttBatchSampleResultEntity> listSource = EntityHelper.GetData<PortHttBatchSampleResultEntity>(
  3066. "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryBatchRack", new object[] { uRow.Cells["HeatPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, row.Cells["PHY_BATCH_NO"].Text }, this.ob);
  3067. portHttBatchSampleResultEntityBindingSource1.DataSource = listSource;
  3068. }
  3069. private void ultraGrid23_ClickCell(object sender, ClickCellEventArgs e)
  3070. {
  3071. 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")
  3072. {
  3073. if (e.Cell.Text.Trim() == "")
  3074. {
  3075. e.Cell.Value = "√";
  3076. }
  3077. else
  3078. {
  3079. e.Cell.Value = "";
  3080. }
  3081. }
  3082. }
  3083. private void btnGetCic_Click(object sender, EventArgs e)
  3084. {
  3085. if (ultraGrid10.ActiveRow.Cells["Cic"].Text.ToString().Trim().Length >0)
  3086. {
  3087. MessageUtil.ShowTips("已有CIC信息,不需要重新获取");
  3088. return;
  3089. }
  3090. if (ultraGrid10.ActiveRow.Cells["HeatPlanNo"].Text.ToString().Length < 1)
  3091. {
  3092. MessageUtil.ShowTips("未委托信息为空!");
  3093. return;
  3094. }
  3095. CoreClientParam ccp = new CoreClientParam();
  3096. ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew";
  3097. ccp.MethodName = "GetCIC";
  3098. ccp.ServerParams = new object[] { ultraGrid10.ActiveRow.Cells["HeatPlanNo"].Text };
  3099. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  3100. if (ccp.ReturnCode != -1)
  3101. {
  3102. if (ccp.ReturnInfo.Equals("获取CIC成功!"))
  3103. {
  3104. doQueryPlan();
  3105. MessageUtil.ShowTips(ccp.ReturnInfo);
  3106. }
  3107. else
  3108. {
  3109. MessageUtil.ShowTips(ccp.ReturnInfo);
  3110. }
  3111. }
  3112. }
  3113. }
  3114. }