FrmStlControlLog.cs 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064
  1. using com.steering.mes.zgmil.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Format;
  4. using Core.Mes.Client.Comm.Server;
  5. using Core.Mes.Client.Comm.Tool;
  6. using Core.StlMes.Client.ZGMil.Entity;
  7. using CoreFS.CA06;
  8. using Infragistics.Win;
  9. using Infragistics.Win.UltraWinEditors;
  10. using Infragistics.Win.UltraWinGrid;
  11. using System;
  12. using System.Collections;
  13. using System.Collections.Generic;
  14. using System.ComponentModel;
  15. using System.Data;
  16. using System.Drawing;
  17. using System.Globalization;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Windows.Forms;
  21. namespace Core.StlMes.Client.ZGMil.Signature
  22. {
  23. public partial class FrmStlControlLog : FrmBase
  24. {
  25. private string departm = "";
  26. UltraComboEditor ucePline = new UltraComboEditor();//产线名称
  27. private string plineCode;
  28. private string plineName;
  29. private string userId = "";
  30. //int stratday;//开始时间日期差,天,时,分
  31. //int strathours;
  32. //int stratminutes;
  33. //int endday;//结束时间日期差,天,时,分
  34. //int endhours;
  35. //int endminutes;toolba
  36. int flag = 0;//分析时间错误
  37. int flag1 = 0;//分析相差时间
  38. private string basecodeSamll = "";//停机小类值
  39. private string basecodeReason = "";//停机原因值
  40. public FrmStlControlLog()
  41. {
  42. InitializeComponent();
  43. }
  44. private void FrmMilControlLog_Load(object sender, EventArgs e)
  45. {
  46. EntityHelper.ShowGridCaption<StlControlLogEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  47. EntityHelper.ShowGridCaption<StlControlLogEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  48. NativeMethodNew na = new NativeMethodNew(this.ob);
  49. departm = UserInfo.GetDepartment();
  50. userId = UserInfo.GetUserID();
  51. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  52. ultraGrid2.DisplayLayout.Bands[0].Columns["Sjc"].Header.Caption = "停机时长(分钟)";
  53. DataTable ds = ServerHelper.GetData("com.steering.mes.signature.FrmStlControlLog.doQueryPlineName", new object[] { plineCode }, ob);
  54. if (ds.Rows.Count > 0)
  55. {
  56. plineName = ds.Rows[0]["PLINE_NAME"].ToString();
  57. }
  58. if (plineCode.Equals(""))
  59. {
  60. this.chkpline.Visible = true;
  61. this.cmbPline.Visible = true;
  62. }
  63. //cmbDate.MaxDate = DateTime.Now;
  64. cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(-1);
  65. cmbDate2.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
  66. cmbPline.Value = na.GetPCodePline(this.ValidDataPurviewIds);
  67. TubeRoll.setUltraGridColumnInput(ultraGrid1, new string[] { "mouldbalewgt" });//出钢量
  68. //TubeRoll.setUltraGridColumnMaxInput(ultraGrid1, new string[] { "QualifiedWt", "ScrapWt" });//重量
  69. TubeRoll.SetComboItemHeight(cmbPline);
  70. TubeRoll.SetComboItemHeight(cmbBc);
  71. TubeRoll.SetComboItemHeight(cmbBz);
  72. DataTable dt = TubeRoll.GetComBaseInfo("3001", ob);
  73. cmbStop.DataSource = dt;
  74. cmbStop.ValueMember = "BASECODE";
  75. cmbStop.DisplayMember = "BASENAME";
  76. TubeRoll.SetComboItemHeight(cmbStop);
  77. }
  78. /// <summary>
  79. /// 重写基类方法
  80. /// </summary>
  81. /// <param name="sender"></param>
  82. /// <param name="ToolbarKey"></param>
  83. public override void ToolBar_Click(object sender, string ToolbarKey)
  84. {
  85. switch (ToolbarKey)
  86. {
  87. case "Query":
  88. doQuery();
  89. doAnalysis();
  90. break;
  91. case "Add":
  92. doAdd();
  93. break;
  94. case "Update":
  95. doUpdate();
  96. break;
  97. case "Delete":
  98. doDelete();
  99. break;
  100. case "Delete2":
  101. doDelete2();
  102. break;
  103. case "Analysis":
  104. doQuery();
  105. doAnalysis();
  106. break;
  107. case "Confirm":
  108. doConfirm();
  109. break;
  110. case "UpConfirm":
  111. UpConfirm();
  112. break;
  113. //case "OneKeyProces":
  114. // DoOneKeyProces();
  115. // break;
  116. case "Statistical":
  117. DoStatistical();
  118. break;
  119. case "OneKeyUpdate":
  120. DoOneKeyUpdate();
  121. break;
  122. case "Production":
  123. DoProduction();
  124. break;
  125. case "Export":
  126. GridHelper.ulGridToExcel(ultraGrid1, "炼钢调度日志");
  127. break;
  128. case "Close":
  129. this.Close();
  130. break;
  131. }
  132. }
  133. /// <summary>
  134. /// 生产记录
  135. /// </summary>
  136. private void DoProduction()
  137. {
  138. FrmProductionDetailsLG pro = new FrmProductionDetailsLG(cmbDate.Value.ToString("yyyyMMdd"), plineCode, this.ob);
  139. pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  140. pro.Text = "生产详细";
  141. pro.ShowDialog();
  142. }
  143. /// <summary>
  144. /// 查询统计数据
  145. /// </summary>
  146. private void DoStatistical()
  147. {
  148. UltraGridRow row = ultraGrid1.ActiveRow;
  149. if (row == null) { MessageUtil.ShowTips("无数据!"); return; }
  150. //foreach (UltraGridRow urg in ultraGrid1.Rows)
  151. //{
  152. // if (row.Cells["ConfirmFlag"].Text.Equals("未确认")) { MessageUtil.ShowTips("未确认,不允许此操作!"); return; }
  153. //}
  154. FrmStatistical fsta = new FrmStatistical(plineCode, ob);
  155. fsta.AutoSize = true;
  156. fsta.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  157. fsta.Text = "统计查询";
  158. fsta.ShowDialog();
  159. }
  160. /// <summary>
  161. /// 查询
  162. /// </summary>
  163. private void doQuery()
  164. {
  165. ArrayList list = new ArrayList();
  166. //当天
  167. string date = "";
  168. //前一天
  169. string endDate = "";
  170. date = cmbDate.Value.ToString("yyyyMMdd");
  171. endDate = cmbDate2.Value.ToString("yyyyMMdd");
  172. if (this.chkpline.Checked)
  173. {
  174. plineCode = this.cmbPline.Value.ToString();
  175. }
  176. else
  177. {
  178. NativeMethodNew na = new NativeMethodNew(this.ob);
  179. plineCode = na.GetPCode(departm);
  180. }
  181. //当班数据
  182. List<StlControlLogEntity> listSource = EntityHelper.GetData<StlControlLogEntity>
  183. ("com.steering.mes.signature.FrmStlControlLog.doQueryPlan", new object[] { date, endDate, this.UserInfo.GetUserOrder(), this.UserInfo.GetUserGroup(), plineCode, "" }, this.ob);
  184. StlControlLogEntity.DataSource = listSource;
  185. GridHelper.RefreshAndAutoSize(ultraGrid1);
  186. this.ultraGrid1.DisplayLayout.Bands[0].Columns["LogsBeg"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTimeWithSpin;
  187. this.ultraGrid1.DisplayLayout.Bands[0].Columns["LogsBeg"].MaskInput = "yyyy-mm-dd hh:mm";
  188. this.ultraGrid1.DisplayLayout.Bands[0].Columns["LogsEnd"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTimeWithSpin;
  189. this.ultraGrid1.DisplayLayout.Bands[0].Columns["LogsEnd"].MaskInput = "yyyy-mm-dd hh:mm";
  190. }
  191. /// <summary>
  192. /// 一键处理新增(分析后五分钟以内的时间间隔)
  193. /// </summary>
  194. //private void DoOneKeyProces()
  195. //{
  196. // ultraGrid1.UpdateData();
  197. // UltraGridRow row = ultraGrid1.ActiveRow;
  198. // if (row == null) { MessageUtil.ShowTips("无数据,不允许此操作!"); return; }
  199. // int minutes = int.Parse(MinTime.Value.ToString());
  200. // if (minutes == 0) { MessageUtil.ShowTips("请输入相差时间!"); }
  201. // ArrayList pram = new ArrayList();
  202. // if (flag == 0) { MessageUtil.ShowTips("未分析,不允许此操作!"); return; }
  203. // if (flag == 1 && flag1 == 0) { MessageUtil.ShowTips("分析通过,不允许此操作!"); return; }
  204. // if (flag == 2) { MessageUtil.ShowTips("分析时间错误,不允许此操作!"); return; }
  205. // int i = 0;
  206. // try
  207. // {
  208. // foreach (UltraGridRow ugr in ultraGrid1.Rows)
  209. // {
  210. // //if (ugr.Cells["ConfirmFlag"].Text.Equals("已确认"))
  211. // //{
  212. // // MessageUtil.ShowTips("已确认数据,不允许此操作!");
  213. // // return;
  214. // //}
  215. // if (!ugr.Cells["LogsEnd"].Value.Equals(""))
  216. // {
  217. // i += 1;
  218. // }
  219. // }
  220. // for (int j = 0; j < i; j++)
  221. // {
  222. // string loagEnd = ultraGrid1.Rows[j].Cells["LogsEnd"].Text.ToString();
  223. // string loagBeg = "";
  224. // if (j + 1 < i)
  225. // {
  226. // loagBeg = ultraGrid1.Rows[j + 1].Cells["LogsBeg"].Text.ToString();
  227. // if (DateTime.Compare(Convert.ToDateTime(loagBeg), Convert.ToDateTime(loagEnd)) > 0)
  228. // {
  229. // if (TubeRoll.JudgeTimeMax(Convert.ToDateTime(loagEnd), Convert.ToDateTime(loagBeg)) <= minutes
  230. // && TubeRoll.JudgeTimeMax(Convert.ToDateTime(loagEnd), Convert.ToDateTime(loagBeg)) > 0)
  231. // {
  232. // ArrayList list = new ArrayList();
  233. // list.Add(DateTime.Parse(ultraGrid1.Rows[j].Cells["LogsEnd"].Value.ToString()).ToString("yyyyMMddHHmm"));
  234. // list.Add(DateTime.Parse(ultraGrid1.Rows[j + 1].Cells["LogsBeg"].Value.ToString()).ToString("yyyyMMddHHmm"));
  235. // list.Add(this.UserInfo.GetUserName());
  236. // list.Add(this.UserInfo.GetUserOrder());
  237. // list.Add(this.UserInfo.GetUserGroup());
  238. // list.Add(plineCode);
  239. // list.Add(plineName);
  240. // pram.Add(list);
  241. // }
  242. // }
  243. // }
  244. // }
  245. // if (MessageUtil.ShowYesNoAndQuestion("是否一键新增处理?") == DialogResult.No)
  246. // {
  247. // return;
  248. // }
  249. // CoreClientParam ccp = new CoreClientParam();
  250. // ccp.ServerName = "com.steering.mes.signature.FrmStlControlLog";
  251. // ccp.MethodName = "oneKeyProcesMilControlLog";
  252. // ccp.ServerParams = new object[] { pram };
  253. // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  254. // if (ccp.ReturnCode != -1)
  255. // {
  256. // MessageUtil.ShowTips(ccp.ReturnInfo);
  257. // if (ccp.ReturnInfo.Equals("一键处理成功!"))
  258. // {
  259. // doQuery();
  260. // doAnalysis();
  261. // }
  262. // }
  263. // }
  264. // catch (Exception ex)
  265. // {
  266. // MessageUtil.ShowTips("开始时间或结束时间不能为空!");
  267. // }
  268. //}
  269. /// <summary>
  270. /// 一键修改
  271. /// </summary>
  272. private void DoOneKeyUpdate()
  273. {
  274. ultraGrid1.UpdateData();
  275. UltraGridRow row = ultraGrid1.ActiveRow;
  276. if (row == null) { MessageUtil.ShowTips("无数据,不允许此操作!"); return; }
  277. ArrayList pram = new ArrayList();
  278. if (flag == 0) { MessageUtil.ShowTips("未分析,不允许此操作!"); return; }
  279. if (flag == 1 && flag1 == 0) { MessageUtil.ShowTips("分析通过,不允许此操作!"); return; }
  280. //if (flag == 2) { MessageUtil.ShowTips("分析时间错误,不允许此操作!"); return; }
  281. int i = 0;
  282. try
  283. {
  284. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  285. {
  286. //if (ugr.Cells["ConfirmFlag"].Text.Equals("已确认"))
  287. //{
  288. // MessageUtil.ShowTips("已确认数据,不允许此操作!");
  289. // return;
  290. //}
  291. if (!ugr.Cells["LogsEnd"].Value.Equals(""))
  292. {
  293. i += 1;
  294. }
  295. }
  296. for (int j = 0; j < i; j++)
  297. {
  298. string loagEnd = ultraGrid1.Rows[j].Cells["LogsEnd"].Text.ToString();
  299. string loagBeg = "";
  300. if (j + 1 < i)
  301. {
  302. loagBeg = ultraGrid1.Rows[j + 1].Cells["LogsBeg"].Text.ToString();
  303. if (DateTime.Compare(Convert.ToDateTime(loagBeg), Convert.ToDateTime(loagEnd)) < 0)
  304. {
  305. ArrayList list = new ArrayList();
  306. list.Add(DateTime.Parse(ultraGrid1.Rows[j].Cells["LogsBeg"].Value.ToString()).ToString("yyyyMMddHHmm"));
  307. list.Add(DateTime.Parse(ultraGrid1.Rows[j].Cells["LogsEnd"].Value.ToString()).ToString("yyyyMMddHHmm"));
  308. list.Add(DateTime.Parse(ultraGrid1.Rows[j + 1].Cells["LogsBeg"].Value.ToString()).ToString("yyyyMMddHHmm"));
  309. list.Add(this.UserInfo.GetUserName());
  310. list.Add(this.UserInfo.GetUserOrder());
  311. list.Add(this.UserInfo.GetUserGroup());
  312. list.Add(plineCode);
  313. list.Add(ultraGrid1.Rows[j].Cells["ControlId"].Value.ToString());
  314. pram.Add(list);
  315. }
  316. }
  317. }
  318. if (ultraGrid1.Rows.Count > 0 && ultraGrid2.Rows.Count > 0)
  319. {
  320. int a = ultraGrid2.Rows.Count;
  321. string logsBeg = ultraGrid1.Rows[0].Cells["LogsBeg"].Value.ToString();
  322. string logsEnd = ultraGrid2.Rows[a - 1].Cells["LogsEnd"].Value.ToString();
  323. string ControlId = ultraGrid1.Rows[0].Cells["ControlId"].Value.ToString();
  324. if (DateTime.Compare(Convert.ToDateTime(logsBeg), Convert.ToDateTime(logsEnd)) < 0)
  325. {
  326. logsEnd = DateTime.Parse(logsEnd).ToString("yyyyMMddHHmm");
  327. ServerHelper.SetData("com.steering.mes.signature.FrmStlControlLog.updateOneDate", new object[] { logsEnd, ControlId }, this.ob);
  328. }
  329. }
  330. if (MessageUtil.ShowYesNoAndQuestion("是否一键修改处理?") == DialogResult.No)
  331. {
  332. return;
  333. }
  334. CoreClientParam ccp = new CoreClientParam();
  335. ccp.ServerName = "com.steering.mes.signature.FrmStlControlLog";
  336. ccp.MethodName = "oneKeyUpdateMilControlLog";
  337. ccp.ServerParams = new object[] { pram };
  338. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  339. if (ccp.ReturnCode != -1)
  340. {
  341. MessageUtil.ShowTips(ccp.ReturnInfo);
  342. if (ccp.ReturnInfo.Equals("一键处理成功!"))
  343. {
  344. doQuery();
  345. doAnalysis();
  346. }
  347. }
  348. }
  349. catch (Exception ex)
  350. {
  351. MessageUtil.ShowTips("开始时间或结束时间不能为空!");
  352. }
  353. }
  354. /// <summary>
  355. /// 新增
  356. /// </summary>
  357. private void doAdd()
  358. {
  359. ultraGrid1.UpdateData();
  360. ultraGrid2.UpdateData();
  361. ArrayList pram = new ArrayList();
  362. UltraGridRow row = ultraGrid1.ActiveRow;
  363. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
  364. if (checkMagRows.Count() == 0)
  365. {
  366. MessageUtil.ShowTips("请选择需要增加的停机记录!");
  367. return;
  368. }
  369. foreach (UltraGridRow uRow in checkMagRows)
  370. {
  371. StlControlLogEntity stlControlLogEntity = (StlControlLogEntity)uRow.ListObject;
  372. stlControlLogEntity.LogsBeg = DateTime.Parse(uRow.Cells["LogsBeg"].Value.ToString()).ToString("yyyyMMddHHmm");
  373. stlControlLogEntity.LogsEnd = DateTime.Parse(uRow.Cells["LogsEnd"].Value.ToString()).ToString("yyyyMMddHHmm");
  374. stlControlLogEntity.UserName = this.UserInfo.GetUserName();
  375. stlControlLogEntity.ProBc = this.UserInfo.GetUserOrder();
  376. stlControlLogEntity.ProBz = this.UserInfo.GetUserGroup();
  377. stlControlLogEntity.PlineCode = row.Cells["PlineCode"].Text.ToString();
  378. stlControlLogEntity.PlineName = row.Cells["PlineName"].Text.ToString();
  379. stlControlLogEntity.EfPlineCode = row.Cells["EfPlineCode"].Text.ToString();
  380. stlControlLogEntity.EfPlineName = row.Cells["EfPlineName"].Text.ToString();
  381. stlControlLogEntity.BalYearMonth = row.Cells["BalYearMonth"].Text.ToString();
  382. stlControlLogEntity.ProcDate = DateTime.Parse(row.Cells["ProcDate"].Text.ToString()).ToString("yyyyMMdd");
  383. stlControlLogEntity.StoveNo = row.Cells["StoveNo"].Text.ToString();
  384. stlControlLogEntity.Gradecode = row.Cells["Gradecode"].Text.ToString();
  385. stlControlLogEntity.Gradename = row.Cells["Gradename"].Text.ToString();
  386. //stlControlLogEntity.StopType = row.Cells["StopType"].Value.ToString();
  387. stlControlLogEntity.StopReason = basecodeReason;
  388. stlControlLogEntity.StopSmall = basecodeSamll;
  389. string matZcTity = JSONFormat.Format(stlControlLogEntity);
  390. pram.Add(matZcTity);
  391. }
  392. CoreClientParam ccp = new CoreClientParam();
  393. ccp.ServerName = "com.steering.mes.signature.FrmStlControlLog";
  394. ccp.MethodName = "addMilControlLog";
  395. ccp.ServerParams = new object[] { pram };
  396. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  397. if (ccp.ReturnCode != -1)
  398. {
  399. MessageUtil.ShowTips(ccp.ReturnInfo);
  400. if (ccp.ReturnInfo.Equals("新增成功!"))
  401. {
  402. doQuery();
  403. doAnalysis();
  404. }
  405. }
  406. }
  407. /// <summary>
  408. /// 修改
  409. /// </summary>
  410. private void doUpdate()
  411. {
  412. ultraGrid1.UpdateData();
  413. ultraGrid2.UpdateData();
  414. UltraGridRow row = ultraGrid1.ActiveRow;
  415. if (row == null) { MessageUtil.ShowTips("无数据!"); return; }
  416. ArrayList pram = new ArrayList();
  417. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
  418. if (checkMagRows.Count() == 0)
  419. {
  420. MessageUtil.ShowTips("请选择需要修改的停机记录!");
  421. return;
  422. }
  423. foreach (UltraGridRow uRow in checkMagRows)
  424. {
  425. StlControlLogEntity stlControlLogEntity = (StlControlLogEntity)uRow.ListObject;
  426. if (stlControlLogEntity.ConfirmFlag.Equals("1"))
  427. {
  428. MessageUtil.ShowTips("已确认的数据不能修改!");
  429. return;
  430. }
  431. stlControlLogEntity.LogsBeg = DateTime.Parse(uRow.Cells["LogsBeg"].Value.ToString()).ToString("yyyyMMddHHmm");
  432. stlControlLogEntity.LogsEnd = DateTime.Parse(uRow.Cells["LogsEnd"].Value.ToString()).ToString("yyyyMMddHHmm");
  433. //stlControlLogEntity.StopType = row.Cells["StopType"].Value.ToString();
  434. stlControlLogEntity.StopReason = basecodeReason;
  435. stlControlLogEntity.StopSmall = basecodeSamll;
  436. string matZcTity = JSONFormat.Format(stlControlLogEntity);
  437. pram.Add(matZcTity);
  438. }
  439. CoreClientParam ccp = new CoreClientParam();
  440. ccp.ServerName = "com.steering.mes.signature.FrmStlControlLog";
  441. ccp.MethodName = "updateMilControlLog";
  442. ccp.ServerParams = new object[] { pram };
  443. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  444. if (ccp.ReturnCode != -1)
  445. {
  446. MessageUtil.ShowTips(ccp.ReturnInfo);
  447. if (ccp.ReturnInfo.Equals("修改成功!"))
  448. {
  449. doQuery();
  450. doAnalysis();
  451. }
  452. }
  453. }
  454. /// <summary>
  455. /// 删除
  456. /// </summary>
  457. private void doDelete()
  458. {
  459. ultraGrid1.UpdateData();
  460. ultraGrid2.UpdateData();
  461. UltraGridRow row = ultraGrid1.ActiveRow;
  462. if (row == null) { MessageUtil.ShowTips("无数据!"); return; }
  463. ArrayList pram = new ArrayList();
  464. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
  465. if (checkMagRows.Count() == 0)
  466. {
  467. MessageUtil.ShowTips("请选择需要删除的停机记录!");
  468. return;
  469. }
  470. foreach (UltraGridRow uRow in checkMagRows)
  471. {
  472. StlControlLogEntity stlControlLogEntity = (StlControlLogEntity)uRow.ListObject;
  473. if (stlControlLogEntity.ConfirmFlag.Equals("1"))
  474. {
  475. MessageUtil.ShowTips("已确认的数据不能删除!");
  476. return;
  477. }
  478. string matZcTity = JSONFormat.Format(stlControlLogEntity);
  479. pram.Add(matZcTity);
  480. }
  481. CoreClientParam ccp = new CoreClientParam();
  482. ccp.ServerName = "com.steering.mes.signature.FrmStlControlLog";
  483. ccp.MethodName = "deleteMilControlLog";
  484. ccp.ServerParams = new object[] { pram };
  485. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  486. if (ccp.ReturnCode != -1)
  487. {
  488. MessageUtil.ShowTips(ccp.ReturnInfo);
  489. if (ccp.ReturnInfo.Equals("删除成功!"))
  490. {
  491. doQuery();
  492. doAnalysis();
  493. }
  494. }
  495. }
  496. /// <summary>
  497. /// 删除2
  498. /// </summary>
  499. private void doDelete2()
  500. {
  501. ultraGrid1.UpdateData();
  502. ultraGrid2.UpdateData();
  503. UltraGridRow row = ultraGrid1.ActiveRow;
  504. if (row == null) { MessageUtil.ShowTips("无数据!"); return; }
  505. ArrayList pram = new ArrayList();
  506. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  507. if (checkMagRows.Count() == 0)
  508. {
  509. MessageUtil.ShowTips("请选择需要删除的停机记录!");
  510. return;
  511. }
  512. foreach (UltraGridRow uRow in checkMagRows)
  513. {
  514. StlControlLogEntity stlControlLogEntity = (StlControlLogEntity)uRow.ListObject;
  515. if (stlControlLogEntity.ConfirmFlag.Equals("1"))
  516. {
  517. MessageUtil.ShowTips("已确认的数据不能删除!");
  518. return;
  519. }
  520. string matZcTity = JSONFormat.Format(stlControlLogEntity);
  521. pram.Add(matZcTity);
  522. }
  523. CoreClientParam ccp = new CoreClientParam();
  524. ccp.ServerName = "com.steering.mes.signature.FrmStlControlLog";
  525. ccp.MethodName = "deleteMilControlLog";
  526. ccp.ServerParams = new object[] { pram };
  527. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  528. if (ccp.ReturnCode != -1)
  529. {
  530. MessageUtil.ShowTips(ccp.ReturnInfo);
  531. if (ccp.ReturnInfo.Equals("删除成功!"))
  532. {
  533. doQuery();
  534. doAnalysis();
  535. }
  536. }
  537. }
  538. /// <summary>
  539. ///分析
  540. /// </summary>
  541. private void doAnalysis()
  542. {
  543. flag = 1;
  544. flag1 = 0;
  545. int i = 0;
  546. try
  547. {
  548. //当班数据分析
  549. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  550. {
  551. if (!ugr.Cells["LogsEnd"].Value.Equals(""))
  552. { i += 1; }
  553. if (!ugr.Cells["LogsEnd"].Value.Equals(""))
  554. {
  555. if (Convert.ToDateTime(ugr.Cells["LogsBeg"].Value.ToString()) > Convert.ToDateTime(ugr.Cells["LogsEnd"].Value.ToString()))
  556. {
  557. ugr.RowSelectorAppearance.BackColor = Color.Red;
  558. //ugr.Cells["LogsBeg"].Appearance.BackHatchStyle = BackHatchStyle.None;
  559. //ugr.Cells["LogsEnd"].Appearance.BackColor = Color.Red;
  560. //ugr.Cells["LogsEnd"].Appearance.BackHatchStyle = BackHatchStyle.None;
  561. flag = 2;//分析时间错误
  562. }
  563. }
  564. }
  565. for (int j = 0; j < i; j++)
  566. {
  567. string loagEnd = ultraGrid1.Rows[j].Cells["LogsEnd"].Text.ToString();
  568. string loagBeg = "";
  569. if (j + 1 < i)
  570. {
  571. loagBeg = ultraGrid1.Rows[j + 1].Cells["LogsBeg"].Text.ToString();
  572. if (DateTime.Compare(Convert.ToDateTime(loagBeg), Convert.ToDateTime(loagEnd)) > 0)
  573. {
  574. if (TubeRoll.JudgeTime(Convert.ToDateTime(loagBeg), Convert.ToDateTime(loagEnd)) > 0)
  575. {
  576. ultraGrid1.Rows[j + 1].Cells["StopType"].Appearance.BackColor = Color.Pink;
  577. ultraGrid1.Rows[j + 1].Cells["StopType"].Appearance.BackHatchStyle = BackHatchStyle.None;
  578. ultraGrid1.Rows[j].Cells["StopType"].Appearance.BackColor = Color.Pink;
  579. ultraGrid1.Rows[j].Cells["StopType"].Appearance.BackHatchStyle = BackHatchStyle.None;
  580. flag1 = 1;//时间差
  581. }
  582. //else if (TubeRoll.JudgeTime(Convert.ToDateTime(loagBeg), Convert.ToDateTime(loagEnd)) <= 5 && TubeRoll.JudgeTime(Convert.ToDateTime(loagBeg), Convert.ToDateTime(loagEnd))>=3)
  583. //{
  584. // ultraGrid1.Rows[j + 1].Cells["StopType"].Appearance.BackColor = Color.LightGray;
  585. // ultraGrid1.Rows[j + 1].Cells["StopType"].Appearance.BackHatchStyle = BackHatchStyle.None;
  586. // ultraGrid1.Rows[j].Cells["StopType"].Appearance.BackColor = Color.LightGray;
  587. // ultraGrid1.Rows[j].Cells["StopType"].Appearance.BackHatchStyle = BackHatchStyle.None;
  588. // flag = 2;
  589. //}
  590. }
  591. else if (DateTime.Compare(Convert.ToDateTime(loagBeg), Convert.ToDateTime(loagEnd)) < 0)
  592. {
  593. ultraGrid1.Rows[j].RowSelectorAppearance.BackColor = Color.Red;
  594. //ultraGrid1.Rows[j + 1].RowSelectorAppearance.BackColor = Color.Red;
  595. //ultraGrid1.Rows[j + 1].Cells["LogsBeg"].Appearance.BackColor = Color.Orange;
  596. //ultraGrid1.Rows[j + 1].Cells["LogsBeg"].Appearance.BackHatchStyle = BackHatchStyle.None;
  597. //ultraGrid1.Rows[j].Cells["LogsBeg"].Appearance.BackColor = Color.Orange;
  598. //ultraGrid1.Rows[j].Cells["LogsBeg"].Appearance.BackHatchStyle = BackHatchStyle.None;
  599. flag = 2;
  600. }
  601. TimeSpan timeSpan = DateTime.Parse(ultraGrid1.Rows[j + 1].Cells["LogsBeg"].Value.ToString()) -
  602. DateTime.Parse(ultraGrid1.Rows[j].Cells["LogsEnd"].Value.ToString());
  603. ultraGrid1.Rows[j + 1].Cells["TimeDiff"].Value = timeSpan.TotalMinutes.ToString();
  604. }
  605. }
  606. }
  607. catch (Exception ex)
  608. {
  609. // MessageUtil.ShowTips(ex.Message);
  610. MessageUtil.ShowTips("开始时间或结束时间不能为空!");
  611. }
  612. }
  613. private string DateDiff(DateTime DateTime1, DateTime DateTime2)
  614. {
  615. string dateDiff = null;
  616. try
  617. {
  618. TimeSpan ts1 = new TimeSpan(DateTime1.Ticks);
  619. TimeSpan ts2 = new TimeSpan(DateTime2.Ticks);
  620. TimeSpan ts = ts1.Subtract(ts2).Duration();
  621. dateDiff = ts.Minutes.ToString();
  622. }
  623. catch
  624. {
  625. }
  626. return dateDiff;
  627. }
  628. /// <summary>
  629. ///确认
  630. /// </summary>
  631. private void doConfirm()
  632. {
  633. UltraGridRow uow = ultraGrid1.ActiveRow;
  634. if (uow == null) { MessageUtil.ShowTips("无数据!"); return; }
  635. ArrayList pram = new ArrayList();
  636. string date = DateTime.Now.ToString();
  637. if (flag == 0) { MessageUtil.ShowTips("未分析,不允许此操作!"); return; }
  638. if (flag1 == 1) { MessageUtil.ShowTips("有时间差值,不允许此操作!"); return; }
  639. if (flag == 2) { MessageUtil.ShowTips("分析时间错误,不允许此操作!"); return; }
  640. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  641. {
  642. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true && ugr.Cells["LogsBeg"].Value.ToString().Equals(""))
  643. {
  644. MessageUtil.ShowTips("有开始时间为空,不允许此操作!"); return;
  645. }
  646. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true && ugr.Cells["LogsEnd"].Value.ToString().Equals(""))
  647. {
  648. MessageUtil.ShowTips("有结束时间为空,不允许此操作!"); return;
  649. }
  650. }
  651. ultraGrid1.UpdateData();
  652. int seqmin1 = ultraGrid1.Rows.Where(a => a.GetValue("CHK") == "True").Select(a => a.Index).Count();
  653. if (seqmin1 < 1)
  654. {
  655. MessageUtil.ShowTips("没有选中要确认的数据!"); return;
  656. }
  657. if (seqmin1 > 0 && ultraGrid1.Rows.Count > 0)
  658. {
  659. int seqmin = ultraGrid1.Rows.Where(a => a.GetValue("CHK") == "True").Select(a => a.Index).Min();
  660. for (int i = 0; i < seqmin; i++)
  661. {
  662. if (ultraGrid1.Rows[i].Cells["ConfirmFlag"].Value.ToString().Trim().Equals("未确认"))
  663. {
  664. MessageBox.Show("前面有未确认的数据,请先确认!");
  665. return;
  666. }
  667. }
  668. }
  669. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  670. if (checkMagRows.Count() == 0)
  671. {
  672. MessageUtil.ShowTips("请选择需要确认的停机记录!");
  673. return;
  674. }
  675. foreach (UltraGridRow uRow in checkMagRows)
  676. {
  677. StlControlLogEntity stlControlLogEntity = (StlControlLogEntity)uRow.ListObject;
  678. stlControlLogEntity.ConfirmName = this.UserInfo.GetUserName();
  679. string matZcTity = JSONFormat.Format(stlControlLogEntity);
  680. pram.Add(matZcTity);
  681. }
  682. CoreClientParam ccp = new CoreClientParam();
  683. ccp.ServerName = "com.steering.mes.signature.FrmStlControlLog";
  684. ccp.MethodName = "confirmMilControlLog";
  685. ccp.ServerParams = new object[] { pram };
  686. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  687. if (ccp.ReturnCode != -1)
  688. {
  689. MessageUtil.ShowTips(ccp.ReturnInfo);
  690. if (ccp.ReturnInfo.Equals("确认成功!"))
  691. {
  692. doQuery();
  693. doAnalysis();
  694. }
  695. }
  696. }
  697. /// <summary>
  698. ///取消确认
  699. /// </summary>
  700. private void UpConfirm()
  701. {
  702. UltraGridRow uow = ultraGrid1.ActiveRow;
  703. if (uow == null) { MessageUtil.ShowTips("无数据!"); return; }
  704. ArrayList pram = new ArrayList();
  705. ultraGrid1.UpdateData();
  706. int seqmax1 = ultraGrid1.Rows.Where(a => a.GetValue("CHK") == "True").Select(a => a.Index).Count();
  707. if (seqmax1 < 1)
  708. {
  709. MessageUtil.ShowTips("没有选中要确认的数据!"); return;
  710. }
  711. if (seqmax1 > 0 && ultraGrid1.Rows.Count() > 0)
  712. {
  713. int seqmax = ultraGrid1.Rows.Where(a => a.GetValue("CHK") == "True").Select(a => a.Index).Max();
  714. for (int i = seqmax + 1; i < ultraGrid1.Rows.Count(); i++)
  715. {
  716. if (ultraGrid1.Rows[i].Cells["ConfirmFlag"].Value.ToString().Trim().Equals("已确认"))
  717. {
  718. MessageBox.Show("后面有已确认的数据,请先取消确认!");
  719. return;
  720. }
  721. }
  722. }
  723. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  724. if (checkMagRows.Count() == 0)
  725. {
  726. MessageUtil.ShowTips("请选择需要确认的停机记录!");
  727. return;
  728. }
  729. foreach (UltraGridRow uRow in checkMagRows)
  730. {
  731. StlControlLogEntity stlControlLogEntity = (StlControlLogEntity)uRow.ListObject;
  732. stlControlLogEntity.ConfirmName = this.UserInfo.GetUserName();
  733. string matZcTity = JSONFormat.Format(stlControlLogEntity);
  734. pram.Add(matZcTity);
  735. }
  736. CoreClientParam ccp = new CoreClientParam();
  737. ccp.ServerName = "com.steering.mes.signature.FrmStlControlLog";
  738. ccp.MethodName = "upConfirmMilControlLog";
  739. ccp.ServerParams = new object[] { pram };
  740. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  741. if (ccp.ReturnCode != -1)
  742. {
  743. MessageUtil.ShowTips(ccp.ReturnInfo);
  744. if (ccp.ReturnInfo.Equals("取消确认成功!"))
  745. {
  746. doQuery();
  747. doAnalysis();
  748. }
  749. }
  750. }
  751. private void chkDate_CheckedChanged(object sender, EventArgs e)
  752. {
  753. if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
  754. if (chkDate.Checked) { cmbDate2.Enabled = true; } else { cmbDate2.Enabled = false; }
  755. if (chkBz.Checked) { cmbBz.Enabled = true; } else { cmbBz.Enabled = false; }
  756. if (chkpline.Checked) { cmbPline.Enabled = true; } else { cmbPline.Enabled = false; }
  757. }
  758. /// <summary>
  759. /// Grid字段修改触发事件
  760. /// </summary>
  761. /// <param name="sender"></param>
  762. /// <param name="e"></param>
  763. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  764. {
  765. UltraGridRow row = ultraGrid1.ActiveRow;
  766. //string stratime = row.Cells["LogsBeg"].Value.ToString();
  767. //string endtime = row.Cells["LogsEnd"].Value.ToString();
  768. try
  769. {
  770. ultraGrid1.UpdateData();
  771. if (e.Cell.Column.Key.Equals("QualifiedNum"))
  772. {
  773. if (e.Cell.Row.Cells["QualifiedNum"].Value == null)
  774. {
  775. e.Cell.Row.Cells["QualifiedNum"].Value = "0";
  776. }
  777. else
  778. {
  779. string actCount = e.Cell.Row.Cells["QualifiedNum"].Value.ToString();
  780. if (!StringUtil.IsInt(actCount) || actCount == "0")//actCount == "" || int.Parse(actCount)==0
  781. {
  782. e.Cell.Row.Cells["QualifiedNum"].Value = "0";
  783. }
  784. }
  785. }
  786. if (e.Cell.Column.Key.Equals("QualifiedWt"))
  787. {
  788. if (e.Cell.Row.Cells["QualifiedWt"].Value == null)
  789. {
  790. e.Cell.Row.Cells["QualifiedWt"].Value = "0";
  791. }
  792. else
  793. {
  794. string actWt = e.Cell.Row.Cells["QualifiedWt"].Value.ToString();
  795. if (!StringUtil.IsDouble(actWt) || actWt == "0")//actCount == "" || int.Parse(actCount)==0
  796. {
  797. e.Cell.Row.Cells["QualifiedWt"].Value = "0";
  798. }
  799. }
  800. }
  801. if (e.Cell.Column.Key.Equals("ScrapNum"))
  802. {
  803. if (e.Cell.Row.Cells["ScrapNum"].Value == null)
  804. {
  805. e.Cell.Row.Cells["ScrapNum"].Value = "0";
  806. }
  807. else
  808. {
  809. string scrpNum = e.Cell.Row.Cells["ScrapNum"].Value.ToString();
  810. if (!StringUtil.IsInt(scrpNum) || scrpNum == "0")//actCount == "" || int.Parse(actCount)==0
  811. {
  812. e.Cell.Row.Cells["ScrapNum"].Value = "0";
  813. }
  814. }
  815. }
  816. if (e.Cell.Column.Key.Equals("ScrapWt"))
  817. {
  818. if (e.Cell.Row.Cells["ScrapWt"].Value == null)
  819. {
  820. e.Cell.Row.Cells["ScrapWt"].Value = "0";
  821. }
  822. else
  823. {
  824. string scrpwt = e.Cell.Row.Cells["ScrapWt"].Value.ToString();
  825. if (!StringUtil.IsDouble(scrpwt) || scrpwt == "0")//actCount == "" || int.Parse(actCount)==0
  826. {
  827. e.Cell.Row.Cells["ScrapWt"].Value = "0";
  828. }
  829. }
  830. }
  831. if (e.Cell.Column.Key.Equals("StopType"))
  832. {
  833. e.Cell.Row.Cells["StopSmall"].Value = "";
  834. e.Cell.Row.Cells["StopReason"].Value = "";
  835. }
  836. if (e.Cell.Column.Key.Equals("StopSmall"))
  837. {
  838. e.Cell.Row.Cells["StopReason"].Value = "";
  839. }
  840. }
  841. catch (Exception ex)
  842. {
  843. //MessageUtil.ShowTips("您输入的时间格式不正确!");
  844. //e.Cell.Row.Cells["LogsBeg"].Value = row.Cells["LogsBeg"].Value.ToString();
  845. //e.Cell.Row.Cells["LogsEnd"].Value = row.Cells["LogsEnd"].Value.ToString();
  846. return;
  847. }
  848. }
  849. private void ultraGrid1_CellDataError(object sender, CellDataErrorEventArgs e)
  850. {
  851. e.RaiseErrorEvent = false;
  852. MessageUtil.ShowTips("您输入的时间格式不正确!");
  853. }
  854. /// <summary>
  855. /// 停机原因
  856. /// </summary>
  857. /// <param name="sender"></param>
  858. /// <param name="e"></param>
  859. private void cmbStopReason_EditorButtonClick(object sender, EditorButtonEventArgs e)
  860. {
  861. UltraGridRow row = ultraGrid2.ActiveRow;
  862. if (row == null) return;
  863. string stopSallm = basecodeSamll;
  864. if (!row.Cells["StopSmall"].Text.Equals("")) { stopSallm = row.Cells["StopSmall"].Text; }
  865. FrmStopSamll fpdc = new FrmStopSamll(basecodeSamll, ob);
  866. fpdc.AutoSize = true;
  867. fpdc.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  868. fpdc.Text = "停机原因";
  869. fpdc.ShowDialog();
  870. if (fpdc.DialogResult == System.Windows.Forms.DialogResult.OK)
  871. {
  872. //获取弹出窗体的属性值
  873. row.Cells["StopReasonm"].Value = fpdc.Basename;
  874. //cmbStopReason.Value = fpdc.Basename;
  875. basecodeReason = fpdc.Basecode;
  876. }
  877. }
  878. /// <summary>
  879. /// 停机小类
  880. /// </summary>
  881. /// <param name="sender"></param>
  882. /// <param name="e"></param>
  883. private void cmbStopSmall_EditorButtonClick(object sender, EditorButtonEventArgs e)
  884. {
  885. UltraGridRow row = ultraGrid2.ActiveRow;
  886. string stoptype = "";
  887. if (!row.Cells["StopType"].Text.Trim().Equals(""))
  888. {
  889. stoptype = row.Cells["StopType"].Value.ToString();
  890. }
  891. FrmStopSamll fpdc = new FrmStopSamll(stoptype, ob);
  892. fpdc.AutoSize = true;
  893. fpdc.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  894. fpdc.Text = "停机小类";
  895. fpdc.ShowDialog();
  896. if (fpdc.DialogResult == System.Windows.Forms.DialogResult.OK)
  897. {
  898. //获取弹出窗体的属性值
  899. row.Cells["StopSmallm"].Value = fpdc.Basename;
  900. //cmbStopSmall.Value = fpdc.Basename;
  901. basecodeSamll = fpdc.Basecode;
  902. }
  903. }
  904. /// <summary>
  905. /// 班次中文
  906. /// </summary>
  907. /// <param name="dtShift"></param>
  908. /// <returns></returns>
  909. private string changeShift(string dtShift)
  910. {
  911. switch (dtShift)
  912. {
  913. case "1":
  914. dtShift = "早班";
  915. break;
  916. case "2":
  917. dtShift = "中班";
  918. break;
  919. case "3":
  920. dtShift = "夜班";
  921. break;
  922. }
  923. return dtShift;
  924. }
  925. /// <summary>
  926. /// 班组中文
  927. /// </summary>
  928. /// <param name="dtGroup"></param>
  929. /// <returns></returns>
  930. private string changeGroup(string dtGroup)
  931. {
  932. switch (dtGroup)
  933. {
  934. case "1":
  935. dtGroup = "甲班";
  936. break;
  937. case "2":
  938. dtGroup = "乙班";
  939. break;
  940. case "3":
  941. dtGroup = "丙班";
  942. break;
  943. case "4":
  944. dtGroup = "丁班";
  945. break;
  946. }
  947. return dtGroup;
  948. }
  949. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  950. {
  951. UltraGridRow row = ultraGrid1.ActiveRow;
  952. List<StlControlLogEntity> listSource2 = EntityHelper.GetData<StlControlLogEntity>
  953. ("com.steering.mes.signature.FrmStlControlLog.doQueryPlan2", new object[] { row.Cells["StoveNo"].Text.ToString(), plineCode }, this.ob);
  954. StlControlLogEntity2.DataSource = listSource2;
  955. GridHelper.RefreshAndAutoSize(ultraGrid2);
  956. this.ultraGrid2.DisplayLayout.Bands[0].Columns["LogsBeg"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTimeWithSpin;
  957. this.ultraGrid2.DisplayLayout.Bands[0].Columns["LogsBeg"].MaskInput = "yyyy-mm-dd hh:mm";
  958. this.ultraGrid2.DisplayLayout.Bands[0].Columns["LogsEnd"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTimeWithSpin;
  959. this.ultraGrid2.DisplayLayout.Bands[0].Columns["LogsEnd"].MaskInput = "yyyy-mm-dd hh:mm";
  960. }
  961. private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  962. {
  963. try
  964. {
  965. ultraGrid2.UpdateData();
  966. UltraGridRow row = ultraGrid1.ActiveRow;
  967. foreach (UltraGridRow r in ultraGrid2.Rows)
  968. {
  969. r.Cells["CHK"].Value = r.Selected;
  970. if (r.Cells["ControlId"].Value.ToString().Equals(""))
  971. {
  972. r.Cells["LogsBeg"].Value = row.Cells["LogsBeg"].Text;
  973. r.Cells["LogsEnd"].Value = row.Cells["LogsEnd"].Text;
  974. }
  975. }
  976. }
  977. catch { }
  978. }
  979. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  980. {
  981. ultraGrid2.UpdateData();
  982. UltraGridRow row = ultraGrid1.ActiveRow;
  983. UltraGridRow row2 = ultraGrid2.ActiveRow;
  984. if (row2.Cells["ControlId"].Value.ToString().Equals(""))
  985. {
  986. row2.Cells["LogsBeg"].Value = row.Cells["LogsBeg"].Text;
  987. row2.Cells["LogsEnd"].Value = row.Cells["LogsEnd"].Text;
  988. }
  989. }
  990. }
  991. }