FrmStraighten.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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 FrmStraighten : FrmBase
  24. {
  25. private string departm = "";
  26. private string plineCode = "";
  27. private string[] plineCodes = { };
  28. public FrmStraighten()
  29. {
  30. InitializeComponent();
  31. this.IsLoadUserView = true;
  32. }
  33. private void FrmStraighten_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.ToString("yyyy-MM-dd 20:59:59"));
  41. cmbDate.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 21:00:00"));
  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 "Export":
  61. doExport();
  62. break;
  63. case "DoExport":
  64. doExport2();
  65. break;
  66. case "Close":
  67. this.Close();
  68. break;
  69. }
  70. }
  71. private void chkDate_CheckedChanged(object sender, EventArgs e)
  72. {
  73. if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
  74. if (chkBc.Checked) { cmbBc.Enabled = true; } else { cmbBc.Enabled = false; }
  75. if (chkBz.Checked) { cmbBz.Enabled = true; } else { cmbBz.Enabled = false; }
  76. if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
  77. }
  78. private void doQuery()
  79. {
  80. ArrayList list = new ArrayList();
  81. string date = "";
  82. string endDate = "";
  83. string bc = "";
  84. string bz = "";
  85. string JudgeStoveNo = "";
  86. if (chkDate.Checked)
  87. {
  88. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  89. {
  90. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  91. return;
  92. }
  93. else
  94. {
  95. date = cmbDate.Value.ToString();
  96. endDate = cmbEndDate.Value.ToString();
  97. }
  98. }
  99. if (chkBz.Checked)
  100. {
  101. if (cmbBz.Text.Trim() == "")
  102. {
  103. // MessageUtil.ShowTips("班组不能为空!");
  104. // return;
  105. bz = "";
  106. }
  107. else
  108. {
  109. bz = cmbBz.Value.ToString();
  110. }
  111. }
  112. if (chkBc.Checked)
  113. {
  114. if (cmbBc.Text.Trim() == "")
  115. {
  116. //MessageUtil.ShowTips("班次不能为空!");
  117. //return;
  118. bc = "";
  119. }
  120. else
  121. {
  122. bc = cmbBc.Value.ToString();
  123. }
  124. }
  125. if (chkJudgeStoveNo.Checked)
  126. {
  127. if (uteJudgeStoveNo.Text.Trim() == "")
  128. {
  129. JudgeStoveNo = "";
  130. }
  131. else
  132. {
  133. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  134. }
  135. }
  136. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmStraighten.queryMinResult", new Object[] { date, endDate, bc, bz,JudgeStoveNo, plineCodes }, this.ob);
  137. GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
  138. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  139. }
  140. /// <summary>
  141. /// 修改
  142. /// </summary>
  143. private void doSave()
  144. {
  145. this.ultraGrid1.UpdateData();
  146. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  147. if (checkMagRows.Count() == 0)
  148. {
  149. MessageUtil.ShowTips("请选择需要修改的信息!");
  150. return;
  151. }
  152. ArrayList parm = new ArrayList();
  153. foreach (UltraGridRow uRow in checkMagRows)
  154. {
  155. FeedSawResultEntity matZcTity = new FeedSawResultEntity();
  156. matZcTity.JudgeStoveNo = uRow.Cells["JUDGE_STOVE_NO"].Text.ToString();
  157. matZcTity.PlineCode = uRow.Cells["PLINE_CODE"].Text.ToString();
  158. if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("早班"))
  159. {
  160. matZcTity.ColShift = "1";
  161. }
  162. else if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("中班"))
  163. {
  164. matZcTity.ColShift = "2";
  165. }
  166. else if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("夜班"))
  167. {
  168. matZcTity.ColShift = "3";
  169. }
  170. else if (uRow.Cells["COL_SHIFT"].Value.ToString().Equals("常白班"))
  171. {
  172. matZcTity.ColShift = "0";
  173. }
  174. else
  175. {
  176. matZcTity.ColShift = uRow.Cells["COL_SHIFT"].Value.ToString();
  177. }
  178. if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("甲"))
  179. {
  180. matZcTity.ColGroup = "1";
  181. }
  182. else if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("乙"))
  183. {
  184. matZcTity.ColGroup = "2";
  185. }
  186. else if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("丙"))
  187. {
  188. matZcTity.ColGroup = "3";
  189. }
  190. else if (uRow.Cells["COL_GROUP"].Value.ToString().Equals("丁"))
  191. {
  192. matZcTity.ColGroup = "4";
  193. }
  194. else
  195. {
  196. matZcTity.ColGroup = uRow.Cells["COL_GROUP"].Value.ToString();
  197. }
  198. matZcTity.StartTime = uRow.Cells["START_TIME"].Text.ToString();
  199. matZcTity.ColUser = uRow.Cells["COL_USER"].Text.ToString();
  200. matZcTity.Remark = "矫直";
  201. string matTity = JSONFormat.Format(matZcTity);
  202. parm.Add(matTity);
  203. }
  204. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return;
  205. CoreClientParam ccp = new CoreClientParam();
  206. ccp.ServerName = "com.steering.mes.zgmil.report.FrmFeedSaw";
  207. ccp.MethodName = "doSave";
  208. ccp.ServerParams = new object[] { parm };
  209. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  210. if (ccp.ReturnCode != -1)
  211. {
  212. if (ccp.ReturnInfo.Equals("修改成功!"))
  213. {
  214. doQuery();
  215. MessageUtil.ShowTips(ccp.ReturnInfo);
  216. }
  217. else
  218. {
  219. MessageUtil.ShowTips(ccp.ReturnInfo);
  220. }
  221. }
  222. }
  223. /// <summary>
  224. /// 导出
  225. /// </summary>
  226. private void doExport2()
  227. {
  228. GridHelper.ulGridToExcel(ultraGrid1, "矫直台账");
  229. }
  230. /// <summary>
  231. /// 打印
  232. /// </summary>
  233. private void doExport()
  234. {
  235. string date = "";
  236. string endDate = "";
  237. string bc = "";
  238. string bz = "";
  239. string judgeStoveNo = "";
  240. //if (!chkDate.Checked)
  241. //{
  242. // MessageUtil.ShowTips("请选择生产日期!");
  243. // return;
  244. //}
  245. if (!chkBz.Checked)
  246. {
  247. MessageUtil.ShowTips("请选择班组!");
  248. return;
  249. }
  250. if (!chkBc.Checked)
  251. {
  252. MessageUtil.ShowTips("请选择班次!");
  253. return;
  254. }
  255. if (chkDate.Checked)
  256. {
  257. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  258. {
  259. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  260. return;
  261. }
  262. else
  263. {
  264. date = cmbDate.Value.ToString();
  265. endDate = cmbEndDate.Value.ToString();
  266. }
  267. }
  268. if (chkBz.Checked)
  269. {
  270. if (cmbBz.Text.Trim() == "")
  271. {
  272. //MessageUtil.ShowTips("班组不能为空!");
  273. //return;
  274. bz="";
  275. }
  276. else
  277. {
  278. bz = cmbBz.Value.ToString();
  279. }
  280. }
  281. if (chkBc.Checked)
  282. {
  283. if (cmbBc.Text.Trim() == "")
  284. {
  285. //MessageUtil.ShowTips("班次不能为空!");
  286. //return;
  287. bc = "";
  288. }
  289. else
  290. {
  291. bc = cmbBc.Value.ToString();
  292. }
  293. }
  294. if (chkJudgeStoveNo.Checked && uteJudgeStoveNo.Text != "")
  295. {
  296. judgeStoveNo = uteJudgeStoveNo.Text;
  297. }
  298. doQuery();
  299. ColUserName colU = new ColUserName();
  300. colU.Ob = this.ob;
  301. colU.PlineCode = plineCode;
  302. colU.ColGroup = bz;
  303. colU.ColOrder = bc;
  304. colU.JudgeStoveNo = judgeStoveNo;
  305. colU.StationId = "7";
  306. if (plineCode.Equals("C017"))
  307. {
  308. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilStraighteningResult460.cpt&format=pdf&__bypagesize__=false";
  309. }
  310. else if (plineCode.Equals("C010"))
  311. {
  312. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilStraighteningResult168.cpt&format=pdf&__bypagesize__=false";
  313. }
  314. else if (plineCode.Equals("C009"))
  315. {
  316. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilStraighteningResult258.cpt&format=pdf&__bypagesize__=false";
  317. }
  318. else if (plineCode.Equals("C008"))
  319. {
  320. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilStraighteningResult250.cpt&format=pdf&__bypagesize__=false";
  321. }
  322. else if (plineCode.Equals("C072"))
  323. {
  324. colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilStraighteningResult508.cpt&__bypagesize__=false";
  325. }
  326. //colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilStraighteningResult.cpt&format=pdf&__bypagesize__=false";
  327. colU.StartTim = date;
  328. colU.EndTim = endDate;
  329. colU.StrText = "矫直报表";
  330. colU.Flag = "0";
  331. colU.ShowDialog();
  332. //string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilStraighteningResult.cpt&__bypagesize__=false&SHIFT=" + bc + "&GROUP=" + bz + "&DATE=" + date + "&DATE2=" + endDate + "&PLINECODE=" + plineCode;
  333. //FrmRepExcel fre = new FrmRepExcel(this.ob,url);
  334. ////fre.AutoSize = true;
  335. //fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  336. //fre.Text = "管排锯台账";
  337. //fre.ShowDialog();
  338. }
  339. }
  340. }