QcmJhyPhySplineCtrl.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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 Infragistics.Win;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Windows.Forms;
  14. namespace Core.StlMes.Client.Judge.Controls
  15. {
  16. public partial class QcmJhyPhySplineCtrl : UserControl
  17. {
  18. private Dal _d;
  19. private string _frmFlag = "";
  20. public QcmJhyPhySplineCtrl(string frmFlag, string deptId, Control container, OpeBase ob)
  21. {
  22. InitializeComponent();
  23. _frmFlag = frmFlag;
  24. if (frmFlag == "phy")
  25. {
  26. ultraGrid1.DisplayLayout.Bands[0].Columns["sampleId"].Hidden = true;
  27. ultraGrid1.DisplayLayout.Bands[0].Columns["lotNo"].Hidden = true;
  28. ultraGrid1.DisplayLayout.Bands[0].Columns["lotNoGroup"].Hidden = true;
  29. ultraGrid1.DisplayLayout.Bands[0].Columns["judgeStoveNo"].Hidden = true;
  30. ultraGrid1.DisplayLayout.Bands[0].Columns["processDesc"].Hidden = true;
  31. ultraGrid1.DisplayLayout.Bands[0].Columns["descCount"].Hidden = true;
  32. }
  33. else
  34. {
  35. if (frmFlag == "bc")
  36. {
  37. ultraGrid1.DisplayLayout.Bands[0].Columns["processDesc"].Hidden = true;
  38. }
  39. }
  40. if (deptId == "phy")
  41. {
  42. ultraGrid1.DisplayLayout.Bands[0].Columns["chk"].Hidden = false;
  43. }
  44. else
  45. {
  46. ultraGrid1.DisplayLayout.Bands[0].Columns["chk"].Hidden = true;
  47. }
  48. container.Controls.Add(this);
  49. this.Dock = DockStyle.Top;
  50. _d = new Dal(ob);
  51. ClsBaseInfo.SetComboItemHeight(ultraComboEditor1);
  52. ValueList listResult = new ValueList();
  53. listResult.ValueListItems.Add("0", "系统判定");
  54. listResult.ValueListItems.Add("1", "人工判定");
  55. ultraGrid1.DisplayLayout.Bands[0].Columns["resultSource"].ValueList = listResult;
  56. ValueList listResample = new ValueList();
  57. listResample.ValueListItems.Add("0", "否");
  58. listResample.ValueListItems.Add("1", "是");
  59. ultraGrid1.DisplayLayout.Bands[0].Columns["applyResample"].ValueList = listResample;
  60. ValueList listCycles = new ValueList();
  61. listCycles.ValueListItems.Add("0", "否");
  62. listCycles.ValueListItems.Add("1", "是");
  63. ultraGrid1.DisplayLayout.Bands[0].Columns["cyclesFlag"].ValueList = listCycles;
  64. ultraGrid1.DisplayLayout.Bands[0].Override.AllowDelete = DefaultableBoolean.False;
  65. ValueList listCraftSource = new ValueList();
  66. listCraftSource.ValueListItems.Add("0", "生产样");
  67. listCraftSource.ValueListItems.Add("1", "首日检");
  68. ultraGrid1.DisplayLayout.Bands[0].Columns["craftSource"].ValueList = listCraftSource;
  69. ultraGrid1.DisplayLayout.Bands[0].Override.AllowDelete = DefaultableBoolean.False;
  70. ValueList listIsMain = new ValueList();
  71. listIsMain.ValueListItems.Add("0", "否");
  72. listIsMain.ValueListItems.Add("1", "是");
  73. ultraGrid1.DisplayLayout.Bands[0].Columns["isMain"].ValueList = listIsMain;
  74. ultraGrid1.DisplayLayout.Bands[0].Override.AllowDelete = DefaultableBoolean.False;
  75. }
  76. public void QueryLg(string ordLnPk, string ordLnDlyPk, string craftSeq, string mscPline, string stoveNo, string lgJudgeStoveNo, string cic, string zcApplyCode,
  77. string zcJudgeStoveNo, string zcBatchNo, string zcIsAllScrap, bool clearData)
  78. {
  79. CoreClientParam ccp = _d.Set("com.steering.pss.judge.Bll.BllRolledTubePhyJudge.getConsignDetailLg",
  80. ordLnPk, craftSeq, stoveNo, lgJudgeStoveNo, cic, zcApplyCode, zcJudgeStoveNo, zcBatchNo, zcIsAllScrap);
  81. if (ccp.ReturnInfo.ToString2() != "")
  82. {
  83. MessageUtil.ShowWarning(ccp.ReturnInfo.ToString2());
  84. }
  85. DataTable dt = JsonHelper.toTable(ccp.ReturnObject.ToString2());
  86. if (dt.Rows.Count == 0) return;
  87. GridHelper.CopyDataToDatatable(dt, dataTable1, clearData);
  88. foreach (DataRow dr in dataTable1.Rows)
  89. {
  90. if (dr["ordLnPk"].ToString() != "") continue;
  91. dr["ordLnPk"] = ordLnPk;
  92. dr["ordLnDlyPk"] = ordLnDlyPk;
  93. dr["craftSeq"] = craftSeq;
  94. dr["mscPline"] = mscPline;
  95. dr["stoveNo"] = stoveNo;
  96. }
  97. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "stdMemo");
  98. ultraGrid1.DisplayLayout.Bands[0].Columns["oldJudgeStoveNo"].Hidden = true;
  99. ultraGrid1.DisplayLayout.Bands[0].Columns["oldBatchNo"].Hidden = true;
  100. ultraGrid1.DisplayLayout.Bands[0].Columns["isMain"].Hidden = true;
  101. foreach (var row in ultraGrid1.Rows)
  102. {
  103. GridEdite(row);
  104. if (row.GetValue("resultSource") == "")
  105. {
  106. row.Cells["chk"].Value = DBNull.Value;
  107. row.Cells["chk"].Activation = Activation.ActivateOnly;
  108. row.Update();
  109. }
  110. else
  111. {
  112. //if (row.GetValue("resultSource") == "0")
  113. //{
  114. // if (row.GetValue("nkResult") != "" && row.GetValue("jfResult") != "")
  115. // {
  116. // row.Cells["chk"].Value = DBNull.Value;
  117. // row.Cells["chk"].Activation = Activation.ActivateOnly;
  118. // row.Update();
  119. // }
  120. //}
  121. }
  122. }
  123. }
  124. public static string GetLgJudgeStoveNo(string loadJudgeStoveNo, OpeBase ob)
  125. {
  126. string lgJudgeStoveNo = loadJudgeStoveNo;
  127. Dal d = new Dal(ob);
  128. DataRow drLgJudge = d.GetRowByXmlId("QcmLgJudgeDAL.queryByJudgeStoveNo", loadJudgeStoveNo, "B");
  129. if (drLgJudge == null)
  130. {
  131. DataRow drGpChange = d.GetRowByXmlId("JdgQcmGpJudgeChange.getJudgeStoveNo", loadJudgeStoveNo, "B");
  132. if (drGpChange != null)
  133. {
  134. lgJudgeStoveNo = drGpChange["judgeStoveNo"].ToString();
  135. }
  136. }
  137. return lgJudgeStoveNo;
  138. }
  139. public void QueryColligate(string applyCode, string stoveNo, string judgeStoveNo, string batchNo, string mscPline, string cic, string pic,
  140. string ordLnPk, string ordLnDlyPk, string craftSeq, string proOrdLnPk, string zcIsAllScap, string[] phyCodeMins,
  141. string zcApplyCode, string zcJudgeStoveNo, string zcBatchNo, bool clearData)
  142. {
  143. CoreClientParam ccp = _d.Set("com.steering.pss.judge.Bll.BllRolledTubePhyJudge.getConsignDetailColligate", applyCode, judgeStoveNo, batchNo,
  144. mscPline, cic, pic, ordLnPk, ordLnDlyPk, craftSeq, proOrdLnPk, phyCodeMins.ToList(), zcIsAllScap, zcApplyCode, zcJudgeStoveNo,
  145. zcBatchNo, _frmFlag );
  146. if (ccp.ReturnInfo.ToString2() != "")
  147. {
  148. MessageUtil.ShowWarning(ccp.ReturnInfo.ToString2());
  149. return;
  150. }
  151. DataTable dt = JsonHelper.toTable(ccp.ReturnObject.ToString2());
  152. if (dt == null || dt.Rows.Count == 0) return;
  153. dt.DefaultView.Sort = "processCode, craftSource desc, judgeStoveNo, batchNo, isMain desc, oldJudgeStoveNo, oldBatchNo, phyNameMin, sampleNo";
  154. DataTable dtSort = dt.DefaultView.ToTable();
  155. GridHelper.CopyDataToDatatable(dtSort, dataTable1, clearData);
  156. foreach (DataRow dr in dataTable1.Rows)
  157. {
  158. if (dr["ordLnPk"].ToString() != "") continue;
  159. dr["ordLnPk"] = ordLnPk;
  160. dr["ordLnDlyPk"] = ordLnDlyPk;
  161. dr["craftSeq"] = craftSeq;
  162. dr["mscPline"] = mscPline;
  163. }
  164. ForUltraGrid(zcIsAllScap, ordLnDlyPk);//处理表格
  165. }
  166. public void QueryPhy(string checkNo, string ordLnPk, string ordLnDlyPk, string processCode, string craftSeq, string mscPline,
  167. string cic, string pic, string craftProcess, string[] phyCodeMins)
  168. {
  169. CoreClientParam ccp = _d.Set("com.steering.pss.judge.Bll.BllRolledTubePhyJudge.getConsignDetailPhy", checkNo, ordLnPk,
  170. processCode, craftSeq, mscPline, cic, pic, craftProcess, phyCodeMins.ToList());
  171. if (ccp.ReturnInfo.ToString2() != "")
  172. {
  173. MessageUtil.ShowWarning(ccp.ReturnInfo.ToString2());
  174. return;
  175. }
  176. DataTable dt = JsonHelper.toTable(ccp.ReturnObject.ToString2());
  177. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  178. if (dt.Rows.Count == 0) return;
  179. dataTable1.DefaultView.Sort = "processCode, craftSource desc, judgeStoveNo, batchNo, isMain desc, oldJudgeStoveNo, oldBatchNo, phyNameMin, sampleNo";
  180. DataTable dtSort = dataTable1.DefaultView.ToTable();
  181. GridHelper.CopyDataToDatatable(dtSort, dataTable1, true);
  182. foreach (DataRow dr in dataTable1.Rows)
  183. {
  184. if (dr["ordLnPk"].ToString() != "") continue;
  185. dr["ordLnPk"] = ordLnPk;
  186. dr["ordLnDlyPk"] = ordLnDlyPk;
  187. dr["craftSeq"] = craftSeq;
  188. dr["mscPline"] = mscPline;
  189. }
  190. ForUltraGrid("", "");//处理表格
  191. }
  192. private void ForUltraGrid(string isAllScrap, string zcOrdLnDlyPk)
  193. {
  194. // if (isAllScrap == "4" || _frmFlag == "phy" || zcOrdLnDlyPk.StartsWith("ZZB"))
  195. // {
  196. // ultraGrid1.DisplayLayout.Bands[0].Columns["chk"].Hidden = false;
  197. // }
  198. // else
  199. // {
  200. // ultraGrid1.DisplayLayout.Bands[0].Columns["chk"].Hidden = true;
  201. // }
  202. bool isGroup = false;//是否组炉炉号 (有检验编号以P开头的就是)
  203. foreach (var row in ultraGrid1.Rows)
  204. {
  205. GridEdite(row);
  206. if (row.GetValue("sampleId").StartsWith("P"))
  207. {
  208. isGroup = true;
  209. }
  210. //if (row.GetValue("resultSource") == "")
  211. //{
  212. // row.Cells["chk"].Value = DBNull.Value;
  213. // row.Cells["chk"].Activation = Activation.ActivateOnly;
  214. // row.Update();
  215. //}
  216. //else
  217. //{
  218. // if (row.GetValue("resultSource") == "0" && !row.GetValue("phyNameMin").Contains("冲击试验"))
  219. // {
  220. // if (row.GetValue("nkResult") != "" && row.GetValue("jfResult") != "")
  221. // {
  222. // row.Cells["chk"].Value = DBNull.Value;
  223. // row.Cells["chk"].Activation = Activation.ActivateOnly;
  224. // row.Update();
  225. // }
  226. // }
  227. //}
  228. }
  229. if (isGroup)
  230. {
  231. ultraGrid1.DisplayLayout.Bands[0].Columns["oldJudgeStoveNo"].Hidden = false;
  232. ultraGrid1.DisplayLayout.Bands[0].Columns["oldBatchNo"].Hidden = false;
  233. ultraGrid1.DisplayLayout.Bands[0].Columns["isMain"].Hidden = false;
  234. }
  235. else
  236. {
  237. ultraGrid1.DisplayLayout.Bands[0].Columns["oldJudgeStoveNo"].Hidden = true;
  238. ultraGrid1.DisplayLayout.Bands[0].Columns["oldBatchNo"].Hidden = true;
  239. ultraGrid1.DisplayLayout.Bands[0].Columns["isMain"].Hidden = true;
  240. }
  241. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "stdMemo");
  242. }
  243. //public void Query(string lotNo, string lotNoGroup, string stoveNo, string judgeStoveNo, string batchNo, string ordLnPk, string ordLnDlyPk, string craftSeq,
  244. // string mscPline, string processCode, string pic, string[] phyCodeMins, string cic, string deptId, string steelStandrad, string craftSource,
  245. // string produccode, string steelcode, string plineCode, string processOrdLnPk, string craftProcess, DataRow zcApply)
  246. //{
  247. // string gpType = "";
  248. // DataTable dt = _d.GetTableByXmlId("QcmJhyPhyresultDAL.QueryPhyMinByBatchNo", ordLnPk, craftSeq, mscPline, processCode, pic,
  249. // judgeStoveNo, batchNo, lotNo, lotNoGroup, "0", phyCodeMins.Length, phyCodeMins, "", "0", plineCode, processOrdLnPk,
  250. // gpType, craftProcess);
  251. // GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  252. // DataRow drLgPline = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.getPlineByStoveNo", stoveNo);
  253. // if (drLgPline != null)
  254. // {
  255. // if (drLgPline["plineCode"].ToString() == "C063" || drLgPline["plineCode"].ToString() == "C064")
  256. // {
  257. // gpType = "1";
  258. // }
  259. // else
  260. // {
  261. // gpType = "0";
  262. // }
  263. // }
  264. // DataTable dtFd = _d.GetTableByXmlId("QcmJhyPhyresultDAL.QueryPhyMinByBatchNo", ordLnPk, craftSeq, mscPline, processCode, pic,
  265. // judgeStoveNo, batchNo, lotNo, lotNoGroup, "1", phyCodeMins.Length, phyCodeMins, "", "0", plineCode,
  266. // processOrdLnPk, gpType, craftProcess);
  267. // GridHelper.CopyDataToDatatable(dtFd, dataTable1, false);
  268. // //处理预备硬度
  269. // for (int i = dataTable1.Rows.Count - 1; i >= 0; i--)
  270. // {
  271. // if (dataTable1.Rows[i]["nkResult"].ToString() == "" && dataTable1.Rows[i]["phyNameMin"].ToString().Contains("洛氏硬度")
  272. // && produccode == "S000046" && steelcode == "C209")
  273. // {
  274. // var drsYb = dataTable1.Select("phyNameMin like '%预备硬度%'");
  275. // if (drsYb.Length > 0)
  276. // {
  277. // dataTable1.Rows.Remove(dataTable1.Rows[i]);
  278. // }
  279. // }
  280. // }
  281. // if(deptId == "002001007010" || deptId == "phy")
  282. // {
  283. // DataRow drChemCnt = _d.GetRowByXmlId("CraftOrdDesignStdCic.getChemCnt", ordLnPk, craftSeq, "0", mscPline, processCode);
  284. // if (drChemCnt["count"].ToString() != "0" )
  285. // {
  286. // DataRow drCraftStd = _d.GetRowByXmlId("JdgCraftOrdDesignStd.getProductCnt", ordLnPk, craftSeq, "0");
  287. // DataTable dtChem = _d.GetTableByXmlId("QcmJhyElementsDAL.getPhyMinByBatchNo", ordLnPk, craftSeq, judgeStoveNo,
  288. // batchNo, processCode, cic, 0, drCraftStd["rateN"].ToString(), plineCode, processOrdLnPk, gpType);
  289. // GridHelper.CopyDataToDatatable(dtChem, dataTable1, false);
  290. // }
  291. // DataRow drChemCntFd = _d.GetRowByXmlId("CraftOrdDesignStdCic.getChemCnt", ordLnPk, craftSeq, "1", mscPline, processCode);
  292. // if (drChemCntFd["count"].ToString() != "0")
  293. // {
  294. // DataRow drCraftStdFd = _d.GetRowByXmlId("JdgCraftOrdDesignStd.getProductCnt", ordLnPk, craftSeq, "1");
  295. // DataTable dtChemFd = _d.GetTableByXmlId("QcmJhyElementsDAL.getPhyMinByBatchNo", ordLnPk, craftSeq, judgeStoveNo,
  296. // batchNo, processCode, cic, 1, drCraftStdFd["rateN"].ToString(), plineCode, processOrdLnPk, gpType);
  297. // GridHelper.CopyDataToDatatable(dtChemFd, dataTable1, false);
  298. // }
  299. // }
  300. // //如果有按炉、按生产批取样的试样组找不到,则查询热处理前的数据
  301. // //DataTable dtRcl = dataTable1.Clone();
  302. // //foreach();
  303. // DataTable dtRcl = _d.GetTableByXmlId("QcmJhyPhyresultDAL.QueryPhyMinByBatchNo", ordLnPk, craftSeq, mscPline, processCode, pic,
  304. // judgeStoveNo, batchNo, lotNo, lotNoGroup, "0", 0, new string[] { }, "", "1", plineCode, processOrdLnPk,
  305. // gpType, craftProcess);
  306. // var groupPhyMin = dataTable1.Select("sampleNo is null").GroupBy(a=>a["phyCodeMin"].ToString());
  307. // DataTable tmpRcl = dtRcl.Clone();
  308. // foreach (var phyMin in groupPhyMin)
  309. // {
  310. // DataRow[] drRcls = dtRcl.Select("phyCodeMin = '"+ phyMin.Key +"'");
  311. // bool addRcl = false;
  312. // foreach (var drRcl in drRcls)
  313. // {
  314. // if (drRcl["sampleNo"].ToString() == "") continue;
  315. // tmpRcl.Rows.Add(drRcl.ItemArray);
  316. // addRcl = true;
  317. // }
  318. // if (addRcl)
  319. // {
  320. // DataRow[] dr1s = dataTable1.Select("phyCodeMin = '"+ phyMin.Key +"'");
  321. // foreach (DataRow dr1 in dr1s)
  322. // {
  323. // dataTable1.Rows.Remove(dr1);
  324. // }
  325. // }
  326. // }
  327. // GridHelper.CopyDataToDatatable(tmpRcl, dataTable1, false);
  328. // //处理成品利库的炉号
  329. // if (zcApply != null)
  330. // {
  331. // if (zcApply["isAllScrap"].ToString() == "4")
  332. // {
  333. // DataTable dtZcJudge = _d.GetTableByXmlId("JdgQcmZcChemPhyDetail.getByBatchNoApplyCode", zcApply["judgeStoveNo"].ToString(),
  334. // zcApply["batchNo"].ToString(), zcApply["jugdeApplyCode"].ToString(), processCode);
  335. // foreach (DataRow dr in dataTable1.Rows)
  336. // {
  337. // DataRow[] drZcJudges = dtZcJudge.Select("checkNo = '" + dr["sampleId"].ToString() + "' and sampleNo = '" + dr["sampleNo"].ToString() + "' and phyCodeMin = '" + dr["phyCodeMin"].ToString() + "'");
  338. // if (drZcJudges.Length > 0)
  339. // {
  340. // dr["resultSource"] = drZcJudges[0]["resultSource"].ToString();
  341. // dr["nkResult"] = drZcJudges[0]["nkResult"].ToString();
  342. // dr["jfResult"] = drZcJudges[0]["jfResult"].ToString();
  343. // }
  344. // else
  345. // {
  346. // dr["resultSource"] = "";
  347. // dr["nkResult"] = "";
  348. // dr["jfResult"] = "";
  349. // }
  350. // }
  351. // }
  352. // }
  353. // dataTable1.DefaultView.Sort = "processCode, craftSource desc, judgeStoveNo, batchNo, isMain desc, oldJudgeStoveNo, oldBatchNo, phyNameMin, sampleNo";
  354. // DataTable dtSort = dataTable1.DefaultView.ToTable();
  355. // GridHelper.CopyDataToDatatable(dtSort, dataTable1, true);
  356. // //是否组炉炉号 (有检验编号以P开头的就是)
  357. // bool isGroup = false;
  358. // foreach (var row in ultraGrid1.Rows)
  359. // {
  360. // GridEdite(row);
  361. // if (row.GetValue("sampleId").StartsWith("P"))
  362. // {
  363. // isGroup = true;
  364. // }
  365. // if (row.GetValue("resultSource") == "")
  366. // {
  367. // row.Cells["chk"].Value = DBNull.Value;
  368. // row.Cells["chk"].Activation = Activation.ActivateOnly;
  369. // row.Update();
  370. // }
  371. // else
  372. // {
  373. // if (row.GetValue("resultSource") == "0" && !row.GetValue("phyNameMin").Contains("冲击试验"))
  374. // {
  375. // if (row.GetValue("nkResult") != "" && row.GetValue("jfResult") != "")
  376. // {
  377. // row.Cells["chk"].Value = DBNull.Value;
  378. // row.Cells["chk"].Activation = Activation.ActivateOnly;
  379. // row.Update();
  380. // }
  381. // }
  382. // }
  383. // }
  384. // if (isGroup)
  385. // {
  386. // ultraGrid1.DisplayLayout.Bands[0].Columns["oldJudgeStoveNo"].Hidden = false;
  387. // ultraGrid1.DisplayLayout.Bands[0].Columns["oldBatchNo"].Hidden = false;
  388. // ultraGrid1.DisplayLayout.Bands[0].Columns["isMain"].Hidden = false;
  389. // }
  390. // else
  391. // {
  392. // ultraGrid1.DisplayLayout.Bands[0].Columns["oldJudgeStoveNo"].Hidden = true;
  393. // ultraGrid1.DisplayLayout.Bands[0].Columns["oldBatchNo"].Hidden = true;
  394. // ultraGrid1.DisplayLayout.Bands[0].Columns["isMain"].Hidden = true;
  395. // }
  396. // if ((_frmFlag == "phy" || zcApply != null && zcApply["isAllScrap"].ToString() == "4") && deptId == "phy")
  397. // {
  398. // ultraGrid1.DisplayLayout.Bands[0].Columns["chk"].Hidden = false;
  399. // }
  400. // else
  401. // {
  402. // ultraGrid1.DisplayLayout.Bands[0].Columns["chk"].Hidden = true;
  403. // }
  404. // GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "stdMemo");
  405. //}
  406. //private void RemoveLgChem(DataTable dtLgChem)
  407. //{
  408. // DataRow[] drs601 = dtLgChem.Select("sampleNo like '601F%'", "sampleNo");
  409. // for(int i = drs601.Length - 2; i >= 0; i--)
  410. // {
  411. // dtLgChem.Rows.Remove(drs601[i]);
  412. // }
  413. // DataRow[] drs602 = dtLgChem.Select("sampleNo like '602F%'", "sampleNo");
  414. // for (int i = drs602.Length - 2; i >= 0; i--)
  415. // {
  416. // dtLgChem.Rows.Remove(drs602[i]);
  417. // }
  418. //}
  419. //public void Query(DataTable dtConsign, string craftSource, string[] phyCodeMins)
  420. //{
  421. // dataTable1.Clear();
  422. // DataRow drConsign2 = dtConsign.Rows[0];
  423. // string checkNo = drConsign2["checkNo"].ToString();
  424. // string judgeStoveNo = drConsign2["judgeStoveNo"].ToString();
  425. // string steelStandrad = drConsign2["steelStandrad"].ToString();
  426. // string processCode = drConsign2["processCode"].ToString();
  427. // string ordLnDlyPk = drConsign2["ordLnDlyPk"].ToString();
  428. // string craftSeq = drConsign2["craftSeq"].ToString();
  429. // string cic = drConsign2["cic"].ToString();
  430. // string pic = drConsign2["pic"].ToString();
  431. // string craftProcessCode = drConsign2["likuProcessCode"].ToString();
  432. // foreach (DataRow drConsign in dtConsign.Rows)
  433. // {
  434. // string batchNo = drConsign["batchNo"].ToString();
  435. // DataTable dt = _d.GetTableByXmlId("QcmJhyPhyresultDAL.QueryPhyMinByCheckNo", checkNo, judgeStoveNo, batchNo,
  436. // phyCodeMins.Length, phyCodeMins, craftSource, craftProcessCode);
  437. // GridHelper.CopyDataToDatatable(dt, dataTable1, false);
  438. // }
  439. // ////获取组炉子炉号信息
  440. // //if (drConsign2["zpMLh"].ToString() != "")
  441. // //{
  442. // // string[] stoveBatchNos = drConsign2["zpColl"].ToString().Split(',');
  443. // // string stoveBatchNoM = drConsign2["zpMLh"].ToString();
  444. // // foreach (string stoveBatchNo in stoveBatchNos)
  445. // // {
  446. // // if (stoveBatchNo == stoveBatchNoM) continue;
  447. // // string judgeStoveNoSub = stoveBatchNo.Split('+')[0];
  448. // // string batchNoSub = stoveBatchNo.Split('+')[1];
  449. // // DataRow drConsignSub = _d.GetRowByXmlId("JdgQcmZcCheckconsign.getByBatchNoOrdLnDlyPk",
  450. // // judgeStoveNoSub, batchNoSub, "0", processCode, ordLnDlyPk);
  451. // // string checkNoSub = drConsignSub["checkNo"].ToString();
  452. // // DataTable dt = _d.GetTableByXmlId("QcmJhyPhyresultDAL.QueryPhyMinByCheckNo", checkNoSub, judgeStoveNoSub, batchNoSub,
  453. // // phyCodeMins.Length, phyCodeMins, craftSource);
  454. // // foreach (DataRow dr in dt.Rows)
  455. // // {
  456. // // dr["pic"] = pic;
  457. // // }
  458. // // GridHelper.CopyDataToDatatable(dt, dataTable1, false);
  459. // // }
  460. // //}
  461. // //是否组炉炉号 (有检验编号以P开头的就是)
  462. // bool isGroup = false;
  463. // foreach (var row in ultraGrid1.Rows)
  464. // {
  465. // GridEdite(row);
  466. // if (row.GetValue("sampleId").StartsWith("P"))
  467. // {
  468. // isGroup = true;
  469. // }
  470. // if (row.GetValue("resultSource") == "")
  471. // {
  472. // row.Cells["chk"].Value = DBNull.Value;
  473. // row.Cells["chk"].Activation = Activation.ActivateOnly;
  474. // row.Update();
  475. // }
  476. // else
  477. // {
  478. // if (row.GetValue("resultSource") == "0" && !row.GetValue("phyNameMin").Contains("冲击试验"))
  479. // {
  480. // if (row.GetValue("nkResult") != "" && row.GetValue("jfResult") != "")
  481. // {
  482. // row.Cells["chk"].Value = DBNull.Value;
  483. // row.Cells["chk"].Activation = Activation.ActivateOnly;
  484. // row.Update();
  485. // }
  486. // }
  487. // }
  488. // }
  489. // if (isGroup)
  490. // {
  491. // ultraGrid1.DisplayLayout.Bands[0].Columns["oldJudgeStoveNo"].Hidden = false;
  492. // ultraGrid1.DisplayLayout.Bands[0].Columns["oldBatchNo"].Hidden = false;
  493. // ultraGrid1.DisplayLayout.Bands[0].Columns["isMain"].Hidden = false;
  494. // }
  495. // else
  496. // {
  497. // ultraGrid1.DisplayLayout.Bands[0].Columns["oldJudgeStoveNo"].Hidden = true;
  498. // ultraGrid1.DisplayLayout.Bands[0].Columns["oldBatchNo"].Hidden = true;
  499. // ultraGrid1.DisplayLayout.Bands[0].Columns["isMain"].Hidden = true;
  500. // }
  501. // GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "stdMemo");
  502. //}
  503. public void ClearData()
  504. {
  505. this.dataTable1.Clear();
  506. }
  507. private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  508. {
  509. var row = ultraGrid1.ActiveRow;
  510. PopupTextBox popupTextBox = new PopupTextBox(row.GetValue("stdMemo"), 4000);
  511. popupTextBox.TxtInfo.ReadOnly = true;
  512. popupTextBox.UltraPanel1.Visible = false;
  513. popupTextBox.Show();
  514. }
  515. private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
  516. {
  517. Color red = Color.FromArgb(255, 106, 106);
  518. Color yellow = Color.FromArgb(255, 246, 143);
  519. Color blue = Color.FromArgb(135, 206, 250);
  520. if (e.Row.GetValue("jfResult") == "0")
  521. {
  522. e.Row.Cells["jfResult"].Appearance.BackColor = red;
  523. }
  524. else if (e.Row.GetValue("jfResult") == "")
  525. {
  526. e.Row.Cells["jfResult"].Appearance.BackColor = yellow;
  527. }
  528. if (e.Row.GetValue("nkResult") == "0")
  529. {
  530. e.Row.Cells["nkResult"].Appearance.BackColor = red;
  531. }
  532. else if (e.Row.GetValue("nkResult") == "")
  533. {
  534. e.Row.Cells["nkResult"].Appearance.BackColor = yellow;
  535. }
  536. if (e.Row.GetValue("sampleId").StartsWith("F"))
  537. {
  538. e.Row.Cells["sampleId"].Appearance.BackColor = blue;
  539. }
  540. }
  541. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  542. {
  543. e.Cell.Row.Update();
  544. GridEdite(e.Cell.Row);
  545. }
  546. private void GridEdite(UltraGridRow row)
  547. {
  548. if (row.GetValue("chk") == "True")
  549. {
  550. foreach (UltraGridCell cell in row.Cells)
  551. {
  552. if (cell.Column.CellActivation == Activation.AllowEdit)
  553. {
  554. cell.Activation = Activation.AllowEdit;
  555. }
  556. }
  557. }
  558. else
  559. {
  560. foreach (UltraGridCell cell in row.Cells)
  561. {
  562. if (cell.Column.Key == "chk") continue;
  563. if (cell.Column.CellActivation == Activation.AllowEdit)
  564. {
  565. cell.Activation = Activation.ActivateOnly;
  566. }
  567. }
  568. }
  569. }
  570. private void ultraTextEditor3_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  571. {
  572. LotNoGroupInfoQueryFrm frm = new LotNoGroupInfoQueryFrm(ultraGrid1.GetActiveRowValue("lotNo"), _d.Ob);
  573. frm.ShowDialog();
  574. }
  575. }
  576. }