| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Judge.Commons;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- namespace Core.StlMes.Client.Judge.Forms
- {
- public partial class QcmZgResampleFrm : FrmBase
- {
- private Dal _d;
- private string _checkNo = "";
- private DataRow _consign;
- public QcmZgResampleFrm(OpeBase ob, DataRow consign)
- {
- InitializeComponent();
- _d = new Dal(ob);
- _consign = consign;
- _checkNo = consign["checkNo"].ToString();
- Query();
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "确认":
- ApplyResample();
- break;
- }
- }
- private void ApplyResample()
- {
- List<string> jsons = new List<string>();
- var chkRows = ultraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
- if (chkRows.Count() == 0)
- {
- MessageUtil.ShowWarning("请至少勾选一条记录!");
- return;
- }
- foreach (DataRow row in dataTable1.Rows)
- {
- if (row["chk"].ToString() == "True")
- {
- if (row["sampleCount"].ToString() == "")
- {
- MessageUtil.ShowWarning("请输入管头个数!");
- return;
- }
- jsons.Add(JsonHelper.ToJson(row));
- }
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认进行此操作?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = _d.Set("com.steering.pss.judge.Bll.BllRolledTubePhyJudge.applyResample",
- new object[] { _checkNo, UserInfo.GetUserName(), jsons });
- if (ccp.ReturnInfo != "")
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips("确认成功!");
- }
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- private void Query()
- {
- string ordLnDlyPk = _consign["ordLnDlyPk"].ToString();
- string craftSeq = _consign["craftSeq"].ToString();
- string craftSource = _consign["craftSource"].ToString();
- string mscPline = _consign["indexSeq"].ToString();
- string processCode = _consign["processCode"].ToString();
- string pic = _consign["pic"].ToString();
- string judgeStoveNo = _consign["judgeStoveNo"].ToString();
- string batchNo = _consign["batchNo"].ToString();
- string lotNo = _consign["lotNo"].ToString();
- string lotNoGroup = _consign["lotNoGroup"].ToString();
- //获取所有已委托的试样组
- DataTable dtBatchNo = _d.GetTableByXmlId("JdgQcmZcCheckConsignDetail.getAllByCheckNo", _checkNo);
- for (int i = dtBatchNo.Rows.Count - 1; i >= 0; i--)
- {
- if (dtBatchNo.Rows[i]["phyCodeMin"].ToString() == "HX" || dtBatchNo.Rows[i]["phyCodeMin"].ToString() == "ONH")
- {
- dtBatchNo.Rows.Remove(dtBatchNo.Rows[i]);
- }
- }
- dtBatchNo.AcceptChanges();
- DataTable dtChemFailed = _d.GetTableByXmlId("QcmBcPhyresultDAL.getChemResampleData", new object[] { _checkNo });
- GridHelper.CopyDataToDatatable(dtChemFailed, dtBatchNo, false);
- dtBatchNo.DefaultView.Sort = "judgeStoveNo, batchNo, nkResult, phyNameMin";
- GridHelper.CopyDataToDatatable(dtBatchNo.DefaultView.ToTable(), dataTable1, true);
- //DataTable dtJudgeStoveNo = _d.GetTableByXmlId("JdgQcmZcCheckConsignDetail.getAllByJudgeStoveNo", judgeStoveNo, batchNo, ordLnDlyPk);
- //GridHelper.CopyDataToDatatable(dtJudgeStoveNo, dataTable1, false);
- //DataTable dtLotNo = _d.GetTableByXmlId("JdgQcmZcCheckConsignDetail.getAllByLotNo", judgeStoveNo, batchNo, ordLnDlyPk);
- //GridHelper.CopyDataToDatatable(dtLotNo, dataTable1, false);
- //DataTable dt = _d.GetTableByXmlId("QcmBcPhyresultDAL.getResampleData",
- // new object[] { _checkNo });
- //GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- DataTable dtNo = _d.GetTable("com.steering.pss.judge.Bll.BllRolledTubePhyJudge.getCheckNoQualifiedData",
- new object[] { _checkNo });
- //DataRow drSscCondition = _d.GetRowByXmlId("JdgCraftOrdDesignStdPicSmp.getSscConditonCnt", ordLnDlyPk, craftSeq, craftSource,
- // mscPline, processCode, pic);
- //if (drSscCondition["count"].ToString() != "0")
- //{
- // DataTable dtLsyd = _d.GetTableByXmlId("JdgQcmZcCheckConsignDetail.getHardnessPhy", _checkNo);
- // GridHelper.CopyDataToDatatable(dtLsyd, dataTable1, false);
- //}
- DataTable dtComplexChem = _d.GetTableByXmlId("JdgComBaseChem.getComplexChemOrderByLength");
- foreach (var row in ultraGrid1.Rows)
- {
- var drChems = dtComplexChem.Select("chemName = '" + row.GetValue("phyNameMin") + "'");
- if (drChems.Length > 0)
- {
- if (drChems[0]["chemType"].ToString() == "B")
- {
- Dictionary<string, string> chems = new Dictionary<string, string>();
- String chemFormula = drChems[0]["chemFormula"].ToString();
- DataTable dtChem = _d.GetTableByXmlId("JdgComBaseChem.queryBaseChemOrderByLength");
- foreach (DataRow drChem in dtChem.Rows)
- {
- if (chemFormula.Contains(drChem["chemName"].ToString()))
- {
- chemFormula = chemFormula.Replace(drChem["chemName"].ToString(), "");
- chems.Add(drChem["chemCode"].ToString(), drChem["chemName"].ToString());
- }
- }
- bool exists = true;
- DataRow[] drChemNos = null;
- foreach (string chemCode in chems.Keys)
- {
- drChemNos = dtNo.Select("phyCode = '" + chemCode + "' and judgeStoveNo = '" + row.GetValue("judgeStoveNo")
- + "' and batchNo = '" + row.GetValue("batchNo") + "'");
- if (drChemNos.Length == 0)
- {
- exists = false;
- break;
- }
- }
- if (exists && drChemNos != null)
- {
- row.SetValue("isOriginal", drChemNos[0]["isOriginal"].ToString());
- row.SetValue("sampleCount", drChemNos[0]["sampleCount"].ToString());
- row.Cells["chk"].Value = true;
- row.Update();
- }
- }
- else
- {
- var drAChemNos = dtNo.Select("phyName = '" + row.GetValue("phyCodeMin") + "' and judgeStoveNo = '" + row.GetValue("judgeStoveNo")
- + "' and batchNo = '" + row.GetValue("batchNo") + "'");
- if (drAChemNos.Length > 0)
- {
- row.SetValue("isOriginal", drAChemNos[0]["isOriginal"].ToString());
- row.SetValue("sampleCount", drAChemNos[0]["sampleCount"].ToString());
- row.Cells["chk"].Value = true;
- row.Update();
- }
- }
- }
- var drs = dtNo.Select("phyCodeMax = '" + row.GetValue("phyCodeMin") + "' and judgeStoveNo = '" + row.GetValue("judgeStoveNo")
- + "' and batchNo = '" + row.GetValue("batchNo") + "'");
- if (drs.Length > 0)
- {
- row.SetValue("isOriginal", drs[0]["isOriginal"].ToString());
- row.SetValue("sampleCount", drs[0]["sampleCount"].ToString());
- row.Cells["chk"].Value = true;
- row.Update();
- }
- }
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- e.Cell.Row.Update();
- }
- private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- Color red = Color.FromArgb(255, 106, 106);
- if (e.Row.GetValue("nkResult") == "不合格")
- {
- e.Row.Appearance.BackColor = red;
- }
- }
- }
- }
|