|
|
@@ -135,45 +135,49 @@ namespace UAS_MES.Make
|
|
|
//如果未装满的话
|
|
|
if (packageqty < pa_stanqty)
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select nvl(pa_type,1) pa_type,pa_mothercode from package where pa_outboxcode='"+outboxcode.Text+"'", "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select nvl(pa_status,1) pa_status,pa_mothercode from package where pa_outboxcode='" + outboxcode.Text + "' and pa_type=1", "select");
|
|
|
//采集的卡通箱号存在
|
|
|
- if (dt.Rows.Count>0)
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- //判断是否已经装箱
|
|
|
- if (dt.Rows[0]["pa_mothercode"].ToString()=="")
|
|
|
+ if (dt.Rows[0]["pa_status"].ToString() != "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");
|
|
|
- //箱内计数+1
|
|
|
- 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");
|
|
|
- //更新采集的子箱记录母箱号
|
|
|
- dh.UpdateByCondition("package", "pa_mothercode='" + bigoutboxcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
- if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString() == "")
|
|
|
+ //判断是否已经装箱
|
|
|
+ if (dt.Rows[0]["pa_mothercode"].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 (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");
|
|
|
+ //箱内计数+1
|
|
|
+ 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");
|
|
|
+ //更新采集的子箱记录母箱号
|
|
|
+ dh.UpdateByCondition("package", "pa_mothercode='" + bigoutboxcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
+ 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);
|
|
|
}
|