输入字符串等不符合要求的值需要return;
protected override void ExecSaveEvent()
{
DataTable dt = new DataTable();
string sBatchId = txtBatchID.Text;//"TEST"
string sFinalDecision = comboBoxEdit1.Text;
int sQtyPass = 0;
int sQtyFail = 0;
if (sFinalDecision == "部分合格")
{
if((CommonFunction.CheckValue(textEdit1, CHECK_VALUE_TYPE.Numeric))== true)
{
sQtyPass = Convert.ToInt32(textEdit1.Text);
}
else
{
return;
}
if ((CommonFunction.CheckValue(textEdit2, CHECK_VALUE_TYPE.Numeric)) == true)
{
sQtyFail = Convert.ToInt32(textEdit2.Text);
}
else
{
return;
}
}
if(!string.IsNullOrEmpty(sBatchId))
{
dt = QCMLIST.ViewQCMInspBatch(sBatchId);
if (dt == null)
{
CommonFunction.ShowMsgBox("不存在批号:" + sBatchId);
return;
}
}
if ((CommonFunction.CheckValue(txtBatchID, CHECK_VALUE_TYPE.NotNull)) == false)
{
return;
}
if ((CommonFunction.CheckValue(comboBoxEdit1, CHECK_VALUE_TYPE.NotNull)) == false)
{
return;
}
DataTable dt1 = QCMLIST.JudgeQcmFinalDecision(sBatchId, sFinalDecision, sQtyPass, sQtyFail);
if (dt1!=null)
{
CommonFunction.ShowMsgBox("保存成功!");
}
return;
}
==================
if (gluCOATemplate.Text == "")
{
CommonFunction.ShowMsgBox("请选择模板ID");
gluCOATemplate.Focus();
return ;
}
if (txtLotID.Text == "")
{
CommonFunction.ShowMsgBox("检查批号不能为空");
txtLotID.Focus();
return ;
}
另:时间格式转换:
txtCreateTime.Text = CommonFunction.MakeDateFormat(out_node.GetString("CREATE_TIME"));
本文详细介绍了在C#中实现质量控制模块保存事件的代码逻辑,包括批号、最终决定、通过数量和失败数量的验证过程。此外,还展示了如何使用CommonFunction类进行数值检查、非空检查及时间格式转换。
4270

被折叠的 条评论
为什么被折叠?



