|
@@ -77,13 +77,13 @@ namespace UAS_MES.Make
|
|
|
if (pa_outboxcode.Text != "")
|
|
if (pa_outboxcode.Text != "")
|
|
|
{
|
|
{
|
|
|
sql.Clear();
|
|
sql.Clear();
|
|
|
- sql.Append("select pa_outboxcode,pr_detail,pa_packageqty,pr_outboxinnerqty,pa_standardqty,pa_currentqty from package left join product on pa_prodcode=");
|
|
|
|
|
|
|
+ sql.Append("select pa_outboxcode,pa_status,pr_packrule,pr_detail,pa_packageqty,pr_outboxinnerqty,pa_standardqty,pa_currentqty from package left join product on pa_prodcode=");
|
|
|
sql.Append("pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
sql.Append("pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
sql.Clear();
|
|
sql.Clear();
|
|
|
- sql.Append("select ms_makecode,pr_code,pr_detail,pr_outboxinnerqty,pa_standardqty,pa_packageqty,pa_currentqty,");
|
|
|
|
|
|
|
+ sql.Append("select ms_makecode,pa_status,pr_packrule,pr_code,pr_detail,pr_outboxinnerqty,pa_standardqty,pa_packageqty,pa_currentqty,");
|
|
|
sql.Append("pa_outboxcode from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
|
|
sql.Append("pa_outboxcode from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
|
|
|
sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_sncode='" + sn_code.Text + "'");
|
|
sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_sncode='" + sn_code.Text + "'");
|
|
|
}
|
|
}
|
|
@@ -97,9 +97,16 @@ namespace UAS_MES.Make
|
|
|
BaseUtil.SetFormValue(this.Controls, dt);
|
|
BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
}
|
|
}
|
|
|
else OperateResult.AppendText(">>序列号不存在\n", Color.Red);
|
|
else OperateResult.AppendText(">>序列号不存在\n", Color.Red);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void LoadGridData()
|
|
|
|
|
+ {
|
|
|
//加载Grid数据
|
|
//加载Grid数据
|
|
|
dt = (DataTable)dh.ExecuteSql("select pa_outboxcode,pd_barcode,pd_innerqty,pa_indate from packageDetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
|
|
dt = (DataTable)dh.ExecuteSql("select pa_outboxcode,pd_barcode,pd_innerqty,pa_indate from packageDetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
|
|
|
BaseUtil.FillDgvWithDataTable(PackageDetail, dt);
|
|
BaseUtil.FillDgvWithDataTable(PackageDetail, dt);
|
|
|
|
|
+ //更新界面的采集数量
|
|
|
|
|
+ pa_currentqty.Text = dh.getFieldDataByCondition("package", "pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void InsertDetail()
|
|
private void InsertDetail()
|
|
@@ -111,7 +118,7 @@ namespace UAS_MES.Make
|
|
|
sql.Append("select packagedetail_seq.nextval,pa_id,pa_outboxcode,pa_totalqty,'" + sn_code.Text + "' from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
sql.Append("select packagedetail_seq.nextval,pa_id,pa_outboxcode,pa_totalqty,'" + sn_code.Text + "' from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty+1,pa_currentqty=pa_currentqty+1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty+1,pa_currentqty=pa_currentqty+1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
- dh.UpdateByCondition("makeserial", "ms_outboxcode='" + pa_outboxcode.Text + "'", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + ms_makecode.Text + "'");
|
|
|
|
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_outboxcode='" + pa_outboxcode.Text + "'", "ms_id='" + oMsID + "'");
|
|
|
if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
|
|
if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sn_code.Text, "包装采集", "装箱成功", User.UserCode, out ErrorMessage))
|
|
|
{
|
|
{
|
|
|
OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
|
|
OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
|
|
@@ -119,8 +126,10 @@ namespace UAS_MES.Make
|
|
|
if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == int.Parse(pr_outboxinnerqty.Text))
|
|
if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == int.Parse(pr_outboxinnerqty.Text))
|
|
|
{
|
|
{
|
|
|
dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
|
|
+ if (AutoPrint.Checked)
|
|
|
|
|
+ Print_Click(new object(), new EventArgs());
|
|
|
}
|
|
}
|
|
|
- LoadData();
|
|
|
|
|
|
|
+ LoadGridData();
|
|
|
sn_code.Clear();
|
|
sn_code.Clear();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -133,6 +142,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
{
|
|
|
if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "1")
|
|
if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "1")
|
|
|
{
|
|
{
|
|
|
|
|
+ dh.ExecuteSql("update package set pa_printcount=pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
|
|
|
OperateResult.AppendText(">>开始打印箱号" + pa_outboxcode.Text + "\n", Color.Green);
|
|
OperateResult.AppendText(">>开始打印箱号" + pa_outboxcode.Text + "\n", Color.Green);
|
|
|
Print.CodeSoft(lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
|
|
Print.CodeSoft(lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
|
|
|
}
|
|
}
|
|
@@ -147,7 +157,7 @@ namespace UAS_MES.Make
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
{
|
|
{
|
|
|
sql.Clear();
|
|
sql.Clear();
|
|
|
- sql.Append("select pr_code,pr_detail,pr_outboxinnerqty,pa_packageqty from package left join product ");
|
|
|
|
|
|
|
+ sql.Append("select pr_code,pr_detail,pr_outboxinnerqty,pa_currentqty,pa_packageqty from package left join product ");
|
|
|
sql.Append("on pr_code=pa_prodcode where pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
sql.Append("on pr_code=pa_prodcode where pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
if (dt.Rows.Count > 0)
|
|
@@ -169,11 +179,43 @@ namespace UAS_MES.Make
|
|
|
{
|
|
{
|
|
|
if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text, User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
|
|
if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text, User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
|
|
|
{
|
|
{
|
|
|
|
|
+ //按工单核对装箱
|
|
|
|
|
+ switch (pr_packrule.Text)
|
|
|
|
|
+ {
|
|
|
|
|
+ case "M":
|
|
|
|
|
+ if (dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_id='" + oMsID + "'").ToString() != ms_makecode.Text)
|
|
|
|
|
+ {
|
|
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "所属工单和当前箱号工单不相等\n", Color.Red, sn_code);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "S":
|
|
|
|
|
+ sql.Clear();
|
|
|
|
|
+ sql.Append("select 1 from package left join make on pa_salecode=ma_salecode left join makeserial ");
|
|
|
|
|
+ sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
|
|
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
|
|
+ if (dt.Rows.Count == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号和当前箱号订单不相等\n", Color.Red, sn_code);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "":
|
|
|
|
|
+ if (dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id='" + oMsID + "'").ToString() != pr_code.Text)
|
|
|
|
|
+ {
|
|
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "对应物料和该箱所装物料不同\n", Color.Red, sn_code);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
if (pa_outboxcode.Text == "")
|
|
if (pa_outboxcode.Text == "")
|
|
|
{
|
|
{
|
|
|
if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
|
|
if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
|
|
|
{
|
|
{
|
|
|
LoadData();
|
|
LoadData();
|
|
|
|
|
+ LoadGridData();
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -190,30 +232,30 @@ namespace UAS_MES.Make
|
|
|
//如果未勾选了取消录入
|
|
//如果未勾选了取消录入
|
|
|
if (!Cancel.Checked)
|
|
if (!Cancel.Checked)
|
|
|
{
|
|
{
|
|
|
- //满箱之后采集下一个之前自动清除内容,生成新的箱号
|
|
|
|
|
- if (AutoGenBoxCode.Checked && pa_currentqty.Text != "" && pr_outboxinnerqty.Text == pa_currentqty.Text)
|
|
|
|
|
- {
|
|
|
|
|
- pa_currentqty.Text = "";
|
|
|
|
|
- pa_outboxcode.Text = "";
|
|
|
|
|
- BaseUtil.CleanDGVData(PackageDetail);
|
|
|
|
|
- pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
|
|
|
|
|
- }
|
|
|
|
|
//判断序列号是否已经装箱
|
|
//判断序列号是否已经装箱
|
|
|
if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
|
|
if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
|
|
|
{
|
|
{
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "已经装箱!\n", Color.Red);
|
|
|
|
|
- sn_code.Clear();
|
|
|
|
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "已经装箱!\n", Color.Red, sn_code);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
|
|
+ //满箱之后采集下一个之前自动清除内容,生成新的箱号
|
|
|
|
|
+ if ((AutoGenBoxCode.Checked && pa_currentqty.Text != "" && pr_outboxinnerqty.Text == pa_currentqty.Text) || pa_status.Text == "1")
|
|
|
|
|
+ {
|
|
|
|
|
+ pa_currentqty.Text = "";
|
|
|
|
|
+ pa_outboxcode.Text = "";
|
|
|
|
|
+ pa_status.Text = "0";
|
|
|
|
|
+ BaseUtil.CleanDGVData(PackageDetail);
|
|
|
|
|
+ pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
|
|
|
|
|
+ }
|
|
|
//箱号不存在的情况
|
|
//箱号不存在的情况
|
|
|
if (!dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
|
|
if (!dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
|
|
|
{
|
|
{
|
|
|
//插入Package主表箱号信息
|
|
//插入Package主表箱号信息
|
|
|
sql.Clear();
|
|
sql.Clear();
|
|
|
- sql.Append("insert into package (pa_id,pa_outboxcode,pa_packageqty,pa_totalqty,pa_status,pa_indate,pa_makecode,pa_prodcode,pa_salecode,pa_custcode,pa_type)");
|
|
|
|
|
- sql.Append("select package_seq.nextval,'" + pa_outboxcode.Text + "',0," + pr_outboxinnerqty.Text + ",0,");
|
|
|
|
|
- sql.Append("sysdate,'" + ms_makecode.Text + "', ma_prodcode,ma_salecode,ma_custcode,1 from make where ma_code = '" + ms_makecode.Text + "'");
|
|
|
|
|
|
|
+ sql.Append("insert into package (pa_id,pa_outboxcode,pa_packageqty,pa_totalqty,pa_status,pa_indate,pa_makecode,pa_prodcode,pa_salecode,");
|
|
|
|
|
+ sql.Append("pa_custcode,pa_type,pa_packtype) select package_seq.nextval,'" + pa_outboxcode.Text + "',0," + pr_outboxinnerqty.Text + ",0,");
|
|
|
|
|
+ sql.Append("sysdate,'" + ms_makecode.Text + "', ma_prodcode,ma_salecode,ma_custcode,1,'" + pr_packrule.Text + "' from make where ma_code = '" + ms_makecode.Text + "'");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "采集成功!\n", Color.Green);
|
|
OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "采集成功!\n", Color.Green);
|
|
|
InsertDetail();
|
|
InsertDetail();
|
|
@@ -242,9 +284,9 @@ namespace UAS_MES.Make
|
|
|
//更新已装数
|
|
//更新已装数
|
|
|
dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty-1,pa_currentqty=pa_currentqty-1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty-1,pa_currentqty=pa_currentqty-1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
//清除序列号箱号
|
|
//清除序列号箱号
|
|
|
- dh.UpdateByCondition("makeserial", "ms_outboxcode=''", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + ms_makecode.Text + "'");
|
|
|
|
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_outboxcode=''", "ms_id='" + oMsID + "'");
|
|
|
OperateResult.AppendText(">>已从该箱中移除序列号" + sn_code.Text + "\n", Color.Green);
|
|
OperateResult.AppendText(">>已从该箱中移除序列号" + sn_code.Text + "\n", Color.Green);
|
|
|
- LoadData();
|
|
|
|
|
|
|
+ LoadGridData();
|
|
|
}
|
|
}
|
|
|
else OperateResult.AppendText(">>序列号" + sn_code.Text + "不在箱" + pa_outboxcode.Text + "内\n", Color.Red);
|
|
else OperateResult.AppendText(">>序列号" + sn_code.Text + "不在箱" + pa_outboxcode.Text + "内\n", Color.Red);
|
|
|
}
|
|
}
|
|
@@ -262,33 +304,6 @@ namespace UAS_MES.Make
|
|
|
OperateResult.Clear();
|
|
OperateResult.Clear();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void pa_packageqty_TextChanged(object sender, EventArgs e)
|
|
|
|
|
- {
|
|
|
|
|
- if (AutoPrint.Checked)
|
|
|
|
|
- {
|
|
|
|
|
- if (pr_outboxinnerqty.Text == pa_currentqty.Text)
|
|
|
|
|
- {
|
|
|
|
|
- OperateResult.AppendText(">>打印箱号" + pa_outboxcode.Text + "\n", Color.Green);
|
|
|
|
|
- if (PrintLabel.Items.Count != 0)
|
|
|
|
|
- {
|
|
|
|
|
- Print.CodeSoft(lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- OperateResult.AppendText(">>产品" + pr_code.Text + "未维护打印标签\n", Color.Red);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private void pa_code_IconClick(object sender, EventArgs e)
|
|
|
|
|
- {
|
|
|
|
|
- if (ms_makecode.Text == "")
|
|
|
|
|
- {
|
|
|
|
|
- OperateResult.AppendText(">>请先选择工单号\n", Color.Red);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private void pr_code_TextChanged(object sender, EventArgs e)
|
|
private void pr_code_TextChanged(object sender, EventArgs e)
|
|
|
{
|
|
{
|
|
|
pa_outboxcode.MakeCode = ms_makecode.Text;
|
|
pa_outboxcode.MakeCode = ms_makecode.Text;
|
|
@@ -317,7 +332,8 @@ namespace UAS_MES.Make
|
|
|
{
|
|
{
|
|
|
if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_status<>1"))
|
|
if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_status<>1"))
|
|
|
{
|
|
{
|
|
|
- dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
|
|
|
|
+ dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
|
|
+ pa_status.Text = "1";
|
|
|
OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "封箱成功\n", Color.Green);
|
|
OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "封箱成功\n", Color.Green);
|
|
|
}
|
|
}
|
|
|
else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "错误或者已封箱\n", Color.Red);
|
|
else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "错误或者已封箱\n", Color.Red);
|