|
@@ -251,126 +251,130 @@ namespace UAS_MES.Make
|
|
|
//当用户输入回车键的时候
|
|
//当用户输入回车键的时候
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
{
|
|
{
|
|
|
- if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
|
|
|
|
|
|
|
+ if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
|
|
|
{
|
|
{
|
|
|
- if (pa_outboxcode.Text == "")
|
|
|
|
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
|
|
|
{
|
|
{
|
|
|
- if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
|
|
|
|
|
|
|
+ if (pa_outboxcode.Text == "")
|
|
|
{
|
|
{
|
|
|
- LoadData();
|
|
|
|
|
- LoadGridData();
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- LoadData();
|
|
|
|
|
- pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- //按工单核对装箱
|
|
|
|
|
- switch (pr_packrule.Text)
|
|
|
|
|
- {
|
|
|
|
|
- case "M":
|
|
|
|
|
- if (dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_id='" + oMsID + "'").ToString() != ms_makecode.Text)
|
|
|
|
|
|
|
+ if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
|
|
|
{
|
|
{
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "所属工单和当前箱号工单不相等\n", Color.Red, sn_code);
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ LoadData();
|
|
|
|
|
+ LoadGridData();
|
|
|
}
|
|
}
|
|
|
- break;
|
|
|
|
|
- case "S":
|
|
|
|
|
- if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
|
|
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
- 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)
|
|
|
|
|
|
|
+ LoadData();
|
|
|
|
|
+ pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //按工单核对装箱
|
|
|
|
|
+ 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);
|
|
|
|
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "所属工单和当前箱号工单不相等\n", Color.Red, sn_code);
|
|
|
return;
|
|
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;
|
|
|
|
|
- }
|
|
|
|
|
- //判断箱内总数必须大于0
|
|
|
|
|
- if (pr_outboxinnerqty.Text == "" || pr_outboxinnerqty.Text == "0")
|
|
|
|
|
- {
|
|
|
|
|
- OperateResult.AppendText(">>箱内容量必须大于0\n", Color.Red);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- //如果未勾选了取消录入
|
|
|
|
|
- if (!Cancel.Checked)
|
|
|
|
|
- {
|
|
|
|
|
- //判断序列号是否已经装箱
|
|
|
|
|
- if (dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
|
|
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "S":
|
|
|
|
|
+ if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
|
|
|
|
|
+ {
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }
|
|
|
|
|
+ //判断箱内总数必须大于0
|
|
|
|
|
+ if (pr_outboxinnerqty.Text == "" || pr_outboxinnerqty.Text == "0")
|
|
|
{
|
|
{
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "已经装箱!\n", Color.Red, sn_code);
|
|
|
|
|
|
|
+ OperateResult.AppendText(">>箱内容量必须大于0\n", Color.Red);
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ //如果未勾选了取消录入
|
|
|
|
|
+ if (!Cancel.Checked)
|
|
|
{
|
|
{
|
|
|
- //满箱之后采集下一个之前自动清除内容,生成新的箱号
|
|
|
|
|
- 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.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString() != "")
|
|
|
{
|
|
{
|
|
|
- //插入Package主表箱号信息
|
|
|
|
|
- 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,");
|
|
|
|
|
- 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");
|
|
|
|
|
- OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "采集成功!\n", Color.Green);
|
|
|
|
|
- InsertDetail();
|
|
|
|
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "已经装箱!\n", Color.Red, sn_code);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- if (dh.getRowCount("makeserial", "ms_sncode='" + sn_code.Text + "'") > 0)
|
|
|
|
|
|
|
+ //满箱之后采集下一个之前自动清除内容,生成新的箱号
|
|
|
|
|
+ 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 + "'"))
|
|
|
|
|
+ {
|
|
|
|
|
+ //插入Package主表箱号信息
|
|
|
|
|
+ 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,");
|
|
|
|
|
+ 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");
|
|
|
|
|
+ OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "采集成功!\n", Color.Green);
|
|
|
InsertDetail();
|
|
InsertDetail();
|
|
|
|
|
+ }
|
|
|
else
|
|
else
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在\n", Color.Red, sn_code);
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ if (dh.getRowCount("makeserial", "ms_sncode='" + sn_code.Text + "'") > 0)
|
|
|
|
|
+ InsertDetail();
|
|
|
|
|
+ else
|
|
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在\n", Color.Red, sn_code);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- //勾选了取消箱号先验证箱号存不存在,存在的话移除掉,重新加载一次数据
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() != "1")
|
|
|
|
|
|
|
+ //勾选了取消箱号先验证箱号存不存在,存在的话移除掉,重新加载一次数据
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
- string outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();
|
|
|
|
|
- if (outboxcode != "")
|
|
|
|
|
|
|
+ if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() != "1")
|
|
|
{
|
|
{
|
|
|
- if (outboxcode == pa_outboxcode.Text)
|
|
|
|
|
|
|
+ string outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();
|
|
|
|
|
+ if (outboxcode != "")
|
|
|
{
|
|
{
|
|
|
- //删除明细行的数据
|
|
|
|
|
- dh.ExecuteSql("delete from packagedetail where pd_barcode='" + sn_code.Text + "' and pd_paid=(select pa_id from package where pa_outboxcode='" + pa_outboxcode.Text + "')", "delete");
|
|
|
|
|
- //更新已装数
|
|
|
|
|
- dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty-1,pa_currentqty=pa_currentqty-1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
|
|
- //清除序列号箱号
|
|
|
|
|
- dh.UpdateByCondition("makeserial", "ms_outboxcode=''", "ms_id='" + oMsID + "'");
|
|
|
|
|
- OperateResult.AppendText(">>已从该箱中移除序列号" + sn_code.Text + "\n", Color.Green, sn_code);
|
|
|
|
|
- LoadGridData();
|
|
|
|
|
|
|
+ if (outboxcode == pa_outboxcode.Text)
|
|
|
|
|
+ {
|
|
|
|
|
+ //删除明细行的数据
|
|
|
|
|
+ dh.ExecuteSql("delete from packagedetail where pd_barcode='" + sn_code.Text + "' and pd_paid=(select pa_id from package where pa_outboxcode='" + pa_outboxcode.Text + "')", "delete");
|
|
|
|
|
+ //更新已装数
|
|
|
|
|
+ dh.UpdateByCondition("Package", "pa_packageqty=pa_packageqty-1,pa_currentqty=pa_currentqty-1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
|
|
+ //清除序列号箱号
|
|
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_outboxcode=''", "ms_id='" + oMsID + "'");
|
|
|
|
|
+ OperateResult.AppendText(">>已从该箱中移除序列号" + sn_code.Text + "\n", Color.Green, sn_code);
|
|
|
|
|
+ LoadGridData();
|
|
|
|
|
+ }
|
|
|
|
|
+ else OperateResult.AppendText(">>序列号" + sn_code.Text + "不在箱" + pa_outboxcode.Text + "内\n", Color.Red, sn_code);
|
|
|
}
|
|
}
|
|
|
- else OperateResult.AppendText(">>序列号" + sn_code.Text + "不在箱" + pa_outboxcode.Text + "内\n", Color.Red, sn_code);
|
|
|
|
|
|
|
+ else OperateResult.AppendText(">>序列号" + sn_code.Text + "尚未装箱\n", Color.Red);
|
|
|
}
|
|
}
|
|
|
- else OperateResult.AppendText(">>序列号" + sn_code.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(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
}
|
|
}
|
|
|
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
}
|
|
}
|
|
@@ -441,7 +445,7 @@ namespace UAS_MES.Make
|
|
|
LogicHandler.DoCommandLog(User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
|
|
LogicHandler.DoCommandLog(User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
|
|
|
ob_checkno.Text = "";
|
|
ob_checkno.Text = "";
|
|
|
}
|
|
}
|
|
|
- else OperateResult.AppendText(">>必须封箱才能送检\n",Color.Red);
|
|
|
|
|
|
|
+ else OperateResult.AppendText(">>必须封箱才能送检\n", Color.Red);
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|