|
|
@@ -117,24 +117,16 @@ namespace UAS_MES.Make
|
|
|
OperateResult.AppendText(">>箱号不能为空\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
- if (!dh.CheckExist("package", "pa_outboxcode='" + palletcode.Text + "' and pa_type=3"))
|
|
|
- {
|
|
|
- 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='" + palletcode.Text + "'");
|
|
|
- int packageqty = int.Parse((dh.ExecuteSql(sql.GetString(), "select") as DataTable).Rows[0][0].ToString());
|
|
|
//如果未装满的话
|
|
|
- if (dh.CheckExist("Package", "pa_outboxcode='" + outboxcode.Text + "' and pa_type=2"))
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select pa_mothercode from package where pa_outboxcode='" + outboxcode.Text + "' and nvl(pa_type,2)=2", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
//判断是否已经装箱
|
|
|
- if (!dh.CheckExist("PackageDetail", "pd_innerboxcode='" + outboxcode.Text + "'"))
|
|
|
+ if (dt.Rows[0]["pa_mothercode"].ToString() == "")
|
|
|
{
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode, pd_innerboxcode, pd_innerqty)");
|
|
|
@@ -142,7 +134,10 @@ namespace UAS_MES.Make
|
|
|
sql.Append(",(select nvl(sum(pd_innerqty),0) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode=");
|
|
|
sql.Append("'" + outboxcode.Text + "') 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='" + palletcode.Text + "')", "pa_outboxcode='" + palletcode.Text + "' and pa_type=3");
|
|
|
+ dh.UpdateByCondition("package", "PA_CURRENTQTY=nvl(PA_CURRENTQTY,0)+1,PA_PACKAGEQTY=nvl(PA_PACKAGEQTY,0)+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + palletcode.Text + "')", "pa_outboxcode='" + palletcode.Text + "' and pa_type=3");
|
|
|
+ //更新大箱的栈板号
|
|
|
+ dh.UpdateByCondition("package", "pa_mothercode='" + palletcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
+ LoadCollectNum();
|
|
|
if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + palletcode.Text + "'").ToString() == "")
|
|
|
{
|
|
|
string carton_macode = dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
|
|
|
@@ -222,8 +217,10 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void ReleasePallet_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
+ //将子箱的母箱编号置成空
|
|
|
+ dh.ExecuteSql("update package set pa_mothercode='' where pa_outboxcode in(select PD_INNERBOXCODE from package left join packagedetail on pa_id=pd_paid where pa_outboxcode='" + palletcode.Text + "')", "update");
|
|
|
dh.ExecuteSql("delete from packagedetail where pd_paid=(select pa_id from package where pa_outboxcode='" + palletcode.Text + "' and pa_type=3)", "delete");
|
|
|
- dh.ExecuteSql("update package set pa_totalqty=0,pa_packageqty=0 where pa_outboxcode='" + palletcode.Text + "' and pa_type=3", "update");
|
|
|
+ dh.ExecuteSql("update package set pa_totalqty=0,pa_currentqty=0,pa_packageqty=0 where pa_outboxcode='" + palletcode.Text + "' and pa_type=3", "update");
|
|
|
OperateResult.AppendText(">>栈板号" + outboxcode.Text + "解除成功\n", Color.Green);
|
|
|
palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
|
|
|
}
|