FrmMeasureResultZG.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.ZGMil.Entity;
  6. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  7. using Core.StlMes.Client.ZGMil.Signature;
  8. using CoreFS.CA06;
  9. using Infragistics.Win.UltraWinGrid;
  10. using System;
  11. using System.Collections;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Data;
  15. using System.Drawing;
  16. using System.Linq;
  17. using System.Text;
  18. using System.Windows.Forms;
  19. namespace Core.StlMes.Client.ZGMil.Result
  20. {
  21. public partial class FrmMeasureResultZG : FrmBase
  22. {
  23. private string departm = "";
  24. private string plineCode = "";
  25. private string userName = "";
  26. private string proPlanId = null;//轧管订单编号
  27. private string gxPlanNo = null;//工序排产序号
  28. private string[] arrId;//数据权限
  29. string HeatPlanNo = "";
  30. string JudgeStoveNo = "";
  31. string PlineCode = "";
  32. public FrmMeasureResultZG()
  33. {
  34. InitializeComponent();
  35. this.IsLoadUserView = true;
  36. }
  37. private void FrmMeasureResultZG_Load(object sender, EventArgs e)
  38. {
  39. cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
  40. NativeMethodNew na = new NativeMethodNew(this.ob);
  41. userName = UserInfo.GetUserName();
  42. departm = UserInfo.GetDepartment();
  43. arrId = this.ValidDataPurviewIds;//获取数据权限
  44. EntityHelper.ShowGridCaption<MilPlanEntity6>(ultraGrid1.DisplayLayout.Bands[0]);
  45. EntityHelper.ShowGridCaption<MilMeasureResultEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  46. EntityHelper.ShowGridCaption<PortMilBatchSampleResultEntity2>(ultraGrid3.DisplayLayout.Bands[0]);
  47. DateTime now = DateTime.Now;
  48. DateTime date = new DateTime(now.Year, now.Month, 1);
  49. cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd"));
  50. cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  51. }
  52. /// <summary>
  53. /// 重写基类方法
  54. /// </summary>
  55. /// <param name="sender"></param>
  56. /// <param name="ToolbarKey"></param>
  57. public override void ToolBar_Click(object sender, string ToolbarKey)
  58. {
  59. switch (ToolbarKey)
  60. {
  61. case "Query":
  62. doQuery();
  63. break;
  64. case "DoAdd":
  65. DoAdd();
  66. break;
  67. case "DoDelete":
  68. DoDelete();
  69. break;
  70. case "SetGroup":
  71. SetGroup();
  72. break;
  73. case "SetMesureData":
  74. SetMesureData();
  75. break;
  76. //case "insertProssWt":
  77. // insertProssWt();
  78. // break;
  79. //case "Print":
  80. // PrintData();
  81. // break;
  82. case "Close":
  83. this.Close();
  84. break;
  85. }
  86. }
  87. /// <summary>
  88. /// 查询
  89. /// </summary>
  90. private void doQuery()
  91. {
  92. string date = "";
  93. string endDate = "";
  94. string JudgeStoveNo = "";
  95. if (chkDate.Checked)
  96. {
  97. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  98. {
  99. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  100. return;
  101. }
  102. else
  103. {
  104. date = cmbDate.Value.ToString();
  105. endDate = cmbEndDate.Value.ToString();
  106. }
  107. }
  108. if (chkJudgeStoveNo.Checked)
  109. {
  110. if (uteJudgeStoveNo.Text.Trim() == "")
  111. {
  112. JudgeStoveNo = "";
  113. }
  114. else
  115. {
  116. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  117. }
  118. }
  119. List<MilPlanEntity6> listSource = EntityHelper.GetData<MilPlanEntity6>(
  120. "com.steering.mes.zgmil.coup.FrmMeasureResultZG.doQuery", new object[] { date, endDate, JudgeStoveNo ,arrId}, this.ob);
  121. bindingSource1.DataSource = listSource;
  122. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  123. }
  124. /// <summary>
  125. /// 打印
  126. /// </summary>
  127. private void PrintData()
  128. {
  129. string HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["HeatPlanNo"].Value.ToString();
  130. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMchMeasurePrint.cpt&op=view" + "&HEAT_PLAN_NO=" + HeatPlanNo;
  131. FrmRepExcel fre = new FrmRepExcel(this.ob, strurl);
  132. fre.AutoSize = true;
  133. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  134. fre.WindowState = FormWindowState.Maximized;
  135. fre.Show();
  136. }
  137. /// <summary>
  138. /// 查询条件
  139. /// </summary>
  140. /// <param name="sender"></param>
  141. /// <param name="e"></param>
  142. private void chkDate_CheckedChanged(object sender, EventArgs e)
  143. {
  144. if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
  145. if (chkDate.Checked) { cmbEndDate.Enabled = true; } else { cmbEndDate.Enabled = false; }
  146. if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
  147. }
  148. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  149. {
  150. this.measureControl2.Value.BatchNo = "";
  151. this.measureControl2.Value.ProUser = this.UserInfo.GetUserName();
  152. this.measureControl2.Value.ProShift = this.UserInfo.GetUserOrderText();
  153. this.measureControl2.Value.ProGroup = this.UserInfo.GetUserGroupText();
  154. this.measureControl2.Value.ProTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  155. this.measureControl2.Value.ProEndTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  156. this.measureControl2.UpdateDate();
  157. string HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  158. string JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  159. string PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  160. doQueryMilMeasureResult();
  161. doQueryPortMilBatchSampleResult();
  162. }
  163. /// <summary>
  164. /// 查询测量实绩
  165. /// </summary>
  166. private void doQueryMilMeasureResult()
  167. {
  168. HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  169. JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  170. PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  171. List<MilMeasureResultEntity> listSource2 = EntityHelper.GetData<MilMeasureResultEntity>(
  172. "com.steering.mes.zgmil.coup.FrmMeasureResultZG.doQueryMilMeasureResult", new object[] { HeatPlanNo, JudgeStoveNo, PlineCode }, this.ob);
  173. MilMeasureResultEntitybindingSource2.DataSource = listSource2;
  174. GridHelper.RefreshAndAutoSize(this.ultraGrid2);
  175. }
  176. /// <summary>
  177. /// 查询进程表
  178. /// </summary>
  179. private void doQueryPortMilBatchSampleResult()
  180. {
  181. HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  182. JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  183. PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  184. List<PortMilBatchSampleResultEntity2> listSource = EntityHelper.GetData<PortMilBatchSampleResultEntity2>(
  185. "com.steering.mes.zgmil.coup.FrmMeasureResultZG.doQueryPortMilBatchSampleResult", new object[] { HeatPlanNo, JudgeStoveNo, PlineCode }, this.ob);
  186. PortMilBatchSampleResultEntity2bindingSource3.DataSource = listSource;
  187. GridHelper.RefreshAndAutoSize(this.ultraGrid3);
  188. }
  189. /// <summary>
  190. /// 新增
  191. /// </summary>
  192. protected virtual void DoAdd()
  193. {
  194. this.ultraGrid1.UpdateData();
  195. measureControl2.UltraGrid3.UpdateData();
  196. MilMeasureResultEntity milMeasureResult = new MilMeasureResultEntity();
  197. milMeasureResult.HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  198. milMeasureResult.JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  199. milMeasureResult.PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  200. milMeasureResult.BatchNo = this.measureControl2.FurResultDateSource1.Rows[0]["BatchNo"].ToString();
  201. milMeasureResult.ProNum = int.Parse(this.measureControl2.FurResultDateSource1.Rows[0]["ProNum"].ToString3());
  202. milMeasureResult.ProUser = this.UserInfo.GetUserName();
  203. milMeasureResult.ProShift = this.UserInfo.GetUserOrder();
  204. milMeasureResult.ProGroup = this.UserInfo.GetUserGroup();
  205. milMeasureResult.ProTime = this.measureControl2.FurResultDateSource1.Rows[0]["ProTime"].ToString();
  206. milMeasureResult.ProEndTime = this.measureControl2.FurResultDateSource1.Rows[0]["ProEndTime"].ToString();
  207. string milMeasureResultStr = JSONFormat.Format(milMeasureResult);
  208. if (milMeasureResult.ProNum == 0)
  209. {
  210. MessageUtil.ShowWarning("请输入正确的支数!");
  211. return;
  212. }
  213. HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  214. JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  215. PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  216. CoreClientParam ccp = new CoreClientParam();
  217. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG";
  218. ccp.MethodName = "DoAdd";
  219. ccp.ServerParams = new object[] { milMeasureResultStr,HeatPlanNo, JudgeStoveNo, PlineCode };
  220. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  221. if (ccp.ReturnCode != -1)
  222. {
  223. if (ccp.ReturnInfo.Equals("新增成功!"))
  224. {
  225. this.ultraGrid1.UpdateData();
  226. doQueryMilMeasureResult();
  227. doQueryPortMilBatchSampleResult();
  228. MessageUtil.ShowTips(ccp.ReturnInfo);
  229. }
  230. else
  231. {
  232. MessageUtil.ShowTips(ccp.ReturnInfo);
  233. }
  234. }
  235. }
  236. /// <summary>
  237. /// 删除
  238. /// </summary>
  239. protected virtual void DoDelete()
  240. {
  241. this.ultraGrid2.UpdateData();
  242. string resultNo = this.ultraGrid2.ActiveRow.Cells["ResultNo"].Value.ToString();
  243. HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  244. JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  245. PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  246. CoreClientParam ccp = new CoreClientParam();
  247. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG";
  248. ccp.MethodName = "DoDelete";
  249. ccp.ServerParams = new object[] { resultNo, HeatPlanNo, JudgeStoveNo, PlineCode };
  250. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  251. if (ccp.ReturnCode != -1)
  252. {
  253. if (ccp.ReturnInfo.Equals("删除成功!"))
  254. {
  255. this.ultraGrid1.UpdateData();
  256. doQueryMilMeasureResult();
  257. doQueryPortMilBatchSampleResult();
  258. MessageUtil.ShowTips(ccp.ReturnInfo);
  259. }
  260. else
  261. {
  262. MessageUtil.ShowTips(ccp.ReturnInfo);
  263. }
  264. }
  265. }
  266. /// <summary>
  267. /// 组号长度范围规则
  268. /// </summary>
  269. private void SetGroup()
  270. {
  271. //if (ActiveRow == null)
  272. //{
  273. // MessageUtil.ShowTips("请选择需要炉计划!");
  274. // return;
  275. //}
  276. //FrmGroupSetting fgs = new FrmGroupSetting(ActiveRow.OrderNoSeq, ActiveRow.HeatPlanNo, ob);
  277. //fgs.ShowDialog();
  278. }
  279. /// <summary>
  280. /// 维护测量点数据
  281. /// </summary>
  282. private void SetMesureData()
  283. {
  284. PlnZyJgxCEntity JgxPlan = new PlnZyJgxCEntity();
  285. JgxPlan.HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  286. JgxPlan.JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  287. JgxPlan.BatchNo = this.ultraGrid1.ActiveRow.Cells["BatchNo"].Value.ToString();
  288. JgxPlan.PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  289. MesureData MesureData = new MesureData(JgxPlan, ob, this.UserInfo.GetUserName(), true);
  290. MesureData.ShowDialog();
  291. }
  292. /// <summary>
  293. /// 保存喷印管号
  294. /// </summary>
  295. /// <param name="sender"></param>
  296. /// <param name="e"></param>
  297. private void ultraButton1_Click(object sender, EventArgs e)
  298. {
  299. ArrayList parm = new ArrayList();
  300. HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  301. JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  302. PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  303. parm.Add(HeatPlanNo);
  304. parm.Add(JudgeStoveNo);
  305. parm.Add(PlineCode);
  306. parm.Add(this.ultraMeasuringSeqStart.Text.ToString());
  307. parm.Add(this.ultraMeasuringSeqLen.Text.ToString());
  308. CoreClientParam ccp = new CoreClientParam();
  309. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG";
  310. ccp.MethodName = "doSaveMeasuringSeq";
  311. ccp.ServerParams = new object[] { parm };
  312. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  313. if (ccp.ReturnCode != -1)
  314. {
  315. if (ccp.ReturnInfo.Equals("保存喷印管号成功!"))
  316. {
  317. //doQueryOffLine();
  318. doQueryPortMilBatchSampleResult();
  319. MessageUtil.ShowTips(ccp.ReturnInfo);
  320. }
  321. else
  322. {
  323. MessageUtil.ShowTips(ccp.ReturnInfo);
  324. }
  325. }
  326. }
  327. /// <summary>
  328. /// 发送喷印信息
  329. /// </summary>
  330. /// <param name="sender"></param>
  331. /// <param name="e"></param>
  332. private void ultraButton2_Click(object sender, EventArgs e)
  333. {
  334. ArrayList parm = new ArrayList();
  335. HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  336. JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  337. PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  338. parm.Add(HeatPlanNo);
  339. parm.Add(JudgeStoveNo);
  340. parm.Add(PlineCode);
  341. parm.Add(this.ultraMatInfoStart.Text.ToString());
  342. parm.Add(this.ultraMatInfoEnd.Text.ToString());
  343. CoreClientParam ccp = new CoreClientParam();
  344. ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG";
  345. ccp.MethodName = "doSaveMatInfo";
  346. ccp.ServerParams = new object[] { parm };
  347. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  348. if (ccp.ReturnCode != -1)
  349. {
  350. if (ccp.ReturnInfo.Equals("发送喷印信息成功!"))
  351. {
  352. doQueryPortMilBatchSampleResult();
  353. MessageUtil.ShowTips(ccp.ReturnInfo);
  354. }
  355. else
  356. {
  357. MessageUtil.ShowTips(ccp.ReturnInfo);
  358. }
  359. }
  360. }
  361. /// <summary>
  362. /// 回填过磅重量
  363. /// </summary>
  364. //private void insertProssWt()
  365. //{
  366. // this.ultraGrid2.UpdateData();
  367. // UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  368. // if (uRow == null)
  369. // {
  370. // MessageUtil.ShowTips("请选择需要回报过磅重量的炉信息!");
  371. // return;
  372. // }
  373. // if (Double.Parse(uRow.Cells["ProWt"].Value.ToString3()) <= 0)
  374. // {
  375. // MessageUtil.ShowTips("请输入正确的重量!");
  376. // return;
  377. // }
  378. // MilMeasureResultEntity milMeasureResult = (MilMeasureResultEntity)this.ultraGrid2.ActiveRow.ListObject;
  379. // string milMeasureStr = JSONFormat.Format(milMeasureResult);
  380. // CoreClientParam ccp = new CoreClientParam();
  381. // ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMeasureResultZG";
  382. // ccp.MethodName = "insertProssWt";
  383. // ccp.ServerParams = new object[] { milMeasureStr };
  384. // ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  385. // if (ccp.ReturnCode != -1)
  386. // {
  387. // if (ccp.ReturnInfo.Equals("回报成功!"))
  388. // {
  389. // doQueryMilMeasureResult();
  390. // doQueryPortMilBatchSampleResult();
  391. // MessageUtil.ShowTips(ccp.ReturnInfo);
  392. // }
  393. // else
  394. // {
  395. // MessageUtil.ShowTips(ccp.ReturnInfo);
  396. // }
  397. // }
  398. //}
  399. private void uteMeasureData_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  400. {
  401. PlnZyJgxCEntity JgxPlan = new PlnZyJgxCEntity();
  402. JgxPlan.HeatPlanNo = this.ultraGrid1.ActiveRow.Cells["Id"].Value.ToString();
  403. JgxPlan.JudgeStoveNo = this.ultraGrid1.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  404. JgxPlan.BatchNo = this.ultraGrid1.ActiveRow.Cells["BatchNo"].Value.ToString();
  405. JgxPlan.PlineCode = this.ultraGrid1.ActiveRow.Cells["PlineCode"].Value.ToString();
  406. MesureData MesureData = new MesureData(JgxPlan, ob, this.UserInfo.GetUserName(), false);
  407. MesureData.ShowDialog();
  408. }
  409. }
  410. }