|
|
@@ -369,7 +369,7 @@ namespace UAS_MES.Make
|
|
|
BaseUtil.CleanDGVData(PackageDetail);
|
|
|
pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PACKAGE", ms_makecode, pr_code.Text, User.UserCode);
|
|
|
}
|
|
|
- if (!CheckOutBoxLength(ms_makecode))
|
|
|
+ if (!CheckOutBoxLength(ms_salecode_text))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
@@ -1010,72 +1010,39 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- private bool CheckOutBoxLength(string ms_makecode)
|
|
|
+ private bool CheckOutBoxLength(string ms_salecode_text)
|
|
|
{
|
|
|
if (AutoGenBoxCode.Checked)
|
|
|
{
|
|
|
- string ms_salecode = dh.getFieldDataByCondition("make", "ma_salecode", "ma_code = '" + ms_makecode + "'").ToString();
|
|
|
- if (ms_salecode != "")
|
|
|
+ if (ms_salecode_text != "")
|
|
|
{
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql(" select pn_number,pn_id,pn_caller,pn_numberlength,pn_leadcode from PACKAGENUMBER where pn_caller='" + ms_salecode + "'", "select");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(" select pn_number,pn_id,pn_caller,pn_numberlength,pn_leadcode from PACKAGENUMBER where pn_caller='" + ms_salecode_text + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
string pn_leadcode = dt.Rows[0]["pn_leadcode"].ToString();
|
|
|
int pn_numberlength = int.Parse(dt.Rows[0]["pn_numberlength"].ToString());
|
|
|
- OutBoxLength.Text = (pn_leadcode.Length + pn_numberlength).ToString();
|
|
|
- PreFix.Text = pn_leadcode;
|
|
|
- BaseUtil.SetCacheData("OutBoxLength", OutBoxLength.Text);
|
|
|
- BaseUtil.SetCacheData("PreFix", PreFix.Text);
|
|
|
+ if (OutBoxLength.Text != (pn_leadcode.Length + pn_numberlength).ToString())
|
|
|
+ {
|
|
|
+ OutBoxLength.Text = (pn_leadcode.Length + pn_numberlength).ToString();
|
|
|
+ BaseUtil.SetCacheData("OutBoxLength", OutBoxLength.Text);
|
|
|
+ }
|
|
|
+ if (PreFix.Text != pn_leadcode)
|
|
|
+ {
|
|
|
+ PreFix.Text = pn_leadcode;
|
|
|
+ BaseUtil.SetCacheData("PreFix", PreFix.Text);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- OperateResult.AppendText(">>订单号" + ms_salecode + "未维护箱号规则\n", Color.Black);
|
|
|
+ OperateResult.AppendText(">>订单号" + ms_salecode_text + "未维护箱号规则\n", Color.Black);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>工单" + ms_makecode + "无订单号\n", Color.Black);
|
|
|
- }
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
- //勾选了检验长度进行校验
|
|
|
- if (OutBoxLength.Text != "")
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- int.Parse(OutBoxLength.Text);
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- MessageBox.Show("请填写正确的箱号长度");
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (pa_outboxcode.Text.Length != int.Parse(OutBoxLength.Text))
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>箱号长度错误,请重新输入箱号\n", Color.Red);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- if (PreFix.Text != "")
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- if (pa_outboxcode.Text.Substring(0, PreFix.Text.Length) != PreFix.Text)
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>箱号前缀不匹配,请重新输入箱号\n", Color.Red);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>箱号前缀不匹配,请重新输入箱号\n", Color.Red);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- return true;
|
|
|
+ return CheckOutBoxLength();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void AutoGenBoxCode_CheckedChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
if (AutoGenBoxCode.Checked)
|