FrmSizingReport.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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 Core.StlMes.Client.ZGMil.Entity;
  10. using CoreFS.CA06;
  11. using System.Collections;
  12. using Core.Mes.Client.Comm.Tool;
  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 FrmSizingReport : FrmBase
  22. {
  23. public FrmSizingReport()
  24. {
  25. InitializeComponent();
  26. this.IsLoadUserView = true;
  27. }
  28. private void FrmSizingReport_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<MilSizingResultEntity1>(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 "DoPrint2":
  58. PrintResult2();
  59. break;
  60. case "Close":
  61. this.Close();
  62. break;
  63. }
  64. }
  65. /// <summary>
  66. /// 打印
  67. /// </summary>
  68. private void PrintData()
  69. {
  70. string bc = "";
  71. string bz = "";
  72. string date = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  73. string date1 = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  74. string plineCode = "";
  75. string departm = "";
  76. string judgeStoveNo = "";
  77. if (chkOrder.Checked && this.cmbOrder.Text != "")
  78. {
  79. bc = cmbOrder.Value.ToString();
  80. }
  81. else
  82. {
  83. MessageUtil.ShowTips("班次需勾选并且不能为空!");
  84. return;
  85. }
  86. if (chkGroup.Checked && this.cmbGroup.Text != "")
  87. {
  88. bz = cmbGroup.Value.ToString();
  89. }
  90. else
  91. {
  92. MessageUtil.ShowTips("班组需勾选并且不能为空!");
  93. return;
  94. }
  95. if (chkJudgeStoveNo.Checked && uteJudgeStoveNo.Text != "")
  96. {
  97. judgeStoveNo = uteJudgeStoveNo.Text;
  98. }
  99. doQueryData();
  100. NativeMethodNew na = new NativeMethodNew(this.ob);
  101. departm = UserInfo.GetDepartment();
  102. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  103. ColUserName colU = new ColUserName();
  104. colU.Ob = this.ob;
  105. colU.PlineCode = plineCode;
  106. colU.ColGroup = cmbGroup.Value.ToString2();
  107. colU.ColOrder = cmbOrder.Value.ToString2();
  108. colU.JudgeStoveNo = judgeStoveNo;
  109. colU.StationId = "5";
  110. if (plineCode.Equals("C017"))
  111. {
  112. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult460.cpt&format=pdf&__bypagesize__=false";
  113. }
  114. else if (plineCode.Equals("C010"))
  115. {
  116. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult168.cpt&format=pdf&__bypagesize__=false";
  117. }
  118. else if (plineCode.Equals("C009"))
  119. {
  120. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult258.cpt&format=pdf&__bypagesize__=false";
  121. }
  122. else if (plineCode.Equals("C008"))
  123. {
  124. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult250.cpt&format=pdf&__bypagesize__=false";
  125. }
  126. else if (plineCode.Equals("C072"))
  127. {
  128. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult508.cpt&__bypagesize__=false";
  129. }
  130. colU.StartTim = date;
  131. colU.EndTim = date1;
  132. colU.StrText = "定径实绩报表";
  133. colU.Flag = "0";
  134. colU.ShowDialog();
  135. }
  136. /// <summary>
  137. /// 查询
  138. /// </summary>
  139. private void doQueryData()
  140. {
  141. string strRegStart = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  142. string strEndTim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  143. string strOrder = "";
  144. string strGroup = "";
  145. string departm = "";
  146. string JudgeStoveNo = "";
  147. string[] plineCode = null;
  148. if (chkOrder.Checked && this.cmbOrder.Text != "")
  149. {
  150. strOrder = this.cmbOrder.Value.ToString();
  151. }
  152. if (chkGroup.Checked && this.cmbGroup.Text != "")
  153. {
  154. strGroup = this.cmbGroup.Value.ToString();
  155. }
  156. if (chkJudgeStoveNo.Checked)
  157. {
  158. if (uteJudgeStoveNo.Text.Trim() == "")
  159. {
  160. JudgeStoveNo = "";
  161. }
  162. else
  163. {
  164. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  165. }
  166. }
  167. NativeMethodNew na = new NativeMethodNew(this.ob);
  168. plineCode = na.GetPCodePline(this.ValidDataPurviewIds);//获取 用户 对应的产线
  169. ArrayList parm = new ArrayList();
  170. parm.Add(strRegStart);
  171. parm.Add(strEndTim);
  172. parm.Add(strOrder);
  173. parm.Add(strGroup);
  174. parm.Add(JudgeStoveNo);
  175. ///parm.Add(plineCode);
  176. List<MilSizingResultEntity1> listSource = EntityHelper.GetData<MilSizingResultEntity1>(
  177. "com.steering.mes.zgmil.report.FrmSizingReport.doQueryData", new object[] { parm, plineCode }, this.ob);
  178. MilSizingResultEntity1bindingSource.DataSource = listSource;
  179. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  180. }
  181. /// <summary>
  182. /// 修改
  183. /// </summary>
  184. private void doSave()
  185. {
  186. this.ultraGrid1.UpdateData();
  187. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  188. if (checkMagRows.Count() == 0)
  189. {
  190. MessageUtil.ShowTips("请选择需要修改的信息!");
  191. return;
  192. }
  193. ArrayList parm = new ArrayList();
  194. foreach (UltraGridRow uRow in checkMagRows)
  195. {
  196. MilSizingResultEntity1 Entity1 = (MilSizingResultEntity1)uRow.ListObject;
  197. FeedSawResultEntity matZcTity = new FeedSawResultEntity();
  198. matZcTity.JudgeStoveNo = Entity1.JudgeStoveNo.ToString();
  199. matZcTity.PlineCode = Entity1.PlineCode.ToString();
  200. if (Entity1.ColShift.ToString().Equals("早班"))
  201. {
  202. matZcTity.ColShift = "1";
  203. }
  204. else if (Entity1.ColShift.ToString().Equals("中班"))
  205. {
  206. matZcTity.ColShift = "2";
  207. }
  208. else if (Entity1.ColShift.ToString().Equals("夜班"))
  209. {
  210. matZcTity.ColShift = "3";
  211. }
  212. else if (Entity1.ColShift.ToString().Equals("常白班"))
  213. {
  214. matZcTity.ColShift = "0";
  215. }
  216. else
  217. {
  218. matZcTity.ColShift = Entity1.ColShift.ToString();
  219. }
  220. if (Entity1.ColGroup.ToString().Equals("甲"))
  221. {
  222. matZcTity.ColGroup = "1";
  223. }
  224. else if (Entity1.ColGroup.ToString().Equals("乙"))
  225. {
  226. matZcTity.ColGroup = "2";
  227. }
  228. else if (Entity1.ColGroup.ToString().Equals("丙"))
  229. {
  230. matZcTity.ColGroup = "3";
  231. }
  232. else if (Entity1.ColGroup.ToString().Equals("丁"))
  233. {
  234. matZcTity.ColGroup = "4";
  235. }
  236. else
  237. {
  238. matZcTity.ColGroup = Entity1.ColGroup.ToString();
  239. }
  240. matZcTity.StartTime = Entity1.EndTime.ToString();
  241. matZcTity.ColUser = Entity1.ColUser.ToString();
  242. matZcTity.Remark = "定径";
  243. string matTity = JSONFormat.Format(matZcTity);
  244. parm.Add(matTity);
  245. }
  246. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return;
  247. CoreClientParam ccp = new CoreClientParam();
  248. ccp.ServerName = "com.steering.mes.zgmil.report.FrmFeedSaw";
  249. ccp.MethodName = "doSave";
  250. ccp.ServerParams = new object[] { parm };
  251. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  252. if (ccp.ReturnCode != -1)
  253. {
  254. if (ccp.ReturnInfo.Equals("修改成功!"))
  255. {
  256. doQueryData();
  257. MessageUtil.ShowTips(ccp.ReturnInfo);
  258. }
  259. else
  260. {
  261. MessageUtil.ShowTips(ccp.ReturnInfo);
  262. }
  263. }
  264. }
  265. private void PrintResult2()
  266. {
  267. string bc = "";
  268. string bz = "";
  269. string date = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  270. string date1 = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  271. string plineCode = "";
  272. string departm = "";
  273. if (chkOrder.Checked && this.cmbOrder.Text != "")
  274. {
  275. bc = cmbOrder.Value.ToString();
  276. }
  277. else
  278. {
  279. MessageUtil.ShowTips("班次需勾选并且不能为空!");
  280. return;
  281. }
  282. if (chkGroup.Checked && this.cmbGroup.Text != "")
  283. {
  284. bz = cmbGroup.Value.ToString();
  285. }
  286. else
  287. {
  288. MessageUtil.ShowTips("班组需勾选并且不能为空!");
  289. return;
  290. }
  291. doQueryData();
  292. NativeMethodNew na = new NativeMethodNew(this.ob);
  293. departm = UserInfo.GetDepartment();
  294. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  295. ColUserName colU = new ColUserName();
  296. colU.Ob = this.ob;
  297. colU.PlineCode = plineCode;
  298. colU.ColGroup = cmbGroup.Value.ToString2();
  299. colU.ColOrder = cmbOrder.Value.ToString2();
  300. colU.StationId = "5";
  301. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResultAlltemp.cpt&format=pdf&format=pdf&__bypagesize__=false";
  302. colU.StartTim = date;
  303. colU.EndTim = date1;
  304. colU.StrText = "定径实绩报表";
  305. colU.Flag = "0";
  306. colU.ShowDialog();
  307. }
  308. private void chkOrder_CheckedChanged(object sender, EventArgs e)
  309. {
  310. this.cmbOrder.Enabled = chkOrder.Checked;
  311. }
  312. private void chkGroup_CheckedChanged(object sender, EventArgs e)
  313. {
  314. this.cmbGroup.Enabled = chkGroup.Checked;
  315. }
  316. private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e)
  317. {
  318. this.uteJudgeStoveNo.Enabled = chkJudgeStoveNo.Checked;
  319. }
  320. }
  321. }