FrmHotSimple.cs 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using com.steering.mes.zgmil.entity;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Core.Mes.Client.Comm.Tool;
  15. using Core.StlMes.Client.ZGMil.Entity;
  16. using Core.StlMes.Client.ZGMil.NodeResultQuery;
  17. using System.Net;
  18. using Core.StlMes.Client.ZGMil.Popup;
  19. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  20. using Core.StlMes.Client.ZGMil.Common;
  21. using CoreFS.SA06;
  22. using System.Collections;
  23. namespace Core.StlMes.Client.ZGMil.Result
  24. {
  25. public partial class FrmHotSimple : FrmBase
  26. {
  27. #region 初始化
  28. MilPlan QueryMainPlan = new MilPlan();
  29. MilPlan MainPlan = new MilPlan();
  30. UltraGridRow actugr = null;
  31. private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
  32. string PLineCode = "";//产线代码
  33. string PlanStatusQuery = "99"; //查询结炉实绩结炉状态
  34. string PlanStartStatusQuery = "01"; //查询结炉实绩起始状态
  35. string ActiveJUDGE_STOVE_NO = string.Empty;//主计划活动行的判定炉号
  36. string ActiveResultNo = string.Empty;//主计划活动行的判定炉号
  37. private string proPlanId = null;//轧管订单编号
  38. private string gxPlanNo = null;//工序排产序号
  39. private string ActiveStatus = null;//主计划活动行的状态
  40. MilSizingResultEntity tempsizingresult = new MilSizingResultEntity();
  41. MilHotCheckEntity HotCheckEntity = new MilHotCheckEntity();
  42. MilHotCheckDetailEntity HotCheckDetailEntity = new MilHotCheckDetailEntity();
  43. string Shift = "";
  44. string Group = "";
  45. private string Departm = "";//部门
  46. private string PlineCod = "";//产线
  47. private int _MouseLocX = 0; //鼠标横坐标
  48. private int _MouseLocY = 0; //鼠标纵坐标
  49. private string _UserName = "";
  50. private string _UserID = "";
  51. private int ShowMessageFlag = 0; //显示提示Flag 0-显示 1-不显示
  52. int HotFlag = 0;
  53. private string CutHeadBefore = "";
  54. private string CutTrailBefore = "";
  55. private string CutOrderBefore = "";
  56. int CopyFlag = 0;
  57. // MilHotCheckDetailEntity HotCheckCopyEntity = new MilHotCheckDetailEntity(); //用于复制
  58. MilHotCheckResultEntity MilHotCheckSave = new com.steering.mes.zgmil.entity.MilHotCheckResultEntity();
  59. string CutHead = "";
  60. string CutOrder = "";
  61. string CutTrail = "";
  62. Infragistics.Win.ValueList valueList = new Infragistics.Win.ValueList();
  63. public Infragistics.Win.UltraWinGrid.UltraGrid Grid
  64. {
  65. get { return _grid; }
  66. }
  67. public FrmHotSimple()
  68. {
  69. InitializeComponent();
  70. InitControl();
  71. Shift = UserInfo.GetUserOrder();
  72. Group = UserInfo.GetUserGroup();
  73. //获取鼠标坐标
  74. Point formPoint = this.PointToClient(Control.MousePosition);
  75. _MouseLocX = Convert.ToInt32(formPoint.X);
  76. _MouseLocY = Convert.ToInt32(formPoint.Y);
  77. valueList.ValueListItems.Add("0", "管头");
  78. valueList.ValueListItems.Add("1", "管体");
  79. valueList.ValueListItems.Add("2", "管尾");
  80. valueList.SelectedIndex = 0;
  81. ultraGrid1.DisplayLayout.Bands[0].Columns["pipe_location"].ValueList = valueList;
  82. ultraGrid1.DisplayLayout.Bands[0].Columns["pipe_location"].CellActivation = Activation.NoEdit;
  83. }
  84. /// <summary>
  85. /// 定时器事件
  86. /// </summary>
  87. /// <param name="sender"></param>
  88. /// <param name="e"></param>
  89. void timer1_Tick(object sender, EventArgs e)
  90. {
  91. int MouseLocX = 0;
  92. int MouseLocY = 0;
  93. //获取当前鼠标坐标
  94. //获取鼠标坐标
  95. Point formPoint = this.PointToClient(Control.MousePosition);
  96. MouseLocX = Convert.ToInt32(formPoint.X);
  97. MouseLocY = Convert.ToInt32(formPoint.Y);
  98. if (MouseLocX == _MouseLocX && MouseLocY == _MouseLocY)
  99. {
  100. ShowMessageFlag = 1;
  101. PlanQuery();
  102. ShowMessageFlag = 0;
  103. }
  104. else
  105. {
  106. _MouseLocX = MouseLocX;
  107. _MouseLocY = MouseLocY;
  108. }
  109. }
  110. protected override void OnLoad(EventArgs e)
  111. {
  112. base.OnLoad(e);
  113. ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  114. rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  115. rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  116. colHotCheck1.UltraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  117. ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  118. splitContainer2.SplitterDistance = 180;
  119. foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
  120. {
  121. ugc.SortIndicator = SortIndicator.Disabled;
  122. }
  123. timer1.Tick += new EventHandler(timer1_Tick);
  124. //ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom;
  125. //ultraGrid1.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.True;
  126. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD_P"].CellActivation = Activation.NoEdit;
  127. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL_P"].CellActivation = Activation.NoEdit;
  128. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER_P"].CellActivation = Activation.NoEdit;
  129. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CHECK_DATE"].CellActivation = Activation.AllowEdit;
  130. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_SHIFT_D"].Hidden = true;
  131. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_GROUP_D"].Hidden = true;
  132. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_USER"].Hidden = true;
  133. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_INFO"].Hidden = true;
  134. //switch (PLineCode)
  135. //{
  136. //}
  137. }
  138. /// <summary>
  139. /// 页面开启事件
  140. /// </summary>
  141. /// <param name="e"></param>
  142. protected override void OnShown(EventArgs e)
  143. {
  144. base.OnShown(e);
  145. string hostname = Dns.GetHostName();
  146. NativeMethodNew na = new NativeMethodNew(this.ob);
  147. Departm = UserInfo.GetDepartment();
  148. PLineCode = na.GetPCode(Departm);
  149. PlineCod = na.GetPCode(Departm);//获取 用户 对应的产线
  150. if (PlineCod.Equals("C009") || PlineCod.Equals("C012") || PlineCod.Equals("C017") || PlineCod.Equals("C072"))
  151. {
  152. this.rollingCard1.ChangCard();
  153. }
  154. switch (PLineCode)
  155. {
  156. case "C008":
  157. ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
  158. ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
  159. ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
  160. ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
  161. ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
  162. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].CellActivation = Activation.NoEdit;
  163. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].CellActivation = Activation.NoEdit;
  164. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].Header.Appearance.BackColor = Color.Gray;
  165. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].Header.Appearance.BackColor = Color.Gray;
  166. break;
  167. case "C009":
  168. ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
  169. ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
  170. ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
  171. ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
  172. ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
  173. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].CellActivation = Activation.NoEdit;
  174. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].CellActivation = Activation.NoEdit;
  175. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].Header.Appearance.BackColor = Color.Gray;
  176. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].Header.Appearance.BackColor = Color.Gray;
  177. break;
  178. case "C010":
  179. ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
  180. ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
  181. ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
  182. ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
  183. ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
  184. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].Header.Caption = "实际长度";
  185. break;
  186. case "C012":
  187. ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
  188. ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
  189. ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
  190. ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
  191. ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
  192. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].CellActivation = Activation.NoEdit;
  193. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].CellActivation = Activation.NoEdit;
  194. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].Header.Appearance.BackColor = Color.Gray;
  195. colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].Header.Appearance.BackColor = Color.Gray;
  196. break;
  197. case "C017":
  198. ultraGrid1.DisplayLayout.Bands[0].Columns["d3"].Hidden = true;
  199. ultraGrid1.DisplayLayout.Bands[0].Columns["d4"].Hidden = true;
  200. ultraGrid1.DisplayLayout.Bands[0].Columns["d1"].Header.Caption = "Dmin";
  201. ultraGrid1.DisplayLayout.Bands[0].Columns["d2"].Header.Caption = "Dmax";
  202. ultraGrid1.DisplayLayout.Bands[0].Columns["DIAMETER"].RowLayoutColumnInfo.SpanX = 2;
  203. //colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].CellActivation = Activation.NoEdit;
  204. //colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].CellActivation = Activation.NoEdit;
  205. //colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["PASS_SERIES4"].Header.Appearance.BackColor = Color.Gray;
  206. //colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["DOUBLE_B4"].Header.Appearance.BackColor = Color.Gray;
  207. break;
  208. }
  209. Sign();
  210. PlanQuery();
  211. }
  212. /// <summary>
  213. /// 签名
  214. /// </summary>
  215. private void Sign()
  216. {
  217. ColUserName col = new ColUserName();
  218. col.StationId = "10";
  219. col.PlineCode = PLineCode;
  220. col.ColGroup = Group;
  221. col.Ob = this.ob;
  222. col.ShowDialog();
  223. _UserID = col.getUserId();
  224. _UserName = col.getUserName();
  225. }
  226. /// <summary>
  227. /// 初始化控件
  228. /// </summary>
  229. public void InitControl()
  230. {
  231. if (chkLotNo.Checked)
  232. {
  233. txtLOT_NO.Enabled = true;
  234. }
  235. else
  236. {
  237. txtLOT_NO.Enabled = false;
  238. }
  239. if (chkHeatNo.Checked)
  240. {
  241. txtJudgeStoveNo.Enabled = true;
  242. }
  243. else
  244. {
  245. txtJudgeStoveNo.Enabled = false;
  246. }
  247. }
  248. #endregion
  249. #region 控制赋值 方法
  250. /// <summary>
  251. /// 刷新
  252. /// </summary>
  253. public void ReFresh()
  254. {
  255. ChangeGridColor();
  256. PlanQuery();
  257. }
  258. /// <summary>
  259. /// 更改剔除坯料行颜色
  260. /// </summary>
  261. public void ChangeGridColor()
  262. {
  263. if (ultraGridPlan.Rows.Count > 0)
  264. {
  265. foreach (UltraGridRow ugr in ultraGridPlan.Rows)
  266. {
  267. if (ugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
  268. {
  269. ugr.Appearance.BackColor = Color.YellowGreen;
  270. }
  271. }
  272. }
  273. }
  274. /// <summary>
  275. /// 复制(把上一炉的实绩信息带到下一炉)
  276. /// </summary>
  277. private void DoStart()
  278. {
  279. if (MilHotCheckSave != null)
  280. {
  281. //colHotCheck1.SizingDataSource1.Rows[0]["INSPECTOR"] = MilHotCheckSave.Inspector;
  282. //colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B1"] = MilHotCheckSave.DoubleB1;
  283. //colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B2"] = MilHotCheckSave.DoubleB2;
  284. //colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B3"] = MilHotCheckSave.DoubleB3;
  285. //colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B4"] = MilHotCheckSave.DoubleB4;
  286. //colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES1"] = MilHotCheckSave.PassSeries1;
  287. //colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES2"] = MilHotCheckSave.PassSeries2;
  288. //colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES3"] = MilHotCheckSave.PassSeries3;
  289. //colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES4"] = MilHotCheckSave.PassSeries4;
  290. //colHotCheck1.SizingDataSource1.Rows[0]["START_TEMP"] = MilHotCheckSave.Standard;
  291. //colHotCheck1.SizingDataSource1.Rows[0]["END_TEMP"] = MilHotCheckSave.EndTemp;
  292. //this.colHotCheck1.Value.Inspector = MilHotCheckSave.Inspector;
  293. this.colHotCheck1.Value.DoubleB1 = MilHotCheckSave.DoubleB1;
  294. this.colHotCheck1.Value.DoubleB2 = MilHotCheckSave.DoubleB2;
  295. this.colHotCheck1.Value.DoubleB3 = MilHotCheckSave.DoubleB3;
  296. //this.colHotCheck1.Value.DoubleB4 = MilHotCheckSave.DoubleB4;
  297. this.colHotCheck1.Value.PassSeries1 = MilHotCheckSave.PassSeries1;
  298. this.colHotCheck1.Value.PassSeries2 = MilHotCheckSave.PassSeries2;
  299. this.colHotCheck1.Value.PassSeries3 = MilHotCheckSave.PassSeries3;
  300. this.colHotCheck1.Value.Outdiameter = MilHotCheckSave.Outdiameter;
  301. this.colHotCheck1.Value.Wallthick = MilHotCheckSave.Wallthick;
  302. //this.colHotCheck1.Value.PassSeries4 = MilHotCheckSave.PassSeries4;
  303. //this.colHotCheck1.Value.Standard = MilHotCheckSave.Standard;
  304. //this.colHotCheck1.Value.EndTemp = MilHotCheckSave.EndTemp;
  305. this.colHotCheck1.Value.StartTemp = MilHotCheckSave.StartTemp;
  306. this.colHotCheck1.Value.EndTemp = MilHotCheckSave.EndTemp;
  307. this.colHotCheck1.Value.Remark = MilHotCheckSave.Remark;
  308. if (PLineCode.Equals("C010"))
  309. {
  310. this.colHotCheck1.Value.DoubleB4 = MilHotCheckSave.DoubleB4;
  311. this.colHotCheck1.Value.PassSeries4 = MilHotCheckSave.PassSeries4;
  312. }
  313. switch (PLineCode)
  314. {
  315. case "C008": //250
  316. case "C010": //168
  317. case "C017": //460
  318. this.colHotCheck1.Value.CutHead = CutHead;
  319. this.colHotCheck1.Value.CutTrail = CutTrail;
  320. this.colHotCheck1.Value.CutOrder = CutOrder;
  321. break;
  322. }
  323. }
  324. colHotCheck1.UpdateDate();
  325. }
  326. /// <summary>
  327. /// 查询流通卡信息
  328. /// </summary>
  329. public void GetRollingCard()
  330. {
  331. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  332. if (ugr != null)
  333. {
  334. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  335. DataTable dt = new DataTable();
  336. if (PlineCod.Equals("C009") || PlineCod.Equals("C012") || PlineCod.Equals("C017"))
  337. {
  338. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  339. }
  340. else
  341. {
  342. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  343. }
  344. RollingCardEditGrid(dt, JudgeStoveNo);
  345. }
  346. }
  347. #endregion
  348. #region L
  349. /// <summary>
  350. /// ToolBar按钮
  351. /// </summary>
  352. /// <param name="sender"></param>
  353. /// <param name="ToolbarKey"></param>
  354. public override void ToolBar_Click(object sender, string ToolbarKey)
  355. {
  356. switch (ToolbarKey)
  357. {
  358. case "DoQuery":
  359. PlanQuery();
  360. break;
  361. case "DoStart":
  362. DoStart();
  363. break;
  364. case "DoSave":
  365. ResultSave();
  366. break;
  367. case "DoAdd":
  368. ResultAdd();
  369. break;
  370. case "DoDelete":
  371. ResultDelete();
  372. break;
  373. case "DoNodeBack":
  374. NodeBack();
  375. break;
  376. case "DoNode":
  377. Node();
  378. break;
  379. case "DoPrint":
  380. PrintResult();
  381. break;
  382. case "DoSign":
  383. Sign();
  384. break;
  385. //case "DoQueryBefore":
  386. // QueryBefore();
  387. // break;
  388. case "Close":
  389. this.Dispose();
  390. this.Close();
  391. break;
  392. }
  393. }
  394. /// <summary>
  395. /// checkbox点击事件
  396. /// </summary>
  397. /// <param name="sender"></param>
  398. /// <param name="e"></param>
  399. private void chkDate_CheckedChanged(object sender, EventArgs e)
  400. {
  401. if (chkLotNo.Checked)
  402. {
  403. txtLOT_NO.Enabled = true;
  404. }
  405. else
  406. {
  407. txtLOT_NO.Enabled = false;
  408. }
  409. if (chkHeatNo.Checked)
  410. {
  411. txtJudgeStoveNo.Enabled = true;
  412. }
  413. else
  414. {
  415. txtJudgeStoveNo.Enabled = false;
  416. }
  417. if (chkStatusQuery.Checked)
  418. {
  419. HotFlag = 1;
  420. }
  421. else
  422. {
  423. HotFlag = 0;
  424. }
  425. if (chkAutoRefresh.Checked)
  426. {
  427. timer1.Enabled = true;
  428. }
  429. else
  430. {
  431. timer1.Enabled = false;
  432. }
  433. }
  434. /// <summary>
  435. /// 计划查询
  436. /// </summary>
  437. public void PlanQuery()
  438. {
  439. string PrimaKey = "";
  440. UltraGridRow ugr = this.ultraGridPlan.ActiveRow;
  441. if (ugr != null)
  442. {
  443. PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  444. }
  445. if (chkHeatNo.Checked == true)
  446. {
  447. if (string.IsNullOrEmpty(this.txtJudgeStoveNo.Text))
  448. {
  449. MessageBox.Show("请输入判定炉号后再执行查询操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  450. return;
  451. }
  452. QueryMainPlan.JudgeStoveNo = this.txtJudgeStoveNo.Text;
  453. }
  454. else
  455. {
  456. QueryMainPlan.JudgeStoveNo = "";
  457. }
  458. if (chkLotNo.Checked == true)
  459. {
  460. if (string.IsNullOrEmpty(this.txtLOT_NO.Text))
  461. {
  462. MessageBox.Show("请输入生产批号后再执行查询操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  463. return;
  464. }
  465. QueryMainPlan.LotNo = this.txtLOT_NO.Text;
  466. }
  467. else
  468. {
  469. QueryMainPlan.LotNo = "";
  470. }
  471. dtHotCheck.Clear();
  472. dtPlan.Clear();
  473. QueryMainPlan.PlineCode = PlineCod;
  474. QueryMainPlan.Status = PlanStatusQuery;
  475. QueryMainPlan.StartStatus = PlanStartStatusQuery;
  476. //查询计划记录
  477. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.getSingleMainPlan", new object[] { QueryMainPlan, 6, HotFlag }, this.ob);
  478. if (dt.Rows.Count == 0)
  479. {
  480. if (ShowMessageFlag == 0)
  481. {
  482. MessageBox.Show("未查询到匹配的数据,请重新查询!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  483. }
  484. return;
  485. }
  486. GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
  487. if (ugr != null)
  488. {
  489. foreach (UltraGridRow ugr1 in ultraGridPlan.Rows)
  490. {
  491. //ugr1.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString());
  492. if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey)
  493. {
  494. ugr1.Activated = true;
  495. }
  496. }
  497. }
  498. ChangeGridColor();
  499. }
  500. /// <summary>
  501. /// 查询结果Gird单击事件
  502. /// </summary>
  503. /// <param name="sender"></param>
  504. /// <param name="e"></param>
  505. private void ultraGridPlan_AfterRowActivate(object sender, EventArgs e)
  506. {
  507. dtMatSeq.Clear();
  508. dtHotCheck.Clear();
  509. if (this.dtPlan.Rows.Count > 0)
  510. {
  511. actugr = ultraGridPlan.ActiveRow;
  512. UltraGridRow ugr = ultraGridPlan.ActiveRow;
  513. if (ugr != null)
  514. {
  515. //查询主计划信息
  516. dtMatSeq.Clear();
  517. string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  518. ActiveJUDGE_STOVE_NO = JudgeStoveNo;
  519. ActiveResultNo = ugr.Cells["ID"].Value.ToString();
  520. proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
  521. gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
  522. MainPlan.JudgeStoveNo = JudgeStoveNo;
  523. MainPlan.ProPlanId = proPlanId;
  524. MainPlan.GxPlanNo = gxPlanNo;
  525. string Status = ugr.Cells["HOT_CHECK_FLAG"].Value.ToString();
  526. ActiveStatus = Status;
  527. string ColShift = "";
  528. string ColGroup = "";
  529. // PLineCode = ugr.Cells["Pline_Code"].Value.ToString();
  530. DataTable dtMP = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { MainPlan }, this.ob);
  531. if (dtMP.Rows.Count > 0)
  532. {
  533. PLineCode = dtMP.Rows[0]["PLINE_CODE"].ToString();
  534. GridEdit(dtMP); //轧制计划信息
  535. //查询流通卡信息
  536. DataTable dtRollingCard = new DataTable();
  537. if (PlineCod.Equals("C009") || PlineCod.Equals("C012") || PlineCod.Equals("C017"))
  538. {
  539. dtRollingCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  540. }
  541. else
  542. {
  543. dtRollingCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
  544. }
  545. if (dtRollingCard.Rows.Count > 0)
  546. {
  547. RollingCardEditGrid(dtRollingCard, JudgeStoveNo);
  548. }
  549. else
  550. {
  551. //清空流通卡值
  552. rollingCard1.Value.Clear();
  553. GridHelper.InitCardGrid(rollingCard1.RollCardDataSource1, rollingCard1.UltraGrid4);
  554. }
  555. //查询热取样实绩信息
  556. if (!chkStatusQuery.Checked)
  557. {
  558. ColShift = Shift;
  559. ColGroup = Group;
  560. }
  561. DataTable dtHotResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.CheckHotCheckDetail", new object[] { JudgeStoveNo, ActiveResultNo, ColShift, ColGroup }, this.ob);
  562. if (dtHotResult.Rows.Count > 0)
  563. {
  564. GridHelper.CopyDataToDatatable(ref dtHotResult, ref dtHotCheck, true);
  565. }
  566. else
  567. {
  568. }
  569. //查询主实绩区实绩
  570. DataTable dtMainResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.GetHotCheckMainResult", new object[] { JudgeStoveNo, ActiveResultNo }, this.ob);
  571. if (dtMainResult.Rows.Count > 0)
  572. {
  573. HotCheckMainResultEdit(dtMainResult);
  574. }
  575. else
  576. {
  577. }
  578. if (dtHotCheck.Rows.Count == 0)
  579. {
  580. AddHotCheckDetailInfo();
  581. }
  582. SetResultGray();
  583. ChangeGridColor();
  584. }
  585. }
  586. }
  587. }
  588. private void AddHotCheckDetailInfo()
  589. {
  590. DataRow newRow;
  591. DataRow newRow1;
  592. DataRow newRow2;
  593. newRow = dtHotCheck.NewRow();
  594. newRow1 = dtHotCheck.NewRow();
  595. newRow2 = dtHotCheck.NewRow();
  596. newRow["pipe_location"] = "管头";
  597. newRow1["pipe_location"] = "管体";
  598. newRow2["pipe_location"] = "管尾";
  599. dtHotCheck.Rows.Add(newRow);
  600. dtHotCheck.Rows.Add(newRow1);
  601. dtHotCheck.Rows.Add(newRow2);
  602. }
  603. /// <summary>
  604. /// 新增一组热取样详细数据
  605. /// </summary>
  606. private void ResultAdd()
  607. {
  608. if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
  609. {
  610. MessageBox.Show("炉号【" + actugr.Cells["JUDGE_NO"].Value.ToString() + "】已取样完成不能新增");
  611. return;
  612. }
  613. AddHotCheckDetailInfo();
  614. ShowMessageFlag = 1;
  615. ResultSave();
  616. ShowMessageFlag = 0;
  617. PlanQuery();
  618. }
  619. /// <summary>
  620. /// 删除最后一组热取样数据
  621. /// </summary>
  622. private void ResultDelete()
  623. {
  624. if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
  625. {
  626. MessageBox.Show("炉号【" + actugr.Cells["JUDGE_NO"].Value.ToString() + "】已取样完成不能删除");
  627. return;
  628. }
  629. if (dtHotCheck.Rows.Count > 3)
  630. {
  631. dtHotCheck.Rows.RemoveAt(dtHotCheck.Rows.Count - 1);
  632. dtHotCheck.Rows.RemoveAt(dtHotCheck.Rows.Count - 2);
  633. dtHotCheck.Rows.RemoveAt(dtHotCheck.Rows.Count - 3);
  634. }
  635. ShowMessageFlag = 1;
  636. ResultSave();
  637. ShowMessageFlag = 0;
  638. PlanQuery();
  639. }
  640. /// <summary>
  641. /// 保存
  642. /// </summary>
  643. public void ResultSave()
  644. {
  645. colHotCheck1.UltraGrid2.UpdateData();
  646. ultraGrid1.UpdateData();
  647. try
  648. {
  649. colHotCheck1.UltraGrid2.UpdateData();
  650. }
  651. catch (Exception e)
  652. {
  653. MessageBox.Show("请输入正确的时间。");
  654. return;
  655. }
  656. if (this.ultraGridPlan.ActiveRow == null)
  657. {
  658. return;
  659. }
  660. //保存主实绩信息
  661. MilHotCheckSave.Inspector = colHotCheck1.SizingDataSource1.Rows[0]["INSPECTOR"].ToString();
  662. MilHotCheckSave.DoubleB1 = colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B1"].ToString();
  663. MilHotCheckSave.DoubleB2 = colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B2"].ToString();
  664. MilHotCheckSave.DoubleB3 = colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B3"].ToString();
  665. MilHotCheckSave.DoubleB4 = colHotCheck1.SizingDataSource1.Rows[0]["DOUBLE_B4"].ToString();
  666. MilHotCheckSave.PassSeries1 = colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES1"].ToString();
  667. MilHotCheckSave.PassSeries2 = colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES2"].ToString();
  668. MilHotCheckSave.PassSeries3 = colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES3"].ToString();
  669. MilHotCheckSave.PassSeries4 = colHotCheck1.SizingDataSource1.Rows[0]["PASS_SERIES4"].ToString();
  670. MilHotCheckSave.StartTemp = colHotCheck1.SizingDataSource1.Rows[0]["START_TEMP"].ToString();
  671. MilHotCheckSave.EndTemp = colHotCheck1.SizingDataSource1.Rows[0]["END_TEMP"].ToString();
  672. MilHotCheckSave.Wallthick = colHotCheck1.SizingDataSource1.Rows[0]["WALLTHICK"].ToString();
  673. MilHotCheckSave.Outdiameter = colHotCheck1.SizingDataSource1.Rows[0]["OUTDIAMETER"].ToString();
  674. CutHead = colHotCheck1.SizingDataSource1.Rows[0]["CUT_HEAD"].ToString();
  675. CutOrder = colHotCheck1.SizingDataSource1.Rows[0]["CUT_ORDER"].ToString();
  676. CutTrail = colHotCheck1.SizingDataSource1.Rows[0]["CUT_TRAIL"].ToString();
  677. MilHotCheckSave.CheckDate = "sysdate";
  678. if (!string.IsNullOrEmpty(colHotCheck1.SizingDataSource1.Rows[0]["CHECK_DATE"].ToString()))
  679. {
  680. MilHotCheckSave.CheckDate = colHotCheck1.SizingDataSource1.Rows[0]["CHECK_DATE"].ToString();
  681. }
  682. MilHotCheckSave.Remark = colHotCheck1.SizingDataSource1.Rows[0]["REMARK"].ToString();
  683. MilHotCheckSave.ColGroup = UserInfo.GetUserGroup();
  684. MilHotCheckSave.ColShift = UserInfo.GetUserOrder();
  685. MilHotCheckSave.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
  686. MilHotCheckSave.PlineCode = PLineCode;
  687. MilHotCheckSave.ResultNo = ActiveResultNo;
  688. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmHotCheck.saveHotCheck", new object[] { MilHotCheckSave, CutHead, CutTrail, CutOrder }, this.ob);
  689. ArrayList ListEntity = new ArrayList();
  690. //保存抽检详细信息
  691. if (ultraGrid1.Rows.Count > 0)
  692. {
  693. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  694. {
  695. if (string.IsNullOrEmpty(ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString()))
  696. {
  697. MessageBox.Show("请选择管位置。");
  698. return;
  699. }
  700. MilHotCheckDetailEntity CheckDetailSave = new MilHotCheckDetailEntity();
  701. CheckDetailSave.JudgeStoveNo = ActiveJUDGE_STOVE_NO;
  702. CheckDetailSave.PassSeries = ultraGrid1.Rows[i].Cells["PASS_SERIES"].Value.ToString();
  703. CheckDetailSave.DoubleB = ultraGrid1.Rows[i].Cells["DOUBLE_B"].Value.ToString();
  704. CheckDetailSave.D1 = ultraGrid1.Rows[i].Cells["d1"].Value.ToString();
  705. CheckDetailSave.D2 = ultraGrid1.Rows[i].Cells["d2"].Value.ToString();
  706. CheckDetailSave.D3 = ultraGrid1.Rows[i].Cells["d3"].Value.ToString();
  707. CheckDetailSave.D4 = ultraGrid1.Rows[i].Cells["d4"].Value.ToString();
  708. CheckDetailSave.S1 = ultraGrid1.Rows[i].Cells["s1"].Value.ToString();
  709. CheckDetailSave.S2 = ultraGrid1.Rows[i].Cells["s2"].Value.ToString();
  710. CheckDetailSave.S3 = ultraGrid1.Rows[i].Cells["s3"].Value.ToString();
  711. CheckDetailSave.S4 = ultraGrid1.Rows[i].Cells["s4"].Value.ToString();
  712. CheckDetailSave.S5 = ultraGrid1.Rows[i].Cells["s5"].Value.ToString();
  713. CheckDetailSave.S6 = ultraGrid1.Rows[i].Cells["s6"].Value.ToString();
  714. CheckDetailSave.S7 = ultraGrid1.Rows[i].Cells["s7"].Value.ToString();
  715. CheckDetailSave.S8 = ultraGrid1.Rows[i].Cells["s8"].Value.ToString();
  716. CheckDetailSave.ColShift = Shift;
  717. CheckDetailSave.ColGroup = Group;
  718. CheckDetailSave.ColUser = _UserName;
  719. CheckDetailSave.ColTime = "sysdate";
  720. if (!string.IsNullOrEmpty(ultraGrid1.Rows[i].Cells["COL_TIME"].Value.ToString()))
  721. {
  722. CheckDetailSave.ColTime = ultraGrid1.Rows[i].Cells["COL_TIME"].Value.ToString();
  723. }
  724. string PipeLocation = "";
  725. if (ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString() == "1")
  726. {
  727. PipeLocation = "1";
  728. }
  729. else if (ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString() == "2")
  730. {
  731. PipeLocation = "2";
  732. }
  733. else if (ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString() == "0")
  734. {
  735. PipeLocation = "0";
  736. }
  737. else
  738. {
  739. switch (ultraGrid1.Rows[i].Cells["pipe_location"].Value.ToString())
  740. {
  741. case "管头":
  742. PipeLocation = "0";
  743. break;
  744. case "管体":
  745. PipeLocation = "1";
  746. break;
  747. case "管尾":
  748. PipeLocation = "2";
  749. break;
  750. }
  751. }
  752. CheckDetailSave.PipeLocation = PipeLocation;
  753. CheckDetailSave.ResultNo = ActiveResultNo;
  754. ListEntity.Add(CheckDetailSave);
  755. }
  756. }
  757. int count1 = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmHotCheck.saveHotCheckDetail", new object[] { ListEntity, ActiveJUDGE_STOVE_NO, ActiveResultNo,Shift,Group }, this.ob);
  758. if (ShowMessageFlag == 0)
  759. {
  760. MessageBox.Show("实绩保存成功");
  761. }
  762. CutHeadBefore = CutHead;
  763. CutOrderBefore = CutOrder;
  764. CutTrailBefore = CutTrail;
  765. ReFresh();
  766. }
  767. /// <summary>
  768. /// 取样判定完成
  769. /// </summary>
  770. private void Node()
  771. {
  772. ShowMessageFlag = 1;
  773. ResultSave();
  774. ShowMessageFlag = 0;
  775. if (ActiveJUDGE_STOVE_NO == null)
  776. {
  777. MessageBox.Show("请选择需要热取样炉计划");
  778. return;
  779. }
  780. if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
  781. {
  782. MessageBox.Show("炉号【" + actugr.Cells["JUDGE_NO"].Value.ToString() + "】已取样完成不能再次判定完成");
  783. return;
  784. }
  785. //查询是否存在该炉计划的取样实绩
  786. //DataTable dtHotResult = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.CheckHotCheckDetail", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo }, this.ob);
  787. if (ultraGrid1.Rows.Count < 3)
  788. {
  789. MessageBox.Show("热取样实绩未录入完整,请完善后判定完成。");
  790. return;
  791. }
  792. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmHotCheck.updateCheckFlag", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, "1" }, this.ob);
  793. MessageBox.Show("热取样完成");
  794. ReFresh();
  795. }
  796. /// <summary>
  797. /// 取样判定回退
  798. /// </summary>
  799. private void NodeBack()
  800. {
  801. if (ActiveJUDGE_STOVE_NO == null)
  802. {
  803. MessageBox.Show("请选择需要回退的热取样炉计划");
  804. return;
  805. }
  806. if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "未完成抽检")
  807. {
  808. MessageBox.Show("炉号【" + actugr.Cells["JUDGE_NO"].Value.ToString() + "】未取样完成不能回退");
  809. return;
  810. }
  811. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmHotCheck.updateCheckFlag", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo, "0" }, this.ob);
  812. MessageBox.Show("热取样回退成功");
  813. ReFresh();
  814. }
  815. /// <summary>
  816. /// 点击添加热取样实绩
  817. /// </summary>
  818. /// <param name="sender"></param>
  819. /// <param name="e"></param>
  820. private void ultraGrid1_AfterRowInsert(object sender, RowEventArgs e)
  821. {
  822. valueList.SelectedIndex = 0;
  823. }
  824. /// <summary>
  825. /// 置灰切头、切尾、定尺录入
  826. /// </summary>
  827. private void SetResultGray()
  828. {
  829. //查询分切是否已经开始切头操作
  830. //DataTable dtPlan = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.getSawCutIsStart", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo }, this.ob);
  831. //if (dtPlan.Rows.Count > 0)
  832. //{
  833. // if (!string.IsNullOrEmpty(dtPlan.Rows[0]["CUT_HEAD_LENGTH"].ToString()))
  834. // {
  835. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].CellActivation = Activation.NoEdit;
  836. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].CellActivation = Activation.NoEdit;
  837. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].CellActivation = Activation.NoEdit;
  838. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].Header.Appearance.BackColor = Color.Gray;
  839. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].Header.Appearance.BackColor = Color.Gray;
  840. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].Header.Appearance.BackColor = Color.Gray;
  841. // }
  842. // else
  843. // {
  844. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].CellActivation = Activation.AllowEdit;
  845. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].CellActivation = Activation.AllowEdit;
  846. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].CellActivation = Activation.NoEdit;
  847. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
  848. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
  849. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].Header.Appearance.BackColor = Color.Gray;
  850. // }
  851. //}
  852. //else
  853. //{
  854. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].CellActivation = Activation.AllowEdit;
  855. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].CellActivation = Activation.AllowEdit;
  856. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].CellActivation = Activation.AllowEdit;
  857. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_HEAD"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
  858. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_TRAIL"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
  859. // colHotCheck1.UltraGrid2.DisplayLayout.Bands[0].Columns["CUT_ORDER"].Header.Appearance.BackColor = Color.FromArgb(202, 222, 247);
  860. //}
  861. //已判定完成的炉次显示班次班组操作人
  862. if (actugr.Cells["HOT_CHECK_FLAG"].Value.ToString() == "已完成抽检")
  863. {
  864. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_SHIFT_D"].Hidden = false;
  865. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_GROUP_D"].Hidden = false;
  866. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_USER"].Hidden = false;
  867. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_INFO"].Hidden = false;
  868. }
  869. else
  870. {
  871. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_SHIFT_D"].Hidden = true;
  872. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_GROUP_D"].Hidden = true;
  873. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_USER"].Hidden = true;
  874. ultraGrid1.DisplayLayout.Bands[0].Columns["COL_INFO"].Hidden = true;
  875. }
  876. }
  877. #endregion
  878. #region 卡片赋值
  879. /// <summary>
  880. /// 轧制信息Grid赋值
  881. /// </summary>
  882. /// <param name="dt">轧制计划信息datatable</param>
  883. public void GridEdit(DataTable dt)
  884. {
  885. if (dt.Rows.Count > 0)
  886. {
  887. DataRow row1 = dt.Rows[0];
  888. //熔炼炉号
  889. this.rollingInfomation1.Value.StoveNo = row1["stove_no"].ToString();
  890. //炉号
  891. this.rollingInfomation1.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString());
  892. //生产批号
  893. this.rollingInfomation1.Value.LotNo = row1["lot_no"].ToString();
  894. //工序合同号
  895. this.rollingInfomation1.Value.ContractNo = row1["contract_no"].ToString();
  896. //执行工艺号
  897. this.rollingInfomation1.Value.ImpProcess = row1["imp_process"].ToString();
  898. //执行工艺号路径
  899. this.rollingInfomation1.Value.ImpProcessPath = row1["imp_process_path"].ToString();
  900. //产线代码
  901. this.rollingInfomation1.Value.PlineCode = row1["pline_code"].ToString();
  902. //状态
  903. this.rollingInfomation1.Value.Status = row1["STATUS"].ToString();
  904. //监制
  905. this.rollingInfomation1.Value.Producer = row1["producer"].ToString();
  906. //工艺状态
  907. this.rollingInfomation1.Value.ProcessStatus = row1["process_status"].ToString();
  908. //单倍长
  909. this.rollingInfomation1.Value.DbLength = row1["db_length"].ToString();
  910. //单倍重
  911. this.rollingInfomation1.Value.DbHeight = row1["db_height"].ToString();
  912. //轧制长度
  913. this.rollingInfomation1.Value.RollLength = row1["roll_length"].ToString();
  914. //分切数
  915. this.rollingInfomation1.Value.SawNum = row1["saw_num"].ToString();
  916. //目标长度
  917. this.rollingInfomation1.Value.TargetLength = row1["target_length"].ToString();
  918. //最终用户
  919. this.rollingInfomation1.Value.FinishUser = row1["finish_user"].ToString();
  920. //目标库
  921. this.rollingInfomation1.Value.TargetLiabrary = row1["target_liabrary"].ToString();
  922. //品种
  923. this.rollingInfomation1.Value.Varieties = row1["varieties"].ToString();
  924. //成品规格
  925. this.rollingInfomation1.Value.PipeSize = row1["pipe_size"].ToString();
  926. //扣型
  927. this.rollingInfomation1.Value.BuckleType = row1["buckle_type"].ToString();
  928. //长度范围
  929. this.rollingInfomation1.Value.LengthRange = row1["length_range"].ToString();
  930. //轧管判定标准
  931. this.rollingInfomation1.Value.RollStandrad = row1["roll_standrad"].ToString();
  932. //断面
  933. this.rollingInfomation1.Value.PipeSection = row1["pipe_section"].ToString();
  934. //钢种代码
  935. this.rollingInfomation1.Value.SteelCode = row1["steelcode"].ToString();
  936. //钢种名称
  937. this.rollingInfomation1.Value.SteelName = row1["steelname"].ToString();
  938. //钢级代码
  939. this.rollingInfomation1.Value.GradeCode = row1["gradecode"].ToString();
  940. //钢级名称
  941. this.rollingInfomation1.Value.GradeName = row1["gradename"].ToString();
  942. //炼钢判定标准
  943. this.rollingInfomation1.Value.SteelStandrad = row1["steel_standrad"].ToString();
  944. //去向
  945. this.rollingInfomation1.Value.Target = row1["target"].ToString();
  946. //支
  947. this.rollingInfomation1.Value.PlanNum = row1["BRANCH"].ToString();
  948. //吨
  949. this.rollingInfomation1.Value.PlanTon = row1["TON"].ToString();
  950. //切损去向
  951. this.rollingInfomation1.Value.CutTarget = row1["cut_target"].ToString();
  952. //切损长度
  953. this.rollingInfomation1.Value.CutLength = row1["cut_length"].ToString();
  954. //切损重量
  955. this.rollingInfomation1.Value.CutHeight = row1["CUT_WEIGHT"].ToString();
  956. //倍尺数
  957. this.rollingInfomation1.Value.DbNum = row1["DB_NUM"].ToString();
  958. //标准类别代码
  959. this.rollingInfomation1.Value.StdStyle = row1["STD_STYLE"].ToString();
  960. //标准类别描述
  961. this.rollingInfomation1.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString();
  962. //成品备注
  963. this.rollingInfomation1.Value.ReMark = row1["ReMark"].ToString();
  964. this.rollingInfomation1.UpdateData();
  965. }
  966. }
  967. /// <summary>
  968. /// 流通卡赋值
  969. /// </summary>
  970. /// <param name="dt"></param>
  971. public void RollingCardEditGrid(DataTable dt, string heatno)
  972. {
  973. if (dt.Rows.Count > 0)
  974. {
  975. //上料切前剔除支数
  976. this.rollingCard1.Value.FeedScrapNum = dt.Rows[0]["SCRAP_FEED"].ToString();
  977. //上料切前合格支数
  978. this.rollingCard1.Value.FeedQualifiedNum = dt.Rows[0]["QUALIFIED_FEED"].ToString();
  979. //上料剔除支数
  980. this.rollingCard1.Value.FeedScrapDBNum = dt.Rows[0]["SCRAP_DBFEED"].ToString();
  981. //上料合格支数
  982. this.rollingCard1.Value.FeedQualifiedDBNum = dt.Rows[0]["QUALIFIED_DBFEED"].ToString();
  983. //加热炉剔除支数
  984. this.rollingCard1.Value.FurScrapNum = dt.Rows[0]["SCRAP_FUR"].ToString();
  985. //加热炉合格支数
  986. this.rollingCard1.Value.FurQualifiedNum = dt.Rows[0]["QUALIFIED_FUR"].ToString();
  987. //穿孔剔除支数
  988. this.rollingCard1.Value.PerScrapNum = dt.Rows[0]["SCRAP_PER"].ToString();
  989. //穿孔合格支数
  990. this.rollingCard1.Value.PerQualifiedNum = dt.Rows[0]["QUALIFIED_PER"].ToString();
  991. //连轧剔除支数
  992. this.rollingCard1.Value.RollingScrapNum = dt.Rows[0]["SCRAP_ROLLING"].ToString();
  993. //连轧合格支数
  994. this.rollingCard1.Value.RollingQualifiedNum = dt.Rows[0]["QUALIFIED_ROLLING"].ToString();
  995. //再加热炉剔除支数
  996. this.rollingCard1.Value.RefurScrapNum = dt.Rows[0]["SCRAP_REFUR"].ToString();
  997. //再加热炉合格支数
  998. this.rollingCard1.Value.RefurQualifiedNum = dt.Rows[0]["QUALIFIED_REFUR"].ToString();
  999. //定径剔除支数
  1000. this.rollingCard1.Value.SizingScrapNum = dt.Rows[0]["SCRAP_SIZING"].ToString();
  1001. //定径合格支数
  1002. this.rollingCard1.Value.SizingQualifiedNum = dt.Rows[0]["QUALIFIED_SIZING"].ToString();
  1003. //分切前剔除支数
  1004. this.rollingCard1.Value.SawScrapNumBE = dt.Rows[0]["SCRAP_SAW_BE"].ToString();
  1005. //分切前合格支数
  1006. this.rollingCard1.Value.SawQualifiedNumBE = dt.Rows[0]["QUALIFIED_SAW_BE"].ToString();
  1007. //分切剔除支数
  1008. this.rollingCard1.Value.SawScrapNum = dt.Rows[0]["SCRAP_SAW"].ToString();
  1009. //分切合格支数
  1010. this.rollingCard1.Value.SawQualifiedNum = dt.Rows[0]["QUALIFIED_SAW"].ToString();
  1011. //矫直剔除支数
  1012. this.rollingCard1.Value.StraightScrapNum = dt.Rows[0]["SCRAP_STRAIGHT"].ToString();
  1013. //矫直合格支数
  1014. this.rollingCard1.Value.StraightQualifiedNum = dt.Rows[0]["QUALIFIED_STRAIGHT"].ToString();
  1015. //矫直下线支数
  1016. this.rollingCard1.Value.OfflineStraight = dt.Rows[0]["OFFLINE_STRAIGHT"].ToString();
  1017. //探伤剔除支数
  1018. this.rollingCard1.Value.TestingScrapNum = dt.Rows[0]["SCRAP_TESTING"].ToString();
  1019. //探伤合格支数
  1020. this.rollingCard1.Value.TestingQualifiedNum = dt.Rows[0]["QUALIFIED_TESTING"].ToString();
  1021. NativeMethodNew na = new NativeMethodNew(this.ob);
  1022. if (na.isBegineNode(heatno, 8) || na.isBegineNode(heatno, 9) || na.isBegineNode(heatno, 10))
  1023. {
  1024. //探伤下线支数
  1025. this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
  1026. }
  1027. else
  1028. {
  1029. if (dt.Rows[0]["OFFLINE_TESTING"].ToString() == "0")
  1030. {
  1031. this.rollingCard1.Value.OfflineTesting = "";
  1032. }
  1033. else
  1034. {
  1035. //探伤下线支数
  1036. this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
  1037. }
  1038. }
  1039. //表检合格支数
  1040. this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
  1041. //表检废品支数
  1042. this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString();
  1043. //表检下线支数
  1044. this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
  1045. //表检返线支数
  1046. //this.rollingCard1.Value.SurfaceBackLineNum= dt.Rows[0]["OFFLINE_TESTING"].ToString();
  1047. this.rollingCard1.UpdateData();
  1048. }
  1049. else
  1050. {
  1051. this.rollingCard1.ClearData();
  1052. }
  1053. }
  1054. /// <summary>
  1055. /// 热取样实绩赋值
  1056. /// </summary>
  1057. public void HotCheckMainResultEdit(DataTable dt)
  1058. {
  1059. if (dt.Rows.Count > 0)
  1060. {
  1061. DataRow row1 = dt.Rows[0];
  1062. //抽检人
  1063. this.colHotCheck1.Value.Inspector = row1["INSPECTOR"].ToString();
  1064. //孔型系列1
  1065. this.colHotCheck1.Value.PassSeries1 = row1["PASS_SERIES1"].ToString();
  1066. //孔型系列2
  1067. this.colHotCheck1.Value.PassSeries2 = row1["PASS_SERIES2"].ToString();
  1068. //孔型系列3
  1069. this.colHotCheck1.Value.PassSeries3 = row1["PASS_SERIES3"].ToString();
  1070. //孔型系列4
  1071. this.colHotCheck1.Value.PassSeries4 = row1["PASS_SERIES4"].ToString();
  1072. //2B值1
  1073. this.colHotCheck1.Value.DoubleB1 = row1["DOUBLE_B1"].ToString();
  1074. //2B值2
  1075. this.colHotCheck1.Value.DoubleB2 = row1["DOUBLE_B2"].ToString();
  1076. //2B值3
  1077. this.colHotCheck1.Value.DoubleB3 = row1["DOUBLE_B3"].ToString();
  1078. //2B值4
  1079. this.colHotCheck1.Value.DoubleB4 = row1["DOUBLE_B4"].ToString();
  1080. //开轧温度
  1081. this.colHotCheck1.Value.StartTemp = row1["START_TEMP"].ToString();
  1082. //终轧温度
  1083. this.colHotCheck1.Value.EndTemp = row1["END_TEMP"].ToString();
  1084. //外径
  1085. this.colHotCheck1.Value.Outdiameter = row1["OUTDIAMETER"].ToString();
  1086. //壁厚
  1087. this.colHotCheck1.Value.Wallthick = row1["WALLTHICK"].ToString();
  1088. //抽检时间
  1089. this.colHotCheck1.Value.CheckDate = row1["CHECK_DATE"].ToString();
  1090. //计划切头长度
  1091. this.colHotCheck1.Value.CutHeadP = row1["CUT_HEAD_LENGTHP"].ToString();
  1092. //计划切尾长度
  1093. this.colHotCheck1.Value.CutTrailP = row1["CUT_TRAIL_LENGTHP"].ToString();
  1094. //计划切定尺长度
  1095. this.colHotCheck1.Value.CutOrderP = row1["TARGET_LENGTH"].ToString();
  1096. DataTable dtPlan = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.getSingleMainPlanNodeStatus", new object[] { ActiveJUDGE_STOVE_NO, ActiveResultNo }, this.ob);
  1097. if (dtPlan.Rows.Count > 0)
  1098. {
  1099. if (int.Parse(dtPlan.Rows[0]["NODE_STATUS"].ToString()) < 61)
  1100. {
  1101. //切头长度
  1102. if (!string.IsNullOrEmpty(row1["CUT_HEAD_LENGTHA"].ToString()))
  1103. {
  1104. this.colHotCheck1.Value.CutHead = row1["CUT_HEAD_LENGTHA"].ToString();
  1105. }
  1106. else
  1107. {
  1108. this.colHotCheck1.Value.CutHead = CutHeadBefore;
  1109. }
  1110. //切尾长度
  1111. if (!string.IsNullOrEmpty(row1["CUT_TRAIL_LENGTHA"].ToString()))
  1112. {
  1113. this.colHotCheck1.Value.CutTrail = row1["CUT_TRAIL_LENGTHA"].ToString();
  1114. }
  1115. else
  1116. {
  1117. this.colHotCheck1.Value.CutTrail = CutTrailBefore;
  1118. }
  1119. //切定尺长度
  1120. if (!string.IsNullOrEmpty(row1["ORDER_LENGTHA"].ToString()))
  1121. {
  1122. this.colHotCheck1.Value.CutOrder = row1["ORDER_LENGTHA"].ToString();
  1123. }
  1124. else
  1125. {
  1126. this.colHotCheck1.Value.CutOrder = CutOrderBefore;
  1127. }
  1128. }
  1129. else
  1130. {
  1131. this.colHotCheck1.Value.CutHead = row1["CUT_HEAD_LENGTHA"].ToString();
  1132. this.colHotCheck1.Value.CutTrail = row1["CUT_TRAIL_LENGTHA"].ToString();
  1133. this.colHotCheck1.Value.CutOrder = row1["ORDER_LENGTHA"].ToString();
  1134. }
  1135. }
  1136. //抽检员
  1137. string Inspector = "";
  1138. if (!string.IsNullOrEmpty(row1["INSPECTOR"].ToString()))
  1139. {
  1140. Inspector = row1["INSPECTOR"].ToString();
  1141. }
  1142. else
  1143. {
  1144. Inspector = _UserName;
  1145. }
  1146. this.colHotCheck1.Value.Inspector = Inspector;
  1147. //备注
  1148. this.colHotCheck1.Value.Remark = row1["REMARK"].ToString();
  1149. this.colHotCheck1.UpdateDate();
  1150. }
  1151. }
  1152. #endregion
  1153. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  1154. {
  1155. if (e.Cell.Column.Key == "pipe_location")
  1156. {
  1157. //e.Cell.Row.Index
  1158. ultraGrid1.UpdateData();
  1159. IQueryable<UltraGridRow> urows = ultraGrid1.Rows.AsQueryable().Where(a => !a.Equals(e.Cell.Row));
  1160. foreach (UltraGridRow ugr in urows)
  1161. {
  1162. if (ugr.Cells["pipe_location"].Text.ToString() == e.Cell.Text.ToString())
  1163. {
  1164. string PipeLocation = e.Cell.Value.ToString();
  1165. switch (e.Cell.Value.ToString())
  1166. {
  1167. case "0":
  1168. PipeLocation = "管头";
  1169. break;
  1170. case "1":
  1171. PipeLocation = "管体";
  1172. break;
  1173. case "2":
  1174. PipeLocation = "管尾";
  1175. break;
  1176. }
  1177. MessageBox.Show("管位置【" + PipeLocation + "】已添加不能重复添加。");
  1178. dtHotCheck.Rows.RemoveAt(e.Cell.Row.Index);
  1179. return;
  1180. }
  1181. }
  1182. }
  1183. }
  1184. /// <summary>
  1185. /// 打印报表
  1186. /// </summary>
  1187. private void PrintResult()
  1188. {
  1189. Group = UserInfo.GetUserGroup();
  1190. Shift = UserInfo.GetUserOrder();
  1191. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  1192. string Time = SeverTime.ToLongTimeString();
  1193. string StartTime = ""; // 开始时间 用于报表查询
  1194. string EndTime = ""; // 结束时间 用于报表查询
  1195. string strurl = "";
  1196. //晚班
  1197. Time = Time.Replace(":", "");
  1198. if (Shift == "3")
  1199. {
  1200. //查询晚班前一天20点40后到当天07点20前所有记录
  1201. if (int.Parse(Time) < 072000)
  1202. {
  1203. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
  1204. EndTime = SeverTime.ToShortDateString() + " 07:20:00";
  1205. //string Date2 = SeverTime.ToString("yyyy-MM-dd");
  1206. }
  1207. //查询当天晚班的所有数据
  1208. else if (int.Parse(Time) > 204000)
  1209. {
  1210. StartTime = SeverTime.ToShortDateString() + " 20:40:00";
  1211. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
  1212. }
  1213. }
  1214. //白班 中班
  1215. else
  1216. {
  1217. StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  1218. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  1219. }
  1220. switch (PLineCode)
  1221. {
  1222. case "C008": //250
  1223. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSamplingQuality250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PLineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1224. break;
  1225. case "C009": //258
  1226. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSamplingQuality258.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PLineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1227. break;
  1228. case "C010": //168
  1229. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSamplingQuality168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PLineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1230. break;
  1231. case "C012": //Arssel
  1232. break;
  1233. case "C017": //460
  1234. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSamplingQuality460.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PLineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
  1235. break;
  1236. }
  1237. FrmRepExcel fre = new FrmRepExcel(ob, strurl);
  1238. fre.AutoSize = true;
  1239. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  1240. fre.WindowState = FormWindowState.Maximized;
  1241. fre.Show();
  1242. }
  1243. /// <summary>
  1244. /// 查询上个班原始记录
  1245. /// </summary>
  1246. private void QueryBefore()
  1247. {
  1248. HOTMethod hm = new HOTMethod(this.ob);
  1249. DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
  1250. string Time = SeverTime.ToLongTimeString();
  1251. string Date = "";
  1252. if (Shift == "3")
  1253. {
  1254. Time = Time.Replace(":", "");
  1255. if (int.Parse(Time) < 122000)
  1256. {
  1257. Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
  1258. }
  1259. else
  1260. {
  1261. Date = SeverTime.ToString("yyyyMMdd");
  1262. }
  1263. }
  1264. if (Shift == "1" || Shift == "0")
  1265. {
  1266. Date = SeverTime.AddDays(-1).ToString("yyyyMMdd");
  1267. }
  1268. else
  1269. {
  1270. Date = SeverTime.ToString("yyyyMMdd");
  1271. }
  1272. string StartTime = ""; // 开始时间 用于报表查询
  1273. string EndTime = ""; // 结束时间 用于报表查询
  1274. string StartTimeU = ""; // 开始时间 用于得到上班UserID
  1275. string EndTimeU = ""; // 结束时间 用于得到上班UserID
  1276. string strurl = "";
  1277. string ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date, PLineCode);
  1278. //if (PlineCode.Equals("C072"))
  1279. //{
  1280. // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date);
  1281. //}
  1282. //else
  1283. //{
  1284. // ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group);
  1285. //}
  1286. string UserIDBefore = "";
  1287. //晚班
  1288. Time = Time.Replace(":", "");
  1289. if (Shift == "3")
  1290. {
  1291. //查询晚班前一天中班所有记录
  1292. if (int.Parse(Time) < 122000)
  1293. {
  1294. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
  1295. EndTime = SeverTime.ToShortDateString() + " 00:00:00";
  1296. //string Date2 = SeverTime.ToString("yyyy-MM-dd");
  1297. StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
  1298. EndTimeU = SeverTime.ToShortDateString() + " 00:00:00";
  1299. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 10, PLineCode);
  1300. //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;
  1301. }
  1302. //查询当天中班的所有数据
  1303. else if (int.Parse(Time) > 204000)
  1304. {
  1305. StartTime = SeverTime.ToShortDateString() + " 13:40:00";
  1306. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  1307. StartTimeU = SeverTime.ToShortDateString() + " 13:40:00";
  1308. EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  1309. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 10, PLineCode);
  1310. //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;
  1311. }
  1312. }
  1313. //白班
  1314. else if (Shift == "1")
  1315. {
  1316. StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
  1317. EndTime = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
  1318. StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 12:00:00";
  1319. EndTimeU = SeverTime.AddDays(0).ToShortDateString() + " 12:00:00";
  1320. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 10, PLineCode);
  1321. }
  1322. //中班
  1323. else
  1324. {
  1325. StartTime = SeverTime.ToShortDateString() + " 00:00:00";
  1326. EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  1327. StartTimeU = SeverTime.ToShortDateString() + " 00:00:00";
  1328. EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
  1329. UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 10, PLineCode);
  1330. //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;
  1331. }
  1332. switch (PLineCode)
  1333. {
  1334. case "C008": //250
  1335. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSamplingQuality250.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PLineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  1336. break;
  1337. case "C009": //258
  1338. //晚班
  1339. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSamplingQuality258.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PLineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  1340. break;
  1341. case "C010": //168
  1342. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSamplingQuality168.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PLineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  1343. break;
  1344. case "C012": //Arssel
  1345. break;
  1346. case "C017": //460
  1347. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSamplingQuality460.cpt&format=pdf&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PLineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
  1348. break;
  1349. }
  1350. FrmRepExcel fre = new FrmRepExcel(ob, strurl);
  1351. fre.AutoSize = true;
  1352. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  1353. fre.WindowState = FormWindowState.Maximized;
  1354. fre.Show();
  1355. }
  1356. private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)
  1357. {
  1358. if (e.KeyChar == (char)13)
  1359. {
  1360. }
  1361. }
  1362. private void ultraGrid1_KeyDown(object sender, KeyEventArgs e)
  1363. {
  1364. // if (e.Control & e.KeyCode == Keys.C)
  1365. // {
  1366. // //HotCheckCopyEntity.PipeLocation = ultraGrid1.ActiveRow.Cells["pipe_location"].Text.ToString();
  1367. // HotCheckCopyEntity.D1 = ultraGrid1.ActiveRow.Cells["d1"].Value.ToString();
  1368. // HotCheckCopyEntity.D2 = ultraGrid1.ActiveRow.Cells["d2"].Value.ToString();
  1369. // HotCheckCopyEntity.D3 = ultraGrid1.ActiveRow.Cells["d3"].Value.ToString();
  1370. // HotCheckCopyEntity.D4 = ultraGrid1.ActiveRow.Cells["d4"].Value.ToString();
  1371. // HotCheckCopyEntity.S1 = ultraGrid1.ActiveRow.Cells["s1"].Value.ToString();
  1372. // HotCheckCopyEntity.S2 = ultraGrid1.ActiveRow.Cells["s2"].Value.ToString();
  1373. // HotCheckCopyEntity.S3 = ultraGrid1.ActiveRow.Cells["s3"].Value.ToString();
  1374. // HotCheckCopyEntity.S4 = ultraGrid1.ActiveRow.Cells["s4"].Value.ToString();
  1375. // HotCheckCopyEntity.S5 = ultraGrid1.ActiveRow.Cells["s5"].Value.ToString();
  1376. // HotCheckCopyEntity.S6 = ultraGrid1.ActiveRow.Cells["s6"].Value.ToString();
  1377. // HotCheckCopyEntity.S7 = ultraGrid1.ActiveRow.Cells["s7"].Value.ToString();
  1378. // HotCheckCopyEntity.S8 = ultraGrid1.ActiveRow.Cells["s8"].Value.ToString();
  1379. // CopyFlag = 1;
  1380. // MessageBox.Show("复制成功!");
  1381. // }
  1382. // if (e.Control & e.KeyCode == Keys.V)
  1383. // {
  1384. // if (CopyFlag == 1)
  1385. // {
  1386. // int index = ultraGrid1.ActiveRow.Index;
  1387. // //dtHotCheck.Rows[index]["pipe_location"] = HotCheckCopyEntity.PipeLocation;
  1388. // dtHotCheck.Rows[index]["s1"] = HotCheckCopyEntity.S1;
  1389. // dtHotCheck.Rows[index]["s2"] = HotCheckCopyEntity.S2;
  1390. // dtHotCheck.Rows[index]["s3"] = HotCheckCopyEntity.S3;
  1391. // dtHotCheck.Rows[index]["s4"] = HotCheckCopyEntity.S4;
  1392. // dtHotCheck.Rows[index]["s5"] = HotCheckCopyEntity.S5;
  1393. // dtHotCheck.Rows[index]["s6"] = HotCheckCopyEntity.S6;
  1394. // dtHotCheck.Rows[index]["s7"] = HotCheckCopyEntity.S7;
  1395. // dtHotCheck.Rows[index]["s8"] = HotCheckCopyEntity.S8;
  1396. // dtHotCheck.Rows[index]["d1"] = HotCheckCopyEntity.D1;
  1397. // dtHotCheck.Rows[index]["d2"] = HotCheckCopyEntity.D2;
  1398. // dtHotCheck.Rows[index]["d3"] = HotCheckCopyEntity.D3;
  1399. // dtHotCheck.Rows[index]["d4"] = HotCheckCopyEntity.D4;
  1400. // //CopyFlag = 0;
  1401. // }
  1402. // }
  1403. }
  1404. }
  1405. }