|
|
@@ -151,7 +151,7 @@ namespace UAS_MES.Make
|
|
|
if (pa_nextstep == "")
|
|
|
{
|
|
|
//判断线外,必须已完工并且未入库
|
|
|
- dt = (DataTable)dh.ExecuteSql("select wm_concat(ms_sncode) from mes_package_view left join makeserial on v_barcode=ms_sncode and ms_sncode=v_barcode where v_outboxcode='" + outboxcode.Text + "' and ms_status<>2", "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select wm_concat(ms_sncode) from mes_package_view left join makeserial on v_makecode=ms_makecode and ms_sncode=v_barcode where v_outboxcode='" + outboxcode.Text + "' and ms_status<>2", "select");
|
|
|
if (dt.Rows[0][0].ToString() == "")
|
|
|
{
|
|
|
//判断箱未入库
|
|
|
@@ -202,7 +202,7 @@ namespace UAS_MES.Make
|
|
|
return;
|
|
|
}
|
|
|
//箱号不存在进行插入
|
|
|
- dt = (DataTable)dh.ExecuteSql("select pa_id from package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select pa_id from package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
|
|
|
if (dt.Rows.Count == 0)
|
|
|
{
|
|
|
pa_id = dh.GetSEQ("package_seq");
|
|
|
@@ -223,7 +223,73 @@ namespace UAS_MES.Make
|
|
|
return;
|
|
|
}
|
|
|
//如果未装满的话
|
|
|
- CollectBox();
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select count(0) cn from packagedetail left join package on pa_id=pd_paid where ");
|
|
|
+ sql.Append("pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
+ int packageqty = int.Parse((dh.ExecuteSql(sql.GetString(), "select") as DataTable).Rows[0][0].ToString());
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select nvl(pa_status,0) pa_status,pa_mothercode from package where pa_outboxcode='" + outboxcode.Text + "' and pa_type=1", "select");
|
|
|
+ //采集的卡通箱号存在
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ if (dt.Rows[0]["pa_status"].ToString() == "1")
|
|
|
+ {
|
|
|
+ //判断是否已经装箱
|
|
|
+ if (dt.Rows[0]["pa_mothercode"].ToString() == "")
|
|
|
+ {
|
|
|
+ //插入大箱明细
|
|
|
+ List<string> SQLS = new List<string>();
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_innerboxcode, pd_innerqty,pd_makecode,pd_prodcode,pd_builddate)");
|
|
|
+ sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + outboxcode.Text + "'");
|
|
|
+ sql.Append(",pa_packageqty,pa_makecode,'" + pd_prodcode.Text + "',sysdate from package where pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
+ SQLS.Add(sql.GetString());
|
|
|
+ //箱内计数+1
|
|
|
+ SQLS.Add("update package set 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='" + pa_outboxcode.Text + "') where pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type=2");
|
|
|
+ //更新采集的子箱记录母箱号
|
|
|
+ SQLS.Add("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
+ dh.ExecuteSQLTran(SQLS.ToArray());
|
|
|
+ if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + pa_outboxcode.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='" + pa_outboxcode.Text + "'", "update");
|
|
|
+ }
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "大箱" + pa_outboxcode.Text + "采集卡通箱" + outboxcode.Text + "采集成功", outboxcode.Text, "");
|
|
|
+ //记录卡通箱所有序列号操作日志
|
|
|
+ if (pa_nextstep != "")
|
|
|
+ {
|
|
|
+ LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "大箱采集成功,大箱号:" + pa_outboxcode.Text, "大箱采集");
|
|
|
+ }
|
|
|
+ LoadGridData();
|
|
|
+ LoadCollectNum();
|
|
|
+ //更新箱号的NextStepCode
|
|
|
+ if (pa_currentqty.Text == "1")
|
|
|
+ {
|
|
|
+ string nextstepcode = dh.getFieldDataByCondition("mes_package_view left join makeserial on ms_sncode=v_barcode", "ms_nextstepcode", "v_outboxcode='" + outboxcode.Text + "'").ToString();
|
|
|
+ dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
+ }
|
|
|
+ OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
|
|
|
+ if (packageqty + 1 == pa_stanqty)
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
|
|
|
+ if (AutoPrint.Checked)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>箱已装满,自动打印!\n", Color.Green);
|
|
|
+ Printlab.PerformClick();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (dt.Rows[0]["pa_mothercode"].ToString() == pa_outboxcode.Text)
|
|
|
+ OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "已在本大箱内\n", Color.Red, outboxcode);
|
|
|
+ else
|
|
|
+ OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "已采集至大箱" + dt.Rows[0]["pa_mothercode"].ToString() + "\n", Color.Red, outboxcode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "尚未封箱\n", Color.Red, outboxcode);
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "不存在\n", Color.Red, outboxcode);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -234,6 +300,7 @@ namespace UAS_MES.Make
|
|
|
SQLS.Add("update package set pa_packageqty=pa_packageqty-1,pa_totalqty=pa_totalqty-(select pa_totalqty from package where pa_outboxcode='" + outboxcode.Text + "'),pa_currentqty=0,pa_status=0 where pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
SQLS.Add("update package set pa_mothercode='' where pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
dh.ExecuteSQLTran(SQLS.ToArray());
|
|
|
+ OperateResult.AppendText(">>箱号" + outboxcode.Text + "取消采集成功\n", Color.Green);
|
|
|
LoadCollectNum();
|
|
|
LoadGridData();
|
|
|
outboxcode.Clear();
|
|
|
@@ -254,75 +321,6 @@ namespace UAS_MES.Make
|
|
|
BaseUtil.FillDgvWithDataTable(PackageInf, dt);
|
|
|
}
|
|
|
|
|
|
- private void CollectBox()
|
|
|
- {
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select count(0) cn from packagedetail left join package on pa_id=pd_paid where ");
|
|
|
- sql.Append("pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
- int packageqty = int.Parse((dh.ExecuteSql(sql.GetString(), "select") as DataTable).Rows[0][0].ToString());
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select nvl(pa_status,0) pa_status,pa_mothercode from package where pa_outboxcode='" + outboxcode.Text + "' and pa_type=1", "select");
|
|
|
- //采集的卡通箱号存在
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- if (dt.Rows[0]["pa_status"].ToString() == "1")
|
|
|
- {
|
|
|
- //判断是否已经装箱
|
|
|
- if (dt.Rows[0]["pa_mothercode"].ToString() == "")
|
|
|
- {
|
|
|
- //插入大箱明细
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_innerboxcode, pd_innerqty,pd_makecode,pd_prodcode,pd_builddate)");
|
|
|
- sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + outboxcode.Text + "'");
|
|
|
- sql.Append(",pa_packageqty,pa_makecode,'" + pd_prodcode.Text + "',sysdate 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='" + pa_outboxcode.Text + "')", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type=2");
|
|
|
- //更新采集的子箱记录母箱号
|
|
|
- dh.UpdateByCondition("package", "pa_mothercode='" + pa_outboxcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
|
|
|
- if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + pa_outboxcode.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='" + pa_outboxcode.Text + "'", "update");
|
|
|
- }
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "大箱" + pa_outboxcode.Text + "采集卡通箱" + outboxcode.Text + "采集成功", outboxcode.Text, "");
|
|
|
- //记录卡通箱所有序列号操作日志
|
|
|
- if (pa_nextstep != "")
|
|
|
- {
|
|
|
- LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "大箱采集成功,大箱号:" + pa_outboxcode.Text, "大箱采集");
|
|
|
- }
|
|
|
- LoadGridData();
|
|
|
- LoadCollectNum();
|
|
|
- //更新箱号的NextStepCode
|
|
|
- if (pa_currentqty.Text == "1")
|
|
|
- {
|
|
|
- string nextstepcode = dh.getFieldDataByCondition("mes_package_view left join makeserial on ms_sncode=v_barcode", "ms_nextstepcode", "v_outboxcode='" + outboxcode.Text + "'").ToString();
|
|
|
- dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
- }
|
|
|
- OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
|
|
|
- if (packageqty + 1 == pa_stanqty)
|
|
|
- {
|
|
|
- dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
|
|
|
- if (AutoPrint.Checked)
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>箱已装满,自动打印!\n", Color.Green);
|
|
|
- Printlab.PerformClick();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (dt.Rows[0]["pa_mothercode"].ToString() == pa_outboxcode.Text)
|
|
|
- OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "已在本大箱内\n", Color.Red, outboxcode);
|
|
|
- else
|
|
|
- OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "已采集至大箱" + dt.Rows[0]["pa_mothercode"].ToString() + "\n", Color.Red, outboxcode);
|
|
|
- }
|
|
|
- }
|
|
|
- else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "尚未封箱\n", Color.Red, outboxcode);
|
|
|
- }
|
|
|
- else OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "不存在\n", Color.Red, outboxcode);
|
|
|
- }
|
|
|
-
|
|
|
private void FillPrintLabel()
|
|
|
{
|
|
|
DataTable _dt = (DataTable)dh.ExecuteSql("select la_id,la_printnos,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault from label where la_prodcode='" + pa_prodcode.Text + "' and la_templatetype='大箱标' and la_statuscode='AUDITED' order by la_isdefault", "select");
|