|
|
@@ -98,13 +98,18 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
{
|
|
|
+ //获取序列号的箱号
|
|
|
+ string ms_outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_sncode='" + outboxcode.Text + "' order by ms_id desc").ToString();
|
|
|
+ if (ms_outboxcode != "")
|
|
|
+ {
|
|
|
+ outboxcode.Text = ms_outboxcode;
|
|
|
+ }
|
|
|
//根据箱号查询表单数据
|
|
|
- pd_barcode.Text = dh.getFieldDataByCondition("makeserial left join package on ms_prodcode=pa_prodcode", "ms_sncode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
|
|
|
sql.Clear();
|
|
|
sql.Append("select pa_totalqty,ma_code,mcd_inqty,ma_qty,ma_qty-mcd_inqty as mcd_waitqty,ma_salecode,pr_detail,pr_cartonunit,pr_code,pr_cartongw,");
|
|
|
- sql.Append("pr_cartonmaxw,pr_cartonminw from package left join product on pr_code=pa_prodcode left join make on ma_prodcode=pr_code and ma_code=pa_makecode ");
|
|
|
+ sql.Append("pr_cartonmaxw,pr_cartonminw from package left join product on pr_code=pa_prodcode left join make on ma_prodcode=pr_code ");
|
|
|
sql.Append("left join makecraftdetail on mcd_macode=ma_code where pa_outboxcode='" + outboxcode.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
//填充Form的值
|
|
|
BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
//填充打印文件选项的DataGridView
|
|
|
@@ -124,14 +129,25 @@ namespace UAS_MES.Make
|
|
|
pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight);
|
|
|
else
|
|
|
pr_cartongw.Text = MinWeight + "-" + MaxWeight;
|
|
|
+ if (pr_cartonunit.Text == "kg")
|
|
|
+ {
|
|
|
+ weight.Text = (float.Parse(weight.Text) / 1000).ToString();
|
|
|
+ }
|
|
|
double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text);
|
|
|
//称量合格或不合格都记录重量
|
|
|
if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
|
|
|
{
|
|
|
if (AutoPrint.Checked)
|
|
|
{
|
|
|
- doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text.Split(':')[1]);
|
|
|
- Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
|
|
|
+ if (PrintLabel.Items.Count > 0)
|
|
|
+ {
|
|
|
+ doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
|
|
|
+ Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>产品" + pr_code.Text + "未维护卡通标签\n", Color.Green);
|
|
|
+ }
|
|
|
}
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserSourceCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量合格", outboxcode.Text, "");
|
|
|
OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测合格\n", Color.Green);
|
|
|
@@ -143,7 +159,7 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
ListViewItem lsi = new ListViewItem();
|
|
|
lsi.SubItems.Add(outboxcode.Text);
|
|
|
- lsi.SubItems.Add(ActualWeight.ToString());
|
|
|
+ lsi.SubItems.Add(ActualWeight.ToString() + pr_cartonunit.Text);
|
|
|
lsi.SubItems.Add(System.DateTime.Now.ToString());
|
|
|
WeighRecord.Items.Add(lsi);
|
|
|
dh.ExecuteSql("update package set pa_weight='" + weight.Text + "', pa_printcount= nvl(pa_printcount,0)+1 where pa_outboxcode='" + outboxcode.Text + "'", "update");
|
|
|
@@ -168,8 +184,6 @@ namespace UAS_MES.Make
|
|
|
try
|
|
|
{
|
|
|
weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
|
|
|
- if (pr_cartonunit.Text == "kg")
|
|
|
- weight.Text = (float.Parse(weight.Text) / 1000).ToString();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
@@ -186,8 +200,8 @@ namespace UAS_MES.Make
|
|
|
//确认打印
|
|
|
private void Confirm_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text.Split(':')[1]);
|
|
|
- Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
|
|
|
+ doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
|
|
|
+ Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
|
|
|
}
|
|
|
|
|
|
//停止进程,关闭串口
|