|
@ -125,9 +125,7 @@ namespace InjectionPC |
|
|
_printNameDict.Add(key, dr["PrinterNo"].ToString()); |
|
|
_printNameDict.Add(key, dr["PrinterNo"].ToString()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
InitPackageInfo(); |
|
|
InitPackageInfo(); |
|
|
|
|
|
|
|
|
Ping p1 = new Ping(); |
|
|
Ping p1 = new Ping(); |
|
|
|
|
|
|
|
|
PingReply reply = p1.Send("10.60.101.60"); //发送主机名或Ip地址
|
|
|
PingReply reply = p1.Send("10.60.101.60"); //发送主机名或Ip地址
|
|
@ -220,7 +218,6 @@ namespace InjectionPC |
|
|
|
|
|
|
|
|
PLCMouldBLL PLCbll = new PLCMouldBLL(); |
|
|
PLCMouldBLL PLCbll = new PLCMouldBLL(); |
|
|
PLCBreakBLL bbll = new PLCBreakBLL(); |
|
|
PLCBreakBLL bbll = new PLCBreakBLL(); |
|
|
|
|
|
|
|
|
DataTable PLCdt = PLCbll.SearchMould(Program.station); |
|
|
DataTable PLCdt = PLCbll.SearchMould(Program.station); |
|
|
if (PLCdt != null && PLCdt.Rows.Count > 0) |
|
|
if (PLCdt != null && PLCdt.Rows.Count > 0) |
|
|
{ |
|
|
{ |
|
@ -230,7 +227,6 @@ namespace InjectionPC |
|
|
opcItemm1[i] = opcItems1.AddItem(PLCdt.Rows[i]["Address"].ToString(), i); |
|
|
opcItemm1[i] = opcItems1.AddItem(PLCdt.Rows[i]["Address"].ToString(), i); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Thread.Sleep(200); |
|
|
Thread.Sleep(200); |
|
|
|
|
|
|
|
|
opcGroup1.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange); |
|
|
opcGroup1.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange); |
|
@ -259,6 +255,7 @@ namespace InjectionPC |
|
|
Connected = false; |
|
|
Connected = false; |
|
|
LogHelper.WriteLog("创建OPC服务失败!"); |
|
|
LogHelper.WriteLog("创建OPC服务失败!"); |
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -406,7 +403,6 @@ namespace InjectionPC |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
CheckPackageSelect(); |
|
|
CheckPackageSelect(); |
|
|
InjectionPlanBLL bll = new InjectionPlanBLL(); |
|
|
InjectionPlanBLL bll = new InjectionPlanBLL(); |
|
|
BarCodeBLL brbll = new BarCodeBLL(); |
|
|
BarCodeBLL brbll = new BarCodeBLL(); |
|
@ -432,7 +428,7 @@ namespace InjectionPC |
|
|
{ |
|
|
{ |
|
|
if ((ItemValues!=null && ItemValues.GetValue(i).ToString() == "True") || IsTest ==true) |
|
|
if ((ItemValues!=null && ItemValues.GetValue(i).ToString() == "True") || IsTest ==true) |
|
|
{ |
|
|
{ |
|
|
LogSysBLL.AddInfo("true" + label6.Text, MethodBase.GetCurrentMethod()); |
|
|
//LogSysBLL.AddInfo("true" + label6.Text, MethodBase.GetCurrentMethod());
|
|
|
GetClass(); |
|
|
GetClass(); |
|
|
|
|
|
|
|
|
#region 增加时间差判定
|
|
|
#region 增加时间差判定
|
|
@ -452,7 +448,6 @@ namespace InjectionPC |
|
|
textBox1.Text = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + |
|
|
textBox1.Text = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + |
|
|
Program.ProductDate.Substring(8, 2); //批次
|
|
|
Program.ProductDate.Substring(8, 2); //批次
|
|
|
#region 查找当前计划
|
|
|
#region 查找当前计划
|
|
|
|
|
|
|
|
|
DataTable dt = bll.SearchInfoByName(Program.station); |
|
|
DataTable dt = bll.SearchInfoByName(Program.station); |
|
|
if (dt != null && dt.Rows.Count > 0) |
|
|
if (dt != null && dt.Rows.Count > 0) |
|
|
{ |
|
|
{ |
|
@ -539,7 +534,7 @@ namespace InjectionPC |
|
|
// Program.ProductDate.Substring(8, 2) + "." + "0001";
|
|
|
// Program.ProductDate.Substring(8, 2) + "." + "0001";
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(),true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(),true, mould, PartName, NumItems+"_551" , ref NewOneCode, ref newcode); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -572,7 +567,7 @@ namespace InjectionPC |
|
|
// Program.ProductDate.Substring(8, 2) + "0001";
|
|
|
// Program.ProductDate.Substring(8, 2) + "0001";
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, NumItems + "_584", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -630,28 +625,37 @@ namespace InjectionPC |
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
if (SaveBarCode (md, Program.tableName, true, mould) == false) |
|
|
//if (SaveBarCode(md, Program.tableName, true, mould) == false)
|
|
|
{ |
|
|
//{
|
|
|
int a = 0; |
|
|
// int a = 0;
|
|
|
for (int l = 0; l < 5; l++) |
|
|
// for (int l = 0; l < 5; l++)
|
|
|
{ |
|
|
// {
|
|
|
// if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
// // if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == true) |
|
|
// if (SaveBarCode(md, Program.tableName, true, mould) == true)
|
|
|
{ |
|
|
// {
|
|
|
break; |
|
|
// break;
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
a += 1; |
|
|
// a += 1;
|
|
|
Thread.Sleep(200); |
|
|
// Thread.Sleep(200);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// if (a >= 4)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //return;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
string errMsg = string.Empty; |
|
|
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
|
|
if (saveRst == false) |
|
|
{ |
|
|
{ |
|
|
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
//return;
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
@ -667,12 +671,12 @@ namespace InjectionPC |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
"wl.grf" |
|
|
"wl.grf" |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName(); //new
|
|
|
PrintMoudleName("0","Print"+Program.station+"_679"); //new
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName(); |
|
|
PrintMoudleName("1", "Print" + Program.station + "_684"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -731,7 +735,7 @@ namespace InjectionPC |
|
|
// Program.ProductDate.Substring(8, 2) + "." + "0001";
|
|
|
// Program.ProductDate.Substring(8, 2) + "." + "0001";
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, NumItems + "_743", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
@ -765,7 +769,7 @@ namespace InjectionPC |
|
|
// Program.ProductDate.Substring(8, 2) + "0001";
|
|
|
// Program.ProductDate.Substring(8, 2) + "0001";
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, NumItems + "_555", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -820,29 +824,36 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
//// if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == false) |
|
|
//if (SaveBarCode(md, Program.tableName, true, mould) == false)
|
|
|
{ |
|
|
//{
|
|
|
int a = 0; |
|
|
// int a = 0;
|
|
|
for (int l = 0; l < 5; l++) |
|
|
// for (int l = 0; l < 5; l++)
|
|
|
{ |
|
|
// {
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == true) |
|
|
// if (SaveBarCode(md, Program.tableName, true, mould) == true)
|
|
|
{ |
|
|
// {
|
|
|
break; |
|
|
// break;
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
a += 1; |
|
|
// a += 1;
|
|
|
Thread.Sleep(200); |
|
|
// Thread.Sleep(200);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// if (a >= 4)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //return;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
string errMsg = string.Empty; |
|
|
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
|
|
if (saveRst == false) |
|
|
{ |
|
|
{ |
|
|
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
//return;
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 打印条码,判断是否打印单个条码
|
|
|
#region 打印条码,判断是否打印单个条码
|
|
@ -870,18 +881,18 @@ namespace InjectionPC |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
"wl.grf" |
|
|
"wl.grf" |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName(); //new
|
|
|
PrintMoudleName("0", "Print" + Program.station + "_882"); //new
|
|
|
if (partNo[j].Contains("A2146982300") || |
|
|
if (partNo[j].Contains("A2146982300") || |
|
|
partNo[j].Contains("A2146982400")) |
|
|
partNo[j].Contains("A2146982400")) |
|
|
{ |
|
|
{ |
|
|
filename = AppDomain.CurrentDomain.BaseDirectory + |
|
|
filename = AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName(); |
|
|
PrintMoudleName("0", "Print" + Program.station + "_887"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName(); |
|
|
PrintMoudleName("1", "Print" + Program.station + "_893"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -935,10 +946,11 @@ namespace InjectionPC |
|
|
{ |
|
|
{ |
|
|
ManufacturerName = dtM.Rows[0]["ManufacturerName"].ToString(); |
|
|
ManufacturerName = dtM.Rows[0]["ManufacturerName"].ToString(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#region 判断有几个零件号
|
|
|
#region 判断有几个零件号
|
|
|
string mould = "0"; |
|
|
string mould = "0"; |
|
|
for (int j = 0; j < partNo.Length; j++) |
|
|
for (int j = 0; j < partNo.Length; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
{ |
|
|
{ |
|
|
#region 根据零件号查找存货代码
|
|
|
#region 根据零件号查找存货代码
|
|
|
mould = j.ToString(); |
|
|
mould = j.ToString(); |
|
@ -970,6 +982,12 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception("p988" + ex.Message); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IsSame == "1") |
|
|
if (IsSame == "1") |
|
|
{ |
|
|
{ |
|
@ -1004,7 +1022,7 @@ namespace InjectionPC |
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, NumItems + "_1017", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
@ -1043,7 +1061,7 @@ namespace InjectionPC |
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, NumItems + "_1056", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -1116,28 +1134,35 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == false) |
|
|
//if (SaveBarCode(md, Program.tableName, true, mould) == false)
|
|
|
{ |
|
|
//{
|
|
|
int a = 0; |
|
|
// int a = 0;
|
|
|
for (int l = 0; l < 5; l++) |
|
|
// for (int l = 0; l < 5; l++)
|
|
|
{ |
|
|
// {
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == true) |
|
|
// if (SaveBarCode(md, Program.tableName, true, mould) == true)
|
|
|
{ |
|
|
// {
|
|
|
break; |
|
|
// break;
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
a += 1; |
|
|
// a += 1;
|
|
|
Thread.Sleep(200); |
|
|
// Thread.Sleep(200);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
// 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; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 打印条码,判断是否打印单个条码
|
|
|
#region 打印条码,判断是否打印单个条码
|
|
@ -1152,12 +1177,12 @@ namespace InjectionPC |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
"wl.grf" |
|
|
"wl.grf" |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName(); //new
|
|
|
PrintMoudleName("0", "Print" + Program.station + "_1167"); //new
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName(); |
|
|
PrintMoudleName("1", "Print" + Program.station + "_1172"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//DataTable dt4 = pbll.SearchInfo(partNo[j].ToString().Trim(),
|
|
|
//DataTable dt4 = pbll.SearchInfo(partNo[j].ToString().Trim(),
|
|
@ -1194,7 +1219,6 @@ namespace InjectionPC |
|
|
if (IsSupply != "1") |
|
|
if (IsSupply != "1") |
|
|
{ |
|
|
{ |
|
|
#region 非直供件
|
|
|
#region 非直供件
|
|
|
|
|
|
|
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
if (ManufacturerName.Contains("蔚来")) |
|
|
if (ManufacturerName.Contains("蔚来")) |
|
@ -1219,8 +1243,7 @@ namespace InjectionPC |
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, NumItems + "_1235", ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
@ -1257,8 +1280,15 @@ namespace InjectionPC |
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, NumItems + "_1273", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception("p988" + ex.Message); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -1293,7 +1323,6 @@ namespace InjectionPC |
|
|
// Program.ProductDate.Substring(5, 2) +
|
|
|
// Program.ProductDate.Substring(5, 2) +
|
|
|
// Program.ProductDate.Substring(8, 2) + "#" + "001" + "#";
|
|
|
// Program.ProductDate.Substring(8, 2) + "#" + "001" + "#";
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
GetSupplyCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), QLevel, true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
GetSupplyCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), QLevel, true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
@ -1307,7 +1336,8 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#region 插入数据tb_barCode
|
|
|
#region 插入数据tb_barCode
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
md.ID = Guid.NewGuid().ToString(); |
|
|
md.ID = Guid.NewGuid().ToString(); |
|
|
md.StationID = dt.Rows[0]["StationID"].ToString(); |
|
|
md.StationID = dt.Rows[0]["StationID"].ToString(); |
|
|
md.OneBarCode = NewOneCode; |
|
|
md.OneBarCode = NewOneCode; |
|
@ -1331,27 +1361,40 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == false) |
|
|
//if (SaveBarCode(md, Program.tableName, true, mould) == false)
|
|
|
{ |
|
|
//{
|
|
|
int a = 0; |
|
|
// int a = 0;
|
|
|
for (int l = 0; l < 5; l++) |
|
|
// for (int l = 0; l < 5; l++)
|
|
|
{ |
|
|
// {
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == true) |
|
|
// if (SaveBarCode(md, Program.tableName, true, mould) == true)
|
|
|
{ |
|
|
// {
|
|
|
break; |
|
|
// break;
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
a += 1; |
|
|
// a += 1;
|
|
|
Thread.Sleep(200); |
|
|
// Thread.Sleep(200);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
// 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; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception("p1396" + ex.Message); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
@ -1368,7 +1411,7 @@ namespace InjectionPC |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
"wl.grf" |
|
|
"wl.grf" |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName();//new
|
|
|
PrintMoudleName("0", "Print" + Program.station + "_1385");//new
|
|
|
if (partNo[j].Contains("A2146982300") || |
|
|
if (partNo[j].Contains("A2146982300") || |
|
|
partNo[j].Contains("A2146982400")) |
|
|
partNo[j].Contains("A2146982400")) |
|
|
{ |
|
|
{ |
|
@ -1378,7 +1421,7 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(); |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName("1", "Print" + Program.station + "_1395"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//DataTable dt4 = pbll.SearchInfo(partNo[j].ToString().Trim(),
|
|
|
//DataTable dt4 = pbll.SearchInfo(partNo[j].ToString().Trim(),
|
|
@ -1590,7 +1633,7 @@ namespace InjectionPC |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould.ToString(), PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould.ToString(), PartName,"", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 插入数据tb_barCode
|
|
|
#region 插入数据tb_barCode
|
|
@ -1618,29 +1661,35 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == false) |
|
|
//if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == false)
|
|
|
{ |
|
|
//{
|
|
|
int a = 0; |
|
|
// int a = 0;
|
|
|
for (int l = 0; l < 5; l++) |
|
|
// for (int l = 0; l < 5; l++)
|
|
|
{ |
|
|
// {
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == true) |
|
|
// if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == true)
|
|
|
{ |
|
|
// {
|
|
|
break; |
|
|
// break;
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
a += 1; |
|
|
// a += 1;
|
|
|
Thread.Sleep(200); |
|
|
// Thread.Sleep(200);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
// 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; |
|
|
return; |
|
|
} |
|
|
} |
|
|
//return;
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 增加产量
|
|
|
#region 增加产量
|
|
@ -1818,7 +1867,7 @@ namespace InjectionPC |
|
|
// NewOneCode = stockNo[j].ToString().Trim() + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "0001";
|
|
|
// NewOneCode = stockNo[j].ToString().Trim() + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "0001";
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould.ToString(), PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(), true, mould.ToString(), PartName,"", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
#region 插入数据tb_barCode
|
|
|
#region 插入数据tb_barCode
|
|
|
|
|
|
|
|
@ -1845,29 +1894,35 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
//// if (brbll.Add_Info_New(md, Program.tableName) == false)
|
|
|
if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == false) |
|
|
//if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == false)
|
|
|
{ |
|
|
//{
|
|
|
int a = 0; |
|
|
// int a = 0;
|
|
|
for (int l = 0; l < 5; l++) |
|
|
// for (int l = 0; l < 5; l++)
|
|
|
{ |
|
|
// {
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
// //if (brbll.Add_Info_New(md, Program.tableName))
|
|
|
if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == true) |
|
|
// if (SaveBarCode(md, Program.tableName, true, same[j].ToString()) == true)
|
|
|
{ |
|
|
// {
|
|
|
break; |
|
|
// break;
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
a += 1; |
|
|
// a += 1;
|
|
|
Thread.Sleep(200); |
|
|
// Thread.Sleep(200);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
if (a >= 4) |
|
|
// 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; |
|
|
return; |
|
|
} |
|
|
} |
|
|
//return;
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 增加产量
|
|
|
#region 增加产量
|
|
@ -2450,7 +2505,7 @@ namespace InjectionPC |
|
|
int printCount = Convert.ToInt32(textBox2.Text.Trim()); |
|
|
int printCount = Convert.ToInt32(textBox2.Text.Trim()); |
|
|
for (int i = 1; i <= printCount; i++) |
|
|
for (int i = 1; i <= printCount; i++) |
|
|
{ |
|
|
{ |
|
|
GetSjBarCode(stockNo, partNo,false,"0", PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo, partNo,false,"0", PartName, "", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
string[] part = newcode.Split('.'); |
|
|
string[] part = newcode.Split('.'); |
|
|
|
|
|
|
|
@ -2480,9 +2535,17 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//if (bll.Add_Info_New(md, Program.tableName) == false)
|
|
|
////if (bll.Add_Info_New(md, Program.tableName) == false)
|
|
|
if (SaveBarCode(md, Program.tableName, false, "0",i== printCount) == 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) |
|
|
{ |
|
|
{ |
|
|
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2497,7 +2560,7 @@ namespace InjectionPC |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
? System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
"wl.grf" |
|
|
"wl.grf" |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
: System.AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName(); //new
|
|
|
PrintMoudleName("0", "Print" + Program.station + "_2514"); //new
|
|
|
if (partNo.Contains("A2146982300") || |
|
|
if (partNo.Contains("A2146982300") || |
|
|
partNo.Contains("A2146982400")) |
|
|
partNo.Contains("A2146982400")) |
|
|
{ |
|
|
{ |
|
@ -2749,9 +2812,17 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//if (bll.Add_Info_New(md, Program.tableName) == false)
|
|
|
////if (bll.Add_Info_New(md, Program.tableName) == false)
|
|
|
if (SaveBarCode(md, Program.tableName, false, "0") == 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; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2761,7 +2832,7 @@ namespace InjectionPC |
|
|
|
|
|
|
|
|
if (IsOne == "1") |
|
|
if (IsOne == "1") |
|
|
{ |
|
|
{ |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(); |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName("1", "Print" + Program.station + "_2778"); ; |
|
|
|
|
|
|
|
|
//DataTable dt4 = plbll.SearchInfo(partNo, stationID);
|
|
|
//DataTable dt4 = plbll.SearchInfo(partNo, stationID);
|
|
|
//if (dt4 != null && dt4.Rows.Count > 0)
|
|
|
//if (dt4 != null && dt4.Rows.Count > 0)
|
|
@ -2989,6 +3060,7 @@ namespace InjectionPC |
|
|
private void label22_Click(object sender, EventArgs e) |
|
|
private void label22_Click(object sender, EventArgs e) |
|
|
{ |
|
|
{ |
|
|
string code = "", filename = "", printName = "", ManufacturerName=""; |
|
|
string code = "", filename = "", printName = "", ManufacturerName=""; |
|
|
|
|
|
string IsSupply = "0"; |
|
|
BarCodeModel md = new BarCodeModel(); |
|
|
BarCodeModel md = new BarCodeModel(); |
|
|
BarCodeBLL bll = new BarCodeBLL(); |
|
|
BarCodeBLL bll = new BarCodeBLL(); |
|
|
ProductBLL pbll = new ProductBLL(); |
|
|
ProductBLL pbll = new ProductBLL(); |
|
@ -3053,8 +3125,10 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ManufacturerName = pdt.Rows[0]["ManufacturerName"].ToString().Trim(); |
|
|
ManufacturerName = pdt.Rows[0]["ManufacturerName"].ToString().Trim(); |
|
|
|
|
|
IsSupply = pdt.Rows[0]["IsSupply"].ToString(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -3082,7 +3156,7 @@ namespace InjectionPC |
|
|
? AppDomain.CurrentDomain.BaseDirectory + |
|
|
? AppDomain.CurrentDomain.BaseDirectory + |
|
|
"wl.grf" |
|
|
"wl.grf" |
|
|
: AppDomain.CurrentDomain.BaseDirectory + |
|
|
: AppDomain.CurrentDomain.BaseDirectory + |
|
|
PrintMoudleName(); //new
|
|
|
PrintMoudleName(IsSupply, "Print" + Program.station + "_3102"); //new
|
|
|
if (md.PartNo.Contains("A2146982300") || |
|
|
if (md.PartNo.Contains("A2146982300") || |
|
|
md.PartNo.Contains("A2146982400")) |
|
|
md.PartNo.Contains("A2146982400")) |
|
|
{ |
|
|
{ |
|
@ -3852,7 +3926,7 @@ namespace InjectionPC |
|
|
for (int k = 0; k < 2; k++) |
|
|
for (int k = 0; k < 2; k++) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(),true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(),true, mould, PartName, "", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
#region 插入数据tb_barCode
|
|
|
#region 插入数据tb_barCode
|
|
|
|
|
|
|
|
@ -3879,9 +3953,17 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName)==false)
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName)==false)
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == 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; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3902,7 +3984,7 @@ namespace InjectionPC |
|
|
{ |
|
|
{ |
|
|
if (IsSupply == "1") |
|
|
if (IsSupply == "1") |
|
|
{ |
|
|
{ |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(); |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(IsSupply, "Print" + Program.station + "_3922"); |
|
|
|
|
|
|
|
|
string reportName = ConfigurationManager.AppSettings[printName].ToString(); |
|
|
string reportName = ConfigurationManager.AppSettings[printName].ToString(); |
|
|
DataTable headTable = GetPrintHeadTable(partNo[j].ToString().Trim(), PartName, NewOneCode, newcode); |
|
|
DataTable headTable = GetPrintHeadTable(partNo[j].ToString().Trim(), PartName, NewOneCode, newcode); |
|
@ -3923,7 +4005,7 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(),true, mould, PartName, ref NewOneCode, ref newcode); |
|
|
GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(),true, mould, PartName, "", ref NewOneCode, ref newcode); |
|
|
|
|
|
|
|
|
#region 插入数据tb_barCode
|
|
|
#region 插入数据tb_barCode
|
|
|
|
|
|
|
|
@ -3950,12 +4032,19 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//if (brbll.Add_Info_New(md, Program.tableName)==false)
|
|
|
////if (brbll.Add_Info_New(md, Program.tableName)==false)
|
|
|
if (SaveBarCode(md, Program.tableName, true, mould) == 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; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 打印条码,判断是否打印单个条码
|
|
|
#region 打印条码,判断是否打印单个条码
|
|
@ -3973,7 +4062,7 @@ namespace InjectionPC |
|
|
{ |
|
|
{ |
|
|
if (IsSupply == "1") |
|
|
if (IsSupply == "1") |
|
|
{ |
|
|
{ |
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(); //new
|
|
|
filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(IsSupply, "Print" + Program.station + "_3993"); //new
|
|
|
|
|
|
|
|
|
string reportName = ConfigurationManager.AppSettings[printName].ToString(); |
|
|
string reportName = ConfigurationManager.AppSettings[printName].ToString(); |
|
|
DataTable headTable = GetPrintHeadTable(partNo[j].ToString().Trim(), PartName, NewOneCode, newcode); |
|
|
DataTable headTable = GetPrintHeadTable(partNo[j].ToString().Trim(), PartName, NewOneCode, newcode); |
|
@ -4199,7 +4288,7 @@ namespace InjectionPC |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
{ |
|
|
{ |
|
|
Label lbPackageCode = lbPackageCodeL; |
|
|
Label lbPackageCode = lbPackageCodeL; |
|
|
Label lbCurrentlQty = lbCurrentlQtyL; |
|
|
Label lbCurrentlQty = lbCurrentlQtyL; |
|
@ -4223,6 +4312,7 @@ namespace InjectionPC |
|
|
{ |
|
|
{ |
|
|
bcm.BoxNo = lbPackageCode.Text.Trim(); |
|
|
bcm.BoxNo = lbPackageCode.Text.Trim(); |
|
|
saveRst = _barCodeBLL.Add_Info_New(bcm, Program.tableName); |
|
|
saveRst = _barCodeBLL.Add_Info_New(bcm, Program.tableName); |
|
|
|
|
|
|
|
|
if (saveRst == true) |
|
|
if (saveRst == true) |
|
|
{ |
|
|
{ |
|
|
//更新箱单数量
|
|
|
//更新箱单数量
|
|
@ -4286,6 +4376,7 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
errorMsg = rst; |
|
|
MessageBox.Show(rst); |
|
|
MessageBox.Show(rst); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -4438,12 +4529,17 @@ namespace InjectionPC |
|
|
/// <param name="mould"></param>
|
|
|
/// <param name="mould"></param>
|
|
|
/// <param name="newOneCode"></param>
|
|
|
/// <param name="newOneCode"></param>
|
|
|
/// <param name="newCode"></param>
|
|
|
/// <param name="newCode"></param>
|
|
|
void GetSjBarCode(string stockNo,string partNo, bool autoPrint,string mould,string partName, ref string newOneCode,ref string newCode) |
|
|
void GetSjBarCode(string stockNo,string partNo, bool autoPrint,string mould,string partName,string printTest, ref string newOneCode,ref string newCode) |
|
|
{ |
|
|
{ |
|
|
CheckPackageCode(partNo, autoPrint, mould, partName); |
|
|
CheckPackageCode(partNo, autoPrint, mould, partName); |
|
|
|
|
|
|
|
|
string batch = GetBatch(autoPrint); |
|
|
string batch = GetBatch(autoPrint); |
|
|
GetBarCode(stockNo, batch, partNo, ref newOneCode, ref newCode); |
|
|
GetBarCode(stockNo, batch, partNo, ref newOneCode, ref newCode); |
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(printTest)) |
|
|
|
|
|
{ |
|
|
|
|
|
SaveLog3("BarCodePrint:"+ Program.station + ":" + printTest + "_" + newOneCode); |
|
|
|
|
|
} |
|
|
// newOneCode = _uniqueBll.GetSjBarCodeSerialNo(stockNo, batch);
|
|
|
// newOneCode = _uniqueBll.GetSjBarCodeSerialNo(stockNo, batch);
|
|
|
//newCode = partNo + "." + batch + "." + newOneCode.Substring(newOneCode.Length - 4, 4);
|
|
|
//newCode = partNo + "." + batch + "." + newOneCode.Substring(newOneCode.Length - 4, 4);
|
|
|
} |
|
|
} |
|
@ -4603,7 +4699,18 @@ namespace InjectionPC |
|
|
int.TryParse(txt, out i); |
|
|
int.TryParse(txt, out i); |
|
|
if(i == 0) |
|
|
if(i == 0) |
|
|
{ |
|
|
{ |
|
|
throw new Exception("未选择装箱规格,请选择. "); |
|
|
List<string> list = comBoxSizeL.DataSource as List<string>; |
|
|
|
|
|
if (list.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
lbNeedQtyL.Text = list[0]; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
lbNeedQtyL.Text = "30"; |
|
|
|
|
|
MessageBox.Show("当前生产计划[未选择装箱规格],默认设置为30, 如果与实际不符合,请尽快作出选择. "); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
//throw new Exception("未选择装箱规格,请选择. ");
|
|
|
//MessageBox.Show("未选择装箱规格,请选择. ");
|
|
|
//MessageBox.Show("未选择装箱规格,请选择. ");
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -4766,7 +4873,7 @@ namespace InjectionPC |
|
|
Program.ProductDate.Substring(8, 2); |
|
|
Program.ProductDate.Substring(8, 2); |
|
|
if (bbb == true) |
|
|
if (bbb == true) |
|
|
{ //自动
|
|
|
{ //自动
|
|
|
opcGroup1_DataChange(1, 1, ref a, ref b, ref c, ref d); |
|
|
opcGroup1_DataChange(1, 2, ref a, ref b, ref c, ref d); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ //手动
|
|
|
{ //手动
|
|
@ -4900,6 +5007,11 @@ namespace InjectionPC |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
this.FormClosed += (arg1, arg2) => { |
|
|
this.FormClosed += (arg1, arg2) => { |
|
|
|
|
|
|
|
|
|
|
|
opcGroup1.DataChange -= new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange); |
|
|
|
|
|
opcServer.OPCGroups.RemoveAll(); |
|
|
|
|
|
opcServer.Disconnect(); |
|
|
|
|
|
serialPort1.Close(); |
|
|
FrmMain2411 frm = new FrmMain2411(); |
|
|
FrmMain2411 frm = new FrmMain2411(); |
|
|
frm.Show(); |
|
|
frm.Show(); |
|
|
}; |
|
|
}; |
|
@ -4950,8 +5062,13 @@ namespace InjectionPC |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
string PrintMoudleName() |
|
|
string PrintMoudleName(string isSupply = "0",string invokeInfo ="") |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (!string.IsNullOrEmpty(invokeInfo)) |
|
|
|
|
|
{ |
|
|
|
|
|
SaveLog2(invokeInfo); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if("IM05,IM08,IM10".Contains(Program.station)) //二维小条码
|
|
|
if("IM05,IM08,IM10".Contains(Program.station)) //二维小条码
|
|
|
{ |
|
|
{ |
|
|
return "单个条码2.grf"; |
|
|
return "单个条码2.grf"; |
|
@ -4967,7 +5084,15 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
else if ("IM13,IM14".Contains(Program.station)) //直供条码
|
|
|
else if ("IM13,IM14".Contains(Program.station)) //直供条码
|
|
|
{ |
|
|
{ |
|
|
return "单个条码1.grf"; |
|
|
if(isSupply == "0") //13,14机台,直供件打二维码 非直供件打一维码
|
|
|
|
|
|
{ |
|
|
|
|
|
return "单个条码.grf"; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
return "单个条码2.grf"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -5000,6 +5125,37 @@ namespace InjectionPC |
|
|
headTable.Rows.Add(row); |
|
|
headTable.Rows.Add(row); |
|
|
return headTable; |
|
|
return headTable; |
|
|
} |
|
|
} |
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 补打左侧上一箱单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
private void btn_lastBoxPrintL_Click(object sender, EventArgs e) |
|
|
|
|
|
{ |
|
|
|
|
|
InjectionBoxBLL boxbll = new InjectionBoxBLL(); |
|
|
|
|
|
DataRow dr = boxbll.SearchNewPrintedBoxInfo(Program.station, "0"); |
|
|
|
|
|
if(dr == null) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBox.Show("没找到上一个箱码"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
PrintBoxCode(dr, int.Parse(dr["StandardQty"].ToString()), "0"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void btn_lastBoxPrintR_Click(object sender, EventArgs e) |
|
|
|
|
|
{ |
|
|
|
|
|
InjectionBoxBLL boxbll = new InjectionBoxBLL(); |
|
|
|
|
|
DataRow dr = boxbll.SearchNewPrintedBoxInfo(Program.station, "1"); |
|
|
|
|
|
if (dr == null) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBox.Show("没找到上一个箱码"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
PrintBoxCode(dr, int.Parse(dr["StandardQty"].ToString()), "1"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
List<string> GetProductBoxSize(string productCode,ref string currentSize) |
|
|
List<string> GetProductBoxSize(string productCode,ref string currentSize) |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
@ -5008,14 +5164,14 @@ namespace InjectionPC |
|
|
DataTable dt = productBll.SearchInfoByPartNo(productCode); |
|
|
DataTable dt = productBll.SearchInfoByPartNo(productCode); |
|
|
if (dt.Rows.Count == 0) |
|
|
if (dt.Rows.Count == 0) |
|
|
{ |
|
|
{ |
|
|
currentSize = "24"; |
|
|
currentSize = "30"; |
|
|
MessageBox.Show("零件号{productCode}未设置标包,默认为24,请及时核对后进行配置."); |
|
|
MessageBox.Show($"零件号{productCode}未设置标包,默认为30,请及时核对后进行配置."); |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
currentSize = dt.Rows[0]["PackCount"].ToString(); |
|
|
currentSize = dt.Rows[0]["PackCount"].ToString(); |
|
|
string sizeStr = dt.Rows[0]["PackCountSize"].ToString(); |
|
|
string sizeStr = dt.Rows[0]["PackCountSize"].ToString(); |
|
|
List<string> list = new List<string>(); |
|
|
List<string> list = new List<string>(); |
|
|
if (string.IsNullOrEmpty(sizeStr)) |
|
|
if (string.IsNullOrEmpty(sizeStr) || sizeStr =="0") |
|
|
{ |
|
|
{ |
|
|
list.Add(currentSize); |
|
|
list.Add(currentSize); |
|
|
return list; |
|
|
return list; |
|
@ -5040,10 +5196,76 @@ namespace InjectionPC |
|
|
catch(Exception ex) |
|
|
catch(Exception ex) |
|
|
{ |
|
|
{ |
|
|
currentSize = "24"; |
|
|
currentSize = "24"; |
|
|
|
|
|
List<string> list = new List<string>(); |
|
|
|
|
|
list.Add(currentSize); |
|
|
MessageBox.Show("零件号{productCode}未设置标包,默认为24,请及时核对后进行配置."); |
|
|
MessageBox.Show("零件号{productCode}未设置标包,默认为24,请及时核对后进行配置."); |
|
|
return null; |
|
|
return list; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
void SaveLog(string txt) |
|
|
|
|
|
{ |
|
|
|
|
|
//try
|
|
|
|
|
|
//{
|
|
|
|
|
|
// LogSysBLL.AddInfo(txt, MethodBase.GetCurrentMethod());
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// LogHelper.WriteLog("SaveLog:" + ex.Message);
|
|
|
|
|
|
//}
|
|
|
|
|
|
} |
|
|
|
|
|
void SaveLog2(string txt) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
LogSysBLL.AddInfo(txt, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
LogHelper.WriteLog("SaveLog:" + ex.Message); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
void SaveLog3(string txt) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
LogSysBLL.AddInfo(txt, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
LogHelper.WriteLog("SaveLog:" + ex.Message); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool SaveInfo(BarCodeModel md, bool isAutoPrint, string mould, bool handPrint, ref string errMsg) |
|
|
|
|
|
{ |
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (a >= 2) |
|
|
|
|
|
{ |
|
|
|
|
|
SaveLog3(Program.station + "保存3次失败,条码" + md.OneBarCode); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|