FrmRollingReport.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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.StlMes.Client.ZGMil.Entity;
  11. using Core.Mes.Client.Comm.Tool;
  12. using System.Collections;
  13. using Core.Mes.Client.Comm.Server;
  14. using Core.Mes.Client.Comm.Control;
  15. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  16. using Infragistics.Win.UltraWinGrid;
  17. using com.steering.mes.zgmil.entity;
  18. using Core.Mes.Client.Comm.Format;
  19. namespace Core.StlMes.Client.ZGMil.Report
  20. {
  21. public partial class FrmRollingReport : FrmBase
  22. {
  23. public FrmRollingReport()
  24. {
  25. InitializeComponent();
  26. this.IsLoadUserView = true;
  27. }
  28. private void FrmRollingReport_Load(object sender, EventArgs e)
  29. {
  30. RegStartTime.Value = DateTime.Parse(DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd 21:00:00"));
  31. RegEndTime.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM-dd 20:59:59"));
  32. EntityHelper.ShowGridCaption<MilRollingResultEntity1>(ultraGrid1.DisplayLayout.Bands[0]);
  33. ClsBaseInfo.SetComboItemHeight(cmbOrder);
  34. ClsBaseInfo.SetComboItemHeight(cmbGroup);
  35. }
  36. /// <summary>
  37. /// 重写基类方法
  38. /// </summary>
  39. /// <param name="sender"></param>
  40. /// <param name="ToolbarKey"></param>
  41. public override void ToolBar_Click(object sender, string ToolbarKey)
  42. {
  43. switch (ToolbarKey)
  44. {
  45. case "Query":
  46. doQueryData();
  47. break;
  48. case "Save":
  49. doSave();
  50. break;
  51. case "Print":
  52. PrintData();
  53. break;
  54. case "ExportData":
  55. GridHelper.ulGridToExcel(ultraGrid1, "连轧台账");
  56. break;
  57. case "Close":
  58. this.Close();
  59. break;
  60. }
  61. }
  62. /// <summary>
  63. /// 打印
  64. /// </summary>
  65. private void PrintData()
  66. {
  67. string bc = "";
  68. string bz = "";
  69. string date = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  70. string date1 = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  71. string plineCode = "";
  72. string departm = "";
  73. string judgeStoveNo = "";
  74. if (chkOrder.Checked && this.cmbOrder.Text != "")
  75. {
  76. bc = cmbOrder.Value.ToString();
  77. }
  78. else
  79. {
  80. MessageUtil.ShowTips("班次需勾选并且不能为空!");
  81. return;
  82. }
  83. if (chkGroup.Checked && this.cmbGroup.Text != "")
  84. {
  85. bz = cmbGroup.Value.ToString();
  86. }
  87. else
  88. {
  89. MessageUtil.ShowTips("班组需勾选并且不能为空!");
  90. return;
  91. }
  92. if (chkJudgeStoveNo.Checked && uteJudgeStoveNo.Text != "")
  93. {
  94. judgeStoveNo = uteJudgeStoveNo.Text;
  95. }
  96. doQueryData();
  97. NativeMethodNew na = new NativeMethodNew(this.ob);
  98. departm = UserInfo.GetDepartment();
  99. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  100. ColUserName colU = new ColUserName();
  101. colU.Ob = this.ob;
  102. colU.PlineCode = plineCode;
  103. colU.ColGroup = cmbGroup.Value.ToString2();
  104. colU.ColOrder = cmbOrder.Value.ToString2();
  105. colU.JudgeStoveNo = judgeStoveNo;
  106. colU.StationId = "3";
  107. if (plineCode.Equals("C017"))
  108. {
  109. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult460.cpt&format=pdf&__bypagesize__=false";
  110. }
  111. else if(plineCode.Equals("C010"))
  112. {
  113. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult168.cpt&format=pdf&__bypagesize__=false";
  114. }
  115. else if (plineCode.Equals("C009"))
  116. {
  117. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult258.cpt&format=pdf&__bypagesize__=false";
  118. }
  119. else if (plineCode.Equals("C008"))
  120. {
  121. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult250.cpt&format=pdf&__bypagesize__=false";
  122. }
  123. else if (plineCode.Equals("C072"))
  124. {
  125. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult508.cpt&__bypagesize__=false";
  126. }
  127. colU.StartTim = date;
  128. colU.EndTim = date1;
  129. colU.StrText = "连轧实绩报表";
  130. colU.Flag = "0";
  131. colU.ShowDialog();
  132. }
  133. /// <summary>
  134. /// 查询
  135. /// </summary>
  136. private void doQueryData()
  137. {
  138. string strRegStart = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  139. string strEndtim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  140. string strOrder = "";
  141. string strGroup = "";
  142. string JudgeStoveNo = "";
  143. string[] plineCode = null;
  144. if (chkOrder.Checked && this.cmbOrder.Text != "")
  145. {
  146. strOrder = this.cmbOrder.Value.ToString();
  147. }
  148. if (chkGroup.Checked && this.cmbGroup.Text != "")
  149. {
  150. strGroup = this.cmbGroup.Value.ToString();
  151. }
  152. if (chkJudgeStoveNo.Checked)
  153. {
  154. if (uteJudgeStoveNo.Text.Trim() == "")
  155. {
  156. JudgeStoveNo = "";
  157. }
  158. else
  159. {
  160. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  161. }
  162. }
  163. NativeMethodNew na = new NativeMethodNew(this.ob);
  164. plineCode = na.GetPCodePline(this.ValidDataPurviewIds);//获取 用户 对应的产线
  165. ArrayList parm = new ArrayList();
  166. parm.Add(strRegStart);
  167. parm.Add(strEndtim);
  168. parm.Add(strOrder);
  169. parm.Add(strGroup);
  170. parm.Add(JudgeStoveNo);
  171. //parm.Add(plineCode);
  172. List<MilRollingResultEntity1> listSource = EntityHelper.GetData<MilRollingResultEntity1>(
  173. "com.steering.mes.zgmil.report.FrmRollingReport.doQueryData", new object[] { parm,plineCode }, this.ob);
  174. MilRollingResultEntity1bindingSource.DataSource = listSource;
  175. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  176. }
  177. /// <summary>
  178. /// 修改
  179. /// </summary>
  180. private void doSave()
  181. {
  182. this.ultraGrid1.UpdateData();
  183. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  184. if (checkMagRows.Count() == 0)
  185. {
  186. MessageUtil.ShowTips("请选择需要修改的信息!");
  187. return;
  188. }
  189. ArrayList parm = new ArrayList();
  190. foreach (UltraGridRow uRow in checkMagRows)
  191. {
  192. MilRollingResultEntity1 Entity1 = (MilRollingResultEntity1)uRow.ListObject;
  193. FeedSawResultEntity matZcTity = new FeedSawResultEntity();
  194. matZcTity.JudgeStoveNo = Entity1.JudgeStoveNo.ToString();
  195. matZcTity.PlineCode = Entity1.PlineCode.ToString();
  196. if (Entity1.ColShift.ToString().Equals("早班"))
  197. {
  198. matZcTity.ColShift = "1";
  199. }
  200. else if (Entity1.ColShift.ToString().Equals("中班"))
  201. {
  202. matZcTity.ColShift = "2";
  203. }
  204. else if (Entity1.ColShift.ToString().Equals("夜班"))
  205. {
  206. matZcTity.ColShift = "3";
  207. }
  208. else if (Entity1.ColShift.ToString().Equals("常白班"))
  209. {
  210. matZcTity.ColShift = "0";
  211. }
  212. else
  213. {
  214. matZcTity.ColShift = Entity1.ColShift.ToString();
  215. }
  216. if (Entity1.ColGroup.ToString().Equals("甲"))
  217. {
  218. matZcTity.ColGroup = "1";
  219. }
  220. else if (Entity1.ColGroup.ToString().Equals("乙"))
  221. {
  222. matZcTity.ColGroup = "2";
  223. }
  224. else if (Entity1.ColGroup.ToString().Equals("丙"))
  225. {
  226. matZcTity.ColGroup = "3";
  227. }
  228. else if (Entity1.ColGroup.ToString().Equals("丁"))
  229. {
  230. matZcTity.ColGroup = "4";
  231. }
  232. else
  233. {
  234. matZcTity.ColGroup = Entity1.ColGroup.ToString();
  235. }
  236. matZcTity.StartTime = Entity1.EndTime.ToString();
  237. matZcTity.ColUser = Entity1.ColUser.ToString();
  238. matZcTity.Remark = "连轧";
  239. string matTity = JSONFormat.Format(matZcTity);
  240. parm.Add(matTity);
  241. }
  242. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return;
  243. CoreClientParam ccp = new CoreClientParam();
  244. ccp.ServerName = "com.steering.mes.zgmil.report.FrmFeedSaw";
  245. ccp.MethodName = "doSave";
  246. ccp.ServerParams = new object[] { parm };
  247. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  248. if (ccp.ReturnCode != -1)
  249. {
  250. if (ccp.ReturnInfo.Equals("修改成功!"))
  251. {
  252. doQueryData();
  253. MessageUtil.ShowTips(ccp.ReturnInfo);
  254. }
  255. else
  256. {
  257. MessageUtil.ShowTips(ccp.ReturnInfo);
  258. }
  259. }
  260. }
  261. private void chkOrder_CheckedChanged(object sender, EventArgs e)
  262. {
  263. this.cmbOrder.Enabled = this.chkOrder.Checked;
  264. }
  265. private void chkGroup_CheckedChanged(object sender, EventArgs e)
  266. {
  267. this.cmbGroup.Enabled = this.chkGroup.Checked;
  268. }
  269. private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e)
  270. {
  271. this.uteJudgeStoveNo.Enabled = this.chkJudgeStoveNo.Checked;
  272. }
  273. }
  274. }