|
|
@ -577,26 +577,32 @@ namespace InjectionPC |
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
if (SaveBarCode (md, Program.tableName, true, mould) == false) |
|
|
|
{ |
|
|
|
int a = 0; |
|
|
|
for (int l = 0; l < 5; l++) |
|
|
|
{ |
|
|
|
// if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == true) |
|
|
|
{ |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
a += 1; |
|
|
|
Thread.Sleep(200); |
|
|
|
} |
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
//if (SaveBarCode (md, Program.tableName, true, mould) == false)
|
|
|
|
// {
|
|
|
|
// int a = 0;
|
|
|
|
// for (int l = 0; l < 5; l++)
|
|
|
|
// {
|
|
|
|
// // if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
// if (SaveBarCode(md, Program.tableName, true, mould) == true)
|
|
|
|
// {
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// a += 1;
|
|
|
|
// Thread.Sleep(200);
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
// if (a >= 4)
|
|
|
|
// {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, true, mould,false,ref errMsg); |
|
|
|
if(saveRst == false) |
|
|
|
{ |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
@ -614,12 +620,12 @@ namespace InjectionPC |
|
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
"wl.grf" |
|
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName(); //new
|
|
|
|
PrintMoudleName("0"); //new
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName(); |
|
|
|
PrintMoudleName("1"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -767,26 +773,33 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == false) |
|
|
|
{ |
|
|
|
int a = 0; |
|
|
|
for (int l = 0; l < 5; l++) |
|
|
|
{ |
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == true) |
|
|
|
{ |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
a += 1; |
|
|
|
Thread.Sleep(200); |
|
|
|
} |
|
|
|
//// if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
//if (SaveBarCode(md, Program.tableName, true, mould) == false)
|
|
|
|
//{
|
|
|
|
// int a = 0;
|
|
|
|
// for (int l = 0; l < 5; l++)
|
|
|
|
// {
|
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
// if (SaveBarCode(md, Program.tableName, true, mould) == true)
|
|
|
|
// {
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// a += 1;
|
|
|
|
// Thread.Sleep(200);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (a >= 4)
|
|
|
|
// {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
@ -817,18 +830,18 @@ namespace InjectionPC |
|
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
"wl.grf" |
|
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName(); //new
|
|
|
|
PrintMoudleName("0"); //new
|
|
|
|
if (partNo[j].Contains("A2146982300") || |
|
|
|
partNo[j].Contains("A2146982400")) |
|
|
|
{ |
|
|
|
filename = AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName(); |
|
|
|
PrintMoudleName("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName(); |
|
|
|
PrintMoudleName("1"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1063,26 +1076,34 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == false) |
|
|
|
{ |
|
|
|
int a = 0; |
|
|
|
for (int l = 0; l < 5; l++) |
|
|
|
{ |
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == true) |
|
|
|
{ |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
a += 1; |
|
|
|
Thread.Sleep(200); |
|
|
|
} |
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
//if (SaveBarCode(md, Program.tableName, true, mould) == false)
|
|
|
|
//{
|
|
|
|
// int a = 0;
|
|
|
|
// for (int l = 0; l < 5; l++)
|
|
|
|
// {
|
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
// if (SaveBarCode(md, Program.tableName, true, mould) == true)
|
|
|
|
// {
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// a += 1;
|
|
|
|
// Thread.Sleep(200);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (a >= 4)
|
|
|
|
// {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
@ -1099,12 +1120,12 @@ namespace InjectionPC |
|
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
"wl.grf" |
|
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName(); //new
|
|
|
|
PrintMoudleName("0"); //new
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName(); |
|
|
|
PrintMoudleName("1"); |
|
|
|
} |
|
|
|
|
|
|
|
//DataTable dt4 = pbll.SearchInfo(partNo[j].ToString().Trim(),
|
|
|
@ -1166,9 +1187,14 @@ namespace InjectionPC |
|
|
|
//}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
throw new Exception("p1197" + ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
@ -1204,9 +1230,15 @@ namespace InjectionPC |
|
|
|
//}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
|
try |
|
|
|
{ |
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
} |
|
|
|
catch(Exception ex) |
|
|
|
{ |
|
|
|
throw new Exception("p1235"+ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
@ -1254,58 +1286,75 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
|
|
|
|
#region 插入数据tb_barCode
|
|
|
|
|
|
|
|
md.ID = Guid.NewGuid().ToString(); |
|
|
|
md.StationID = dt.Rows[0]["StationID"].ToString(); |
|
|
|
md.OneBarCode = NewOneCode; |
|
|
|
md.BarCode = newcode; |
|
|
|
md.StockNo = stockNo[j].ToString().Trim(); |
|
|
|
md.PartNo = partNo[j].ToString().Trim(); |
|
|
|
md.PrintType = 0; |
|
|
|
md.PlanID = planID; |
|
|
|
md.ProductNature = ProductNature; |
|
|
|
md.Des1 = PartName; |
|
|
|
DataTable pdt = productBll.SearchIsImportByPartNo(partNo[j].ToString()); |
|
|
|
if (pdt != null && pdt.Rows.Count > 0) |
|
|
|
try |
|
|
|
{ |
|
|
|
if (pdt.Rows[0]["isImport"].ToString() == "1") |
|
|
|
{ |
|
|
|
md.Import = "国产料Kingfa"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
md.Import = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == false) |
|
|
|
{ |
|
|
|
int a = 0; |
|
|
|
for (int l = 0; l < 5; l++) |
|
|
|
md.ID = Guid.NewGuid().ToString(); |
|
|
|
md.StationID = dt.Rows[0]["StationID"].ToString(); |
|
|
|
md.OneBarCode = NewOneCode; |
|
|
|
md.BarCode = newcode; |
|
|
|
md.StockNo = stockNo[j].ToString().Trim(); |
|
|
|
md.PartNo = partNo[j].ToString().Trim(); |
|
|
|
md.PrintType = 0; |
|
|
|
md.PlanID = planID; |
|
|
|
md.ProductNature = ProductNature; |
|
|
|
md.Des1 = PartName; |
|
|
|
DataTable pdt = productBll.SearchIsImportByPartNo(partNo[j].ToString()); |
|
|
|
if (pdt != null && pdt.Rows.Count > 0) |
|
|
|
{ |
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == true) |
|
|
|
{ |
|
|
|
break; |
|
|
|
if (pdt.Rows[0]["isImport"].ToString() == "1") |
|
|
|
{ |
|
|
|
md.Import = "国产料Kingfa"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
md.Import = ""; |
|
|
|
} |
|
|
|
|
|
|
|
a += 1; |
|
|
|
Thread.Sleep(200); |
|
|
|
} |
|
|
|
|
|
|
|
if (a >= 4) |
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
//if (SaveBarCode(md, Program.tableName, true, mould) == false)
|
|
|
|
//{
|
|
|
|
// int a = 0;
|
|
|
|
// for (int l = 0; l < 5; l++)
|
|
|
|
// {
|
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
// if (SaveBarCode(md, Program.tableName, true, mould) == true)
|
|
|
|
// {
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// a += 1;
|
|
|
|
// Thread.Sleep(200);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (a >= 4)
|
|
|
|
// {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
SaveLog3(Program.station + "测试保存条码" + md.OneBarCode); |
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
return; |
|
|
|
SaveLog3(Program.station + "测试保存错误,异常信息:" + md.OneBarCode + errMsg); |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
throw new Exception("p1348" + ex.Message); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 打印条码,判断是否打印单个条码
|
|
|
|
|
|
|
|
#region 打印单个标签
|
|
|
|
|
|
|
|
SaveLog3(Program.station + "测试保存 ,IsOne:" + md.OneBarCode +":"+ IsOne); |
|
|
|
if (IsOne == "1") |
|
|
|
{ |
|
|
|
|
|
|
@ -1315,7 +1364,7 @@ namespace InjectionPC |
|
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
"wl.grf" |
|
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName();//new
|
|
|
|
PrintMoudleName("0");//new
|
|
|
|
if (partNo[j].Contains("A2146982300") || |
|
|
|
partNo[j].Contains("A2146982400")) |
|
|
|
{ |
|
|
@ -1325,9 +1374,9 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(); |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName("1"); |
|
|
|
} |
|
|
|
|
|
|
|
SaveLog3(Program.station + "测试保存 ,filename:" + md.OneBarCode + ":" + filename); |
|
|
|
//DataTable dt4 = pbll.SearchInfo(partNo[j].ToString().Trim(),
|
|
|
|
// dt.Rows[0]["StationID"].ToString());
|
|
|
|
//if (dt4 != null && dt4.Rows.Count > 0)
|
|
|
@ -1565,29 +1614,35 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == false) |
|
|
|
{ |
|
|
|
int a = 0; |
|
|
|
for (int l = 0; l < 5; l++) |
|
|
|
{ |
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == true) |
|
|
|
{ |
|
|
|
break; |
|
|
|
} |
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
//if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == false)
|
|
|
|
//{
|
|
|
|
// int a = 0;
|
|
|
|
// for (int l = 0; l < 5; l++)
|
|
|
|
// {
|
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
// if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == true)
|
|
|
|
// {
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
|
|
|
|
a += 1; |
|
|
|
Thread.Sleep(200); |
|
|
|
} |
|
|
|
// a += 1;
|
|
|
|
// Thread.Sleep(200);
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
// if (a >= 4)
|
|
|
|
// {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, true, same[j].ToString(), false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 增加产量
|
|
|
@ -1792,29 +1847,34 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == false) |
|
|
|
{ |
|
|
|
int a = 0; |
|
|
|
for (int l = 0; l < 5; l++) |
|
|
|
{ |
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == true) |
|
|
|
{ |
|
|
|
break; |
|
|
|
} |
|
|
|
//// if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
//if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == false)
|
|
|
|
//{
|
|
|
|
// int a = 0;
|
|
|
|
// for (int l = 0; l < 5; l++)
|
|
|
|
// {
|
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
// if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == true)
|
|
|
|
// {
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
|
|
|
|
a += 1; |
|
|
|
Thread.Sleep(200); |
|
|
|
} |
|
|
|
// a += 1;
|
|
|
|
// Thread.Sleep(200);
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
// if (a >= 4)
|
|
|
|
// {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, true, same[j].ToString(), false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 增加产量
|
|
|
@ -2133,6 +2193,7 @@ namespace InjectionPC |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -2425,12 +2486,21 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//if (bll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
if (SaveBarCode(md, Program.tableName, false, "0",i== printCount) == false) |
|
|
|
////if (bll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
//if (SaveBarCode(md, Program.tableName, false, "0",i== printCount) == false)
|
|
|
|
//{
|
|
|
|
// return;
|
|
|
|
//}
|
|
|
|
|
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, false, "0", i == printCount, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
return; |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 打印单个标签
|
|
|
@ -2442,7 +2512,7 @@ namespace InjectionPC |
|
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
"wl.grf" |
|
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName(); //new
|
|
|
|
PrintMoudleName("0"); //new
|
|
|
|
if (partNo.Contains("A2146982300") || |
|
|
|
partNo.Contains("A2146982400")) |
|
|
|
{ |
|
|
@ -2694,10 +2764,18 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//if (bll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
if (SaveBarCode(md, Program.tableName, false, "0") == false) |
|
|
|
{ |
|
|
|
return; |
|
|
|
////if (bll.Add_Info_New(md, Program.tableName) == false)
|
|
|
|
//if (SaveBarCode(md, Program.tableName, false, "0") == false)
|
|
|
|
//{
|
|
|
|
// return;
|
|
|
|
//}
|
|
|
|
|
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, false, "0", false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
@ -2706,7 +2784,7 @@ namespace InjectionPC |
|
|
|
|
|
|
|
if (IsOne == "1") |
|
|
|
{ |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(); |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName("1"); |
|
|
|
|
|
|
|
//DataTable dt4 = plbll.SearchInfo(partNo, stationID);
|
|
|
|
//if (dt4 != null && dt4.Rows.Count > 0)
|
|
|
@ -2934,6 +3012,7 @@ namespace InjectionPC |
|
|
|
private void label22_Click(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
string code = "", filename = "", printName = "", ManufacturerName = ""; |
|
|
|
string IsSupply = "0"; |
|
|
|
BarCodeModel md = new BarCodeModel(); |
|
|
|
BarCodeBLL bll = new BarCodeBLL(); |
|
|
|
ProductBLL pbll = new ProductBLL(); |
|
|
@ -2998,7 +3077,7 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
|
|
|
|
ManufacturerName = pdt.Rows[0]["ManufacturerName"].ToString().Trim(); |
|
|
|
|
|
|
|
IsSupply = pdt.Rows[0]["IsSupply"].ToString(); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@ -3027,7 +3106,7 @@ namespace InjectionPC |
|
|
|
? AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
"wl.grf" |
|
|
|
: AppDomain.CurrentDomain.BaseDirectory + |
|
|
|
PrintMoudleName(); //new
|
|
|
|
PrintMoudleName(IsSupply); //new
|
|
|
|
if (md.PartNo.Contains("A2146982300") || |
|
|
|
md.PartNo.Contains("A2146982400")) |
|
|
|
{ |
|
|
@ -3788,10 +3867,18 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName)==false)
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == false) |
|
|
|
{ |
|
|
|
return; |
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName)==false)
|
|
|
|
//if (SaveBarCode(md, Program.tableName, true, mould) == false)
|
|
|
|
//{
|
|
|
|
// return;
|
|
|
|
//}
|
|
|
|
|
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
@ -3811,7 +3898,7 @@ namespace InjectionPC |
|
|
|
{ |
|
|
|
if (IsSupply == "1") |
|
|
|
{ |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(); |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(IsSupply); |
|
|
|
|
|
|
|
string reportName = ConfigurationManager.AppSettings[printName].ToString(); |
|
|
|
DataTable headTable = GetPrintHeadTable(partNo[j].ToString().Trim(), PartName, NewOneCode, newcode); |
|
|
@ -3859,12 +3946,19 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName)==false)
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == false) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName)==false)
|
|
|
|
//if (SaveBarCode(md, Program.tableName, true, mould) == false)
|
|
|
|
//{
|
|
|
|
// return;
|
|
|
|
//}
|
|
|
|
|
|
|
|
string errMsg = string.Empty; |
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 打印条码,判断是否打印单个条码
|
|
|
@ -3882,7 +3976,7 @@ namespace InjectionPC |
|
|
|
{ |
|
|
|
if (IsSupply == "1") |
|
|
|
{ |
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(); //new
|
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(IsSupply); //new
|
|
|
|
|
|
|
|
string reportName = ConfigurationManager.AppSettings[printName].ToString(); |
|
|
|
DataTable headTable = GetPrintHeadTable(partNo[j].ToString().Trim(), PartName, NewOneCode, newcode); |
|
|
@ -4106,9 +4200,12 @@ namespace InjectionPC |
|
|
|
return lReturn; |
|
|
|
} |
|
|
|
|
|
|
|
//bool SaveBarCode(BarCodeModel bcm, string tableName, bool isAutoPrint, string mould, bool handPrint = false)
|
|
|
|
//{
|
|
|
|
// return true;
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
bool SaveBarCode(BarCodeModel bcm,string tableName, bool isAutoPrint,string mould,bool handPrint = false) |
|
|
|
bool SaveBarCode(BarCodeModel bcm,string tableName, bool isAutoPrint,string mould, ref string errorMsg ,bool handPrint = false ) |
|
|
|
{ |
|
|
|
|
|
|
|
string rst = _wmsBll.SaveRecordAndInterface(bcm, Program.tableName,"",Program.station); |
|
|
@ -4118,73 +4215,50 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
LogErrBLL.AddInfo(rst, MethodBase.GetCurrentMethod()); |
|
|
|
errorMsg = rst; |
|
|
|
LogErrBLL.AddInfo(Program.station+"-"+ bcm.OneBarCode + ":" + rst, MethodBase.GetCurrentMethod()); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 打印箱码
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="boxRow"></param>
|
|
|
|
/// <param name="realCount"></param>
|
|
|
|
/// <param name="mould"></param>
|
|
|
|
private void PrintBoxCode(DataRow boxRow,int realCount,string mould) |
|
|
|
private BarCodeModel _lastbarCodeModel =null; |
|
|
|
bool SaveInfo(BarCodeModel md, bool isAutoPrint, string mould, bool handPrint, ref string errMsg) |
|
|
|
{ |
|
|
|
string filename = System.AppDomain.CurrentDomain.BaseDirectory + "装箱单.grf"; |
|
|
|
DataTable headTable = new DataTable(); |
|
|
|
headTable.Columns.Add("BoxNo"); |
|
|
|
headTable.Columns.Add("PartName"); |
|
|
|
headTable.Columns.Add("PartNo"); |
|
|
|
headTable.Columns.Add("BatchNo"); |
|
|
|
headTable.Columns.Add("PackCount"); |
|
|
|
headTable.Columns.Add("Line"); |
|
|
|
DataRow row = headTable.NewRow(); |
|
|
|
string boxCode = boxRow["BoxNo"].ToString(); |
|
|
|
string[] boxes = boxCode.Split('.'); |
|
|
|
if(boxes.Length != 4) |
|
|
|
if (_lastbarCodeModel!=null) |
|
|
|
{ |
|
|
|
//新生成一个箱码 应该都有
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
row["BoxNo"] = boxCode; |
|
|
|
row["PartNo"] = boxes[0].Trim(); |
|
|
|
row["PartName"] = boxRow["PartName"].ToString(); |
|
|
|
row["BatchNo"] = boxes[1].Trim(); |
|
|
|
row["PackCount"] = realCount; |
|
|
|
row["Line"] = boxRow["StationNo"].ToString()+"注塑机"; |
|
|
|
} |
|
|
|
UpdateBoxRecordPrintState(boxCode); |
|
|
|
string printBoxName = string.Empty; |
|
|
|
if (mould == "1") |
|
|
|
{ |
|
|
|
printBoxName = "Printer3"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
printBoxName = "Printer4"; |
|
|
|
DataTable dt = _barCodeBLL.SeachInfoByOne(_lastbarCodeModel.OneBarCode, Program.tableName, 1); |
|
|
|
if(dt.Rows.Count == 0) |
|
|
|
{ |
|
|
|
SaveLog3("重发数据"+ Program.station + ",条码" + md.OneBarCode); |
|
|
|
SaveBarCode(_lastbarCodeModel, Program.tableName, isAutoPrint, mould, ref errMsg, handPrint); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
string reportName = ConfigurationManager.AppSettings[printBoxName].ToString(); |
|
|
|
headTable.Rows.Add(row); |
|
|
|
|
|
|
|
ReportHelper rp = new ReportHelper(filename, headTable, null, (int)GRPaperOrientation.grpoDefault, 1, reportName); |
|
|
|
|
|
|
|
rp.Report.Print(false); |
|
|
|
|
|
|
|
_lastbarCodeModel = md; |
|
|
|
if (SaveBarCode(md, Program.tableName, isAutoPrint, mould, ref errMsg, handPrint) == false) |
|
|
|
{ |
|
|
|
int a = 0; |
|
|
|
for (int l = 0; l < 3; l++) |
|
|
|
{ |
|
|
|
// if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould, ref errMsg, handPrint) == true) |
|
|
|
{ |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
a += 1; |
|
|
|
//Thread.Sleep(200);
|
|
|
|
Thread.Sleep(200); |
|
|
|
} |
|
|
|
|
|
|
|
private void UpdateBoxRecordPrintState(string UpdatePrinted) |
|
|
|
{ |
|
|
|
_injectionBoxBLL.UpdatePrinted(UpdatePrinted); |
|
|
|
if (a >= 2) |
|
|
|
{ |
|
|
|
SaveLog3(Program.station+"保存3次失败,条码" + md.OneBarCode); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 20位注塑条码
|
|
|
|
/// </summary>
|
|
|
@ -4299,6 +4373,12 @@ namespace InjectionPC |
|
|
|
try |
|
|
|
{ |
|
|
|
this.FormClosed += (arg1, arg2) => { |
|
|
|
|
|
|
|
opcGroup1.DataChange -= new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange); |
|
|
|
opcServer.OPCGroups.RemoveAll(); |
|
|
|
opcServer.Disconnect(); |
|
|
|
serialPort1.Close(); |
|
|
|
|
|
|
|
FrmMain2408 frm = new FrmMain2408(); |
|
|
|
frm.Show(); |
|
|
|
}; |
|
|
@ -4310,7 +4390,7 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
string PrintMoudleName() |
|
|
|
string PrintMoudleName(string isSupply = "0") |
|
|
|
{ |
|
|
|
if("IM05,IM08,IM10".Contains(Program.station)) //二维小条码
|
|
|
|
{ |
|
|
@ -4327,14 +4407,24 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
else if ("IM13,IM14".Contains(Program.station)) //直供条码
|
|
|
|
{ |
|
|
|
return "单个条码1.grf"; |
|
|
|
//return "单个条码1.grf";
|
|
|
|
if (isSupply == "0") //13,14机台,直供件打二维码 非直供件打一维码
|
|
|
|
{ |
|
|
|
return "单个条码.grf"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return "单个条码2.grf"; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return "单个条码2.grf"; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DataTable GetPrintLableModel() |
|
|
|
{ |
|
|
|
DataTable headTable = new DataTable(); |
|
|
@ -4360,50 +4450,18 @@ namespace InjectionPC |
|
|
|
headTable.Rows.Add(row); |
|
|
|
return headTable; |
|
|
|
} |
|
|
|
List<string> GetProductBoxSize(string productCode,ref string currentSize) |
|
|
|
|
|
|
|
void SaveLog3(string txt) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
ProductBLL productBll = new ProductBLL(); |
|
|
|
DataTable dt = productBll.SearchInfoByPartNo(productCode); |
|
|
|
if (dt.Rows.Count == 0) |
|
|
|
{ |
|
|
|
currentSize = "24"; |
|
|
|
MessageBox.Show("零件号{productCode}未设置标包,默认为24,请及时核对后进行配置."); |
|
|
|
return null; |
|
|
|
} |
|
|
|
currentSize = dt.Rows[0]["PackCount"].ToString(); |
|
|
|
string sizeStr = dt.Rows[0]["PackCountSize"].ToString(); |
|
|
|
List<string> list = new List<string>(); |
|
|
|
if (string.IsNullOrEmpty(sizeStr)) |
|
|
|
{ |
|
|
|
list.Add(currentSize); |
|
|
|
return list; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
string[] array = sizeStr.Split(','); |
|
|
|
foreach (string item in array) |
|
|
|
{ |
|
|
|
if (!list.Contains(item)) |
|
|
|
{ |
|
|
|
list.Add(item); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!list.Contains(currentSize)) |
|
|
|
{ |
|
|
|
list.Add(currentSize); |
|
|
|
} |
|
|
|
} |
|
|
|
return list; |
|
|
|
LogSysBLL.AddInfo(txt, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
} |
|
|
|
catch(Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
currentSize = "24"; |
|
|
|
MessageBox.Show("零件号{productCode}未设置标包,默认为24,请及时核对后进行配置."); |
|
|
|
return null; |
|
|
|
LogHelper.WriteLog("SaveLog:" + ex.Message); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|