|
|
@@ -24,6 +24,8 @@ namespace UAS_MES.OQC
|
|
|
|
|
|
DataTable TempForCheckType = new DataTable();
|
|
|
|
|
|
+ DataTable TempForBadGroup = new DataTable();
|
|
|
+
|
|
|
public OQC_SamplingDataCollection()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
@@ -65,7 +67,7 @@ namespace UAS_MES.OQC
|
|
|
{
|
|
|
if (CheckSnCode())
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select or_reasoncode, oi_description from OQCNGReason where or_checkno='" + ob_checkno.Text + "' and or_sncode='" + sncode.Text + "'", "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select or_id,or_reasoncode bg_code, oi_description bg_name from OQCNGReason where or_checkno='" + ob_checkno.Text + "' and or_sncode='" + sncode.Text + "'", "select");
|
|
|
BaseUtil.FillDgvWithDataTable(ChoosedDGV, dt);
|
|
|
GetBatchTypeGridData();
|
|
|
}
|
|
|
@@ -162,6 +164,7 @@ namespace UAS_MES.OQC
|
|
|
//将布尔值转换为0,-1
|
|
|
if (TempForCheckType.Rows[i]["ois_id"].ToString() != "" && TempForCheckType.Rows[i]["ois_id"].ToString() != "0")
|
|
|
{
|
|
|
+ Console.WriteLine("ioi_ng" + TempForCheckType.Rows[i]["oi_ng"].ToString());
|
|
|
ois_ifng_update.Add(TempForCheckType.Rows[i]["oi_ng"].ToString() == "True" ? "-1" : "0");
|
|
|
ois_defectlevel_update.Add(TempForCheckType.Rows[i]["oi_leveldefect"].ToString());
|
|
|
ois_remark_update.Add(TempForCheckType.Rows[i]["ois_remark"].ToString());
|
|
|
@@ -169,6 +172,7 @@ namespace UAS_MES.OQC
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ Console.WriteLine("uoi_ng" + TempForCheckType.Rows[i]["oi_ng"].ToString());
|
|
|
oi_itemcode_insert.Add(TempForCheckType.Rows[i]["oi_itemcode"].ToString());
|
|
|
ois_ifng_insert.Add(TempForCheckType.Rows[i]["oi_ng"].ToString() == "True" ? "-1" : "0");
|
|
|
ois_defectlevel_insert.Add(TempForCheckType.Rows[i]["oi_leveldefect"].ToString());
|
|
|
@@ -177,15 +181,17 @@ namespace UAS_MES.OQC
|
|
|
}
|
|
|
//判断是否含不通过的内容
|
|
|
bool AllPass = true;
|
|
|
+ Console.WriteLine(ois_ifng_insert.Count);
|
|
|
for (int i = 0; i < ois_ifng_insert.Count; i++)
|
|
|
{
|
|
|
- Console.WriteLine("ois_ifng_insert" + ois_ifng_insert[i]);
|
|
|
+ Console.WriteLine(ois_ifng_insert[i]);
|
|
|
if (ois_ifng_insert[i] == "-1")
|
|
|
AllPass = false;
|
|
|
}
|
|
|
+ Console.WriteLine(ois_ifng_update.Count);
|
|
|
for (int i = 0; i < ois_ifng_update.Count; i++)
|
|
|
{
|
|
|
- Console.WriteLine("ois_ifng_update" + ois_ifng_update[i]);
|
|
|
+ Console.WriteLine(ois_ifng_update[i]);
|
|
|
if (ois_ifng_update[i] == "-1")
|
|
|
AllPass = false;
|
|
|
}
|
|
|
@@ -218,15 +224,19 @@ namespace UAS_MES.OQC
|
|
|
List<string> bc_name = new List<string>();
|
|
|
for (int i = 0; i < ChoosedDGV.RowCount; i++)
|
|
|
{
|
|
|
- bc_code.Add(ChoosedDGV.Rows[i].Cells[0].Value.ToString());
|
|
|
- bc_name.Add(ChoosedDGV.Rows[i].Cells[1].Value.ToString());
|
|
|
+ bc_code.Add(ChoosedDGV.Rows[i].Cells[1].Value.ToString());
|
|
|
+ bc_name.Add(ChoosedDGV.Rows[i].Cells[2].Value.ToString());
|
|
|
+ }
|
|
|
+ if (bc_name.Count > 0)
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("delete from OQCNGReason where or_sncode='" + sncode.Text + "' and or_checkno='" + ob_checkno.Text + "'", "delete");
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into OQCNGReason(or_id, or_checkno, or_makecode, or_sncode, or_reasoncode, oi_description, oi_remark)");
|
|
|
+ sql.Append("values (OQCNGReason_seq.nextval,'" + ob_checkno.Text + "','" + ob_makecode.Text + "','" + sncode.Text + "',:a,:b,'" + ob_remark.Text + "')");
|
|
|
+ dh.BatchInsert(sql.GetString(), new string[] { "a", "b" }, bc_code.ToArray(), bc_name.ToArray());
|
|
|
}
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into OQCNGReason(or_id, or_checkno, or_makecode, or_sncode, or_reasoncode, oi_description, oi_remark)");
|
|
|
- sql.Append("values (OQCNGReason_seq.nextval,'" + ob_checkno.Text + "','" + ob_makecode.Text + "','" + sncode.Text + "',:a,:b,'" + ob_remark.Text + "')");
|
|
|
- dh.BatchInsert(sql.GetString(), new string[] { "a", "b" }, bc_code.ToArray(), bc_name.ToArray());
|
|
|
- sql.Clear();
|
|
|
//更新项目编号中的抽检数、不合格数,根据采样项目记录
|
|
|
+ sql.Clear();
|
|
|
sql.Append("UPDATE OQCItems SET (oi_ngqty,oi_checkqty)=(select nvl(sum(case when ");
|
|
|
sql.Append("nvl(ois_ifng,0)=0 then 0 else 1 end),0) ,count(1) from OQCItemSamples where ois_checkno=oi_checkno ");
|
|
|
sql.Append("and ois_itemcode=oi_itemcode)where oi_checkno ='" + ob_checkno.Text + "' and oi_projectcode ='" + ob_projectcode.Text + "'");
|
|
|
@@ -239,8 +249,10 @@ namespace UAS_MES.OQC
|
|
|
GetBatch.PerformClick();
|
|
|
ChoosedDGV.DataSource = null;
|
|
|
BaseUtil.CleanDGVData(CheckTypeDGV);
|
|
|
+ BaseUtil.CleanDGVData(WaitChooseDGV);
|
|
|
sncode.Text = "";
|
|
|
TempForCheckType.Clear();
|
|
|
+ TempForBadGroup.Clear();
|
|
|
}
|
|
|
else OperateResult.AppendText(">>含有未通过项请勾选不良明细\n", Color.Red);
|
|
|
}
|
|
|
@@ -329,9 +341,15 @@ namespace UAS_MES.OQC
|
|
|
|
|
|
private void ChooseedReject_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- dt = BaseUtil.DGVIfChecked(WaitChooseDGV);
|
|
|
- if (dt != null)
|
|
|
- BaseUtil.FillDgvWithDataTable(ChoosedDGV, dt);
|
|
|
+ if (TempForBadGroup != null)
|
|
|
+ {
|
|
|
+ for (int i = TempForBadGroup.Rows.Count - 1; i >= 0; i--)
|
|
|
+ {
|
|
|
+ if (TempForBadGroup.Rows[i][0].ToString() != "True")
|
|
|
+ TempForBadGroup.Rows.RemoveAt(i);
|
|
|
+ }
|
|
|
+ BaseUtil.FillDgvWithDataTable(ChoosedDGV, TempForBadGroup.Copy());
|
|
|
+ }
|
|
|
else
|
|
|
OperateResult.AppendText(">>请先勾选不良明细\n", Color.Red);
|
|
|
}
|
|
|
@@ -343,7 +361,7 @@ namespace UAS_MES.OQC
|
|
|
string checkkind = CheckTypeDGV.Rows[e.RowIndex].Cells["oi_itemcode"].Value.ToString();
|
|
|
sql.Clear();
|
|
|
sql.Append("select oi_checkkind,ois_sncode,nvl(ois_id,0) ois_id ,oi_itemcode ,nvl(ois_ifng,0) oi_ng,nvl(ois_defectlevel,'-1')");
|
|
|
- sql.Append("oi_leveldefect,ois_remark,case ois_id when 0 then '未检验' else '已检验' end ois_status from OQCItems ");
|
|
|
+ sql.Append("oi_leveldefect,ois_remark,case nvl(ois_id,0) when 0 then '未检验' else '已检验' end ois_status from OQCItems ");
|
|
|
sql.Append("left join OQCItemSamples on ois_sncode='" + sncode.Text + "' and ois_checkno=oi_checkno and ");
|
|
|
sql.Append("ois_itemcode=oi_itemcode and ois_projectcode = oi_projectcode where oi_checkno ='" + ob_checkno.Text + "' ");
|
|
|
sql.Append("and oi_checkkind='" + checkkind + "'");
|
|
|
@@ -383,7 +401,6 @@ namespace UAS_MES.OQC
|
|
|
{
|
|
|
|
|
|
}
|
|
|
-
|
|
|
cl.Rows.Add(headerRow);
|
|
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
@@ -467,6 +484,7 @@ namespace UAS_MES.OQC
|
|
|
//标记展开的子行
|
|
|
dataRow.Tag = "SonRow";
|
|
|
DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
|
|
|
+ checkcell.Tag = "SonRow";
|
|
|
dataRow.Cells.Add(checkcell);
|
|
|
|
|
|
textcell = new DataGridViewTextBoxCell();
|
|
|
@@ -489,13 +507,10 @@ namespace UAS_MES.OQC
|
|
|
CheckTypeDGV.Rows[e.RowIndex].Cells[0].Value = true;
|
|
|
try
|
|
|
{
|
|
|
- if (e.ColumnIndex == 0)
|
|
|
+ if (CheckTypeDGV.Rows[e.RowIndex].Cells[0].Tag != null)
|
|
|
{
|
|
|
- if (CheckTypeDGV.Rows[e.RowIndex].Cells[0].Tag != null)
|
|
|
- {
|
|
|
- if (CheckTypeDGV.Rows[e.RowIndex].Cells[0].Tag.ToString() == "SonRow")
|
|
|
- BaseUtil.GetExpandDGVCheckedRow(CheckTypeDGV, TempForCheckType, e.RowIndex, 1);
|
|
|
- }
|
|
|
+ if (CheckTypeDGV.Rows[e.RowIndex].Cells[0].Tag.ToString() == "SonRow")
|
|
|
+ BaseUtil.GetExpandDGVCheckedRow(CheckTypeDGV, TempForCheckType, e.RowIndex, 1);
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
@@ -513,7 +528,6 @@ namespace UAS_MES.OQC
|
|
|
private void CheckTypeDGV_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|
|
|
BaseUtil.ExpandDGVCheck(CheckTypeDGV, e);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void bccode_KeyDown(object sender, KeyEventArgs e)
|
|
|
@@ -545,16 +559,30 @@ namespace UAS_MES.OQC
|
|
|
private void ms_sncode_KeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
- {
|
|
|
GetBatch.PerformClick();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void obd_outboxcode_KeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
- {
|
|
|
GetBatch.PerformClick();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void WaitChooseDGV_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (e.ColumnIndex == 0)
|
|
|
+ {
|
|
|
+ if (WaitChooseDGV.Rows[e.RowIndex].Cells[0].Tag != null)
|
|
|
+ {
|
|
|
+ if (WaitChooseDGV.Rows[e.RowIndex].Cells[0].Tag.ToString() == "SonRow")
|
|
|
+ BaseUtil.GetExpandDGVCheckedRow(WaitChooseDGV, TempForBadGroup, e.RowIndex, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
}
|
|
|
}
|
|
|
}
|