|
@@ -61,6 +61,8 @@ namespace UAS_MES.OQC
|
|
|
{
|
|
{
|
|
|
if (ErrorMessage == "")
|
|
if (ErrorMessage == "")
|
|
|
{
|
|
{
|
|
|
|
|
+ ad_qty.Text = "";
|
|
|
|
|
+ ob_maxngacceptqty.Text = "";
|
|
|
BaseUtil.SetFormValue(Controls, dt[0]);
|
|
BaseUtil.SetFormValue(Controls, dt[0]);
|
|
|
BaseUtil.FillDgvWithDataTable(CheckTypeDGV, dt[1]);
|
|
BaseUtil.FillDgvWithDataTable(CheckTypeDGV, dt[1]);
|
|
|
ob_aqlcode.Text = "";
|
|
ob_aqlcode.Text = "";
|
|
@@ -96,24 +98,39 @@ namespace UAS_MES.OQC
|
|
|
//更新的数据
|
|
//更新的数据
|
|
|
List<string> ci_kind_update = new List<string>();
|
|
List<string> ci_kind_update = new List<string>();
|
|
|
List<string> oi_sampleqty_update = new List<string>();
|
|
List<string> oi_sampleqty_update = new List<string>();
|
|
|
|
|
+ int ChooseCount = 0;
|
|
|
for (int i = 0; i < CheckTypeDGV.Rows.Count; i++)
|
|
for (int i = 0; i < CheckTypeDGV.Rows.Count; i++)
|
|
|
{
|
|
{
|
|
|
//用户勾选的数据才进行操作
|
|
//用户勾选的数据才进行操作
|
|
|
if (CheckTypeDGV.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
|
|
if (CheckTypeDGV.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
|
|
|
{
|
|
{
|
|
|
- if (!(int.Parse(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString()) > int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text)))
|
|
|
|
|
|
|
+ ChooseCount = ChooseCount + 1;
|
|
|
|
|
+ if (int.Parse(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString()) > 0)
|
|
|
{
|
|
{
|
|
|
- oi_id.Add(CheckTypeDGV.Rows[i].Cells["oi_id"].Value.ToString());
|
|
|
|
|
- ci_kind.Add(CheckTypeDGV.Rows[i].Cells["ci_kind"].Value.ToString());
|
|
|
|
|
- oi_sampleqty.Add(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString());
|
|
|
|
|
|
|
+ if (!(int.Parse(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString()) > int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text)))
|
|
|
|
|
+ {
|
|
|
|
|
+ oi_id.Add(CheckTypeDGV.Rows[i].Cells["oi_id"].Value.ToString());
|
|
|
|
|
+ ci_kind.Add(CheckTypeDGV.Rows[i].Cells["ci_kind"].Value.ToString());
|
|
|
|
|
+ oi_sampleqty.Add(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString());
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ OperateResult.AppendText(">>第" + (i + 1) + "行的数量大于送检批数量\n", Color.Red);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- OperateResult.AppendText(">>第" + (i + 1) + "行的数量大于送检批数量\n", Color.Red);
|
|
|
|
|
|
|
+ OperateResult.AppendText(">>第" + (i + 1) + "行的抽样数量必需大于0\n", Color.Red);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if (ChooseCount == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ OperateResult.AppendText(">>请勾选检验项目\n", Color.Red);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
//如果ID为0的数组存在内容则进行插入操作
|
|
//如果ID为0的数组存在内容则进行插入操作
|
|
|
dh.ExecuteSql("delete from oqcitems where oi_checkno='" + ob_checkno.Text + "'", "delete");
|
|
dh.ExecuteSql("delete from oqcitems where oi_checkno='" + ob_checkno.Text + "'", "delete");
|
|
|
if (oi_id.Count > 0)
|
|
if (oi_id.Count > 0)
|
|
@@ -125,6 +142,8 @@ namespace UAS_MES.OQC
|
|
|
sql.Append("LEFT JOIN QUA_CHECKITEM ON PD_CIID=CI_ID where pr_code='" + ob_projectcode.Text + "' and ci_kind=:ci_kind1");
|
|
sql.Append("LEFT JOIN QUA_CHECKITEM ON PD_CIID=CI_ID where pr_code='" + ob_projectcode.Text + "' and ci_kind=:ci_kind1");
|
|
|
dh.BatchInsert(sql.GetString(), new string[] { "ci_kind", "oi_sampleqty", "ci_kind1" }, ci_kind.ToArray(), oi_sampleqty.ToArray(), ci_kind.ToArray());
|
|
dh.BatchInsert(sql.GetString(), new string[] { "ci_kind", "oi_sampleqty", "ci_kind1" }, ci_kind.ToArray(), oi_sampleqty.ToArray(), ci_kind.ToArray());
|
|
|
}
|
|
}
|
|
|
|
|
+ GetBatch.PerformClick();
|
|
|
|
|
+ OperateResult.AppendText(">>保存成功\n", Color.Green);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
OperateResult.AppendText(">>送检批次必须为待检验状态\n", Color.Red);
|
|
OperateResult.AppendText(">>送检批次必须为待检验状态\n", Color.Red);
|
|
@@ -137,7 +156,6 @@ namespace UAS_MES.OQC
|
|
|
if (Checkob_maxngacceptqty())
|
|
if (Checkob_maxngacceptqty())
|
|
|
{
|
|
{
|
|
|
SaveConfiguration_Click(sender, e);
|
|
SaveConfiguration_Click(sender, e);
|
|
|
- GetBatch.PerformClick();
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -147,7 +165,7 @@ namespace UAS_MES.OQC
|
|
|
//对于最大不合格允通过数的校验
|
|
//对于最大不合格允通过数的校验
|
|
|
private bool Checkob_maxngacceptqty()
|
|
private bool Checkob_maxngacceptqty()
|
|
|
{
|
|
{
|
|
|
- if (int.Parse(ob_maxngacceptqty.Text) < 0)
|
|
|
|
|
|
|
+ if (int.Parse(ob_maxngacceptqty.Text == "" ? "0" : ob_maxngacceptqty.Text) < 0)
|
|
|
{
|
|
{
|
|
|
OperateResult.AppendText(">>最大不合格允通过数必须大于等于0\n", Color.Red);
|
|
OperateResult.AppendText(">>最大不合格允通过数必须大于等于0\n", Color.Red);
|
|
|
ob_maxngacceptqty.Text = null;
|
|
ob_maxngacceptqty.Text = null;
|
|
@@ -158,12 +176,10 @@ namespace UAS_MES.OQC
|
|
|
int result = (int)dh.ExecuteSql("update OQCBatch set ob_projectcode='" + ob_projectcode.Text + "',ob_remark = '" + ob_remark.Text + "',ob_aqlcode='" + ob_aqlcode.Text + "',ob_maxngacceptqty='" + ob_maxngacceptqty.Text + "' where ob_checkno='" + ob_checkno.Text + "' ", "update");
|
|
int result = (int)dh.ExecuteSql("update OQCBatch set ob_projectcode='" + ob_projectcode.Text + "',ob_remark = '" + ob_remark.Text + "',ob_aqlcode='" + ob_aqlcode.Text + "',ob_maxngacceptqty='" + ob_maxngacceptqty.Text + "' where ob_checkno='" + ob_checkno.Text + "' ", "update");
|
|
|
if (result > 0)
|
|
if (result > 0)
|
|
|
{
|
|
{
|
|
|
- OperateResult.AppendText(">>保存成功\n", Color.Green);
|
|
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- OperateResult.AppendText(">>保存失败\n", Color.Red);
|
|
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -225,18 +241,21 @@ namespace UAS_MES.OQC
|
|
|
{
|
|
{
|
|
|
for (int i = 0; i < CheckTypeDGV.Rows.Count; i++)
|
|
for (int i = 0; i < CheckTypeDGV.Rows.Count; i++)
|
|
|
{
|
|
{
|
|
|
- CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value = ad_qty.Text;
|
|
|
|
|
|
|
+ if (CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString() == "0")
|
|
|
|
|
+ {
|
|
|
|
|
+ CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value = ad_qty.Text;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void ob_projectcode_UserControlTextChanged(object sender, EventArgs e)
|
|
private void ob_projectcode_UserControlTextChanged(object sender, EventArgs e)
|
|
|
{
|
|
{
|
|
|
sql.Clear();
|
|
sql.Clear();
|
|
|
- sql.Append("select nvl(max(oi_id),0)oi_id, ci_kind,nvl(max(oi_sampleqty),0) oi_sampleqty from QUA_PROJECT left join ");
|
|
|
|
|
|
|
+ sql.Append("select nvl(max(oi_id),0)oi_id,ci_kind,nvl(max(oi_sampleqty),0) oi_sampleqty from QUA_PROJECT left join ");
|
|
|
sql.Append(" QUA_ProjectDetail on pd_prid=pr_id left join QUA_CheckItem on pd_ciid=ci_id ");
|
|
sql.Append(" QUA_ProjectDetail on pd_prid=pr_id left join QUA_CheckItem on pd_ciid=ci_id ");
|
|
|
sql.Append("left join OQCITEMS on oi_checkno ='" + ob_checkno.Text + "' and oi_projectcode='" + ob_projectcode.Text + "' ");
|
|
sql.Append("left join OQCITEMS on oi_checkno ='" + ob_checkno.Text + "' and oi_projectcode='" + ob_projectcode.Text + "' ");
|
|
|
sql.Append("and oi_projectcode = pr_code and oi_checkkind = ci_kind where pr_code='" + ob_projectcode.Text + "' group by ci_kind");
|
|
sql.Append("and oi_projectcode = pr_code and oi_checkkind = ci_kind where pr_code='" + ob_projectcode.Text + "' group by ci_kind");
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(),"select");
|
|
|
|
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
BaseUtil.FillDgvWithDataTable(CheckTypeDGV, dt);
|
|
BaseUtil.FillDgvWithDataTable(CheckTypeDGV, dt);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|