|
@@ -128,72 +128,28 @@ namespace UAS_MES.Make
|
|
|
OperateResult.AppendText(">>大箱号不存在\n", Color.Red);
|
|
OperateResult.AppendText(">>大箱号不存在\n", Color.Red);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (pa_standardqty.Text == pa_currentqty.Text)
|
|
|
|
|
|
|
+ //获取大箱的状态
|
|
|
|
|
+ string pa_status = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString();
|
|
|
|
|
+ if (pa_standardqty.Text == pa_currentqty.Text && pa_status == "0")
|
|
|
{
|
|
{
|
|
|
- Packing_Click(new object(), new EventArgs());
|
|
|
|
|
|
|
+ dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + bigoutboxcode.Text + "'", "update");
|
|
|
}
|
|
}
|
|
|
- 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 (int.Parse(pa_currentqty.Text) < pa_stanqty && pa_status == "0")
|
|
|
{
|
|
{
|
|
|
- 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[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)");
|
|
|
|
|
- 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, "");
|
|
|
|
|
- //记录卡通箱所有序列号操作日志
|
|
|
|
|
- LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "大箱采集成功,大箱号:" + bigoutboxcode.Text, "大箱采集");
|
|
|
|
|
- LoadGridData();
|
|
|
|
|
- LoadCollectNum();
|
|
|
|
|
- //更新箱号的NextStepCode
|
|
|
|
|
- if (pa_currentqty.Text == "1")
|
|
|
|
|
- {
|
|
|
|
|
- string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_outboxcode='" + outboxcode.Text + "'").ToString();
|
|
|
|
|
- dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + bigoutboxcode.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='" + bigoutboxcode.Text + "'", "update");
|
|
|
|
|
- if (AutoPrint.Checked)
|
|
|
|
|
- {
|
|
|
|
|
- OperateResult.AppendText(">>箱已装满,自动打印!\n", Color.Green);
|
|
|
|
|
- Printlab.PerformClick();
|
|
|
|
|
- }
|
|
|
|
|
- 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);
|
|
|
|
|
|
|
+ CollectBox();
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ bigoutboxcode.Text = LogicHandler.GetOutBoxCode("BIGBOX", "", pa_prodcode.Text, User.UserCode);
|
|
|
|
|
+ //更新箱号已封箱
|
|
|
|
|
+ sql.Clear();
|
|
|
|
|
+ sql.Append("insert into package (pa_id,pa_outboxcode,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_standardqty,pa_sccode,pa_currentstep)values");
|
|
|
|
|
+ sql.Append("(package_seq.nextval,'" + bigoutboxcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',2,'" + pa_prodcode.Text + "',0,'','" + pa_standardqty.Text + "','" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
|
|
|
|
|
+ dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
|
|
+ palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
|
|
|
|
|
+ CollectBox();
|
|
|
}
|
|
}
|
|
|
- else OperateResult.AppendText(">>大箱" + bigoutboxcode.Text + "已装满\n", Color.Red, outboxcode);
|
|
|
|
|
}
|
|
}
|
|
|
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
}
|
|
}
|
|
@@ -209,6 +165,66 @@ namespace UAS_MES.Make
|
|
|
BaseUtil.FillDgvWithDataTable(PackageInf, dt);
|
|
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='" + bigoutboxcode.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,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[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)");
|
|
|
|
|
+ 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, "");
|
|
|
|
|
+ //记录卡通箱所有序列号操作日志
|
|
|
|
|
+ LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "大箱采集成功,大箱号:" + bigoutboxcode.Text, "大箱采集");
|
|
|
|
|
+ LoadGridData();
|
|
|
|
|
+ LoadCollectNum();
|
|
|
|
|
+ //更新箱号的NextStepCode
|
|
|
|
|
+ if (pa_currentqty.Text == "1")
|
|
|
|
|
+ {
|
|
|
|
|
+ string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_outboxcode='" + outboxcode.Text + "'").ToString();
|
|
|
|
|
+ dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + bigoutboxcode.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='" + bigoutboxcode.Text + "'", "update");
|
|
|
|
|
+ if (AutoPrint.Checked)
|
|
|
|
|
+ {
|
|
|
|
|
+ OperateResult.AppendText(">>箱已装满,自动打印!\n", Color.Green);
|
|
|
|
|
+ Printlab.PerformClick();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void FillPrintLabel()
|
|
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");
|
|
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");
|
|
@@ -249,7 +265,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
{
|
|
|
if (PrintLabel.Items.Count != 0)
|
|
if (PrintLabel.Items.Count != 0)
|
|
|
{
|
|
{
|
|
|
- if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString() != "1")
|
|
|
|
|
|
|
+ if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString() == "1")
|
|
|
{
|
|
{
|
|
|
OperateResult.AppendText(">>打印箱号" + bigoutboxcode.Text + "\n", Color.Black);
|
|
OperateResult.AppendText(">>打印箱号" + bigoutboxcode.Text + "\n", Color.Black);
|
|
|
doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
|
|
doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
|
|
@@ -280,18 +296,15 @@ namespace UAS_MES.Make
|
|
|
|
|
|
|
|
private void Packing_Click(object sender, EventArgs e)
|
|
private void Packing_Click(object sender, EventArgs e)
|
|
|
{
|
|
{
|
|
|
- if (pa_prodcode.Text != "" && bigoutboxcode.Text != "")
|
|
|
|
|
|
|
+ if (bigoutboxcode.Text != "")
|
|
|
{
|
|
{
|
|
|
- OperateResult.AppendText(">>" + bigoutboxcode.Text + "装箱成功\n", Color.Green);
|
|
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "装箱" + bigoutboxcode.Text + "成功", outboxcode.Text, "");
|
|
|
|
|
- dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + bigoutboxcode.Text + "'", "update");
|
|
|
|
|
- bigoutboxcode.Text = LogicHandler.GetOutBoxCode("BIGBOX", "", pa_prodcode.Text, User.UserCode);
|
|
|
|
|
- //更新箱号已封箱
|
|
|
|
|
- sql.Clear();
|
|
|
|
|
- sql.Append("insert into package (pa_id,pa_outboxcode,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_standardqty,pa_sccode,pa_currentstep)values");
|
|
|
|
|
- sql.Append("(package_seq.nextval,'" + bigoutboxcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',2,'" + pa_prodcode.Text + "',0,'','" + pa_standardqty.Text + "','" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
|
|
|
|
|
- dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
|
|
- palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
|
|
|
|
|
|
|
+ if (dh.CheckExist("package", "pa_outboxcode='" + bigoutboxcode.Text + "' and nvl(pa_status,0)=0"))
|
|
|
|
|
+ {
|
|
|
|
|
+ OperateResult.AppendText(">>" + bigoutboxcode.Text + "封箱成功\n", Color.Green);
|
|
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "装箱" + bigoutboxcode.Text + "成功", outboxcode.Text, "");
|
|
|
|
|
+ dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + bigoutboxcode.Text + "'", "update");
|
|
|
|
|
+ }
|
|
|
|
|
+ else OperateResult.AppendText(">>箱号" + bigoutboxcode.Text + "错误或者已封箱\n", Color.Red);
|
|
|
}
|
|
}
|
|
|
else OperateResult.AppendText(">>大箱号不能为空\n", Color.Red);
|
|
else OperateResult.AppendText(">>大箱号不能为空\n", Color.Red);
|
|
|
}
|
|
}
|