|
|
@@ -54,11 +54,16 @@ namespace UAS_MES.OQC
|
|
|
if (ErrorMessage == "")
|
|
|
{
|
|
|
BaseUtil.SetFormValue(Controls, dt[0]);
|
|
|
- oi_checkqty.Text = dh.getFieldDataByCondition("oqcitems", "max(oi_checkqty)", "oi_checkno='"+ob_checkno.Text+"'").ToString();
|
|
|
- if (ob_aqlcode.Text == "")
|
|
|
+ //如果已经判定过则不可再编辑
|
|
|
+ if (ob_status.Text == "OK"|| ob_status.Text == "NG"|| ob_status.Text == "FOK"|| ob_status.Text == "FNG")
|
|
|
{
|
|
|
-
|
|
|
+ BatchPass.Enabled = false;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ BatchPass.Enabled = true;
|
|
|
+ }
|
|
|
+ oi_checkqty.Text = dh.getFieldDataByCondition("oqcitems", "max(oi_checkqty)", "oi_checkno='" + ob_checkno.Text + "'").ToString();
|
|
|
dgvr.Clear();
|
|
|
}
|
|
|
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
@@ -140,7 +145,7 @@ namespace UAS_MES.OQC
|
|
|
private void GetBatchTypeGridData()
|
|
|
{
|
|
|
dt = (DataTable)dh.ExecuteSql("select oi_checkkind,max(oi_sampleqty) oi_count,nvl(max(oi_checkqty),0) oi_checkedcount from OQCBatch left join OQCItems on ob_checkno=oi_checkno where oi_checkno='" + ob_checkno.Text + "' group by oi_checkkind ", "select");
|
|
|
- BaseUtil.FillExpandDgvWithDataTable(CheckTypeDGV, dt, true,true);
|
|
|
+ BaseUtil.FillExpandDgvWithDataTable(CheckTypeDGV, dt, true, true);
|
|
|
if (CheckTypeDGV.Rows.Count == 0)
|
|
|
{
|
|
|
OperateResult.AppendText(">>请先维护抽样计划\n", Color.Red);
|
|
|
@@ -149,21 +154,21 @@ namespace UAS_MES.OQC
|
|
|
string checkkind = "";
|
|
|
for (int i = 0; i < CheckTypeDGV.Rows.Count; i++)
|
|
|
{
|
|
|
- checkkind +=("'"+ CheckTypeDGV.Rows[i].Cells["oi_itemcode"].Value.ToString() + "',") ;
|
|
|
+ checkkind += ("'" + CheckTypeDGV.Rows[i].Cells["oi_itemcode"].Value.ToString() + "',");
|
|
|
}
|
|
|
sql.Clear();
|
|
|
sql.Append("select 1 choose,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 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 in (" + checkkind.Substring(0,checkkind.Length-1) + ")");
|
|
|
+ sql.Append("and oi_checkkind in (" + checkkind.Substring(0, checkkind.Length - 1) + ")");
|
|
|
TempForCheckType = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
sql.Clear();
|
|
|
sql.Append("select bg_code,bg_name from product left join productkind ");
|
|
|
sql.Append("on pr_kind=pk_name left join PRODUCTBADGROUP on pk_code= pb_kindcode ");
|
|
|
sql.Append("left join badgroup on bg_code=pb_badgroup where pr_code='" + ob_prodcode.Text + "'");
|
|
|
BadCode = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- BaseUtil.FillExpandDgvWithDataTable(WaitChooseDGV, BadCode, true,false);
|
|
|
+ BaseUtil.FillExpandDgvWithDataTable(WaitChooseDGV, BadCode, true, false);
|
|
|
}
|
|
|
|
|
|
private void Confirm_Click(object sender, EventArgs e)
|
|
|
@@ -258,7 +263,7 @@ namespace UAS_MES.OQC
|
|
|
}
|
|
|
if (bc_name.Count > 0)
|
|
|
{
|
|
|
- dh.UpdateByCondition("makeserial", "ms_badtimes=ms_badtimes+1", "ms_sncode='"+sncode.Text+"'");
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_badtimes=ms_badtimes+1", "ms_sncode='" + sncode.Text + "'");
|
|
|
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)");
|
|
|
@@ -266,7 +271,7 @@ namespace UAS_MES.OQC
|
|
|
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 + "'");
|
|
|
@@ -276,9 +281,9 @@ namespace UAS_MES.OQC
|
|
|
//更新批次中的合格数不合格数:用抽检批检验项目表获取最大的抽检数和不合格数
|
|
|
sql.Clear();
|
|
|
sql.Append("select count(1)from (select ois_sncode from OQCITEMSAMPLES where ");
|
|
|
- sql.Append("ois_checkno = '"+ob_checkno.Text+"' and ois_ifng = 1 group by ois_sncode)");
|
|
|
- string ngqty = (dh.ExecuteSql(sql.GetString(),"select") as DataTable).Rows[0][0].ToString();
|
|
|
- dh.ExecuteSql("update OQCBATCH set ob_ngqty='"+ngqty+"',ob_okqty=(select max(oi_checkqty)-'"+ngqty+"' from OQCItems where oi_checkno ='" + ob_checkno.Text + "') where ob_checkno ='" + ob_checkno.Text + "'", "update");
|
|
|
+ sql.Append("ois_checkno = '" + ob_checkno.Text + "' and ois_ifng = 1 group by ois_sncode)");
|
|
|
+ string ngqty = (dh.ExecuteSql(sql.GetString(), "select") as DataTable).Rows[0][0].ToString();
|
|
|
+ dh.ExecuteSql("update OQCBATCH set ob_ngqty='" + ngqty + "',ob_okqty=(select max(oi_checkqty)-'" + ngqty + "' from OQCItems where oi_checkno ='" + ob_checkno.Text + "') where ob_checkno ='" + ob_checkno.Text + "'", "update");
|
|
|
OperateResult.AppendText(">>序列号 " + sncode.Text + "操作成功\n", Color.Green);
|
|
|
GetBatch.PerformClick();
|
|
|
ChoosedDGV.DataSource = null;
|
|
|
@@ -304,11 +309,12 @@ namespace UAS_MES.OQC
|
|
|
{
|
|
|
dh.ExecuteSql("update OQCBatch set ob_status='OK',ob_result='OK' where ob_checkno='" + ob_checkno.Text + "'", "select");
|
|
|
string ErrorMessage;
|
|
|
- LogicHandler.UpdateOQCMessage(ms_sncode.Text, ob_checkno.Text,ob_makecode.Text, "OQC批判过", User.UserSourceCode, User.UserName, "批次通过", out ErrorMessage);
|
|
|
+ LogicHandler.UpdateOQCMessage(ms_sncode.Text, ob_checkno.Text, ob_makecode.Text, "OQC批判过", User.UserSourceCode, User.UserName, "批次通过", out ErrorMessage);
|
|
|
//记录操作日志
|
|
|
LogicHandler.InsertMakeProcess(ms_sncode.Text, ob_makecode.Text, User.UserSourceCode, "批结果判定", "批次通过", User.UserName);
|
|
|
GetBatch.PerformClick();
|
|
|
- OperateResult.AppendText(">>"+ob_checkno.Text+"通过批成功\n", Color.Green);
|
|
|
+ BatchPass.Enabled = false;
|
|
|
+ OperateResult.AppendText(">>" + ob_checkno.Text + "通过批成功\n", Color.Green);
|
|
|
}
|
|
|
else
|
|
|
OperateResult.AppendText(">>当前批次不合格数为" + ob_ngqty.Text + ",大于最大不合格允通过数" + ob_maxngacceptqty.Text + "\n", Color.Red);
|
|
|
@@ -386,7 +392,7 @@ namespace UAS_MES.OQC
|
|
|
{
|
|
|
string checkkind = CheckTypeDGV.Rows[e.RowIndex].Cells["oi_itemcode"].Value.ToString();
|
|
|
|
|
|
- DataTable dt = BaseUtil.filterDataTable(TempForCheckType,"oi_checkkind='"+checkkind+"'");
|
|
|
+ DataTable dt = BaseUtil.filterDataTable(TempForCheckType, "oi_checkkind='" + checkkind + "'");
|
|
|
DataGridViewRow headerRow = new DataGridViewRow();
|
|
|
|
|
|
DataGridViewTextBoxCell textcell = new DataGridViewTextBoxCell();
|
|
|
@@ -431,7 +437,7 @@ namespace UAS_MES.OQC
|
|
|
dataRow.Tag = "SonRow";
|
|
|
DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
|
|
|
checkcell.Tag = "SonRow";
|
|
|
- checkcell.Value=true;
|
|
|
+ checkcell.Value = true;
|
|
|
dataRow.Cells.Add(checkcell);
|
|
|
|
|
|
textcell = new DataGridViewTextBoxCell();
|