FrmPerforationResult.cs 126 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664
  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.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using com.steering.mes.zgmil.entity;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Core.Mes.Client.Comm.Tool;
  15. using Core.StlMes.Client.ZGMil.Entity;
  16. using System.Net;
  17. using Core.StlMes.Client.ZGMil.NodeResultQuery;
  18. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  19. using System.Collections;
  20. using Core.StlMes.Client.ZGMil.Popup;
  21. using Core.StlMes.Client.ZGMil.Common;
  22. using CoreFS.SA06;
  23. namespace Core.StlMes.Client.ZGMil.Result
  24. {
  25. public partial class FrmPerforationResult : FrmBase
  26. {
  27. private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
  28. #region 初始化
  29. int PanelSizeFlag = 0;
  30. RollingInfomation rf = new RollingInfomation();
  31. FeedRowPlan QuertFeedplan = new FeedRowPlan();
  32. MilPlan QueryMainPlan = new MilPlan();
  33. FeedRowPlan Feedplan = new FeedRowPlan();
  34. MilPlan MainPlan = new MilPlan();
  35. SawResult FeedSawResult = new SawResult();
  36. private string ActiveResultNo = "";
  37. private string proPlanId = null;//轧管订单编号
  38. private string gxPlanNo = null;//工序排产序号
  39. private string lotNo = null;//生产批号
  40. private int _MouseLocX = 0; //鼠标横坐标
  41. private int _MouseLocY = 0; //鼠标纵坐标
  42. private string ChangeUserID = ""; //接班用户名
  43. private string ChangePassWord = ""; //接班密码
  44. private int ShowMessageFlag = 0; //保存弹窗标识 0 弹出 1 不弹出
  45. MilPerforationResultEntity tempperforation = new MilPerforationResultEntity();
  46. private string ActiveJUDGE_STOVE_NO = null;//主计划活动行的判定炉号
  47. private string ActiveStatus = null;//主计划活动行的状态
  48. string Shift = "";
  49. string Group = "";
  50. private string Departm = "";//部门
  51. private string PlineCode = "";//产线
  52. string PlanStatusQuery = "29";
  53. string PlanStartStatusQuery = "00"; //查询结炉实绩起始状态
  54. private string _UserName = "";
  55. private string _UserID = "";
  56. private string _Url = "";
  57. private int ChangeFlag = 0; //交班标识
  58. public FrmPerforationResult()
  59. {
  60. InitializeComponent();
  61. //this.perforationResult1.UltraGrid1.ClickCellButton += new CellEventHandler(UltraGrid1_ClickCellButton);
  62. //获取鼠标坐标
  63. Point formPoint = this.PointToClient(Control.MousePosition);
  64. _MouseLocX = Convert.ToInt32(formPoint.X);
  65. _MouseLocY = Convert.ToInt32(formPoint.Y);
  66. }
  67. /// <summary>
  68. /// 定时器事件
  69. /// </summary>
  70. /// <param name="sender"></param>
  71. /// <param name="e"></param>
  72. void timer1_Tick(object sender, EventArgs e)
  73. {
  74. int MouseLocX = 0;
  75. int MouseLocY = 0;
  76. //获取当前鼠标坐标
  77. //获取鼠标坐标
  78. Point formPoint = this.PointToClient(Control.MousePosition);
  79. MouseLocX = Convert.ToInt32(formPoint.X);
  80. MouseLocY = Convert.ToInt32(formPoint.Y);
  81. if (MouseLocX == _MouseLocX && MouseLocY == _MouseLocY)
  82. {
  83. ShowMessageFlag = 1;
  84. PlanQuery();
  85. ShowMessageFlag = 0;
  86. }
  87. else
  88. {
  89. _MouseLocX = MouseLocX;
  90. _MouseLocY = MouseLocY;
  91. }
  92. }
  93. /// <summary>
  94. /// 交班取消
  95. /// </summary>
  96. private void ChangeCancel()
  97. {
  98. string JudgeStoveNo = "";
  99. string Status = "";
  100. string ResultNo = "";
  101. UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
  102. if (ugr != null)
  103. {
  104. JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  105. Status = ugr.Cells["IS_START"].Value.ToString();
  106. ResultNo = ugr.Cells["ID"].Value.ToString();
  107. if (Status == "穿孔完成")
  108. {
  109. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成穿孔操作,不允许交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  110. return;
  111. }
  112. if (Status == "未开始穿孔")
  113. {
  114. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始穿孔,不允许交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  115. return;
  116. }
  117. NativeMethodNew nass = new NativeMethodNew(this.ob);
  118. nass.ChangeShiftBack(JudgeStoveNo, ResultNo, proPlanId, gxPlanNo, PlineCode, Shift, Group, 2);
  119. ultraGridTC();
  120. DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.getPerResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  121. if (dtFurResult.Rows.Count > 0)
  122. {
  123. PerResultEditForRack(dtFurResult);
  124. }
  125. GetGridButtonName();
  126. ChangeGridColor();
  127. }
  128. }
  129. protected override void OnLoad(EventArgs e)
  130. {
  131. Shift = UserInfo.GetUserOrder();
  132. Group = UserInfo.GetUserGroup();
  133. base.OnLoad(e);
  134. foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
  135. {
  136. ugc.SortIndicator = SortIndicator.Disabled;
  137. }
  138. rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  139. rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  140. perforationResult1.UltraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  141. ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  142. ultraGrid_GHDL.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  143. PanelSizeFlag = 0;
  144. splitContainer2.SplitterDistance = 180;
  145. InitControl();
  146. timer1.Tick += new EventHandler(timer1_Tick);
  147. ShowShift();
  148. }
  149. private void ShowShift()
  150. {
  151. colShowShiftGroup1.Ob = this.ob;
  152. colShowShiftGroup1.Group = this.UserInfo.GetUserGroup();
  153. colShowShiftGroup1.Shift = this.UserInfo.GetUserOrder();
  154. colShowShiftGroup1.ShowShift();
  155. colShowShiftGroup1.Timer1.Enabled = true;
  156. }
  157. public void InitControl()
  158. {
  159. if (chkLotNo.Checked)
  160. {
  161. txtLOT_NO.Enabled = true;
  162. }
  163. else
  164. {
  165. txtLOT_NO.Enabled = false;
  166. }
  167. if (chkHeatNo.Checked)
  168. {
  169. txtJudgeStoveNo.Enabled = true;
  170. }
  171. else
  172. {
  173. txtJudgeStoveNo.Enabled = false;
  174. }
  175. GetGridButtonName();
  176. }
  177. /// <summary>
  178. /// 页面开启事件
  179. /// </summary>
  180. /// <param name="e"></param>
  181. protected override void OnShown(EventArgs e)
  182. {
  183. base.OnShown(e);
  184. string hostname = Dns.GetHostName();
  185. IPAddress ip = Dns.GetHostByName(hostname).AddressList[0];
  186. NativeMethodNew na = new NativeMethodNew(this.ob);
  187. Departm = UserInfo.GetDepartment();
  188. PlineCode = na.GetPCode(Departm);//获取 用户 对应的产线
  189. if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017") || PlineCode.Equals("C072"))
  190. {
  191. this.rollingCard1.ChangCard();
  192. }
  193. switch (PlineCode)
  194. {
  195. case "C008":
  196. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["bite_angle"].Header.Caption = "轧辊倾角";
  197. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["dp_gg"].Header.Caption = "导盘中径";
  198. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_up"].Header.Caption = "导盘位置左";
  199. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_down"].Header.Caption = "导盘位置右";
  200. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_loca"].CellActivation = Activation.NoEdit;
  201. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_loca"].Header.Appearance.ForeColor = Color.Gray;
  202. break;
  203. case "C009":
  204. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_speed"].CellActivation = Activation.NoEdit;
  205. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_speed"].Header.Appearance.ForeColor = Color.Gray;
  206. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["dt_code"].CellActivation = Activation.NoEdit;
  207. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["dt_code"].Header.Appearance.ForeColor = Color.Gray;
  208. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_loca"].CellActivation = Activation.NoEdit;
  209. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_disc_motor_loca"].Header.Appearance.ForeColor = Color.Gray;
  210. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["roller_space"].CellActivation = Activation.NoEdit;
  211. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["guide_space"].CellActivation = Activation.NoEdit;
  212. break;
  213. case "C010":
  214. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].Header.Caption = "毛管名义尺寸(DxS)";
  215. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].CellActivation = Activation.AllowEdit;
  216. break;
  217. case "C017":
  218. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].Header.Caption = "毛管名义尺寸(DxS)";
  219. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].CellActivation = Activation.AllowEdit;
  220. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_loca_up"].CellActivation = Activation.NoEdit;
  221. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_loca_up"].Header.Appearance.ForeColor = Color.Gray;
  222. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_loca_down"].CellActivation = Activation.NoEdit;
  223. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_loca_down"].Header.Appearance.ForeColor = Color.Gray;
  224. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_up"].CellActivation = Activation.NoEdit;
  225. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_up"].Header.Appearance.ForeColor = Color.Gray;
  226. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_down"].CellActivation = Activation.NoEdit;
  227. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["db_loca_down"].Header.Appearance.ForeColor = Color.Gray;
  228. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["head_diameter"].Header.Caption = "顶头代号";
  229. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["head_diameter"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Default;
  230. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["head_diameter"].MaskInput = "";
  231. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["head_diameter"].MaxLength = 20;
  232. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["roll_motor_speed"].Header.Caption = "轧辊转速(rpm)";
  233. break;
  234. case "C072":
  235. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].Header.Caption = "毛管名义尺寸(DxS)";
  236. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["CapillarySize"].CellActivation = Activation.AllowEdit;
  237. perforationResult1.UltraGrid1.DisplayLayout.Bands[0].Columns["zg_zj"].CellActivation = Activation.AllowEdit;
  238. break;
  239. }
  240. Sign();
  241. frmTechnological1.InitMilSet(PlineCode, "40050", this.ob);
  242. PlanQuery();
  243. }
  244. /// <summary>
  245. /// 签名
  246. /// </summary>
  247. private void Sign()
  248. {
  249. ColUserName col = new ColUserName();
  250. col.StationId = "2";
  251. col.PlineCode = PlineCode;
  252. col.ColGroup = Group;
  253. col.Ob = this.ob;
  254. col.ShowDialog();
  255. _UserID = col.getUserId();
  256. _UserName = col.getUserName();
  257. }
  258. private void chkHeatNo_CheckedChanged(object sender, EventArgs e)
  259. {
  260. if (this.chkHeatNo.Checked)
  261. {
  262. this.txtJudgeStoveNo.Enabled = true;
  263. }
  264. else
  265. {
  266. this.txtJudgeStoveNo.Enabled = false;
  267. }
  268. }
  269. /// <summary>
  270. /// checkbox点击事件
  271. /// </summary>
  272. /// <param name="sender"></param>
  273. /// <param name="e"></param>
  274. //private void chkDate_CheckedChanged(object sender, EventArgs e)
  275. //{
  276. // if (chkLotNo.Checked)
  277. // {
  278. // txtLOT_NO.Enabled = true;
  279. // }
  280. // else
  281. // {
  282. // txtLOT_NO.Enabled = false;
  283. // }
  284. // if (chkHeatNo.Checked)
  285. // {
  286. // txtJudgeStoveNo.Enabled = true;
  287. // }
  288. // else
  289. // {
  290. // txtJudgeStoveNo.Enabled = false;
  291. // }
  292. //}
  293. public void GetGridButtonName()
  294. {
  295. if (ultraGrid_GHDL.Rows.Count > 0)
  296. {
  297. foreach (UltraGridRow ugr in ultraGrid_GHDL.Rows)
  298. {
  299. ugr.Cells["SCRAP_SLAB"].Value = "剔除管坯";
  300. ugr.Cells["DELBACK"].Value = "剔料回退";
  301. }
  302. }
  303. if (ultraGridPlan.Rows.Count > 0)
  304. {
  305. foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  306. {
  307. NativeMethodNew NaMethod = new NativeMethodNew(this.ob);
  308. string Judge_Stove_No = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  309. //if (NaMethod.isBegineNode(Judge_Stove_No, 0))
  310. //{
  311. // ugr.Appearance.BackColor = Color.YellowGreen;
  312. //}
  313. if (ugr.Cells["IS_START"].Value.ToString() != "未开始穿孔" && ugr.Cells["IS_START"].Value.ToString() != "已开始穿孔" && ugr.Cells["IS_START"].Value.ToString() != "穿孔完成")
  314. {
  315. switch (Convert.ToInt32(ugr.Cells["IS_START"].Value))
  316. {
  317. case 3:
  318. ugr.Cells["IS_START"].Value = "未开始穿孔";
  319. break;
  320. case 0:
  321. ugr.Cells["IS_START"].Value = "已开始穿孔";
  322. break;
  323. case 1:
  324. ugr.Cells["IS_START"].Value = "穿孔完成";
  325. break;
  326. }
  327. }
  328. }
  329. }
  330. }
  331. public override void ToolBar_Click(object sender, string ToolbarKey)
  332. {
  333. switch (ToolbarKey)
  334. {
  335. case "DoQuery":
  336. if (chkHeatNo.Checked)
  337. {
  338. if (string.IsNullOrEmpty(txtJudgeStoveNo.Text))
  339. {
  340. MessageBox.Show("请输入需查询的炉号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  341. return;
  342. }
  343. }
  344. if (this.chkLotNo.Checked)
  345. {
  346. if (string.IsNullOrEmpty(this.txtLOT_NO.Text))
  347. {
  348. MessageBox.Show("请输入需查询的轧批号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  349. return;
  350. }
  351. }
  352. PlanQuery();
  353. break;
  354. case "DoSave":
  355. PerResultSave();
  356. break;
  357. case "DoNode":
  358. FeedSawResultNode();
  359. break;
  360. case "DoNodeBack":
  361. NodeBack();
  362. break;
  363. case "DoQueryBefore":
  364. QueryBefore();
  365. break;
  366. case "DoStart":
  367. DoStart();
  368. break;
  369. case "DoStartBack":
  370. StartBack();
  371. break;
  372. case "NodeQuery":
  373. NodeQuery();
  374. break;
  375. case "DoToolChange":
  376. DoToolChange();
  377. break;
  378. case "DoSign":
  379. Sign();
  380. break;
  381. case "DoChangeCancel":
  382. ChangeCancel();
  383. break;
  384. case "DoPrint":
  385. PrintResult();
  386. break;
  387. case "Close":
  388. this.Dispose();
  389. this.Close();
  390. break;
  391. }
  392. }
  393. public void PlanQuery()
  394. {
  395. string PrimaKey = "";
  396. UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
  397. if (ugr != null)
  398. {
  399. PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  400. }
  401. //if (dtStartDate.DateTime > dtEndDate.DateTime)
  402. //{
  403. // MessageBox.Show("开始时间不能大于结束时间。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  404. //}
  405. //if (chkDate.Checked == true)
  406. //{
  407. // QueryMainPlan.StartTime = this.dtStartDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
  408. // QueryMainPlan.EndTime = this.dtEndDate.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
  409. //}
  410. //else
  411. //{
  412. // QueryMainPlan.StartTime = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
  413. // QueryMainPlan.EndTime = DateTime.Now.AddDays(+1).ToString("yyyy-MM-dd HH:mm:ss");
  414. //}
  415. if (chkHeatNo.Checked == true)
  416. {
  417. QueryMainPlan.JudgeStoveNo = this.txtJudgeStoveNo.Text;
  418. }
  419. else
  420. {
  421. QueryMainPlan.JudgeStoveNo = "";
  422. }
  423. if (chkLotNo.Checked == true)
  424. {
  425. QueryMainPlan.LotNo = this.txtLOT_NO.Text;
  426. }
  427. else
  428. {
  429. QueryMainPlan.LotNo = "";
  430. }
  431. dtPlan.Clear();
  432. //查询主表记录
  433. QueryMainPlan.PlineCode = PlineCode;
  434. QueryMainPlan.Status = PlanStatusQuery;
  435. QueryMainPlan.StartStatus = PlanStartStatusQuery;
  436. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 3 }, this.ob);
  437. GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
  438. //ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
  439. GetGridButtonName();
  440. ChangeGridColor();
  441. if (dt.Rows.Count > 0)
  442. {
  443. if (ugr != null)
  444. {
  445. foreach (UltraGridRow ugr1 in ultraGridPlan.Rows)
  446. {
  447. //ugr1.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString());
  448. if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
  449. {
  450. ugr1.Activated = true;
  451. }
  452. }
  453. }
  454. }
  455. else
  456. {
  457. if (ShowMessageFlag == 1)
  458. {
  459. MessageBox.Show("没有查询的数据!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  460. }
  461. }
  462. }
  463. private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e)
  464. {
  465. dtTC.Clear();
  466. if (this.dtPlan.Rows.Count > 0)
  467. {
  468. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  469. //UltraGridRow ugr = e.Row;
  470. if (ugr != null)
  471. {
  472. //查询主计划信息
  473. string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  474. proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
  475. gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
  476. lotNo = ugr.Cells["LOT_NO"].Value.ToString();
  477. MainPlan.JudgeStoveNo = HeatNo;
  478. MainPlan.ProPlanId = proPlanId;
  479. MainPlan.GxPlanNo = gxPlanNo;
  480. ActiveJUDGE_STOVE_NO = HeatNo;
  481. ActiveStatus = ugr.Cells["IS_START"].Value.ToString();
  482. ActiveResultNo = ugr.Cells["ID"].Value.ToString();
  483. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
  484. GetRollingCard();
  485. if (ugr.Cells["IS_START"].Value.ToString() != "未开始穿孔")
  486. {
  487. ultraGridTC();
  488. }
  489. else
  490. {
  491. dtTC.Clear();
  492. }
  493. if (dtMP.Rows.Count > 0)
  494. {
  495. GridEdit(dtMP); //轧制计划信息
  496. }
  497. GetGridButtonName();
  498. ChangeGridColor();
  499. DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.getPerResult", new object[] { HeatNo, proPlanId, gxPlanNo }, this.ob);
  500. if (dtFurResult.Rows.Count > 0)
  501. {
  502. PerResultEdit(dtFurResult, dtMP);
  503. }
  504. else
  505. {
  506. MilPerforationResultEntity pr = new MilPerforationResultEntity();
  507. this.perforationResult1.Value = pr;
  508. }
  509. }
  510. }
  511. }
  512. public void PerResultEdit(DataTable dt, DataTable dtMP)
  513. {
  514. UltraGridRow ugr = this.rollingCard1.UltraGrid4.Rows[0];
  515. if (dt.Rows.Count == 0)
  516. {
  517. MilPerforationResultEntity pr = new MilPerforationResultEntity();
  518. this.perforationResult1.Value = pr;
  519. }
  520. else
  521. {
  522. UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
  523. string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
  524. string ResultNo = ugr1.Cells["ID"].Value.ToString();
  525. perforationResult1.Value.ScrapNum = "0";
  526. //查询本道工序剔除支数
  527. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
  528. if (dtScrapNum.Rows.Count > 0)
  529. {
  530. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  531. {
  532. perforationResult1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  533. }
  534. }
  535. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
  536. if (dtQANum.Rows.Count > 0)
  537. {
  538. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  539. {
  540. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(perforationResult1.Value.ScrapNum.ToString()))
  541. {
  542. //合格支数
  543. perforationResult1.Value.PerforationNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(perforationResult1.Value.ScrapNum.ToString());
  544. }
  545. else
  546. {
  547. perforationResult1.Value.PerforationNum = 0;
  548. }
  549. }
  550. else
  551. { perforationResult1.Value.PerforationNum = 0; }
  552. }
  553. this.perforationResult1.Value.JzbNum = dt.Rows[0]["jzb_num"].ToString();
  554. this.perforationResult1.Value.FrontExtendingQuantity = dt.Rows[0]["front_extending_quantity"].ToString();
  555. this.perforationResult1.Value.RollerSpace = dt.Rows[0]["roller_space"].ToString();
  556. this.perforationResult1.Value.GuideSpace = dt.Rows[0]["guide_space"].ToString();
  557. if (PlineCode == "C008" || PlineCode == "C009")
  558. {
  559. if (dtMP != null)
  560. {
  561. this.perforationResult1.Value.CapillarySize = dtMP.Rows[0]["PIPE_SECTION"].ToString() + "x" + dtMP.Rows[0]["DB_LENGTH"].ToString();
  562. }
  563. }
  564. else
  565. {
  566. this.perforationResult1.Value.CapillarySize = dt.Rows[0]["CAPILLARY_SIZE"].ToString();
  567. }
  568. this.perforationResult1.Value.CapollaryWallThickness = dt.Rows[0]["capollary_wall_thickness"].ToString();
  569. this.perforationResult1.Value.BiteAngle = dt.Rows[0]["bite_angle"].ToString();
  570. this.perforationResult1.Value.GuideDiscMotorSpeed = dt.Rows[0]["guide_disc_motor_speed"].ToString();
  571. this.perforationResult1.Value.HeadDiameter = dt.Rows[0]["head_diameter"].ToString();
  572. this.perforationResult1.Value.RollMotorSpeed = dt.Rows[0]["roll_motor_speed"].ToString();
  573. this.perforationResult1.Value.RollMotorSjb = dt.Rows[0]["roll_motor_sjb"].ToString();
  574. this.perforationResult1.Value.KzTemp = dt.Rows[0]["kz_temp"].ToString();
  575. this.perforationResult1.Value.AmountOfBorax = dt.Rows[0]["AMOUNT_OF_BORAX"].ToString();
  576. this.perforationResult1.Value.Remark = dt.Rows[0]["Remark"].ToString();
  577. this.perforationResult1.Value.StartTime = dt.Rows[0]["start_time"].ToString();
  578. this.perforationResult1.Value.EndTime = dt.Rows[0]["end_time"].ToString();
  579. this.perforationResult1.Value.BoraxPressure = dt.Rows[0]["borax_pressure"].ToString();
  580. this.perforationResult1.Value.GuideDiscMotorLoca = dt.Rows[0]["guide_disc_motor_loca"].ToString();
  581. this.perforationResult1.Value.DbLoca = dt.Rows[0]["db_loca"].ToString();
  582. this.perforationResult1.Value.DbLocaDown = dt.Rows[0]["db_loca_down"].ToString();
  583. this.perforationResult1.Value.DpGg = dt.Rows[0]["dp_gg"].ToString();
  584. this.perforationResult1.Value.DtCode = dt.Rows[0]["dt_code"].ToString();
  585. this.perforationResult1.Value.ZgZj = dt.Rows[0]["zg_zj"].ToString();
  586. this.perforationResult1.Value.ZgLocaDown = dt.Rows[0]["zg_loca_down"].ToString();
  587. this.perforationResult1.Value.ZgLocaUp = dt.Rows[0]["zg_loca_up"].ToString();
  588. this.perforationResult1.Value.BeginRollingTemp = dt.Rows[0]["BEGIN_ROLLING_TEMP"].ToString();
  589. //this.perforationResult1.Value.ca
  590. this.perforationResult1.UpdateData();
  591. }
  592. if (!string.IsNullOrEmpty(ugr.Cells["ScrapNum4"].Value.ToString()))
  593. {
  594. this.perforationResult1.Value.ScrapNum = ugr.Cells["ScrapNum4"].Value.ToString();
  595. }
  596. else
  597. {
  598. this.perforationResult1.Value.ScrapNum = "0";
  599. }
  600. if (!string.IsNullOrEmpty(ugr.Cells["QualifiedNum4"].Value.ToString()))
  601. {
  602. this.perforationResult1.Value.PerforationNum = ugr.Cells["QualifiedNum4"].Value.ToString();
  603. }
  604. else
  605. {
  606. this.perforationResult1.Value.PerforationNum = "0";
  607. }
  608. }
  609. public void PerResultEditForRack(DataTable dt)
  610. {
  611. UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
  612. string JudgeStoveNo = ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString();
  613. string ResultNo = ugr1.Cells["ID"].Value.ToString();
  614. perforationResult1.Value.ScrapNum = "0";
  615. //查询本道工序剔除支数
  616. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
  617. if (dtScrapNum.Rows.Count > 0)
  618. {
  619. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  620. {
  621. perforationResult1.Value.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  622. }
  623. }
  624. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
  625. if (dtQANum.Rows.Count > 0)
  626. {
  627. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  628. {
  629. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(perforationResult1.Value.ScrapNum.ToString()))
  630. {
  631. //合格支数
  632. perforationResult1.Value.PerforationNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(perforationResult1.Value.ScrapNum.ToString());
  633. }
  634. else
  635. {
  636. perforationResult1.Value.PerforationNum = 0;
  637. }
  638. }
  639. else
  640. { perforationResult1.Value.PerforationNum = 0; }
  641. }
  642. this.perforationResult1.Value.JzbNum = dt.Rows[0]["jzb_num"].ToString();
  643. this.perforationResult1.UpdateDataForRack();
  644. }
  645. /// <summary>
  646. /// 判断是否能开始当前炉次
  647. /// </summary>
  648. /// <returns></returns>
  649. private bool IsStart()
  650. {
  651. bool Start = true;
  652. foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  653. {
  654. if (ugr.Cells["IS_START"].Value.ToString() == "已开始穿孔")
  655. {
  656. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString()) + "】正在穿孔,不能两炉同时开始穿孔。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  657. Start = false;
  658. }
  659. }
  660. return Start;
  661. }
  662. public void GetRollingCard()
  663. {
  664. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  665. if (ugr != null)
  666. {
  667. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  668. DataTable dt = new DataTable();
  669. if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017"))
  670. {
  671. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  672. }
  673. else
  674. {
  675. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  676. }
  677. RollingCardEditGrid(dt, JudgeStoveNo);
  678. }
  679. }
  680. /// <summary>
  681. /// 轧制信息Grid赋值
  682. /// </summary>
  683. /// <param name="dt">轧制计划信息datatable</param>
  684. public void GridEdit(DataTable dt)
  685. {
  686. if (dt.Rows.Count > 0)
  687. {
  688. DataRow row1 = dt.Rows[0];
  689. //熔炼炉号
  690. this.rollingInfomation1.Value.StoveNo = row1["stove_no"].ToString();
  691. //炉号
  692. this.rollingInfomation1.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString());
  693. //生产批号
  694. this.rollingInfomation1.Value.LotNo = row1["lot_no"].ToString();
  695. //工序合同号
  696. this.rollingInfomation1.Value.ContractNo = row1["contract_no"].ToString();
  697. //执行工艺号
  698. this.rollingInfomation1.Value.ImpProcess = row1["imp_process"].ToString();
  699. //执行工艺号路径
  700. this.rollingInfomation1.Value.ImpProcessPath = row1["imp_process_path"].ToString();
  701. //产线代码
  702. this.rollingInfomation1.Value.PlineCode = row1["pline_code"].ToString();
  703. //状态
  704. this.rollingInfomation1.Value.Status = row1["STATUS"].ToString();
  705. //监制
  706. this.rollingInfomation1.Value.Producer = row1["producer"].ToString();
  707. //工艺状态
  708. this.rollingInfomation1.Value.ProcessStatus = row1["process_status"].ToString();
  709. //单倍长
  710. this.rollingInfomation1.Value.DbLength = row1["db_length"].ToString();
  711. //单倍重
  712. this.rollingInfomation1.Value.DbHeight = row1["db_height"].ToString();
  713. //轧制长度
  714. this.rollingInfomation1.Value.RollLength = row1["roll_length"].ToString();
  715. //分切数
  716. this.rollingInfomation1.Value.SawNum = row1["saw_num"].ToString();
  717. //目标长度
  718. this.rollingInfomation1.Value.TargetLength = row1["target_length"].ToString();
  719. //最终用户
  720. this.rollingInfomation1.Value.FinishUser = row1["finish_user"].ToString();
  721. //目标库
  722. this.rollingInfomation1.Value.TargetLiabrary = row1["target_liabrary"].ToString();
  723. //品种
  724. this.rollingInfomation1.Value.Varieties = row1["varieties"].ToString();
  725. //成品规格
  726. this.rollingInfomation1.Value.PipeSize = row1["pipe_size"].ToString();
  727. //扣型
  728. this.rollingInfomation1.Value.BuckleType = row1["buckle_type"].ToString();
  729. //长度范围
  730. this.rollingInfomation1.Value.LengthRange = row1["length_range"].ToString();
  731. //轧管判定标准
  732. this.rollingInfomation1.Value.RollStandrad = row1["roll_standrad"].ToString();
  733. //断面
  734. this.rollingInfomation1.Value.PipeSection = row1["pipe_section"].ToString();
  735. //钢种代码
  736. this.rollingInfomation1.Value.SteelCode = row1["steelcode"].ToString();
  737. //钢种名称
  738. this.rollingInfomation1.Value.SteelName = row1["steelname"].ToString();
  739. //钢级代码
  740. this.rollingInfomation1.Value.GradeCode = row1["gradecode"].ToString();
  741. //钢级名称
  742. this.rollingInfomation1.Value.GradeName = row1["gradename"].ToString();
  743. //炼钢判定标准
  744. this.rollingInfomation1.Value.SteelStandrad = row1["steel_standrad"].ToString();
  745. //去向
  746. this.rollingInfomation1.Value.Target = row1["target"].ToString();
  747. //支
  748. this.rollingInfomation1.Value.PlanNum = row1["BRANCH"].ToString();
  749. //吨
  750. this.rollingInfomation1.Value.PlanTon = row1["TON"].ToString();
  751. //切损去向
  752. this.rollingInfomation1.Value.CutTarget = row1["cut_target"].ToString();
  753. //切损长度
  754. this.rollingInfomation1.Value.CutLength = row1["cut_length"].ToString();
  755. //切损重量
  756. this.rollingInfomation1.Value.CutHeight = row1["CUT_WEIGHT"].ToString();
  757. //倍尺数
  758. this.rollingInfomation1.Value.DbNum = row1["DB_NUM"].ToString();
  759. //标准类别代码
  760. this.rollingInfomation1.Value.StdStyle = row1["STD_STYLE"].ToString();
  761. //标准类别描述
  762. this.rollingInfomation1.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString();
  763. //成品备注
  764. this.rollingInfomation1.Value.ReMark = row1["ReMark"].ToString();
  765. this.rollingInfomation1.UpdateData();
  766. }
  767. }
  768. /// <summary>
  769. /// 流通卡赋值
  770. /// </summary>
  771. /// <param name="dt"></param>
  772. public void RollingCardEditGrid(DataTable dt, string heatno)
  773. {
  774. if (dt.Rows.Count > 0)
  775. {
  776. //上料切前剔除支数
  777. this.rollingCard1.Value.FeedScrapNum = dt.Rows[0]["SCRAP_FEED"].ToString();
  778. //上料切前合格支数
  779. this.rollingCard1.Value.FeedQualifiedNum = dt.Rows[0]["QUALIFIED_FEED"].ToString();
  780. //上料剔除支数
  781. this.rollingCard1.Value.FeedScrapDBNum = dt.Rows[0]["SCRAP_DBFEED"].ToString();
  782. //上料合格支数
  783. this.rollingCard1.Value.FeedQualifiedDBNum = dt.Rows[0]["QUALIFIED_DBFEED"].ToString();
  784. //加热炉剔除支数
  785. this.rollingCard1.Value.FurScrapNum = dt.Rows[0]["SCRAP_FUR"].ToString();
  786. //加热炉合格支数
  787. this.rollingCard1.Value.FurQualifiedNum = dt.Rows[0]["QUALIFIED_FUR"].ToString();
  788. //穿孔剔除支数
  789. this.rollingCard1.Value.PerScrapNum = dt.Rows[0]["SCRAP_PER"].ToString();
  790. //穿孔合格支数
  791. this.rollingCard1.Value.PerQualifiedNum = dt.Rows[0]["QUALIFIED_PER"].ToString();
  792. //连轧剔除支数
  793. this.rollingCard1.Value.RollingScrapNum = dt.Rows[0]["SCRAP_ROLLING"].ToString();
  794. //连轧合格支数
  795. this.rollingCard1.Value.RollingQualifiedNum = dt.Rows[0]["QUALIFIED_ROLLING"].ToString();
  796. //再加热炉剔除支数
  797. this.rollingCard1.Value.RefurScrapNum = dt.Rows[0]["SCRAP_REFUR"].ToString();
  798. //再加热炉合格支数
  799. this.rollingCard1.Value.RefurQualifiedNum = dt.Rows[0]["QUALIFIED_REFUR"].ToString();
  800. //定径剔除支数
  801. this.rollingCard1.Value.SizingScrapNum = dt.Rows[0]["SCRAP_SIZING"].ToString();
  802. //定径合格支数
  803. this.rollingCard1.Value.SizingQualifiedNum = dt.Rows[0]["QUALIFIED_SIZING"].ToString();
  804. //分切前剔除支数
  805. this.rollingCard1.Value.SawScrapNumBE = dt.Rows[0]["SCRAP_SAW_BE"].ToString();
  806. //分切前合格支数
  807. this.rollingCard1.Value.SawQualifiedNumBE = dt.Rows[0]["QUALIFIED_SAW_BE"].ToString();
  808. //分切剔除支数
  809. this.rollingCard1.Value.SawScrapNum = dt.Rows[0]["SCRAP_SAW"].ToString();
  810. //分切合格支数
  811. this.rollingCard1.Value.SawQualifiedNum = dt.Rows[0]["QUALIFIED_SAW"].ToString();
  812. //矫直剔除支数
  813. this.rollingCard1.Value.StraightScrapNum = dt.Rows[0]["SCRAP_STRAIGHT"].ToString();
  814. //矫直合格支数
  815. this.rollingCard1.Value.StraightQualifiedNum = dt.Rows[0]["QUALIFIED_STRAIGHT"].ToString();
  816. //矫直下线支数
  817. this.rollingCard1.Value.OfflineStraight = dt.Rows[0]["OFFLINE_STRAIGHT"].ToString();
  818. //矫直返线支数
  819. this.rollingCard1.Value.BacklineStraight = dt.Rows[0]["BACKLINE_STRAIGHT"].ToString();
  820. //探伤剔除支数
  821. this.rollingCard1.Value.TestingScrapNum = dt.Rows[0]["SCRAP_TESTING"].ToString();
  822. //探伤合格支数
  823. this.rollingCard1.Value.TestingQualifiedNum = dt.Rows[0]["QUALIFIED_TESTING"].ToString();
  824. NativeMethodNew na = new NativeMethodNew(this.ob);
  825. if (na.isBegineNode(heatno, 8) || na.isBegineNode(heatno, 9) || na.isBegineNode(heatno, 10))
  826. {
  827. //探伤下线支数
  828. this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
  829. this.rollingCard1.Value.BacklineTesting = dt.Rows[0]["BACKLINE_TESTING"].ToString();
  830. }
  831. else
  832. {
  833. if (dt.Rows[0]["OFFLINE_TESTING"].ToString() == "0")
  834. {
  835. this.rollingCard1.Value.OfflineTesting = "";
  836. this.rollingCard1.Value.BacklineTesting = "";
  837. }
  838. else
  839. {
  840. //探伤下线支数
  841. this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
  842. this.rollingCard1.Value.BacklineTesting = dt.Rows[0]["BACKLINE_TESTING"].ToString();
  843. }
  844. }
  845. //表检合格支数
  846. this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
  847. //表检废品支数
  848. this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString();
  849. //表检下线支数
  850. this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
  851. //表检返线支数
  852. //this.rollingCard1.Value.SurfaceBackLineNum= dt.Rows[0]["OFFLINE_TESTING"].ToString();
  853. this.rollingCard1.UpdateData();
  854. }
  855. else
  856. {
  857. this.rollingCard1.ClearData();
  858. }
  859. }
  860. //查询计划对应的对列
  861. public void ultraGridTC()
  862. {
  863. dtTC.Clear();
  864. if (this.dtPlan.Rows.Count > 0)
  865. {
  866. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  867. //UltraGridRow ugr = e.Row;
  868. if (ugr != null)
  869. {
  870. string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  871. string proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
  872. string gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
  873. MainPlan.JudgeStoveNo = HeatNo;
  874. MainPlan.ProPlanId = proPlanId;
  875. MainPlan.GxPlanNo = gxPlanNo;
  876. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.getSingleMainPlanTC", new object[] { MainPlan }, this.ob);
  877. GridHelper.CopyDataToDatatable(ref dtMP, ref this.dtTC, true);
  878. ultraGrid_GHDL.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
  879. }
  880. }
  881. }
  882. // private void ultraGridPlan_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
  883. private void DoStart()
  884. {
  885. MilPerforationResultEntity PerResult1 = new MilPerforationResultEntity();
  886. NativeMethodNew NaMethod = new NativeMethodNew(this.ob);
  887. if (ultraGridPlan.Rows.Count > 0)
  888. {
  889. //if (!IsStart())
  890. //{
  891. // return;
  892. //}
  893. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  894. if (ugr == null)
  895. {
  896. MessageBox.Show("未选择任何计划。请选择当前生产计划后再开始穿孔操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  897. return;
  898. }
  899. string Judge_Stove_No = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  900. string ResultNo = ugr.Cells["ID"].Value.ToString();
  901. ActiveJUDGE_STOVE_NO = Judge_Stove_No;
  902. ActiveStatus = ugr.Cells["IS_START"].Value.ToString();
  903. NativeMethodNew Nvw = new NativeMethodNew(this.ob);
  904. //if (!Nvw.isBegineNode(Judge_Stove_No, 1))
  905. //{
  906. // MessageBox.Show("炉号【"+Judge_Stove_No.Substring(0,6)+"】未入炉,不能穿孔。");
  907. // return;
  908. //}
  909. if (ActiveStatus == "穿孔完成")
  910. {
  911. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(Judge_Stove_No) + "】已完成穿孔操作,不允许再次进行穿孔操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  912. return;
  913. }
  914. if (ActiveStatus == "已开始穿孔")
  915. {
  916. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(Judge_Stove_No) + "】已开始穿孔,不允许再次进行穿孔操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  917. return;
  918. }
  919. if (!NaMethod.isBegineNode(Judge_Stove_No, 0))
  920. {
  921. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(Judge_Stove_No) + "】未开始锯切,不能进行穿孔!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  922. return;
  923. }
  924. if (ugr != null && ugr.Cells["IS_START"].Value.ToString() != "已开始穿孔")
  925. {
  926. //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + MainPlan.JudgeStoveNo + "】穿孔开始?") == DialogResult.No)
  927. //{
  928. // return;
  929. //}
  930. if (tempperforation != null)
  931. {
  932. PerResult1.FrontExtendingQuantity = tempperforation.FrontExtendingQuantity;
  933. PerResult1.RollerSpace = tempperforation.RollerSpace;
  934. PerResult1.GuideSpace = tempperforation.GuideSpace;
  935. PerResult1.CapillarySize = tempperforation.CapillarySize;
  936. PerResult1.CapollaryWallThickness = tempperforation.CapollaryWallThickness;
  937. PerResult1.BiteAngle = tempperforation.BiteAngle;
  938. PerResult1.GuideDiscMotorSpeed = tempperforation.GuideDiscMotorSpeed;
  939. PerResult1.HeadDiameter = tempperforation.HeadDiameter;
  940. PerResult1.RollMotorSpeed = tempperforation.RollMotorSpeed;
  941. PerResult1.RollMotorSjb = tempperforation.RollMotorSjb;
  942. PerResult1.KzTemp = tempperforation.KzTemp;
  943. PerResult1.AmountOfBorax = tempperforation.AmountOfBorax;
  944. PerResult1.Remark = tempperforation.Remark;
  945. PerResult1.StartTime = tempperforation.StartTime;
  946. PerResult1.EndTime = tempperforation.EndTime;
  947. PerResult1.BoraxPressure = tempperforation.BoraxPressure;
  948. PerResult1.GuideDiscMotorLoca = tempperforation.GuideDiscMotorLoca;
  949. PerResult1.DbLoca = tempperforation.DbLoca;
  950. PerResult1.DpGg = tempperforation.DpGg;
  951. PerResult1.DtCode = tempperforation.DtCode;
  952. PerResult1.ZgZj = tempperforation.ZgZj;
  953. PerResult1.ZgLocaDown = tempperforation.ZgLocaDown;
  954. PerResult1.ZgLocaUp = tempperforation.ZgLocaUp;
  955. PerResult1.BeginRollingTemp = tempperforation.BeginRollingTemp;
  956. PerResult1.DbLocaDown = tempperforation.DbLocaDown;
  957. }
  958. perforationResult1.Update();
  959. string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  960. ActiveJUDGE_STOVE_NO = HeatNo;
  961. MainPlan.JudgeStoveNo = HeatNo;
  962. MainPlan.ProPlanId = proPlanId;
  963. MainPlan.GxPlanNo = gxPlanNo;
  964. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
  965. GridEdit(dtMP); //轧制计划信息
  966. string PLineCode = dtMP.Rows[0]["PLINE_CODE"].ToString();
  967. string LotNo = dtMP.Rows[0]["LOT_NO"].ToString();
  968. string StoveNo = dtMP.Rows[0]["STOVE_NO"].ToString();
  969. string Judge_stove_no = dtMP.Rows[0]["judge_stove_no"].ToString();
  970. UltraGridRow ugr1 = this.perforationResult1.UltraGrid1.Rows[0];
  971. PerResult1.PlineCode = PLineCode;
  972. PerResult1.LotNo = LotNo;
  973. PerResult1.StoveNo = StoveNo;
  974. PerResult1.JudgeStoveNo = Judge_stove_no;
  975. PerResult1.ColMode = "0";
  976. PerResult1.ColGroup = UserInfo.GetUserGroup();
  977. PerResult1.ColShift = UserInfo.GetUserOrder();
  978. PerResult1.ColUser = UserInfo.GetUserName();
  979. PerResult1.ResultNo = ResultNo;
  980. PerResult1.ProPlanId = proPlanId;
  981. PerResult1.GxPlanNo = gxPlanNo;
  982. //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.UpdatePerforationStatue", new object[] { Feedplan }, this.ob);
  983. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.UpdatePerforationStatue", new object[] { PerResult1 }, this.ob);
  984. NativeMethodNew na = new NativeMethodNew(this.ob);
  985. na.InsertSTAferDoubleClick(Judge_Stove_No, 2, "0", proPlanId, gxPlanNo);
  986. PlanQuery();
  987. ultraGridTC();
  988. GetGridButtonName();
  989. ChangeGridColor();
  990. //if (ugr.Cells["IS_START"].Value.ToString() == "已开始穿孔")
  991. //{
  992. // ultraGridTC();
  993. //}
  994. }
  995. else
  996. {
  997. MessageBox.Show("状态不符,不能穿孔。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  998. return;
  999. }
  1000. }
  1001. }
  1002. private void perforationResult1_Load(object sender, EventArgs e)
  1003. {
  1004. }
  1005. private void ultraGridMatSeq_ClickCellButton(object sender, CellEventArgs e)
  1006. {
  1007. MilSlabScrapSeqEntity ScrapSlab = new MilSlabScrapSeqEntity();
  1008. UltraGridRow ugr = ultraGrid_GHDL.ActiveRow;
  1009. UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
  1010. HOTMethod hm = new HOTMethod(this.ob);
  1011. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1012. string ResultNo = ugr1.Cells["ID"].Value.ToString();
  1013. String MAT_NO = ugr.Cells["MAT_NO"].Value.ToString();
  1014. String Seq = ugr.Cells["seq"].Value.ToString();
  1015. int Seq1 = int.Parse(Seq);
  1016. string PlanStatus = ugr1.Cells["IS_START"].Value.ToString();
  1017. string DlSTATUS = ugr.Cells["STATUS"].Value.ToString();
  1018. string shif = ugr.Cells["COL_SHIFT"].Value.ToString();
  1019. string group = ugr.Cells["COL_GROUP"].Value.ToString();
  1020. NativeMethodNew nasssss = new NativeMethodNew(this.ob);
  1021. if (nasssss.IsRackOperate(shif, group))
  1022. {
  1023. MessageBox.Show("序号:【" + Seq + "】管已由" + shif + "," + group + "交班操作,不允许再进行操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1024. return;
  1025. }
  1026. if (PlanStatus == "未开始穿孔")
  1027. {
  1028. if (e.Cell.Column.Key == "CHANGE_NUM")
  1029. {
  1030. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始穿孔,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1031. }
  1032. else if (e.Cell.Column.Key == "BTNCHANGECOM")
  1033. {
  1034. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成穿孔操作,不允许接班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1035. }
  1036. else
  1037. {
  1038. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】穿孔未开始,不能剔除。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1039. }
  1040. return;
  1041. }
  1042. if (PlanStatus == "穿孔完成")
  1043. {
  1044. if (e.Cell.Column.Key == "CHANGE_NUM")
  1045. {
  1046. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】穿孔完成,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1047. }
  1048. else
  1049. {
  1050. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】穿孔完成,不能剔除。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1051. }
  1052. return;
  1053. }
  1054. if (e.Cell.Column.Key == "SCRAP_SLAB")
  1055. {
  1056. DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.selectPortBacthSlample", new object[] { MAT_NO }, ob);
  1057. if (ds.Rows.Count > 0)
  1058. {
  1059. if (MessageUtil.ShowYesNoAndQuestion("此管坯已有被取为样管,是否继续剔除?") == DialogResult.No)
  1060. {
  1061. return;
  1062. }
  1063. }
  1064. }
  1065. //查询前几道工序累计剔除多少半成品管(管坯等进行换算)
  1066. CoreClientParam ccp = new CoreClientParam();
  1067. ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult";
  1068. ccp.MethodName = "scrapMatCheck";
  1069. ccp.ServerParams = new Object[] { JudgeStoveNo, 3, proPlanId, gxPlanNo };
  1070. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1071. int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);
  1072. if (e.Cell.Column.Key == "SCRAP_SLAB")
  1073. {
  1074. if (DlSTATUS != "正常轧制")
  1075. {
  1076. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】该条已经剔除,不能重复剔除。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1077. return;
  1078. }
  1079. //if (MessageUtil.ShowYesNoAndQuestion("是否剔除该毛管") == DialogResult.No)
  1080. //{
  1081. // return;
  1082. //}
  1083. int i = 0;
  1084. foreach (UltraGridRow uRow in ultraGrid_GHDL.Rows)
  1085. {
  1086. if (uRow.Cells["STATUS"].Value.ToString().Equals("正常轧制") && int.Parse(uRow.Cells["SEQ"].Value.ToString3()) > 2)
  1087. {
  1088. i = i +1;
  1089. }
  1090. }
  1091. if (int.Parse(Seq) < 3 && i > 0)
  1092. {
  1093. if (MessageUtil.ShowYesNoAndQuestion("该管坯可能是样管,是否确认剔除。") == DialogResult.No)
  1094. {
  1095. return;
  1096. }
  1097. }
  1098. if (ultraGrid_GHDL.Rows.Count - ScrapNumBefore < Seq1)
  1099. {
  1100. MessageBox.Show("管号【" + Seq + "】,已被前道工序剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1101. return;
  1102. }
  1103. //if(ugr.Cells["MAT_NO"].Text == "")
  1104. //{
  1105. // MessageBox.Show("管号【" + Seq + "】,已被前道工序剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1106. // return;
  1107. //}
  1108. //管排锯切前判断当前管坯序号是否已剔除
  1109. //DataTable dtSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapSeq", new object[] { JudgeStoveNo, Seq }, this.ob);
  1110. //if (dtSeq.Rows.Count > 0)
  1111. //{
  1112. // MessageBox.Show("不存在序号为【" + Seq + "】的管号,已在【" + dtSeq.Rows[0][0].ToString() + "】剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1113. // return;
  1114. //}
  1115. ScrapSlab.JudgeStoveNo = JudgeStoveNo;
  1116. ScrapSlab.Seq = Seq;
  1117. ScrapSlab.ProcessNo = "3";
  1118. ScrapSlab.Flag = "0";
  1119. ScrapSlab.ColMode = "1";
  1120. ScrapSlab.ColUser = UserInfo.GetUserName();
  1121. ScrapSlab.ColGroup = UserInfo.GetUserGroup();
  1122. ScrapSlab.ColShift = UserInfo.GetUserOrder();
  1123. ScrapSlab.ProPlanId = proPlanId;
  1124. ScrapSlab.GxPlanNo = gxPlanNo;
  1125. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.scrapFurMat", new object[] { ScrapSlab }, this.ob);
  1126. //剔除支数+1
  1127. int ScrapNum = 0;
  1128. if (string.IsNullOrEmpty(perforationResult1.Value.ScrapNum.ToString()))
  1129. {
  1130. ScrapNum = 1;
  1131. }
  1132. else
  1133. {
  1134. ScrapNum = int.Parse(perforationResult1.Value.ScrapNum.ToString()) + count;
  1135. }
  1136. perforationResult1.Value.ScrapNum = ScrapNum;
  1137. perforationResult1.UpdateData();
  1138. //UltraGridRow ugr2 = rollingCard1.UltraGrid4.Rows[0];
  1139. //string lailiao = ugr2.Cells["QualifiedNum3"].Value.ToString();
  1140. //int ck = 0;
  1141. //if (string.IsNullOrEmpty(lailiao))
  1142. //{
  1143. // ck = 0;
  1144. //}
  1145. //else
  1146. //{
  1147. // ck = int.Parse(lailiao) - ScrapNum;
  1148. //}
  1149. //perforationResult1.Value.PerforationNum = ck;
  1150. // MessageBox.Show("管序号【" + Seq + "】剔除成功!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1151. }
  1152. if (e.Cell.Column.Key == "DELBACK")
  1153. {
  1154. //if (MessageUtil.ShowYesNoAndQuestion("是否回退该剔除的坯料") == DialogResult.No)
  1155. //{
  1156. // return;
  1157. //}
  1158. if (!DlSTATUS.Equals("剔除"))
  1159. {
  1160. MessageBox.Show("该坯料未被剔除,请确认后重新选择!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1161. return;
  1162. }
  1163. NativeMethodNew na = new NativeMethodNew(this.ob);
  1164. int counts = na.DeleteSlabSeq(JudgeStoveNo, Seq.ToString(), 3, 1, 0, proPlanId, gxPlanNo);
  1165. if (counts > 0)
  1166. {
  1167. // MessageBox.Show("剔料回退成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1168. }
  1169. else
  1170. {
  1171. MessageBox.Show("剔料回退失败", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1172. return;
  1173. }
  1174. }
  1175. //交班
  1176. if (e.Cell.Column.Key == "CHANGE_NUM")
  1177. {
  1178. string Shift = UserInfo.GetUserOrder();
  1179. string Group = UserInfo.GetUserGroup();
  1180. string User = UserInfo.GetUserName();
  1181. int BeforeChangeNum = 0;
  1182. //查询上个班交班支数
  1183. DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1184. if (dtChangeNum.Rows.Count > 0)
  1185. {
  1186. if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString()))
  1187. {
  1188. BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString());
  1189. }
  1190. }
  1191. int Seq2 = int.Parse(Seq);
  1192. if (Seq2 <= BeforeChangeNum)
  1193. {
  1194. MessageBox.Show("前道班次已交班,该支不能再次交班。");
  1195. return;
  1196. }
  1197. if (Seq2 > ultraGrid_GHDL.Rows.Count - ScrapNumBefore)
  1198. {
  1199. MessageBox.Show("该支已被前道工序剔除,不能在该支交班");
  1200. return;
  1201. }
  1202. // int Seq = int.Parse(e.Cell.Row.Cells["SEQ"].Value.ToString());
  1203. //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 3, 0 }, this.ob);
  1204. //ChangeFlag = 1;
  1205. hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 2, int.Parse(Seq), 0);
  1206. }
  1207. //接班
  1208. if (e.Cell.Column.Key == "BTNCHANGECOM")
  1209. {
  1210. int BeforeChangeNum = 0;
  1211. //查询上个班交班支数
  1212. DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1213. if (dtChangeNum.Rows.Count > 0)
  1214. {
  1215. if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString()))
  1216. {
  1217. BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString());
  1218. }
  1219. }
  1220. int WaitChangeSeq = hm.GetWaitChangeSeq(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 2, 0, proPlanId, gxPlanNo);
  1221. if (WaitChangeSeq == 0)
  1222. {
  1223. MessageBox.Show("没有待交班确认的管号。");
  1224. return;
  1225. }
  1226. if (WaitChangeSeq != int.Parse(Seq))
  1227. {
  1228. MessageBox.Show("交班管序号与接班管序号不符,请确认后接班。");
  1229. return;
  1230. }
  1231. if (MessageUtil.ShowYesNoAndQuestion("确认炉号:【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】序号:【" + Seq + "】交班?") == DialogResult.No)
  1232. {
  1233. return;
  1234. }
  1235. //查询是否有该班接班记录
  1236. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  1237. string Time = SeverTime.ToLongTimeString();
  1238. string StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  1239. string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  1240. //未登录
  1241. //if (!hm.IsChanged(StartTime, EndTime, Shift, Group, "2", PlineCode))
  1242. //{
  1243. //FrmChangeGroup frmCg = new FrmChangeGroup(this.ob);
  1244. //frmCg.ShowDialog();
  1245. //if (frmCg.DialogResult == DialogResult.OK)
  1246. if (this.DoRelogin(DoCheck))
  1247. {
  1248. //插入接班确认履历表
  1249. hm.InsertChangeRemuse(Shift, Group, _UserName, "2", PlineCode);
  1250. int Seq2 = int.Parse(Seq);
  1251. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 3, 0, proPlanId, gxPlanNo }, this.ob);
  1252. ChangeFlag = 1;
  1253. }
  1254. //}
  1255. //else
  1256. //{
  1257. // int Seq2 = int.Parse(Seq);
  1258. // int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq2, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 3, 0 }, this.ob);
  1259. // ChangeFlag = 1;
  1260. //}
  1261. }
  1262. //过渡方法,接班后重登陆初始化导致Grid.Row为null
  1263. if (ultraGrid_GHDL.Rows == null)
  1264. {
  1265. return;
  1266. }
  1267. ultraGridTC();
  1268. ultraGrid_GHDL.Refresh();
  1269. GetRollingCard();
  1270. GetGridButtonName();
  1271. ChangeGridColor();
  1272. MainPlan.JudgeStoveNo = JudgeStoveNo;
  1273. MainPlan.ProPlanId = proPlanId;
  1274. MainPlan.GxPlanNo = gxPlanNo;
  1275. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
  1276. DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.getPerResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  1277. if (dtFurResult.Rows.Count > 0)
  1278. {
  1279. PerResultEdit(dtFurResult, dtMP);
  1280. }
  1281. else
  1282. {
  1283. MilPerforationResultEntity pr = new MilPerforationResultEntity();
  1284. this.perforationResult1.Value = pr;
  1285. }
  1286. }
  1287. public string DoCheck(CoreUserInfo User)
  1288. {
  1289. return "";
  1290. }
  1291. public void ChangeGridColor()
  1292. {
  1293. foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  1294. {
  1295. if (ugr.Cells["IS_START"].Value.ToString() == "穿孔完成")
  1296. {
  1297. ugr.Appearance.BackColor = Color.YellowGreen;
  1298. }
  1299. }
  1300. foreach (UltraGridRow ugr in ultraGrid_GHDL.Rows)
  1301. {
  1302. if (ugr != null)
  1303. {
  1304. switch (ugr.Cells["STATUS"].Value.ToString())
  1305. {
  1306. case "剔除":
  1307. ugr.Appearance.BackColor = Color.Yellow;
  1308. break;
  1309. }
  1310. switch (ugr.Cells["CHANGE_FLAG"].Value.ToString())
  1311. {
  1312. case "待接班确认":
  1313. ugr.Appearance.BackColor = Color.LightGreen;
  1314. break;
  1315. }
  1316. }
  1317. }
  1318. }
  1319. /// <summary>
  1320. /// 保存
  1321. /// </summary>
  1322. MilPerforationResultEntity PerResult = new MilPerforationResultEntity();
  1323. public void PerResultSave()
  1324. {
  1325. try
  1326. {
  1327. perforationResult1.UltraGrid1.UpdateData();
  1328. }
  1329. catch (Exception e)
  1330. {
  1331. MessageBox.Show("请输入正确的时间。");
  1332. return;
  1333. }
  1334. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  1335. UltraGridRow ugr1 = perforationResult1.UltraGrid1.Rows[0];
  1336. UltraGridRow ugr2 = this.rollingCard1.UltraGrid4.Rows[0];
  1337. //string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1338. string ResultNo = ActiveResultNo;
  1339. if (this.ultraGridPlan.ActiveRow == null && ActiveJUDGE_STOVE_NO == null)
  1340. {
  1341. MessageBox.Show("未选择任何炉号,请选择炉号后进行保存操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1342. return;
  1343. }
  1344. if (this.ultraGridPlan.ActiveRow == null)
  1345. {
  1346. PerResult.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
  1347. }
  1348. else
  1349. {
  1350. PerResult.JudgeStoveNo = this.ultraGridPlan.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1351. }
  1352. if (ActiveStatus == "未开始穿孔")
  1353. {
  1354. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(PerResult.JudgeStoveNo.ToString()) + "】未开始穿孔,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1355. return;
  1356. }
  1357. //if (ActiveStatus == "穿孔完成")
  1358. //{
  1359. // MessageBox.Show("炉号:【" + PerResult.JudgeStoveNo + "】已完成穿孔,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1360. // return;
  1361. //}
  1362. //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + PerResult.JudgeStoveNo + "】保存实绩?") == DialogResult.No)
  1363. //{
  1364. // return;
  1365. //}
  1366. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.GetResult", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
  1367. //PerResult.JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1368. //剔除支数
  1369. if (!string.IsNullOrEmpty(ugr1.Cells["scrap_num"].Value.ToString()))
  1370. {
  1371. PerResult.ScrapNum = ugr1.Cells["scrap_num"].Value.ToString();
  1372. }
  1373. else
  1374. {
  1375. PerResult.ScrapNum = "0";
  1376. }
  1377. PerResult.PerforationNum = 0;
  1378. // 合格支数
  1379. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { ActiveJUDGE_STOVE_NO, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1380. if (dtQANum.Rows.Count > 0)
  1381. {
  1382. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  1383. {
  1384. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(PerResult.ScrapNum.ToString()))
  1385. {
  1386. //合格支数
  1387. PerResult.PerforationNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(PerResult.ScrapNum.ToString());
  1388. }
  1389. }
  1390. }
  1391. //入炉支数
  1392. string lailiao = ugr2.Cells["QualifiedNum3"].Value.ToString();
  1393. PerResult.DbLoca = ugr1.Cells["db_loca_up"].Value.ToString();//导板位置上
  1394. PerResult.DbLocaDown = ugr1.Cells["db_loca_down"].Value.ToString();//导板位置下
  1395. PerResult.ZgLocaUp = ugr1.Cells["zg_loca_up"].Value.ToString();//轧辊位置上
  1396. PerResult.ZgLocaDown = ugr1.Cells["zg_loca_down"].Value.ToString();//轧辊位置下
  1397. double DbUp = 0;
  1398. double DbDown = 0;
  1399. double RollerUp = 0;
  1400. double RollerDown = 0;
  1401. if (!string.IsNullOrEmpty(PerResult.DbLoca.ToString()))
  1402. {
  1403. DbUp = double.Parse(PerResult.DbLoca.ToString());
  1404. }
  1405. if (!string.IsNullOrEmpty(PerResult.DbLocaDown.ToString()))
  1406. {
  1407. DbDown = double.Parse(PerResult.DbLocaDown.ToString());
  1408. }
  1409. if (!string.IsNullOrEmpty(PerResult.ZgLocaUp.ToString()))
  1410. {
  1411. RollerUp = double.Parse(PerResult.ZgLocaUp.ToString());
  1412. }
  1413. if (!string.IsNullOrEmpty(PerResult.ZgLocaDown.ToString()))
  1414. {
  1415. RollerDown = double.Parse(PerResult.ZgLocaDown.ToString());
  1416. }
  1417. PerResult.RollerSpace = ugr1.Cells["roller_space"].Value.ToString();//辊距
  1418. PerResult.GuideSpace = ugr1.Cells["guide_space"].Value.ToString();//导距
  1419. PerResult.FrontExtendingQuantity = ugr1.Cells["front_extending_quantity"].Value.ToString(); //前伸量7o
  1420. PerResult.BiteAngle = ugr1.Cells["bite_angle"].Value.ToString();//咬入角
  1421. PerResult.HeadDiameter = ugr1.Cells["head_diameter"].Value.ToString();//顶头直径
  1422. PerResult.RollMotorSpeed = ugr1.Cells["roll_motor_speed"].Value.ToString();//轧辊电机速度
  1423. PerResult.GuideDiscMotorSpeed = ugr1.Cells["guide_disc_motor_speed"].Value.ToString();//导盘电机速度
  1424. PerResult.BoraxPressure = ugr1.Cells["borax_pressure"].Value.ToString();//硼砂压力
  1425. PerResult.AmountOfBorax = ugr1.Cells["AMOUNT_OF_BORAX"].Value.ToString();//硼砂量
  1426. PerResult.CapillarySize = ugr1.Cells["CapillarySize"].Value.ToString();//毛管壁厚
  1427. PerResult.CapollaryWallThickness = ugr1.Cells["capollary_wall_thickness"].Value.ToString();//毛管外径
  1428. PerResult.StartTime = ugr1.Cells["start_time"].Value.ToString();//开始时间
  1429. PerResult.EndTime = ugr1.Cells["end_time"].Value.ToString();//结束时间
  1430. PerResult.Remark = ugr1.Cells["Remark"].Value.ToString();//备注
  1431. PerResult.JzbNum = ugr1.Cells["JzbNum"].Value.ToString();//交接班支数
  1432. PerResult.KzTemp = ugr1.Cells["kz_temp"].Value.ToString();//开扎温度
  1433. PerResult.DpGg = ugr1.Cells["dp_gg"].Value.ToString();//导板规格
  1434. PerResult.GuideDiscMotorLoca = ugr1.Cells["guide_disc_motor_loca"].Value.ToString();//导盘位置
  1435. PerResult.RollMotorSjb = ugr1.Cells["roll_motor_sjb"].Value.ToString();//轧辊转速升降比
  1436. PerResult.ZgZj = ugr1.Cells["zg_zj"].Value.ToString();//轧辊直径
  1437. PerResult.DtCode = ugr1.Cells["dt_code"].Value.ToString();//顶头代码
  1438. PerResult.DtCode = ugr1.Cells["dt_code"].Value.ToString();
  1439. PerResult.BeginRollingTemp = ugr1.Cells["beginRollingTemp"].Value.ToString();
  1440. PerResult.NodeFurFlag = "0";
  1441. PerResult.ProPlanId = proPlanId;
  1442. PerResult.GxPlanNo = gxPlanNo;
  1443. if (string.IsNullOrEmpty(PerResult.StartTime.ToString()))
  1444. {
  1445. MessageBox.Show("开始时间不能为空,请输入正确的开始时间");
  1446. return;
  1447. }
  1448. //查询结炉状态,已结炉的计划 结炉时间不能为空
  1449. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ResultNo, proPlanId, gxPlanNo }, this.ob);
  1450. if (int.Parse(dt.Rows[0][0].ToString()) > 29)
  1451. {
  1452. if (string.IsNullOrEmpty(PerResult.EndTime.ToString()))
  1453. {
  1454. MessageBox.Show("结束时间不能为空,请输入正确的结束时间");
  1455. return;
  1456. }
  1457. //开始时间必须小于结束时间
  1458. if (DateTime.Parse(PerResult.StartTime.ToString()) > DateTime.Parse(PerResult.EndTime.ToString()))
  1459. {
  1460. MessageBox.Show("结束时间不能小于开始时间。");
  1461. return;
  1462. }
  1463. }
  1464. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.savePerResult", new object[] { PerResult }, this.ob);
  1465. if (ShowMessageFlag == 0)
  1466. {
  1467. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(PerResult.JudgeStoveNo.ToString()) + "】保存成功!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1468. PlanQuery();
  1469. }
  1470. GetRollingCard();
  1471. this.perforationResult1.IsCellSelect = false;
  1472. tempperforation = NativeMethod.GetEntityToEntity(tempperforation, PerResult);//保存后全局变量赋值
  1473. PlanQuery();
  1474. }
  1475. /// <summary>
  1476. /// 结炉
  1477. /// </summary>
  1478. public void FeedSawResultNode()
  1479. {
  1480. PerResultSave();
  1481. HOTMethod hm = new HOTMethod(this.ob);
  1482. try
  1483. {
  1484. perforationResult1.UltraGrid1.UpdateData();
  1485. }
  1486. catch (Exception e)
  1487. {
  1488. MessageBox.Show("请输入正确的时间格式");
  1489. return;
  1490. }
  1491. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  1492. UltraGridRow ugr1 = perforationResult1.UltraGrid1.Rows[0];
  1493. UltraGridRow ugr2 = this.rollingCard1.UltraGrid4.Rows[0];
  1494. if (ultraGrid_GHDL.Rows.Count == 0)
  1495. {
  1496. MessageBox.Show("没有生成管号队列,不允许结炉", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1497. return;
  1498. }
  1499. //判断是否有重复剔除的坯子
  1500. foreach (UltraGridRow ugr4 in ultraGrid_GHDL.Rows)
  1501. {
  1502. if (ugr4.Cells["MAT_NO"].Value.ToString().Equals("") && ugr4.Cells["STATUS"].Value.ToString().Equals("剔除"))
  1503. {
  1504. MessageBox.Show("不存在序号第【" + ugr4.Cells["SEQ"].Value.ToString() + "】的坯子,它已被其它工序剔除,不能再次剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1505. return;
  1506. }
  1507. }
  1508. if (ugr != null)
  1509. {
  1510. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1511. string Status = ugr.Cells["IS_START"].Value.ToString();
  1512. string ResultNo = ugr.Cells["ID"].Value.ToString();
  1513. string proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
  1514. string gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
  1515. if (Status == "穿孔完成")
  1516. {
  1517. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成穿孔操作,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1518. return;
  1519. }
  1520. if (Status == "未开始穿孔")
  1521. {
  1522. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始穿孔,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1523. return;
  1524. }
  1525. //查看结炉标识
  1526. DataTable dtFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.GetSingleJRLResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  1527. if (dtFlag.Rows.Count > 0)
  1528. {
  1529. string NodeFlag = dtFlag.Rows[0]["NODE_FUR_FLAG"].ToString();
  1530. if (NodeFlag == "0")
  1531. {
  1532. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】不能结炉。该炉在上一道工序未结炉", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1533. return;
  1534. }
  1535. if (hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 2) > 0)
  1536. {
  1537. MessageBox.Show("管号【" + hm.NodeGetWaitChangeMat(JudgeStoveNo, ResultNo, 2) + "】未接班确认,不能结炉");
  1538. return;
  1539. }
  1540. if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉?") == DialogResult.No)
  1541. {
  1542. return;
  1543. }
  1544. //剔除支数
  1545. PerResult.ScrapNum = "0";
  1546. //查询本道工序剔除支数
  1547. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1548. if (dtScrapNum.Rows.Count > 0)
  1549. {
  1550. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  1551. {
  1552. PerResult.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  1553. }
  1554. }
  1555. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1556. if (dtQANum.Rows.Count > 0)
  1557. {
  1558. if (!string.IsNullOrEmpty(dtQANum.Rows[0][0].ToString()))
  1559. {
  1560. if (int.Parse(dtQANum.Rows[0][0].ToString()) > int.Parse(PerResult.ScrapNum.ToString()))
  1561. {
  1562. //合格支数
  1563. PerResult.PerforationNum = int.Parse(dtQANum.Rows[0][0].ToString()) - int.Parse(PerResult.ScrapNum.ToString());
  1564. }
  1565. else
  1566. {
  1567. PerResult.PerforationNum = 0;
  1568. }
  1569. }
  1570. else
  1571. { PerResult.PerforationNum = 0; }
  1572. }
  1573. //PerResult.PerforationNum = ck;
  1574. PerResult.DbLoca = ugr1.Cells["db_loca_up"].Value.ToString();//导板位置上
  1575. PerResult.DbLocaDown = ugr1.Cells["db_loca_down"].Value.ToString();//导板位置下
  1576. PerResult.ZgLocaUp = ugr1.Cells["zg_loca_up"].Value.ToString();//轧辊位置上
  1577. PerResult.ZgLocaDown = ugr1.Cells["zg_loca_down"].Value.ToString();//轧辊位置下
  1578. double DbUp = 0;
  1579. double DbDown = 0;
  1580. double RollerUp = 0;
  1581. double RollerDown = 0;
  1582. if (!string.IsNullOrEmpty(PerResult.DbLoca.ToString()))
  1583. {
  1584. DbUp = double.Parse(PerResult.DbLoca.ToString());
  1585. }
  1586. if (!string.IsNullOrEmpty(PerResult.DbLocaDown.ToString()))
  1587. {
  1588. DbDown = double.Parse(PerResult.DbLocaDown.ToString());
  1589. }
  1590. if (!string.IsNullOrEmpty(PerResult.ZgLocaUp.ToString()))
  1591. {
  1592. RollerUp = double.Parse(PerResult.ZgLocaUp.ToString());
  1593. }
  1594. if (!string.IsNullOrEmpty(PerResult.ZgLocaDown.ToString()))
  1595. {
  1596. RollerDown = double.Parse(PerResult.ZgLocaDown.ToString());
  1597. }
  1598. PerResult.RollerSpace = ugr1.Cells["roller_space"].Value.ToString();//辊距
  1599. PerResult.GuideSpace = ugr1.Cells["guide_space"].Value.ToString();//导距
  1600. PerResult.FrontExtendingQuantity = ugr1.Cells["front_extending_quantity"].Value.ToString(); //前伸量
  1601. PerResult.BiteAngle = ugr1.Cells["bite_angle"].Value.ToString();//咬入角
  1602. PerResult.HeadDiameter = ugr1.Cells["head_diameter"].Value.ToString();//顶头直径
  1603. PerResult.RollMotorSpeed = ugr1.Cells["roll_motor_speed"].Value.ToString();//轧辊电机速度
  1604. PerResult.GuideDiscMotorSpeed = ugr1.Cells["guide_disc_motor_speed"].Value.ToString();//导盘电机速度
  1605. //PerResult.BoraxTank = ugr1.Cells["borax_tank"].Value.ToString();//硼砂罐
  1606. PerResult.BoraxPressure = ugr1.Cells["borax_pressure"].Value.ToString();//硼砂压力
  1607. PerResult.AmountOfBorax = ugr1.Cells["AMOUNT_OF_BORAX"].Value.ToString();//硼砂量
  1608. PerResult.CapillarySize = ugr1.Cells["CapillarySize"].Value.ToString();//毛管规格
  1609. PerResult.CapollaryWallThickness = ugr1.Cells["capollary_wall_thickness"].Value.ToString();//毛管外径
  1610. PerResult.StartTime = ugr1.Cells["start_time"].Value.ToString();//开始时间
  1611. PerResult.EndTime = ugr1.Cells["end_time"].Value.ToString();//结束时间
  1612. PerResult.Remark = ugr1.Cells["Remark"].Value.ToString();//备注
  1613. PerResult.JzbNum = ugr1.Cells["JzbNum"].Value.ToString();//交接班支数
  1614. PerResult.KzTemp = ugr1.Cells["kz_temp"].Value.ToString();//开扎温度
  1615. PerResult.DpGg = ugr1.Cells["dp_gg"].Value.ToString();//导板规格
  1616. PerResult.GuideDiscMotorLoca = ugr1.Cells["guide_disc_motor_loca"].Value.ToString();//导盘位置
  1617. PerResult.RollMotorSjb = ugr1.Cells["roll_motor_sjb"].Value.ToString();//轧辊转速升降比
  1618. PerResult.ZgZj = ugr1.Cells["zg_zj"].Value.ToString();//轧辊直径
  1619. PerResult.DtCode = ugr1.Cells["dt_code"].Value.ToString();//顶头代码
  1620. PerResult.DtCode = ugr1.Cells["dt_code"].Value.ToString();
  1621. PerResult.BeginRollingTemp = ugr1.Cells["beginRollingTemp"].Value.ToString();
  1622. //合格吨
  1623. double DBHeight = 0;
  1624. double BurnningRate = 0;
  1625. double DBNum = 1;
  1626. DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getDbHeight", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
  1627. if (dtDBH.Rows.Count > 0)
  1628. {
  1629. if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_HEIGHT"].ToString()))
  1630. {
  1631. DBHeight = double.Parse(dtDBH.Rows[0]["DB_HEIGHT"].ToString());
  1632. }
  1633. if (!string.IsNullOrEmpty(dtDBH.Rows[0]["BURNNING_RATE"].ToString()))
  1634. {
  1635. BurnningRate = double.Parse(dtDBH.Rows[0]["BURNNING_RATE"].ToString());
  1636. }
  1637. if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_NUM"].ToString()))
  1638. {
  1639. DBNum = double.Parse(dtDBH.Rows[0]["DB_NUM"].ToString());
  1640. }
  1641. }
  1642. PerResult.QaTon = DBHeight * (1 - (BurnningRate / 100)) * double.Parse(PerResult.PerforationNum.ToString());
  1643. PerResult.Status = "30";
  1644. PerResult.NodeFurFlag = "1";
  1645. PerResult.JudgeStoveNo = JudgeStoveNo;
  1646. PerResult.ColGroup = UserInfo.GetUserGroup();
  1647. PerResult.ColShift = UserInfo.GetUserOrder();
  1648. PerResult.ColUser = _UserName;
  1649. PerResult.UserId = _UserID;
  1650. PerResult.ProPlanId = proPlanId;
  1651. PerResult.GxPlanNo = gxPlanNo;
  1652. PerResult.LotNo = lotNo;
  1653. PerResult.PlineCode = PlineCode;
  1654. //结炉赋值材料号到剔废表、写进程表
  1655. CoreClientParam ccp = new CoreClientParam();
  1656. ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult";
  1657. ccp.MethodName = "updateMilSlab";
  1658. ccp.ServerParams = new object[] { JudgeStoveNo, "3", proPlanId, gxPlanNo };
  1659. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1660. if (ccp.ReturnCode != -1)
  1661. {
  1662. if (ccp.ReturnInfo.Equals("修改成功!"))
  1663. {
  1664. ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult";
  1665. ccp.MethodName = "updateProcess";
  1666. ccp.ServerParams = new object[] { JudgeStoveNo, "3", "3", proPlanId, gxPlanNo, lotNo, PlineCode };
  1667. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1668. if (ccp.ReturnCode != -1)
  1669. {
  1670. if (ccp.ReturnInfo.Equals("修改成功!"))
  1671. {
  1672. int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PerforationResult.nodePerResult", new object[] { PerResult }, this.ob);
  1673. if (count1 > 0)
  1674. {
  1675. //NativeMethodNew na = new NativeMethodNew(this.ob);
  1676. //na.InsertSTAferDoubleClick(JudgeStoveNo, 2, "1", proPlanId, gxPlanNo);
  1677. int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { JudgeStoveNo, 3, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1678. NativeMethod.CheckNodeMatStatus(JudgeStoveNo, proPlanId, gxPlanNo, 2, this.ob);
  1679. }
  1680. }
  1681. else
  1682. {
  1683. MessageUtil.ShowTips(ccp.ReturnInfo);
  1684. }
  1685. }
  1686. }
  1687. }
  1688. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】结炉成功!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1689. PlanQuery();
  1690. ultraGridTC();
  1691. }
  1692. else
  1693. {
  1694. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】加热炉工序未结炉,当前工序不能结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1695. }
  1696. tempperforation = NativeMethod.GetEntityToEntity(tempperforation, PerResult);//保存后全局变量赋值
  1697. this.perforationResult1.IsCellSelect = false;
  1698. }
  1699. }
  1700. /// <summary>
  1701. /// 开始回退
  1702. /// </summary>
  1703. private void StartBack()
  1704. {
  1705. if (ultraGridPlan.Rows.Count > 0)
  1706. {
  1707. if (this.ultraGridPlan.ActiveRow == null)
  1708. {
  1709. MessageBox.Show("请选择需要回退的炉号!!!");
  1710. return;
  1711. }
  1712. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  1713. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1714. string ResultNo = ugr.Cells["ID"].Value.ToString();
  1715. string StartStatus = ugr.Cells["IS_START"].Value.ToString();
  1716. if (StartStatus == "穿孔完成")
  1717. {
  1718. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已结炉,不能开始回退!!!!");
  1719. return;
  1720. }
  1721. if (StartStatus == "未开始穿孔")
  1722. {
  1723. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始穿孔,不能开始回退!!!!");
  1724. return;
  1725. }
  1726. //NativeMethodNew nvw = new NativeMethodNew(this.ob);
  1727. //if (nvw.isBegineNode(JudgeStoveNo, 3))
  1728. //{
  1729. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已开始连轧,不能开始回退!!!!");
  1730. // return;
  1731. //}
  1732. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.startBack", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1733. ultraGridTC();
  1734. ChangeGridColor();
  1735. GetGridButtonName();
  1736. PlanQuery();
  1737. }
  1738. }
  1739. /// <summary>
  1740. /// 结炉回退
  1741. /// </summary>
  1742. private void NodeBack()
  1743. {
  1744. if (this.ultraGridPlan.ActiveRow == null)
  1745. {
  1746. MessageBox.Show("请选择需要回退的炉号!!!");
  1747. return;
  1748. }
  1749. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  1750. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1751. string ResultNo = ugr.Cells["ID"].Value.ToString();
  1752. string NodeFlag = ugr.Cells["IS_START"].Value.ToString();
  1753. if (NodeFlag != "穿孔完成")
  1754. {
  1755. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未结炉,不能结炉回退!!!!");
  1756. return;
  1757. }
  1758. //查询结炉班次班组
  1759. DataTable dtNodeGroup = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, 2, proPlanId, gxPlanNo }, this.ob);
  1760. if (dtNodeGroup.Rows.Count > 0)
  1761. {
  1762. string NodeShift = dtNodeGroup.Rows[0][0].ToString();
  1763. string NodeGroup = dtNodeGroup.Rows[0][1].ToString();
  1764. if (Shift == NodeShift && Group == NodeGroup)
  1765. {
  1766. }
  1767. else
  1768. {
  1769. switch (NodeShift)
  1770. {
  1771. case "0":
  1772. NodeShift = "白班";
  1773. break;
  1774. case "1":
  1775. NodeShift = "早班";
  1776. break;
  1777. case "2":
  1778. NodeShift = "中班";
  1779. break;
  1780. case "3":
  1781. NodeShift = "夜班";
  1782. break;
  1783. }
  1784. switch (NodeGroup)
  1785. {
  1786. case "1":
  1787. NodeGroup = "甲班";
  1788. break;
  1789. case "2":
  1790. NodeGroup = "乙班";
  1791. break;
  1792. case "3":
  1793. NodeGroup = "丙班";
  1794. break;
  1795. case "4":
  1796. NodeGroup = "丁班";
  1797. break;
  1798. }
  1799. switch (this.UserInfo.GetUserOrder())
  1800. {
  1801. case "0":
  1802. Shift = "白班";
  1803. break;
  1804. case "1":
  1805. Shift = "早班";
  1806. break;
  1807. case "2":
  1808. Shift = "中班";
  1809. break;
  1810. case "3":
  1811. Shift = "夜班";
  1812. break;
  1813. }
  1814. switch (this.UserInfo.GetUserGroup())
  1815. {
  1816. case "1":
  1817. Group = "甲班";
  1818. break;
  1819. case "2":
  1820. Group = "乙班";
  1821. break;
  1822. case "3":
  1823. Group = "丙班";
  1824. break;
  1825. case "4":
  1826. Group = "丁班";
  1827. break;
  1828. }
  1829. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已由" + NodeGroup + "," + NodeShift + "结炉,当班不能结炉回退");
  1830. return;
  1831. }
  1832. }
  1833. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
  1834. if (dt.Rows.Count > 0)
  1835. {
  1836. string NodeProcess = ""; //当前炉次结炉工序
  1837. string NodeStatus = dt.Rows[0][0].ToString();
  1838. switch (NodeStatus)
  1839. {
  1840. case "30":
  1841. NodeProcess = "穿孔";
  1842. break;
  1843. case "40":
  1844. NodeProcess = "连轧";
  1845. break;
  1846. case "50":
  1847. NodeProcess = "再加热炉";
  1848. break;
  1849. case "60":
  1850. NodeProcess = "定径";
  1851. break;
  1852. case "70":
  1853. NodeProcess = "分切";
  1854. break;
  1855. case "80":
  1856. NodeProcess = "矫直";
  1857. break;
  1858. case "90":
  1859. NodeProcess = "探伤";
  1860. break;
  1861. case "96":
  1862. NodeProcess = "质检";
  1863. break;
  1864. }
  1865. if (NodeStatus != "30")
  1866. {
  1867. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 " + NodeProcess + "工序已结炉,当前工序不能结炉回退");
  1868. return;
  1869. }
  1870. }
  1871. //判断当前炉次下道工序是否结炉 下道工序结炉 - 不允许回退
  1872. //查询当前炉次是否有交班点
  1873. int Seq = 0;
  1874. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.changeFlagQuery", new object[] { JudgeStoveNo, ResultNo, 2, proPlanId, gxPlanNo }, this.ob);
  1875. if (dt1.Rows.Count > 0)
  1876. {
  1877. Seq = int.Parse(dt1.Rows[0][0].ToString());
  1878. }
  1879. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 2, PlineCode, Seq, 0, 3, proPlanId, gxPlanNo, lotNo }, this.ob);
  1880. ultraGridTC();
  1881. ChangeGridColor();
  1882. GetGridButtonName();
  1883. PlanQuery();
  1884. }
  1885. /// <summary>
  1886. /// 打印报表
  1887. /// </summary>
  1888. private void PrintResult()
  1889. {
  1890. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  1891. string Time = SeverTime.ToLongTimeString();
  1892. string StartTime = "";
  1893. string EndTime = "";
  1894. string strurl = "";
  1895. //晚班
  1896. Time = Time.Replace(":", "");
  1897. if (Shift == "3")
  1898. {
  1899. //查询晚班前一天20点40后到当天07点20前所有记录
  1900. if (int.Parse(Time) < 072000)
  1901. {
  1902. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
  1903. EndTime = SeverTime.ToShortDateString() + " 07:20:00";
  1904. //string Date2 = SeverTime.ToString("yyyy-MM-dd");
  1905. //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1906. }
  1907. //查询当天晚班的所有数据
  1908. else if (int.Parse(Time) > 204000)
  1909. {
  1910. StartTime = SeverTime.ToShortDateString() + " 20:40:00";
  1911. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
  1912. //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1913. }
  1914. }
  1915. //白班 中班
  1916. else
  1917. {
  1918. StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  1919. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  1920. //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1921. }
  1922. switch (PlineCode)
  1923. {
  1924. case "C008": //250
  1925. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1926. break;
  1927. case "C009": //258
  1928. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation258.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1929. break;
  1930. case "C010": //168
  1931. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1932. break;
  1933. case "C012": //Arssel
  1934. break;
  1935. case "C017": //460
  1936. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation460.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1937. break;
  1938. case "C072": //508
  1939. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation508.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1940. break;
  1941. }
  1942. FrmRepExcel fre = new FrmRepExcel(ob, strurl);
  1943. fre.AutoSize = true;
  1944. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  1945. fre.WindowState = FormWindowState.Maximized;
  1946. fre.Show();
  1947. }
  1948. /// <summary>
  1949. /// 查询上个班原始记录
  1950. /// </summary>
  1951. private void QueryBefore()
  1952. {
  1953. HOTMethod hm = new HOTMethod(this.ob);
  1954. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  1955. string Time = SeverTime.ToLongTimeString();
  1956. string Date = "";
  1957. if (Shift == "3")
  1958. {
  1959. Time = Time.Replace(":", "");
  1960. if (int.Parse(Time) < 122000)
  1961. {
  1962. Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
  1963. }
  1964. else
  1965. {
  1966. Date = SeverTime.ToString("yyyyMMdd");
  1967. }
  1968. }
  1969. if (Shift == "1" || Shift == "0")
  1970. {
  1971. Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
  1972. }
  1973. else
  1974. {
  1975. Date = SeverTime.ToString("yyyyMMdd");
  1976. }
  1977. string StartTime = ""; // 开始时间 用于报表查询
  1978. string EndTime = ""; // 结束时间 用于报表查询
  1979. string StartTimeU = ""; // 开始时间 用于得到上班UserID
  1980. string EndTimeU = ""; // 结束时间 用于得到上班UserID
  1981. string strurl = "";
  1982. string ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date, PlineCode);
  1983. //if (PlineCode.Equals("C072"))
  1984. //{
  1985. // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date);
  1986. //}
  1987. //else
  1988. //{
  1989. // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group);
  1990. //}
  1991. string UserIDBefore = "";
  1992. //晚班
  1993. Time = Time.Replace(":", "");
  1994. if (Shift == "3")
  1995. {
  1996. //查询晚班前一天中班所有记录
  1997. if (int.Parse(Time) < 122000)
  1998. {
  1999. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
  2000. EndTime = SeverTime.ToShortDateString() + " 00:00:00";
  2001. //string Date2 = SeverTime.ToString("yyyy-MM-dd");
  2002. StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
  2003. EndTimeU = SeverTime.ToShortDateString() + " 00:00:00";
  2004. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 2, PlineCode);
  2005. //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;
  2006. }
  2007. //查询当天中班的所有数据
  2008. else if (int.Parse(Time) > 204000)
  2009. {
  2010. StartTime = SeverTime.ToShortDateString() + " 13:40:00";
  2011. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2012. StartTimeU = SeverTime.ToShortDateString() + " 13:40:00";
  2013. EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2014. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 2, PlineCode);
  2015. //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;
  2016. }
  2017. }
  2018. //白班
  2019. else if (Shift == "1")
  2020. {
  2021. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
  2022. EndTime = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
  2023. StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
  2024. EndTimeU = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
  2025. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 2, PlineCode);
  2026. }
  2027. //中班
  2028. else
  2029. {
  2030. StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  2031. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2032. StartTimeU = SeverTime.ToShortDateString() + " 00:00:00";
  2033. EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2034. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 2, PlineCode);
  2035. //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;
  2036. }
  2037. switch (PlineCode)
  2038. {
  2039. case "C008": //250
  2040. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation250.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  2041. break;
  2042. case "C009": //258
  2043. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation258.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  2044. break;
  2045. case "C010": //168
  2046. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation168.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  2047. break;
  2048. case "C012": //Arssel
  2049. break;
  2050. case "C017": //460
  2051. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation460.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  2052. break;
  2053. case "C072": //508
  2054. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilPerforation508.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  2055. break;
  2056. }
  2057. FrmRepExcel fre = new FrmRepExcel(ob, strurl);
  2058. fre.AutoSize = true;
  2059. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  2060. fre.WindowState = FormWindowState.Maximized;
  2061. fre.Show();
  2062. }
  2063. #endregion
  2064. private void ultraGrid_GHDL_DoubleClickHeader(object sender, DoubleClickHeaderEventArgs e)
  2065. {
  2066. if (PanelSizeFlag == 0)
  2067. {
  2068. PanelSizeFlag = 1;
  2069. splitContainer2.SplitterDistance = 180;
  2070. }
  2071. else
  2072. {
  2073. PanelSizeFlag = 0;
  2074. splitContainer2.SplitterDistance = 90;
  2075. }
  2076. }
  2077. private void ultraButton1_Click(object sender, EventArgs e)
  2078. {
  2079. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.GetSQLDate.getPlanQuery", new object[] { }, this.ob);
  2080. }
  2081. /// <summary>
  2082. /// 计划表ROW点击变换判断
  2083. /// </summary>
  2084. /// <param name="sender"></param>
  2085. /// <param name="e"></param>
  2086. private void ultraGridPlan_BeforeRowActivate(object sender, RowEventArgs e)
  2087. {
  2088. if (this.perforationResult1.IsCellSelect == true)
  2089. {
  2090. NativeMethodNew na = new NativeMethodNew(this.ob);
  2091. if (!na.isBegineNode(ActiveJUDGE_STOVE_NO, 2))
  2092. {
  2093. this.perforationResult1.IsCellSelect = false;
  2094. return;
  2095. }
  2096. //if (MessageBox.Show("提示:穿孔实绩可能已修改,是否保存", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  2097. //{
  2098. // this.perforationResult1.IsCellSelect = false;
  2099. // //保存探伤实绩
  2100. //}
  2101. else
  2102. {
  2103. ShowMessageFlag = 1;
  2104. PerResultSave();
  2105. ShowMessageFlag = 0;
  2106. this.perforationResult1.IsCellSelect = false;
  2107. foreach (UltraGridRow ugr in this.ultraGridPlan.Rows)
  2108. {
  2109. if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString() == ActiveJUDGE_STOVE_NO)
  2110. {
  2111. this.ultraGridPlan.ActiveRow = ugr;
  2112. }
  2113. }
  2114. return;
  2115. }
  2116. }
  2117. }
  2118. /// <summary>
  2119. /// 查询结炉实绩
  2120. /// </summary>
  2121. public void NodeQuery()
  2122. {
  2123. string Shift = UserInfo.GetUserOrder();
  2124. string Group = UserInfo.GetUserGroup();
  2125. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2126. string StartTime = SeverTime.ToString("yyyy-MM-dd");
  2127. string EndTime = SeverTime.AddDays(1).ToString("yyyy-MM-dd");
  2128. string Date = StartTime;
  2129. string Time = SeverTime.ToLongTimeString();
  2130. //晚班
  2131. if (Shift == "3")
  2132. {
  2133. Time = Time.Replace(":", "");
  2134. if (int.Parse(Time) > 205900)
  2135. {
  2136. StartTime += " " + "21:00:00";
  2137. EndTime += " " + "10:00:00";
  2138. }
  2139. else
  2140. {
  2141. StartTime = SeverTime.AddDays(-1).ToString("yyyy-MM-dd") + " " + "21:00:00";
  2142. EndTime = SeverTime.ToString("yyyy-MM-dd") + " " + "10:00:00";
  2143. }
  2144. }
  2145. //StartTime = StartTime + " 00:00:00";
  2146. //EndTime = EndTime + " 00:00:00";
  2147. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.GetSingleFurNodeResult", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
  2148. FrmNodeResultQuery frm = new FrmNodeResultQuery(dt, 3, Date, Shift, Group, this.ob);
  2149. frm.ShowDialog();
  2150. }
  2151. /// <summary>
  2152. /// 当班工具更换
  2153. /// </summary>
  2154. private void DoToolChange()
  2155. {
  2156. string Shift = UserInfo.GetUserOrder();
  2157. string Group = UserInfo.GetUserGroup();
  2158. string User = UserInfo.GetUserName();
  2159. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2160. string StartTime = SeverTime.ToString("yyyy-MM-dd");
  2161. string EndTime = SeverTime.AddDays(1).ToString("yyyy-MM-dd");
  2162. string Date = StartTime;
  2163. string Time = SeverTime.ToLongTimeString();
  2164. ////晚班
  2165. //if (Shift == "3")
  2166. //{
  2167. // Time = Time.Replace(":", "");
  2168. // if (int.Parse(Time) > 205900)
  2169. // {
  2170. // StartTime += " " + "21:00:00";
  2171. // EndTime += " " + "07:00:00";
  2172. // }
  2173. // else
  2174. // {
  2175. // StartTime = SeverTime.AddDays(-1).ToString("yyyy-MM-dd") + " " + "21:00:00";
  2176. // EndTime = SeverTime.ToString("yyyy-MM-dd") + " " + "07:00:00";
  2177. // }
  2178. //}
  2179. //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.PerforationResult.toolChangeQuery", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
  2180. txtQuery frm = new txtQuery(1, Date, Shift, Group, _UserName, PlineCode, this.ob);
  2181. frm.ShowDialog();
  2182. }
  2183. /// <summary>
  2184. /// checkbox点击事件
  2185. /// </summary>
  2186. /// <param name="sender"></param>
  2187. /// <param name="e"></param>
  2188. private void chkDate_CheckedChanged(object sender, EventArgs e)
  2189. {
  2190. //if (chkDate.Checked)
  2191. //{
  2192. // dtStartDate.Enabled = true;
  2193. // dtEndDate.Enabled = true;
  2194. //}
  2195. //else
  2196. //{
  2197. // dtStartDate.Enabled = false;
  2198. // dtEndDate.Enabled = false;
  2199. //}
  2200. if (chkLotNo.Checked)
  2201. {
  2202. txtLOT_NO.Enabled = true;
  2203. }
  2204. else
  2205. {
  2206. txtLOT_NO.Enabled = false;
  2207. }
  2208. if (chkHeatNo.Checked)
  2209. {
  2210. txtJudgeStoveNo.Enabled = true;
  2211. }
  2212. else
  2213. {
  2214. txtJudgeStoveNo.Enabled = false;
  2215. }
  2216. if (chkStatusQuery.Checked)
  2217. {
  2218. PlanStatusQuery = "99";
  2219. PlanStartStatusQuery = "30";
  2220. }
  2221. else
  2222. {
  2223. PlanStatusQuery = "29";
  2224. PlanStartStatusQuery = "00";
  2225. }
  2226. if (chkAutoRefresh.Checked)
  2227. {
  2228. timer1.Enabled = true;
  2229. }
  2230. else
  2231. {
  2232. timer1.Enabled = false;
  2233. }
  2234. }
  2235. private void frmTechnological1_DoubleClickEvent(DataTable dt)
  2236. {
  2237. NativeMethodNew NmN = new NativeMethodNew(this.ob);
  2238. HOTMethod HOTm = new HOTMethod(this.ob);
  2239. if (!NmN.isBegineNode(ActiveJUDGE_STOVE_NO, 2))
  2240. {
  2241. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未开始穿孔,不能带入参数。");
  2242. return;
  2243. }
  2244. //if (HOTm.isNode(ActiveJUDGE_STOVE_NO, ActiveResultNo, 2, PlineCode))
  2245. //{
  2246. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成穿孔,不能带入参数。");
  2247. // return;
  2248. //}
  2249. MilPerforationResultEntity PerResultEdit = new MilPerforationResultEntity();
  2250. PerResultEdit = (MilPerforationResultEntity)EntityTool.setObjectByDataTable(PerResultEdit, dt);
  2251. this.perforationResult1.UpdateDateForPrama(PerResultEdit);
  2252. ShowMessageFlag = 1;
  2253. PerResultSave();
  2254. ShowMessageFlag = 0;
  2255. }
  2256. /// <summary>
  2257. /// 到点提示交班
  2258. /// </summary>
  2259. /// <param name="sender"></param>
  2260. /// <param name="e"></param>
  2261. private void timer2_Tick_1(object sender, EventArgs e)
  2262. {
  2263. if (!PlineCode.Equals("C072"))
  2264. {
  2265. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2266. string Time = SeverTime.ToLongTimeString();
  2267. Time = Time.Replace(":", "");
  2268. if (ChangeFlag == 0)
  2269. {
  2270. if (int.Parse(Time) > 065459 && int.Parse(Time) < 065600 || int.Parse(Time) > 070359 && int.Parse(Time) < 070500)
  2271. {
  2272. if (Shift == "3")
  2273. {
  2274. if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
  2275. {
  2276. }
  2277. ChangeFlag = 1;
  2278. return;
  2279. }
  2280. }
  2281. if (int.Parse(Time) > 135359 && int.Parse(Time) < 135500 || int.Parse(Time) > 140359 && int.Parse(Time) < 140500)
  2282. {
  2283. if (Shift == "1")
  2284. {
  2285. if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
  2286. {
  2287. }
  2288. ChangeFlag = 1;
  2289. return;
  2290. }
  2291. }
  2292. if (int.Parse(Time) > 205359 && int.Parse(Time) < 205500 || int.Parse(Time) > 210359 && int.Parse(Time) < 210500)
  2293. {
  2294. if (Shift == "2")
  2295. {
  2296. if (MessageUtil.ShowYesNoAndQuestion("确认最后一炉已交班或已结炉!") == DialogResult.Yes)
  2297. {
  2298. }
  2299. ChangeFlag = 1;
  2300. return;
  2301. }
  2302. }
  2303. }
  2304. }
  2305. }
  2306. /// <summary>
  2307. /// 管号队列修改剔除原因 备注
  2308. /// </summary>
  2309. /// <param name="sender"></param>
  2310. /// <param name="e"></param>
  2311. private void ultraGridMatSeq_KeyPress(object sender, KeyPressEventArgs e)
  2312. {
  2313. if (e.KeyChar == (char)13)
  2314. {
  2315. e.Handled = true;
  2316. UltraGridRow ugr = null;
  2317. int Index = ultraGrid_GHDL.ActiveRow.Index;
  2318. if (Index < ultraGrid_GHDL.Rows.Count - 1)
  2319. {
  2320. ugr = ultraGrid_GHDL.Rows[Index - 1];
  2321. // ugr = ultraGrid1.ActiveRow;
  2322. }
  2323. else
  2324. {
  2325. ugr = ultraGrid_GHDL.ActiveRow;
  2326. }
  2327. ultraGrid_GHDL.UpdateData();
  2328. ultraGrid_GHDL.Update();
  2329. string ScrapReason = ugr.Cells["SCRAP_REASON"].Text.ToString().Trim();
  2330. string Remark = ugr.Cells["REMARK"].Text.ToString();
  2331. string Seq = ugr.Cells["SEQ"].Text.ToString();
  2332. string Status = ugr.Cells["STATUS"].Text.ToString();
  2333. if (Status == "剔除")
  2334. {
  2335. int dt = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateMatNoPro", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 2, Seq, ScrapReason, Remark }, this.ob);
  2336. }
  2337. ultraGridTC();
  2338. ChangeGridColor();
  2339. GetGridButtonName();
  2340. }
  2341. }
  2342. private void perforationResult1_KeyPress(object sender, KeyPressEventArgs e)
  2343. {
  2344. //if (e.KeyChar == (char)13 || e.KeyChar == (char)9)
  2345. //{
  2346. e.Handled = true;
  2347. UltraGridRow ugr = perforationResult1.UltraGrid1.ActiveRow;
  2348. UltraGridCell ugc = perforationResult1.UltraGrid1.ActiveCell;
  2349. //perforationResult1.UltraGrid1.UpdateData();
  2350. double DbUp = 0;
  2351. double DbDown = 0;
  2352. double RollerUp = 0;
  2353. double RollerDown = 0;
  2354. if (!string.IsNullOrEmpty(ugr.Cells["db_loca_up"].Value.ToString()))
  2355. {
  2356. DbUp = double.Parse(ugr.Cells["db_loca_up"].Value.ToString());
  2357. }
  2358. if (!string.IsNullOrEmpty(ugr.Cells["db_loca_down"].Value.ToString()))
  2359. {
  2360. DbDown = double.Parse(ugr.Cells["db_loca_down"].Value.ToString());
  2361. }
  2362. if (!string.IsNullOrEmpty(ugr.Cells["zg_loca_up"].Value.ToString()))
  2363. {
  2364. RollerUp = double.Parse(ugr.Cells["zg_loca_up"].Value.ToString());
  2365. }
  2366. if (!string.IsNullOrEmpty(ugr.Cells["zg_loca_down"].Value.ToString()))
  2367. {
  2368. RollerDown = double.Parse(ugr.Cells["zg_loca_down"].Value.ToString());
  2369. }
  2370. if (ugc.Column.Key == "db_loca_up")
  2371. {
  2372. this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
  2373. perforationResult1.UpdateDataForGuideSpace();
  2374. }
  2375. if (ugc.Column.Key == "db_loca_down")
  2376. {
  2377. this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
  2378. perforationResult1.UpdateDataForGuideSpace();
  2379. }
  2380. if (ugc.Column.Key == "zg_loca_up")
  2381. {
  2382. this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
  2383. perforationResult1.UpdateDataForRollerSpace();
  2384. }
  2385. if (ugc.Column.Key == "zg_loca_down")
  2386. {
  2387. this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
  2388. perforationResult1.UpdateDataForRollerSpace();
  2389. }
  2390. this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
  2391. perforationResult1.UpdateDataForGuideSpace();
  2392. this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
  2393. perforationResult1.UpdateDataForRollerSpace();
  2394. // }
  2395. }
  2396. private void perforationResult1_GridCellChange(object sender, CellEventArgs e)
  2397. {
  2398. if (PlineCode == "C008" || PlineCode == "C010")
  2399. {
  2400. return;
  2401. }
  2402. if (e.Cell.Column.Key == "db_loca_up" || e.Cell.Column.Key == "db_loca_down" || e.Cell.Column.Key == "zg_loca_up" || e.Cell.Column.Key == "zg_loca_down")
  2403. {
  2404. UltraGridRow ugr = perforationResult1.UltraGrid1.ActiveRow;
  2405. UltraGridCell ugc = perforationResult1.UltraGrid1.ActiveCell;
  2406. perforationResult1.UltraGrid1.UpdateData();
  2407. double DbUp = 0;
  2408. double DbDown = 0;
  2409. double RollerUp = 0;
  2410. double RollerDown = 0;
  2411. if (!string.IsNullOrEmpty(ugr.Cells["db_loca_up"].Value.ToString()))
  2412. {
  2413. DbUp = double.Parse(ugr.Cells["db_loca_up"].Value.ToString());
  2414. }
  2415. if (!string.IsNullOrEmpty(ugr.Cells["db_loca_down"].Value.ToString()))
  2416. {
  2417. DbDown = double.Parse(ugr.Cells["db_loca_down"].Value.ToString());
  2418. }
  2419. if (!string.IsNullOrEmpty(ugr.Cells["zg_loca_up"].Value.ToString()))
  2420. {
  2421. RollerUp = double.Parse(ugr.Cells["zg_loca_up"].Value.ToString());
  2422. }
  2423. if (!string.IsNullOrEmpty(ugr.Cells["zg_loca_down"].Value.ToString()))
  2424. {
  2425. RollerDown = double.Parse(ugr.Cells["zg_loca_down"].Value.ToString());
  2426. }
  2427. if (ugc.Column.Key == "db_loca_up")
  2428. {
  2429. this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
  2430. perforationResult1.UpdateDataForGuideSpace();
  2431. }
  2432. if (ugc.Column.Key == "db_loca_down")
  2433. {
  2434. this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
  2435. perforationResult1.UpdateDataForGuideSpace();
  2436. }
  2437. if (ugc.Column.Key == "zg_loca_up")
  2438. {
  2439. this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
  2440. perforationResult1.UpdateDataForRollerSpace();
  2441. }
  2442. if (ugc.Column.Key == "zg_loca_down")
  2443. {
  2444. this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
  2445. perforationResult1.UpdateDataForRollerSpace();
  2446. }
  2447. this.perforationResult1.Value.GuideSpace = (DbUp + DbDown).ToString();
  2448. perforationResult1.UpdateDataForGuideSpace();
  2449. this.perforationResult1.Value.RollerSpace = (RollerUp + RollerDown).ToString();
  2450. perforationResult1.UpdateDataForRollerSpace();
  2451. }
  2452. }
  2453. }
  2454. }