|
|
@ -567,8 +567,9 @@ namespace InjectionPC |
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
|
return; |
|
|
|
LogErrBLL.AddInfo($"自动打印[{partNo[j].ToString()}],条码" + md.OneBarCode + "报错:"+ errMsg, MethodBase.GetCurrentMethod()); |
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -673,8 +674,10 @@ namespace InjectionPC |
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
|
return; |
|
|
|
LogErrBLL.AddInfo($"自动打印[{partNo[j].ToString()}],条码" + md.OneBarCode + "报错:" + errMsg, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
@ -889,8 +892,10 @@ namespace InjectionPC |
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
|
return; |
|
|
|
LogErrBLL.AddInfo($"自动打印[{partNo[j].ToString()}],条码" + md.OneBarCode + "报错:" + errMsg, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
@ -1026,8 +1031,10 @@ namespace InjectionPC |
|
|
|
bool saveRst = SaveInfo(md, true, mould, false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
|
return; |
|
|
|
LogErrBLL.AddInfo($"自动打印[{partNo[j].ToString()}],条码" + md.OneBarCode + "报错:" + errMsg, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
@ -1271,8 +1278,10 @@ namespace InjectionPC |
|
|
|
bool saveRst = SaveInfo(md, true, same[j].ToString(), false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
|
return; |
|
|
|
LogErrBLL.AddInfo($"自动打印[{partNo[j].ToString()}],条码" + md.OneBarCode + "报错:" + errMsg, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
@ -1373,8 +1382,10 @@ namespace InjectionPC |
|
|
|
bool saveRst = SaveInfo(md, true, same[j].ToString(), false, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
|
return; |
|
|
|
LogErrBLL.AddInfo($"自动打印[{partNo[j].ToString()}],条码" + md.OneBarCode + "报错:" + errMsg, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
@ -1882,8 +1893,10 @@ namespace InjectionPC |
|
|
|
bool saveRst = SaveInfo(md, false, "0", i == printCount, ref errMsg); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg); |
|
|
|
return; |
|
|
|
LogErrBLL.AddInfo($"手工打印[{partNo}],条码" + md.OneBarCode + "报错:" + errMsg, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
@ -1964,18 +1977,14 @@ namespace InjectionPC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
////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; |
|
|
|
LogErrBLL.AddInfo($"手工打印[{partNo}],条码" + md.OneBarCode + "报错:" + errMsg, MethodBase.GetCurrentMethod()); |
|
|
|
|
|
|
|
//MessageBox.Show("条码" + md.OneBarCode + "存储时发生错误,原因:" + errMsg);
|
|
|
|
//return;
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
@ -2928,283 +2937,7 @@ namespace InjectionPC |
|
|
|
fr.Show(); |
|
|
|
} |
|
|
|
|
|
|
|
//private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
|
|
|
//{
|
|
|
|
// try
|
|
|
|
// {
|
|
|
|
// base.Invoke(new EventHandler(this.Scan));
|
|
|
|
// }
|
|
|
|
// catch (Exception ex)
|
|
|
|
// {
|
|
|
|
// LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
|
|
// }
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//private void Scan(object sender, EventArgs e)
|
|
|
|
//{
|
|
|
|
// string _code_meca = "",printBoxName="";
|
|
|
|
// try
|
|
|
|
// {
|
|
|
|
// Thread.Sleep(1500);
|
|
|
|
// char[] buffer = new char[serialPort1.BytesToRead];
|
|
|
|
// serialPort1.Read(buffer, 0, serialPort1.BytesToRead);
|
|
|
|
// for (int i = 0; i < buffer.Length; i++)
|
|
|
|
// {
|
|
|
|
// _code_meca = _code_meca + buffer[i];
|
|
|
|
// }
|
|
|
|
|
|
|
|
// GetClass();
|
|
|
|
|
|
|
|
// string aa = _code_meca;
|
|
|
|
|
|
|
|
// var result1 = System.Text.RegularExpressions.Regex.Replace(aa, @"\s*\n\s*", ",");
|
|
|
|
// result1 = System.Text.RegularExpressions.Regex.Replace(aa, @"\s*\f\s*", ",");
|
|
|
|
// result1 = System.Text.RegularExpressions.Regex.Replace(aa, @"\s*\r\s*", ",");
|
|
|
|
// result1 = result1.Remove(result1.LastIndexOf(","), 1);
|
|
|
|
// result1 = result1.Remove(result1.LastIndexOf("g"), 1);
|
|
|
|
// int idxStart = result1.LastIndexOf(" ");
|
|
|
|
// string value = result1.Substring(idxStart, result1.Length - idxStart).Trim();
|
|
|
|
// string[] b = value.Split('.');
|
|
|
|
// string c = b[0];
|
|
|
|
// string d = b[1];
|
|
|
|
// int chengzhong = Convert.ToInt32(c);
|
|
|
|
// int chengzhong1 = Convert.ToInt32(d);
|
|
|
|
// if (chengzhong1 >= 5)
|
|
|
|
// {
|
|
|
|
// chengzhong = chengzhong + 1; //重量
|
|
|
|
// }
|
|
|
|
|
|
|
|
// InjectionPlanBLL bll = new InjectionPlanBLL();
|
|
|
|
// BarCodeBLL brbll = new BarCodeBLL();
|
|
|
|
// BarCodeModel md = new BarCodeModel();
|
|
|
|
// ProductBLL productBll = new ProductBLL();
|
|
|
|
// PlasticBLL pbll = _plasticBLL;
|
|
|
|
// InjectionBoxBLL boxbll = new InjectionBoxBLL();
|
|
|
|
// InjectionBoxModel boxmd = new InjectionBoxModel();
|
|
|
|
// DataTable dt2 = null;
|
|
|
|
// string code = "", OneCode = "";
|
|
|
|
// string newcode = "", newcode1 = "", NewOneCode = "", NewOneCode1 = "";
|
|
|
|
// string IsPack = "", IsOne = "", QLevel = "", IsPaint = "", PartName = "",IsSupply="";
|
|
|
|
// string filename = "", printName = "";
|
|
|
|
// int MaxCount = 0, CurrentCount = 0;
|
|
|
|
|
|
|
|
// #region 查找当前计划
|
|
|
|
|
|
|
|
// DataTable dt = bll.SearchInfoByName(Program.station);
|
|
|
|
// if (dt != null && dt.Rows.Count > 0)
|
|
|
|
// {
|
|
|
|
// planID = dt.Rows[0]["InjectionPlanID"].ToString();
|
|
|
|
// string[] partNo = dt.Rows[0]["PartNo"].ToString().Split(',');
|
|
|
|
// string[] stockNo = new string [partNo.Length];
|
|
|
|
// //string[] stockNo = dt.Rows[0]["StockNo"].ToString().Split(',');
|
|
|
|
// string ProductNature = dt.Rows[0]["ProductNature"].ToString();
|
|
|
|
// int IsSame = 0;
|
|
|
|
|
|
|
|
// #region 判断有几个零件号
|
|
|
|
// string mould = "0";
|
|
|
|
// for (int j = 0; j < partNo.Length; j++)
|
|
|
|
// {
|
|
|
|
// #region 根据零件号查找存货代码
|
|
|
|
|
|
|
|
// DataTable sdt = productBll.SearchInfoByPartNo(partNo[j].ToString().Trim());
|
|
|
|
// if (sdt != null && sdt.Rows.Count > 0)
|
|
|
|
// {
|
|
|
|
// stockNo[j] = sdt.Rows[0]["StockNo"].ToString();
|
|
|
|
// IsSame=Convert.ToInt32(sdt.Rows[0]["IsSame"].ToString());
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// stockNo[j] = "";
|
|
|
|
// IsSame = 0;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
// DataTable dt3 = productBll.SearchInfoByPartNo(partNo[j].ToString().Trim());
|
|
|
|
// if (dt3 != null && dt3.Rows.Count > 0)
|
|
|
|
// {
|
|
|
|
// QLevel = dt3.Rows[0]["QLevel"].ToString();
|
|
|
|
// IsOne = dt3.Rows[0]["IsPrintOneTag"].ToString();
|
|
|
|
// IsPack = dt3.Rows[0]["IsPrintPackList"].ToString();
|
|
|
|
// IsPaint = dt3.Rows[0]["IsPlating"].ToString();
|
|
|
|
// PartName = dt3.Rows[0]["ProductName"].ToString();
|
|
|
|
// MaxCount = Convert.ToInt32(dt3.Rows[0]["PackCount"].ToString());
|
|
|
|
// IsSupply = dt3.Rows[0]["IsSupply"].ToString();
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (IsSame == 1)
|
|
|
|
// {
|
|
|
|
// for (int k = 0; k < 2; k++)
|
|
|
|
// {
|
|
|
|
|
|
|
|
// GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(),true, mould, PartName, "", ref NewOneCode, ref newcode);
|
|
|
|
|
|
|
|
// #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)
|
|
|
|
// {
|
|
|
|
// 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)
|
|
|
|
// //{
|
|
|
|
// // 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 打印条码,判断是否打印单个条码
|
|
|
|
|
|
|
|
// DataTable dt4 = pbll.SearchInfo(partNo[j].ToString().Trim(),
|
|
|
|
// dt.Rows[0]["StationID"].ToString());
|
|
|
|
// if (dt4 != null && dt4.Rows.Count > 0)
|
|
|
|
// {
|
|
|
|
// printName = "Printer" + dt4.Rows[0]["PrinterNo"].ToString();
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #region 打印单个标签
|
|
|
|
|
|
|
|
// if (IsOne == "1")
|
|
|
|
// {
|
|
|
|
// if (IsSupply == "1")
|
|
|
|
// {
|
|
|
|
// filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(IsSupply, "Print" + Program.station + "_3922");
|
|
|
|
|
|
|
|
// string reportName = ConfigurationManager.AppSettings[printName].ToString();
|
|
|
|
// DataTable headTable = GetPrintHeadTable(partNo[j].ToString().Trim(), PartName, NewOneCode, newcode);
|
|
|
|
|
|
|
|
// ReportHelper rp = new ReportHelper(filename, headTable, null,
|
|
|
|
// (int) GRPaperOrientation.grpoDefault, 1, reportName);
|
|
|
|
|
|
|
|
// rp.Report.Print(false);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// GetSjBarCode(stockNo[j].ToString().Trim(), partNo[j].ToString().Trim(),true, mould, PartName, "", ref NewOneCode, ref newcode);
|
|
|
|
|
|
|
|
// #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)
|
|
|
|
// {
|
|
|
|
// 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)
|
|
|
|
// //{
|
|
|
|
// // 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 打印条码,判断是否打印单个条码
|
|
|
|
|
|
|
|
// DataTable dt4 = pbll.SearchInfo(partNo[j].ToString().Trim(),
|
|
|
|
// dt.Rows[0]["StationID"].ToString());
|
|
|
|
// if (dt4 != null && dt4.Rows.Count > 0)
|
|
|
|
// {
|
|
|
|
// printName = "Printer" + dt4.Rows[0]["PrinterNo"].ToString();
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #region 打印单个标签
|
|
|
|
|
|
|
|
// if (IsOne == "1")
|
|
|
|
// {
|
|
|
|
// if (IsSupply == "1")
|
|
|
|
// {
|
|
|
|
// filename = System.AppDomain.CurrentDomain.BaseDirectory + PrintMoudleName(IsSupply, "Print" + Program.station + "_3993"); //new
|
|
|
|
|
|
|
|
// string reportName = ConfigurationManager.AppSettings[printName].ToString();
|
|
|
|
// DataTable headTable = GetPrintHeadTable(partNo[j].ToString().Trim(), PartName, NewOneCode, newcode);
|
|
|
|
|
|
|
|
// LogHelper.WriteLog(printName + ";" + reportName + ";" + filename);
|
|
|
|
// ReportHelper rp = new ReportHelper(filename, headTable, null,
|
|
|
|
// (int) GRPaperOrientation.grpoDefault, 1, reportName);
|
|
|
|
|
|
|
|
// rp.Report.Print(false);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
// }
|
|
|
|
// initBarCode();
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
// }
|
|
|
|
// catch (Exception ex)
|
|
|
|
// {
|
|
|
|
// LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
private void timer2_Tick(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
Program.ProductDate = _barCodeBLL.GetServiceTime().ToString(); |
|
|
@ -3406,83 +3139,195 @@ namespace InjectionPC |
|
|
|
Label lbPackageCode = lbPackageCodeL; |
|
|
|
Label lbCurrentlQty = lbCurrentlQtyL; |
|
|
|
Label lbNeedQty = lbNeedQtyL; |
|
|
|
//BarCodeModel lastFailedModel = null;
|
|
|
|
if (mould == _leftType) |
|
|
|
{ |
|
|
|
lbPackageCode = lbPackageCodeL; |
|
|
|
lbCurrentlQty = lbCurrentlQtyL; |
|
|
|
lbNeedQty = lbNeedQtyL; |
|
|
|
//lastFailedModel = _lastFailedModelL;
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
lbPackageCode = lbPackageCodeR; |
|
|
|
lbCurrentlQty = lbCurrentlQtyR; |
|
|
|
lbNeedQty = lbNeedQtyR; |
|
|
|
//lastFailedModel = _lastFailedModelR;
|
|
|
|
} |
|
|
|
|
|
|
|
bool saveRst = false; |
|
|
|
bool saveRst = true; |
|
|
|
//自动模式 或者手动模式选中绑定箱码
|
|
|
|
if (isAutoPrint == true || (isAutoPrint==false && cboxHandBox.Checked ==true)) |
|
|
|
{ |
|
|
|
bcm.BoxNo = lbPackageCode.Text.Trim(); |
|
|
|
saveRst = _barCodeBLL.Add_Info_New(bcm, Program.tableName); |
|
|
|
|
|
|
|
if (saveRst == true) |
|
|
|
bool isSuccess = false; |
|
|
|
DataTable dt = null; |
|
|
|
int realCount = 0; |
|
|
|
int sizeCount = 0; |
|
|
|
LocalDBService local = new LocalDBService(SqlHelper.GetConnSting()); |
|
|
|
try |
|
|
|
{ |
|
|
|
local.BeginTrans(); |
|
|
|
_barCodeBLL.Add_Info_New(local, bcm, Program.tableName, "1"); |
|
|
|
|
|
|
|
//更新箱单数量
|
|
|
|
//查询箱单数量 是否等于标包数量 等于的话清空lb显示 小于,数量值赋值给lb显示
|
|
|
|
if (_injectionBoxBLL.UpdateBoxCount(bcm.BoxNo,1)) |
|
|
|
if (_injectionBoxBLL.UpdateBoxCount(local, bcm.BoxNo, 1)) |
|
|
|
{ |
|
|
|
DataTable dt = _injectionBoxBLL.SearchBox(bcm.BoxNo); |
|
|
|
if (dt.Rows.Count == 0) |
|
|
|
dt = _injectionBoxBLL.SearchBox(local, bcm.BoxNo); |
|
|
|
if (dt.Rows.Count > 0) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
string realCountStr = dt.Rows[0]["BoxCount"].ToString(); |
|
|
|
string sizeCountStr = lbNeedQty.Text.Trim(); |
|
|
|
int realCount = 0; |
|
|
|
int sizeCount = 0; |
|
|
|
int.TryParse(realCountStr, out realCount); |
|
|
|
int.TryParse(sizeCountStr, out sizeCount); |
|
|
|
|
|
|
|
// if(Program.station == "IM18")
|
|
|
|
// {
|
|
|
|
SaveLog3($"{Program.station}装箱测试:realCount=[{realCount}],sizeCount=[{sizeCount}],isAutoPrint=[{isAutoPrint}],handPrint=[{handPrint}]"); |
|
|
|
//}
|
|
|
|
|
|
|
|
if ((realCount != 0 && realCount == sizeCount) || (isAutoPrint == false && handPrint==true)) |
|
|
|
{ |
|
|
|
lbPackageCode.Text = ""; |
|
|
|
lbCurrentlQty.Text = "0"; |
|
|
|
string realCountStr = dt.Rows[0]["BoxCount"].ToString(); |
|
|
|
string sizeCountStr = lbNeedQty.Text.Trim(); |
|
|
|
|
|
|
|
int.TryParse(realCountStr, out realCount); |
|
|
|
int.TryParse(sizeCountStr, out sizeCount); |
|
|
|
|
|
|
|
string rst = _wmsBll.SaveInterface(dt.Rows[0]["BoxNo"].ToString(), _lastBoxNoL, _lastBoxNoR, MESClassLibrary.Enum.WmsInterfaceEnum.塑件箱码报工, Program.station); |
|
|
|
if (string.IsNullOrEmpty(rst)) |
|
|
|
if ((realCount != 0 && realCount == sizeCount) || (isAutoPrint == false && handPrint == true)) |
|
|
|
{ |
|
|
|
_lastBoxNoL = lbPackageCodeL.Text; |
|
|
|
_lastBoxNoR = lbPackageCodeR.Text; |
|
|
|
PrintBoxCode(dt.Rows[0], realCount, mould); |
|
|
|
lbPackageCode.Text = ""; |
|
|
|
lbCurrentlQty.Text = "0"; |
|
|
|
_wmsBll.SaveInterface(local, bcm, "", Program.station); |
|
|
|
isSuccess = true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
errorMsg = "插入接口表时异常-" +rst; |
|
|
|
MessageBox.Show(rst); |
|
|
|
lbCurrentlQty.Text = realCountStr; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
lbCurrentlQty.Text = realCountStr; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//throw new Exception("资源被占用,死锁了测试");
|
|
|
|
|
|
|
|
local.Commit(); |
|
|
|
} |
|
|
|
else |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
errorMsg = "插入表" + Program.tableName + "时发生异常"; |
|
|
|
if (local != null) |
|
|
|
{ |
|
|
|
local.Rollback(); |
|
|
|
} |
|
|
|
errorMsg = ex.Message; |
|
|
|
//lastFailedModel = bcm;
|
|
|
|
if (mould == _leftType) { |
|
|
|
_lastFailedModelL = bcm; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_lastFailedModelR = bcm; |
|
|
|
} |
|
|
|
saveRst = false; |
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
if (local != null) |
|
|
|
{ |
|
|
|
local.EndTrans(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//保存后打印箱单
|
|
|
|
if (isSuccess) |
|
|
|
{ |
|
|
|
_lastBoxNoL = lbPackageCodeL.Text; |
|
|
|
_lastBoxNoR = lbPackageCodeR.Text; |
|
|
|
|
|
|
|
//打印箱码
|
|
|
|
PrintBoxCode(dt.Rows[0], realCount, mould); |
|
|
|
// _lastBoxNo = lbPackageCodeL.Text;
|
|
|
|
lbPackageCodeL.Text = ""; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//saveRst = _barCodeBLL.Add_Info_New(bcm, Program.tableName);
|
|
|
|
|
|
|
|
//if (saveRst == true)
|
|
|
|
//{
|
|
|
|
// //更新箱单数量
|
|
|
|
// //查询箱单数量 是否等于标包数量 等于的话清空lb显示 小于,数量值赋值给lb显示
|
|
|
|
// if (_injectionBoxBLL.UpdateBoxCount(bcm.BoxNo, 1))
|
|
|
|
// {
|
|
|
|
// DataTable dt = _injectionBoxBLL.SearchBox(bcm.BoxNo);
|
|
|
|
// if (dt.Rows.Count == 0)
|
|
|
|
// {
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// string realCountStr = dt.Rows[0]["BoxCount"].ToString();
|
|
|
|
// string sizeCountStr = lbNeedQty.Text.Trim();
|
|
|
|
// int realCount = 0;
|
|
|
|
// int sizeCount = 0;
|
|
|
|
// int.TryParse(realCountStr, out realCount);
|
|
|
|
// int.TryParse(sizeCountStr, out sizeCount);
|
|
|
|
|
|
|
|
// // if(Program.station == "IM18")
|
|
|
|
// // {
|
|
|
|
// SaveLog3($"{Program.station}装箱测试:realCount=[{realCount}],sizeCount=[{sizeCount}],isAutoPrint=[{isAutoPrint}],handPrint=[{handPrint}]");
|
|
|
|
// //}
|
|
|
|
|
|
|
|
// if ((realCount != 0 && realCount == sizeCount) || (isAutoPrint == false && handPrint == true))
|
|
|
|
// {
|
|
|
|
// lbPackageCode.Text = "";
|
|
|
|
// lbCurrentlQty.Text = "0";
|
|
|
|
|
|
|
|
// string rst = _wmsBll.SaveInterface(dt.Rows[0]["BoxNo"].ToString(), _lastBoxNoL, _lastBoxNoR, MESClassLibrary.Enum.WmsInterfaceEnum.塑件箱码报工, Program.station);
|
|
|
|
// if (string.IsNullOrEmpty(rst))
|
|
|
|
// {
|
|
|
|
// _lastBoxNoL = lbPackageCodeL.Text;
|
|
|
|
// _lastBoxNoR = lbPackageCodeR.Text;
|
|
|
|
// PrintBoxCode(dt.Rows[0], realCount, mould);
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// errorMsg = "插入接口表时异常-" + rst;
|
|
|
|
// MessageBox.Show(rst);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// lbCurrentlQty.Text = realCountStr;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// errorMsg = "插入表" + Program.tableName + "时发生异常";
|
|
|
|
// saveRst = false;
|
|
|
|
//}
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//手动打印, 关闭打印箱码, 直接存条码记录.不处理其他
|
|
|
|
saveRst = _barCodeBLL.Add_Info_New(bcm, Program.tableName); |
|
|
|
try |
|
|
|
{ |
|
|
|
//手动打印, 关闭打印箱码, 直接存条码记录.不处理其他
|
|
|
|
saveRst = _barCodeBLL.Add_Info_New(bcm, Program.tableName); |
|
|
|
if (saveRst == false) |
|
|
|
{ |
|
|
|
//lastFailedModel = bcm;
|
|
|
|
if (mould == _leftType) |
|
|
|
{ |
|
|
|
_lastFailedModelL = bcm; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_lastFailedModelR = bcm; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch(Exception ex) |
|
|
|
{ |
|
|
|
errorMsg = ex.Message; |
|
|
|
//lastFailedModel = bcm;
|
|
|
|
if (mould == _leftType) |
|
|
|
{ |
|
|
|
_lastFailedModelL = bcm; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_lastFailedModelR = bcm; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return saveRst; |
|
|
@ -3991,7 +3836,7 @@ namespace InjectionPC |
|
|
|
timer3.Enabled = false; |
|
|
|
//调用测试
|
|
|
|
Array a = null; |
|
|
|
Array b = null; |
|
|
|
Array b = new string[] { "1", "2", "3", "4", "5" }; |
|
|
|
Array c = null; |
|
|
|
Array d = null; |
|
|
|
status = true; |
|
|
@ -4518,32 +4363,46 @@ namespace InjectionPC |
|
|
|
LogHelper.WriteLog("SaveLog:" + ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private BarCodeModel _lastFailedModelL = null; |
|
|
|
private BarCodeModel _lastFailedModelR = null; |
|
|
|
bool SaveInfo(BarCodeModel md, bool isAutoPrint, string mould, bool handPrint, ref string errMsg) |
|
|
|
{ |
|
|
|
if (SaveBarCode(md, Program.tableName, isAutoPrint, mould, ref errMsg, handPrint) == false) |
|
|
|
if (_lastFailedModelL != null && mould == "0") |
|
|
|
{ |
|
|
|
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; |
|
|
|
} |
|
|
|
SaveBarCode(_lastFailedModelL, Program.tableName, isAutoPrint, mould, ref errMsg, handPrint); |
|
|
|
_lastFailedModelL = null; |
|
|
|
} |
|
|
|
if (_lastFailedModelR != null && !string.IsNullOrEmpty(mould) && mould != "0") |
|
|
|
{ |
|
|
|
SaveBarCode(_lastFailedModelR, Program.tableName, isAutoPrint, mould, ref errMsg, handPrint); |
|
|
|
_lastFailedModelR = null; |
|
|
|
} |
|
|
|
|
|
|
|
a += 1; |
|
|
|
//Thread.Sleep(200);
|
|
|
|
Thread.Sleep(200); |
|
|
|
} |
|
|
|
bool rst = SaveBarCode(md, Program.tableName, isAutoPrint, mould, ref errMsg, handPrint); |
|
|
|
|
|
|
|
if (a >= 2) |
|
|
|
{ |
|
|
|
SaveLog3(Program.station + "保存3次失败,条码" + md.OneBarCode); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
//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 rst; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|