|
|
@@ -9,6 +9,7 @@ using UAS_MES.PublicMethod;
|
|
|
using System.Drawing;
|
|
|
using System.Threading;
|
|
|
using UAS_MES.PublicForm;
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
|
namespace UAS_MES.Make
|
|
|
{
|
|
|
@@ -259,8 +260,15 @@ namespace UAS_MES.Make
|
|
|
//采集完后如果是第一个装的序列号,把序列号的NextStepCode赋值给箱号
|
|
|
if (pa_currentqty.Text == "1")
|
|
|
{
|
|
|
- string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
|
|
|
- dh.UpdateByCondition("package", "pa_nextstep='"+nextstepcode+"'", "pa_outboxcode='"+pa_outboxcode.Text+"'");
|
|
|
+ //如果下一道工序是Packing才更新进入Package表
|
|
|
+ DataTable ifpacking = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_nextstepcode", "ms_craftcode" }, "ms_id='" + oMsID + "'");
|
|
|
+ string nextstepcode = ifpacking.Rows[0]["ms_nextstepcode"].ToString();
|
|
|
+ string craftcode = ifpacking.Rows[0]["ms_craftcode"].ToString();
|
|
|
+ string nextpackging = dh.getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid", "cd_ifpack ", "cr_prodcode='" + pr_code.Text + "' and cr_code='" + craftcode + "'").ToString();
|
|
|
+ if (nextpackging != "0")
|
|
|
+ {
|
|
|
+ dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
+ }
|
|
|
}
|
|
|
if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) == pr_outboxinnerqty.Value)
|
|
|
{
|
|
|
@@ -487,5 +495,67 @@ namespace UAS_MES.Make
|
|
|
PrintNum.Text = (PrintNums == "" ? "1" : PrintNums);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void DeleteAll_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select pa_checkno,ob_status,pa_mothercode,nvl(pa_downstatus,0)pa_downstatus from package left join oqcbatch on pa_checkno=ob_checkno where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ if (dt.Rows[0]["pa_mothercode"].ToString() == "")
|
|
|
+ {
|
|
|
+ if (dt.Rows[0]["pa_downstatus"].ToString() == "0")
|
|
|
+ {
|
|
|
+ string ob_status = dt.Rows[0]["ob_status"].ToString();
|
|
|
+ string pa_checkno = dt.Rows[0]["pa_checkno"].ToString();
|
|
|
+ //不存在抽检批次或者还未检验可以拆解
|
|
|
+ if (ob_status == "" || ob_status == "ENTERING" || ob_status == "UNCHECK")
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pd_makecode,pd_barcode,pd_prodcode,ms_status,ms_stepcode from packagedetail left join makeserial ");
|
|
|
+ sql.Append("on ms_sncode=pd_barcode and ms_makecode=pd_makecode where pd_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ string ma_code = dt.Rows[i]["pd_makecode"].ToString();
|
|
|
+ string ms_sncode = dt.Rows[i]["pd_barcode"].ToString();
|
|
|
+ string pr_code = dt.Rows[i]["pd_prodcode"].ToString();
|
|
|
+ string ms_status = dt.Rows[i]["ms_status"].ToString();
|
|
|
+ string ms_stepcode = dt.Rows[i]["ms_stepcode"].ToString();
|
|
|
+ List<string> SQLS1 = new List<string>();
|
|
|
+ if (ms_status == "2")
|
|
|
+ {
|
|
|
+ //已完工数-1
|
|
|
+ SQLS1.Add("update make set ma_madeqty=ma_madeqty-1 where ma_code='" + ma_code + "'");
|
|
|
+ }
|
|
|
+ //更新序列号状态
|
|
|
+ SQLS1.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1,mcd_okqty=mcd_okqty-1 where mcd_macode='" + ma_code + "' and mcd_stepcode='" + ms_stepcode + "'");
|
|
|
+ SQLS1.Add("update makeserial set ms_status=1,ms_nextstepcode=ms_stepcode,ms_outboxcode='' where ms_sncode='" + ms_sncode + "' and ms_makecode='" + ma_code + "'");
|
|
|
+ SQLS1.Add("delete from makeprocess where mp_sncode='" + ms_sncode + "' and mp_makecode='" + ma_code + "' and mp_stepcode='" + ms_stepcode + "'");
|
|
|
+ SQLS1.Add("delete from steppassed where sp_sncode='" + ms_sncode + "' and sp_makecode='" + ma_code + "' and sp_stepcode='" + ms_stepcode + "'");
|
|
|
+ //抽检批次不为空的时候进行移除
|
|
|
+ if (pa_checkno != "")
|
|
|
+ {
|
|
|
+ SQLS1.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + pa_checkno + "'");
|
|
|
+ SQLS1.Add("delete from oqcbatchdetail where obd_checkno='" + pa_checkno + "' and obd_sncode='" + ms_sncode + "'");
|
|
|
+ }
|
|
|
+ dh.ExecuteSQLTran(SQLS1.ToArray());
|
|
|
+ }
|
|
|
+ List<string> SQLS2 = new List<string>();
|
|
|
+ ////置空原箱
|
|
|
+ SQLS2.Add("update package set pa_packageqty=0,pa_totalqty=0,pa_currentqty=0,pa_status=0 where pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
+ //删除箱的明细
|
|
|
+ SQLS2.Add("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
+ dh.ExecuteSQLTran(SQLS2.ToArray());
|
|
|
+ OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "成功拆解!\n", Color.Green);
|
|
|
+ LoadGridData();
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已送检,不允许解除\n", Color.Red);
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已下地,不允许解除\n", Color.Red);
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已装箱,不允许解除\n", Color.Red);
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在\n", Color.Red);
|
|
|
+ }
|
|
|
}
|
|
|
}
|