FrmReFurResult.cs 135 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Server;
  12. using Infragistics.Win.UltraWinGrid;
  13. using Core.Mes.Client.Comm.Tool;
  14. using Core.StlMes.Client.ZGMil.Entity;
  15. using com.steering.mes.zgmil.entity;
  16. using Core.StlMes.Client.ZGMil.NodeResultQuery;
  17. using System.Net;
  18. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  19. using Core.StlMes.Client.ZGMil.Common;
  20. using CoreFS.SA06;
  21. namespace Core.StlMes.Client.ZGMil.Result
  22. {
  23. public partial class FrmReFurResult : FrmBase
  24. {
  25. #region 初始化
  26. private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
  27. int PanelSizeFlag = 0;
  28. RollingInfomation rf = new RollingInfomation();
  29. FeedRowPlan QuertFeedplan = new FeedRowPlan();
  30. MilPlan QueryMainPlan = new MilPlan();
  31. FeedRowPlan Feedplan = new FeedRowPlan();
  32. MilPlan MainPlan = new MilPlan();
  33. MilRollingResultEntity RollingRs = new MilRollingResultEntity();
  34. FeedSawResultEntity FeedSawResult = new FeedSawResultEntity();
  35. MilRefurResultEntity RefurRs = new MilRefurResultEntity();
  36. MilRefurRackEntity RefurRack = new MilRefurRackEntity();
  37. MilSlabScrapSeqEntity ScrapSeq = new MilSlabScrapSeqEntity();
  38. private UltraGridRow ActiveUgr = null;
  39. private string ActiveJUDGE_STOVE_NO = null;//主计划活动行的判定炉号
  40. private string ActiveStatus = null;////主计划活动行的状态
  41. private string ActiveResultNo = ""; //主计划活动行ResultNo
  42. private string proPlanId = null;//轧管订单编号
  43. private string gxPlanNo = null;//工序排产序号
  44. private string lotNo = null;//生产批号
  45. int ShowMessageFlag = 0;
  46. MilRefurResultEntity temprefur = new MilRefurResultEntity();//保存当前实绩类
  47. string PlanStatusQuery = "50";
  48. string Shift = "";
  49. string Group = "";
  50. private string Departm = "";//部门
  51. private string PlineCode = "";//产线
  52. private string _UserName = "";
  53. private string _UserID = "";
  54. // private string _Url = "";
  55. private int _MouseLocX = 0; //鼠标横坐标
  56. private int _MouseLocY = 0; //鼠标纵坐标
  57. public Infragistics.Win.UltraWinGrid.UltraGrid Grid
  58. {
  59. get { return _grid; }
  60. }
  61. public FrmReFurResult()
  62. {
  63. Shift = UserInfo.GetUserOrder();
  64. Group = UserInfo.GetUserGroup();
  65. InitializeComponent();
  66. PanelSizeFlag = 0;
  67. this.reFurResult1.UltraGrid2.ClickCellButton += new CellEventHandler(UltraGrid2_ClickCellButton);
  68. //获取鼠标坐标
  69. Point formPoint = this.PointToClient(Control.MousePosition);
  70. _MouseLocX = Convert.ToInt32(formPoint.X);
  71. _MouseLocY = Convert.ToInt32(formPoint.Y);
  72. }
  73. protected override void OnLoad(EventArgs e)
  74. {
  75. base.OnLoad(e);
  76. //屏蔽Grid筛选条件
  77. foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
  78. {
  79. ugc.SortIndicator = SortIndicator.Disabled;
  80. }
  81. rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  82. rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  83. ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  84. reFurResult1.UltraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  85. ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  86. InitControl();
  87. foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
  88. {
  89. ugc.SortIndicator = SortIndicator.Disabled;
  90. }
  91. foreach (UltraGridColumn ugc in this.ultraGridINFurInfor.DisplayLayout.Bands[0].Columns)
  92. {
  93. ugc.SortIndicator = SortIndicator.Disabled;
  94. }
  95. foreach (UltraGridColumn ugc in this.ultraGridOUTFurInfor.DisplayLayout.Bands[0].Columns)
  96. {
  97. ugc.SortIndicator = SortIndicator.Disabled;
  98. }
  99. timer1.Tick += new EventHandler(timer1_Tick);
  100. ShowShift();
  101. }
  102. private void ShowShift()
  103. {
  104. colShowShiftGroup1.Ob = this.ob;
  105. colShowShiftGroup1.Group = this.UserInfo.GetUserGroup();
  106. colShowShiftGroup1.Shift = this.UserInfo.GetUserOrder();
  107. colShowShiftGroup1.ShowShift();
  108. colShowShiftGroup1.Timer1.Enabled = true;
  109. }
  110. /// <summary>
  111. /// 页面开启事件
  112. /// </summary>
  113. /// <param name="e"></param>
  114. protected override void OnShown(EventArgs e)
  115. {
  116. base.OnShown(e);
  117. string hostname = Dns.GetHostName();
  118. IPAddress ip = Dns.GetHostByName(hostname).AddressList[0];
  119. NativeMethodNew na = new NativeMethodNew(this.ob);
  120. Departm = UserInfo.GetDepartment();
  121. PlineCode = na.GetPCode(Departm);//获取 用户 对应的产线
  122. PlanQuery();
  123. foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  124. {
  125. ugr.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString());
  126. }
  127. Sign();
  128. frmTechnological1.InitMilSet(PlineCode, "40030", this.ob);
  129. PlanQuery();
  130. }
  131. /// <summary>
  132. /// 签名
  133. /// </summary>
  134. private void Sign()
  135. {
  136. ColUserName col = new ColUserName();
  137. col.StationId = "4";
  138. col.PlineCode = PlineCode;
  139. col.ColGroup = Group;
  140. col.Ob = this.ob;
  141. col.ShowDialog();
  142. _UserID = col.getUserId();
  143. _UserName = col.getUserName();
  144. }
  145. /// <summary>
  146. /// 初始化控件
  147. /// </summary>
  148. public void InitControl()
  149. {
  150. //if (chkDate.Checked)
  151. //{
  152. // dtStartDate.Enabled = true;
  153. // dtEndDate.Enabled = true;
  154. //}
  155. //else
  156. //{
  157. // dtStartDate.Enabled = false;
  158. // dtEndDate.Enabled = false;
  159. //}
  160. if (chkLotNo.Checked)
  161. {
  162. txtLOT_NO.Enabled = true;
  163. }
  164. else
  165. {
  166. txtLOT_NO.Enabled = false;
  167. }
  168. if (chkHeatNo.Checked)
  169. {
  170. txtJudgeStoveNo.Enabled = true;
  171. }
  172. else
  173. {
  174. txtJudgeStoveNo.Enabled = false;
  175. }
  176. Shift = UserInfo.GetUserOrder();
  177. Group = UserInfo.GetUserGroup();
  178. }
  179. #endregion
  180. #region 按钮操作
  181. /// <summary>
  182. /// ToolBar按钮
  183. /// </summary>
  184. /// <param name="sender"></param>
  185. /// <param name="ToolbarKey"></param>
  186. public override void ToolBar_Click(object sender, string ToolbarKey)
  187. {
  188. switch (ToolbarKey)
  189. {
  190. case "Query":
  191. PlanQuery();
  192. break;
  193. case "Save":
  194. FeedRowSave();
  195. break;
  196. case "Node":
  197. FeedSawResultNode();
  198. break;
  199. case "DoNodeBack":
  200. NodeBack();
  201. break;
  202. case "DoSign":
  203. Sign();
  204. break;
  205. case "NodeQuery":
  206. NodeQuery();
  207. break;
  208. case "DoChangeCancel":
  209. ChangeCancel();
  210. break;
  211. case "DoQueryBefore":
  212. QueryBefore();
  213. break;
  214. case "DoPrint":
  215. PrintResult();
  216. break;
  217. case "DoStart":
  218. DoStart();
  219. break;
  220. case "DoStartBack":
  221. StartBack();
  222. break;
  223. case "Close":
  224. this.Dispose();
  225. this.Close();
  226. break;
  227. }
  228. }
  229. /// <summary>
  230. /// 查询主计划
  231. /// </summary>
  232. private void PlanQuery()
  233. {
  234. string PrimaKey = "";
  235. string PrimaKey1 = "";
  236. string PrimaKey2 = "";
  237. UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
  238. if (ugr != null)
  239. {
  240. PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  241. }
  242. UltraGridRow ugrIN = this.ultraGridINFurInfor.ActiveRow;
  243. if (ugrIN != null)
  244. {
  245. PrimaKey1 = ugrIN.Cells["JUDGE_STOVE_NO"].Value.ToString();
  246. }
  247. UltraGridRow ugrOUT = this.ultraGridOUTFurInfor.ActiveRow;
  248. if (ugrOUT != null)
  249. {
  250. PrimaKey2 = ugrOUT.Cells["JUDGE_STOVE_NO"].Value.ToString();
  251. }
  252. if (chkHeatNo.Checked)
  253. {
  254. if (this.txtJudgeStoveNo.Text == "")
  255. {
  256. MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  257. return;
  258. }
  259. else
  260. {
  261. QueryMainPlan.JudgeStoveNo = this.txtJudgeStoveNo.Text;
  262. }
  263. }
  264. else
  265. {
  266. QueryMainPlan.JudgeStoveNo = "";
  267. }
  268. if (chkLotNo.Checked)
  269. {
  270. if (this.txtLOT_NO.Text == "")
  271. {
  272. MessageBox.Show("请输入生产批号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  273. return;
  274. }
  275. else
  276. {
  277. QueryMainPlan.LotNo = this.txtLOT_NO.Text;
  278. }
  279. }
  280. else
  281. {
  282. QueryMainPlan.LotNo = "";
  283. }
  284. dtPlan.Clear();
  285. tbRollDate.Clear();
  286. dtINFurInfor.Clear();
  287. dtOUTFurInfor.Clear();
  288. QueryMainPlan.PlineCode = PlineCode;
  289. QueryMainPlan.Status = PlanStatusQuery;
  290. if (ultraTabControl3.Tabs[0].Active)
  291. {
  292. //查询待装炉计划
  293. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getINFurPlan", new object[] { QueryMainPlan.PlineCode, QueryMainPlan.LotNo, QueryMainPlan.JudgeStoveNo }, this.ob);
  294. if (dt.Rows.Count > 0)
  295. {
  296. GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
  297. foreach (UltraGridRow ugr1 in ultraGridPlan.Rows)
  298. {
  299. if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
  300. {
  301. ugr1.Activated = true;
  302. }
  303. }
  304. }
  305. }
  306. else if (ultraTabControl3.Tabs[1].Active)
  307. {
  308. //查询待出炉炉次计划
  309. DataTable dtINFur = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getINFurOUTPlan", new object[] { QueryMainPlan.PlineCode, QueryMainPlan.LotNo, QueryMainPlan.JudgeStoveNo }, this.ob);
  310. {
  311. if (dtINFur.Rows.Count > 0)
  312. {
  313. GridHelper.CopyDataToDatatable(ref dtINFur, ref dtINFurInfor, true);
  314. foreach (UltraGridRow ugrINFur in ultraGridINFurInfor.Rows)
  315. {
  316. if (ugrINFur.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey1)
  317. {
  318. ugrINFur.Activated = true;
  319. }
  320. }
  321. }
  322. }
  323. }
  324. else if (ultraTabControl3.Tabs[2].Active)
  325. {
  326. //查询已出炉炉次计划
  327. DataTable dtOUTFur = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getOUTFurPlan", new object[] { QueryMainPlan.PlineCode, QueryMainPlan.LotNo, QueryMainPlan.JudgeStoveNo }, this.ob);
  328. {
  329. if (dtOUTFur.Rows.Count > 0)
  330. {
  331. GridHelper.CopyDataToDatatable(ref dtOUTFur, ref dtOUTFurInfor, true);
  332. foreach (UltraGridRow ugrOUTFur in ultraGridOUTFurInfor.Rows)
  333. {
  334. if (ugrOUTFur.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey2)
  335. {
  336. ugrOUTFur.Activated = true;
  337. }
  338. }
  339. }
  340. }
  341. }
  342. ChangeGridColor();
  343. }
  344. /// <summary>
  345. /// 单击主计划
  346. /// </summary>
  347. /// <param name="sender"></param>
  348. /// <param name="e"></param>
  349. private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e)
  350. {
  351. tbRollDate.Clear();
  352. switch (ultraTabControl3.SelectedTab.Index)
  353. {
  354. case 0:
  355. if (this.dtPlan.Rows.Count > 0)
  356. {
  357. ActiveUgr = ultraGridPlan.ActiveRow;
  358. AfterRowActive(ActiveUgr);
  359. }
  360. else
  361. {
  362. ActiveUgr = null;
  363. }
  364. break;
  365. case 1:
  366. if (this.dtINFurInfor.Rows.Count > 0)
  367. {
  368. ActiveUgr = ultraGridINFurInfor.ActiveRow;
  369. AfterRowActive(ActiveUgr);
  370. }
  371. else
  372. {
  373. ActiveUgr = null;
  374. }
  375. break;
  376. case 2:
  377. if (this.dtOUTFurInfor.Rows.Count > 0)
  378. {
  379. ActiveUgr = ultraGridOUTFurInfor.ActiveRow;
  380. AfterRowActive(ActiveUgr);
  381. }
  382. else
  383. {
  384. ActiveUgr = null;
  385. }
  386. break;
  387. }
  388. }
  389. /// <summary>
  390. /// 单击行激活方法
  391. /// </summary>
  392. /// <param name="ugr"></param>
  393. private void AfterRowActive(UltraGridRow ugr)
  394. {
  395. if (ugr == null)
  396. {
  397. return;
  398. }
  399. //查询主计划信息
  400. tbRollDate.Clear();
  401. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  402. string Status = ugr.Cells["IS_START"].Value.ToString();
  403. proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
  404. gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
  405. lotNo = ugr.Cells["LOT_NO"].Value.ToString();
  406. MainPlan.JudgeStoveNo = JudgeStoveNo;
  407. MainPlan.ProPlanId = proPlanId;
  408. MainPlan.GxPlanNo = gxPlanNo;
  409. ActiveJUDGE_STOVE_NO = JudgeStoveNo;
  410. ActiveStatus = ugr.Cells["IS_START"].Value.ToString();
  411. ActiveResultNo = ugr.Cells["ID"].Value.ToString();
  412. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
  413. if (dtMP.Rows.Count > 0)
  414. {
  415. GridEdit(dtMP); //轧制计划信息
  416. //查询流通卡信息
  417. DataTable dtRollingCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  418. if (dtRollingCard.Rows.Count > 0)
  419. {
  420. RollingCardEditGrid(dtRollingCard, JudgeStoveNo);
  421. }
  422. else
  423. {
  424. //清空流通卡值
  425. rollingCard1.ClearData();
  426. //GridHelper.InitCardGrid(rollingCard1.RollCardDataSource1, rollingCard1.UltraGrid4);
  427. }
  428. //查询加热炉实绩信息
  429. DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  430. if (dtFurResult.Rows.Count > 0)
  431. {
  432. GridEditResult(dtFurResult);
  433. }
  434. else
  435. {
  436. MilRefurResultEntity fr = new com.steering.mes.zgmil.entity.MilRefurResultEntity();
  437. reFurResult1.Value = fr;
  438. ////清空加热炉实绩
  439. //// GridHelper.InitCardGrid(furResult1.FurResultDateSource1, furResult1.UltraGrid3);
  440. ////加一段温度
  441. //txtTemp1.Text = "0.00";
  442. ////加二段温度
  443. //txtTemp2.Text = "0.00";
  444. ////加三段温度
  445. //txtTemp3.Text = "0.00";
  446. ////加四段温度
  447. //txtTemp4.Text = "0.00";
  448. ////加五段温度
  449. //txtTemp5.Text = "0.00";
  450. ////加六段温度
  451. //txtTemp6.Text = "0.00";
  452. ////加七段温度
  453. //txtTemp7.Text = "0.00";
  454. ////加八段温度
  455. //txtTemp8.Text = "0.00";
  456. ////炉压
  457. //txtFurTemp1.Text = "0.00";
  458. ////风压
  459. //txtPress1.Text = "0.00";
  460. ////天然气压力
  461. //txtGasPress1.Text = "0.00";
  462. }
  463. }
  464. if (Status != "未开始入炉")
  465. {
  466. RackQuery(JudgeStoveNo);
  467. }
  468. else
  469. {
  470. tbRollDate.Rows.Clear();
  471. }
  472. GetRollingCard();//流通卡赋值
  473. refurResultQuery();
  474. //ChangeGridColor();
  475. }
  476. /// <summary>
  477. /// 双击入炉
  478. /// </summary>
  479. /// <param name="sender"></param>
  480. /// <param name="e"></param>
  481. private void DoStart()
  482. // private void ultraGridPlan_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
  483. {
  484. HOTMethod hm = new HOTMethod(this.ob);
  485. DataTable dt = new DataTable();
  486. if (ActiveUgr == null)
  487. {
  488. return;
  489. }
  490. else
  491. {
  492. //if (!IsStart())
  493. //{
  494. // return;
  495. //}
  496. UltraGridRow ugr = ActiveUgr;
  497. string HeatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();//判定炉号
  498. string ResultNo = ugr.Cells["ID"].Value.ToString();//实绩编号
  499. ActiveStatus = ugr.Cells["IS_START"].Value.ToString();
  500. NativeMethodNew Nvw = new NativeMethodNew(this.ob);
  501. //if (!Nvw.isBegineNode(HeatNo, 3))
  502. //{
  503. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】未连轧,不能入再加热炉。");
  504. // return;
  505. //}
  506. if (ActiveStatus == "已完成出炉")
  507. {
  508. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已完成入炉,不允许再次入炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  509. return;
  510. }
  511. if (ActiveStatus == "已开始入炉")
  512. {
  513. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】已开始入炉,不允许再次入炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  514. return;
  515. }
  516. if (hm.InFurIsEnd("0", PlineCode, 1).Rows.Count > 0)
  517. {
  518. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(hm.InFurIsEnd("0", PlineCode, 1).Rows[0][0].ToString()) + "】正在入炉,当前炉号:【" + BaseMethod.getJudgeStoveNo(HeatNo) + "】不能开始入炉");
  519. return;
  520. }
  521. RefurRs.Clear();
  522. if (ugr.Cells["IS_START"].Text.ToString().Trim() == "已开始再加热")
  523. {
  524. MessageBox.Show("已入再加热炉,无法进行再次入炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  525. return;
  526. }
  527. else
  528. {
  529. MainPlan.JudgeStoveNo = HeatNo;
  530. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
  531. GridEdit(dtMP); //轧制计划信息
  532. if (temprefur != null)
  533. {
  534. RefurRs.FirstInTemp = temprefur.FirstInTemp;
  535. RefurRs.FirstOutTemp = temprefur.FirstOutTemp;
  536. RefurRs.LastInTemp = temprefur.LastInTemp;
  537. RefurRs.LastOutTemp = temprefur.LastOutTemp;
  538. RefurRs.ProcessRoute = temprefur.ProcessRoute;
  539. RefurRs.SetFurTemp = temprefur.SetFurTemp;
  540. RefurRs.TransferRhythm = temprefur.TransferRhythm;
  541. RefurRs.SteppingRhythm = temprefur.SteppingRhythm;
  542. RefurRs.BeginRollingTemp = temprefur.BeginRollingTemp;
  543. //加一段温度
  544. RefurRs.LheatCruve1 = temprefur.LheatCruve1;
  545. //加二段温度
  546. RefurRs.LheatCruve2 = temprefur.LheatCruve2;
  547. //加三段温度
  548. RefurRs.LheatCruve3 = temprefur.LheatCruve3;
  549. //加四段温度
  550. RefurRs.LheatCruve4 = temprefur.LheatCruve4;
  551. //加五段温度
  552. RefurRs.LheatCruve5 = temprefur.LheatCruve5;
  553. //加六段温度
  554. RefurRs.LheatCruve6 = temprefur.LheatCruve6;
  555. //加七段温度
  556. RefurRs.LheatCruve7 = temprefur.LheatCruve7;
  557. //加八段温度
  558. RefurRs.LheatCruve8 = temprefur.LheatCruve8;
  559. //炉温
  560. RefurRs.FurPress = temprefur.FurPress;
  561. //风压
  562. RefurRs.WindPress = temprefur.WindPress;
  563. //天然气压力
  564. RefurRs.GasPress = temprefur.GasPress;
  565. }
  566. //DataTable dtBR = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getBurnningRate", new object[] { PlineCode }, this.ob);
  567. //if (dtBR.Rows.Count > 0)
  568. //{
  569. // RefurRs.Burningrate = dtBR.Rows[0][0].ToString();
  570. //}
  571. string stoveNo = dtMP.Rows[0]["STOVE_NO"].ToString();//熔炼炉号
  572. string lotNo = dtMP.Rows[0]["LOT_NO"].ToString();//生产批号
  573. string factoryId = dtMP.Rows[0]["PLINE_CODE"].ToString();//产线
  574. RefurRs.JudgeStoveNo = HeatNo;
  575. RefurRs.StoveNo = stoveNo;
  576. RefurRs.LotNo = lotNo;
  577. RefurRs.PlineCode = factoryId;
  578. RefurRs.ColUser = this.UserInfo.GetUserName();
  579. RefurRs.ColShift = this.UserInfo.GetUserOrder();
  580. RefurRs.ColGroup = this.UserInfo.GetUserGroup();
  581. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  582. string Time = SeverTime.AddMinutes(1).ToString("yyyy-MM-dd HH:mm:ss");
  583. RefurRs.StartTime = Time;
  584. RefurRs.FirstInTime = Time;
  585. RefurRs.ResultNo = ResultNo;
  586. RefurRs.NodeFurFlag = "0";
  587. RefurRs.ProPlanId = proPlanId;
  588. RefurRs.GxPlanNo = gxPlanNo;
  589. //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + HeatNo + "】开始入炉?") == DialogResult.No)
  590. //{
  591. // return;
  592. //}
  593. //修改主计划状态、新增再加热实绩
  594. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.insertResultForMainPlan", new object[] { RefurRs }, this.ob);
  595. //往跟踪记录表插入开始时间
  596. NativeMethodNew na = new NativeMethodNew(this.ob);
  597. na.InsertSTAferDoubleClick(RefurRs.JudgeStoveNo.ToString(), 4, "0", proPlanId, gxPlanNo);
  598. //查询主表记录
  599. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { QueryMainPlan, 5 }, this.ob);
  600. GridHelper.CopyDataToDatatable(ref dt1, ref dtPlan, true);
  601. ChangeCellName();
  602. // ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
  603. foreach (UltraGridRow ugr1 in this.ultraGridPlan.Rows)
  604. {
  605. ugr1.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString());
  606. //if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == HeatNo)
  607. //{
  608. // ultraGridPlan.ActiveRow = ugr1;
  609. //}
  610. }
  611. }
  612. ChangeGridColor();
  613. PlanQuery();
  614. RackQuery(HeatNo);
  615. }
  616. }
  617. /// <summary>
  618. /// 开始回退
  619. /// </summary>
  620. private void StartBack()
  621. {
  622. if (ActiveUgr == null)
  623. {
  624. return;
  625. }
  626. else
  627. {
  628. UltraGridRow ugr = ActiveUgr;
  629. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  630. string ResultNo = ugr.Cells["ID"].Value.ToString();
  631. string StartStatus = ugr.Cells["IS_START"].Value.ToString();
  632. if (StartStatus == "已完成出炉")
  633. {
  634. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已结炉,不能入炉回退!!!!");
  635. return;
  636. }
  637. if (StartStatus == "未开始入炉")
  638. {
  639. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始入炉,不能入炉回退!!!!");
  640. return;
  641. }
  642. //NativeMethodNew nvw = new NativeMethodNew(this.ob);
  643. //if (nvw.isBegineNode(JudgeStoveNo, 5))
  644. //{
  645. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已开始定径,不能开始回退!!!!");
  646. // return;
  647. //}
  648. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.startBack", new object[] { JudgeStoveNo, ResultNo, 4, PlineCode, proPlanId, gxPlanNo }, this.ob);
  649. ChangeGridColor();
  650. PlanQuery();
  651. }
  652. }
  653. /// <summary>
  654. /// 保存
  655. /// </summary>
  656. private void FeedRowSave()
  657. {
  658. if (ActiveUgr == null)
  659. {
  660. return;
  661. }
  662. int count = 0;
  663. try
  664. {
  665. reFurResult1.UltraGrid2.UpdateData();
  666. }
  667. catch (Exception e)
  668. {
  669. MessageBox.Show("请输入正确的时间。");
  670. return;
  671. }
  672. UltraGridRow ugrg = this.reFurResult1.UltraGrid2.Rows[0];
  673. string heatNo = null;
  674. this.reFurResult1.UltraGrid2.UpdateData();
  675. RefurRs.Clear();//清空公共类
  676. if (this.ActiveUgr == null && ActiveJUDGE_STOVE_NO == null)
  677. {
  678. MessageBox.Show("未选择任何炉号,请选择炉号后进行保存操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  679. return;
  680. }
  681. if (this.ActiveUgr == null)
  682. {
  683. RefurRs.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
  684. }
  685. else
  686. {
  687. heatNo = ActiveUgr.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
  688. RefurRs.JudgeStoveNo = heatNo;
  689. }
  690. if (ActiveStatus == "未开始入炉")
  691. {
  692. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(RefurRs.JudgeStoveNo.ToString()) + "】未开始进行入炉或,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  693. return;
  694. }
  695. //if (ActiveStatus == "已完成再加热")
  696. //{
  697. // MessageBox.Show("炉号:【" + RefurRs.JudgeStoveNo + "】已完成再加热,不允许进行保存操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  698. // return;
  699. //}
  700. //if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + RefurRs.JudgeStoveNo + "】保存实绩?") == DialogResult.No)
  701. //{
  702. // return;
  703. //}
  704. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob);
  705. if (dt.Rows.Count > 0)//如果上一工序结炉则计算出来料支数等数据
  706. {
  707. if (dt.Rows[0]["NODE_FUR_FLAG"].ToString() == "1")
  708. {
  709. if (!string.IsNullOrEmpty(this.rollingCard1.UltraGrid4.Rows[0].Cells["QualifiedNum5"].Text.ToString().Trim()))//来料支数
  710. {
  711. //来料支数
  712. this.RefurRs.InFurNum = this.rollingCard1.UltraGrid4.Rows[0].Cells["QualifiedNum5"].Text.ToString().Trim();
  713. if (!string.IsNullOrEmpty(this.reFurResult1.UltraGrid2.ActiveRow.Cells["ScrapNum"].Text.ToString()))
  714. {
  715. //剔废支数
  716. RefurRs.ScrapNum = this.reFurResult1.UltraGrid2.ActiveRow.Cells["ScrapNum"].Text.ToString();
  717. //出炉支数
  718. this.RefurRs.OutFurNum = int.Parse(RefurRs.InFurNum.ToString()) - int.Parse(RefurRs.ScrapNum.ToString());
  719. }
  720. else
  721. {
  722. RefurRs.ScrapNum = "0";
  723. RefurRs.OutFurNum = RefurRs.InFurNum.ToString();
  724. }
  725. }
  726. }
  727. }
  728. //RefurRs.InFurNum = ugrg.Cells["InRefurNum"].Value.ToString().Trim();
  729. //RefurRs.ScrapNum = ugrg.Cells["ScrapNum"].Value.ToString().Trim();
  730. //RefurRs.OutFurNum =( int.Parse(RefurRs.InFurNum.ToString()) - int.Parse(RefurRs.ScrapNum.ToString())).ToString();
  731. RefurRs.Changeclassnum = ugrg.Cells["ChangeClassNum"].Value.ToString().Trim().Trim('_');//交接班支数限制问题?
  732. RefurRs.Remark = ugrg.Cells["Remark"].Text.ToString().Trim().Trim('_');
  733. RefurRs.ProcessRoute = ugrg.Cells["ProcessRoute"].Value.ToString().Trim().Trim('_');
  734. RefurRs.SetFurTemp = ugrg.Cells["SetFURTemp"].Value.ToString().Trim().Trim('_');
  735. RefurRs.SteppingRhythm = ugrg.Cells["SteppingRhythm"].Text.ToString().Trim().Trim('_');
  736. if (RefurRs.SteppingRhythm.ToString() == ".")
  737. {
  738. RefurRs.SteppingRhythm = "";
  739. }
  740. RefurRs.TransferRhythm = ugrg.Cells["TransferRhythm"].Value.ToString().Trim().Trim('_');
  741. if (RefurRs.TransferRhythm.ToString() == ".")
  742. {
  743. RefurRs.TransferRhythm = "";
  744. }
  745. RefurRs.ActualLengthOfWastePipe = ugrg.Cells["PipeSize"].Value.ToString().Trim().Trim('_');
  746. RefurRs.FirstInTemp = ugrg.Cells["FirstInTemp"].Value.ToString().Trim().Trim('_');
  747. RefurRs.FirstOutTemp = ugrg.Cells["FirstOutTemp"].Value.ToString().Trim().Trim('_');
  748. RefurRs.FirstInTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_');
  749. RefurRs.LastInTime = ugrg.Cells["LastInTime"].Value.ToString().Trim().Trim('_');
  750. RefurRs.Burningrate = ugrg.Cells["BurningRate"].Value.ToString().Trim().Trim('_');
  751. RefurRs.LastInTemp = ugrg.Cells["LastInTemp"].Value.ToString().Trim().Trim('_');
  752. RefurRs.LastOutTemp = ugrg.Cells["LastOutTemp"].Value.ToString().Trim().Trim('_');
  753. RefurRs.StartTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_');
  754. RefurRs.OutChangeNum = ugrg.Cells["OUT_CHANGE_NUM"].Value.ToString().Trim().Trim('_');
  755. RefurRs.LastOutTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_');
  756. RefurRs.FirstOutTime = ugrg.Cells["FirstOutTime"].Value.ToString().Trim().Trim('_');
  757. RefurRs.StartTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_');
  758. RefurRs.EndTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_');
  759. //RefurRs.LastOutTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim();
  760. //RefurRs.ColUser = this.UserInfo.GetUserName();
  761. //RefurRs.ColShift = this.UserInfo.GetUserOrder();
  762. //RefurRs.ColGroup = this.UserInfo.GetUserGroup();
  763. // RefurRs.JudgeStoveNo = heatNo;
  764. //加一段温度
  765. RefurRs.LheatCruve1 = getstring(ultraTextEditor16.Text.Trim('_'));
  766. //加二段温度
  767. RefurRs.LheatCruve2 = getstring(ultraTextEditor1.Text.Trim('_'));
  768. //加三段温度
  769. RefurRs.LheatCruve3 = getstring(ultraTextEditor10.Text.Trim('_'));
  770. //加四段温度
  771. RefurRs.LheatCruve4 = getstring(ultraTextEditor11.Text.Trim('_'));
  772. //加五段温度
  773. RefurRs.LheatCruve5 = getstring(ultraTextEditor12.Text.Trim('_'));
  774. //加六段温度
  775. RefurRs.LheatCruve6 = getstring(ultraTextEditor13.Text.Trim('_'));
  776. //加七段温度
  777. RefurRs.LheatCruve7 = getstring(ultraTextEditor14.Text.Trim('_'));
  778. //加八段温度
  779. RefurRs.LheatCruve8 = getstring(ultraTextEditor15.Text.Trim('_'));
  780. //炉温
  781. RefurRs.FurPress = getstring(ultraTextEditor19.Text.Trim('_'));
  782. //风压
  783. RefurRs.WindPress = getstring(ultraTextEditor18.Text.Trim('_'));
  784. //天然气压力
  785. RefurRs.GasPress = getstring(ultraTextEditor17.Text.Trim('_'));
  786. //残氧量
  787. RefurRs.ResidualOxygen = "0";
  788. RefurRs.ProPlanId = proPlanId;
  789. RefurRs.GxPlanNo = gxPlanNo;
  790. //if (RefurRs.Changeclassnum.ToString() == "")
  791. //{
  792. // RefurRs.Changeclassnum = "0";
  793. //}
  794. //if (int.Parse(RefurRs.Changeclassnum.ToString()) - int.Parse(RefurRs.InFurNum.ToString()) > 0)
  795. //{
  796. // MessageBox.Show("交接班支数不允许大于入炉支数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  797. // return;
  798. //}
  799. if (string.IsNullOrEmpty(RefurRs.FirstInTime.ToString()))
  800. {
  801. MessageBox.Show("第一支入炉时间不能为空,请输入正确的第一支入炉时间");
  802. return;
  803. }
  804. //查询结炉状态,已结炉的计划 结炉时间不能为空
  805. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, proPlanId, gxPlanNo }, this.ob);
  806. if (int.Parse(dt1.Rows[0][0].ToString()) > 49)
  807. {
  808. if (string.IsNullOrEmpty(RefurRs.LastOutTime.ToString()))
  809. {
  810. MessageBox.Show("最后一支出炉时间不能为空,请输入正确的最后一支出炉时间时间");
  811. return;
  812. }
  813. }
  814. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.resultSave", new object[] { RefurRs }, this.ob);
  815. if (count > 0)
  816. {
  817. MessageBox.Show("再入炉实绩保存完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  818. }
  819. this.reFurResult1.IsCellSelect = false;
  820. temprefur = NativeMethod.GetEntityToEntity(temprefur, RefurRs);//当前实绩备份
  821. ChangeGridColor();
  822. PlanQuery();
  823. RackQuery(ActiveJUDGE_STOVE_NO);
  824. }
  825. /// <summary>
  826. /// 结炉
  827. /// </summary>
  828. private void FeedSawResultNode()
  829. {
  830. FeedRowSave();
  831. try
  832. {
  833. reFurResult1.UltraGrid2.UpdateData();
  834. }
  835. catch (Exception e)
  836. {
  837. MessageBox.Show("请输入正确的时间。");
  838. return;
  839. }
  840. HOTMethod hm = new HOTMethod(this.ob);
  841. if (ActiveUgr == null)
  842. {
  843. return;
  844. }
  845. int count = 0;
  846. RefurRs.Clear();
  847. UltraGridRow ugrg = this.reFurResult1.UltraGrid2.Rows[0];
  848. this.reFurResult1.UltraGrid2.UpdateData();
  849. string heatNo = ActiveUgr.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
  850. this.RefurRs.JudgeStoveNo = heatNo;
  851. this.RollingRs.JudgeStoveNo = heatNo;
  852. string Status = ActiveUgr.Cells["IS_START"].Value.ToString2();
  853. string ResultNo = ActiveUgr.Cells["ID"].Value.ToString2();
  854. string proPlanId = ActiveUgr.Cells["PRO_PLAN_ID"].Value.ToString();
  855. string gxPlanNo = ActiveUgr.Cells["GX_PLAN_NO"].Value.ToString();
  856. //判断是否有重复剔除的坯子
  857. foreach (UltraGridRow ugr4 in ultraGrid1.Rows)
  858. {
  859. if (ugr4.Cells["MAT_NO"].Value.ToString().Equals("") && ugr4.Cells["STATUS"].Value.ToString().Equals("剔除"))
  860. {
  861. MessageBox.Show("不存在序号第【" + ugr4.Cells["SEQ"].Value.ToString() + "】的坯子,它已被其它工序剔除,不能再次剔除", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  862. return;
  863. }
  864. }
  865. if (ActiveStatus == "未开始入炉")
  866. {
  867. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】未开始入炉,不允许结炉!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  868. return;
  869. }
  870. if (ActiveStatus == "已完成出炉")
  871. {
  872. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(heatNo) + "】已出炉,不允许进行结炉操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  873. return;
  874. }
  875. if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】结炉?") == DialogResult.No)
  876. {
  877. return;
  878. }
  879. DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob);
  880. if (dtFurResult1.Rows.Count > 0)
  881. {
  882. if (string.IsNullOrEmpty(dtFurResult1.Rows[0]["FIRST_OUT_TIME"].ToString()))
  883. {
  884. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未出炉,不能结炉。");
  885. return;
  886. }
  887. if (string.IsNullOrEmpty(dtFurResult1.Rows[0]["LAST_IN_TIME"].ToString()))
  888. {
  889. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】最后一支未入炉,不能结炉。");
  890. return;
  891. }
  892. }
  893. else
  894. {
  895. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】未入炉,不能结炉。");
  896. return;
  897. }
  898. string BackPlanFlag = ""; //返线计划标识(5--荒管组炉的炉号)
  899. DataTable dtBackPlanFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getMilPlanFalg", new object[] { heatNo, PlineCode, proPlanId, gxPlanNo }, this.ob);
  900. if (dtBackPlanFlag.Rows.Count > 0)
  901. {
  902. BackPlanFlag = dtBackPlanFlag.Rows[0]["BACK_PLAN_FLAG"].ToString();
  903. }
  904. if (BackPlanFlag != "5")
  905. {
  906. //查询上一炉的实绩
  907. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob);
  908. if (dt.Rows.Count == 0)
  909. {
  910. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】上个工序未开始,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  911. return;
  912. }
  913. if (dt.Rows[0]["NODE_FUR_FLAG"].ToString() != "1")
  914. {
  915. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】上个工序未结炉,不允许结炉!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  916. return;
  917. }
  918. }
  919. if (hm.NodeGetWaitChangeMat(heatNo, ResultNo, 4) > 0)
  920. {
  921. MessageBox.Show("管号【" + hm.NodeGetWaitChangeMat(heatNo, ResultNo, 4) + "】未接班确认,不能结炉");
  922. return;
  923. }
  924. RefurRs.ScrapNum = "0";
  925. //查询本道工序剔除支数
  926. DataTable dtScrapNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapNum", new object[] { heatNo, ResultNo, 4, PlineCode, proPlanId, gxPlanNo }, this.ob);
  927. if (dtScrapNum.Rows.Count > 0)
  928. {
  929. if (!string.IsNullOrEmpty(dtScrapNum.Rows[0][0].ToString()))
  930. {
  931. RefurRs.ScrapNum = dtScrapNum.Rows[0][0].ToString();
  932. }
  933. }
  934. //查询上个工序合格支数
  935. DataTable dtQANum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getQANumBefore", new object[] { heatNo, ResultNo, 4, PlineCode, proPlanId, gxPlanNo }, this.ob);
  936. //入炉支数
  937. if (dtQANum.Rows.Count > 0)
  938. {
  939. RefurRs.InFurNum = dtQANum.Rows[0][0];
  940. NativeMethodNew na = new NativeMethodNew(this.ob);
  941. if (int.Parse(RefurRs.InFurNum.ToString()) - na.GetSlabNum(heatNo, proPlanId, gxPlanNo, 4, this.ob) < 0)
  942. {
  943. //MessageBox.Show("存在上一道工序已经剔除的管坯在本道工序也剔除了,请回退后再进行结炉操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  944. //return;
  945. }
  946. }
  947. else
  948. {
  949. RefurRs.InFurNum = "0";
  950. }
  951. //出炉支数
  952. int InNum = int.Parse(RefurRs.InFurNum.ToString());
  953. int ScrapNum = int.Parse(RefurRs.ScrapNum.ToString());
  954. RefurRs.OutFurNum = (InNum - ScrapNum).ToString();
  955. RefurRs.Changeclassnum = ugrg.Cells["ChangeClassNum"].Value.ToString().Trim().Trim('_');//交接班支数限制问题?
  956. RefurRs.Remark = ugrg.Cells["Remark"].Text.ToString().Trim().Trim('_');
  957. RefurRs.ProcessRoute = ugrg.Cells["ProcessRoute"].Value.ToString().Trim().Trim('_');
  958. RefurRs.SetFurTemp = ugrg.Cells["SetFURTemp"].Value.ToString().Trim().Trim('_');
  959. RefurRs.SteppingRhythm = ugrg.Cells["SteppingRhythm"].Text.ToString().Trim().Trim('_');
  960. if (RefurRs.SteppingRhythm.ToString() == ".")
  961. {
  962. RefurRs.SteppingRhythm = "";
  963. }
  964. RefurRs.TransferRhythm = ugrg.Cells["TransferRhythm"].Value.ToString().Trim().Trim('_');
  965. if (RefurRs.TransferRhythm.ToString() == ".")
  966. {
  967. RefurRs.TransferRhythm = "";
  968. }
  969. RefurRs.ActualLengthOfWastePipe = ugrg.Cells["PipeSize"].Value.ToString().Trim().Trim('_');
  970. RefurRs.FirstInTemp = ugrg.Cells["FirstInTemp"].Value.ToString().Trim().Trim('_');
  971. RefurRs.FirstOutTemp = ugrg.Cells["FirstOutTemp"].Value.ToString().Trim().Trim('_');
  972. RefurRs.FirstInTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_');
  973. RefurRs.LastInTime = ugrg.Cells["LastInTime"].Value.ToString().Trim().Trim('_');
  974. RefurRs.Burningrate = ugrg.Cells["BurningRate"].Value.ToString().Trim().Trim('_');
  975. RefurRs.LastInTemp = ugrg.Cells["LastInTemp"].Value.ToString().Trim().Trim('_');
  976. RefurRs.LastOutTemp = ugrg.Cells["LastOutTemp"].Value.ToString().Trim().Trim('_');
  977. RefurRs.StartTime = ugrg.Cells["FirstInTime"].Value.ToString().Trim().Trim('_');
  978. RefurRs.EndTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_');
  979. RefurRs.OutChangeNum = ugrg.Cells["OUT_CHANGE_NUM"].Value.ToString().Trim().Trim('_');
  980. RefurRs.LastOutTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_');
  981. RefurRs.FirstOutTime = ugrg.Cells["FirstOutTime"].Value.ToString().Trim().Trim('_');
  982. //RefurRs.LastOutTime = ugrg.Cells["LastOutTime"].Value.ToString().Trim().Trim('_');
  983. RefurRs.ColUser = _UserName;
  984. RefurRs.UserId = _UserID;
  985. RefurRs.ColShift = this.UserInfo.GetUserOrder();
  986. RefurRs.ColGroup = this.UserInfo.GetUserGroup();
  987. RefurRs.JudgeStoveNo = heatNo;
  988. RefurRs.UserId = _UserID;
  989. //加一段温度
  990. RefurRs.LheatCruve1 = getstring(ultraTextEditor16.Text.Trim('_'));
  991. //加二段温度
  992. RefurRs.LheatCruve2 = getstring(ultraTextEditor1.Text.Trim('_'));
  993. //加三段温度
  994. RefurRs.LheatCruve3 = getstring(ultraTextEditor10.Text.Trim('_'));
  995. //加四段温度
  996. RefurRs.LheatCruve4 = getstring(ultraTextEditor11.Text.Trim('_'));
  997. //加五段温度
  998. RefurRs.LheatCruve5 = getstring(ultraTextEditor12.Text.Trim('_'));
  999. //加六段温度
  1000. RefurRs.LheatCruve6 = getstring(ultraTextEditor13.Text.Trim('_'));
  1001. //加七段温度
  1002. RefurRs.LheatCruve7 = getstring(ultraTextEditor14.Text.Trim('_'));
  1003. //加八段温度
  1004. RefurRs.LheatCruve8 = getstring(ultraTextEditor15.Text.Trim('_'));
  1005. //炉温
  1006. RefurRs.FurPress = getstring(ultraTextEditor19.Text.Trim('_'));
  1007. //风压
  1008. RefurRs.WindPress = getstring(ultraTextEditor18.Text.Trim('_'));
  1009. //天然气压力
  1010. RefurRs.GasPress = getstring(ultraTextEditor17.Text.Trim('_'));
  1011. //合格吨
  1012. double DBHeight = 0;
  1013. double BurnningRate = 0;
  1014. double DBNum = 1;
  1015. //烧损率
  1016. if (string.IsNullOrEmpty(ugrg.Cells["BurningRate"].Value.ToString()))
  1017. {
  1018. RefurRs.Burningrate = "2.0";
  1019. }
  1020. else
  1021. {
  1022. RefurRs.Burningrate = ugrg.Cells["BurningRate"].Value.ToString();
  1023. }
  1024. DataTable dtDBH = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getDbHeight", new object[] { heatNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
  1025. if (dtDBH.Rows.Count > 0)
  1026. {
  1027. if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_HEIGHT"].ToString()))
  1028. {
  1029. DBHeight = double.Parse(dtDBH.Rows[0]["DB_HEIGHT"].ToString());
  1030. }
  1031. if (!string.IsNullOrEmpty(dtDBH.Rows[0]["BURNNING_RATE"].ToString()))
  1032. {
  1033. BurnningRate = double.Parse(dtDBH.Rows[0]["BURNNING_RATE"].ToString());
  1034. }
  1035. if (!string.IsNullOrEmpty(dtDBH.Rows[0]["DB_NUM"].ToString()))
  1036. {
  1037. DBNum = double.Parse(dtDBH.Rows[0]["DB_NUM"].ToString());
  1038. }
  1039. }
  1040. RefurRs.QaTon = DBHeight * (1 - (BurnningRate / 100)) * (1 - (double.Parse(BurnningRate.ToString()) / 100)) * double.Parse(RefurRs.OutFurNum.ToString());
  1041. //残氧量
  1042. RefurRs.ResidualOxygen = "";
  1043. RefurRs.NodeFurFlag = "1";//结炉标识
  1044. RefurRs.ProPlanId = proPlanId;
  1045. RefurRs.GxPlanNo = gxPlanNo;
  1046. RefurRs.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
  1047. RefurRs.LotNo = lotNo;
  1048. RefurRs.PlineCode = PlineCode;
  1049. //写进程表
  1050. CoreClientParam ccp = new CoreClientParam();
  1051. ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult";
  1052. ccp.MethodName = "updateMilSlab";
  1053. ccp.ServerParams = new object[] { heatNo, "5", proPlanId, gxPlanNo };
  1054. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1055. if (ccp.ReturnCode != -1)
  1056. {
  1057. if (ccp.ReturnInfo.Equals("修改成功!"))
  1058. {
  1059. ccp.ServerName = "com.steering.mes.zgmil.coup.FurResult";
  1060. ccp.MethodName = "updateProcess";
  1061. ccp.ServerParams = new object[] { heatNo, "5", "5", proPlanId, gxPlanNo, lotNo, PlineCode };
  1062. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1063. if (ccp.ReturnCode != -1)
  1064. {
  1065. if (ccp.ReturnInfo.Equals("修改成功!"))
  1066. {
  1067. if (count == 0)
  1068. {
  1069. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.endStoveForMainPlan", new object[] { RefurRs, heatNo, PlineCode, _UserName, Shift, Group }, this.ob);
  1070. if (count > 0)
  1071. {
  1072. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.scrapNodeMat", new object[] { heatNo, 5, 0, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1073. if (count > 0)
  1074. {
  1075. //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.insertFurnacesReslut", new object[] { heatNo, PlineCode, _UserName, Shift, Group }, this.ob);
  1076. //if (count == 0)
  1077. //{
  1078. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(heatNo) + "】结炉完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  1079. NativeMethodNew na = new NativeMethodNew(this.ob);
  1080. //na.InsertSTAferDoubleClick(heatNo, 4, "1", proPlanId, gxPlanNo);
  1081. NativeMethod.CheckNodeMatStatus(heatNo, proPlanId, gxPlanNo, 4, this.ob);
  1082. PlanQuery();
  1083. GetRollingCard(heatNo);
  1084. this.reFurResult1.IsCellSelect = false;
  1085. //}
  1086. }
  1087. }
  1088. }
  1089. }
  1090. else
  1091. {
  1092. MessageUtil.ShowTips(ccp.ReturnInfo);
  1093. }
  1094. }
  1095. }
  1096. }
  1097. ChangeGridColor();
  1098. PlanQuery();
  1099. RackQuery(heatNo);
  1100. }
  1101. /// <summary>
  1102. /// 结炉回退
  1103. /// </summary>
  1104. private void NodeBack()
  1105. {
  1106. if (ActiveUgr == null)
  1107. {
  1108. return;
  1109. }
  1110. UltraGridRow ugr = ActiveUgr;
  1111. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1112. string ResultNo = ugr.Cells["ID"].Value.ToString();
  1113. string NodeFlag = ugr.Cells["IS_START"].Value.ToString();
  1114. if (NodeFlag != "已完成出炉")
  1115. {
  1116. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未结炉,不能结炉回退!!!!");
  1117. return;
  1118. }
  1119. //查询结炉班次班组
  1120. DataTable dtNodeGroup = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, 4, proPlanId, gxPlanNo }, this.ob);
  1121. if (dtNodeGroup.Rows.Count > 0)
  1122. {
  1123. string NodeShift = dtNodeGroup.Rows[0][0].ToString();
  1124. string NodeGroup = dtNodeGroup.Rows[0][1].ToString();
  1125. if (Shift == NodeShift && Group == NodeGroup)
  1126. {
  1127. }
  1128. else
  1129. {
  1130. switch (NodeShift)
  1131. {
  1132. case "0":
  1133. NodeShift = "白班";
  1134. break;
  1135. case "1":
  1136. NodeShift = "早班";
  1137. break;
  1138. case "2":
  1139. NodeShift = "中班";
  1140. break;
  1141. case "3":
  1142. NodeShift = "夜班";
  1143. break;
  1144. }
  1145. switch (NodeGroup)
  1146. {
  1147. case "1":
  1148. NodeGroup = "甲班";
  1149. break;
  1150. case "2":
  1151. NodeGroup = "乙班";
  1152. break;
  1153. case "3":
  1154. NodeGroup = "丙班";
  1155. break;
  1156. case "4":
  1157. NodeGroup = "丁班";
  1158. break;
  1159. }
  1160. switch (this.UserInfo.GetUserOrder())
  1161. {
  1162. case "0":
  1163. Shift = "白班";
  1164. break;
  1165. case "1":
  1166. Shift = "早班";
  1167. break;
  1168. case "2":
  1169. Shift = "中班";
  1170. break;
  1171. case "3":
  1172. Shift = "夜班";
  1173. break;
  1174. }
  1175. switch (this.UserInfo.GetUserGroup())
  1176. {
  1177. case "1":
  1178. Group = "甲班";
  1179. break;
  1180. case "2":
  1181. Group = "乙班";
  1182. break;
  1183. case "3":
  1184. Group = "丙班";
  1185. break;
  1186. case "4":
  1187. Group = "丁班";
  1188. break;
  1189. }
  1190. // MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已由" + NodeGroup + "," + NodeShift + "结炉,当班不能结炉回退");
  1191. }
  1192. }
  1193. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
  1194. if (dt.Rows.Count > 0)
  1195. {
  1196. string NodeProcess = ""; //当前炉次结炉工序
  1197. string NodeStatus = dt.Rows[0][0].ToString();
  1198. switch (NodeStatus)
  1199. {
  1200. case "30":
  1201. NodeProcess = "穿孔";
  1202. break;
  1203. case "40":
  1204. NodeProcess = "连轧";
  1205. break;
  1206. case "50":
  1207. NodeProcess = "再加热炉";
  1208. break;
  1209. case "60":
  1210. NodeProcess = "定径";
  1211. break;
  1212. case "70":
  1213. NodeProcess = "分切";
  1214. break;
  1215. case "80":
  1216. NodeProcess = "矫直";
  1217. break;
  1218. case "90":
  1219. NodeProcess = "探伤";
  1220. break;
  1221. case "96":
  1222. NodeProcess = "质检";
  1223. break;
  1224. }
  1225. if (NodeStatus != "50")
  1226. {
  1227. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】 " + NodeProcess + "工序已结炉,当前工序不能结炉回退");
  1228. return;
  1229. }
  1230. }
  1231. //判断当前炉次下道工序是否结炉 下道工序结炉 - 不允许回退
  1232. //查询当前炉次是否有交班点
  1233. int Seq = 0; //入炉交班序号
  1234. int OutSeq = 0; //出炉交班序号
  1235. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.changeFlagQuery", new object[] { JudgeStoveNo, ResultNo, 4, proPlanId, gxPlanNo }, this.ob);
  1236. if (dt1.Rows.Count > 0)
  1237. {
  1238. for (int i = 0; i < dt1.Rows.Count; i++)
  1239. {
  1240. if (dt1.Rows[i]["IN_CHANGE_FLAG"].ToString() == "1")
  1241. {
  1242. Seq = int.Parse(dt1.Rows[i][0].ToString());
  1243. }
  1244. if (dt1.Rows[i]["OUT_CHANGE_FLAG"].ToString() == "1")
  1245. {
  1246. OutSeq = int.Parse(dt1.Rows[i][0].ToString());
  1247. }
  1248. }
  1249. }
  1250. //查询当前炉次最后一支是否入炉
  1251. DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
  1252. if (dtFurResult1.Rows.Count > 0)
  1253. {
  1254. if (!string.IsNullOrEmpty(dtFurResult1.Rows[0]["LAST_IN_TIME"].ToString()))
  1255. {
  1256. Seq = ultraGrid1.Rows.Count;
  1257. }
  1258. }
  1259. CoreClientParam ccp = new CoreClientParam();
  1260. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmReFurResult";
  1261. ccp.MethodName = "deleteFurnacesReslut";
  1262. ccp.ServerParams = new object[] { JudgeStoveNo, PlineCode, proPlanId, gxPlanNo };
  1263. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1264. //int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.deleteFurnacesReslut", new object[] { JudgeStoveNo, PlineCode }, this.ob);
  1265. if (ccp.ReturnInfo.Equals("荒管剔除成功!"))
  1266. {
  1267. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 4, PlineCode, Seq, OutSeq, 5, proPlanId, gxPlanNo, lotNo }, this.ob);
  1268. }
  1269. else {
  1270. //MessageUtil.ShowTips(ccp.ReturnInfo);
  1271. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已经荒管组炉,不可以结炉回退!");
  1272. }
  1273. ChangeGridColor();
  1274. PlanQuery();
  1275. RackQuery(JudgeStoveNo);
  1276. }
  1277. /// <summary>
  1278. /// 毛管剔除
  1279. /// </summary>
  1280. /// <param name="sender"></param>
  1281. /// <param name="e"></param>
  1282. private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
  1283. {
  1284. if (ActiveUgr == null)
  1285. {
  1286. return;
  1287. }
  1288. HOTMethod hm = new HOTMethod(this.ob);
  1289. DataTable dt = new DataTable();
  1290. int scrapNum = 0;
  1291. int count = 0;
  1292. string heatNo = ultraGrid1.ActiveRow.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
  1293. string seq = ultraGrid1.ActiveRow.Cells["SEQ"].Text.ToString().Trim();
  1294. string MAT_NO = ultraGrid1.ActiveRow.Cells["MAT_NO"].Text.ToString().Trim();
  1295. int Seq = int.Parse(seq);
  1296. string Shift = UserInfo.GetUserOrder();
  1297. string Group = UserInfo.GetUserGroup();
  1298. string User = UserInfo.GetUserName();
  1299. string PlanStatus = ActiveUgr.Cells["IS_START"].Value.ToString();
  1300. if (PlanStatus == "已完成出炉") // -- 修改结炉回退操作时放开
  1301. {
  1302. if (e.Cell.Column.Key == "IN_CHANGE_NUM" || e.Cell.Column.Key == "OUT_CHANGE_NUM")
  1303. {
  1304. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(heatNo) + "】已出炉,不允许交班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1305. }
  1306. else if (e.Cell.Column.Key == "BTNOUTCHANGECOM" || e.Cell.Column.Key == "BTNINCHANGECOM")
  1307. {
  1308. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(heatNo) + "】已出炉,不允许接班!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1309. }
  1310. else
  1311. {
  1312. MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(heatNo) + "】已出炉,不允许剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1313. }
  1314. return;
  1315. }
  1316. CoreClientParam ccp = new CoreClientParam();
  1317. ccp.ServerName = "com.steering.mes.zgmil.coup.FeedSawResult";
  1318. ccp.MethodName = "scrapMatCheck";
  1319. ccp.ServerParams = new object[] { heatNo, 5, proPlanId, gxPlanNo };
  1320. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1321. int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);
  1322. if (e.Cell.Column.Key == "DELETE")
  1323. {
  1324. if (this.ultraGrid1.ActiveRow.Cells["STATUS"].Text.ToString().Trim() == "剔除")
  1325. {
  1326. MessageBox.Show("此毛管已被剔除,不可重复剔除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1327. return;
  1328. }
  1329. if (ultraGrid1.Rows.Count - ScrapNumBefore < int.Parse(seq))
  1330. {
  1331. MessageBox.Show("不存在序号为【" + seq + "】的管号,被其他工序剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1332. return;
  1333. }
  1334. DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.selectPortBacthSlample", new object[] { MAT_NO }, ob);
  1335. if (ds.Rows.Count > 0)
  1336. {
  1337. if (MessageUtil.ShowYesNoAndQuestion("此管坯已有被取为样管,是否继续剔除?") == DialogResult.No)
  1338. {
  1339. return;
  1340. }
  1341. }
  1342. int i = 0;
  1343. foreach (UltraGridRow uRow in ultraGrid1.Rows)
  1344. {
  1345. if (uRow.Cells["STATUS"].Value.ToString().Equals("正常轧制") && int.Parse(uRow.Cells["SEQ"].Value.ToString3()) > 2)
  1346. {
  1347. i = i + 1;
  1348. }
  1349. }
  1350. if (int.Parse(seq) < 3 && i > 0)
  1351. {
  1352. if (MessageUtil.ShowYesNoAndQuestion("该管坯可能是样管,是否确认剔除。") == DialogResult.No)
  1353. {
  1354. return;
  1355. }
  1356. }
  1357. //管排锯切前判断当前管坯序号是否已剔除
  1358. //DataTable dtSeq = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getScrapSeq", new object[] { heatNo, seq }, this.ob);
  1359. //if (dtSeq.Rows.Count > 0)
  1360. //{
  1361. // MessageBox.Show("不存在序号为【" + seq + "】的管号,已在【" + dtSeq.Rows[0][0].ToString() + "】剔除,不能再次剔除!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1362. // return;
  1363. //}
  1364. RefurRs.JudgeStoveNo = heatNo;
  1365. RefurRs.ProPlanId = proPlanId;
  1366. RefurRs.GxPlanNo = gxPlanNo;
  1367. dt.Clear();
  1368. ScrapSeq.Seq = seq;
  1369. ScrapSeq.JudgeStoveNo = heatNo;
  1370. ScrapSeq.ColUser = this.UserInfo.GetUserName();
  1371. ScrapSeq.ColShift = this.UserInfo.GetUserOrder();
  1372. ScrapSeq.ColGroup = this.UserInfo.GetUserGroup();
  1373. ScrapSeq.ProPlanId = proPlanId;
  1374. ScrapSeq.GxPlanNo = gxPlanNo;
  1375. //新增管列序号表
  1376. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.insertScrapSlabSeq", new object[] { ScrapSeq }, this.ob);
  1377. if (count > 0)
  1378. {
  1379. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.scrapNumQuery", new object[] { RefurRs }, this.ob);
  1380. if (dt.Rows.Count > 0)
  1381. {
  1382. scrapNum = int.Parse(dt.Rows[0]["SCRAP_NUM"].ToString());
  1383. }
  1384. RefurRack.ScrapNum = scrapNum.ToString();
  1385. RefurRack.ColUser = UserInfo.GetUserName();
  1386. RefurRack.ColGroup = UserInfo.GetUserGroup();
  1387. RefurRack.ColShift = UserInfo.GetUserOrder();
  1388. RefurRack.Status = "1";
  1389. RefurRack.JudgeStoveNo = heatNo;
  1390. RefurRack.Seq = seq;
  1391. RefurRack.ProPlanId = proPlanId;
  1392. RefurRack.GxPlanNo = gxPlanNo;
  1393. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.rackDelete", new object[] { RefurRack }, this.ob);
  1394. if (count > 0)
  1395. {
  1396. RackQuery(ActiveJUDGE_STOVE_NO);
  1397. refurResultQuery();
  1398. GetRollingCard();
  1399. }
  1400. }
  1401. }
  1402. if (e.Cell.Column.Key == "DELBACK")
  1403. {
  1404. //if (MessageUtil.ShowYesNoAndQuestion("是否回退该剔除的坯料") == DialogResult.No)
  1405. //{
  1406. // return;
  1407. //}
  1408. if (!this.ultraGrid1.ActiveRow.Cells["STATUS"].Text.ToString().Trim().Equals("剔除"))
  1409. {
  1410. MessageBox.Show("该坯料未被剔除,请确认后重新选择!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1411. return;
  1412. }
  1413. NativeMethodNew na = new NativeMethodNew(this.ob);
  1414. int counts = na.DeleteSlabSeq(heatNo, seq.ToString(), 5, 1, 0, proPlanId, gxPlanNo);
  1415. if (counts > 0)
  1416. {
  1417. // MessageBox.Show("剔料回退成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1418. RackQuery(ActiveJUDGE_STOVE_NO);
  1419. refurResultQuery();
  1420. GetRollingCard();
  1421. }
  1422. else
  1423. {
  1424. MessageBox.Show("剔料回退失败", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1425. return;
  1426. }
  1427. }
  1428. //入炉交班
  1429. if (e.Cell.Column.Key == "IN_CHANGE_NUM")
  1430. {
  1431. //查询是否有最后一只入炉时间
  1432. DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
  1433. if (dtFurResult1.Rows.Count > 0)
  1434. {
  1435. if (!string.IsNullOrEmpty(dtFurResult1.Rows[0]["LAST_IN_TIME"].ToString()))
  1436. {
  1437. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】已完成入炉,不能入炉交班。");
  1438. return;
  1439. }
  1440. }
  1441. int BeforeChangeNum = 0;
  1442. //查询上个班入炉交班支数
  1443. DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1444. if (dtChangeNum.Rows.Count > 0)
  1445. {
  1446. if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString()))
  1447. {
  1448. BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString());
  1449. }
  1450. }
  1451. if (Seq <= BeforeChangeNum)
  1452. {
  1453. MessageBox.Show("前道班次已交班,该支不能再次交班。");
  1454. return;
  1455. }
  1456. if (Seq > ultraGrid1.Rows.Count - ScrapNumBefore)
  1457. {
  1458. MessageBox.Show("该支已被前道工序剔除,不能在该支交班");
  1459. return;
  1460. }
  1461. int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 5, 1, proPlanId, gxPlanNo }, this.ob);
  1462. //hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 4, Seq, 0);
  1463. }
  1464. //入炉交班确认
  1465. if (e.Cell.Column.Key == "BTNINCHANGECOM")
  1466. {
  1467. int WaitChangeSeq = hm.GetWaitChangeSeq(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 4, 0, proPlanId, gxPlanNo);
  1468. if (WaitChangeSeq == 0)
  1469. {
  1470. MessageBox.Show("没有待交班确认的管号。");
  1471. return;
  1472. }
  1473. if (WaitChangeSeq != Seq)
  1474. {
  1475. MessageBox.Show("交班管序号与接班管序号不符,请确认后接班。");
  1476. return;
  1477. }
  1478. if (MessageUtil.ShowYesNoAndQuestion("确认炉号:【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】序号:【" + Seq + "】交班?") == DialogResult.No)
  1479. {
  1480. return;
  1481. }
  1482. // //查询是否有该班接班记录
  1483. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  1484. string Time = SeverTime.ToLongTimeString();
  1485. string StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  1486. string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  1487. int BeforeChangeNum = 0;
  1488. //查询上个班入炉交班支数
  1489. DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1490. if (dtChangeNum.Rows.Count > 0)
  1491. {
  1492. if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString()))
  1493. {
  1494. BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString());
  1495. }
  1496. }
  1497. if (Seq <= BeforeChangeNum)
  1498. {
  1499. MessageBox.Show("前道班次已交班,该支不能再次交班。");
  1500. return;
  1501. }
  1502. if (Seq > ultraGrid1.Rows.Count - ScrapNumBefore)
  1503. {
  1504. MessageBox.Show("该支已被前道工序剔除,不能在该支交班");
  1505. return;
  1506. }
  1507. //未登录
  1508. if (!hm.IsChanged(StartTime, EndTime, Shift, Group, "4", PlineCode))
  1509. {
  1510. if (this.DoRelogin(DoCheck))
  1511. {
  1512. //查询上个班入炉交班支数
  1513. DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1514. if (dtChangeNum1.Rows.Count > 0)
  1515. {
  1516. if (!string.IsNullOrEmpty(dtChangeNum1.Rows[0][0].ToString()))
  1517. {
  1518. BeforeChangeNum = int.Parse(dtChangeNum1.Rows[0][0].ToString());
  1519. }
  1520. }
  1521. // hm.InsertChangeRemuse(Shift, Group, _UserName, "4", PlineCode);
  1522. // string User = UserInfo.GetUserName();
  1523. int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 5, 1, proPlanId, gxPlanNo }, this.ob);
  1524. //查询是否有出炉交班但未确认接班的炉号
  1525. DataTable dtOutChange = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQueryReFur", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, proPlanId, gxPlanNo }, this.ob);
  1526. {
  1527. if (dtOutChange.Rows.Count > 0)
  1528. {
  1529. string WaitOutFur = dtOutChange.Rows[0][0].ToString();
  1530. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(WaitOutFur) + "】需要出炉交班确认。");
  1531. }
  1532. }
  1533. }
  1534. }
  1535. else
  1536. {
  1537. //string User = UserInfo.GetUserName();
  1538. DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1539. if (dtChangeNum1.Rows.Count > 0)
  1540. {
  1541. if (!string.IsNullOrEmpty(dtChangeNum1.Rows[0][0].ToString()))
  1542. {
  1543. BeforeChangeNum = int.Parse(dtChangeNum1.Rows[0][0].ToString());
  1544. }
  1545. }
  1546. int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, BeforeChangeNum, 0, PlineCode, Shift, Group, _UserName, 5, 1, proPlanId, gxPlanNo }, this.ob);
  1547. //查询是否有出炉交班但未确认接班的炉号
  1548. DataTable dtOutChange = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeQueryReFur", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, proPlanId, gxPlanNo }, this.ob);
  1549. {
  1550. if (dtOutChange.Rows.Count > 0)
  1551. {
  1552. string WaitOutFur = dtOutChange.Rows[0][0].ToString();
  1553. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(WaitOutFur) + "】需要出炉交班确认。");
  1554. }
  1555. }
  1556. }
  1557. }
  1558. //出炉交班
  1559. if (e.Cell.Column.Key == "OUT_CHANGE_NUM")
  1560. {
  1561. //string Shift = UserInfo.GetUserOrder();
  1562. //string Group = UserInfo.GetUserGroup();
  1563. //string User = UserInfo.GetUserName();
  1564. int BeforeChangeNum = 0;
  1565. //查询上个班出炉交班支数
  1566. DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1567. if (dtChangeNum.Rows.Count > 0)
  1568. {
  1569. if (!string.IsNullOrEmpty(dtChangeNum.Rows[1][0].ToString()))
  1570. {
  1571. BeforeChangeNum = int.Parse(dtChangeNum.Rows[1][0].ToString());
  1572. }
  1573. }
  1574. DataTable dtFurResult1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob);
  1575. if (dtFurResult1.Rows.Count > 0)
  1576. {
  1577. if (string.IsNullOrEmpty(dtFurResult1.Rows[0]["FIRST_OUT_TIME"].ToString()))
  1578. {
  1579. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】第一支未出炉,不能交班。");
  1580. return;
  1581. }
  1582. }
  1583. if (Seq <= BeforeChangeNum)
  1584. {
  1585. MessageBox.Show("前道班次已交班,该支不能再次交班。");
  1586. return;
  1587. }
  1588. if (Seq > ultraGrid1.Rows.Count - ScrapNumBefore)
  1589. {
  1590. MessageBox.Show("该支已被前道工序剔除,不能在该支交班");
  1591. return;
  1592. }
  1593. //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq, 0, BeforeChangeNum, PlineCode, Shift, Group, _UserName, 2, 2 }, this.ob);
  1594. //ChangeFlag = 1;
  1595. hm.UpdateChangeFlag(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 4, Seq, 1);
  1596. }
  1597. //出炉交班确认
  1598. if (e.Cell.Column.Key == "BTNOUTCHANGECOM")
  1599. {
  1600. int WaitChangeSeq = hm.GetWaitChangeSeq(ActiveJUDGE_STOVE_NO, ActiveResultNo, "", 4, 1, proPlanId, gxPlanNo);
  1601. if (WaitChangeSeq == 0)
  1602. {
  1603. MessageBox.Show("没有待交班确认的管号。");
  1604. return;
  1605. }
  1606. if (WaitChangeSeq != Seq)
  1607. {
  1608. MessageBox.Show("交班管序号与接班管序号不符,请确认后接班。");
  1609. return;
  1610. }
  1611. if (MessageUtil.ShowYesNoAndQuestion("确认炉号:【" + BaseMethod.getJudgeStoveNo(ActiveJUDGE_STOVE_NO) + "】序号:【" + Seq + "】交班?") == DialogResult.No)
  1612. {
  1613. return;
  1614. }
  1615. int BeforeChangeNum = 0;
  1616. //查询上个班出炉交班支数
  1617. DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1618. if (dtChangeNum.Rows.Count > 0)
  1619. {
  1620. if (!string.IsNullOrEmpty(dtChangeNum.Rows[1][0].ToString()))
  1621. {
  1622. BeforeChangeNum = int.Parse(dtChangeNum.Rows[1][0].ToString());
  1623. }
  1624. }
  1625. if (Seq <= BeforeChangeNum)
  1626. {
  1627. MessageBox.Show("前道班次已交班,该支不能再次交班。");
  1628. return;
  1629. }
  1630. if (Seq > ultraGrid1.Rows.Count - ScrapNumBefore)
  1631. {
  1632. MessageBox.Show("该支已被前道工序剔除,不能在该支交班");
  1633. return;
  1634. }
  1635. if (this.DoRelogin(DoCheck))
  1636. {
  1637. //string User = UserInfo.GetUserName();
  1638. //hm.InsertChangeRemuse(Shift, Group, _UserName, "4", PlineCode);
  1639. //查询上个班出炉交班支数
  1640. DataTable dtChangeNum1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 4, PlineCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
  1641. if (dtChangeNum1.Rows.Count > 0)
  1642. {
  1643. if (!string.IsNullOrEmpty(dtChangeNum1.Rows[1][0].ToString()))
  1644. {
  1645. BeforeChangeNum = int.Parse(dtChangeNum1.Rows[1][0].ToString());
  1646. }
  1647. }
  1648. int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, Seq, 0, BeforeChangeNum, PlineCode, Shift, Group, _UserName, 5, 2, proPlanId, gxPlanNo }, this.ob);
  1649. }
  1650. }
  1651. //过渡方法,接班后重登陆初始化导致Grid.Row为null
  1652. if (ultraGridPlan.Rows == null)
  1653. {
  1654. return;
  1655. }
  1656. DataTable dtFurResult2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
  1657. GridEditResult(dtFurResult2);
  1658. ChangeGridColor();
  1659. GetRollingCard();//流通卡赋值
  1660. RackQuery(heatNo);
  1661. }
  1662. public string DoCheck(CoreUserInfo User)
  1663. {
  1664. return "";
  1665. }
  1666. /// <summary>
  1667. /// 交班取消
  1668. /// </summary>
  1669. private void ChangeCancel()
  1670. {
  1671. int Flag = 0;
  1672. string JudgeStoveNo = "";
  1673. string Status = "";
  1674. string ResultNo = "";
  1675. UltraGridRow ugr = this.ActiveUgr;
  1676. string Shift = UserInfo.GetUserOrder();
  1677. string Group = UserInfo.GetUserGroup();
  1678. if (ugr != null)
  1679. {
  1680. JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1681. Status = ugr.Cells["IS_START"].Value.ToString();
  1682. ResultNo = ugr.Cells["ID"].Value.ToString();
  1683. if (Status == "未开始入炉")
  1684. {
  1685. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未开始入炉,不能交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1686. return;
  1687. }
  1688. if (Status == "已完成出炉")
  1689. {
  1690. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成出炉,不能交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1691. return;
  1692. }
  1693. //查询最后一支是否入炉
  1694. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  1695. if (dt.Rows.Count > 0)
  1696. {
  1697. if (!string.IsNullOrEmpty(dt.Rows[0]["LAST_IN_TIME"].ToString()))
  1698. {
  1699. Flag = 1;
  1700. }
  1701. }
  1702. NativeMethodNew nass = new NativeMethodNew(this.ob);
  1703. nass.ChangeShiftBack(JudgeStoveNo, ResultNo, proPlanId, gxPlanNo, PlineCode, Shift, Group, 4, Flag);
  1704. //查询加热炉实绩信息
  1705. DataTable dtFurResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  1706. if (dtFurResult.Rows.Count > 0)
  1707. {
  1708. GridEditResult(dtFurResult);
  1709. }
  1710. PlanQuery();
  1711. }
  1712. }
  1713. /// <summary>
  1714. /// 点击保存单支出入炉时间
  1715. /// </summary>
  1716. /// <param name="sender"></param>
  1717. /// <param name="e"></param>
  1718. public void UltraGrid2_ClickCellButton(object sender, CellEventArgs e)
  1719. {
  1720. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  1721. string Time = SeverTime.ToLongTimeString();
  1722. HOTMethod hm = new HOTMethod(this.ob);
  1723. string temp = "";
  1724. string Shift = UserInfo.GetUserOrder();
  1725. string Group = UserInfo.GetUserGroup();
  1726. if (ActiveUgr == null)
  1727. {
  1728. return;
  1729. }
  1730. string JudgeStoveNo = "";
  1731. string ResultNo = "";
  1732. UltraGridRow ugr = ActiveUgr;
  1733. if (ugr != null)
  1734. {
  1735. JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1736. ResultNo = ugr.Cells["ID"].Value.ToString();
  1737. }
  1738. int count = 0;
  1739. int Flag = 0;
  1740. string Status = ugr.Cells["IS_START"].Value.ToString();
  1741. if (e.Cell.Column.Key != "btnFirstIn")
  1742. {
  1743. if (Status == "未开始入炉")
  1744. {
  1745. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未开始入炉,不能!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1746. return;
  1747. }
  1748. }
  1749. if (Status == "已完成出炉")
  1750. {
  1751. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成出炉,不能进行操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1752. return;
  1753. }
  1754. switch (e.Cell.Column.Key)
  1755. {
  1756. case "btnFirstIn":
  1757. this.reFurResult1.UltraGrid2.Rows[0].Cells["FirstInTime"].Value = Time;
  1758. DoStart();
  1759. Flag = 0;
  1760. temp = temprefur.FirstInTemp.ToString();
  1761. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, temp, Flag }, this.ob);
  1762. break;
  1763. case "btnLastIn":
  1764. string BackPlanFlag = ""; //返线计划标识(5--荒管组炉的炉号)
  1765. DataTable dtBackPlanFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getMilPlanFalg", new object[] { JudgeStoveNo, PlineCode, proPlanId, gxPlanNo }, this.ob);
  1766. if (dtBackPlanFlag.Rows.Count > 0)
  1767. {
  1768. BackPlanFlag = dtBackPlanFlag.Rows[0]["BACK_PLAN_FLAG"].ToString();
  1769. }
  1770. if (BackPlanFlag != "5")
  1771. {
  1772. string NodeFlag = "";
  1773. DataTable dtFlag = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmRollingRPipeResult.resultQuery", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  1774. if (dtFlag.Rows.Count > 0)
  1775. {
  1776. NodeFlag = dtFlag.Rows[0]["NODE_FUR_FLAG"].ToString();
  1777. }
  1778. else
  1779. {
  1780. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未开始连轧,不能入炉完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1781. return;
  1782. }
  1783. if (NodeFlag != "1")
  1784. {
  1785. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】还未连轧完成,不能入炉完成!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1786. return;
  1787. }
  1788. }
  1789. Flag = 1;
  1790. temp = temprefur.LastInTemp.ToString();
  1791. this.reFurResult1.UltraGrid2.Rows[0].Cells["LastInTime"].Value = Time;
  1792. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, temp, Flag }, this.ob);
  1793. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.SetInFur", new object[] { JudgeStoveNo, ResultNo, Shift, Group, _UserName }, this.ob);
  1794. break;
  1795. case "btnFirstOut":
  1796. Flag = 2;
  1797. temp = temprefur.FirstOutTemp.ToString();
  1798. DataTable dtIsOut = hm.InFurIsEnd("2", PlineCode, 1);
  1799. if (dtIsOut.Rows.Count > 0)
  1800. {
  1801. MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(dtIsOut.Rows[0][0].ToString()) + "】正在出炉。");
  1802. return;
  1803. }
  1804. this.reFurResult1.UltraGrid2.Rows[0].Cells["FirstOutTime"].Value = Time;
  1805. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, temp, Flag }, this.ob);
  1806. break;
  1807. case "btnLastOut":
  1808. Flag = 3;
  1809. FeedSawResultNode();
  1810. temp = temprefur.LastOutTemp.ToString();
  1811. this.reFurResult1.UltraGrid2.Rows[0].Cells["LastOutTime"].Value = Time;
  1812. //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmReFurResult.updateFurTime", new object[] { JudgeStoveNo, Shift, Group, temp, Flag }, this.ob);
  1813. break;
  1814. }
  1815. PlanQuery();
  1816. //刷新实绩界面
  1817. //this.reFurResult1.UpdateData();
  1818. }
  1819. public string getstring(string str)
  1820. {
  1821. string result = "0";
  1822. if (!string.IsNullOrEmpty(str))
  1823. {
  1824. if (str.Contains("_"))
  1825. {
  1826. str = str.Replace("_", "");
  1827. if (str.Equals("."))
  1828. {
  1829. str = "0";
  1830. }
  1831. }
  1832. if (str.Equals("."))
  1833. {
  1834. str = "0";
  1835. }
  1836. result = str;
  1837. }
  1838. return result;
  1839. }
  1840. /// <summary>
  1841. /// 修改IS_START名称
  1842. /// </summary>
  1843. public void ChangeCellName()
  1844. {
  1845. //if (ultraGridPlan.Rows.Count > 0)
  1846. //{
  1847. // NativeMethodNew na = new NativeMethodNew(this.ob);
  1848. // foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  1849. // {
  1850. // //String Judge_Stove_No = ugr.Cells["JUDGE_DTOVE_NO"].Value.ToString();
  1851. // //if (na.isBegineNode(Judge_Stove_No, 0))
  1852. // //{
  1853. // // ugr.Appearance.BackColor = Color.YellowGreen;
  1854. // //}
  1855. // if (ugr.Cells["IS_START"].Value.ToString() != "未开始再加热" && ugr.Cells["IS_START"].Value.ToString() != "已开始再加热" && ugr.Cells["IS_START"].Value.ToString() != "已完成再加热")
  1856. // {
  1857. // switch (Convert.ToInt32(ugr.Cells["IS_START"].Value))
  1858. // {
  1859. // case 3:
  1860. // ugr.Cells["IS_START"].Value = "未开始再加热";
  1861. // break;
  1862. // case 0:
  1863. // ugr.Cells["IS_START"].Value = "已开始再加热";
  1864. // break;
  1865. // case 1:
  1866. // ugr.Cells["IS_START"].Value = "已完成再加热";
  1867. // break;
  1868. // }
  1869. // }
  1870. // }
  1871. //}
  1872. }
  1873. /// <summary>
  1874. /// 变色
  1875. /// </summary>
  1876. private void ChangeGridColor()
  1877. {
  1878. foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  1879. {
  1880. if (ugr.Cells["IS_START"].Value.ToString() == "已完成出炉")
  1881. {
  1882. ugr.Appearance.BackColor = Color.YellowGreen;
  1883. }
  1884. if (ugr.Cells["IS_START"].Value.ToString() == "已开始出炉")
  1885. {
  1886. ugr.Appearance.BackColor = Color.LightGray;
  1887. }
  1888. if (ugr.Cells["IS_START"].Value.ToString() == "已完成入炉")
  1889. {
  1890. ugr.Appearance.BackColor = Color.LightGreen;
  1891. }
  1892. if (ugr.Cells["IS_START"].Value.ToString() == "已开始入炉")
  1893. {
  1894. ugr.Appearance.BackColor = Color.LightGreen;
  1895. }
  1896. }
  1897. foreach (UltraGridRow ugr in ultraGridINFurInfor.Rows)
  1898. {
  1899. if (ugr.Cells["IS_START"].Value.ToString() == "已完成出炉")
  1900. {
  1901. ugr.Appearance.BackColor = Color.YellowGreen;
  1902. }
  1903. if (ugr.Cells["IS_START"].Value.ToString() == "已开始出炉")
  1904. {
  1905. ugr.Appearance.BackColor = Color.LightGray;
  1906. }
  1907. if (ugr.Cells["IS_START"].Value.ToString() == "已完成入炉")
  1908. {
  1909. ugr.Appearance.BackColor = Color.LightGreen;
  1910. }
  1911. if (ugr.Cells["IS_START"].Value.ToString() == "已开始入炉")
  1912. {
  1913. ugr.Appearance.BackColor = Color.LightGreen;
  1914. }
  1915. }
  1916. foreach (UltraGridRow ugr in ultraGridOUTFurInfor.Rows)
  1917. {
  1918. if (ugr.Cells["IS_START"].Value.ToString() == "已完成出炉")
  1919. {
  1920. ugr.Appearance.BackColor = Color.YellowGreen;
  1921. }
  1922. if (ugr.Cells["IS_START"].Value.ToString() == "已开始出炉")
  1923. {
  1924. ugr.Appearance.BackColor = Color.LightGray;
  1925. }
  1926. if (ugr.Cells["IS_START"].Value.ToString() == "已完成入炉")
  1927. {
  1928. ugr.Appearance.BackColor = Color.LightGreen;
  1929. }
  1930. if (ugr.Cells["IS_START"].Value.ToString() == "已开始入炉")
  1931. {
  1932. ugr.Appearance.BackColor = Color.LightGreen;
  1933. }
  1934. }
  1935. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  1936. {
  1937. if (ugr != null)
  1938. {
  1939. switch (ugr.Cells["STATUS"].Value.ToString())
  1940. {
  1941. case "剔除":
  1942. ugr.Appearance.BackColor = Color.Yellow;
  1943. break;
  1944. }
  1945. switch (ugr.Cells["OUT_CHANGE_FLAG"].Value.ToString())
  1946. {
  1947. case "出炉交班待确认":
  1948. ugr.Appearance.BackColor = Color.LightGreen;
  1949. break;
  1950. }
  1951. switch (ugr.Cells["IN_CHANGE_FLAG"].Value.ToString())
  1952. {
  1953. case "入炉交班待确认":
  1954. ugr.Appearance.BackColor = Color.LightGreen;
  1955. break;
  1956. }
  1957. }
  1958. }
  1959. }
  1960. /// <summary>
  1961. /// 判断是否能开始当前炉次
  1962. /// </summary>
  1963. /// <returns></returns>
  1964. private bool IsStart()
  1965. {
  1966. bool Start = true;
  1967. foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  1968. {
  1969. UltraGridRow ugr1 = ultraGridPlan.ActiveRow;
  1970. if (ugr.Cells["IS_START"].Value.ToString() == "已开始再加热")
  1971. {
  1972. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1973. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getInFurTime", new object[] { JudgeStoveNo }, this.ob);
  1974. if (string.IsNullOrEmpty(dt.Rows[0]["LAST_IN_TIME"].ToString()))
  1975. // if(!(dt.Rows.Count>0))
  1976. {
  1977. MessageBox.Show("炉号【" + JudgeStoveNo + "】入炉未完成,【" + ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() + "】不能入炉");
  1978. Start = false;
  1979. }
  1980. }
  1981. }
  1982. return Start;
  1983. }
  1984. /// <summary>
  1985. /// 查询流通卡信息
  1986. /// </summary>
  1987. private void GetRollingCard()
  1988. {
  1989. if (!string.IsNullOrEmpty(ActiveJUDGE_STOVE_NO))
  1990. {
  1991. DataTable dt = new DataTable();
  1992. if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017"))
  1993. {
  1994. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
  1995. }
  1996. else
  1997. {
  1998. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { ActiveJUDGE_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
  1999. }
  2000. RollingCardEditGrid(dt, ActiveJUDGE_STOVE_NO);
  2001. }
  2002. }
  2003. /// <summary>
  2004. /// 流通卡赋值
  2005. /// </summary>
  2006. /// <param name="dt"></param>
  2007. public void RollingCardEditGrid(DataTable dt, string heatno)
  2008. {
  2009. if (dt.Rows.Count > 0)
  2010. {
  2011. //上料切前剔除支数
  2012. this.rollingCard1.Value.FeedScrapNum = dt.Rows[0]["SCRAP_FEED"].ToString();
  2013. //上料切前合格支数
  2014. this.rollingCard1.Value.FeedQualifiedNum = dt.Rows[0]["QUALIFIED_FEED"].ToString();
  2015. //上料剔除支数
  2016. this.rollingCard1.Value.FeedScrapDBNum = dt.Rows[0]["SCRAP_DBFEED"].ToString();
  2017. //上料合格支数
  2018. this.rollingCard1.Value.FeedQualifiedDBNum = dt.Rows[0]["QUALIFIED_DBFEED"].ToString();
  2019. //加热炉剔除支数
  2020. this.rollingCard1.Value.FurScrapNum = dt.Rows[0]["SCRAP_FUR"].ToString();
  2021. //加热炉合格支数
  2022. this.rollingCard1.Value.FurQualifiedNum = dt.Rows[0]["QUALIFIED_FUR"].ToString();
  2023. //穿孔剔除支数
  2024. this.rollingCard1.Value.PerScrapNum = dt.Rows[0]["SCRAP_PER"].ToString();
  2025. //穿孔合格支数
  2026. this.rollingCard1.Value.PerQualifiedNum = dt.Rows[0]["QUALIFIED_PER"].ToString();
  2027. //连轧剔除支数
  2028. this.rollingCard1.Value.RollingScrapNum = dt.Rows[0]["SCRAP_ROLLING"].ToString();
  2029. //连轧合格支数
  2030. this.rollingCard1.Value.RollingQualifiedNum = dt.Rows[0]["QUALIFIED_ROLLING"].ToString();
  2031. //再加热炉剔除支数
  2032. this.rollingCard1.Value.RefurScrapNum = dt.Rows[0]["SCRAP_REFUR"].ToString();
  2033. //再加热炉合格支数
  2034. this.rollingCard1.Value.RefurQualifiedNum = dt.Rows[0]["QUALIFIED_REFUR"].ToString();
  2035. //定径剔除支数
  2036. this.rollingCard1.Value.SizingScrapNum = dt.Rows[0]["SCRAP_SIZING"].ToString();
  2037. //定径合格支数
  2038. this.rollingCard1.Value.SizingQualifiedNum = dt.Rows[0]["QUALIFIED_SIZING"].ToString();
  2039. //分切前剔除支数
  2040. this.rollingCard1.Value.SawScrapNumBE = dt.Rows[0]["SCRAP_SAW_BE"].ToString();
  2041. //分切前合格支数
  2042. this.rollingCard1.Value.SawQualifiedNumBE = dt.Rows[0]["QUALIFIED_SAW_BE"].ToString();
  2043. //分切剔除支数
  2044. this.rollingCard1.Value.SawScrapNum = dt.Rows[0]["SCRAP_SAW"].ToString();
  2045. //分切合格支数
  2046. this.rollingCard1.Value.SawQualifiedNum = dt.Rows[0]["QUALIFIED_SAW"].ToString();
  2047. //矫直剔除支数
  2048. this.rollingCard1.Value.StraightScrapNum = dt.Rows[0]["SCRAP_STRAIGHT"].ToString();
  2049. //矫直合格支数
  2050. this.rollingCard1.Value.StraightQualifiedNum = dt.Rows[0]["QUALIFIED_STRAIGHT"].ToString();
  2051. //矫直下线支数
  2052. this.rollingCard1.Value.OfflineStraight = dt.Rows[0]["OFFLINE_STRAIGHT"].ToString();
  2053. //矫直返线支数
  2054. this.rollingCard1.Value.BacklineStraight = dt.Rows[0]["BACKLINE_STRAIGHT"].ToString();
  2055. //探伤剔除支数
  2056. this.rollingCard1.Value.TestingScrapNum = dt.Rows[0]["SCRAP_TESTING"].ToString();
  2057. //探伤合格支数
  2058. this.rollingCard1.Value.TestingQualifiedNum = dt.Rows[0]["QUALIFIED_TESTING"].ToString();
  2059. NativeMethodNew na = new NativeMethodNew(this.ob);
  2060. if (na.isBegineNode(heatno, 8) || na.isBegineNode(heatno, 9) || na.isBegineNode(heatno, 10))
  2061. {
  2062. //探伤下线支数
  2063. this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
  2064. this.rollingCard1.Value.BacklineTesting = dt.Rows[0]["BACKLINE_TESTING"].ToString();
  2065. }
  2066. else
  2067. {
  2068. if (dt.Rows[0]["OFFLINE_TESTING"].ToString() == "0")
  2069. {
  2070. this.rollingCard1.Value.OfflineTesting = "";
  2071. this.rollingCard1.Value.BacklineTesting = "";
  2072. }
  2073. else
  2074. {
  2075. //探伤下线支数
  2076. this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
  2077. this.rollingCard1.Value.BacklineTesting = dt.Rows[0]["BACKLINE_TESTING"].ToString();
  2078. }
  2079. }
  2080. //表检合格支数
  2081. this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
  2082. //表检废品支数
  2083. this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString();
  2084. //表检下线支数
  2085. this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
  2086. //表检返线支数
  2087. //this.rollingCard1.Value.SurfaceBackLineNum= dt.Rows[0]["OFFLINE_TESTING"].ToString();
  2088. this.rollingCard1.UpdateData();
  2089. }
  2090. else
  2091. {
  2092. this.rollingCard1.ClearData();
  2093. }
  2094. }
  2095. /// <summary>
  2096. /// 查询流通卡信息
  2097. /// </summary>
  2098. private void GetRollingCard(string heatNo)
  2099. {
  2100. string JudgeStoveNo = heatNo;
  2101. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  2102. RollingCardEditGrid(dt, JudgeStoveNo);
  2103. }
  2104. #endregion
  2105. #region 事件处理
  2106. private void chkHeatNo_CheckedChanged(object sender, EventArgs e)
  2107. {
  2108. if (this.chkHeatNo.Checked)
  2109. {
  2110. this.txtJudgeStoveNo.Enabled = true;
  2111. }
  2112. else
  2113. {
  2114. this.txtJudgeStoveNo.Enabled = false;
  2115. }
  2116. if (this.chkLotNo.Checked)
  2117. {
  2118. this.txtLOT_NO.Enabled = true;
  2119. }
  2120. else
  2121. {
  2122. this.txtLOT_NO.Enabled = false;
  2123. }
  2124. if (chkStatusQuery.Checked)
  2125. {
  2126. PlanStatusQuery = "99";
  2127. }
  2128. else
  2129. {
  2130. PlanStatusQuery = "50";
  2131. }
  2132. }
  2133. /// <summary>
  2134. /// 再加热炉跟踪信息查询
  2135. /// </summary>
  2136. private void RackQuery(string heatNo)
  2137. {
  2138. tbRollDate.Clear();
  2139. int TabIndex = ultraTabControl3.ActiveTab.Index;
  2140. switch (TabIndex)
  2141. {
  2142. case 0:
  2143. if (ultraGridPlan.Rows.Count == 0)
  2144. {
  2145. return;
  2146. }
  2147. break;
  2148. case 1:
  2149. if (ultraGridINFurInfor.Rows.Count == 0)
  2150. {
  2151. return;
  2152. }
  2153. break;
  2154. case 2:
  2155. if (ultraGridOUTFurInfor.Rows.Count == 0)
  2156. {
  2157. return;
  2158. }
  2159. break;
  2160. }
  2161. RefurRack.JudgeStoveNo = heatNo;
  2162. RefurRack.ProPlanId = proPlanId;
  2163. RefurRack.GxPlanNo = gxPlanNo;
  2164. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.rackQueryForHeatNo", new object[] { RefurRack }, this.ob);//再加热炉跟踪信息
  2165. GridHelper.CopyDataToDatatable(ref dt, ref tbRollDate, true);
  2166. ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
  2167. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  2168. {
  2169. ugr.Cells["DELETE"].Value = "剔除";
  2170. ugr.Cells["DELBACK"].Value = "剔料回退";
  2171. }
  2172. ChangeGridColor();
  2173. }
  2174. /// <summary>
  2175. /// tab页切换事件
  2176. /// </summary>
  2177. /// <param name="sender"></param>
  2178. /// <param name="e"></param>
  2179. private void ultraTabControl3_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  2180. {
  2181. PlanQuery();
  2182. UltraGridRow ugr = null;
  2183. tbRollDate.Clear();
  2184. this.reFurResult1.ClearData();
  2185. switch (ultraTabControl3.SelectedTab.Index)
  2186. {
  2187. case 0:
  2188. if (this.dtPlan.Rows.Count > 0)
  2189. {
  2190. ugr = ultraGridPlan.ActiveRow;
  2191. AfterRowActive(ugr);
  2192. ActiveUgr = ugr;
  2193. }
  2194. else
  2195. {
  2196. ActiveUgr = null;
  2197. }
  2198. break;
  2199. case 1:
  2200. if (this.dtINFurInfor.Rows.Count > 0)
  2201. {
  2202. ugr = ultraGridINFurInfor.ActiveRow;
  2203. AfterRowActive(ugr);
  2204. ActiveUgr = ugr;
  2205. }
  2206. else
  2207. {
  2208. ActiveUgr = null;
  2209. }
  2210. break;
  2211. case 2:
  2212. if (this.dtOUTFurInfor.Rows.Count > 0)
  2213. {
  2214. ugr = ultraGridOUTFurInfor.ActiveRow;
  2215. AfterRowActive(ugr);
  2216. ActiveUgr = ugr;
  2217. }
  2218. else
  2219. {
  2220. ActiveUgr = null;
  2221. }
  2222. break;
  2223. }
  2224. }
  2225. /// <summary>
  2226. /// 查询再入炉实绩
  2227. /// </summary>
  2228. private void refurResultQuery()
  2229. {
  2230. DataTable dt = new DataTable();
  2231. dt.Clear();
  2232. if (ActiveUgr == null)
  2233. {
  2234. return;
  2235. }
  2236. string heatNo = ActiveUgr.Cells["JUDGE_STOVE_NO"].Text.ToString().Trim();
  2237. RefurRs.JudgeStoveNo = heatNo;
  2238. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getRefurResult", new object[] { heatNo, proPlanId, gxPlanNo }, this.ob);
  2239. GridEditResult(dt);
  2240. }
  2241. /// <summary>
  2242. /// 再入炉实绩赋值给Grid
  2243. /// </summary>
  2244. /// <param name="dt"></param>
  2245. private void GridEditResult(DataTable dt)
  2246. {
  2247. if (dt.Rows.Count > 0)
  2248. {
  2249. //入炉支数
  2250. this.reFurResult1.Value.InFurNum = dt.Rows[0]["IN_FUR_NUM"].ToString();
  2251. //剔除支数
  2252. this.reFurResult1.Value.ScrapNum = dt.Rows[0]["SCRAP_NUM"].ToString();
  2253. //入炉交接班支数
  2254. this.reFurResult1.Value.Changeclassnum = dt.Rows[0]["CHANGECLASSNUM"].ToString();
  2255. //出炉交接班支数
  2256. this.reFurResult1.Value.OutChangeNum = dt.Rows[0]["OUT_CHANGE_NUM"].ToString();
  2257. //出炉支数
  2258. if (dt.Rows[0]["IN_FUR_NUM"].ToString() == "")
  2259. {
  2260. this.reFurResult1.Value.OutFurNum = dt.Rows[0]["OUT_FUR_NUM"].ToString();
  2261. }
  2262. else
  2263. {
  2264. if (dt.Rows[0]["OUT_FUR_NUM"].ToString() == "")
  2265. {
  2266. if (dt.Rows[0]["SCRAP_NUM"].ToString() == "")
  2267. {
  2268. this.reFurResult1.Value.OutFurNum = (int.Parse(this.reFurResult1.Value.InFurNum.ToString()) - 0).ToString();
  2269. }
  2270. else
  2271. {
  2272. this.reFurResult1.Value.OutFurNum = (int.Parse(this.reFurResult1.Value.InFurNum.ToString()) - int.Parse(dt.Rows[0]["SCRAP_NUM"].ToString())).ToString();
  2273. }
  2274. }
  2275. else
  2276. {
  2277. this.reFurResult1.Value.OutFurNum = dt.Rows[0]["OUT_FUR_NUM"].ToString();
  2278. }
  2279. }
  2280. //备注
  2281. this.reFurResult1.Value.Remark = dt.Rows[0]["REMARK"].ToString();
  2282. //工艺路线
  2283. this.reFurResult1.Value.ProcessRoute = dt.Rows[0]["PROCESS_ROUTE"].ToString();
  2284. //炉温设定
  2285. this.reFurResult1.Value.SetFurTemp = dt.Rows[0]["SET_FUR_TEMP"].ToString();
  2286. //步进梁节奏
  2287. this.reFurResult1.Value.SteppingRhythm = dt.Rows[0]["STEPPING_RHYTHM"].ToString();
  2288. //移送链节奏
  2289. this.reFurResult1.Value.TransferRhythm = dt.Rows[0]["TRANSFER_RHYTHM"].ToString();
  2290. //荒管实际尺寸
  2291. //开始时间
  2292. this.reFurResult1.Value.StartTime = dt.Rows[0]["START_TIME"].ToString();
  2293. //结束时间
  2294. this.reFurResult1.Value.EndTime = dt.Rows[0]["END_TIME"].ToString();
  2295. //结束时间
  2296. this.reFurResult1.Value.ActualLengthOfWastePipe = dt.Rows[0]["ACTUAL_LENGTH_OF_WASTE_PIPE"].ToString();
  2297. //第一支入炉温度
  2298. this.reFurResult1.Value.FirstInTemp = dt.Rows[0]["FIRST_IN_TEMP"].ToString();
  2299. //第一支出炉温度
  2300. this.reFurResult1.Value.FirstOutTemp = dt.Rows[0]["FIRST_OUT_TEMP"].ToString();
  2301. //第一支入炉时间
  2302. this.reFurResult1.Value.FirstInTime = dt.Rows[0]["FIRST_IN_TIME"].ToString();
  2303. //最后一支入炉时间
  2304. this.reFurResult1.Value.LastInTime = dt.Rows[0]["LAST_IN_TIME"].ToString();
  2305. // 烧损率
  2306. this.reFurResult1.Value.Burningrate = "2.0";//dt.Rows[0]["BURNINGRATE"].ToString();
  2307. //最后一支入炉温度
  2308. this.reFurResult1.Value.LastInTemp = dt.Rows[0]["LAST_IN_TEMP"].ToString();
  2309. //最后一支出炉温度
  2310. this.reFurResult1.Value.LastOutTemp = dt.Rows[0]["LAST_OUT_TEMP"].ToString();
  2311. //第一支出炉时间
  2312. this.reFurResult1.Value.FirstOutTime = dt.Rows[0]["FIRST_OUT_TIME"].ToString();
  2313. //最后一支出炉时间
  2314. this.reFurResult1.Value.LastOutTime = dt.Rows[0]["LAST_OUT_TIME"].ToString();
  2315. this.reFurResult1.Value.BeginRollingTemp = dt.Rows[0]["BEGIN_ROLLING_TEMP"].ToString();
  2316. this.reFurResult1.UpdateData();
  2317. //加一段温度
  2318. this.ultraTextEditor16.Text = getstring(dt.Rows[0]["LHEAT_CRUVE1"].ToString());
  2319. //加二段温度
  2320. this.ultraTextEditor1.Text = getstring(dt.Rows[0]["LHEAT_CRUVE2"].ToString());
  2321. //加三段温度
  2322. ultraTextEditor10.Text = getstring(dt.Rows[0]["LHEAT_CRUVE3"].ToString());
  2323. //加四段温度
  2324. ultraTextEditor11.Text = getstring(dt.Rows[0]["LHEAT_CRUVE4"].ToString());
  2325. //加五段温度
  2326. ultraTextEditor12.Text = getstring(dt.Rows[0]["LHEAT_CRUVE5"].ToString());
  2327. //加六段温度
  2328. ultraTextEditor13.Text = getstring(dt.Rows[0]["LHEAT_CRUVE6"].ToString());
  2329. //加七段温度
  2330. ultraTextEditor14.Text = getstring(dt.Rows[0]["LHEAT_CRUVE7"].ToString());
  2331. //加八段温度
  2332. ultraTextEditor15.Text = getstring(dt.Rows[0]["LHEAT_CRUVE8"].ToString());
  2333. //炉温
  2334. ultraTextEditor19.Text = getstring(dt.Rows[0]["FUR_PRESS"].ToString());
  2335. //风压
  2336. ultraTextEditor18.Text = getstring(dt.Rows[0]["WIND_PRESS"].ToString());
  2337. //天然气压力
  2338. ultraTextEditor17.Text = getstring(dt.Rows[0]["GAS_PRESS"].ToString());
  2339. }
  2340. else//再加热实绩为null 时清楚实绩卡里的记录
  2341. {
  2342. MilRefurResultEntity re = new MilRefurResultEntity();
  2343. this.reFurResult1.Value = re;
  2344. this.reFurResult1.UpdateData();
  2345. //加一段温度
  2346. this.ultraTextEditor16.Text = "0.00";
  2347. //加二段温度
  2348. this.ultraTextEditor1.Text = "0.00";
  2349. //加三段温度
  2350. ultraTextEditor10.Text = "0.00";
  2351. //加四段温度
  2352. ultraTextEditor11.Text = "0.00";
  2353. //加五段温度
  2354. ultraTextEditor12.Text = "0.00";
  2355. //加六段温度
  2356. ultraTextEditor13.Text = "0.00";
  2357. //加七段温度
  2358. ultraTextEditor14.Text = "0.00";
  2359. //加八段温度
  2360. ultraTextEditor15.Text = "0.00";
  2361. //炉温
  2362. ultraTextEditor19.Text = "0.00";
  2363. //风压
  2364. ultraTextEditor18.Text = "0.00";
  2365. //天然气压力
  2366. ultraTextEditor17.Text = "0.00";
  2367. }
  2368. this.reFurResult1.UpdateData();
  2369. }
  2370. /// <summary>
  2371. /// Grid表头事件
  2372. /// </summary>
  2373. /// <param name="sender"></param>
  2374. /// <param name="e"></param>
  2375. private void ultraGrid1_DoubleClickHeader(object sender, DoubleClickHeaderEventArgs e)
  2376. {
  2377. if (PanelSizeFlag == 0)
  2378. {
  2379. PanelSizeFlag = 1;
  2380. splitContainer2.SplitterDistance = 180;
  2381. }
  2382. else
  2383. {
  2384. PanelSizeFlag = 0;
  2385. splitContainer2.SplitterDistance = 90;
  2386. }
  2387. }
  2388. #endregion
  2389. /// <summary>
  2390. /// 轧制信息Grid赋值
  2391. /// </summary>
  2392. /// <param name="dt">轧制计划信息datatable</param>
  2393. public void GridEdit(DataTable dt)
  2394. {
  2395. if (dt.Rows.Count > 0)
  2396. {
  2397. DataRow row1 = dt.Rows[0];
  2398. //熔炼炉号
  2399. this.rollingInfomation1.Value.StoveNo = row1["stove_no"].ToString();
  2400. //炉号
  2401. this.rollingInfomation1.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString());
  2402. //生产批号
  2403. this.rollingInfomation1.Value.LotNo = row1["lot_no"].ToString();
  2404. //工序合同号
  2405. this.rollingInfomation1.Value.ContractNo = row1["contract_no"].ToString();
  2406. //执行工艺号
  2407. this.rollingInfomation1.Value.ImpProcess = row1["imp_process"].ToString();
  2408. //执行工艺号路径
  2409. this.rollingInfomation1.Value.ImpProcessPath = row1["imp_process_path"].ToString();
  2410. //产线代码
  2411. this.rollingInfomation1.Value.PlineCode = row1["pline_code"].ToString();
  2412. //状态
  2413. this.rollingInfomation1.Value.Status = row1["STATUS"].ToString();
  2414. //监制
  2415. this.rollingInfomation1.Value.Producer = row1["producer"].ToString();
  2416. //工艺状态
  2417. this.rollingInfomation1.Value.ProcessStatus = row1["process_status"].ToString();
  2418. //单倍长
  2419. this.rollingInfomation1.Value.DbLength = row1["db_length"].ToString();
  2420. //单倍重
  2421. this.rollingInfomation1.Value.DbHeight = row1["db_height"].ToString();
  2422. //轧制长度
  2423. this.rollingInfomation1.Value.RollLength = row1["roll_length"].ToString();
  2424. //分切数
  2425. this.rollingInfomation1.Value.SawNum = row1["saw_num"].ToString();
  2426. //目标长度
  2427. this.rollingInfomation1.Value.TargetLength = row1["target_length"].ToString();
  2428. //最终用户
  2429. this.rollingInfomation1.Value.FinishUser = row1["finish_user"].ToString();
  2430. //目标库
  2431. this.rollingInfomation1.Value.TargetLiabrary = row1["target_liabrary"].ToString();
  2432. //品种
  2433. this.rollingInfomation1.Value.Varieties = row1["varieties"].ToString();
  2434. //成品规格
  2435. this.rollingInfomation1.Value.PipeSize = row1["pipe_size"].ToString();
  2436. //扣型
  2437. this.rollingInfomation1.Value.BuckleType = row1["buckle_type"].ToString();
  2438. //长度范围
  2439. this.rollingInfomation1.Value.LengthRange = row1["length_range"].ToString();
  2440. //轧管判定标准
  2441. this.rollingInfomation1.Value.RollStandrad = row1["roll_standrad"].ToString();
  2442. //断面
  2443. this.rollingInfomation1.Value.PipeSection = row1["pipe_section"].ToString();
  2444. //钢种代码
  2445. this.rollingInfomation1.Value.SteelCode = row1["steelcode"].ToString();
  2446. //钢种名称
  2447. this.rollingInfomation1.Value.SteelName = row1["steelname"].ToString();
  2448. //钢级代码
  2449. this.rollingInfomation1.Value.GradeCode = row1["gradecode"].ToString();
  2450. //钢级名称
  2451. this.rollingInfomation1.Value.GradeName = row1["gradename"].ToString();
  2452. //炼钢判定标准
  2453. this.rollingInfomation1.Value.SteelStandrad = row1["steel_standrad"].ToString();
  2454. //去向
  2455. this.rollingInfomation1.Value.Target = row1["target"].ToString();
  2456. //支
  2457. this.rollingInfomation1.Value.PlanNum = row1["BRANCH"].ToString();
  2458. //吨
  2459. this.rollingInfomation1.Value.PlanTon = row1["TON"].ToString();
  2460. //切损去向
  2461. this.rollingInfomation1.Value.CutTarget = row1["cut_target"].ToString();
  2462. //切损长度
  2463. this.rollingInfomation1.Value.CutLength = row1["cut_length"].ToString();
  2464. //切损重量
  2465. this.rollingInfomation1.Value.CutHeight = row1["CUT_WEIGHT"].ToString();
  2466. //倍尺数
  2467. this.rollingInfomation1.Value.DbNum = row1["DB_NUM"].ToString();
  2468. //标准类别代码
  2469. this.rollingInfomation1.Value.StdStyle = row1["STD_STYLE"].ToString();
  2470. //标准类别描述
  2471. this.rollingInfomation1.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString();
  2472. //成品备注
  2473. this.rollingInfomation1.Value.ReMark = row1["ReMark"].ToString();
  2474. this.rollingInfomation1.UpdateData();
  2475. }
  2476. }
  2477. /// <summary>
  2478. /// 计划表ROW点击变换判断
  2479. /// </summary>
  2480. /// <param name="sender"></param>
  2481. /// <param name="e"></param>
  2482. private void ultraGridPlan_BeforeRowActivate(object sender, RowEventArgs e)
  2483. {
  2484. if (this.reFurResult1.IsCellSelect == true)
  2485. {
  2486. NativeMethodNew na = new NativeMethodNew(this.ob);
  2487. if (!na.isBegineNode(ActiveJUDGE_STOVE_NO, 4))
  2488. {
  2489. this.reFurResult1.IsCellSelect = false;
  2490. return;
  2491. }
  2492. //if (MessageBox.Show("提示:再加热炉实绩可能已修改,是否保存", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  2493. //{
  2494. // this.reFurResult1.IsCellSelect = false;
  2495. // //保存探伤实绩
  2496. //}
  2497. else
  2498. {
  2499. FeedRowSave();
  2500. this.reFurResult1.IsCellSelect = false;
  2501. foreach (UltraGridRow ugr in this.ultraGridPlan.Rows)
  2502. {
  2503. if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString() == ActiveJUDGE_STOVE_NO)
  2504. {
  2505. this.ultraGridPlan.ActiveRow = ugr;
  2506. }
  2507. }
  2508. return;
  2509. }
  2510. }
  2511. }
  2512. /// <summary>
  2513. /// 查询结炉实绩
  2514. /// </summary>
  2515. public void NodeQuery()
  2516. {
  2517. string Group = UserInfo.GetUserGroup();
  2518. string Shift = UserInfo.GetUserOrder();
  2519. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2520. string StartTime = SeverTime.ToString("yyyy-MM-dd");
  2521. string EndTime = SeverTime.AddDays(1).ToString("yyyy-MM-dd");
  2522. string Date = StartTime;
  2523. string Time = SeverTime.ToLongTimeString();
  2524. //晚班
  2525. if (Shift == "3")
  2526. {
  2527. Time = Time.Replace(":", "");
  2528. if (int.Parse(Time) > 205900)
  2529. {
  2530. StartTime += " " + "21:00:00";
  2531. EndTime += " " + "10:00:00";
  2532. }
  2533. else
  2534. {
  2535. StartTime = SeverTime.AddDays(-1).ToString("yyyy-MM-dd") + " " + "21:00:00";
  2536. EndTime = SeverTime.ToString("yyyy-MM-dd") + " " + "10:00:00";
  2537. }
  2538. }
  2539. else
  2540. {
  2541. StartTime = StartTime + " 00:00:00";
  2542. EndTime = EndTime + " 00:00:00";
  2543. }
  2544. // DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.GetReFurResultNodeQuery", new object[] { PlineCode, Shift, Group, StartTime, EndTime }, this.ob);
  2545. CoreClientParam ccp = new CoreClientParam();
  2546. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmReFurResult";
  2547. ccp.MethodName = "GetReFurResultNodeQuery";
  2548. ccp.ServerParams = new object[] { PlineCode, Shift, Group, StartTime, EndTime };
  2549. ccp = this.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
  2550. if (ccp.ReturnObject == null)
  2551. {
  2552. return;
  2553. }
  2554. DataTable dt = ccp.SourceDataTable;
  2555. FrmNodeResultQuery frm = new FrmNodeResultQuery(dt, 5, Date, Shift, Group, this.ob);
  2556. frm.ShowDialog();
  2557. }
  2558. /// <summary>
  2559. /// 打印报表
  2560. /// </summary>
  2561. private void PrintResult()
  2562. {
  2563. Group = UserInfo.GetUserGroup();
  2564. Shift = UserInfo.GetUserOrder();
  2565. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2566. string Time = SeverTime.ToLongTimeString();
  2567. string StartTime = ""; // 开始时间 用于报表查询
  2568. string EndTime = ""; // 结束时间 用于报表查询
  2569. string strurl = "";
  2570. //晚班
  2571. Time = Time.Replace(":", "");
  2572. if (Shift == "3")
  2573. {
  2574. //查询晚班前一天20点40后到当天07点20前所有记录
  2575. if (int.Parse(Time) < 072000)
  2576. {
  2577. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
  2578. EndTime = SeverTime.ToShortDateString() + " 07:20:00";
  2579. //string Date2 = SeverTime.ToString("yyyy-MM-dd");
  2580. }
  2581. //查询当天晚班的所有数据
  2582. else if (int.Parse(Time) > 204000)
  2583. {
  2584. StartTime = SeverTime.ToShortDateString() + " 20:40:00";
  2585. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
  2586. }
  2587. }
  2588. //白班 中班
  2589. else
  2590. {
  2591. StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  2592. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2593. }
  2594. switch (PlineCode)
  2595. {
  2596. case "C008": //250
  2597. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilAgainiFurResult250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  2598. break;
  2599. case "C072": //508
  2600. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilAgainiFurResult250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  2601. break;
  2602. case "C009": //258
  2603. break;
  2604. case "C010": //168
  2605. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilAgainiFurResult168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  2606. break;
  2607. case "C012": //Arssel
  2608. break;
  2609. case "C017": //460
  2610. break;
  2611. }
  2612. FrmRepExcel fre = new FrmRepExcel(ob, strurl);
  2613. fre.AutoSize = true;
  2614. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  2615. fre.WindowState = FormWindowState.Maximized;
  2616. fre.Show();
  2617. }
  2618. /// <summary>
  2619. /// 查询上个班原始记录
  2620. /// </summary>
  2621. private void QueryBefore()
  2622. {
  2623. HOTMethod hm = new HOTMethod(this.ob);
  2624. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  2625. string Time = SeverTime.ToLongTimeString();
  2626. string Date = "";
  2627. if (Shift == "3")
  2628. {
  2629. Time = Time.Replace(":", "");
  2630. if (int.Parse(Time) < 122000)
  2631. {
  2632. Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
  2633. }
  2634. else
  2635. {
  2636. Date = SeverTime.ToString("yyyyMMdd");
  2637. }
  2638. }
  2639. if (Shift == "1" || Shift == "0")
  2640. {
  2641. Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
  2642. }
  2643. else
  2644. {
  2645. Date = SeverTime.ToString("yyyyMMdd");
  2646. }
  2647. string StartTime = ""; // 开始时间 用于报表查询
  2648. string EndTime = ""; // 结束时间 用于报表查询
  2649. string StartTimeU = ""; // 开始时间 用于得到上班UserID
  2650. string EndTimeU = ""; // 结束时间 用于得到上班UserID
  2651. string strurl = "";
  2652. string ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date, PlineCode);
  2653. //if (PlineCode.Equals("C072"))
  2654. //{
  2655. // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date);
  2656. //}
  2657. //else
  2658. //{
  2659. // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group);
  2660. //}
  2661. string UserIDBefore = "";
  2662. //晚班
  2663. Time = Time.Replace(":", "");
  2664. if (Shift == "3")
  2665. {
  2666. //查询晚班前一天中班所有记录
  2667. if (int.Parse(Time) < 122000)
  2668. {
  2669. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
  2670. EndTime = SeverTime.ToShortDateString() + " 00:00:00";
  2671. //string Date2 = SeverTime.ToString("yyyy-MM-dd");
  2672. StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
  2673. EndTimeU = SeverTime.ToShortDateString() + " 00:00:00";
  2674. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 4, PlineCode);
  2675. //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;
  2676. }
  2677. //查询当天中班的所有数据
  2678. else if (int.Parse(Time) > 204000)
  2679. {
  2680. StartTime = SeverTime.ToShortDateString() + " 13:40:00";
  2681. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2682. StartTimeU = SeverTime.ToShortDateString() + " 13:40:00";
  2683. EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2684. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 4, PlineCode);
  2685. //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;
  2686. }
  2687. }
  2688. //白班
  2689. else if (Shift == "1")
  2690. {
  2691. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
  2692. EndTime = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
  2693. StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
  2694. EndTimeU = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
  2695. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 4, PlineCode);
  2696. }
  2697. //中班
  2698. else
  2699. {
  2700. StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  2701. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2702. StartTimeU = SeverTime.ToShortDateString() + " 00:00:00";
  2703. EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  2704. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 4, PlineCode);
  2705. //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;
  2706. }
  2707. switch (PlineCode)
  2708. {
  2709. case "C008": //250
  2710. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilAgainiFurResult250.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  2711. break;
  2712. case "C072": //508
  2713. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilAgainiFurResult250.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  2714. break;
  2715. case "C009": //258
  2716. //晚班
  2717. break;
  2718. case "C010": //168
  2719. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilAgainiFurResult168.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  2720. break;
  2721. case "C012": //Arssel
  2722. break;
  2723. case "C017": //460
  2724. break;
  2725. }
  2726. FrmRepExcel fre = new FrmRepExcel(ob, strurl);
  2727. fre.AutoSize = true;
  2728. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  2729. fre.WindowState = FormWindowState.Maximized;
  2730. fre.Show();
  2731. }
  2732. private void frmTechnological1_DoubleClickEvent(DataTable dt)
  2733. {
  2734. GridEditResult(dt);
  2735. }
  2736. /// <summary>
  2737. /// 自动刷新
  2738. /// </summary>
  2739. /// <param name="sender"></param>
  2740. /// <param name="e"></param>
  2741. private void timer1_Tick(object sender, EventArgs e)
  2742. {
  2743. int MouseLocX = 0;
  2744. int MouseLocY = 0;
  2745. //获取当前鼠标坐标
  2746. //获取鼠标坐标
  2747. Point formPoint = this.PointToClient(Control.MousePosition);
  2748. MouseLocX = Convert.ToInt32(formPoint.X);
  2749. MouseLocY = Convert.ToInt32(formPoint.Y);
  2750. if (MouseLocX == _MouseLocX && MouseLocY == _MouseLocY)
  2751. {
  2752. ShowMessageFlag = 1;
  2753. PlanQuery();
  2754. ShowMessageFlag = 0;
  2755. }
  2756. else
  2757. {
  2758. _MouseLocX = MouseLocX;
  2759. _MouseLocY = MouseLocY;
  2760. }
  2761. }
  2762. /// <summary>
  2763. /// 管号队列修改剔除原因 备注
  2764. /// </summary>
  2765. /// <param name="sender"></param>
  2766. /// <param name="e"></param>
  2767. private void ultraGridMatSeq_KeyPress(object sender, KeyPressEventArgs e)
  2768. {
  2769. if (e.KeyChar == (char)13)
  2770. {
  2771. e.Handled = true;
  2772. UltraGridRow ugr = null;
  2773. int Index = ultraGrid1.ActiveRow.Index;
  2774. if (Index < ultraGrid1.Rows.Count - 1)
  2775. {
  2776. ugr = ultraGrid1.Rows[Index - 1];
  2777. // ugr = ultraGrid1.ActiveRow;
  2778. }
  2779. else
  2780. {
  2781. ugr = ultraGrid1.ActiveRow;
  2782. }
  2783. ultraGrid1.UpdateData();
  2784. ultraGrid1.Update();
  2785. string ScrapReason = ugr.Cells["SCRAP_REASON"].Text.ToString().Trim();
  2786. string Remark = ugr.Cells["REMARK"].Text.ToString();
  2787. string Seq = ugr.Cells["SEQ"].Text.ToString();
  2788. string Status = ugr.Cells["STATUS"].Text.ToString();
  2789. if (Status == "剔除")
  2790. {
  2791. int dt = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateMatNoPro", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, 1, Seq, ScrapReason, Remark }, this.ob);
  2792. }
  2793. ChangeGridColor();
  2794. RackQuery(ActiveJUDGE_STOVE_NO);
  2795. }
  2796. }
  2797. }
  2798. }