FrmFeedSaw.cs 13 KB

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