FrmAnnularFurnace.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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 System.Collections;
  11. using Core.Mes.Client.Comm.Tool;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.Mes.Client.Comm.Control;
  14. using Core.StlMes.Client.ZGMil.Entity;
  15. using Core.StlMes.Client.ZGMil.Signature;
  16. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  17. using Core.StlMes.Client.ZGMil.Common;
  18. using Infragistics.Win.UltraWinGrid;
  19. using com.steering.mes.zgmil.entity;
  20. using Core.Mes.Client.Comm.Format;
  21. namespace Core.StlMes.Client.ZGMil.Report
  22. {
  23. public partial class FrmAnnularFurnace : FrmBase
  24. {
  25. private string departm = "";
  26. private string plineCode = "";
  27. private string[] plineCodes = { };
  28. public FrmAnnularFurnace()
  29. {
  30. InitializeComponent();
  31. this.IsLoadUserView = true;
  32. }
  33. private void FrmAnnularFurnace_Load(object sender, EventArgs e)
  34. {
  35. cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
  36. NativeMethodNew na = new NativeMethodNew(this.ob);
  37. departm = UserInfo.GetDepartment();
  38. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  39. plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob);
  40. cmbEndDate.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 21:00:00"));
  41. cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 20:59:59"));
  42. TubeRoll.SetComboItemHeight(cmbBc);
  43. TubeRoll.SetComboItemHeight(cmbBz);
  44. }
  45. /// <summary>
  46. /// 重写基类方法
  47. /// </summary>
  48. /// <param name="sender"></param>
  49. /// <param name="ToolbarKey"></param>
  50. public override void ToolBar_Click(object sender, string ToolbarKey)
  51. {
  52. switch (ToolbarKey)
  53. {
  54. case "Query":
  55. doQuery();
  56. break;
  57. case "Save":
  58. doSave("入炉修改");
  59. break;
  60. case "AfterDoSave":
  61. doSave("出炉修改");
  62. break;
  63. case "Export":
  64. doExport();
  65. break;
  66. case "ExportData":
  67. GridHelper.ulGridToExcel(ultraGrid1, "环形加热炉台账");
  68. break;
  69. case "Close":
  70. this.Close();
  71. break;
  72. }
  73. }
  74. /// <summary>
  75. /// 修改
  76. /// </summary>
  77. private void doSave(String remarkState)
  78. {
  79. this.ultraGrid1.UpdateData();
  80. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  81. if (checkMagRows.Count() == 0)
  82. {
  83. MessageUtil.ShowTips("请选择需要修改的信息!");
  84. return;
  85. }
  86. ArrayList parm = new ArrayList();
  87. foreach (UltraGridRow uRow in checkMagRows)
  88. {
  89. FeedSawResultEntity matZcTity = new FeedSawResultEntity();
  90. matZcTity.JudgeStoveNo = uRow.Cells["JUDGE_STOVE_NO"].Text.ToString();
  91. matZcTity.PlineCode = uRow.Cells["PLINE_CODE"].Text.ToString();
  92. if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("早班"))
  93. {
  94. matZcTity.ColShift = "1";
  95. }
  96. else if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("中班"))
  97. {
  98. matZcTity.ColShift = "2";
  99. }
  100. else if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("夜班"))
  101. {
  102. matZcTity.ColShift = "3";
  103. }
  104. else if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("常白班"))
  105. {
  106. matZcTity.ColShift = "0";
  107. }
  108. else
  109. {
  110. matZcTity.ColShift = uRow.Cells["COL_SHIFT"].Value.ToString();
  111. }
  112. if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("甲"))
  113. {
  114. matZcTity.ColGroup = "1";
  115. }
  116. else if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("乙"))
  117. {
  118. matZcTity.ColGroup = "2";
  119. }
  120. else if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("丙"))
  121. {
  122. matZcTity.ColGroup = "3";
  123. }
  124. else if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("丁"))
  125. {
  126. matZcTity.ColGroup = "4";
  127. }
  128. else
  129. {
  130. matZcTity.ColGroup = uRow.Cells["COL_GROUP"].Value.ToString();
  131. }
  132. matZcTity.StartTime = uRow.Cells["START_TIME"].Text.ToString();
  133. matZcTity.ColUser = uRow.Cells["COL_USER"].Text.ToString();
  134. matZcTity.Remark = "环形炉";
  135. matZcTity.RemarkState = remarkState;
  136. string matTity = JSONFormat.Format(matZcTity);
  137. parm.Add(matTity);
  138. }
  139. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return;
  140. CoreClientParam ccp = new CoreClientParam();
  141. ccp.ServerName = "com.steering.mes.zgmil.report.FrmFeedSaw";
  142. ccp.MethodName = "doSave";
  143. ccp.ServerParams = new object[] { parm };
  144. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  145. if (ccp.ReturnCode != -1)
  146. {
  147. if (ccp.ReturnInfo.Equals("修改成功!"))
  148. {
  149. doQuery();
  150. MessageUtil.ShowTips(ccp.ReturnInfo);
  151. }
  152. else
  153. {
  154. MessageUtil.ShowTips(ccp.ReturnInfo);
  155. }
  156. }
  157. }
  158. private void chkDate_CheckedChanged(object sender, EventArgs e)
  159. {
  160. if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
  161. if (chkBc.Checked) { cmbBc.Enabled = true; } else { cmbBc.Enabled = false; }
  162. if (chkBz.Checked) { cmbBz.Enabled = true; } else { cmbBz.Enabled = false; }
  163. }
  164. private void doQuery()
  165. {
  166. ArrayList list = new ArrayList();
  167. string date = "";
  168. string endDate = "";
  169. string bc = "";
  170. string bz="";
  171. string JudgeStoveNo = "";
  172. if (chkDate.Checked)
  173. {
  174. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  175. {
  176. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  177. return;
  178. }
  179. else
  180. {
  181. date = cmbDate.Value.ToString();
  182. endDate = cmbEndDate.Value.ToString();
  183. }
  184. }
  185. if (chkBz.Checked)
  186. {
  187. if (cmbBz.Text.Trim() == "")
  188. {
  189. //MessageUtil.ShowTips("班组不能为空!");
  190. //return;
  191. bz = "";
  192. }
  193. else
  194. {
  195. bz = cmbBz.Value.ToString();
  196. }
  197. }
  198. if (chkBc.Checked)
  199. {
  200. if (cmbBc.Text.Trim() == "")
  201. {
  202. //MessageUtil.ShowTips("班次不能为空!");
  203. //return;
  204. bc = "";
  205. }
  206. else
  207. {
  208. bc = cmbBc.Value.ToString();
  209. }
  210. }
  211. if (chkJudgeStoveNo.Checked)
  212. {
  213. if (uteJudgeStoveNo.Text.Trim() == "")
  214. {
  215. JudgeStoveNo = "";
  216. }
  217. else
  218. {
  219. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  220. }
  221. }
  222. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmAnnularFurnace.queryMinResult", new Object[] { date, endDate, bc, bz,JudgeStoveNo,plineCodes }, this.ob);
  223. GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
  224. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  225. }
  226. /// <summary>
  227. /// 打印
  228. /// </summary>
  229. private void doExport()
  230. {
  231. string date = "";
  232. string endDate = "";
  233. string bc = "";
  234. string bz = "";
  235. //if (!chkDate.Checked)
  236. //{
  237. // MessageUtil.ShowTips("请选择生产日期!");
  238. // return;
  239. //}
  240. if (!chkBz.Checked)
  241. {
  242. MessageUtil.ShowTips("请选择班组!");
  243. return;
  244. }
  245. if (!chkBc.Checked)
  246. {
  247. MessageUtil.ShowTips("请选择班次!");
  248. return;
  249. }
  250. if (chkDate.Checked)
  251. {
  252. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  253. {
  254. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  255. return;
  256. }
  257. else
  258. {
  259. date = cmbDate.Value.ToString();
  260. endDate = cmbEndDate.Value.ToString();
  261. }
  262. }
  263. if (chkBz.Checked)
  264. {
  265. if (cmbBz.Text.Trim() == "")
  266. {
  267. //MessageUtil.ShowTips("班组不能为空!");
  268. //return;
  269. bz = "";
  270. }
  271. else
  272. {
  273. bz = cmbBz.Value.ToString();
  274. }
  275. }
  276. if (chkBc.Checked)
  277. {
  278. if (cmbBc.Text.Trim() == "")
  279. {
  280. //MessageUtil.ShowTips("班次不能为空!");
  281. //return;
  282. bc = "";
  283. }
  284. else
  285. {
  286. bc = cmbBc.Value.ToString();
  287. }
  288. }
  289. doQuery();
  290. ColUserName colU = new ColUserName();
  291. colU.Ob = this.ob;
  292. colU.PlineCode = plineCode;
  293. colU.ColGroup = bz;
  294. colU.ColOrder = bc;
  295. colU.StationId = "1";
  296. if (plineCode.Equals("C017"))//460
  297. {
  298. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult460.cpt&format=pdf&__bypagesize__=false";
  299. }
  300. else if (plineCode.Equals("C010"))//168
  301. {
  302. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult168.cpt&format=pdf&__bypagesize__=false";
  303. }
  304. else if (plineCode.Equals("C009"))//258
  305. {
  306. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult258.cpt&format=pdf&__bypagesize__=false";
  307. }
  308. else if (plineCode.Equals("C008"))//250
  309. {
  310. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult250.cpt&format=pdf&__bypagesize__=false";
  311. }
  312. else if (plineCode.Equals("C072"))//508
  313. {
  314. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult508.cpt&__bypagesize__=false";
  315. }
  316. colU.StartTim = date;
  317. colU.EndTim = endDate;
  318. colU.StrText = "环形加热炉";
  319. colU.Flag = "0";
  320. colU.ShowDialog();
  321. //string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFurResult.cpt&format=pdf&__bypagesize__=false&SHIFT=" + bc + "&GROUP=" + bz + "&DATE=" + date + "&DATE2=" + endDate + "&PLINECODE=" + plineCode;
  322. //FrmRepExcel fre = new FrmRepExcel(this.ob,url);
  323. ////fre.AutoSize = true;
  324. //fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  325. //fre.Text = "环形加热炉";
  326. //fre.ShowDialog();
  327. }
  328. private string cjkEncode(string p)
  329. {
  330. throw new NotImplementedException();
  331. }
  332. }
  333. }