|
|
@@ -13,6 +13,7 @@ using UAS_MES_MAXMADE.PublicMethod;
|
|
|
using System.Drawing;
|
|
|
using LabelManager2;
|
|
|
using UAS_MES_MAXMADE.PublicForm;
|
|
|
+using Seagull.BarTender.Print;
|
|
|
|
|
|
namespace UAS_MES_MAXMADE.Make
|
|
|
{
|
|
|
@@ -20,7 +21,6 @@ namespace UAS_MES_MAXMADE.Make
|
|
|
{
|
|
|
AutoSizeFormClass asc = new AutoSizeFormClass();
|
|
|
ApplicationClass lbl;
|
|
|
- Document doc;
|
|
|
DataHelper dh;
|
|
|
DataTable dt;
|
|
|
LogStringBuilder sql = new LogStringBuilder();
|
|
|
@@ -36,17 +36,17 @@ namespace UAS_MES_MAXMADE.Make
|
|
|
//是否通过串口获取数据
|
|
|
bool GetData = true;
|
|
|
string LastSncode;
|
|
|
- bool WeightChange = false;
|
|
|
|
|
|
DataTable Dbfind;
|
|
|
|
|
|
+ Engine engine;
|
|
|
+
|
|
|
Regex re = new Regex("\\d+.\\d+\\w+");
|
|
|
|
|
|
string ErrorMessage;
|
|
|
|
|
|
Thread InitPrint;
|
|
|
|
|
|
- System.DateTime[] indate;
|
|
|
private bool AutoCut;
|
|
|
|
|
|
public Make_ColorBoxWeigh()
|
|
|
@@ -103,12 +103,13 @@ namespace UAS_MES_MAXMADE.Make
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- lbl = new ApplicationClass();
|
|
|
- BaseUtil.WriteLbl();
|
|
|
+ engine = new Engine();
|
|
|
+ //lbl = new ApplicationClass();
|
|
|
+ //BaseUtil.WriteLbl();
|
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
+ catch (Exception)
|
|
|
{
|
|
|
- OperateResult.AppendText("未正确安装CodeSoft软件\n", Color.Red);
|
|
|
+ OperateResult.AppendText("未正确安装BarTender软件\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -118,48 +119,48 @@ namespace UAS_MES_MAXMADE.Make
|
|
|
{
|
|
|
if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
|
|
|
{
|
|
|
- string oMakeCode = "";
|
|
|
- string oMsID = "";
|
|
|
- if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
|
|
|
- {
|
|
|
- //string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
|
|
|
- //if (nextstepcode != User.CurrentStepCode)
|
|
|
- //{
|
|
|
- // OperateResult.AppendText("<<序列号:" + sncode.Text + "下一工序是" + nextstepcode + ",不是当前岗位的工序\n", Color.Red, sncode);
|
|
|
- // return;
|
|
|
- //}
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select ms_makecode ma_code,ma_qty,ma_salecode,pr_spec,pr_colorboxunit,pr_code,pr_colorboxgw,");
|
|
|
- sql.Append("pr_colorboxunit,pr_colorboxmaxw,pr_colorboxminw,nvl(PR_CHECKCOLORBOXW,'0') PR_CHECKCOLORBOXW,nvl(pr_sendchecktype,'LineCode')");
|
|
|
- sql.Append("pr_sendchecktype from makeserial left join make on ms_makecode=ma_code left join product on ");
|
|
|
- sql.Append("ms_prodcode=pr_code where ms_sncode='" + sncode.Text + "' order by ms_id desc");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ string oMakeCode = "";
|
|
|
+ string oMsID = "";
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
|
|
|
{
|
|
|
- //重量的临时变量
|
|
|
- pr_code.Text = dt.Rows[0]["pr_code"].ToString();
|
|
|
- string _weight = dt.Rows[0]["pr_colorboxgw"].ToString();
|
|
|
- string _maxweight = dt.Rows[0]["pr_colorboxmaxw"].ToString();
|
|
|
- string _minweight = dt.Rows[0]["pr_colorboxminw"].ToString();
|
|
|
- string pr_colorunit = dt.Rows[0]["pr_colorboxunit"].ToString();
|
|
|
- string ma_salecode_text = dt.Rows[0]["ma_salecode"].ToString();
|
|
|
- string PR_CHECKCOLORBOXW = dt.Rows[0]["PR_CHECKCOLORBOXW"].ToString();
|
|
|
- //赋值重量单位
|
|
|
- Weight = double.Parse(_weight == "" ? "0" : _weight);
|
|
|
- MaxWeight = double.Parse(_maxweight == "" ? "0" : _maxweight);
|
|
|
- MinWeight = double.Parse(_minweight == "" ? "0" : _minweight);
|
|
|
- if (locksalecode.Checked && ma_salecode.Text != "" && ma_salecode.Text != ma_salecode_text)
|
|
|
+ //string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
|
|
|
+ //if (nextstepcode != User.CurrentStepCode)
|
|
|
+ //{
|
|
|
+ // OperateResult.AppendText("<<序列号:" + sncode.Text + "下一工序是" + nextstepcode + ",不是当前岗位的工序\n", Color.Red, sncode);
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select ms_makecode ma_code,ma_qty,ma_salecode,pr_spec,pr_colorboxunit,pr_code,pr_colorboxgw,");
|
|
|
+ sql.Append("pr_colorboxunit,pr_colorboxmaxw,pr_colorboxminw,nvl(PR_CHECKCOLORBOXW,'0') PR_CHECKCOLORBOXW,nvl(pr_sendchecktype,'LineCode')");
|
|
|
+ sql.Append("pr_sendchecktype from makeserial left join make on ms_makecode=ma_code left join product on ");
|
|
|
+ sql.Append("ms_prodcode=pr_code where ms_sncode='" + sncode.Text + "' order by ms_id desc");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>序列号" + sncode.Text + "所属订单号" + ma_salecode_text + "与界面订单号" + ma_salecode.Text + "不同,无法采集\n", Color.Red, sncode);
|
|
|
- return;
|
|
|
- }
|
|
|
- ma_salecode.Text = dt.Rows[0]["ma_salecode"].ToString();
|
|
|
- BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
- if (Weight - MinWeight == MaxWeight - Weight)
|
|
|
- pr_colorboxgw.Text = Weight + "±" + (MaxWeight - Weight) + dt.Rows[0]["pr_colorboxunit"].ToString();
|
|
|
- else
|
|
|
- pr_colorboxgw.Text = MinWeight + "-" + MaxWeight + dt.Rows[0]["pr_colorboxunit"].ToString();
|
|
|
-
|
|
|
+ //重量的临时变量
|
|
|
+ pr_code.Text = dt.Rows[0]["pr_code"].ToString();
|
|
|
+ string _weight = dt.Rows[0]["pr_colorboxgw"].ToString();
|
|
|
+ string _maxweight = dt.Rows[0]["pr_colorboxmaxw"].ToString();
|
|
|
+ string _minweight = dt.Rows[0]["pr_colorboxminw"].ToString();
|
|
|
+ string pr_colorunit = dt.Rows[0]["pr_colorboxunit"].ToString();
|
|
|
+ string ma_salecode_text = dt.Rows[0]["ma_salecode"].ToString();
|
|
|
+ string PR_CHECKCOLORBOXW = dt.Rows[0]["PR_CHECKCOLORBOXW"].ToString();
|
|
|
+ //赋值重量单位
|
|
|
+ Weight = double.Parse(_weight == "" ? "0" : _weight);
|
|
|
+ MaxWeight = double.Parse(_maxweight == "" ? "0" : _maxweight);
|
|
|
+ MinWeight = double.Parse(_minweight == "" ? "0" : _minweight);
|
|
|
+ if (locksalecode.Checked && ma_salecode.Text != "" && ma_salecode.Text != ma_salecode_text)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>序列号" + sncode.Text + "所属订单号" + ma_salecode_text + "与界面订单号" + ma_salecode.Text + "不同,无法采集\n", Color.Red, sncode);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ma_salecode.Text = dt.Rows[0]["ma_salecode"].ToString();
|
|
|
+ BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
+ if (Weight - MinWeight == MaxWeight - Weight)
|
|
|
+ pr_colorboxgw.Text = Weight + "±" + (MaxWeight - Weight) + dt.Rows[0]["pr_colorboxunit"].ToString();
|
|
|
+ else
|
|
|
+ pr_colorboxgw.Text = MinWeight + "-" + MaxWeight + dt.Rows[0]["pr_colorboxunit"].ToString();
|
|
|
+
|
|
|
//如果未打开串口设置为0
|
|
|
//if (pr_colorboxunit.Text == "kg" && !WeightChange)
|
|
|
//{
|
|
|
@@ -226,7 +227,7 @@ namespace UAS_MES_MAXMADE.Make
|
|
|
}
|
|
|
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sncode);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>"+ErrorMessage+"\n", Color.Red, sncode);
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sncode);
|
|
|
}
|
|
|
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sncode);
|
|
|
}
|
|
|
@@ -301,7 +302,7 @@ namespace UAS_MES_MAXMADE.Make
|
|
|
{
|
|
|
//doc = lbl.Documents.Open(PrintLabel.Text);
|
|
|
string oErrorMessage;
|
|
|
- if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sncode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "彩盒标", "0", out oErrorMessage))
|
|
|
+ if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sncode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "彩盒标", "0", out oErrorMessage))
|
|
|
{
|
|
|
OperateResult.AppendText(oErrorMessage + "\n", Color.Red);
|
|
|
}
|