|
|
@@ -42,6 +42,8 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private System.DateTime[] indate;
|
|
|
|
|
|
+ string ErrorMessage = "";
|
|
|
+
|
|
|
public Make_BigBoxCollection()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
@@ -86,6 +88,7 @@ namespace UAS_MES.Make
|
|
|
OperateResult.AppendText(">>大箱号不能为空\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
sql.Clear();
|
|
|
sql.Append("select pa_makecode,pa_standardqty,pa_packageqty,pa_prodcode,pa_outboxcode,pa_totalqty,pa_currentqty,pa_custcode,pa_salecode ");
|
|
|
sql.Append("from package where pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type =2");
|
|
|
@@ -109,64 +112,68 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
{
|
|
|
- if (outboxcode.Text == "")
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>卡通箱号不能为空\n", Color.Red);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!dh.CheckExist("package", "pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2"))
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>大箱号不存在\n", Color.Red);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (pa_standardqty.Text == pa_currentqty.Text)
|
|
|
- {
|
|
|
- Packing_Click(new object(), new EventArgs());
|
|
|
- }
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select count(0) cn from packagedetail left join package on pa_id=pd_paid where ");
|
|
|
- sql.Append("pa_outboxcode='" + bigoutboxcode.Text + "'");
|
|
|
- int packageqty = int.Parse((dh.ExecuteSql(sql.GetString(), "select") as DataTable).Rows[0][0].ToString());
|
|
|
- //如果未装满的话
|
|
|
- if (packageqty < pa_stanqty)
|
|
|
+ if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
|
|
|
{
|
|
|
- if (dh.CheckExist("Package", "pa_outboxcode='" + outboxcode.Text + "' and nvl(pa_type,1)=1"))
|
|
|
+ if (outboxcode.Text == "")
|
|
|
{
|
|
|
- //判断是否已经装箱
|
|
|
- if (!dh.CheckExist("PackageDetail", "pd_innerboxcode='" + outboxcode.Text + "'"))
|
|
|
+ OperateResult.AppendText(">>卡通箱号不能为空\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!dh.CheckExist("package", "pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2"))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>大箱号不存在\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (pa_standardqty.Text == pa_currentqty.Text)
|
|
|
+ {
|
|
|
+ Packing_Click(new object(), new EventArgs());
|
|
|
+ }
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select count(0) cn from packagedetail left join package on pa_id=pd_paid where ");
|
|
|
+ sql.Append("pa_outboxcode='" + bigoutboxcode.Text + "'");
|
|
|
+ int packageqty = int.Parse((dh.ExecuteSql(sql.GetString(), "select") as DataTable).Rows[0][0].ToString());
|
|
|
+ //如果未装满的话
|
|
|
+ if (packageqty < pa_stanqty)
|
|
|
+ {
|
|
|
+ if (dh.CheckExist("Package", "pa_outboxcode='" + outboxcode.Text + "' and nvl(pa_type,1)=1"))
|
|
|
{
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_innerboxcode, pd_innerqty)");
|
|
|
- sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + bigoutboxcode.Text + "','" + outboxcode.Text + "'");
|
|
|
- sql.Append(",pa_packageqty from package where pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
- dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
- dh.UpdateByCondition("package", "PA_CURRENTQTY=PA_CURRENTQTY+1,PA_PACKAGEQTY=PA_PACKAGEQTY+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + bigoutboxcode.Text + "')", "pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2");
|
|
|
- if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString() == "")
|
|
|
- {
|
|
|
- string carton_macode = dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
|
|
|
- pa_makecode.Text = carton_macode;
|
|
|
- dh.ExecuteSql("update package set pa_makecode='" + carton_macode + "' where pa_outboxcode='" + bigoutboxcode.Text + "'", "update");
|
|
|
- }
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "卡通箱" + outboxcode.Text + "采集成功", outboxcode.Text, "");
|
|
|
- OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
|
|
|
- LoadGridData();
|
|
|
- LoadCollectNum();
|
|
|
- //判断明细和箱内的件数的差是不是1,如果只相差1则表示此时已经采集慢了
|
|
|
- if (packageqty + 1 == pa_stanqty)
|
|
|
+ //判断是否已经装箱
|
|
|
+ if (!dh.CheckExist("PackageDetail", "pd_innerboxcode='" + outboxcode.Text + "'"))
|
|
|
{
|
|
|
- if (AutoPrint.Checked)
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_innerboxcode, pd_innerqty)");
|
|
|
+ sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + bigoutboxcode.Text + "','" + outboxcode.Text + "'");
|
|
|
+ sql.Append(",pa_packageqty from package where pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
+ dh.UpdateByCondition("package", "PA_CURRENTQTY=PA_CURRENTQTY+1,PA_PACKAGEQTY=PA_PACKAGEQTY+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + bigoutboxcode.Text + "')", "pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2");
|
|
|
+ if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString() == "")
|
|
|
+ {
|
|
|
+ string carton_macode = dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
|
|
|
+ pa_makecode.Text = carton_macode;
|
|
|
+ dh.ExecuteSql("update package set pa_makecode='" + carton_macode + "' where pa_outboxcode='" + bigoutboxcode.Text + "'", "update");
|
|
|
+ }
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "卡通箱" + outboxcode.Text + "采集成功", outboxcode.Text, "");
|
|
|
+ OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
|
|
|
+ LoadGridData();
|
|
|
+ LoadCollectNum();
|
|
|
+ //判断明细和箱内的件数的差是不是1,如果只相差1则表示此时已经采集慢了
|
|
|
+ if (packageqty + 1 == pa_stanqty)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱已装满,自动打印!\n", Color.Green);
|
|
|
- Printlab.PerformClick();
|
|
|
+ if (AutoPrint.Checked)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>箱已装满,自动打印!\n", Color.Green);
|
|
|
+ Printlab.PerformClick();
|
|
|
+ }
|
|
|
+ OperateResult.AppendText(">>大箱" + bigoutboxcode.Text + "已采集满\n", Color.Green);
|
|
|
}
|
|
|
- OperateResult.AppendText(">>大箱" + bigoutboxcode.Text + "已采集满\n", Color.Green);
|
|
|
}
|
|
|
+ else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "已采集\n", Color.Red, outboxcode);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "已采集\n", Color.Red, outboxcode);
|
|
|
+ else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "不存在\n", Color.Red, outboxcode);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "不存在\n", Color.Red, outboxcode);
|
|
|
+ else OperateResult.AppendText(">>大箱" + bigoutboxcode.Text + "已装满\n", Color.Red, outboxcode);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>大箱" + bigoutboxcode.Text + "已装满\n", Color.Red, outboxcode);
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
|