FrmMilSamplingQuality.cs 13 KB

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