|
@@ -21,7 +21,7 @@ namespace UAS_MES.OQC
|
|
|
List<DataGridViewRow> dgvr = new List<DataGridViewRow>();
|
|
|
LogStringBuilder sql = new LogStringBuilder();
|
|
|
string[] LevelDefect = new string[] { "A#A", "B#B", "C#C", "D#D" };
|
|
|
-
|
|
|
+ string ErrorMessage = "";
|
|
|
DataTable TempForCheckType = new DataTable();
|
|
|
|
|
|
public OQC_SamplingDataCollection()
|
|
@@ -79,8 +79,8 @@ namespace UAS_MES.OQC
|
|
|
//判断当前的检验状态
|
|
|
if (ob_status.Text == "待检验" || ob_status.Text == "检验中")
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select obd_sncode,ob_source,ob_makecode from OQCBatchDetail left join OQCBatch on ob_id=obd_obid where obd_sncode='" + sncode.Text + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select obd_sncode,ob_source,ob_makecode,ob_checkno from OQCBatchDetail left join OQCBatch on ob_id=obd_obid where obd_sncode='" + sncode.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0 && dt.Rows[0]["ob_checkno"].ToString() == ob_checkno.Text)
|
|
|
{
|
|
|
if (dt.Rows[0]["ob_source"].ToString() != "工序")
|
|
|
{
|
|
@@ -88,7 +88,7 @@ namespace UAS_MES.OQC
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- string ErrorMessage = "";
|
|
|
+
|
|
|
string oMakeCode = "";
|
|
|
string oMsID = "";
|
|
|
if (LogicHandler.CheckStepSNAndMacode(dt.Rows[0]["ob_makecode"].ToString(), User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
|
|
@@ -102,7 +102,7 @@ namespace UAS_MES.OQC
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- OperateResult.AppendText(">>序列号"+sncode.Text+"不属于当前抽检批次\n", Color.Red);
|
|
|
+ OperateResult.AppendText(">>序列号" + sncode.Text + "不属于当前抽检批次\n", Color.Red);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -144,7 +144,7 @@ namespace UAS_MES.OQC
|
|
|
TempForCheckType.Rows.RemoveAt(i);
|
|
|
}
|
|
|
}
|
|
|
- if (TempForCheckType != null && TempForCheckType.Rows.Count>0)
|
|
|
+ if (TempForCheckType != null && TempForCheckType.Rows.Count > 0)
|
|
|
{
|
|
|
//用于存放更新的数据
|
|
|
List<string> ois_ifng_update = new List<string>();
|
|
@@ -159,7 +159,6 @@ namespace UAS_MES.OQC
|
|
|
for (int i = 0; i < TempForCheckType.Rows.Count; i++)
|
|
|
{
|
|
|
//将布尔值转换为0,-1
|
|
|
- Console.WriteLine(TempForCheckType.Rows[i]["ois_id"].ToString());
|
|
|
if (TempForCheckType.Rows[i]["ois_id"].ToString() != "" && TempForCheckType.Rows[i]["ois_id"].ToString() != "0")
|
|
|
{
|
|
|
ois_ifng_update.Add(TempForCheckType.Rows[i]["oi_ng"].ToString() == "True" ? "-1" : "0");
|
|
@@ -227,9 +226,14 @@ namespace UAS_MES.OQC
|
|
|
dh.ExecuteSql("update OQCBatch set ob_status='CHECKING' where ob_checkno='" + ob_checkno.Text + "' and ob_status='UNCHECK'", "update");
|
|
|
//更新批次中的合格数不合格数:用抽检批检验项目表获取最大的抽检数和不合格数
|
|
|
dh.ExecuteSql("update OQCBATCH set (ob_ngqty,ob_okqty)=(select nvl(max(oi_ngqty),0),max(oi_checkqty)-nvl(max(oi_ngqty),0) from OQCItems where oi_checkno ='" + ob_checkno.Text + "') where ob_checkno ='" + ob_checkno.Text + "'", "update");
|
|
|
- OperateResult.AppendText(">>操作成功\n", Color.Green);
|
|
|
- GetBatchTypeGridData();
|
|
|
- TempForCheckType.Clear();
|
|
|
+ if (LogicHandler.SetStepFinish(ob_makecode.Text, User.UserSourceCode, sncode.Text, "OQC检查", "抽样数据采集完成", User.UserCode, out ErrorMessage))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>操作成功\n", Color.Green);
|
|
|
+ GetBatchTypeGridData();
|
|
|
+ ChoosedDGV.DataSource = null;
|
|
|
+ TempForCheckType.Clear();
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
}
|
|
|
else OperateResult.AppendText(">>含有未通过项请勾选不良明细\n", Color.Red);
|
|
|
}
|
|
@@ -352,51 +356,55 @@ namespace UAS_MES.OQC
|
|
|
textcell.Value = "检验状态";
|
|
|
headerRow.Cells.Add(textcell);
|
|
|
headerRow.ReadOnly = true;
|
|
|
- CollapseDataGridViewRow cl = (CollapseDataGridViewRow)(CheckTypeDGV.Rows[e.RowIndex]);
|
|
|
- cl.Rows.Add(headerRow);
|
|
|
-
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ try
|
|
|
{
|
|
|
- DataGridViewRow dataRow = new DataGridViewRow();
|
|
|
- //标记展开的子行
|
|
|
- dataRow.Tag = "SonRow";
|
|
|
- DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
|
|
|
- checkcell.Tag = "SonRow";
|
|
|
- dataRow.Cells.Add(checkcell);
|
|
|
-
|
|
|
- textcell = new DataGridViewTextBoxCell();
|
|
|
- textcell.Value = dt.Rows[i]["oi_itemcode"].ToString();
|
|
|
- dataRow.Cells.Add(textcell);
|
|
|
- textcell.ReadOnly = true;
|
|
|
-
|
|
|
- DataGridViewCheckBoxCell checkcel2 = new DataGridViewCheckBoxCell();
|
|
|
- checkcel2.Value = dt.Rows[i]["oi_ng"].ToString() != "0" ? true : false;
|
|
|
- dataRow.Cells.Add(checkcel2);
|
|
|
- textcell.ReadOnly = false;
|
|
|
-
|
|
|
- DataGridViewComboBoxCell combocell = new DataGridViewComboBoxCell();
|
|
|
- BaseUtil.SetDGVCellComboxData(combocell, "display", "value", LevelDefect);
|
|
|
- combocell.Value = dt.Rows[i]["oi_leveldefect"].ToString();
|
|
|
- dataRow.Cells.Add(combocell);
|
|
|
- textcell.ReadOnly = false;
|
|
|
+ CollapseDataGridViewRow cl = (CollapseDataGridViewRow)(CheckTypeDGV.Rows[e.RowIndex]);
|
|
|
+ cl.Rows.Add(headerRow);
|
|
|
|
|
|
- textcell = new DataGridViewTextBoxCell();
|
|
|
- textcell.Value = dt.Rows[i]["ois_remark"].ToString();
|
|
|
- dataRow.Cells.Add(textcell);
|
|
|
- textcell.ReadOnly = false;
|
|
|
-
|
|
|
- textcell = new DataGridViewTextBoxCell();
|
|
|
- textcell.Value = dt.Rows[i]["ois_status"].ToString();
|
|
|
- dataRow.Cells.Add(textcell);
|
|
|
- textcell.ReadOnly = true;
|
|
|
-
|
|
|
- textcell = new DataGridViewTextBoxCell();
|
|
|
- textcell.Value = dt.Rows[i]["ois_id"].ToString();
|
|
|
- dataRow.Cells.Add(textcell);
|
|
|
-
|
|
|
- cl.Rows.Add(dataRow);
|
|
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ DataGridViewRow dataRow = new DataGridViewRow();
|
|
|
+ //标记展开的子行
|
|
|
+ dataRow.Tag = "SonRow";
|
|
|
+ DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
|
|
|
+ checkcell.Tag = "SonRow";
|
|
|
+ dataRow.Cells.Add(checkcell);
|
|
|
+
|
|
|
+ textcell = new DataGridViewTextBoxCell();
|
|
|
+ textcell.Value = dt.Rows[i]["oi_itemcode"].ToString();
|
|
|
+ dataRow.Cells.Add(textcell);
|
|
|
+ textcell.ReadOnly = true;
|
|
|
+
|
|
|
+ DataGridViewCheckBoxCell checkcel2 = new DataGridViewCheckBoxCell();
|
|
|
+ checkcel2.Value = dt.Rows[i]["oi_ng"].ToString() != "0" ? true : false;
|
|
|
+ dataRow.Cells.Add(checkcel2);
|
|
|
+ textcell.ReadOnly = false;
|
|
|
+
|
|
|
+ DataGridViewComboBoxCell combocell = new DataGridViewComboBoxCell();
|
|
|
+ BaseUtil.SetDGVCellComboxData(combocell, "display", "value", LevelDefect);
|
|
|
+ combocell.Value = dt.Rows[i]["oi_leveldefect"].ToString();
|
|
|
+ dataRow.Cells.Add(combocell);
|
|
|
+ textcell.ReadOnly = false;
|
|
|
+
|
|
|
+ textcell = new DataGridViewTextBoxCell();
|
|
|
+ textcell.Value = dt.Rows[i]["ois_remark"].ToString();
|
|
|
+ dataRow.Cells.Add(textcell);
|
|
|
+ textcell.ReadOnly = false;
|
|
|
+
|
|
|
+ textcell = new DataGridViewTextBoxCell();
|
|
|
+ textcell.Value = dt.Rows[i]["ois_status"].ToString();
|
|
|
+ dataRow.Cells.Add(textcell);
|
|
|
+ textcell.ReadOnly = true;
|
|
|
+
|
|
|
+ textcell = new DataGridViewTextBoxCell();
|
|
|
+ textcell.Value = dt.Rows[i]["ois_id"].ToString();
|
|
|
+ dataRow.Cells.Add(textcell);
|
|
|
+
|
|
|
+ cl.Rows.Add(dataRow);
|
|
|
+ }
|
|
|
+ dgvr.Add(CheckTypeDGV.Rows[e.RowIndex]);
|
|
|
}
|
|
|
- dgvr.Add(CheckTypeDGV.Rows[e.RowIndex]);
|
|
|
+ catch (Exception) { }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -453,13 +461,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)
|
|
@@ -477,7 +482,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)
|
|
@@ -501,25 +505,19 @@ namespace UAS_MES.OQC
|
|
|
private void ob_checkno_KeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
- {
|
|
|
GetBatch.PerformClick();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|