QcmZgColligateJudgeApplyCtrl.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Judge.Commons;
  5. using Core.StlMes.Client.Judge.Forms;
  6. using CoreFS.CA06;
  7. using CoreFS.SA06;
  8. using Infragistics.Win;
  9. using Infragistics.Win.UltraWinGrid;
  10. using System;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Windows.Forms;
  14. namespace Core.StlMes.Client.Judge.Controls
  15. {
  16. public partial class QcmZgColligateJudgeApplyCtrl : UserControl
  17. {
  18. private OpeBase _ob;
  19. private JudgeType _judgeType;
  20. private Dal _d;
  21. private string _passInfo;
  22. private string _processCode = "";
  23. private CoreUserInfo _UserInfo;
  24. public QcmZgColligateJudgeApplyCtrl(Control container, OpeBase ob, JudgeType judgeType, string passInfo,
  25. string processCode, CoreUserInfo UserInfo)
  26. {
  27. InitializeComponent();
  28. this._ob = ob;
  29. _passInfo = passInfo;
  30. _processCode = processCode;
  31. _UserInfo = UserInfo;
  32. _judgeType = judgeType;
  33. container.Controls.Add(this);
  34. this.Dock = DockStyle.Fill;
  35. this.BringToFront();
  36. _d = new Dal(ob);
  37. ClsBaseInfo.FillComBaseInfo(ultraComboEditor1, "407401", ob, false);
  38. //判定结果只显示内控合格和不合格。 40740101内控合格 40740102内控不合格
  39. DataTable dt = (DataTable)ultraComboEditor1.DataSource;
  40. for (int i = 0; i < dt.Rows.Count; i++)
  41. {
  42. if (dt.Rows[i]["BASECODE"].ToString() != "40740101"
  43. && dt.Rows[i]["BASECODE"].ToString() != "40740102")
  44. {
  45. dt.Rows[i].Delete();
  46. }
  47. }
  48. dt.AcceptChanges();
  49. ClsBaseInfo.SetComboItemHeight(ultraComboEditor1);
  50. ClsBaseInfo.FillComBaseInfo(ultraComboEditor2, "407402", ob, false);
  51. ClsBaseInfo.FillComBaseInfo(ultraComboEditor3, "407407", ob, false);
  52. ClsBaseInfo.FillComBaseInfo(ultraComboEditor4, "407404", ob, false);
  53. ClsBaseInfo.FillComBaseInfo(ultraComboEditor5, "407406", ob, false);
  54. ClsBaseInfo.FillComBaseInfo(ultraComboEditor6, "4100", ob, false);
  55. if ("admin".Equals(_UserInfo.GetUserName()) && "屈松山".Equals(_UserInfo.GetUserName()) && !"宋丹".Equals(_UserInfo.GetUserName()))
  56. {
  57. ultraComboEditor6.Visible = true;
  58. ultraComboEditor5.Visible = true;
  59. }
  60. else {
  61. ultraComboEditor6.Visible = false;
  62. ultraComboEditor5.Visible = false;
  63. }
  64. ValueList lkFlag = new ValueList();
  65. lkFlag.ValueListItems.Add("0", "正常");
  66. lkFlag.ValueListItems.Add("1", "利库");
  67. lkFlag.ValueListItems.Add("2", "利库");
  68. lkFlag.ValueListItems.Add("3", "销售成品利库");
  69. ultraGrid1.DisplayLayout.Bands[0].Columns["lkFlag"].ValueList = lkFlag;
  70. if(_passInfo.Equals("XS")){
  71. ultraGrid1.DisplayLayout.Bands[0].Columns["Chk"].Header.CheckBoxVisibility = HeaderCheckBoxVisibility.Always;
  72. }
  73. //屏蔽接箍相关字段
  74. if (processCode != "H")
  75. {
  76. ultraGrid1.DisplayLayout.Bands[0].Columns["ifOutDetect"].Hidden = true;
  77. ultraGrid1.DisplayLayout.Bands[0].Columns["ifOutCoat"].Hidden = true;
  78. ultraGrid1.DisplayLayout.Bands[0].Columns["ifOutImpress"].Hidden = true;
  79. ultraGrid1.DisplayLayout.Bands[0].Columns["ifOutBlast"].Hidden = true;
  80. }
  81. else
  82. {
  83. ultraGrid1.DisplayLayout.Bands[0].Columns["chemResultName"].Hidden = true;
  84. ultraGrid1.DisplayLayout.Bands[0].Columns["phyResultName"].Hidden = true;
  85. ultraGrid1.DisplayLayout.Bands[0].Columns["specResultName"].Hidden = true;
  86. ultraGrid1.DisplayLayout.Bands[0].Columns["faceResultName"].Hidden = true;
  87. ultraGrid1.DisplayLayout.Bands[0].Columns["detectResultName"].Hidden = true;
  88. ultraGrid1.DisplayLayout.Bands[0].Columns["waterResultName"].Hidden = true;
  89. ultraGrid1.DisplayLayout.Bands[0].Columns["processResultName"].Hidden = true;
  90. }
  91. if (processCode == "D")
  92. {
  93. ultraGrid1.DisplayLayout.Bands[0].Columns["exitTemp"].Hidden = false;
  94. }
  95. else
  96. {
  97. ultraGrid1.DisplayLayout.Bands[0].Columns["exitTemp"].Hidden = true;
  98. }
  99. if (processCode == "G")
  100. {
  101. ultraGrid1.DisplayLayout.Bands[0].Columns["chemResultName"].Hidden = true;
  102. ultraGrid1.DisplayLayout.Bands[0].Columns["phyResultName"].Hidden = true;
  103. ultraGrid1.DisplayLayout.Bands[0].Columns["specResultName"].Hidden = true;
  104. ultraGrid1.DisplayLayout.Bands[0].Columns["faceResultName"].Hidden = true;
  105. ultraGrid1.DisplayLayout.Bands[0].Columns["detectResultName"].Hidden = true;
  106. ultraGrid1.DisplayLayout.Bands[0].Columns["waterResultName"].Hidden = true;
  107. ultraGrid1.DisplayLayout.Bands[0].Columns["processResultName"].Hidden = true;
  108. }
  109. }
  110. public void QueryBcColligate(string lotNo, string judgeStoveNo, string[] judgeStates, string timeType, string judgeTimeB,
  111. string judgeTimeE, string[] plines, string judgeCondition, string orderMngNo)
  112. {
  113. string orderNo = "";
  114. string orderSeq = "";
  115. string[] mngOrderNos = orderMngNo.Split('/');
  116. if (mngOrderNos.Length >= 2)
  117. {
  118. orderNo = mngOrderNos[0];
  119. orderSeq = mngOrderNos[1];
  120. }
  121. else if (mngOrderNos.Length >= 1)
  122. {
  123. orderNo = mngOrderNos[0];
  124. }
  125. DataTable dt = _d.GetTableByXmlId("QcmZgJugdeApplyDAL.QueryBcColligate", lotNo, judgeStoveNo, judgeStates.Length, judgeStates,
  126. judgeTimeB, judgeTimeE, plines.Length, plines, _processCode, judgeCondition, orderNo, orderSeq, timeType,"");
  127. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  128. GridHelper.CopyDataToDatatable(dt, dataTable2, true);
  129. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "memo", "judgeMemo");
  130. for (int i = dataTable1.Rows.Count-1; i >= 0; i--)
  131. {
  132. DataRow row = dataTable1.Rows[i];
  133. row["actCount"] = dataTable2.Compute("sum(actCount)", " JUDGESTOVENO ='" + row["JUDGESTOVENO"].ToString() + "' and JUGDEAPPLYCODE ='" + row["JUGDEAPPLYCODE"].ToString() + "' and BATCHNO='" + row["BATCHNO"].ToString() + "'");
  134. row["actTheoryWeight"] = dataTable2.Compute("sum(actTheoryWeight)", " JUDGESTOVENO ='" + row["JUDGESTOVENO"].ToString() + "' and JUGDEAPPLYCODE ='" + row["JUGDEAPPLYCODE"].ToString() + "' and BATCHNO='" + row["BATCHNO"].ToString() + "'");
  135. if (dataTable1.Select(" JUDGESTOVENO ='" + row["JUDGESTOVENO"].ToString() + "' and JUGDEAPPLYCODE ='" + row["JUGDEAPPLYCODE"].ToString() + "' and BATCHNO='" + row["BATCHNO"].ToString()+"'").Length > 1)
  136. {
  137. dataTable1.Rows.Remove(row);
  138. }
  139. }
  140. foreach (UltraGridRow row in ultraGrid1.Rows)
  141. {
  142. row.Cells["deliveryStateName"].Activation = Activation.ActivateOnly;
  143. }
  144. }
  145. public void QueryBcQuality(string lotNo, string judgeStoveNo, string[] judgeStates, string judgeTimeB, string judgeTimeE,
  146. string[] plines, string processCode, string judgeCondition, string orderMngNo, string timeType)
  147. {
  148. _processCode = processCode;
  149. string orderNo = "";
  150. string orderSeq = "";
  151. string[] mngOrderNos = orderMngNo.Split('/');
  152. if (mngOrderNos.Length == 1)
  153. {
  154. orderNo = mngOrderNos[0];
  155. }
  156. else if (mngOrderNos.Length == 2)
  157. {
  158. orderNo = mngOrderNos[0];
  159. orderSeq = mngOrderNos[1];
  160. }
  161. DataTable dt = _d.GetTableByXmlId("QcmZgJugdeApplyDAL.QueryBcQuality", lotNo, judgeStoveNo, judgeStates.Length, judgeStates,
  162. judgeTimeB, judgeTimeE, plines.Length, plines, processCode, judgeCondition, orderNo, orderSeq, timeType);
  163. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  164. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "memo", "judgeMemo");
  165. }
  166. public void QueryBcUrgent(string lotNo, string judgeStoveNo, string judgeState, string judgeTimeB,
  167. string judgeTimeE, string[] plines, string processCode, string judgeCondition,
  168. string orderNo, string orderSeq, string uTimeType)
  169. {
  170. _processCode = processCode;
  171. DataTable dt = _d.GetTableByXmlId("QcmZgJugdeApplyDAL.QueryBcUrgent", lotNo, judgeStoveNo, judgeState,
  172. judgeTimeB, judgeTimeE, plines.Length, plines, processCode,
  173. judgeCondition, orderNo, orderSeq, uTimeType);
  174. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  175. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "memo", "judgeMemo");
  176. foreach (UltraGridRow row in ultraGrid1.Rows)
  177. {
  178. row.Cells["deliveryStateName"].Activation = Activation.ActivateOnly;
  179. }
  180. }
  181. public void Clear()
  182. {
  183. dataTable1.Clear();
  184. }
  185. private void ultraTextEditor2_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  186. {
  187. PopupTextBox popupText = new PopupTextBox(ultraGrid1.ActiveCell.Value.ToString(), 2000);
  188. if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  189. {
  190. ultraGrid1.ActiveCell.Value = popupText.TextInfo.Trim();
  191. ultraGrid1.ActiveRow.Update();
  192. }
  193. }
  194. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  195. {
  196. String oldDeliveryState = ultraGrid1.ActiveCell.Value.ToString();
  197. e.Cell.Row.Update();
  198. if (e.Cell.Row.Cells["Chk"].Value.ToString().ToUpper() == "TRUE")
  199. {
  200. e.Cell.Row.Cells["deliveryStateName"].Activation = Activation.AllowEdit;
  201. }
  202. else
  203. {
  204. e.Cell.Row.Cells["deliveryStateName"].Activation = Activation.ActivateOnly;
  205. }
  206. if (e.Cell.Column.Key == "deliveryStateName")
  207. {
  208. updateDeliveryStateName(oldDeliveryState);
  209. }
  210. if (e.Cell.Column.Key == "Chk" && _passInfo == "")
  211. {
  212. UltraGridRow chkRow = e.Cell.Row;
  213. foreach (UltraGridRow row in ultraGrid1.Rows)
  214. {
  215. if (row.Cells["Chk"].Value.ToString() == "True" && row != chkRow)
  216. {
  217. row.Cells["Chk"].Value = "False";
  218. row.Update();
  219. }
  220. }
  221. }
  222. }
  223. private void updateDeliveryStateName(String oldDeliveryState)
  224. {
  225. ultraGrid1.ActiveCell.Value.ToString();
  226. var row = ultraGrid1.ActiveRow;
  227. string judgeStoveNo = row.Cells["judgeStoveNo"].Value.ToString();
  228. string batchNo = row.Cells["batchNo"].Value.ToString();
  229. String[] parm = new String[] { judgeStoveNo, batchNo, _processCode, ultraGrid1.ActiveCell.Value.ToString(), oldDeliveryState, _judgeType.ToString(), _UserInfo.GetUserName(), "id", "5" };
  230. ServerHelper.SetData("com.steering.pss.judge.Bll.BllZcColligateJudge.updateDeliveryStateZG", new object[] { parm }, _ob);
  231. ultraGrid1.ActiveRow.Update();
  232. }
  233. private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  234. {
  235. try
  236. {
  237. this.Cursor = Cursors.WaitCursor;
  238. var row = ultraGrid1.ActiveRow;
  239. if (row == null)
  240. {
  241. MessageUtil.ShowWarning("请选择一行记录!");
  242. return;
  243. }
  244. string judgeApplyCode = row.Cells["jugdeApplyCode"].Value.ToString();
  245. string judgeStoveNo = row.Cells["judgeStoveNo"].Value.ToString();
  246. string batchNo = row.Cells["batchNo"].Value.ToString();
  247. string passType = "0";
  248. if (ultraGrid1.ActiveCell.Column.Key == "urgentAuditResult")
  249. {
  250. passType = "1";
  251. }
  252. //string passType = passInfo == "Qu"
  253. DataRow drPassApply = _d.GetRowByXmlId("JdgQcmBcPassApplyDAL.queryByBatchNo", judgeApplyCode, judgeStoveNo, batchNo, _processCode, passType);
  254. if (drPassApply == null ||
  255. drPassApply["type"].ToString() == "0" && drPassApply["auditResult"].ToString() == "")
  256. {
  257. MessageUtil.ShowWarning("没有不合格品评审单可查看!");
  258. return;
  259. }
  260. else
  261. {
  262. //if (drPassApply["type"].ToString() == "1")
  263. //{
  264. // MessageUtil.ShowWarning("紧急放行!");
  265. // return;
  266. //}
  267. }
  268. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepZGRejectDisposalList.cpt" + "&JUDGE_STOVE_NO=" + judgeStoveNo
  269. + "&BATCH_NO=" + batchNo + "&JUGDE_APPLY_CODE=" + judgeApplyCode + "&PROCESS_CODE=" + _processCode + "&TYPE=" + passType;
  270. FrmOrderRepExcel fBug = new FrmOrderRepExcel(_ob, strurl);
  271. fBug.AutoSize = true;
  272. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  273. fBug.WindowState = FormWindowState.Maximized;
  274. fBug.Text = "不合格品评审处置单";
  275. fBug.Show();
  276. }
  277. finally
  278. {
  279. this.Cursor = Cursors.Default;
  280. }
  281. }
  282. private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
  283. {
  284. Color red = Color.FromArgb(255, 106, 106);
  285. if (e.Row.GetValue("phyResultCode") == "40740202")
  286. {
  287. e.Row.Cells["phyResultName"].Appearance.BackColor = red;
  288. }
  289. if (e.Row.GetValue("chemResultCode") == "40740102")
  290. {
  291. e.Row.Cells["chemResultName"].Appearance.BackColor = red;
  292. }
  293. if (e.Row.GetValue("resultCode") == "40740704")
  294. {
  295. e.Row.Cells["resultName"].Appearance.BackColor = red;
  296. }
  297. }
  298. private void ultraTextEditor3_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  299. {
  300. if (e.Button.Key.Equals("bj")) {
  301. //if (!"admin".Equals(_UserInfo.GetUserName()) && !"屈松山".Equals(_UserInfo.GetUserName()))
  302. //{
  303. // throw new Exception("您没有该权限!");
  304. //}
  305. PopupTextBox popupText = new PopupTextBox(ultraGrid1.ActiveCell.Value.ToString(), 2000);
  306. if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  307. {
  308. var row = ultraGrid1.ActiveRow;
  309. string judgeStoveNo = row.Cells["judgeStoveNo"].Value.ToString();
  310. string batchNo = row.Cells["batchNo"].Value.ToString();
  311. String[] parm = new String[] { judgeStoveNo, batchNo, _processCode, popupText.TextInfo.Trim(), ultraGrid1.ActiveCell.Value.ToString(), _judgeType.ToString(), _UserInfo.GetUserName(), "id" ,"2"};
  312. ServerHelper.SetData("com.steering.pss.judge.Bll.BllZcColligateJudge.updateLotNoGroup", new object[] { parm }, _ob);
  313. ultraGrid1.ActiveCell.Value = popupText.TextInfo.Trim();
  314. ultraGrid1.ActiveRow.Update();
  315. }
  316. return;
  317. }
  318. LotNoGroupInfoQueryFrm frm = new LotNoGroupInfoQueryFrm(ultraGrid1.GetActiveRowValue("lotNo"), _d.Ob);
  319. frm.ShowDialog();
  320. }
  321. private void ultraTextEditor4_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  322. {
  323. //if (!"admin".Equals(_UserInfo.GetUserName()) && !"屈松山".Equals(_UserInfo.GetUserName()))
  324. //{
  325. // throw new Exception("您没有该权限!");
  326. //}
  327. PopupTextBox popupText = new PopupTextBox(ultraGrid1.ActiveCell.Value.ToString(), 2000);
  328. if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  329. {
  330. var row = ultraGrid1.ActiveRow;
  331. string judgeStoveNo = row.Cells["judgeStoveNo"].Value.ToString();
  332. string batchNo = row.Cells["batchNo"].Value.ToString();
  333. String[] parm = new String[] { judgeStoveNo, batchNo, _processCode, popupText.TextInfo.Trim(), ultraGrid1.ActiveCell.Value.ToString(), _judgeType.ToString(), _UserInfo.GetUserName(), "id" ,"1"};
  334. ServerHelper.SetData("com.steering.pss.judge.Bll.BllZcColligateJudge.updateLotNo", new object[] { parm }, _ob);
  335. ultraGrid1.ActiveCell.Value = popupText.TextInfo.Trim();
  336. ultraGrid1.ActiveRow.Update();
  337. }
  338. }
  339. private void ultraTextCic_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  340. {
  341. if (!"admin".Equals(_UserInfo.GetUserName()) && !"屈松山".Equals(_UserInfo.GetUserName()) && !"宋丹".Equals(_UserInfo.GetUserName()))
  342. {
  343. throw new Exception("您没有该权限!");
  344. }
  345. PopupTextBox popupText = new PopupTextBox(ultraGrid1.ActiveCell.Value.ToString(), 2000);
  346. if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  347. {
  348. var row = ultraGrid1.ActiveRow;
  349. string judgeStoveNo = row.Cells["judgeStoveNo"].Value.ToString();
  350. string batchNo = row.Cells["batchNo"].Value.ToString();
  351. String[] parm = new String[] { judgeStoveNo, batchNo, _processCode, popupText.TextInfo.Trim(), ultraGrid1.ActiveCell.Value.ToString(), _judgeType.ToString(), _UserInfo.GetUserName(), "id", "3" };
  352. ServerHelper.SetData("com.steering.pss.judge.Bll.BllZcColligateJudge.updateCic", new object[] { parm }, _ob);
  353. ultraGrid1.ActiveCell.Value = popupText.TextInfo.Trim();
  354. ultraGrid1.ActiveRow.Update();
  355. }
  356. }
  357. private void ultraTextPic_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  358. {
  359. if (!"admin".Equals(_UserInfo.GetUserName()) && !"屈松山".Equals(_UserInfo.GetUserName()) && !"宋丹".Equals(_UserInfo.GetUserName()))
  360. {
  361. throw new Exception("您没有该权限!");
  362. }
  363. PopupTextBox popupText = new PopupTextBox(ultraGrid1.ActiveCell.Value.ToString(), 40);
  364. if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  365. {
  366. var row = ultraGrid1.ActiveRow;
  367. string judgeStoveNo = row.Cells["judgeStoveNo"].Value.ToString();
  368. string batchNo = row.Cells["batchNo"].Value.ToString();
  369. String[] parm = new String[] { judgeStoveNo, batchNo, _processCode, popupText.TextInfo.Trim(), ultraGrid1.ActiveCell.Value.ToString(), _judgeType.ToString(), _UserInfo.GetUserName(), "id", "4" };
  370. ServerHelper.SetData("com.steering.pss.judge.Bll.BllZcColligateJudge.updatePic", new object[] { parm }, _ob);
  371. ultraGrid1.ActiveCell.Value = popupText.TextInfo.Trim();
  372. ultraGrid1.ActiveRow.Update();
  373. }
  374. }
  375. }
  376. }