|
|
@@ -27,6 +27,7 @@ namespace UAS_MES.Make
|
|
|
|
|
|
Make_NewPallet NewPallet;
|
|
|
|
|
|
+ string pa_nextstep = "";
|
|
|
//箱类型
|
|
|
string pa_type;
|
|
|
//物料编号
|
|
|
@@ -117,23 +118,75 @@ namespace UAS_MES.Make
|
|
|
OperateResult.AppendText(">>箱号不能为空\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
- string pa_nextstep = dh.getFieldDataByCondition("package", "pa_nextstep", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
|
|
|
- if (pa_nextstep != User.CurrentStepCode && pa_nextstep != "")
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pd_makecode pa_makecode,pa_id,pd_prodcode pa_prodcode,pa_status,pa_nextstep from packagedetail ");
|
|
|
+ sql.Append("left join package on pd_paid=pa_id where pd_outboxcode='" + outboxcode.Text + "'");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
+ pa_nextstep = dt.Rows[0]["pa_nextstep"].ToString();
|
|
|
+ if (pa_nextstep != User.CurrentStepCode && pa_nextstep != "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>箱号" + outboxcode.Text + "的下一工序不是当前岗位资源对应工序\n", Color.Red, outboxcode);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //未空表示线外
|
|
|
+ if (pa_nextstep == "")
|
|
|
+ {
|
|
|
+ //判断线外,必须已完工并且未入库
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select wm_concat(ms_sncode) from mes_package_view left join makeserial on v_barcode=ms_sncode where v_outboxcode='" + outboxcode.Text + "' and ms_status<>2", "select");
|
|
|
+ if (dt.Rows[0][0].ToString() == "")
|
|
|
+ {
|
|
|
+ //判断箱未入库
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select count(1) from package where pa_outboxcode='" + outboxcode.Text + "' and nvl(pa_iostatus,0)<>0", "select");
|
|
|
+ if (dt.Rows[0][0].ToString() != "0")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>序列号" + dt.Rows[0][0].ToString() + "已入库,不允许装箱\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>序列号" + dt.Rows[0][0].ToString() + "尚未完工\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱号" + outboxcode.Text + "的下一工序不是当前岗位资源对应工序\n", Color.Red, outboxcode);
|
|
|
+ OperateResult.AppendText(">>箱号" + outboxcode.Text + "未采集内容,不允许装栈板箱\n", Color.Red, outboxcode);
|
|
|
return;
|
|
|
}
|
|
|
- string pa_status = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + palletcode.Text + "'").ToString();
|
|
|
- if (pa_status == "1")
|
|
|
+ pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + palletcode.Text + "'").ToString();
|
|
|
+ if (pa_status.Text == "1" && AutoOutBoxCode.Checked)
|
|
|
{
|
|
|
palletcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
|
|
|
+ pa_status.Text = "1";
|
|
|
+ }
|
|
|
+ else if (palletcode.Text == "" && AutoOutBoxCode.Checked)
|
|
|
+ {
|
|
|
+ palletcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
|
|
|
+ }
|
|
|
+ else if (palletcode.Text == "" && !AutoOutBoxCode.Checked)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>栈板号箱号不能为空\n", Color.Red, outboxcode);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ pa_outboxcode.Text = palletcode.Text;
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select pa_id from package where pa_outboxcode='" + palletcode.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count == 0)
|
|
|
+ {
|
|
|
+ pa_id = dh.GetSEQ("package_seq");
|
|
|
sql.Clear();
|
|
|
- sql.Append("insert into package (pa_id,pa_outboxcode,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,pa_standardqty,pa_sccode,pa_currentstep)values");
|
|
|
- sql.Append("(package_seq.nextval,'" + palletcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',3,'" + pa_prodcode.Text + "',0,'" + pa_standardqty.Text + "','" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
|
|
|
+ sql.Append("insert into package (pa_id,pa_outboxcode,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_sccode,pa_currentstep)values");
|
|
|
+ sql.Append("(" + pa_id + ",'" + palletcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',3,'" + pa_prodcode.Text + "',0,0,'" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
- palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
|
|
|
}
|
|
|
- //如果未装满的话
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pa_id = dt.Rows[0]["pa_id"].ToString();
|
|
|
+ }
|
|
|
dt = (DataTable)dh.ExecuteSql("select pa_mothercode,nvl(pa_status,0) pa_status from package where pa_outboxcode='" + outboxcode.Text + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
@@ -142,15 +195,17 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (dt.Rows[0]["pa_status"].ToString() == "1")
|
|
|
{
|
|
|
+ List<string> SQLS = new List<string>();
|
|
|
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 + "','" + palletcode.Text + "','" + outboxcode.Text + "' ");
|
|
|
+ sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_makecode,pd_prodcode,pd_innerboxcode, pd_innerqty,pd_builddate)");
|
|
|
+ sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + palletcode.Text + "','" + pa_makecode.Text + "','" + pa_prodcode.Text + "','" + outboxcode.Text + "' ");
|
|
|
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=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");
|
|
|
+ sql.Append("'" + outboxcode.Text + "'),sysdate from package where pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
+ SQLS.Add(sql.GetString());
|
|
|
+ SQLS.Add("update package set 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 + "') where pa_outboxcode='" + palletcode.Text + "' and pa_type=3");
|
|
|
+ SQLS.Add("update package set pa_mothercode='" + palletcode.Text + "' where pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
+ dh.ExecuteSQLTran(SQLS.ToArray());
|
|
|
//更新大箱的栈板号
|
|
|
- dh.UpdateByCondition("package", "pa_mothercode='" + palletcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
LoadCollectNum();
|
|
|
if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + palletcode.Text + "'").ToString() == "")
|
|
|
{
|
|
|
@@ -160,6 +215,7 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
//已箱号过站
|
|
|
LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "栈板采集成功,栈板号:" + palletcode.Text, "栈板采集");
|
|
|
+ LoadGridData();
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "栈板采集", "栈板采集成功", palletcode.Text, "");
|
|
|
OperateResult.AppendText(">>箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
|
|
|
LoadGridData();
|
|
|
@@ -249,10 +305,10 @@ namespace UAS_MES.Make
|
|
|
dh.ExecuteSQLTran(SQLS.ToArray());
|
|
|
}
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "栈板采集", "解除栈板" + palletcode.Text + "成功", palletcode.Text, "");
|
|
|
- OperateResult.AppendText(">>栈板号" + outboxcode.Text + "解除成功\n", Color.Green);
|
|
|
+ OperateResult.AppendText(">>栈板号" + palletcode.Text + "解除成功\n", Color.Green);
|
|
|
palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
|
|
|
}
|
|
|
- OperateResult.AppendText(">>栈板号" + outboxcode.Text + "未采集箱\n", Color.Red);
|
|
|
+ else OperateResult.AppendText(">>栈板号" + palletcode.Text + "未采集箱\n", Color.Red);
|
|
|
}
|
|
|
|
|
|
private void Make_PalletCollection_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
@@ -264,8 +320,9 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (pa_prodcode.Text != "" && palletcode.Text != "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>" + palletcode.Text + "装栈板成功\n", Color.Black);
|
|
|
+ OperateResult.AppendText(">>" + palletcode.Text + "装栈板成功\n", Color.Green);
|
|
|
dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + palletcode.Text + "'", "update");
|
|
|
+ pa_status.Text = "1";
|
|
|
}
|
|
|
else OperateResult.AppendText(">>栈板号不能为空\n", Color.Red);
|
|
|
}
|
|
|
@@ -278,5 +335,10 @@ namespace UAS_MES.Make
|
|
|
PrintNum.Text = (PrintNums == "" ? "1" : PrintNums);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void pa_prodcode_TextChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ FillPrintLabel();
|
|
|
+ }
|
|
|
}
|
|
|
}
|