|
|
@@ -13,6 +13,8 @@ using System.IO.Ports;
|
|
|
using System.IO;
|
|
|
using System.Text.RegularExpressions;
|
|
|
using System.Collections.Generic;
|
|
|
+using Seagull.BarTender.Print;
|
|
|
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
|
|
namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
|
@@ -23,7 +25,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
LogStringBuilder sql = new LogStringBuilder();
|
|
|
AutoSizeFormClass asc = new AutoSizeFormClass();
|
|
|
Document doc;
|
|
|
- ApplicationClass lbl;
|
|
|
+ Engine engine;
|
|
|
Thread thread;
|
|
|
DataTable Dbfind;
|
|
|
string ErrorMessage = "";
|
|
|
@@ -40,7 +42,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
|
|
|
string ActWeigh = "0";
|
|
|
|
|
|
- Regex re = new Regex("\\d+.\\d+\\w+");
|
|
|
+ Regex re = new Regex("\\d+.\\d+[\\s\\S]+");
|
|
|
|
|
|
decimal StandardQTY = 0;
|
|
|
|
|
|
@@ -64,12 +66,12 @@ namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- lbl = new ApplicationClass();
|
|
|
+ engine = new Engine(true);
|
|
|
BaseUtil.WriteLbl();
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- OperateResult.AppendText("未正确安装CodeSoft软件\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText("未正确安装BarTender软件\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -103,9 +105,9 @@ namespace UAS_MES_NEW.Packing
|
|
|
catch (Exception mes)
|
|
|
{
|
|
|
if (Baurate.Text == "" || ComList.Text == "")
|
|
|
- OperateResult.AppendText(">>请先在电子秤调试界面维护波特率和串口\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>请先在电子秤调试界面维护波特率和串口\n", Color.Red);
|
|
|
else
|
|
|
- OperateResult.AppendText(">>" + mes.Message + "\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>" + mes.Message + "\n", Color.Red);
|
|
|
}
|
|
|
sn_code.Focus();
|
|
|
dh = SystemInf.dh;
|
|
|
@@ -131,6 +133,15 @@ namespace UAS_MES_NEW.Packing
|
|
|
try
|
|
|
{
|
|
|
weight.Text = re.Match(serialPort1.ReadLine().Trim()).Groups[0].Value;
|
|
|
+ pa_remark.AppendText(weight.Text + "\n");
|
|
|
+ //int len = serialPort1.BytesToRead;
|
|
|
+ //Byte[] readBuffer = new Byte[len];
|
|
|
+ //serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
|
|
|
+ //string weigh = Encoding.Default.GetString(readBuffer);
|
|
|
+ //if (weigh != "")
|
|
|
+ //{
|
|
|
+ // weight.Text = re.Matches(weigh)[0].Value;
|
|
|
+ //}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
@@ -216,13 +227,24 @@ namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
|
dh.ExecuteSql("update package set pa_printcount=pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
|
|
|
//doc = lbl.Documents.Open(PrintLabel.Text);
|
|
|
- if (Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), oMakeCode == "" ? pa_makecode.Text : oMakeCode, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
|
|
|
+ if (Print.BarTender1(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), oMakeCode == "" ? pa_makecode.Text : oMakeCode, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
|
|
|
{
|
|
|
OperateResult.AppendText(">>开始打印箱号" + pa_outboxcode.Text + "\n", Color.Black);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- OperateResult.AppendText(ErrorMessage + "\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
|
|
|
+ }
|
|
|
+ if (PrintSecond.Checked)
|
|
|
+ {
|
|
|
+ if (Print.BarTender1(Tag.ToString(), ref engine, PrintLabel1.Text, PrintLabel1.SelectedValue.ToString(), PrintList1.Text, pa_outboxcode.Text, int.Parse(PrintNum1.Text), oMakeCode == "" ? pa_makecode.Text : oMakeCode, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>开始打印箱号" + pa_outboxcode.Text + "\n", Color.Black);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
|
|
|
+ }
|
|
|
}
|
|
|
if (!AutoGenBoxCode.Checked)
|
|
|
{
|
|
|
@@ -235,9 +257,9 @@ namespace UAS_MES_NEW.Packing
|
|
|
sn_code.SelectAll();
|
|
|
}
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "尚未封箱,请封箱后执行打印\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "尚未封箱,请封箱后执行打印\n", Color.Red);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>产品" + pr_code.Text + "未维护打印标签\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>产品" + pr_code.Text + "未维护打印标签\n", Color.Red);
|
|
|
}
|
|
|
|
|
|
//加载工单信息和装箱明细信息
|
|
|
@@ -262,6 +284,35 @@ namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
|
if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
|
|
|
{
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_sncode from makeserial where ms_imei1='" + sn_code.Text + "' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ sn_code.Text = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_sncode from makeserial where ms_imei2='" + sn_code.Text + "' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ sn_code.Text = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select mil_sncode from makeimeilist where mil_imei1='" + sn_code.Text + "' order by mil_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ sn_code.Text = dt.Rows[0]["mil_sncode"].ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select mil_sncode from makeimeilist where mil_imei2='" + sn_code.Text + "' order by mil_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ sn_code.Text = dt.Rows[0]["mil_sncode"].ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode,ms_craftcode,ms_prodcode from makeserial where ms_sncode ='" + sn_code.Text + "' order by ms_id desc", "select");
|
|
|
if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage) || (dt.Rows.Count > 0 && dt.Rows[0]["ms_status"].ToString() == "2"))
|
|
|
{
|
|
|
@@ -278,14 +329,15 @@ namespace UAS_MES_NEW.Packing
|
|
|
string craftstepcode = dh.getFieldDataByCondition("craft left join craftdetail on cr_id =cd_crid", "cd_stepcode", "cr_prodcode='" + prodcode + "' and cr_code='" + craftcode + "' and cd_stepcode='" + User.CurrentStepCode + "'").ToString();
|
|
|
if (craftstepcode == "")
|
|
|
{
|
|
|
- OperateResult.AppendText("工序" + User.CurrentStepCode + "不在途程" + craftcode + "内,不允许采集\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText("工序" + User.CurrentStepCode + "不在途程" + craftcode + "内,不允许采集\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
|
|
|
if (nextstepcode != "" && nextstepcode != User.CurrentStepCode)
|
|
|
{
|
|
|
- OperateResult.AppendText("当前序列号下一道工序为" + nextstepcode + ",当前资源不允许采集\n", Color.DarkRed);
|
|
|
+ string stname = dh.getFieldDataByCondition("step", "st_name", "st_code='" + nextstepcode + "'").ToString();
|
|
|
+ OperateResult.AppendText("<<序列号:" + sn_code.Text + "下一工序是" + stname + ",不是当前岗位的工序\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
//PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
|
|
|
@@ -309,19 +361,19 @@ namespace UAS_MES_NEW.Packing
|
|
|
ms_salecode_text = dt.Rows[0]["ms_salecode"].ToString();
|
|
|
if (locksalecode.Checked && ms_salecode.Text != "" && ms_salecode.Text != ms_salecode_text)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号" + ms_salecode_text + "与界面订单号" + ms_salecode.Text + "不同,无法采集\n", Color.DarkRed, sn_code);
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号" + ms_salecode_text + "与界面订单号" + ms_salecode.Text + "不同,无法采集\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
}
|
|
|
if (dt.Rows[0]["ms_outno"].ToString() != "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "已被出货单" + dt.Rows[0]["ms_outno"].ToString() + "采集,不允许操作\n", Color.DarkRed, sn_code);
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "已被出货单" + dt.Rows[0]["ms_outno"].ToString() + "采集,不允许操作\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
if (dt.Rows[0]["ms_iostatus"].ToString() != "0")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "已入库不允许采集\n", Color.DarkRed, sn_code);
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "已入库不允许采集\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
if (pa_standardqty.Text != "0" && pa_standardqty.Text != "")
|
|
|
@@ -347,13 +399,13 @@ namespace UAS_MES_NEW.Packing
|
|
|
}
|
|
|
if (pa_outboxcode.Text == "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱号不能为空\n", Color.DarkRed, sn_code);
|
|
|
+ OperateResult.AppendText(">>箱号不能为空\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
//判断箱内总数必须大于0
|
|
|
if (pr_outboxinnerqty.Text == "" || pr_outboxinnerqty.Text == "0")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱内容量必须大于0\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>箱内容量必须大于0\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
sql.Clear();
|
|
|
@@ -368,12 +420,12 @@ namespace UAS_MES_NEW.Packing
|
|
|
}
|
|
|
if (dt.Rows[0]["pa_outno"].ToString() != "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "已被出货单" + dt.Rows[0]["pa_outno"].ToString() + "采集,不允许操作\n", Color.DarkRed, sn_code);
|
|
|
+ OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "已被出货单" + dt.Rows[0]["pa_outno"].ToString() + "采集,不允许操作\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
if (dt.Rows[0]["pa_iostatus"].ToString() != "0")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "处于入库状态,不允许操作\n", Color.DarkRed, sn_code);
|
|
|
+ OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "处于入库状态,不允许操作\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -384,9 +436,9 @@ namespace UAS_MES_NEW.Packing
|
|
|
if (ms_outboxcode != "")
|
|
|
{
|
|
|
if (ms_outboxcode == pa_outboxcode.Text)
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "已在本箱内\n", Color.DarkRed, sn_code);
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "已在本箱内\n", Color.Red, sn_code);
|
|
|
else
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "已采集至箱" + ms_outboxcode + "\n", Color.DarkRed, sn_code);
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "已采集至箱" + ms_outboxcode + "\n", Color.Red, sn_code);
|
|
|
LoadData();
|
|
|
}
|
|
|
else
|
|
|
@@ -413,7 +465,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
OperateResult.AppendText(">>" + ErrorMessage + "\n");
|
|
|
LoadCheckQTY();
|
|
|
LoadCollectedNum();
|
|
|
- OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.LightGreen);
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "卡通箱采集", "卡通箱" + pa_outboxcode.Text + "采集成功", sn_code.Text, "");
|
|
|
LastSncode = sn_code.Text;
|
|
|
//满箱更新状态为1
|
|
|
@@ -452,18 +504,18 @@ namespace UAS_MES_NEW.Packing
|
|
|
sn_code.Clear();
|
|
|
if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) == int.Parse(pr_outboxinnerqty.Text))
|
|
|
{
|
|
|
- ActWeigh = weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Trim();
|
|
|
+ ActWeigh = weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Replace("g", "").Trim();
|
|
|
float weigh = float.Parse(ActWeigh);
|
|
|
if (PR_CHECKCARTONW != "0")
|
|
|
{
|
|
|
if (MinWeight == 0 || MaxWeight == 0)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>产品" + pr_code.Text + "未维护卡通箱重量范围\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>产品" + pr_code.Text + "未维护卡通箱重量范围\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
if (!(weigh >= MinWeight && weigh <= MaxWeight) || weigh == 0)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量\n", Color.Red);
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不符合要求:" + weight.Text.Trim(), pa_outboxcode.Text, "");
|
|
|
LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
|
|
|
return;
|
|
|
@@ -472,7 +524,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty,pa_weight=" + weigh + "", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
pa_standardqty.Text = "";
|
|
|
pa_status.Text = "1";
|
|
|
- OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "满箱封箱成功\n", Color.LightGreen);
|
|
|
+ OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "满箱封箱成功\n", Color.Green);
|
|
|
LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量完成:" + weight.Text.Trim(), pa_outboxcode.Text, "");
|
|
|
if (LogicHandler.OutBoxStepPass(pa_outboxcode.Text, ms_makecode, User.UserSourceCode, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", "卡通箱整箱过站", out ErrorMessage))
|
|
|
@@ -481,11 +533,11 @@ namespace UAS_MES_NEW.Packing
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
}
|
|
|
LoadCheckQTY();
|
|
|
LoadCollectedNum();
|
|
|
- OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量完成\n", Color.LightGreen);
|
|
|
+ OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量完成\n", Color.Green);
|
|
|
if (AutoPrint.Checked)
|
|
|
Print_Click(new object(), new EventArgs());
|
|
|
if (!CollecRemark.Checked)
|
|
|
@@ -508,7 +560,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
//勾选了取消箱号先验证箱号存不存在,存在的话移除掉,重新加载一次数据
|
|
|
@@ -545,14 +597,14 @@ namespace UAS_MES_NEW.Packing
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "卡通箱采集", "卡通箱" + pa_outboxcode.Text + "取消采集成功", sn_code.Text, "");
|
|
|
LoadGridData();
|
|
|
pa_status.Text = "0";
|
|
|
- OperateResult.AppendText(">>已从该箱中移除序列号" + sn_code.Text + "\n", Color.LightGreen, sn_code);
|
|
|
+ OperateResult.AppendText(">>已从该箱中移除序列号" + sn_code.Text + "\n", Color.Green, sn_code);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.DarkRed, sn_code);
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sn_code);
|
|
|
}
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.DarkRed, sn_code);
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sn_code);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.DarkRed, sn_code);
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sn_code);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -564,15 +616,27 @@ namespace UAS_MES_NEW.Packing
|
|
|
private void pr_code_TextChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
LoadCheckQTY();
|
|
|
- dt = (DataTable)dh.ExecuteSql("select la_id,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='卡通箱标' and la_statuscode='AUDITED' order by la_isdefault", "select");
|
|
|
- PrintLabel.DataSource = dt;
|
|
|
- PrintLabel.DisplayMember = "la_url";
|
|
|
- PrintLabel.ValueMember = "la_id";
|
|
|
+ DataTable _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault,replace(LA_SOFTTYPE,';',',')LA_SOFTTYPE from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='卡通箱标' and la_statuscode='AUDITED' order by la_isdefault", "select");
|
|
|
+ if (_dt.Rows.Count == 0)
|
|
|
+ {
|
|
|
+ _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault,replace(LA_SOFTTYPE,';',',')LA_SOFTTYPE from label where la_prodcode is null and la_templatetype='卡通箱标' and la_statuscode='AUDITED' order by la_isdefault", "select");
|
|
|
+ }
|
|
|
+ if (_dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string la_id = _dt.Rows[0]["la_id"].ToString();
|
|
|
+ _dt = (DataTable)dh.ExecuteSql("select fp_name la_url,'" + la_id + "' la_id from FILEPATH where fp_id in (select * from table(select parsestring(LA_SOFTTYPE,';') from label where la_id='" + la_id + "') where COLUMN_VALUE is not null)", "select");
|
|
|
+ PrintLabel.DataSource = _dt;
|
|
|
+ PrintLabel.DisplayMember = "la_url";
|
|
|
+ PrintLabel.ValueMember = "la_id";
|
|
|
+
|
|
|
+ PrintLabel1.DataSource = _dt.Copy();
|
|
|
+ PrintLabel1.DisplayMember = "la_url";
|
|
|
+ PrintLabel1.ValueMember = "la_id";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void Make_PackageCollectionWeigh_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
{
|
|
|
- BaseUtil.ClosePrint(lbl);
|
|
|
if (serialPort1.IsOpen)
|
|
|
{
|
|
|
GetData = false;
|
|
|
@@ -590,13 +654,13 @@ namespace UAS_MES_NEW.Packing
|
|
|
string Seal = MessageBox.Show(this.ParentForm, "是否确认封箱?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
if (Seal == "Yes")
|
|
|
{
|
|
|
- ActWeigh = weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Trim();
|
|
|
+ ActWeigh = weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Replace("g", "").Trim();
|
|
|
float weigh = float.Parse(ActWeigh);
|
|
|
if (PR_CHECKCARTONW != "0" && pa_standardqty.Text == pa_currentqty.Text)
|
|
|
{
|
|
|
if (!(weigh >= MinWeight && weigh <= MaxWeight) || weigh == 0)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量,不能完成工序过站\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量,不能完成工序过站\n", Color.Red);
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不符合要求:" + weight.Text.Trim(), pa_outboxcode.Text, "");
|
|
|
LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
|
|
|
return;
|
|
|
@@ -606,7 +670,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
pa_status.Text = "1";
|
|
|
pa_standardqty.Text = "";
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱采集", "封箱成功", pa_outboxcode.Text, "");
|
|
|
- OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "封箱成功\n", Color.LightGreen);
|
|
|
+ OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "封箱成功\n", Color.Green);
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量完成:" + weight.Text.Trim(), pa_outboxcode.Text, "");
|
|
|
LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
|
|
|
string ms_makecode = dh.getFieldDataByCondition("packagedetail", "pd_makecode", "pd_outboxcode = '" + pa_outboxcode.Text + "'").ToString();
|
|
|
@@ -616,7 +680,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
}
|
|
|
LoadCheckQTY();
|
|
|
if (!CollecRemark.Checked)
|
|
|
@@ -639,7 +703,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "错误或者已封箱\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "错误或者已封箱\n", Color.Red);
|
|
|
}
|
|
|
|
|
|
private void SendCheck_Click(object sender, EventArgs e)
|
|
|
@@ -649,7 +713,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select wm_concat(pa_outboxcode) pa_outboxcode from package where pa_checkno='" + ob_checkno.Text + "' and pa_status=0 ", "select");
|
|
|
if (dt.Rows[0][0].ToString() != "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>批次" + ob_checkno.Text + "存在箱号" + dt.Rows[0][0].ToString() + "未封箱,请先进行封箱\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>批次" + ob_checkno.Text + "存在箱号" + dt.Rows[0][0].ToString() + "未封箱,请先进行封箱\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
sql.Clear();
|
|
|
@@ -659,13 +723,13 @@ namespace UAS_MES_NEW.Packing
|
|
|
ob_batchqty.Text = "";
|
|
|
ob_nowcheckqty.ForeColor = Color.Black;
|
|
|
SendCheck.Enabled = false;
|
|
|
- OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.LightGreen);
|
|
|
+ OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.Green);
|
|
|
LogicHandler.InsertMakeProcess(LastSncode, oMakeCode, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
|
|
|
//记录操作日志
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
|
|
|
ob_checkno.Text = "";
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>必须封箱才能送检\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>必须封箱才能送检\n", Color.Red);
|
|
|
}
|
|
|
|
|
|
bool AutoCut;
|
|
|
@@ -701,11 +765,11 @@ namespace UAS_MES_NEW.Packing
|
|
|
batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
|
|
|
if (nowcheckqty >= batchqty)
|
|
|
{
|
|
|
- ob_nowcheckqty.ForeColor = Color.DarkRed;
|
|
|
- OperateResult.AppendText(">>当前采集数量已达到送检数量\n", Color.DarkRed);
|
|
|
+ ob_nowcheckqty.ForeColor = Color.Red;
|
|
|
+ OperateResult.AppendText(">>当前采集数量已达到送检数量\n", Color.Red);
|
|
|
if (AutoCut)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>批次" + ob_checkno.Text + "自动断批\n", Color.LightGreen);
|
|
|
+ OperateResult.AppendText(">>批次" + ob_checkno.Text + "自动断批\n", Color.Green);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -752,7 +816,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
|
if (pa_outboxcode.Text == "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱号不能为空\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>箱号不能为空\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
string Delete = MessageBox.Show(this.ParentForm, "是否确认拆箱?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
@@ -763,12 +827,12 @@ namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
|
if (dt.Rows[0]["pa_outno"].ToString() != "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "已被出货单" + dt.Rows[0]["pa_outno"].ToString() + "采集,不允许操作\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "已被出货单" + dt.Rows[0]["pa_outno"].ToString() + "采集,不允许操作\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
if (dt.Rows[0]["pa_iostatus"].ToString() != "0")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "处于入库状态,不允许操作\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "处于入库状态,不允许操作\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
if (dt.Rows[0]["pa_mothercode"].ToString() == "")
|
|
|
@@ -793,7 +857,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
SQLS1.Add("delete from steppassed where sp_sncode in (select ms_sncode from makeserial where ms_outboxcode='" + pa_outboxcode.Text + "' and ms_makecode='" + ma_code + "') and sp_makecode='" + ma_code + "' and sp_stepcode='" + User.CurrentStepCode + "'");
|
|
|
SQLS1.Add("update makecraftdetail set mcd_inqty=mcd_inqty-" + num + ",mcd_outqty=mcd_outqty-" + num + ",mcd_okqty=mcd_okqty-" + num + " where mcd_macode='" + ma_code + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
|
|
|
//扣减已完工数
|
|
|
- SQLS1.Add("update make set ma_madeqty=ma_madeqty-(select count(1) from makeserial where ms_outboxcode='" + pa_outboxcode.Text + "' and ms_makecode='" + ma_code + "' and ms_status=2) where ma_code='" + ma_code + "'");
|
|
|
+ SQLS1.Add("update make set ma_endqty=ma_endqty-(select count(1) from makeserial where ms_outboxcode='" + pa_outboxcode.Text + "' and ms_makecode='" + ma_code + "' and ms_status=2) where ma_code='" + ma_code + "'");
|
|
|
}
|
|
|
if (pa_checkno != "")
|
|
|
{
|
|
|
@@ -817,19 +881,20 @@ namespace UAS_MES_NEW.Packing
|
|
|
dh.ExecuteSql("update package set pa_checkno='',pa_prodcode='',pa_packtype='',pa_salecode='',pa_packageqty=0,pa_totalqty=0,pa_currentqty=0,pa_status=0 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
|
|
|
pa_status.Text = "0";
|
|
|
//删除箱的明细
|
|
|
+ dh.ExecuteSql("delete from labelprintlog where lpl_value='" + pa_outboxcode.Text + "'", "delete");
|
|
|
dh.ExecuteSql("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "'", "delete");
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱拆解", "成功", pa_outboxcode.Text, ob_checkno.Text);
|
|
|
- OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "成功拆解!\n", Color.LightGreen);
|
|
|
+ OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "成功拆解!\n", Color.Green);
|
|
|
LoadGridData();
|
|
|
LoadCheckQTY();
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已送检,不允许解除\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已送检,不允许解除\n", Color.Red);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已下地,不允许解除\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已下地,不允许解除\n", Color.Red);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已装箱" + dt.Rows[0]["pa_mothercode"].ToString() + ",不允许解除\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已装箱" + dt.Rows[0]["pa_mothercode"].ToString() + ",不允许解除\n", Color.Red);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -878,7 +943,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
}
|
|
|
if (pa_outboxcode.Text.Length != int.Parse(OutBoxLength.Text))
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱号长度错误,请重新输入箱号\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>箱号长度错误,请重新输入箱号\n", Color.Red);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -888,13 +953,13 @@ namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
|
if (pa_outboxcode.Text.Substring(0, PreFix.Text.Length) != PreFix.Text)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱号前缀不匹配,请重新输入箱号\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>箱号前缀不匹配,请重新输入箱号\n", Color.Red);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱号前缀不匹配,请重新输入箱号\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>箱号前缀不匹配,请重新输入箱号\n", Color.Red);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -941,13 +1006,13 @@ namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
|
if (pa_remark.Text.Substring(0, Remark_PreFix.Text.Length) != Remark_PreFix.Text)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>备注前缀不匹配,请重新输入备注信息\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>备注前缀不匹配,请重新输入备注信息\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>备注前缀不匹配,请重新输入备注信息\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>备注前缀不匹配,请重新输入备注信息\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -956,12 +1021,12 @@ namespace UAS_MES_NEW.Packing
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select pa_outboxcode from package where pa_remark='" + pa_remark.Text.ToUpper() + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>箱号" + dt.Rows[0][0].ToString() + "已采集关联信息" + pa_remark.Text + "\n", Color.DarkRed);
|
|
|
+ OperateResult.AppendText(">>箱号" + dt.Rows[0][0].ToString() + "已采集关联信息" + pa_remark.Text + "\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
dh.UpdateByCondition("package", "pa_remark='" + pa_remark.Text.ToUpper() + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
|
|
|
- OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "关联信息" + pa_remark.Text + "采集成功\n", Color.LightGreen);
|
|
|
+ OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "关联信息" + pa_remark.Text + "采集成功\n", Color.Green);
|
|
|
pa_remark.Text = "";
|
|
|
if (!AutoGenBoxCode.Checked)
|
|
|
{
|
|
|
@@ -973,7 +1038,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
sn_code.Focus();
|
|
|
}
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>请先采集箱内数据\n", Color.DarkRed);
|
|
|
+ else OperateResult.AppendText(">>请先采集箱内数据\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1045,11 +1110,13 @@ namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
|
OutBoxLength.Enabled = false;
|
|
|
PreFix.Enabled = false;
|
|
|
+ pa_outboxcode.Enabled = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
OutBoxLength.Enabled = true;
|
|
|
PreFix.Enabled = true;
|
|
|
+ pa_outboxcode.Enabled = true;
|
|
|
}
|
|
|
}
|
|
|
}
|