FrmRollingRPipeResult.cs 170 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Control;
  11. using com.steering.mes.zgmil.entity;
  12. using Infragistics.Win.UltraWinGrid;
  13. using Core.Mes.Client.Comm.Server;
  14. using Core.Mes.Client.Comm.Tool;
  15. using Core.StlMes.Client.ZGMil.Entity;
  16. using Core.StlMes.Client.ZGMil.NodeResultQuery;
  17. using System.Net;
  18. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  19. using Core.StlMes.Client.ZGMil.Popup;
  20. using Core.StlMes.Client.ZGMil.Common;
  21. using CoreFS.SA06;
  22. namespace Core.StlMes.Client.ZGMil.Result
  23. {
  24. public partial class FrmRollingRPipeResult : FrmBase
  25. {
  26. #region 初始化
  27. private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
  28. int PanelSizeFlag = 0;
  29. RollingInfomation rf = new RollingInfomation();
  30. FeedRowPlan QuertFeedplan = new FeedRowPlan();
  31. MilPlan QueryMainPlan = new MilPlan();
  32. FeedRowPlan Feedplan = new FeedRowPlan();
  33. MilPlan MainPlan = new MilPlan();
  34. FeedSawResultEntity FeedSawResult = new FeedSawResultEntity();
  35. MilRollingRackEntity RackRs = new MilRollingRackEntity();
  36. MilRollingResultEntity ResultRs = new MilRollingResultEntity();
  37. MilRollingHistoryEntity HistoryRs = new MilRollingHistoryEntity();
  38. MilSlabScrapSeqEntity ScrapSeq = new MilSlabScrapSeqEntity();
  39. string PlanStatusQuery = "39";
  40. string PlanStartStatusQuery = "00"; //查询结炉实绩起始状态
  41. MilRollingResultEntity temprollingresult = new MilRollingResultEntity();
  42. private string ActiveJUDGE_STOVE_NO = null;//主计划活动行的判定炉号
  43. private string ActiveStatus = null;//主计划活动行的状态
  44. private string ActiveResultNo = null;//主计划实绩编号
  45. private string ActiveLotNo = null;//主计划批号
  46. private string _UpdateFlag = "0"; //调度日志确认标识
  47. //private string PlineCode = null;//产线代码
  48. string Shift = "";
  49. string Group = "";
  50. private string Departm = "";//部门
  51. private string PlineCode = "";//产线
  52. private string lotNo = null;//生产批号
  53. private int _MouseLocX = 0; //鼠标横坐标
  54. private int _MouseLocY = 0; //鼠标纵坐标
  55. private string ChangeUserID = ""; //接班用户名
  56. private string ChangePassWord = ""; //接班密码
  57. private int ShowMessageFlag = 0; //保存弹窗标识 0 弹出 1 不弹出
  58. private string _UserName = "";
  59. private string _UserID = "";
  60. private string _Url = "";
  61. private int ChangeFlag = 0;
  62. string proPlanId = "";
  63. string gxPlanNo = "";
  64. public Infragistics.Win.UltraWinGrid.UltraGrid Grid
  65. {
  66. get { return _grid; }
  67. }
  68. public FrmRollingRPipeResult()
  69. {
  70. InitializeComponent();
  71. PanelSizeFlag = 0;
  72. this.rollResult1.UltraGrid2.ClickCellButton += new CellEventHandler(UltraGrid2_ClickCellButton);
  73. this.rollResult_Arssel1.UltraGrid2.ClickCellButton += new CellEventHandler(UltraGrid2_ClickCellButton);
  74. //获取鼠标坐标
  75. Point formPoint = this.PointToClient(Control.MousePosition);
  76. _MouseLocX = Convert.ToInt32(formPoint.X);
  77. _MouseLocY = Convert.ToInt32(formPoint.Y);
  78. }
  79. /// <summary>
  80. /// 定时器事件
  81. /// </summary>
  82. /// <param name="sender"></param>
  83. /// <param name="e"></param>
  84. void timer1_Tick(object sender, EventArgs e)
  85. {
  86. int MouseLocX = 0;
  87. int MouseLocY = 0;
  88. //获取当前鼠标坐标
  89. //获取鼠标坐标
  90. Point formPoint = this.PointToClient(Control.MousePosition);
  91. MouseLocX = Convert.ToInt32(formPoint.X);
  92. MouseLocY = Convert.ToInt32(formPoint.Y);
  93. if (MouseLocX == _MouseLocX && MouseLocY == _MouseLocY)
  94. {
  95. ShowMessageFlag = 1;
  96. PlanQuery();
  97. ShowMessageFlag = 0;
  98. }
  99. else
  100. {
  101. _MouseLocX = MouseLocX;
  102. _MouseLocY = MouseLocY;
  103. }
  104. }
  105. /// <summary>
  106. /// 交班取消
  107. /// </summary>
  108. /// <param name="sender"></param>
  109. /// <param name="e"></param>
  110. void UltraGrid2_ClickCellButton(object sender, CellEventArgs e)
  111. {
  112. string JudgeStoveNo = "";
  113. string Status = "";
  114. string ResultNo = "";
  115. UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
  116. if (ugr != null)
  117. {
  118. if (e.Cell.Column.Key == "CHANGENUMCANCEL")
  119. {
  120. JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  121. Status = ugr.Cells["IS_START"].Value.ToString();
  122. ResultNo = ugr.Cells["ID"].Value.ToString();
  123. if (Status == "已完成连轧")
  124. {
  125. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成连轧操作,不允许交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  126. return;
  127. }
  128. if (Status == "未开始连轧")
  129. {
  130. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始连轧操作,不允许交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  131. return;
  132. }
  133. NativeMethodNew nass = new NativeMethodNew(this.ob);
  134. nass.ChangeShiftBack(JudgeStoveNo, ResultNo, proPlanId, gxPlanNo, PlineCode, Shift, Group, 3);
  135. //ChangeShiftBackRolling(JudgeStoveNo, ResultNo, PlineCode, Shift, Group);
  136. RackQuery(JudgeStoveNo);
  137. this.rollResult_Arssel1.UpdateData();
  138. this.rollResult1.UpdateData();
  139. PlanQuery();
  140. }
  141. }
  142. }
  143. /// <summary>
  144. /// 连轧回退
  145. /// </summary>
  146. /// <param name="JudgeStoveNo"></param>
  147. /// <param name="ResultNo"></param>
  148. /// <param name="PLineCode"></param>
  149. /// <param name="Shift"></param>
  150. /// <param name="Group"></param>
  151. /// <param name="Flag">加热炉/再加热炉最后一支入炉标识 0-未入炉 1-入炉 最后一支入炉时,交班取消不能取消入炉交班</param>
  152. /// <param name="process">0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-开始探伤 9-开始质检</param>
  153. /// <returns></returns>
  154. public int ChangeShiftBackRolling(string JudgeStoveNo, string ResultNo, string PLineCode, string Shift, string Group)
  155. {
  156. int count = 0;
  157. int process = 3;
  158. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.findRollingRack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group}, this.ob);
  159. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.BeforeChangBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0", proPlanId, gxPlanNo }, this.ob);
  160. if (dt.Rows.Count > 0 )
  161. {
  162. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.ChangBackelse", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group}, this.ob);
  163. }
  164. if (dt1.Rows.Count > 0)
  165. {
  166. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.ChangBackelse", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group }, this.ob);
  167. }
  168. return count;
  169. }
  170. /// <summary>
  171. /// 交班取消
  172. /// </summary>
  173. private void ChangeCancel()
  174. {
  175. string JudgeStoveNo = "";
  176. string Status = "";
  177. string ResultNo = "";
  178. UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
  179. if (ugr != null)
  180. {
  181. JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  182. Status = ugr.Cells["IS_START"].Value.ToString();
  183. ResultNo = ugr.Cells["ID"].Value.ToString();
  184. if (Status == "已完成连轧")
  185. {
  186. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成连轧操作,不允许交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  187. return;
  188. }
  189. if (Status == "未开始连轧")
  190. {
  191. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始连轧操作,不允许交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  192. return;
  193. }
  194. foreach (UltraGridRow ug in ultraGrid1.Rows)
  195. {
  196. if (ug.Cells["CHANGE_FLAG"].Text == "待接班确认")
  197. {
  198. //NativeMethodNew nass = new NativeMethodNew(this.ob);
  199. //nass.ChangeShiftBack(JudgeStoveNo, ResultNo, PlineCode, Shift, Group, 3);
  200. ChangeShiftBackRolling(JudgeStoveNo, ResultNo, PlineCode, "", "");
  201. }
  202. }
  203. DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.doQueryRackGroup", new object[] { JudgeStoveNo, ResultNo }, ob);
  204. if (ds.Rows.Count > 0)
  205. {
  206. if (ds.Rows[0]["COL_SHIFT"].ToString() == UserInfo.GetUserOrder() && ds.Rows[0]["COL_GROUP"].ToString() == UserInfo.GetUserGroup())
  207. {
  208. //NativeMethodNew nass = new NativeMethodNew(this.ob);
  209. //nass.ChangeShiftBack(JudgeStoveNo, ResultNo, PlineCode, Shift, Group, 3);
  210. ChangeShiftBackRolling(JudgeStoveNo, ResultNo, PlineCode, Shift, Group);
  211. //更新连轧调度日志
  212. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  213. string Time = SeverTime.ToLongTimeString();
  214. string StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  215. string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  216. string Date = "";
  217. if (Shift == "3")
  218. {
  219. Time = Time.Replace(":", "");
  220. Date = SeverTime.AddDays(+1).ToString("yyyyMMdd");
  221. }
  222. else
  223. {
  224. Date = SeverTime.ToString("yyyyMMdd");
  225. }
  226. string ShiftA = this.UserInfo.GetUserOrder();//HOTMethod.GetShiftAfter(Shift, Group, Date).Substring(0, 1);
  227. string GroupA = this.UserInfo.GetUserGroup();//HOTMethod.GetShiftAfter(Shift, Group, Date).Substring(1, 1);
  228. if (_UpdateFlag == "0")
  229. {
  230. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeGroupCancelUpdateContralLog", new object[] { Shift, Group, ShiftA, GroupA, ActiveJUDGE_STOVE_NO, ActiveLotNo }, this.ob);
  231. }
  232. }
  233. }
  234. RackQuery(JudgeStoveNo);
  235. this.rollResult_Arssel1.UpdateData();
  236. this.rollResult1.UpdateData();
  237. PlanQuery();
  238. }
  239. }
  240. protected override void OnLoad(EventArgs e)
  241. {
  242. Shift = UserInfo.GetUserOrder();
  243. Group = UserInfo.GetUserGroup();
  244. base.OnLoad(e);
  245. //屏蔽Grid筛选条件
  246. chk.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  247. rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  248. rollResult1.UltraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  249. rollResult_Arssel1.UltraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  250. ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  251. ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  252. foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
  253. {
  254. ugc.SortIndicator = SortIndicator.Disabled;
  255. }
  256. timer1.Tick += new EventHandler(timer1_Tick);
  257. //ChangeGridColor();
  258. InitControl();
  259. ShowShift();
  260. }
  261. private void ShowShift()
  262. {
  263. colShowShiftGroup1.Ob = this.ob;
  264. colShowShiftGroup1.Group = this.UserInfo.GetUserGroup();
  265. colShowShiftGroup1.Shift = this.UserInfo.GetUserOrder();
  266. colShowShiftGroup1.ShowShift();
  267. colShowShiftGroup1.Timer1.Enabled = true;
  268. }
  269. /// <summary>
  270. /// 页面开启事件
  271. /// </summary>
  272. /// <param name="e"></param>
  273. protected override void OnShown(EventArgs e)
  274. {
  275. base.OnShown(e);
  276. string hostname = Dns.GetHostName();
  277. IPAddress ip = Dns.GetHostByName(hostname).AddressList[0];
  278. NativeMethodNew na = new NativeMethodNew(this.ob);
  279. Departm = UserInfo.GetDepartment();
  280. PlineCode = na.GetPCode(Departm);//获取 用户 对应的产线
  281. if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017") || PlineCode.Equals("C072"))
  282. {
  283. this.rollingCard1.ChangCard();
  284. }
  285. ultraTabControl1.Tabs[1].Visible = false;
  286. //if (PlineCode == "C009")
  287. switch (PlineCode)
  288. {
  289. case "C008":
  290. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["EMSPEED"].Header.Appearance.ForeColor = Color.Gray;
  291. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["VXSSPEED"].Header.Appearance.ForeColor = Color.Gray;
  292. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["EMSPEED"].CellActivation = Activation.NoEdit;
  293. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["VXSSPEED"].CellActivation = Activation.NoEdit;
  294. break;
  295. case "C009":
  296. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["EMSPEED"].Header.Appearance.ForeColor = Color.Gray;
  297. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["Roller7"].Header.Appearance.ForeColor = Color.Gray;
  298. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["VXSSPEED"].Header.Appearance.ForeColor = Color.Gray;
  299. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["RollingForce"].CellActivation = Activation.NoEdit;
  300. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["EMSPEED"].CellActivation = Activation.NoEdit;
  301. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["VXSSPEED"].CellActivation = Activation.NoEdit;
  302. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["ROLLINGFORCE7"].CellActivation = Activation.NoEdit;
  303. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["ROLLSPEED7"].CellActivation = Activation.NoEdit;
  304. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["ROLLSPACE7"].CellActivation = Activation.NoEdit;
  305. break;
  306. case "C012":
  307. ultraTabControl1.Tabs[0].Visible = false;
  308. ultraTabControl1.Tabs[0].Visible = true;
  309. break;
  310. case "C072":
  311. rollResult1.UltraGrid2.DisplayLayout.Bands[0].Columns["startRollTemp"].Header.Caption = "入口温度(℃)";
  312. break;
  313. }
  314. Sign();
  315. frmTechnological1.InitMilSet(PlineCode, "40070", this.ob);
  316. PlanQuery();
  317. }
  318. /// <summary>
  319. /// 签名
  320. /// </summary>
  321. private void Sign()
  322. {
  323. ColUserName col = new ColUserName();
  324. col.StationId = "3";
  325. col.PlineCode = PlineCode;
  326. col.ColGroup = Group;
  327. col.Ob = this.ob;
  328. col.ShowDialog();
  329. _UserID = col.getUserId();
  330. _UserName = col.getUserName();
  331. }
  332. /// <summary>
  333. /// 初始化控件
  334. /// </summary>
  335. public void InitControl()
  336. {
  337. //if (chkDate.Checked)
  338. //{
  339. // dtStartDate.Enabled = true;
  340. // dtEndDate.Enabled = true;
  341. //}
  342. //else
  343. //{
  344. // dtStartDate.Enabled = false;
  345. // dtEndDate.Enabled = false;
  346. //}
  347. if (chkLotNo.Checked)
  348. {
  349. txtLOT_NO.Enabled = true;
  350. }
  351. else
  352. {
  353. txtLOT_NO.Enabled = false;
  354. }
  355. if (chkHeatNo.Checked)
  356. {
  357. txtJudgeStoveNo.Enabled = true;
  358. }
  359. else
  360. {
  361. txtJudgeStoveNo.Enabled = false;
  362. }
  363. }
  364. #endregion
  365. #region 按钮操作
  366. /// <summary>
  367. /// ToolBar按钮
  368. /// </summary>
  369. /// <param name="sender"></param>
  370. /// <param name="ToolbarKey"></param>
  371. public override void ToolBar_Click(object sender, string ToolbarKey)
  372. {
  373. switch (ToolbarKey)
  374. {
  375. case "Query":
  376. PlanQuery();
  377. break;
  378. case "Save":
  379. FeedRowSave();
  380. break;
  381. case "Node":
  382. FeedSawResultNode();
  383. break;
  384. case "NodeQuery":
  385. NodeQuery();
  386. break;
  387. case "DoNodeBack":
  388. NodeBack();
  389. break;
  390. case "DoStart":
  391. DoStart();
  392. break;
  393. case "DoQueryBefore":
  394. QueryBefore();
  395. break;
  396. case "DoStartBack":
  397. StartBack();
  398. break;
  399. case "DoToolChange":
  400. DoToolChange();
  401. break;
  402. case "DoSign":
  403. Sign();
  404. break;
  405. case "DoPrint":
  406. PrintResult();
  407. break;
  408. case "DoChangeCancel":
  409. ChangeCancel();
  410. break;
  411. case "Close":
  412. this.Dispose();
  413. this.Close();
  414. break;
  415. }
  416. }
  417. /// <summary>
  418. /// 修改IS_START名称
  419. /// </summary>
  420. public void ChangeCellName()
  421. {
  422. if (ultraGridPlan.Rows.Count > 0)
  423. {
  424. NativeMethodNew na = new NativeMethodNew(this.ob);
  425. foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  426. {
  427. //String Judge_Stove_No = ugr.Cells["JUDGE_DTOVE_NO"].Value.ToString();
  428. //if (na.isBegineNode(Judge_Stove_No, 0))
  429. //{
  430. // ugr.Appearance.BackColor = Color.YellowGreen;
  431. //}
  432. if (ugr.Cells["IS_START"].Value.ToString() != "未开始连轧" && ugr.Cells["IS_START"].Value.ToString() != "已开始连轧" && ugr.Cells["IS_START"].Value.ToString() != "已完成连轧")
  433. {
  434. switch (Convert.ToInt32(ugr.Cells["IS_START"].Value))
  435. {
  436. case 3:
  437. ugr.Cells["IS_START"].Value = "未开始连轧";
  438. break;
  439. case 0:
  440. ugr.Cells["IS_START"].Value = "已开始连轧";
  441. break;
  442. case 1:
  443. ugr.Cells["IS_START"].Value = "已完成连轧";
  444. break;
  445. }
  446. }
  447. }
  448. }
  449. }
  450. /// <summary>
  451. /// 判断是否能开始当前炉次
  452. /// </summary>
  453. /// <returns></returns>
  454. private bool IsStart()
  455. {
  456. bool Start = true;
  457. foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  458. {
  459. if (ugr.Cells["IS_START"].Value.ToString() == "已开始连轧")
  460. {
  461. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString()) + "】正在连轧,不能两炉同时开始连轧", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  462. Start = false;
  463. }
  464. }
  465. return Start;
  466. }
  467. /// <summary>
  468. /// 查询主计划
  469. /// </summary>
  470. private void PlanQuery()
  471. {
  472. string PrimaKey = "";
  473. string SencodKey = "";
  474. UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
  475. if (ugr != null)
  476. {
  477. PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  478. if (ugr.HasParent())
  479. {
  480. SencodKey = ugr.Cells["FEED_ROW_NO"].Value.ToString();
  481. }
  482. }
  483. //if (dtStartDate.DateTime > dtEndDate.DateTime)
  484. //{
  485. // MessageBox.Show("开始时间不能大于结束时间。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  486. //}
  487. //if (chkDate.Checked == true)
  488. //{
  489. // QueryMainPlan.StartTime = this.dtStartDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
  490. // QueryMainPlan.EndTime = this.dtEndDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
  491. //}
  492. //else
  493. //{
  494. // QueryMainPlan.StartTime = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
  495. // QueryMainPlan.EndTime = DateTime.Now.AddDays(+1).ToString("yyyy-MM-dd HH:mm:ss");
  496. //}
  497. if (chkHeatNo.Checked)
  498. {
  499. if (this.txtJudgeStoveNo.Text == "")
  500. {
  501. MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  502. return;
  503. }
  504. else
  505. {
  506. QueryMainPlan.JudgeStoveNo = this.txtJudgeStoveNo.Text;
  507. }
  508. }
  509. else
  510. {
  511. QueryMainPlan.JudgeStoveNo = "";
  512. }
  513. if (chkLotNo.Checked)
  514. {
  515. if (this.txtLOT_NO.Text == "")
  516. {
  517. MessageBox.Show("请输入生产批号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  518. return;
  519. }
  520. else
  521. {
  522. QueryMainPlan.LotNo = this.txtLOT_NO.Text;
  523. }
  524. }
  525. else
  526. {
  527. QueryMainPlan.LotNo = "";
  528. }
  529. dtPlan.Clear();
  530. tbRollDate.Clear();
  531. QueryMainPlan.PlineCode = PlineCode;
  532. QueryMainPlan.Status = PlanStatusQuery;
  533. QueryMainPlan.StartStatus = PlanStartStatusQuery;
  534. QueryMainPlan.ProPlanId = proPlanId;
  535. QueryMainPlan.GxPlanNo = gxPlanNo;
  536. //查询主表记录
  537. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 4 }, this.ob);
  538. if (dt.Rows.Count == 0)
  539. {
  540. if (ShowMessageFlag == 0)
  541. {
  542. MessageBox.Show("未查询到匹配的数据,请重新查询!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  543. }
  544. return;
  545. }
  546. else
  547. {
  548. GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
  549. //ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
  550. ChangeCellName();
  551. ChangeGridColor();
  552. if (ugr != null)
  553. {
  554. foreach (UltraGridRow ugr1 in ultraGridPlan.Rows)
  555. {
  556. if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
  557. {
  558. ugr1.Activated = true;
  559. }
  560. }
  561. }
  562. }
  563. }
  564. /// <summary>
  565. /// 单击主计划
  566. /// </summary>
  567. /// <param name="sender"></param>
  568. /// <param name="e"></param>
  569. private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e)
  570. {
  571. tbRollDate.Clear();
  572. if (dtPlan.Rows.Count > 0)
  573. {
  574. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  575. if (ugr != null)
  576. {
  577. string HeatNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
  578. ActiveJUDGE_STOVE_NO = HeatNo;
  579. string Status = ugr.Cells["IS_START"].Value.ToString();
  580. ActiveStatus = Status;
  581. ActiveResultNo = ugr.Cells["ID"].Value.ToString();
  582. ActiveLotNo = ugr.Cells["LOT_NO"].Value.ToString();
  583. MainPlan.JudgeStoveNo = HeatNo;
  584. PlineCode = ugr.Cells["Pline_Code"].Value.ToString();
  585. proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
  586. gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
  587. lotNo = ugr.Cells["LOT_NO"].Value.ToString();
  588. //查询该炉 该班次调度日志是否确认
  589. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getControlStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveLotNo, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  590. if (dt1.Rows.Count > 0)
  591. {
  592. _UpdateFlag = dt1.Rows[0][0].ToString();
  593. }
  594. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
  595. if (dtMP.Rows.Count > 0)
  596. {
  597. if (dtMP.Rows[0]["PLINE_CODE"].ToString() == "C012")
  598. {
  599. ultraTabControl1.Tabs[0].Visible = false;
  600. ultraTabControl1.Tabs[1].Visible = true;
  601. }
  602. else
  603. {
  604. ultraTabControl1.Tabs[0].Visible = true;
  605. ultraTabControl1.Tabs[1].Visible = false;
  606. }
  607. GridEdit(dtMP); //轧制计划信息
  608. PlineCode = dtMP.Rows[0]["PLINE_CODE"].ToString();
  609. resultQuery(HeatNo, PlineCode);//实绩查询
  610. }
  611. if (Status != "未开始连轧")
  612. {
  613. RackQuery(HeatNo);//查询跟踪记录信息
  614. }
  615. else
  616. {
  617. //tbRollDate.Rows.Clear();
  618. }
  619. GetRollingCard();
  620. }
  621. }
  622. }
  623. /// <summary>
  624. /// 双击开始连轧
  625. /// </summary>
  626. /// <param name="sender"></param>
  627. /// <param name="e"></param>
  628. private void DoStart()
  629. {
  630. ResultRs.Clear();
  631. DataTable dt = new DataTable();
  632. //if (this.UserInfo.GetUserOrder() == "0")
  633. //{
  634. // MessageBox.Show("常白班不能操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  635. // return;
  636. //}
  637. if (ultraGridPlan.Rows.Count > 0)
  638. {
  639. //if (!IsStart())
  640. //{
  641. // return;
  642. //}
  643. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  644. string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();//判定炉号
  645. ActiveJUDGE_STOVE_NO = HeatNo;
  646. string Status = ugr.Cells["IS_START"].Value.ToString();
  647. string ResultNo = ugr.Cells["ID"].Value.ToString();
  648. NativeMethodNew Nvw = new NativeMethodNew(this.ob);
  649. //if (!Nvw.isBegineNode(HeatNo, 2))
  650. //{
  651. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】未穿孔,不能连轧。");
  652. // return;
  653. //}
  654. ActiveStatus = Status;
  655. if (Status == "已完成连轧")
  656. {
  657. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成连轧,不允许重新开始!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  658. return;
  659. }
  660. PlineCode = ugr.Cells["Pline_Code"].Value.ToString();
  661. if (ugr != null)
  662. {
  663. if (Status == "已开始连轧")
  664. {
  665. MessageBox.Show("连轧脱管正在进行,无法再次开始连轧!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  666. return;
  667. }
  668. MainPlan.JudgeStoveNo = HeatNo;
  669. MainPlan.ProPlanId = proPlanId;
  670. MainPlan.GxPlanNo = gxPlanNo;
  671. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
  672. GridEdit(dtMP); //轧制计划信息
  673. if (temprollingresult != null)
  674. {
  675. //1
  676. ResultRs.VrsSpeed = temprollingresult.VrsSpeed;
  677. ResultRs.InsertLength = temprollingresult.InsertLength;
  678. ResultRs.Tubesize = temprollingresult.Tubesize;
  679. ResultRs.Emspeed = temprollingresult.Emspeed;
  680. ResultRs.LimitSpeed = temprollingresult.LimitSpeed;
  681. ResultRs.Ext1RackSpeed = temprollingresult.Ext1RackSpeed;
  682. ResultRs.RackSpace1 = temprollingresult.RackSpace1;
  683. ResultRs.RackSpace2 = temprollingresult.RackSpace2;
  684. ResultRs.RackSpace3 = temprollingresult.RackSpace3;
  685. ResultRs.RackSpace4 = temprollingresult.RackSpace4;
  686. ResultRs.RackSpace5 = temprollingresult.RackSpace5;
  687. ResultRs.RackSpace6 = temprollingresult.RackSpace6;
  688. ResultRs.RackSpace7 = temprollingresult.RackSpace7;
  689. ResultRs.RackSpeed1 = temprollingresult.RackSpeed1;
  690. ResultRs.RackSpeed2 = temprollingresult.RackSpeed2;
  691. ResultRs.RackSpeed3 = temprollingresult.RackSpeed3;
  692. ResultRs.RackSpeed4 = temprollingresult.RackSpeed4;
  693. ResultRs.RackSpeed5 = temprollingresult.RackSpeed5;
  694. ResultRs.RackSpeed6 = temprollingresult.RackSpeed6;
  695. ResultRs.RackSpeed7 = temprollingresult.RackSpeed7;
  696. ResultRs.RollingForce1 = temprollingresult.RollingForce1;
  697. ResultRs.RollingForce2 = temprollingresult.RollingForce2;
  698. ResultRs.RollingForce3 = temprollingresult.RollingForce3;
  699. ResultRs.RollingForce4 = temprollingresult.RollingForce4;
  700. ResultRs.RollingForce5 = temprollingresult.RollingForce5;
  701. ResultRs.RollingForce6 = temprollingresult.RollingForce6;
  702. ResultRs.RollingForce7 = temprollingresult.RollingForce7;
  703. ResultRs.StartRollTemp = temprollingresult.StartRollTemp;
  704. //阿塞尔线
  705. ResultRs.Tubesize = temprollingresult.Tubesize;
  706. ResultRs.QoRollerThroatDiameter = temprollingresult.QoRollerThroatDiameter;
  707. ResultRs.QcRollerThroatDiameter = temprollingresult.QcRollerThroatDiameter;
  708. ResultRs.RollingThroatDiameter = temprollingresult.RollingThroatDiameter;
  709. ResultRs.RollerBiteSpeed = temprollingresult.RollerBiteSpeed;//咬入
  710. ResultRs.Rollangle = temprollingresult.Rollangle;//轧辊角
  711. ResultRs.FeedAngle = temprollingresult.FeedAngle;//喂入角
  712. ResultRs.RollingSpeed = temprollingresult.RollingSpeed;//轧制速度
  713. }
  714. string stoveNo = dtMP.Rows[0]["STOVE_NO"].ToString();//熔炼炉号
  715. string lotNo = dtMP.Rows[0]["LOT_NO"].ToString();//生产批号
  716. string factoryId = dtMP.Rows[0]["PLINE_CODE"].ToString();//产线
  717. ResultRs.JudgeStoveNo = HeatNo;
  718. ResultRs.ResultNo = ResultNo;
  719. ResultRs.StoveNo = stoveNo;
  720. ResultRs.LotNo = lotNo;
  721. ResultRs.PlineCode = factoryId;
  722. ResultRs.ColUser = this.UserInfo.GetUserName();
  723. ResultRs.ColShift = this.UserInfo.GetUserOrder();
  724. ResultRs.ColGroup = this.UserInfo.GetUserGroup();
  725. ResultRs.ProPlanId = proPlanId;
  726. ResultRs.GxPlanNo = gxPlanNo;
  727. //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + HeatNo + "】开始连轧?") == DialogResult.No)
  728. //{
  729. // return;
  730. //}
  731. //修改主计划状态、新增连轧实绩
  732. CoreClientParam ccp = new CoreClientParam();
  733. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmRollingRPipeResult";
  734. ccp.MethodName = "insertResultForMainPlan";
  735. ccp.ServerParams = new object[] { ResultRs };
  736. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  737. if (ccp.ReturnInfo == "开始成功!")
  738. {
  739. }
  740. else
  741. {
  742. MessageUtil.ShowTips(ccp.ReturnInfo);
  743. }
  744. //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.insertResultForMainPlan", new object[] { ResultRs }, this.ob);
  745. //新增连轧调度日志
  746. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.insertContralLog", new object[] { HeatNo, lotNo, Shift, Group, _UserID, _UserName, "0", proPlanId, gxPlanNo }, this.ob);
  747. //往跟踪记录表插入连轧开始时间
  748. NativeMethodNew na = new NativeMethodNew(this.ob);
  749. na.InsertSTAferDoubleClick(HeatNo, 3, "0", proPlanId, gxPlanNo);
  750. //resultQuery();
  751. //刷新主表
  752. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 4 }, this.ob);
  753. GridHelper.CopyDataToDatatable(ref dt1, ref dtPlan, true);
  754. //ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
  755. ChangeCellName();
  756. ChangeGridColor();
  757. foreach (UltraGridRow ugr1 in this.ultraGridPlan.Rows)
  758. {
  759. if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == HeatNo)
  760. {
  761. ultraGridPlan.ActiveRow = ugr1;
  762. }
  763. }
  764. }
  765. }
  766. }
  767. /// <summary>
  768. /// 保存
  769. /// </summary>
  770. private void FeedRowSave()
  771. {
  772. ResultRs.Clear();
  773. int count = 0;
  774. string flag = "";
  775. try
  776. {
  777. rollResult1.UltraGrid2.UpdateData();
  778. rollResult_Arssel1.UltraGrid2.UpdateData();
  779. }
  780. catch (Exception e)
  781. {
  782. MessageBox.Show("请输入正确的时间。");
  783. return;
  784. }
  785. UltraGridRow ugrg = this.rollResult1.UltraGrid2.Rows[0];
  786. UltraGridRow uRow = this.rollResult_Arssel1.UltraGrid2.Rows[0];
  787. string factoryId = null;
  788. //string heatNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
  789. if (this.ultraGridPlan.ActiveRow == null && ActiveJUDGE_STOVE_NO == null)
  790. {
  791. MessageBox.Show("未选择任何炉号,请选择炉号后进行保存操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  792. return;
  793. }
  794. if (this.ultraGridPlan.ActiveRow == null)
  795. {
  796. factoryId = PlineCode;
  797. ResultRs.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
  798. }
  799. else
  800. {
  801. ResultRs.JudgeStoveNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
  802. factoryId = this.ultraGridPlan.ActiveRow.Cells["Pline_Code"].Value.ToString();
  803. }
  804. if (ActiveStatus == "未开始连轧")
  805. {
  806. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(ResultRs.JudgeStoveNo.ToString()) + "】未开始进行连轧,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  807. return;
  808. }
  809. //if (ActiveStatus == "已完成连轧")
  810. //{
  811. // MessageBox.Show("炉号:【" + ResultRs.JudgeStoveNo + "】已完成连轧,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  812. // return;
  813. //}
  814. //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + ResultRs.JudgeStoveNo.ToString().Substring(0, 6) + "】保存实绩?") == DialogResult.No)
  815. //{
  816. // return;
  817. //}
  818. if (factoryId != "C012")//其他线
  819. {
  820. //this.rollResult1.UltraGrid2.Update();
  821. this.rollResult1.UltraGrid2.UpdateData();
  822. MilRollingResultEntity rr = new MilRollingResultEntity();
  823. this.rollResult_Arssel1.Value = rr;
  824. flag = "0";
  825. if (string.IsNullOrEmpty(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim()))
  826. {
  827. ResultRs.ScrapNum = 0;
  828. if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()))
  829. {
  830. ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - 0).ToString();
  831. }
  832. else
  833. {
  834. ResultRs.QualifiedNum = 0;
  835. }
  836. }
  837. else
  838. {
  839. ResultRs.ScrapNum = ugrg.Cells["SCRAPNUM"].Value.ToString().Trim();
  840. if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()))
  841. {
  842. ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
  843. }
  844. }
  845. ResultRs.Rollingnum = ugrg.Cells["ROLLINGNUM"].Value.ToString().Trim();
  846. //ResultRs.ScrapNum = ugrg.Cells["SCRAPNUM"].Value.ToString().Trim();
  847. ResultRs.Changeclassnum = ugrg.Cells["CHANGECLASSNUM"].Value.ToString().Trim();
  848. ResultRs.Remark = ugrg.Cells["Remark1"].Value.ToString().Trim();
  849. ResultRs.VrsSpeed = ugrg.Cells["VXSSPEED"].Value.ToString().Trim();
  850. ResultRs.Tubesize = ugrg.Cells["SIZE"].Text.ToString().Trim();
  851. ResultRs.InsertLength = ugrg.Cells["INSERTLENGTH"].Value.ToString().Trim();
  852. ResultRs.Emspeed = ugrg.Cells["EMSPEED"].Value.ToString().Trim();
  853. ResultRs.LimitSpeed = ugrg.Cells["SPEEDLIMIT"].Value.ToString().Trim();
  854. ResultRs.Ext1RackSpeed = ugrg.Cells["EXT1SPEED"].Value.ToString().Trim();
  855. ResultRs.RackSpeed1 = ugrg.Cells["ROLLSPEED1"].Value.ToString().Trim();
  856. ResultRs.RackSpeed2 = ugrg.Cells["ROLLSPEED2"].Value.ToString().Trim();
  857. ResultRs.RackSpeed3 = ugrg.Cells["ROLLSPEED3"].Value.ToString().Trim();
  858. ResultRs.RackSpeed4 = ugrg.Cells["ROLLSPEED4"].Value.ToString().Trim();
  859. ResultRs.RackSpeed5 = ugrg.Cells["ROLLSPEED5"].Value.ToString().Trim();
  860. ResultRs.RackSpeed6 = ugrg.Cells["ROLLSPEED6"].Value.ToString().Trim();
  861. ResultRs.RackSpeed7 = ugrg.Cells["ROLLSPEED7"].Value.ToString().Trim();
  862. ResultRs.RackSpace1 = ugrg.Cells["ROLLSPACE1"].Value.ToString().Trim();
  863. ResultRs.RackSpace2 = ugrg.Cells["ROLLSPACE2"].Value.ToString().Trim();
  864. ResultRs.RackSpace3 = ugrg.Cells["ROLLSPACE3"].Value.ToString().Trim();
  865. ResultRs.RackSpace4 = ugrg.Cells["ROLLSPACE4"].Value.ToString().Trim();
  866. ResultRs.RackSpace5 = ugrg.Cells["ROLLSPACE5"].Value.ToString().Trim();
  867. ResultRs.RackSpace6 = ugrg.Cells["ROLLSPACE6"].Value.ToString().Trim();
  868. ResultRs.RackSpace7 = ugrg.Cells["ROLLSPACE7"].Value.ToString().Trim();
  869. ResultRs.RollingForce1 = ugrg.Cells["ROLLINGFORCE1"].Value.ToString().Trim();
  870. ResultRs.RollingForce2 = ugrg.Cells["ROLLINGFORCE2"].Value.ToString().Trim();
  871. ResultRs.RollingForce3 = ugrg.Cells["ROLLINGFORCE3"].Value.ToString().Trim();
  872. ResultRs.RollingForce4 = ugrg.Cells["ROLLINGFORCE4"].Value.ToString().Trim();
  873. ResultRs.RollingForce5 = ugrg.Cells["ROLLINGFORCE5"].Value.ToString().Trim();
  874. ResultRs.RollingForce6 = ugrg.Cells["ROLLINGFORCE6"].Value.ToString().Trim();
  875. ResultRs.RollingForce7 = ugrg.Cells["ROLLINGFORCE7"].Value.ToString().Trim();
  876. ResultRs.StartTime = ugrg.Cells["StartTime"].Value.ToString().Trim();
  877. ResultRs.EndTime = ugrg.Cells["EndTime"].Value.ToString().Trim();//--
  878. ResultRs.StartRollTemp = ugrg.Cells["startRollTemp"].Value.ToString().Trim();
  879. ResultRs.ColUser = this.UserInfo.GetUserName();
  880. ResultRs.ColShift = this.UserInfo.GetUserOrder();
  881. ResultRs.ColGroup = this.UserInfo.GetUserGroup();
  882. ResultRs.ProPlanId = proPlanId;
  883. ResultRs.GxPlanNo = gxPlanNo;
  884. //ResultRs.JudgeStoveNo = heatNo;
  885. ResultRs.PlineCode = flag;
  886. if (ResultRs.Changeclassnum.ToString() == "")
  887. {
  888. ResultRs.Changeclassnum = "0";
  889. }
  890. //if (int.Parse(ResultRs.Changeclassnum.ToString()) - int.Parse(ResultRs.QualifiedNum.ToString()) > 0)
  891. //{
  892. // MessageBox.Show("交接班支数不允许大于轧制支数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  893. // return;
  894. //}
  895. if (string.IsNullOrEmpty(ResultRs.StartTime.ToString()))
  896. {
  897. MessageBox.Show("开始时间不能为空,请输入正确的开始时间");
  898. return;
  899. }
  900. //查询结炉状态,已结炉的计划 结炉时间不能为空
  901. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, proPlanId, gxPlanNo }, this.ob);
  902. if (int.Parse(dt.Rows[0][0].ToString()) > 39)
  903. {
  904. if (string.IsNullOrEmpty(ResultRs.EndTime.ToString()))
  905. {
  906. MessageBox.Show("结束时间不能为空,请输入正确的结束时间");
  907. return;
  908. }
  909. //开始时间必须小于结束时间
  910. if (DateTime.Parse(ResultRs.StartTime.ToString()) > DateTime.Parse(ResultRs.EndTime.ToString()))
  911. {
  912. MessageBox.Show("结束时间不能小于开始时间。");
  913. return;
  914. }
  915. }
  916. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultSave", new object[] { ResultRs, _UpdateFlag }, this.ob);
  917. this.rollResult_Arssel1.IsCellSelect = false;
  918. this.rollResult1.IsCellSelect = false;
  919. if (count > 0)
  920. {
  921. if (ShowMessageFlag == 0)
  922. {
  923. MessageBox.Show("连轧实绩保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  924. }
  925. }
  926. }
  927. else//阿塞尔线
  928. {
  929. ResultRs.Clear();
  930. this.rollResult_Arssel1.UltraGrid2.Update();
  931. MilRollingResultEntity rr = new MilRollingResultEntity();
  932. this.rollResult1.Value = rr;
  933. flag = "1";
  934. if (string.IsNullOrEmpty(uRow.Cells["SCRAPNUM"].Text.ToString().Trim()))
  935. {
  936. ResultRs.ScrapNum = 0;
  937. if (this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim() == "")
  938. {
  939. ResultRs.QualifiedNum = "0";
  940. }
  941. else
  942. {
  943. ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - 0).ToString();
  944. }
  945. }
  946. else
  947. {
  948. ResultRs.ScrapNum = uRow.Cells["SCRAPNUM"].Text.ToString().Trim();
  949. if (this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim() == "")
  950. {
  951. //MessageBox.Show("轧制支数为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  952. }
  953. else
  954. {
  955. ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(uRow.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
  956. }
  957. }
  958. ResultRs.Rollingnum = ugrg.Cells["ROLLINGNUM"].Value.ToString().Trim();
  959. //ResultRs.ScrapNum = uRow.Cells["SCRAPNUM"].Value.ToString().Trim();
  960. ResultRs.Changeclassnum = uRow.Cells["CHANGECLASSNUM"].Value.ToString().Trim();
  961. ResultRs.Remark = uRow.Cells["REMARK"].Value.ToString().Trim();
  962. ResultRs.Tubesize = uRow.Cells["TUBESIZE"].Text.ToString().Trim();
  963. ResultRs.QoRollerThroatDiameter = uRow.Cells["QUICKOPEN"].Value.ToString().Trim();
  964. ResultRs.QcRollerThroatDiameter = uRow.Cells["QUICKCLOSE"].Value.ToString().Trim();
  965. ResultRs.RollingThroatDiameter = uRow.Cells["ROLLING"].Value.ToString().Trim();
  966. ResultRs.RollerBiteSpeed = uRow.Cells["BITE"].Value.ToString().Trim();
  967. ResultRs.RollingAngle = uRow.Cells["ROLLTAPER"].Text.ToString().Trim();
  968. ResultRs.FeedAngle = uRow.Cells["FEEDANGLE"].Value.ToString().Trim();
  969. ResultRs.RollingSpeed = uRow.Cells["ROLLINGSPEED"].Value.ToString().Trim();
  970. ResultRs.StartTime = uRow.Cells["START_TIME"].Value.ToString().Trim();
  971. ResultRs.EndTime = uRow.Cells["END_TIME"].Value.ToString().Trim();
  972. ResultRs.StartRollTemp = uRow.Cells["startRollTemp"].Value.ToString().Trim();
  973. ResultRs.ColUser = this.UserInfo.GetUserName();
  974. ResultRs.ColShift = this.UserInfo.GetUserOrder();
  975. ResultRs.ColGroup = this.UserInfo.GetUserGroup();
  976. ResultRs.ProPlanId = proPlanId;
  977. ResultRs.GxPlanNo = gxPlanNo;
  978. //ResultRs.JudgeStoveNo = heatNo;
  979. ResultRs.PlineCode = flag;
  980. if (ResultRs.Changeclassnum.ToString() == "")
  981. {
  982. ResultRs.Changeclassnum = "0";
  983. }
  984. //if (int.Parse(ResultRs.Changeclassnum.ToString()) - int.Parse(ResultRs.QualifiedNum.ToString()) > 0)
  985. //{
  986. // MessageBox.Show("交接班支数不允许大于轧制支数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  987. // return;
  988. //}
  989. if (string.IsNullOrEmpty(ResultRs.StartTime.ToString()))
  990. {
  991. MessageBox.Show("开始时间不能为空,请输入正确的开始时间");
  992. return;
  993. }
  994. //查询结炉状态,已结炉的计划 结炉时间不能为空
  995. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, proPlanId, gxPlanNo }, this.ob);
  996. if (int.Parse(dt.Rows[0][0].ToString()) > 39)
  997. {
  998. if (string.IsNullOrEmpty(ResultRs.EndTime.ToString()))
  999. {
  1000. MessageBox.Show("结束时间不能为空,请输入正确的结束时间");
  1001. return;
  1002. }
  1003. //开始时间必须小于结束时间
  1004. if (DateTime.Parse(ResultRs.StartTime.ToString()) > DateTime.Parse(ResultRs.EndTime.ToString()))
  1005. {
  1006. MessageBox.Show("结束时间不能小于开始时间。");
  1007. return;
  1008. }
  1009. }
  1010. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultSave", new object[] { ResultRs, _UpdateFlag }, this.ob);
  1011. this.rollResult_Arssel1.IsCellSelect = false;
  1012. this.rollResult1.IsCellSelect = false;
  1013. if (count > 0)
  1014. {
  1015. if (ShowMessageFlag == 0)
  1016. {
  1017. MessageBox.Show("连轧实绩保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  1018. }
  1019. }
  1020. }
  1021. // resultQuery();
  1022. temprollingresult = NativeMethod.GetEntityToEntity(temprollingresult, ResultRs);
  1023. // RackQuery(ActiveJUDGE_STOVE_NO);
  1024. ChangeGridColor();
  1025. PlanQuery();
  1026. }
  1027. /// <summary>
  1028. /// 结炉
  1029. /// </summary>
  1030. private void FeedSawResultNode()
  1031. {
  1032. FeedRowSave();
  1033. //if (this.UserInfo.GetUserOrder() == "0")
  1034. //{
  1035. // MessageBox.Show("常白班不能操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1036. // return;
  1037. //}
  1038. try
  1039. {
  1040. rollResult1.UltraGrid2.UpdateData();
  1041. rollResult_Arssel1.UltraGrid2.UpdateData();
  1042. }
  1043. catch (Exception e)
  1044. {
  1045. MessageBox.Show("请输入正确的时间。");
  1046. return;
  1047. }
  1048. HOTMethod hm = new HOTMethod(this.ob);
  1049. int count = 0;
  1050. string seq = "";
  1051. UltraGridRow ugrg = this.rollResult1.UltraGrid2.Rows[0];
  1052. UltraGridRow uRow = this.rollResult_Arssel1.UltraGrid2.Rows[0];
  1053. //判断是否有重复剔除的坯子
  1054. foreach (UltraGridRow ugr4 in ultraGrid1.Rows)
  1055. {
  1056. if (ugr4.Cells["MAT_NO"].Value.ToString().Equals("") && ugr4.Cells["STATUS"].Value.ToString().Equals("剔除"))
  1057. {
  1058. MessageBox.Show("不存在序号第【" + ugr4.Cells["SEQ"].Value.ToString() + "】的坯子,它已被其它工序剔除,不能再次剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1059. return;
  1060. }
  1061. }
  1062. string factoryId = null;
  1063. string flag = "0";
  1064. if (this.ultraGridPlan.ActiveRow == null)
  1065. {
  1066. MessageBox.Show("未选择任何炉号,不允许结炉", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1067. return;
  1068. }
  1069. string heatNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
  1070. string ResultNo = this.ultraGridPlan.ActiveRow.Cells["ID"].Text.ToString().Trim();
  1071. string LotNo = this.ultraGridPlan.ActiveRow.Cells["LOT_NO"].Text.ToString().Trim();
  1072. string proPlanId = this.ultraGridPlan.ActiveRow.Cells["PRO_PLAN_ID"].Value.ToString();
  1073. string gxPlanNo = this.ultraGridPlan.ActiveRow.Cells["GX_PLAN_NO"].Value.ToString();
  1074. //if (ultraGridPlan.ActiveRow != ultraGridPlan.Rows[0])
  1075. //{ MessageUtil.ShowTips("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】之前有未结的炉号,请按顺序结炉!"); return; }
  1076. ResultRs.Clear();
  1077. ResultRs.JudgeStoveNo = heatNo;
  1078. string Status = ultraGridPlan.ActiveRow.Cells["IS_START"].Value.ToString();
  1079. if (Status == "已完成连轧")
  1080. {
  1081. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(heatNo) + "】已完成连轧,不允许结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1082. return;
  1083. }
  1084. factoryId = this.ultraGridPlan.ActiveRow.Cells["Pline_Code"].Value.ToString();
  1085. if (Status != "已开始连轧")
  1086. {
  1087. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】未开始连轧,不允许结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1088. return;
  1089. }
  1090. if (hm.NodeGetWaitChangeMat(heatNo, ResultNo, 3) > 0)
  1091. {
  1092. MessageBox.Show("管号【" + hm.NodeGetWaitChangeMat(heatNo, ResultNo, 3) + "】未接班确认,不能结炉");
  1093. return;
  1094. }
  1095. if (factoryId != "C012")//其他线
  1096. {
  1097. //this.rollResult1.UltraGrid2.Update();
  1098. this.rollResult1.UltraGrid2.UpdateData();
  1099. MilRollingResultEntity rr = new MilRollingResultEntity();
  1100. this.rollResult_Arssel1.Value = rr;
  1101. flag = "0";
  1102. //剔除支数
  1103. ResultRs.ScrapNum = "0";
  1104. //查询本道工序剔除支数
  1105. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { heatNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1106. if (dtScrapNum.Rows.Count > 0)
  1107. {
  1108. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  1109. {
  1110. ResultRs.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  1111. }
  1112. }
  1113. //if (ugrg.Cells["SCRAPNUM"].Text.ToString().Trim() == "")
  1114. //{
  1115. // ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - 0).ToString();
  1116. //}
  1117. //else
  1118. //{
  1119. // if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString()))
  1120. // {
  1121. // if (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) > int.Parse(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim()))
  1122. // {
  1123. // ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
  1124. // }
  1125. // else
  1126. // {
  1127. // // MessageBox.Show("存在上一道工序已经剔除的管坯在本道工序也剔除了,请回退后再进行结炉操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1128. // // return;
  1129. // }
  1130. // }
  1131. // else
  1132. // {
  1133. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1134. // return;
  1135. // }
  1136. //}
  1137. //合格支数
  1138. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { heatNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1139. if (dtQANum.Rows.Count > 0)
  1140. {
  1141. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  1142. {
  1143. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(ResultRs.ScrapNum.ToString()))
  1144. {
  1145. //合格支数
  1146. ResultRs.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(ResultRs.ScrapNum.ToString());
  1147. ResultRs.QualifiedNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(ResultRs.ScrapNum.ToString());
  1148. }
  1149. else
  1150. {
  1151. ResultRs.Rollingnum = 0;
  1152. ResultRs.QualifiedNum = 0;
  1153. }
  1154. }
  1155. else
  1156. {
  1157. ResultRs.Rollingnum = 0;
  1158. ResultRs.QualifiedNum = 0;
  1159. }
  1160. }
  1161. //ResultRs.Rollingnum = ugrg.Cells["ROLLINGNUM"].Value.ToString().Trim();
  1162. //ResultRs.ScrapNum = ugrg.Cells["SCRAPNUM"].Value.ToString().Trim();
  1163. ResultRs.Changeclassnum = ugrg.Cells["CHANGECLASSNUM"].Value.ToString().Trim();
  1164. ResultRs.Remark = ugrg.Cells["Remark1"].Value.ToString().Trim();
  1165. ResultRs.VrsSpeed = ugrg.Cells["VXSSPEED"].Value.ToString().Trim();
  1166. ResultRs.Tubesize = ugrg.Cells["SIZE"].Text.ToString().Trim();
  1167. ResultRs.InsertLength = ugrg.Cells["INSERTLENGTH"].Value.ToString().Trim();
  1168. ResultRs.Emspeed = ugrg.Cells["EMSPEED"].Value.ToString().Trim();
  1169. ResultRs.LimitSpeed = ugrg.Cells["SPEEDLIMIT"].Value.ToString().Trim();
  1170. ResultRs.Ext1RackSpeed = ugrg.Cells["EXT1SPEED"].Value.ToString().Trim();
  1171. ResultRs.RackSpeed1 = ugrg.Cells["ROLLSPEED1"].Value.ToString().Trim();
  1172. ResultRs.RackSpeed2 = ugrg.Cells["ROLLSPEED2"].Value.ToString().Trim();
  1173. ResultRs.RackSpeed3 = ugrg.Cells["ROLLSPEED3"].Value.ToString().Trim();
  1174. ResultRs.RackSpeed4 = ugrg.Cells["ROLLSPEED4"].Value.ToString().Trim();
  1175. ResultRs.RackSpeed5 = ugrg.Cells["ROLLSPEED5"].Value.ToString().Trim();
  1176. ResultRs.RackSpeed6 = ugrg.Cells["ROLLSPEED6"].Value.ToString().Trim();
  1177. ResultRs.RackSpeed7 = ugrg.Cells["ROLLSPEED7"].Value.ToString().Trim();
  1178. ResultRs.RackSpace1 = ugrg.Cells["ROLLSPACE1"].Value.ToString().Trim();
  1179. ResultRs.RackSpace2 = ugrg.Cells["ROLLSPACE2"].Value.ToString().Trim();
  1180. ResultRs.RackSpace3 = ugrg.Cells["ROLLSPACE3"].Value.ToString().Trim();
  1181. ResultRs.RackSpace4 = ugrg.Cells["ROLLSPACE4"].Value.ToString().Trim();
  1182. ResultRs.RackSpace5 = ugrg.Cells["ROLLSPACE5"].Value.ToString().Trim();
  1183. ResultRs.RackSpace6 = ugrg.Cells["ROLLSPACE6"].Value.ToString().Trim();
  1184. ResultRs.RackSpace7 = ugrg.Cells["ROLLSPACE7"].Value.ToString().Trim();
  1185. ResultRs.RollingForce1 = ugrg.Cells["ROLLINGFORCE1"].Value.ToString().Trim();
  1186. ResultRs.RollingForce2 = ugrg.Cells["ROLLINGFORCE2"].Value.ToString().Trim();
  1187. ResultRs.RollingForce3 = ugrg.Cells["ROLLINGFORCE3"].Value.ToString().Trim();
  1188. ResultRs.RollingForce4 = ugrg.Cells["ROLLINGFORCE4"].Value.ToString().Trim();
  1189. ResultRs.RollingForce5 = ugrg.Cells["ROLLINGFORCE5"].Value.ToString().Trim();
  1190. ResultRs.RollingForce6 = ugrg.Cells["ROLLINGFORCE6"].Value.ToString().Trim();
  1191. ResultRs.RollingForce7 = ugrg.Cells["ROLLINGFORCE7"].Value.ToString().Trim();
  1192. ResultRs.StartTime = ugrg.Cells["StartTime"].Value.ToString().Trim();
  1193. ResultRs.StartRollTemp = ugrg.Cells["startRollTemp"].Value.ToString().Trim();
  1194. ResultRs.ColUser = _UserName;
  1195. ResultRs.UserId = _UserID;
  1196. ResultRs.ProPlanId = proPlanId;
  1197. ResultRs.GxPlanNo = gxPlanNo;
  1198. ResultRs.ColShift = this.UserInfo.GetUserOrder();
  1199. ResultRs.ColGroup = this.UserInfo.GetUserGroup();
  1200. //ResultRs.JudgeStoveNo = heatNo;
  1201. ResultRs.PlineCode = flag;
  1202. if (ResultRs.Changeclassnum.ToString() == "")
  1203. {
  1204. ResultRs.Changeclassnum = "0";
  1205. }
  1206. }
  1207. else//阿塞尔线
  1208. {
  1209. ResultRs.Clear();
  1210. this.rollResult_Arssel1.UltraGrid2.Update();
  1211. MilRollingResultEntity rr = new MilRollingResultEntity();
  1212. this.rollResult1.Value = rr;
  1213. flag = "1";
  1214. //剔除支数
  1215. ResultRs.ScrapNum = "0";
  1216. //查询本道工序剔除支数
  1217. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { heatNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1218. if (dtScrapNum.Rows.Count > 0)
  1219. {
  1220. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  1221. {
  1222. ResultRs.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  1223. }
  1224. }
  1225. //else
  1226. //{
  1227. // if (this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim() == "")
  1228. // {
  1229. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1230. // return;
  1231. // }
  1232. // else
  1233. // {
  1234. // if (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) > int.Parse(uRow.Cells["SCRAPNUM"].Text.ToString().Trim()))
  1235. // {
  1236. // ResultRs.QualifiedNum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(uRow.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
  1237. // }
  1238. // else
  1239. // {
  1240. // MessageBox.Show("存在上一道工序已经剔除的管坯在本道工序也剔除了,请回退后再进行结炉操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1241. // return;
  1242. // }
  1243. // }
  1244. //}
  1245. //ResultRs.Rollingnum = ugrg.Cells["ROLLINGNUM"].Value.ToString().Trim();
  1246. //合格支数
  1247. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { heatNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1248. if (dtQANum.Rows.Count > 0)
  1249. {
  1250. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  1251. {
  1252. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(ResultRs.ScrapNum.ToString()))
  1253. {
  1254. //合格支数
  1255. ResultRs.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(ResultRs.ScrapNum.ToString());
  1256. ResultRs.QualifiedNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(ResultRs.ScrapNum.ToString());
  1257. }
  1258. else
  1259. {
  1260. ResultRs.Rollingnum = 0;
  1261. ResultRs.QualifiedNum = 0;
  1262. }
  1263. }
  1264. else
  1265. {
  1266. ResultRs.Rollingnum = 0;
  1267. ResultRs.QualifiedNum = 0;
  1268. }
  1269. }
  1270. // ResultRs.ScrapNum = uRow.Cells["SCRAPNUM"].Value.ToString().Trim();
  1271. ResultRs.Changeclassnum = uRow.Cells["CHANGECLASSNUM"].Value.ToString().Trim();
  1272. ResultRs.Remark = uRow.Cells["REMARK"].Value.ToString().Trim();
  1273. ResultRs.Tubesize = uRow.Cells["TUBESIZE"].Text.ToString().Trim();
  1274. ResultRs.QoRollerThroatDiameter = uRow.Cells["QUICKOPEN"].Value.ToString().Trim();
  1275. ResultRs.QcRollerThroatDiameter = uRow.Cells["QUICKCLOSE"].Value.ToString().Trim();
  1276. ResultRs.RollingThroatDiameter = uRow.Cells["ROLLING"].Value.ToString().Trim();
  1277. ResultRs.RollerBiteSpeed = uRow.Cells["BITE"].Value.ToString().Trim();
  1278. ResultRs.RollingAngle = uRow.Cells["ROLLTAPER"].Text.ToString().Trim();
  1279. ResultRs.FeedAngle = uRow.Cells["FEEDANGLE"].Value.ToString().Trim();
  1280. ResultRs.RollingSpeed = uRow.Cells["ROLLINGSPEED"].Value.ToString().Trim();
  1281. ResultRs.StartTime = uRow.Cells["START_TIME"].Value.ToString().Trim();
  1282. ResultRs.StartRollTemp = uRow.Cells["startRollTemp"].Value.ToString().Trim();
  1283. ResultRs.ColUser = _UserName;
  1284. ResultRs.UserId = _UserID;
  1285. ResultRs.ProPlanId = proPlanId;
  1286. ResultRs.GxPlanNo = gxPlanNo;
  1287. ResultRs.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
  1288. ResultRs.LotNo = lotNo;
  1289. ResultRs.PlineCode = PlineCode;
  1290. ResultRs.ColShift = this.UserInfo.GetUserOrder();
  1291. ResultRs.ColGroup = this.UserInfo.GetUserGroup();
  1292. //ResultRs.JudgeStoveNo = heatNo;
  1293. ResultRs.PlineCode = flag;
  1294. if (ResultRs.Changeclassnum.ToString() == "")
  1295. {
  1296. ResultRs.Changeclassnum = "0";
  1297. }
  1298. //if (int.Parse(ResultRs.Changeclassnum.ToString()) - int.Parse(ResultRs.QualifiedNum.ToString()) > 0)
  1299. //{
  1300. // MessageBox.Show("交接班支数不允许大于轧制支数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1301. // return;
  1302. //}
  1303. }
  1304. double DBHeight = 0;
  1305. double BurnningRate = 0;
  1306. double DBNum = 1;
  1307. DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getDbHeight", new object[] { heatNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
  1308. if (dtDBH.Rows.Count > 0)
  1309. {
  1310. if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_HEIGHT"].ToString()))
  1311. {
  1312. DBHeight = double.Parse(dtDBH.Rows[0]["DB_HEIGHT"].ToString());
  1313. }
  1314. if (!string.IsNullOrEmpty(dtDBH.Rows[0]["BURNNING_RATE"].ToString()))
  1315. {
  1316. BurnningRate = double.Parse(dtDBH.Rows[0]["BURNNING_RATE"].ToString());
  1317. }
  1318. if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_NUM"].ToString()))
  1319. {
  1320. DBNum = double.Parse(dtDBH.Rows[0]["DB_NUM"].ToString());
  1321. }
  1322. }
  1323. string QANum = "0";
  1324. if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()))
  1325. {
  1326. QANum = (int.Parse(this.rollingCard1.UltraGrid4.ActiveRow.Cells["QualifiedNum4"].Text.ToString().Trim()) - int.Parse(ugrg.Cells["SCRAPNUM"].Text.ToString().Trim())).ToString();
  1327. }
  1328. ResultRs.QaTon = DBHeight * (1 - (BurnningRate / 100)) * double.Parse(QANum.ToString());
  1329. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.perForationResultQuery", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob);
  1330. if (dt.Rows.Count > 0)
  1331. {
  1332. if (dt.Rows[0]["NODE_FUR_FLAG"].ToString() == "1")
  1333. {
  1334. if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】结炉?") == DialogResult.No)
  1335. {
  1336. return;
  1337. }
  1338. if (count == 0)
  1339. {
  1340. //写进程表
  1341. CoreClientParam ccp = new CoreClientParam();
  1342. ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult";
  1343. ccp.MethodName = "updateMilSlab";
  1344. ccp.ServerParams = new object[] { heatNo, "4", proPlanId, gxPlanNo };
  1345. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1346. if (ccp.ReturnCode != -1)
  1347. {
  1348. if (ccp.ReturnInfo.Equals("修改成功!"))
  1349. {
  1350. ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult";
  1351. ccp.MethodName = "updateProcess";
  1352. ccp.ServerParams = new object[] { heatNo, "4", "4", proPlanId, gxPlanNo, lotNo, PlineCode };
  1353. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1354. if (ccp.ReturnCode != -1)
  1355. {
  1356. if (ccp.ReturnInfo.Equals("修改成功!"))
  1357. {
  1358. #region 修改连轧调度日志
  1359. //查询有效最大管序号
  1360. int MaxSeq = 0;
  1361. DataTable dtSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getMaxSeq", new object[] { ActiveJUDGE_STOVE_NO, ResultNo, proPlanId, gxPlanNo }, this.ob);
  1362. if (dtSeq.Rows.Count > 0)
  1363. {
  1364. MaxSeq = int.Parse(dtSeq.Rows[0][0].ToString());
  1365. }
  1366. //查询上个班交班支数
  1367. int BeforeChangeNum = 0;
  1368. DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ResultNo, 3, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1369. if (dtChangeNum.Rows.Count > 0)
  1370. {
  1371. if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString()))
  1372. {
  1373. BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString());
  1374. }
  1375. }
  1376. MilControlLogEntity ControlLogEntity = new MilControlLogEntity();
  1377. //查询本班合格支数
  1378. string[] Temp = GetDbHeightBruningRate(heatNo, ResultNo, BeforeChangeNum+1, MaxSeq).Split('-');
  1379. string QaTon = Temp[0];
  1380. string ScrapTon = Temp[1];
  1381. string ScrapNum1 = Temp[2];
  1382. ControlLogEntity.QualifiedNum = (MaxSeq - BeforeChangeNum - int.Parse(ScrapNum1.ToString3())).ToString3();
  1383. ControlLogEntity.ScrapNum = ScrapNum1.ToString3();
  1384. ControlLogEntity.QualifiedWt = QaTon.ToString3();
  1385. ControlLogEntity.ScrapWt = ScrapTon.ToString3();
  1386. ControlLogEntity.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
  1387. ControlLogEntity.LotNo = ActiveLotNo;
  1388. ControlLogEntity.UserId = _UserID;
  1389. ControlLogEntity.UserName = _UserName;
  1390. ControlLogEntity.ProPlanId = proPlanId;
  1391. ControlLogEntity.GxPlanNo = gxPlanNo;
  1392. ControlLogEntity.ProBc = Shift;
  1393. ControlLogEntity.ProBz = Group;
  1394. ControlLogEntity.NodeFlag = "1";
  1395. if (int.Parse(ControlLogEntity.QualifiedNum) < 1)
  1396. {
  1397. if (MessageUtil.ShowYesNoAndQuestion("合格支数为" +ControlLogEntity.QualifiedNum+"支,是否确认继续结炉?") == DialogResult.No)
  1398. {
  1399. return;
  1400. }
  1401. }
  1402. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  1403. ControlLogEntity.ProcDate = SeverTime.ToString("yyyyMMdd");
  1404. ControlLogEntity.BalYearMonth = SeverTime.ToString("yyyyMM");
  1405. string a = SeverTime.ToShortTimeString();
  1406. string Time = SeverTime.ToLongTimeString();
  1407. Time = Time.Replace(":", "");
  1408. if (int.Parse(Time) > 120000 && int.Parse(Time) < 240000 && Shift == "3")
  1409. {
  1410. ControlLogEntity.ProcDate = SeverTime.AddDays(1).ToString("yyyyMMdd");
  1411. ControlLogEntity.BalYearMonth = SeverTime.AddDays(5).ToString("yyyyMM");
  1412. }
  1413. //if (_UpdateFlag == "0")
  1414. //{
  1415. if (BeforeChangeNum == 0)
  1416. {
  1417. ControlLogEntity.ChangeShiftFlag = "0";
  1418. //int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeShiftGroupUpdateContralLog", new object[] { ControlLogEntity }, this.ob);
  1419. }
  1420. else
  1421. {
  1422. ControlLogEntity.ChangeShiftFlag = "2";
  1423. //int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeShiftGroupUpdateContralLog", new object[] { ControlLogEntity }, this.ob);
  1424. }
  1425. //}
  1426. #endregion
  1427. ResultRs.LotNo = lotNo;
  1428. ResultRs.PlineCode = PlineCode;
  1429. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.endStoveForMainPlan", new object[] { ResultRs, ControlLogEntity }, this.ob);
  1430. //
  1431. NativeMethodNew na = new NativeMethodNew(this.ob);
  1432. // na.InsertSTAferDoubleClick(heatNo, 3, "1", proPlanId, gxPlanNo);
  1433. NativeMethod.CheckNodeMatStatus(heatNo, proPlanId, gxPlanNo, 3, this.ob);
  1434. if (count > 0)
  1435. {
  1436. if (PlineCode.Equals("C008") || PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017") || PlineCode.Equals("C072"))
  1437. {
  1438. //插入MIL_SLAB_SCRAP表
  1439. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { heatNo, 4, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1440. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { heatNo, 5, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1441. }
  1442. else
  1443. {
  1444. //插入MIL_SLAB_SCRAP表
  1445. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { heatNo, 4, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1446. }
  1447. if (count > 0)
  1448. {
  1449. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】结炉完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  1450. this.rollResult_Arssel1.IsCellSelect = false;
  1451. this.rollResult1.IsCellSelect = false;
  1452. temprollingresult = NativeMethod.GetEntityToEntity(temprollingresult, ResultRs);
  1453. //刷新主表
  1454. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 4 }, this.ob);
  1455. GridHelper.CopyDataToDatatable(ref dt1, ref dtPlan, true);
  1456. //ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
  1457. ChangeCellName();
  1458. ChangeGridColor();
  1459. RackQuery(heatNo);
  1460. foreach (UltraGridRow ugr1 in this.ultraGridPlan.Rows)
  1461. {
  1462. ugr1.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString());
  1463. if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == heatNo)
  1464. {
  1465. ultraGridPlan.ActiveRow = ugr1;
  1466. }
  1467. }
  1468. }
  1469. }
  1470. }
  1471. else
  1472. {
  1473. MessageUtil.ShowTips(ccp.ReturnInfo);
  1474. }
  1475. }
  1476. }
  1477. }
  1478. else
  1479. {
  1480. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1481. }
  1482. }
  1483. else
  1484. {
  1485. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1486. }
  1487. }
  1488. }
  1489. }
  1490. /// <summary>
  1491. /// 开始回退
  1492. /// </summary>
  1493. private void StartBack()
  1494. {
  1495. if (ultraGridPlan.Rows.Count > 0)
  1496. {
  1497. if (this.ultraGridPlan.ActiveRow == null)
  1498. {
  1499. MessageBox.Show("请选择需要回退的炉号!!!");
  1500. return;
  1501. }
  1502. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  1503. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1504. string ResultNo = ugr.Cells["ID"].Value.ToString();
  1505. string StartStatus = ugr.Cells["IS_START"].Value.ToString();
  1506. if (StartStatus == "已完成连轧")
  1507. {
  1508. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已结炉,不能开始回退!!!!");
  1509. return;
  1510. }
  1511. if (StartStatus == "未开始连轧")
  1512. {
  1513. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始连轧,不能开始回退!!!!");
  1514. return;
  1515. }
  1516. //NativeMethodNew nvw = new NativeMethodNew(this.ob);
  1517. //if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017"))
  1518. //{
  1519. // if (nvw.isBegineNode(JudgeStoveNo, 5))
  1520. // {
  1521. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已开始定径,不能开始回退!!!!");
  1522. // return;
  1523. // }
  1524. //}
  1525. //else
  1526. //{
  1527. // if (nvw.isBegineNode(JudgeStoveNo, 4))
  1528. // {
  1529. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已入再加热炉,不能开始回退!!!!");
  1530. // return;
  1531. // }
  1532. //}
  1533. if (_UpdateFlag == "0")
  1534. {
  1535. // 0- 开始回退 1-结炉回退
  1536. int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.DeleteControlLog", new object[] { JudgeStoveNo, ActiveLotNo, 0, proPlanId, gxPlanNo }, this.ob);
  1537. }
  1538. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.startBack", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1539. RackQuery(JudgeStoveNo);
  1540. ChangeGridColor();
  1541. PlanQuery();
  1542. }
  1543. }
  1544. /// <summary>
  1545. /// 结炉回退
  1546. /// </summary>
  1547. private void NodeBack()
  1548. {
  1549. if (this.ultraGridPlan.ActiveRow == null)
  1550. {
  1551. MessageBox.Show("请选择需要回退的炉号!!!");
  1552. return;
  1553. }
  1554. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  1555. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1556. string ResultNo = ugr.Cells["ID"].Value.ToString();
  1557. string NodeFlag = ugr.Cells["IS_START"].Value.ToString();
  1558. string LotNo = ugr.Cells["LOT_NO"].Value.ToString();
  1559. if (NodeFlag != "已完成连轧")
  1560. {
  1561. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未结炉,不能结炉回退!!!!");
  1562. return;
  1563. }
  1564. string SHIFTf = this.UserInfo.GetUserOrder();
  1565. string GROUPf = this.UserInfo.GetUserGroup();
  1566. DataTable dtFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getControlStatus", new object[] { JudgeStoveNo, LotNo, SHIFTf, GROUPf, proPlanId, gxPlanNo }, this.ob);
  1567. _UpdateFlag = "0";
  1568. if (dtFlag.Rows.Count > 0)
  1569. {
  1570. _UpdateFlag = dtFlag.Rows[0][0].ToString();
  1571. }
  1572. if (_UpdateFlag == "1")
  1573. {
  1574. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】在调度室已确认,不能结炉回退!!!!");
  1575. return;
  1576. }
  1577. //查询结炉班次班组
  1578. DataTable dtNodeGroup = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, 3, proPlanId, gxPlanNo }, this.ob);
  1579. if (dtNodeGroup.Rows.Count > 0)
  1580. {
  1581. string NodeShift = dtNodeGroup.Rows[0][0].ToString();
  1582. string NodeGroup = dtNodeGroup.Rows[0][1].ToString();
  1583. if (Shift == NodeShift && Group == NodeGroup)
  1584. {
  1585. }
  1586. else
  1587. {
  1588. switch (NodeShift)
  1589. {
  1590. case "0":
  1591. NodeShift = "白班";
  1592. break;
  1593. case "1":
  1594. NodeShift = "早班";
  1595. break;
  1596. case "2":
  1597. NodeShift = "中班";
  1598. break;
  1599. case "3":
  1600. NodeShift = "夜班";
  1601. break;
  1602. }
  1603. switch (NodeGroup)
  1604. {
  1605. case "1":
  1606. NodeGroup = "甲班";
  1607. break;
  1608. case "2":
  1609. NodeGroup = "乙班";
  1610. break;
  1611. case "3":
  1612. NodeGroup = "丙班";
  1613. break;
  1614. case "4":
  1615. NodeGroup = "丁班";
  1616. break;
  1617. }
  1618. switch (this.UserInfo.GetUserOrder())
  1619. {
  1620. case "0":
  1621. Shift = "白班";
  1622. break;
  1623. case "1":
  1624. Shift = "早班";
  1625. break;
  1626. case "2":
  1627. Shift = "中班";
  1628. break;
  1629. case "3":
  1630. Shift = "夜班";
  1631. break;
  1632. }
  1633. switch (this.UserInfo.GetUserGroup())
  1634. {
  1635. case "1":
  1636. Group = "甲班";
  1637. break;
  1638. case "2":
  1639. Group = "乙班";
  1640. break;
  1641. case "3":
  1642. Group = "丙班";
  1643. break;
  1644. case "4":
  1645. Group = "丁班";
  1646. break;
  1647. }
  1648. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已由" + NodeGroup + "," + NodeShift + "结炉,当班不能结炉回退");
  1649. return;
  1650. }
  1651. }
  1652. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
  1653. if (dt.Rows.Count > 0)
  1654. {
  1655. string NodeProcess = ""; //当前炉次结炉工序
  1656. string NodeStatus = dt.Rows[0][0].ToString();
  1657. switch (NodeStatus)
  1658. {
  1659. case "30":
  1660. NodeProcess = "穿孔";
  1661. break;
  1662. case "40":
  1663. NodeProcess = "连轧";
  1664. break;
  1665. case "50":
  1666. NodeProcess = "再加热炉";
  1667. break;
  1668. case "60":
  1669. NodeProcess = "定径";
  1670. break;
  1671. case "70":
  1672. NodeProcess = "分切";
  1673. break;
  1674. case "80":
  1675. NodeProcess = "矫直";
  1676. break;
  1677. case "90":
  1678. NodeProcess = "探伤";
  1679. break;
  1680. case "96":
  1681. NodeProcess = "质检";
  1682. break;
  1683. }
  1684. if (NodeStatus != "40")
  1685. {
  1686. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 " + NodeProcess + "工序已结炉,当前工序不能结炉回退");
  1687. return;
  1688. }
  1689. }
  1690. //判断当前炉次下道工序是否结炉 下道工序结炉 - 不允许回退
  1691. //查询当前炉次是否有交班点
  1692. int Seq = 0;
  1693. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.changeFlagQuery", new object[] { JudgeStoveNo, ResultNo, 3, proPlanId, gxPlanNo }, this.ob);
  1694. if (dt1.Rows.Count > 0)
  1695. {
  1696. Seq = int.Parse(dt1.Rows[dt1.Rows.Count - 1][0].ToString());
  1697. }
  1698. if (_UpdateFlag == "0")
  1699. {
  1700. // 0- 开始回退 1-结炉回退
  1701. int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.DeleteControlLog", new object[] { JudgeStoveNo, ActiveLotNo, 1, proPlanId, gxPlanNo }, this.ob);
  1702. }
  1703. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, Seq, 0, 4, proPlanId, gxPlanNo, lotNo }, this.ob);
  1704. RackQuery(JudgeStoveNo);
  1705. ChangeGridColor();
  1706. PlanQuery();
  1707. }
  1708. /// <summary>
  1709. /// 毛管剔除
  1710. /// </summary>
  1711. /// <param name="sender"></param>
  1712. /// <param name="e"></param>
  1713. private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
  1714. {
  1715. //if (this.UserInfo.GetUserOrder() == "0")
  1716. //{
  1717. // MessageBox.Show("常白班不能操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1718. // return;
  1719. //}
  1720. RackRs.Clear();
  1721. UltraGridRow ugr_pian = ultraGridPlan.ActiveRow;
  1722. string HeatNo = ugr_pian.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1723. UltraGridRow ugr_testingrack = ultraGrid1.ActiveRow;
  1724. HOTMethod hm = new HOTMethod(this.ob);
  1725. DataTable dt = new DataTable();
  1726. int scrapNum = 0;
  1727. int count = 0;
  1728. string ResultNo = ugr_pian.Cells["ID"].Value.ToString();
  1729. string heatNo = this.ultraGrid1.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
  1730. string seq = this.ultraGrid1.ActiveRow.Cells["SEQ"].Text.ToString().Trim();
  1731. string PlanStatuss = ultraGridPlan.ActiveRow.Cells["IS_START"].Value.ToString();
  1732. string MAT_NO = ugr_testingrack.Cells["MAT_NO"].Value.ToString();
  1733. CoreClientParam ccp = new CoreClientParam();
  1734. ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult";
  1735. ccp.MethodName = "scrapMatCheck";
  1736. ccp.ServerParams = new Object[] { ugr_pian.Cells["JUDGE_STOVE_NO"].Value.ToString(), 4, proPlanId, gxPlanNo };
  1737. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1738. int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);
  1739. string shif = ugr_testingrack.Cells["COL_SHIFT"].Value.ToString();
  1740. string group = ugr_testingrack.Cells["COL_GROUP"].Value.ToString();
  1741. //string shifSeq = ""; //待交班的班次
  1742. //string groupSeq = ""; //待交班的班组
  1743. //NativeMethodNew nasssss = new NativeMethodNew(this.ob);
  1744. //if (nasssss.IsRackOperateRolling(shif, group))
  1745. //{
  1746. // MessageBox.Show("序号:【" + seq + "】子管已由" + shif + "," + group + "操作,不允许再进行操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1747. // return;
  1748. //}
  1749. if (PlanStatuss == "已完成连轧")
  1750. {
  1751. if (e.Cell.Column.Key == "CHANGE_NUM")
  1752. {
  1753. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成连轧,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1754. }
  1755. else if (e.Cell.Column.Key == "BTNCHANGECOM")
  1756. {
  1757. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成连轧,不允许接班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1758. }
  1759. else
  1760. {
  1761. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成连轧,不能剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1762. }
  1763. return;
  1764. }
  1765. if (e.Cell.Column.Key == "DELETE")
  1766. {
  1767. if (ultraGrid1.ActiveRow.Cells["STATUS"].Value.ToString() == "剔除")
  1768. {
  1769. MessageBox.Show("该毛管已被剔除不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1770. return;
  1771. }
  1772. int i = 0;
  1773. foreach (UltraGridRow uRow in ultraGrid1.Rows)
  1774. {
  1775. if (uRow.Cells["STATUS"].Value.ToString().Equals("正常轧制") && int.Parse(uRow.Cells["SEQ"].Value.ToString3()) > 2)
  1776. {
  1777. i = i + 1;
  1778. }
  1779. }
  1780. //if (int.Parse(seq) < 3 && i > 0)
  1781. //{
  1782. // MessageUtil.ShowYesNoAndQuestion("该管坯可能是样管,请先从正常管开始剔除。");
  1783. // return;
  1784. // }
  1785. //管排锯切前判断当前管坯序号是否已剔除
  1786. //DataTable dtSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapSeq", new object[] { heatNo, seq }, this.ob);
  1787. //if (dtSeq.Rows.Count > 0)
  1788. //{
  1789. // MessageBox.Show("不存在序号为【" + seq + "】的管号,已在【" + dtSeq.Rows[0][0].ToString() + "】剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1790. // return;
  1791. //}
  1792. if (ultraGridPlan.ActiveRow.Cells["IS_START"].Value.ToString() != "已开始连轧")
  1793. {
  1794. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString()) + "】的毛管未开始连轧,请检查确认后再剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1795. return;
  1796. }
  1797. //查询前几道工序累计剔除多少半成品管(管坯等进行换算)
  1798. if (ultraGrid1.Rows.Count - ScrapNumBefore < int.Parse(ugr_testingrack.Cells["SEQ"].Value.ToString()))
  1799. {
  1800. MessageBox.Show("不存在序号为【" + ugr_testingrack.Cells["SEQ"].Value.ToString() + "】的管号,被其他工序剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1801. return;
  1802. }
  1803. //if (ugr_testingrack.Cells["MAT_NO"].Text == "")
  1804. //{
  1805. // MessageBox.Show("不存在序号为【" + ugr_testingrack.Cells["SEQ"].Value.ToString() + "】的管号,被其他工序剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1806. // return;
  1807. //}
  1808. DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.selectPortBacthSlample", new object[] { MAT_NO }, ob);
  1809. if (ds.Rows.Count > 0)
  1810. {
  1811. if (MessageUtil.ShowYesNoAndQuestion("此管坯已有被取为样管,是否继续剔除?") == DialogResult.No)
  1812. {
  1813. return;
  1814. }
  1815. }
  1816. // 有班次交班了,其它班次不能操作。
  1817. foreach (UltraGridRow ugd in ultraGrid1.Rows)
  1818. {
  1819. if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
  1820. {
  1821. string shifSeq = ugd.Cells["COL_SHIFT"].Value.ToString();
  1822. string groupSeq = ugd.Cells["COL_GROUP"].Value.ToString();
  1823. NativeMethodNew nasssss = new NativeMethodNew(this.ob);
  1824. if (nasssss.IsRackOperateRolling(shifSeq, groupSeq))
  1825. {
  1826. MessageBox.Show("管号对列已由" + shifSeq + "," + groupSeq + "操作,请先接班确认", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1827. return;
  1828. }
  1829. }
  1830. }
  1831. ResultRs.JudgeStoveNo = heatNo;
  1832. dt.Clear();
  1833. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.scrapNumQuery", new object[] { ResultRs }, this.ob);
  1834. if (dt.Rows.Count > 0)
  1835. {
  1836. if (dt.Rows[0]["SCRAP_NUM"].ToString() == "")
  1837. {
  1838. scrapNum = 0;
  1839. }
  1840. else
  1841. {
  1842. scrapNum = int.Parse(dt.Rows[0]["SCRAP_NUM"].ToString());
  1843. }
  1844. }
  1845. //if (MessageUtil.ShowYesNoAndQuestion("是否剔除该毛管") == DialogResult.No)
  1846. //{
  1847. // return;
  1848. //}
  1849. RackRs.ScrapNum = (scrapNum + 1).ToString();
  1850. RackRs.ColUser = UserInfo.GetUserName();
  1851. RackRs.ColGroup = UserInfo.GetUserGroup();
  1852. RackRs.ColShift = UserInfo.GetUserOrder();
  1853. RackRs.Status = "1";
  1854. RackRs.JudgeStoveNo = heatNo;
  1855. RackRs.Seq = seq;
  1856. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.rackDelete", new object[] { RackRs }, this.ob);
  1857. if (count > 0)
  1858. {
  1859. //新增管列序号表
  1860. ScrapSeq.Seq = seq;
  1861. ScrapSeq.JudgeStoveNo = heatNo;
  1862. ScrapSeq.ColUser = this.UserInfo.GetUserName();
  1863. ScrapSeq.ColShift = this.UserInfo.GetUserOrder();
  1864. ScrapSeq.ColGroup = this.UserInfo.GetUserGroup();
  1865. ScrapSeq.ProPlanId = proPlanId;
  1866. ScrapSeq.GxPlanNo = gxPlanNo;
  1867. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.insertScrapSlabSeq", new object[] { ScrapSeq }, this.ob);
  1868. }
  1869. }
  1870. if (e.Cell.Column.Key == "DELBACK")
  1871. {
  1872. //if (MessageUtil.ShowYesNoAndQuestion("是否回退该剔除的坯料") == DialogResult.No)
  1873. //{
  1874. // return;
  1875. //}
  1876. if (!ultraGrid1.ActiveRow.Cells["STATUS"].Value.ToString().Equals("剔除"))
  1877. {
  1878. MessageBox.Show("该坯料未被剔除,请确认后重新选择!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1879. return;
  1880. }
  1881. // 有班次交班了,其它班次不能操作。
  1882. foreach (UltraGridRow ugd in ultraGrid1.Rows)
  1883. {
  1884. if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
  1885. {
  1886. string shifSeq = ugd.Cells["COL_SHIFT"].Value.ToString();
  1887. string groupSeq = ugd.Cells["COL_GROUP"].Value.ToString();
  1888. NativeMethodNew nasssss = new NativeMethodNew(this.ob);
  1889. if (nasssss.IsRackOperateRolling(shifSeq, groupSeq))
  1890. {
  1891. MessageBox.Show("管号对列已由" + shifSeq + "," + groupSeq + "操作,请先接班确认", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1892. return;
  1893. }
  1894. }
  1895. }
  1896. NativeMethodNew na = new NativeMethodNew(this.ob);
  1897. int counts = na.DeleteSlabSeq(HeatNo, seq.ToString(), 4, 1, 0, proPlanId, gxPlanNo);
  1898. if (counts > 0)
  1899. {
  1900. // MessageBox.Show("剔料回退成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1901. RackQuery(HeatNo);
  1902. foreach (UltraGridRow ugr_1 in ultraGrid1.Rows)
  1903. {
  1904. if (ugr_1.Cells["SEQ"].Value.ToString() == seq)
  1905. {
  1906. ultraGrid1.ActiveRow = ugr_1;
  1907. }
  1908. }
  1909. }
  1910. else
  1911. {
  1912. MessageBox.Show("剔料回退失败", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1913. return;
  1914. }
  1915. }
  1916. //交班
  1917. if (e.Cell.Column.Key == "CHANGE_NUM")
  1918. {
  1919. string Shift = UserInfo.GetUserOrder();
  1920. string Group = UserInfo.GetUserGroup();
  1921. string User = UserInfo.GetUserName();
  1922. int BeforeChangeNum = 0;
  1923. //查询上个班交班支数
  1924. DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { HeatNo, ResultNo, 3, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1925. if (dtChangeNum.Rows.Count > 0)
  1926. {
  1927. if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString()))
  1928. {
  1929. BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString());
  1930. }
  1931. }
  1932. int Seq2 = int.Parse(seq);
  1933. if (Seq2 <= BeforeChangeNum)
  1934. {
  1935. MessageBox.Show("前道班次已交班,该支不能再次交班。");
  1936. return;
  1937. }
  1938. if (Seq2 > ultraGrid1.Rows.Count - ScrapNumBefore)
  1939. {
  1940. MessageBox.Show("该支已被前道工序剔除,不能在该支交班");
  1941. return;
  1942. }
  1943. if (ultraGrid1.Rows.Count == Seq2)
  1944. {
  1945. MessageBox.Show("该支是本炉最后一支,请结炉!");
  1946. return;
  1947. }
  1948. // 有班次交班了,其它班次不能操作。
  1949. foreach (UltraGridRow ugd in ultraGrid1.Rows)
  1950. {
  1951. if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
  1952. {
  1953. string shifSeq = ugd.Cells["COL_SHIFT"].Value.ToString();
  1954. string groupSeq = ugd.Cells["COL_GROUP"].Value.ToString();
  1955. NativeMethodNew nasssss = new NativeMethodNew(this.ob);
  1956. if (nasssss.IsRackOperateRolling(shifSeq, groupSeq))
  1957. {
  1958. MessageBox.Show("管号对列已由" + shifSeq + "," + groupSeq + "操作,请先接班确认", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1959. return;
  1960. }
  1961. }
  1962. }
  1963. //int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { heatNo, ResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 4, 0 }, this.ob);
  1964. // ChangeFlag = 1;
  1965. hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 3, int.Parse(seq), 0);
  1966. ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.doSetShiftGroup", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq2, BeforeChangeNum, PlineCode, Shift, Group, User }, this.ob);
  1967. }
  1968. //接班确认
  1969. if (e.Cell.Column.Key == "BTNCHANGECOM")
  1970. {
  1971. string Shift = UserInfo.GetUserOrder();
  1972. string Group = UserInfo.GetUserGroup();
  1973. string User = UserInfo.GetUserName();
  1974. int BeforeChangeNum = 0;
  1975. string shiftSeq = "";
  1976. string groupSeq = "";
  1977. foreach (UltraGridRow ugd in ultraGrid1.Rows)
  1978. {
  1979. if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
  1980. {
  1981. shiftSeq = ugd.Cells["COL_SHIFT"].Value.ToString();
  1982. groupSeq = ugd.Cells["COL_GROUP"].Value.ToString();
  1983. }
  1984. }
  1985. //查询上个班交班支数
  1986. DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { HeatNo, ResultNo, 3, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1987. if (dtChangeNum.Rows.Count > 0)
  1988. {
  1989. if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString()))
  1990. {
  1991. BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString());
  1992. }
  1993. }
  1994. int WaitChangeSeq = hm.GetWaitChangeSeq(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 3, 0, proPlanId, gxPlanNo);
  1995. if (WaitChangeSeq == 0)
  1996. {
  1997. MessageBox.Show("没有待交班确认的管号。");
  1998. return;
  1999. }
  2000. if (WaitChangeSeq != int.Parse(seq))
  2001. {
  2002. MessageBox.Show("交班管序号与接班管序号不符,请确认后接班。");
  2003. return;
  2004. }
  2005. if (MessageUtil.ShowYesNoAndQuestion("确认炉号:【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】序号:【" + seq + "】交班?") == DialogResult.No)
  2006. {
  2007. return;
  2008. }
  2009. //查询是否有该班接班记录
  2010. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2011. string Time = SeverTime.ToLongTimeString();
  2012. string StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  2013. string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2014. string Date = "";
  2015. if (this.DoRelogin(DoCheck))
  2016. {
  2017. //插入接班确认履历表
  2018. hm.InsertChangeRemuse(Shift, Group, _UserName, "3", PlineCode);
  2019. int Seq2 = int.Parse(seq);
  2020. //int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { heatNo, ResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 4, 0 }, this.ob);
  2021. int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeNum", new object[] { heatNo, ResultNo, Seq2, BeforeChangeNum, PlineCode, Shift, Group, _UserName }, this.ob);
  2022. ChangeFlag = 1;
  2023. #region 修改连轧日志表
  2024. string gridShift = Shift;
  2025. string gridGroup = Group;
  2026. if(!shiftSeq.Equals("") && !groupSeq.Equals(""))
  2027. {
  2028. switch (shiftSeq)
  2029. {
  2030. case "常白班":
  2031. shiftSeq = "0";
  2032. break;
  2033. case "白班":
  2034. shiftSeq = "0";
  2035. break;
  2036. case "早班":
  2037. shiftSeq = "1";
  2038. break;
  2039. case "中班":
  2040. shiftSeq = "2";
  2041. break;
  2042. case "夜班":
  2043. shiftSeq = "3";
  2044. break;
  2045. }
  2046. switch (groupSeq)
  2047. {
  2048. case "甲":
  2049. groupSeq = "1";
  2050. break;
  2051. case "乙":
  2052. groupSeq = "2";
  2053. break;
  2054. case "丙":
  2055. groupSeq = "3";
  2056. break;
  2057. case "丁":
  2058. groupSeq = "4";
  2059. break;
  2060. }
  2061. gridShift = shiftSeq;
  2062. gridGroup = groupSeq;
  2063. }
  2064. //foreach (UltraGridRow ugd in ultraGrid1.Rows)
  2065. //{
  2066. // if (ugd.Cells["CHANGE_FLAG"].Value.ToString().Equals("待接班确认"))
  2067. // {
  2068. // gridShift = ugd.Cells["COL_SHIFT"].Value.ToString();
  2069. // gridGroup = ugd.Cells["COL_GROUP"].Value.ToString();
  2070. // }
  2071. //}
  2072. string[] Temp = GetDbHeightBruningRate(heatNo, ResultNo, BeforeChangeNum, Seq2).Split('-');
  2073. string QaTon = Temp[0];
  2074. string ScrapTon = Temp[1];
  2075. string ScrapNum1 = Temp[2];
  2076. MilControlLogEntity ControlLogEntity = new MilControlLogEntity();
  2077. ControlLogEntity.QualifiedNum = (Seq2 - BeforeChangeNum - int.Parse(ScrapNum1)).ToString();
  2078. ControlLogEntity.ScrapNum = ScrapNum1.ToString();
  2079. ControlLogEntity.QualifiedWt = QaTon.ToString();
  2080. ControlLogEntity.ScrapWt = ScrapTon.ToString();
  2081. ControlLogEntity.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
  2082. ControlLogEntity.ProBc = gridShift;
  2083. ControlLogEntity.ProBz = gridGroup;
  2084. ControlLogEntity.LotNo = ActiveLotNo;
  2085. ControlLogEntity.UserId = _UserID;
  2086. ControlLogEntity.UserName = _UserName;
  2087. ControlLogEntity.ChangeShiftFlag = "1";
  2088. ControlLogEntity.ProPlanId = proPlanId;
  2089. ControlLogEntity.GxPlanNo = gxPlanNo;
  2090. //CoreClientParam ccp = new CoreClientParam();
  2091. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmRollingRPipeResult";
  2092. ccp.MethodName = "changeGroupUpdateContralLog";
  2093. ccp.ServerParams = new object[] { ControlLogEntity };
  2094. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  2095. //int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.changeGroupUpdateContralLog", new object[] { ControlLogEntity }, this.ob);
  2096. //if (count2 > 0)
  2097. //{
  2098. if (Shift == "3")
  2099. {
  2100. Time = Time.Replace(":", "");
  2101. Date = SeverTime.AddDays(+1).ToString("yyyyMMdd");
  2102. }
  2103. else
  2104. {
  2105. Date = SeverTime.ToString("yyyyMMdd");
  2106. }
  2107. string ShiftA = this.UserInfo.GetUserOrder();//HOTMethod.GetShiftAfter(Shift, Group, Date).Substring(0, 1);
  2108. string GroupA = this.UserInfo.GetUserGroup();//HOTMethod.GetShiftAfter(Shift, Group, Date).Substring(1, 1);
  2109. //if (_UpdateFlag == "0")
  2110. //{
  2111. //接班标识
  2112. string ChangeShiftFlag = "2";
  2113. int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.insertContralLog", new object[] { HeatNo, ActiveLotNo, ShiftA, GroupA, _UserID, _UserName, ChangeShiftFlag, proPlanId, gxPlanNo }, this.ob);
  2114. //}
  2115. //}
  2116. #endregion
  2117. }
  2118. }
  2119. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", new object[] { HeatNo, proPlanId, gxPlanNo }, this.ob);
  2120. //过渡方法,接班后重登陆初始化导致Grid.Row为null
  2121. if (ultraGridPlan.Rows == null)
  2122. {
  2123. return;
  2124. }
  2125. if (dt1.Rows.Count > 0)
  2126. {
  2127. if (PlineCode != "C012")
  2128. {
  2129. GridEditHistoryForRack(dt1);
  2130. }
  2131. else
  2132. {
  2133. GridEditHistoryAressForRack(dt1);
  2134. }
  2135. }
  2136. GetRollingCard();
  2137. RackQuery(HeatNo);
  2138. }
  2139. /// <summary>
  2140. /// 连轧跟踪信息查询
  2141. /// </summary>
  2142. private void RackQuery(string heatNo)
  2143. {
  2144. tbRollDate.Clear();
  2145. if (ultraGridPlan.Rows.Count > 0)
  2146. {
  2147. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.rackQueryForHeatNo", new object[] { heatNo,proPlanId,gxPlanNo }, this.ob);//连轧跟踪信息
  2148. GridHelper.CopyDataToDatatable(ref dt, ref tbRollDate, true);
  2149. ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
  2150. foreach (UltraGridRow dr in ultraGrid1.Rows)
  2151. {
  2152. dr.Cells["DELETE"].Value = "剔除";
  2153. dr.Cells["DELBACK"].Value = "剔料回退";
  2154. if (dr.Cells["STATUS"].Text == "剔除")
  2155. {
  2156. dr.Cells["SCRAP_REASON"].Activation = Activation.AllowEdit;
  2157. }
  2158. }
  2159. }
  2160. ChangeGridColor();
  2161. }
  2162. /// <summary>
  2163. /// 变色
  2164. /// </summary>
  2165. private void ChangeGridColor()
  2166. {
  2167. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  2168. {
  2169. if (ugr != null)
  2170. {
  2171. switch (ugr.Cells["STATUS"].Value.ToString())
  2172. {
  2173. case "剔除":
  2174. ugr.Appearance.BackColor = Color.Yellow;
  2175. break;
  2176. }
  2177. switch (ugr.Cells["CHANGE_FLAG"].Value.ToString())
  2178. {
  2179. case "待接班确认":
  2180. ugr.Appearance.BackColor = Color.LightGreen;
  2181. break;
  2182. }
  2183. }
  2184. }
  2185. foreach (UltraGridRow uRow in ultraGridPlan.Rows)
  2186. {
  2187. if (uRow != null)
  2188. {
  2189. switch (uRow.Cells["IS_START"].Value.ToString())
  2190. {
  2191. case "已完成连轧":
  2192. uRow.Appearance.BackColor = Color.YellowGreen;
  2193. break;
  2194. }
  2195. }
  2196. }
  2197. }
  2198. /// <summary>
  2199. /// 查询连轧实绩
  2200. /// </summary>
  2201. private void resultQuery(string heatNo, string PliceCode)
  2202. {
  2203. string strheatno = heatNo;
  2204. string factoryId = PliceCode;
  2205. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", new object[] { strheatno, proPlanId, gxPlanNo }, this.ob);
  2206. if (dt.Rows.Count > 0)
  2207. {
  2208. if (factoryId != "C012")
  2209. {
  2210. GridEditHistory(dt);
  2211. }
  2212. else
  2213. {
  2214. GridEditHistoryAress(dt);
  2215. }
  2216. }
  2217. if (dt.Rows.Count == 0)
  2218. {
  2219. MilRollingResultEntity rr = new MilRollingResultEntity();
  2220. rollResult_Arssel1.Value = rr;
  2221. rollResult1.Value = rr;
  2222. }
  2223. }
  2224. #endregion
  2225. #region 卡片赋值
  2226. /// <summary>
  2227. /// 连轧实绩Grid赋值Aress_1
  2228. /// </summary>
  2229. /// <param name="dt"></param>
  2230. private void GridEditHistoryAress(DataTable dt)
  2231. {
  2232. ultraTabControl1.Tabs[0].Visible = false;
  2233. ultraTabControl1.Tabs[1].Visible = true;
  2234. if (dt.Rows.Count > 0)
  2235. {
  2236. UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
  2237. string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
  2238. string ResultNo = ugr1.Cells["ID"].Value.ToString();
  2239. rollResult_Arssel1.Value.ScrapNum = "0";
  2240. //查询本道工序剔除支数
  2241. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  2242. if (dtScrapNum.Rows.Count > 0)
  2243. {
  2244. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  2245. {
  2246. rollResult_Arssel1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  2247. }
  2248. }
  2249. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  2250. if (dtQANum.Rows.Count > 0)
  2251. {
  2252. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  2253. {
  2254. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(rollResult_Arssel1.Value.ScrapNum.ToString()))
  2255. {
  2256. //合格支数
  2257. rollResult_Arssel1.Value.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(rollResult1.Value.ScrapNum.ToString());
  2258. }
  2259. else
  2260. {
  2261. rollResult_Arssel1.Value.Rollingnum = 0;
  2262. }
  2263. }
  2264. else
  2265. { rollResult_Arssel1.Value.Rollingnum = 0; }
  2266. }
  2267. //交接班支数
  2268. this.rollResult_Arssel1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString();
  2269. //备注
  2270. this.rollResult_Arssel1.Value.Remark = dt.Rows[0]["REMARK"].ToString();
  2271. //毛管名义尺寸
  2272. this.rollResult_Arssel1.Value.Tubesize = dt.Rows[0]["TUBESIZE"].ToString();
  2273. //连轧开始时间
  2274. this.rollResult_Arssel1.Value.StartTime = dt.Rows[0]["START_TIME"].ToString();
  2275. //连轧结束时间
  2276. this.rollResult_Arssel1.Value.EndTime = dt.Rows[0]["END_TIME"].ToString();
  2277. //快开
  2278. this.rollResult_Arssel1.Value.QoRollerThroatDiameter = dt.Rows[0]["QO_ROLLER_THROAT_DIAMETER"].ToString();
  2279. //轧制
  2280. this.rollResult_Arssel1.Value.RollingThroatDiameter = dt.Rows[0]["ROLLING_THROAT_DIAMETER"].ToString();
  2281. //快关
  2282. this.rollResult_Arssel1.Value.QcRollerThroatDiameter = dt.Rows[0]["QC_ROLLER_THROAT_DIAMETER"].ToString();
  2283. //咬入
  2284. this.rollResult_Arssel1.Value.RollerBiteSpeed = dt.Rows[0]["ROLLER_BITE_SPEED"].ToString();
  2285. //轧辊角
  2286. this.rollResult_Arssel1.Value.RollingAngle = dt.Rows[0]["ROLLING_ANGLE"].ToString();
  2287. //喂角转速
  2288. this.rollResult_Arssel1.Value.FeedAngle = dt.Rows[0]["FEED_ANGLE"].ToString();
  2289. //轧制转速
  2290. this.rollResult_Arssel1.Value.RollingSpeed = dt.Rows[0]["ROLLING_SPEED"].ToString();
  2291. this.rollResult_Arssel1.Value.StartRollTemp = dt.Rows[0]["START_ROLL_TEMP"].ToString();
  2292. this.rollResult_Arssel1.UpdateData();
  2293. }
  2294. }
  2295. /// <summary>
  2296. /// 查询流通卡信息
  2297. /// </summary>
  2298. private void GetRollingCard()
  2299. {
  2300. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  2301. if (ugr != null)
  2302. {
  2303. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  2304. DataTable dt = new DataTable();
  2305. if (PlineCode.Equals("C008") || PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017"))
  2306. {
  2307. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  2308. }
  2309. else
  2310. {
  2311. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  2312. }
  2313. RollingCardEditGrid(dt, JudgeStoveNo);
  2314. }
  2315. }
  2316. /// <summary>
  2317. /// 查询流通卡信息
  2318. /// </summary>
  2319. private void GetRollingCard(string heatNo)
  2320. {
  2321. string JudgeStoveNo = heatNo;
  2322. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  2323. RollingCardEditGrid(dt, JudgeStoveNo);
  2324. }
  2325. #region 事件处理
  2326. private void chkLotNo_CheckedChanged(object sender, EventArgs e)
  2327. {
  2328. this.txtLOT_NO.Enabled = this.chkLotNo.Checked;
  2329. }
  2330. private void chkHeatNo_CheckedChanged(object sender, EventArgs e)
  2331. {
  2332. if (this.chkHeatNo.Checked)
  2333. {
  2334. this.txtJudgeStoveNo.Enabled = true;
  2335. }
  2336. else
  2337. {
  2338. this.txtJudgeStoveNo.Enabled = false;
  2339. }
  2340. if (chkStatusQuery.Checked)
  2341. {
  2342. PlanStatusQuery = "99";
  2343. PlanStartStatusQuery = "40";
  2344. }
  2345. else
  2346. {
  2347. PlanStatusQuery = "39";
  2348. PlanStartStatusQuery = "00";
  2349. }
  2350. if (chkAutoRefresh.Checked)
  2351. {
  2352. timer1.Enabled = true;
  2353. }
  2354. else
  2355. {
  2356. timer1.Enabled = false;
  2357. }
  2358. }
  2359. public string DoCheck(CoreUserInfo User)
  2360. {
  2361. return "";
  2362. }
  2363. /// <summary>
  2364. /// 查询合格支 合格吨
  2365. /// </summary>
  2366. /// <param name="JudgeStoveNo"></param>
  2367. /// <param name="ResultNo"></param>
  2368. /// <param name="StartSeq"></param>
  2369. /// <param name="EndSeq"></param>
  2370. /// <param name="Flag"> 0-交班合废支吨</param>
  2371. /// <returns></returns>
  2372. private string GetDbHeightBruningRate(string JudgeStoveNo, string ResultNo, int StartSeq, int EndSeq)
  2373. {
  2374. string DbHeightBrate = "";
  2375. double DbHeight = 0;
  2376. double BRate = 0;
  2377. int ScrapNum = 0;
  2378. double QaTon = 0;
  2379. double ScrapTon = 0;
  2380. DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getDBHeightBRate", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
  2381. if (dtDBH.Rows.Count > 0)
  2382. {
  2383. DbHeight = double.Parse(dtDBH.Rows[0]["DB_HEIGHT"].ToString());
  2384. BRate = double.Parse(dtDBH.Rows[0]["burnning_rate"].ToString());
  2385. }
  2386. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, StartSeq, EndSeq, proPlanId, gxPlanNo }, this.ob);
  2387. if (dtScrapNum.Rows.Count > 0)
  2388. {
  2389. ScrapNum = int.Parse(dtScrapNum.Rows[0][0].ToString());
  2390. }
  2391. QaTon = (EndSeq - StartSeq+1 - ScrapNum) * DbHeight * (1 - (BRate / 100));
  2392. ScrapTon = ScrapNum * DbHeight * (1 - (BRate / 100));
  2393. DbHeightBrate = QaTon + "-" + ScrapTon + "-" + ScrapNum;
  2394. return DbHeightBrate;
  2395. }
  2396. /// <summary>
  2397. /// Grid表头事件
  2398. /// </summary>
  2399. /// <param name="sender"></param>
  2400. /// <param name="e"></param>
  2401. private void ultraGrid1_DoubleClickHeader(object sender, DoubleClickHeaderEventArgs e)
  2402. {
  2403. if (PanelSizeFlag == 0)
  2404. {
  2405. PanelSizeFlag = 1;
  2406. splitContainer2.SplitterDistance = 180;
  2407. }
  2408. else
  2409. {
  2410. PanelSizeFlag = 0;
  2411. splitContainer2.SplitterDistance = 90;
  2412. }
  2413. }
  2414. /// <summary>
  2415. /// 计划表ROW点击变换判断
  2416. /// </summary>
  2417. /// <param name="sender"></param>
  2418. /// <param name="e"></param>
  2419. private void ultraGridPlan_BeforeRowActivate(object sender, RowEventArgs e)
  2420. {
  2421. if (this.rollResult1.IsCellSelect == true)
  2422. {
  2423. NativeMethodNew na = new NativeMethodNew(this.ob);
  2424. if (!na.isBegineNode(ActiveJUDGE_STOVE_NO, 3))
  2425. {
  2426. this.rollResult1.IsCellSelect = false;
  2427. return;
  2428. }
  2429. //if (MessageBox.Show("提示:连轧实绩可能已修改,是否保存", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  2430. //{
  2431. // this.rollResult1.IsCellSelect = false;
  2432. // //保存探伤实绩
  2433. //}
  2434. else
  2435. {
  2436. ShowMessageFlag = 1;
  2437. FeedRowSave();
  2438. ShowMessageFlag = 0;
  2439. this.rollResult1.IsCellSelect = false;
  2440. foreach (UltraGridRow ugr in this.ultraGridPlan.Rows)
  2441. {
  2442. if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString() == ActiveJUDGE_STOVE_NO)
  2443. {
  2444. this.ultraGridPlan.ActiveRow = ugr;
  2445. }
  2446. }
  2447. return;
  2448. }
  2449. }
  2450. if (this.rollResult_Arssel1.IsCellSelect == true)
  2451. {
  2452. NativeMethodNew na = new NativeMethodNew(this.ob);
  2453. if (!na.isBegineNode(ActiveJUDGE_STOVE_NO, 3))
  2454. {
  2455. this.rollResult_Arssel1.IsCellSelect = false;
  2456. return;
  2457. }
  2458. //if (MessageBox.Show("提示:探伤实绩可能已修改,是否保存", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  2459. //{
  2460. // this.rollResult1.IsCellSelect = false;
  2461. // //保存探伤实绩
  2462. // FeedRowSave();
  2463. //}
  2464. else
  2465. {
  2466. this.rollResult_Arssel1.IsCellSelect = false;
  2467. foreach (UltraGridRow ugr in this.ultraGridPlan.Rows)
  2468. {
  2469. if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString() == ActiveJUDGE_STOVE_NO)
  2470. {
  2471. this.ultraGridPlan.ActiveRow = ugr;
  2472. }
  2473. }
  2474. return;
  2475. }
  2476. }
  2477. }
  2478. /// <summary>
  2479. /// 查询结炉实绩
  2480. /// </summary>
  2481. public void NodeQuery()
  2482. {
  2483. string Shift = UserInfo.GetUserOrder();
  2484. string Group = UserInfo.GetUserGroup();
  2485. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2486. string StartTime = SeverTime.ToString("yyyy-MM-dd");
  2487. string EndTime = SeverTime.AddDays(1).ToString("yyyy-MM-dd");
  2488. string Date = StartTime;
  2489. string Time = SeverTime.ToLongTimeString();
  2490. //晚班
  2491. if (Shift == "3")
  2492. {
  2493. Time = Time.Replace(":", "");
  2494. if (int.Parse(Time) > 205900)
  2495. {
  2496. StartTime += " " + "21:00:00";
  2497. EndTime += " " + "10:00:00";
  2498. }
  2499. else
  2500. {
  2501. StartTime = SeverTime.AddDays(-1).ToString("yyyy-MM-dd") + " " + "21:00:00";
  2502. EndTime = SeverTime.ToString("yyyy-MM-dd") + " " + "10:00:00";
  2503. }
  2504. }
  2505. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.GetRollResultNodeQuery", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
  2506. FrmNodeResultQuery frm = new FrmNodeResultQuery(dt, 4, Date, Shift, Group, this.ob);
  2507. frm.ShowDialog();
  2508. }
  2509. #endregion
  2510. /// <summary>
  2511. /// 当班工具更换
  2512. /// </summary>
  2513. private void DoToolChange()
  2514. {
  2515. string Shift = UserInfo.GetUserOrder();
  2516. string Group = UserInfo.GetUserGroup();
  2517. string User = UserInfo.GetUserName();
  2518. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2519. string StartTime = SeverTime.ToString("yyyy-MM-dd");
  2520. string EndTime = SeverTime.AddDays(1).ToString("yyyy-MM-dd");
  2521. string Date = StartTime;
  2522. string Time = SeverTime.ToLongTimeString();
  2523. //晚班
  2524. if (Shift == "3")
  2525. {
  2526. Time = Time.Replace(":", "");
  2527. if (int.Parse(Time) > 205900)
  2528. {
  2529. StartTime += " " + "21:00:00";
  2530. EndTime += " " + "07:00:00";
  2531. }
  2532. else
  2533. {
  2534. StartTime = SeverTime.AddDays(-1).ToString("yyyy-MM-dd") + " " + "21:00:00";
  2535. EndTime = SeverTime.ToString("yyyy-MM-dd") + " " + "07:00:00";
  2536. }
  2537. }
  2538. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.toolChangeQuery", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
  2539. txtQuery frm = new txtQuery(2, Date, Shift, Group, User, PlineCode, this.ob);
  2540. frm.ShowDialog();
  2541. }
  2542. /// <summary>
  2543. ///
  2544. /// </summary>
  2545. /// <param name="dt"></param>
  2546. private void frmTechnological1_DoubleClickEvent(DataTable dt)
  2547. {
  2548. NativeMethodNew NmN = new NativeMethodNew(this.ob);
  2549. HOTMethod HOTm = new HOTMethod(this.ob);
  2550. if (!NmN.isBegineNode(ActiveJUDGE_STOVE_NO, 3))
  2551. {
  2552. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未开始连轧,不能带入参数。");
  2553. return;
  2554. }
  2555. //if (HOTm.isNode(ActiveJUDGE_STOVE_NO, ActiveResultNo, 3, PlineCode))
  2556. //{
  2557. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成连轧,不能带入参数。");
  2558. // return;
  2559. //}
  2560. MilRollingResultEntity RollingResult = new MilRollingResultEntity();
  2561. RollingResult = (MilRollingResultEntity)EntityTool.setObjectByDataTable(RollingResult, dt);
  2562. this.rollResult1.UpdateDateForPrama(RollingResult);
  2563. ShowMessageFlag = 1;
  2564. FeedRowSave();
  2565. ShowMessageFlag = 0;
  2566. }
  2567. /// <summary>
  2568. /// Arsel
  2569. /// </summary>
  2570. /// <param name="dt"></param>
  2571. private void frmTechnological2_DoubleClickEvent(DataTable dt)
  2572. {
  2573. NativeMethodNew NmN = new NativeMethodNew(this.ob);
  2574. HOTMethod HOTm = new HOTMethod(this.ob);
  2575. if (!NmN.isBegineNode(ActiveJUDGE_STOVE_NO, 3))
  2576. {
  2577. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未开始连轧,不能带入参数。");
  2578. return;
  2579. }
  2580. //if (HOTm.isNode(ActiveJUDGE_STOVE_NO, ActiveResultNo, 3, PlineCode))
  2581. //{
  2582. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成连轧,不能带入参数。");
  2583. // return;
  2584. //}
  2585. MilRollingResultEntity RollingResult = new MilRollingResultEntity();
  2586. RollingResult = (MilRollingResultEntity)EntityTool.setObjectByDataTable(RollingResult, dt);
  2587. this.rollResult_Arssel1.UpdateDateForPrama(RollingResult);
  2588. ShowMessageFlag = 1;
  2589. FeedRowSave();
  2590. ShowMessageFlag = 0;
  2591. }
  2592. /// <summary>
  2593. /// 到点提示交班
  2594. /// </summary>
  2595. /// <param name="sender"></param>
  2596. /// <param name="e"></param>
  2597. private void timer2_Tick(object sender, EventArgs e)
  2598. {
  2599. if (!PlineCode.Equals("C072"))
  2600. {
  2601. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2602. string Time = SeverTime.ToLongTimeString();
  2603. Time = Time.Replace(":", "");
  2604. if (ChangeFlag == 0)
  2605. {
  2606. if (int.Parse(Time) > 065459 && int.Parse(Time) < 065600 || int.Parse(Time) > 070359 && int.Parse(Time) < 070500)
  2607. {
  2608. if (Shift == "3")
  2609. {
  2610. if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
  2611. {
  2612. }
  2613. ChangeFlag = 1;
  2614. return;
  2615. }
  2616. }
  2617. if (int.Parse(Time) > 135359 && int.Parse(Time) < 135500 || int.Parse(Time) > 140359 && int.Parse(Time) < 140500)
  2618. {
  2619. if (Shift == "1")
  2620. {
  2621. if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
  2622. {
  2623. }
  2624. ChangeFlag = 1;
  2625. return;
  2626. }
  2627. }
  2628. if (int.Parse(Time) > 205359 && int.Parse(Time) < 205500 || int.Parse(Time) > 210359 && int.Parse(Time) < 210500)
  2629. {
  2630. if (Shift == "2")
  2631. {
  2632. if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
  2633. {
  2634. }
  2635. ChangeFlag = 1;
  2636. return;
  2637. }
  2638. }
  2639. }
  2640. }
  2641. }
  2642. /// <summary>
  2643. /// 管号队列修改剔除原因 备注
  2644. /// </summary>
  2645. /// <param name="sender"></param>
  2646. /// <param name="e"></param>
  2647. private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)
  2648. {
  2649. if (e.KeyChar != (char)13)
  2650. {
  2651. }
  2652. if (e.KeyChar == (char)13)
  2653. {
  2654. e.Handled = true;
  2655. UltraGridRow ugr = null;
  2656. int Index = ultraGrid1.ActiveRow.Index;
  2657. if (Index < ultraGrid1.Rows.Count - 1)
  2658. {
  2659. ugr = ultraGrid1.Rows[Index - 1];
  2660. }
  2661. else
  2662. {
  2663. ugr = ultraGrid1.ActiveRow;
  2664. }
  2665. ultraGrid1.UpdateData();
  2666. ultraGrid1.Update();
  2667. string ScrapReason = ugr.Cells["SCRAP_REASON"].Text.ToString().Trim();
  2668. string Remark = ugr.Cells["REMARK"].Text.ToString();
  2669. string Seq = ugr.Cells["SEQ"].Text.ToString();
  2670. string Status = ugr.Cells["STATUS"].Text.ToString();
  2671. if (Status == "剔除")
  2672. {
  2673. int dt = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateMatNoPro", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 3, Seq, ScrapReason, Remark }, this.ob);
  2674. }
  2675. RackQuery(ActiveJUDGE_STOVE_NO);
  2676. }
  2677. }
  2678. #endregion
  2679. #region 卡片赋值
  2680. /// <summary>
  2681. /// 连轧实绩Grid赋值Aress_1
  2682. /// </summary>
  2683. /// <param name="dt"></param>
  2684. private void GridEditHistoryAressForRack(DataTable dt)
  2685. {
  2686. ultraTabControl1.Tabs[0].Visible = false;
  2687. ultraTabControl1.Tabs[1].Visible = true;
  2688. if (dt.Rows.Count > 0)
  2689. {
  2690. UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
  2691. string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
  2692. string ResultNo = ugr1.Cells["ID"].Value.ToString();
  2693. rollResult_Arssel1.Value.ScrapNum = "0";
  2694. //查询本道工序剔除支数
  2695. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  2696. if (dtScrapNum.Rows.Count > 0)
  2697. {
  2698. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  2699. {
  2700. rollResult_Arssel1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  2701. }
  2702. }
  2703. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  2704. if (dtQANum.Rows.Count > 0)
  2705. {
  2706. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  2707. {
  2708. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(rollResult_Arssel1.Value.ScrapNum.ToString()))
  2709. {
  2710. //合格支数
  2711. rollResult_Arssel1.Value.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(rollResult1.Value.ScrapNum.ToString());
  2712. }
  2713. else
  2714. {
  2715. rollResult_Arssel1.Value.Rollingnum = 0;
  2716. }
  2717. }
  2718. else
  2719. { rollResult_Arssel1.Value.Rollingnum = 0; }
  2720. }
  2721. //交接班支数
  2722. this.rollResult_Arssel1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString();
  2723. this.rollResult_Arssel1.UpdateDataForRack();
  2724. }
  2725. }
  2726. /// <summary>
  2727. /// 连轧实绩Grid赋值
  2728. /// </summary>
  2729. /// <param name="dt"></param>
  2730. private void GridEditHistory(DataTable dt)
  2731. {
  2732. ultraTabControl1.Tabs[0].Visible = true;
  2733. ultraTabControl1.Tabs[1].Visible = false;
  2734. if (dt.Rows.Count > 0)
  2735. {
  2736. UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
  2737. string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
  2738. string ResultNo = ugr1.Cells["ID"].Value.ToString();
  2739. rollResult1.Value.ScrapNum = "0";
  2740. //查询本道工序剔除支数
  2741. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  2742. if (dtScrapNum.Rows.Count > 0)
  2743. {
  2744. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  2745. {
  2746. rollResult1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  2747. }
  2748. }
  2749. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  2750. if (dtQANum.Rows.Count > 0)
  2751. {
  2752. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  2753. {
  2754. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(rollResult1.Value.ScrapNum.ToString()))
  2755. {
  2756. //合格支数
  2757. rollResult1.Value.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(rollResult1.Value.ScrapNum.ToString());
  2758. }
  2759. else
  2760. {
  2761. rollResult1.Value.Rollingnum = 0;
  2762. }
  2763. }
  2764. else
  2765. { rollResult1.Value.Rollingnum = 0; }
  2766. }
  2767. //交接班支数
  2768. this.rollResult1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString();
  2769. //备注
  2770. this.rollResult1.Value.Remark = dt.Rows[0]["REMARK"].ToString();
  2771. //VRS转速
  2772. this.rollResult1.Value.VrsSpeed = dt.Rows[0]["VRS_SPEED"].ToString();
  2773. //预插入长度
  2774. this.rollResult1.Value.InsertLength = dt.Rows[0]["INSERT_LENGTH"].ToString();
  2775. //毛管名义尺寸
  2776. this.rollResult1.Value.Tubesize = dt.Rows[0]["TUBESIZE"].ToString();
  2777. //EM转速
  2778. this.rollResult1.Value.Emspeed = dt.Rows[0]["EMSPEED"].ToString();
  2779. //限动速度
  2780. this.rollResult1.Value.LimitSpeed = dt.Rows[0]["LIMIT_SPEED"].ToString();
  2781. //EX1脱管机架转速
  2782. this.rollResult1.Value.Ext1RackSpeed = dt.Rows[0]["EXT1_RACK_SPEED"].ToString();
  2783. //连轧开始时间
  2784. this.rollResult1.Value.StartTime = dt.Rows[0]["START_TIME"].ToString();
  2785. //连轧结束时间
  2786. this.rollResult1.Value.EndTime = dt.Rows[0]["END_TIME"].ToString();
  2787. //机架转速1
  2788. this.rollResult1.Value.RackSpeed1 = dt.Rows[0]["RACK_SPEED1"].ToString();
  2789. //机架转速2
  2790. this.rollResult1.Value.RackSpeed2 = dt.Rows[0]["RACK_SPEED2"].ToString();
  2791. //机架转速3
  2792. this.rollResult1.Value.RackSpeed3 = dt.Rows[0]["RACK_SPEED3"].ToString();
  2793. //机架转速4
  2794. this.rollResult1.Value.RackSpeed4 = dt.Rows[0]["RACK_SPEED4"].ToString();
  2795. //机架转速5
  2796. this.rollResult1.Value.RackSpeed5 = dt.Rows[0]["RACK_SPEED5"].ToString();
  2797. //机架转速6
  2798. this.rollResult1.Value.RackSpeed6 = dt.Rows[0]["RACK_SPEED6"].ToString();
  2799. //机架转速7
  2800. this.rollResult1.Value.RackSpeed7 = dt.Rows[0]["RACK_SPEED7"].ToString();
  2801. //辊缝转速1
  2802. this.rollResult1.Value.RackSpace1 = dt.Rows[0]["RACK_SPACE1"].ToString();
  2803. //辊缝转速2
  2804. this.rollResult1.Value.RackSpace2 = dt.Rows[0]["RACK_SPACE2"].ToString();
  2805. //辊缝转速3
  2806. this.rollResult1.Value.RackSpace3 = dt.Rows[0]["RACK_SPACE3"].ToString();
  2807. //辊缝转速4
  2808. this.rollResult1.Value.RackSpace4 = dt.Rows[0]["RACK_SPACE4"].ToString();
  2809. //辊缝转速5
  2810. this.rollResult1.Value.RackSpace5 = dt.Rows[0]["RACK_SPACE5"].ToString();
  2811. //辊缝转速6
  2812. this.rollResult1.Value.RackSpace6 = dt.Rows[0]["RACK_SPACE6"].ToString();
  2813. //辊缝转速7
  2814. this.rollResult1.Value.RackSpace7 = dt.Rows[0]["RACK_SPACE7"].ToString();
  2815. //机架轧制力1
  2816. this.rollResult1.Value.RollingForce1 = dt.Rows[0]["ROLLING_FORCE1"].ToString();
  2817. //机架轧制力2
  2818. this.rollResult1.Value.RollingForce2 = dt.Rows[0]["ROLLING_FORCE2"].ToString();
  2819. //机架轧制力3
  2820. this.rollResult1.Value.RollingForce3 = dt.Rows[0]["ROLLING_FORCE3"].ToString();
  2821. //机架轧制力4
  2822. this.rollResult1.Value.RollingForce4 = dt.Rows[0]["ROLLING_FORCE4"].ToString();
  2823. //机架轧制力5
  2824. this.rollResult1.Value.RollingForce5 = dt.Rows[0]["ROLLING_FORCE5"].ToString();
  2825. //机架轧制力6
  2826. this.rollResult1.Value.RollingForce6 = dt.Rows[0]["ROLLING_FORCE6"].ToString();
  2827. //机架轧制力7
  2828. this.rollResult1.Value.RollingForce7 = dt.Rows[0]["ROLLING_FORCE7"].ToString();
  2829. this.rollResult1.Value.StartRollTemp = dt.Rows[0]["START_ROLL_TEMP"].ToString();
  2830. this.rollResult1.UpdateData();
  2831. }
  2832. }
  2833. /// <summary>
  2834. /// 连轧实绩Grid赋值
  2835. /// </summary>
  2836. /// <param name="dt"></param>
  2837. private void GridEditHistoryForRack(DataTable dt)
  2838. {
  2839. ultraTabControl1.Tabs[0].Visible = true;
  2840. ultraTabControl1.Tabs[1].Visible = false;
  2841. if (dt.Rows.Count > 0)
  2842. {
  2843. UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
  2844. string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
  2845. string ResultNo = ugr1.Cells["ID"].Value.ToString();
  2846. rollResult1.Value.ScrapNum = "0";
  2847. //查询本道工序剔除支数
  2848. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  2849. if (dtScrapNum.Rows.Count > 0)
  2850. {
  2851. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  2852. {
  2853. rollResult1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  2854. }
  2855. }
  2856. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 3, PlineCode, proPlanId, gxPlanNo }, this.ob);
  2857. if (dtQANum.Rows.Count > 0)
  2858. {
  2859. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  2860. {
  2861. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(rollResult1.Value.ScrapNum.ToString()))
  2862. {
  2863. //合格支数
  2864. rollResult1.Value.Rollingnum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(rollResult1.Value.ScrapNum.ToString());
  2865. }
  2866. else
  2867. {
  2868. rollResult1.Value.Rollingnum = 0;
  2869. }
  2870. }
  2871. else
  2872. { rollResult1.Value.Rollingnum = 0; }
  2873. }
  2874. //交接班支数
  2875. this.rollResult1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString();
  2876. this.rollResult1.UpdateDataForRack();
  2877. }
  2878. }
  2879. /// <summary>
  2880. /// 流通卡赋值
  2881. /// </summary>
  2882. /// <param name="dt"></param>
  2883. public void RollingCardEditGrid(DataTable dt, string heatno)
  2884. {
  2885. if (dt.Rows.Count > 0)
  2886. {
  2887. //上料切前剔除支数
  2888. this.rollingCard1.Value.FeedScrapNum = dt.Rows[0]["SCRAP_FEED"].ToString();
  2889. //上料切前合格支数
  2890. this.rollingCard1.Value.FeedQualifiedNum = dt.Rows[0]["QUALIFIED_FEED"].ToString();
  2891. //上料剔除支数
  2892. this.rollingCard1.Value.FeedScrapDBNum = dt.Rows[0]["SCRAP_DBFEED"].ToString();
  2893. //上料合格支数
  2894. this.rollingCard1.Value.FeedQualifiedDBNum = dt.Rows[0]["QUALIFIED_DBFEED"].ToString();
  2895. //加热炉剔除支数
  2896. this.rollingCard1.Value.FurScrapNum = dt.Rows[0]["SCRAP_FUR"].ToString();
  2897. //加热炉合格支数
  2898. this.rollingCard1.Value.FurQualifiedNum = dt.Rows[0]["QUALIFIED_FUR"].ToString();
  2899. //穿孔剔除支数
  2900. this.rollingCard1.Value.PerScrapNum = dt.Rows[0]["SCRAP_PER"].ToString();
  2901. //穿孔合格支数
  2902. this.rollingCard1.Value.PerQualifiedNum = dt.Rows[0]["QUALIFIED_PER"].ToString();
  2903. //连轧剔除支数
  2904. this.rollingCard1.Value.RollingScrapNum = dt.Rows[0]["SCRAP_ROLLING"].ToString();
  2905. //连轧合格支数
  2906. this.rollingCard1.Value.RollingQualifiedNum = dt.Rows[0]["QUALIFIED_ROLLING"].ToString();
  2907. //再加热炉剔除支数
  2908. this.rollingCard1.Value.RefurScrapNum = dt.Rows[0]["SCRAP_REFUR"].ToString();
  2909. //再加热炉合格支数
  2910. this.rollingCard1.Value.RefurQualifiedNum = dt.Rows[0]["QUALIFIED_REFUR"].ToString();
  2911. //定径剔除支数
  2912. this.rollingCard1.Value.SizingScrapNum = dt.Rows[0]["SCRAP_SIZING"].ToString();
  2913. //定径合格支数
  2914. this.rollingCard1.Value.SizingQualifiedNum = dt.Rows[0]["QUALIFIED_SIZING"].ToString();
  2915. //分切前剔除支数
  2916. this.rollingCard1.Value.SawScrapNumBE = dt.Rows[0]["SCRAP_SAW_BE"].ToString();
  2917. //分切前合格支数
  2918. this.rollingCard1.Value.SawQualifiedNumBE = dt.Rows[0]["QUALIFIED_SAW_BE"].ToString();
  2919. //分切剔除支数
  2920. this.rollingCard1.Value.SawScrapNum = dt.Rows[0]["SCRAP_SAW"].ToString();
  2921. //分切合格支数
  2922. this.rollingCard1.Value.SawQualifiedNum = dt.Rows[0]["QUALIFIED_SAW"].ToString();
  2923. //矫直剔除支数
  2924. this.rollingCard1.Value.StraightScrapNum = dt.Rows[0]["SCRAP_STRAIGHT"].ToString();
  2925. //矫直合格支数
  2926. this.rollingCard1.Value.StraightQualifiedNum = dt.Rows[0]["QUALIFIED_STRAIGHT"].ToString();
  2927. //矫直下线支数
  2928. this.rollingCard1.Value.OfflineStraight = dt.Rows[0]["OFFLINE_STRAIGHT"].ToString();
  2929. //矫直返线支数
  2930. this.rollingCard1.Value.BacklineStraight = dt.Rows[0]["BACKLINE_STRAIGHT"].ToString();
  2931. //探伤剔除支数
  2932. this.rollingCard1.Value.TestingScrapNum = dt.Rows[0]["SCRAP_TESTING"].ToString();
  2933. //探伤合格支数
  2934. this.rollingCard1.Value.TestingQualifiedNum = dt.Rows[0]["QUALIFIED_TESTING"].ToString();
  2935. NativeMethodNew na = new NativeMethodNew(this.ob);
  2936. if (na.isBegineNode(heatno, 8) || na.isBegineNode(heatno, 9) || na.isBegineNode(heatno, 10))
  2937. {
  2938. //探伤下线支数
  2939. this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
  2940. this.rollingCard1.Value.BacklineTesting = dt.Rows[0]["BACKLINE_TESTING"].ToString();
  2941. }
  2942. else
  2943. {
  2944. if (dt.Rows[0]["OFFLINE_TESTING"].ToString() == "0")
  2945. {
  2946. this.rollingCard1.Value.OfflineTesting = "";
  2947. this.rollingCard1.Value.BacklineTesting = "";
  2948. }
  2949. else
  2950. {
  2951. //探伤下线支数
  2952. this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
  2953. this.rollingCard1.Value.BacklineTesting = dt.Rows[0]["BACKLINE_TESTING"].ToString();
  2954. }
  2955. }
  2956. //表检合格支数
  2957. this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
  2958. //表检废品支数
  2959. this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString();
  2960. //表检下线支数
  2961. this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
  2962. //表检返线支数
  2963. //this.rollingCard1.Value.SurfaceBackLineNum= dt.Rows[0]["OFFLINE_TESTING"].ToString();
  2964. this.rollingCard1.UpdateData();
  2965. }
  2966. else
  2967. {
  2968. this.rollingCard1.ClearData();
  2969. }
  2970. }
  2971. /// <summary>
  2972. /// 轧制信息Grid赋值
  2973. /// </summary>
  2974. /// <param name="dt">轧制计划信息datatable</param>
  2975. public void GridEdit(DataTable dt)
  2976. {
  2977. if (dt.Rows.Count > 0)
  2978. {
  2979. DataRow row1 = dt.Rows[0];
  2980. //熔炼炉号
  2981. this.chk.Value.StoveNo = row1["stove_no"].ToString();
  2982. //炉号
  2983. this.chk.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString());
  2984. //生产批号
  2985. this.chk.Value.LotNo = row1["lot_no"].ToString();
  2986. //工序合同号
  2987. this.chk.Value.ContractNo = row1["contract_no"].ToString();
  2988. //执行工艺号
  2989. this.chk.Value.ImpProcess = row1["imp_process"].ToString();
  2990. //执行工艺号路径
  2991. this.chk.Value.ImpProcessPath = row1["imp_process_path"].ToString();
  2992. //产线代码
  2993. this.chk.Value.PlineCode = row1["pline_code"].ToString();
  2994. //状态
  2995. this.chk.Value.Status = row1["STATUS"].ToString();
  2996. //监制
  2997. this.chk.Value.Producer = row1["producer"].ToString();
  2998. //工艺状态
  2999. this.chk.Value.ProcessStatus = row1["process_status"].ToString();
  3000. //单倍长
  3001. this.chk.Value.DbLength = row1["db_length"].ToString();
  3002. //单倍重
  3003. this.chk.Value.DbHeight = row1["db_height"].ToString();
  3004. //轧制长度
  3005. this.chk.Value.RollLength = row1["roll_length"].ToString();
  3006. //分切数
  3007. this.chk.Value.SawNum = row1["saw_num"].ToString();
  3008. //目标长度
  3009. this.chk.Value.TargetLength = row1["target_length"].ToString();
  3010. //最终用户
  3011. this.chk.Value.FinishUser = row1["finish_user"].ToString();
  3012. //目标库
  3013. this.chk.Value.TargetLiabrary = row1["target_liabrary"].ToString();
  3014. //品种
  3015. this.chk.Value.Varieties = row1["varieties"].ToString();
  3016. //成品规格
  3017. this.chk.Value.PipeSize = row1["pipe_size"].ToString();
  3018. //扣型
  3019. this.chk.Value.BuckleType = row1["buckle_type"].ToString();
  3020. //长度范围
  3021. this.chk.Value.LengthRange = row1["length_range"].ToString();
  3022. //轧管判定标准
  3023. this.chk.Value.RollStandrad = row1["roll_standrad"].ToString();
  3024. //断面
  3025. this.chk.Value.PipeSection = row1["pipe_section"].ToString();
  3026. //钢种代码
  3027. this.chk.Value.SteelCode = row1["steelcode"].ToString();
  3028. //钢种名称
  3029. this.chk.Value.SteelName = row1["steelname"].ToString();
  3030. //钢级代码
  3031. this.chk.Value.GradeCode = row1["gradecode"].ToString();
  3032. //钢级名称
  3033. this.chk.Value.GradeName = row1["gradename"].ToString();
  3034. //炼钢判定标准
  3035. this.chk.Value.SteelStandrad = row1["steel_standrad"].ToString();
  3036. //去向
  3037. this.chk.Value.Target = row1["target"].ToString();
  3038. //支
  3039. this.chk.Value.PlanNum = row1["BRANCH"].ToString();
  3040. //吨
  3041. this.chk.Value.PlanTon = row1["TON"].ToString();
  3042. //切损去向
  3043. this.chk.Value.CutTarget = row1["cut_target"].ToString();
  3044. //切损长度
  3045. this.chk.Value.CutLength = row1["cut_length"].ToString();
  3046. //切损重量
  3047. this.chk.Value.CutHeight = row1["CUT_WEIGHT"].ToString();
  3048. //倍尺数
  3049. this.chk.Value.DbNum = row1["DB_NUM"].ToString();
  3050. //标准类别代码
  3051. this.chk.Value.StdStyle = row1["STD_STYLE"].ToString();
  3052. //标准类别描述
  3053. this.chk.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString();
  3054. //成品备注
  3055. this.chk.Value.ReMark = row1["ReMark"].ToString();
  3056. this.chk.UpdateData();
  3057. }
  3058. }
  3059. #endregion
  3060. #region 报表
  3061. /// <summary>
  3062. /// 打印报表
  3063. /// </summary>
  3064. private void PrintResult()
  3065. {
  3066. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  3067. string Time = SeverTime.ToLongTimeString();
  3068. string StartTime = "";
  3069. string EndTime = "";
  3070. string strurl = "";
  3071. Time = Time.Replace(":", "");
  3072. //晚班
  3073. if (Shift == "3")
  3074. {
  3075. //查询晚班前一天20点40后到当天07点20前所有记录
  3076. if (int.Parse(Time) < 072000)
  3077. {
  3078. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
  3079. EndTime = SeverTime.ToShortDateString() + " 07:20:00";
  3080. //string Date2 = SeverTime.ToString("yyyy-MM-dd");
  3081. //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  3082. }
  3083. //查询当天晚班的所有数据
  3084. else if (int.Parse(Time) > 204000)
  3085. {
  3086. StartTime = SeverTime.ToShortDateString() + " 20:40:00";
  3087. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
  3088. //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  3089. }
  3090. }
  3091. //白班 中班
  3092. else
  3093. {
  3094. StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  3095. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  3096. //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  3097. }
  3098. switch (PlineCode)
  3099. {
  3100. case "C008": //250
  3101. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  3102. break;
  3103. case "C009": //258
  3104. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult258.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  3105. break;
  3106. case "C010": //168
  3107. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  3108. break;
  3109. case "C012": //Arssel
  3110. break;
  3111. case "C017": //460
  3112. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult460.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  3113. break;
  3114. case "C072": //508
  3115. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult508.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  3116. break;
  3117. }
  3118. FrmRepExcel fre = new FrmRepExcel(ob, strurl);
  3119. fre.AutoSize = true;
  3120. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  3121. fre.WindowState = FormWindowState.Maximized;
  3122. fre.Show();
  3123. }
  3124. /// <summary>
  3125. /// 查询上个班原始记录
  3126. /// </summary>
  3127. private void QueryBefore()
  3128. {
  3129. HOTMethod hm = new HOTMethod(this.ob);
  3130. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  3131. string Time = SeverTime.ToLongTimeString();
  3132. string Date = "";
  3133. if (Shift == "3")
  3134. {
  3135. Time = Time.Replace(":", "");
  3136. if (int.Parse(Time) < 122000)
  3137. {
  3138. Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
  3139. }
  3140. else
  3141. {
  3142. Date = SeverTime.ToString("yyyyMMdd");
  3143. }
  3144. }
  3145. if (Shift == "1" || Shift == "0")
  3146. {
  3147. Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
  3148. }
  3149. else
  3150. {
  3151. Date = SeverTime.ToString("yyyyMMdd");
  3152. }
  3153. string StartTime = ""; // 开始时间 用于报表查询
  3154. string EndTime = ""; // 结束时间 用于报表查询
  3155. string StartTimeU = ""; // 开始时间 用于得到上班UserID
  3156. string EndTimeU = ""; // 结束时间 用于得到上班UserID
  3157. string strurl = "";
  3158. string ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date, PlineCode);
  3159. //if (PlineCode.Equals("C072"))
  3160. //{
  3161. // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date);
  3162. //}
  3163. //else
  3164. //{
  3165. // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group);
  3166. //}
  3167. string UserIDBefore = "";
  3168. //晚班
  3169. Time = Time.Replace(":", "");
  3170. if (Shift == "3")
  3171. {
  3172. //查询晚班前一天中班所有记录
  3173. if (int.Parse(Time) < 122000)
  3174. {
  3175. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
  3176. EndTime = SeverTime.ToShortDateString() + " 00:00:00";
  3177. //string Date2 = SeverTime.ToString("yyyy-MM-dd");
  3178. StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
  3179. EndTimeU = SeverTime.ToShortDateString() + " 00:00:00";
  3180. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 3, PlineCode);
  3181. //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  3182. }
  3183. //查询当天中班的所有数据
  3184. else if (int.Parse(Time) > 204000)
  3185. {
  3186. StartTime = SeverTime.ToShortDateString() + " 13:40:00";
  3187. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  3188. StartTimeU = SeverTime.ToShortDateString() + " 13:40:00";
  3189. EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  3190. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 3, PlineCode);
  3191. //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  3192. }
  3193. }
  3194. //白班
  3195. else if (Shift == "1")
  3196. {
  3197. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
  3198. EndTime = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
  3199. StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
  3200. EndTimeU = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
  3201. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 3, PlineCode);
  3202. }
  3203. //中班
  3204. else
  3205. {
  3206. StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  3207. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  3208. StartTimeU = SeverTime.ToShortDateString() + " 00:00:00";
  3209. EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  3210. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 3, PlineCode);
  3211. //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  3212. }
  3213. switch (PlineCode)
  3214. {
  3215. case "C008": //250
  3216. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult250.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  3217. break;
  3218. case "C009": //258
  3219. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult258.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  3220. break;
  3221. case "C010": //168
  3222. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult168.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  3223. break;
  3224. case "C012": //Arssel
  3225. break;
  3226. case "C017": //460
  3227. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult460.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  3228. break;
  3229. case "C072": //508
  3230. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult508.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  3231. break;
  3232. }
  3233. FrmRepExcel fre = new FrmRepExcel(ob, strurl);
  3234. fre.AutoSize = true;
  3235. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  3236. fre.WindowState = FormWindowState.Maximized;
  3237. fre.Show();
  3238. }
  3239. #endregion
  3240. }
  3241. }