|
|
@ -30,6 +30,7 @@ using gregn6Lib; |
|
|
|
using System.Data; |
|
|
|
using QMAPP.FJC.Entity.BZD; |
|
|
|
using QMAPP.BoraUpgrade.BLL; |
|
|
|
using System.Text; |
|
|
|
|
|
|
|
namespace QMAPP.WinForm.Forms.Operation |
|
|
|
{ |
|
|
@ -1913,6 +1914,8 @@ namespace QMAPP.WinForm.Forms.Operation |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
WriteFile("ZSN, Print052QRCODE 开始", @"D:\MES\Log"); |
|
|
|
|
|
|
|
if (!cBoxVANstr || "IP_ASSEMBLING,GWASSEMBLE_VW371PA".Contains(_operationServiceParam.machineInfo.WORKLOC_CODE)) |
|
|
|
cBoxVAN.Visible = false; |
|
|
|
|
|
|
@ -1927,20 +1930,24 @@ namespace QMAPP.WinForm.Forms.Operation |
|
|
|
//数据填充
|
|
|
|
Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReadFetchRecordBox); |
|
|
|
|
|
|
|
WriteFile("ZSN, Print052QRCODE reportPath:" + reportPath, @"D:\MES\Log"); |
|
|
|
|
|
|
|
Report.LoadFromFile(reportPath); |
|
|
|
|
|
|
|
//rep.Printer.PrinterName = "默认打印机";//调取不同的打印机
|
|
|
|
|
|
|
|
Report.Print(false); |
|
|
|
|
|
|
|
WriteFile("ZSN, Print052QRCODE 结束", @"D:\MES\Log"); |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
|
|
|
|
WriteFile("ZSN, Print052QRCODE catch " + ex.Message, @"D:\MES\Log"); |
|
|
|
throw; |
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
|
|
|
|
WriteFile("ZSN, Print052QRCODE finally", @"D:\MES\Log"); |
|
|
|
Report = new GridppReport(); |
|
|
|
} |
|
|
|
|
|
|
@ -1964,9 +1971,15 @@ namespace QMAPP.WinForm.Forms.Operation |
|
|
|
private BZD getBZDCode() |
|
|
|
{ |
|
|
|
BZD bzd = new BZD(); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
List<string> list = new List<string>(); |
|
|
|
List<string> paramList = new List<string>(); |
|
|
|
|
|
|
|
WriteFile("ZSN,planMATERIAL_CODE =1= " + planMATERIAL_CODE, @"D:\MES\Log"); |
|
|
|
WriteFile("ZSN,processMainCode =1= " + processMainCode, @"D:\MES\Log"); |
|
|
|
|
|
|
|
//张松男 20210207 总成工位打印052 缺少物料号 重新查找填充 start
|
|
|
|
if (string.IsNullOrEmpty(planMATERIAL_CODE)) |
|
|
|
{ |
|
|
@ -1979,21 +1992,26 @@ namespace QMAPP.WinForm.Forms.Operation |
|
|
|
if (!string.IsNullOrEmpty(MaterialCodes)) |
|
|
|
planMATERIAL_CODE = MaterialCodes; |
|
|
|
else |
|
|
|
{ |
|
|
|
WriteFile("ZSN,缺少planMATERIAL_CODE ", @"D:\MES\Log"); |
|
|
|
throw new Exception("创建BZD码失败!缺少planMATERIAL_CODE"); |
|
|
|
} |
|
|
|
} |
|
|
|
//张松男 20210207 总成工位打印052 缺少物料号 重新查找填充 end
|
|
|
|
|
|
|
|
|
|
|
|
paramList.Add(planMATERIAL_CODE); |
|
|
|
paramList.Add(processMainCode); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
WriteFile("ZSN,planMATERIAL_CODE =2= " + planMATERIAL_CODE, @"D:\MES\Log"); |
|
|
|
WriteFile("ZSN,processMainCode =2= " + processMainCode, @"D:\MES\Log"); |
|
|
|
|
|
|
|
//读取BZDCONFIG配置列表
|
|
|
|
list = _agent.InvokeServiceFunction<List<string>>( |
|
|
|
B9IPCService.BZDRecorderBLL_CreateBZDCode.ToString(), paramList); |
|
|
|
if (list != null) |
|
|
|
{ |
|
|
|
WriteFile("ZSN,查询到list " + processMainCode, @"D:\MES\Log"); |
|
|
|
//将返回值赋值给bzd对象
|
|
|
|
bzd.barcode = list[0]; |
|
|
|
bzd.color = list[1]; |
|
|
@ -2001,6 +2019,7 @@ namespace QMAPP.WinForm.Forms.Operation |
|
|
|
bzd.count = list[3]; |
|
|
|
if (bzd.count == "0") |
|
|
|
{ |
|
|
|
WriteFile("创建BZD码失败!缺少list[3] ", @"D:\MES\Log"); |
|
|
|
planMATERIAL_CODE = null; |
|
|
|
processMainCode = null; |
|
|
|
throw new Exception($"创建BZD码失败!缺少list[3];planMATERIAL_CODE={planMATERIAL_CODE};processMainCode={processMainCode}"); |
|
|
@ -2010,6 +2029,7 @@ namespace QMAPP.WinForm.Forms.Operation |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
WriteFile("创建BZD码失败!list=null ", @"D:\MES\Log"); |
|
|
|
planMATERIAL_CODE = null; |
|
|
|
processMainCode = null; |
|
|
|
throw new Exception($"创建BZD码异常!list=null;planMATERIAL_CODE={planMATERIAL_CODE};processMainCode={processMainCode}"); |
|
|
@ -2017,6 +2037,7 @@ namespace QMAPP.WinForm.Forms.Operation |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
WriteFile("创建BZD码失败!Exception: " + e.Message, @"D:\MES\Log"); |
|
|
|
planMATERIAL_CODE = null; |
|
|
|
processMainCode = null; |
|
|
|
MessageBox.Show(e.Message); |
|
|
@ -3821,5 +3842,50 @@ namespace QMAPP.WinForm.Forms.Operation |
|
|
|
|
|
|
|
BindPlanView(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 临时日志
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="strText"></param>
|
|
|
|
/// <param name="path"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public string WriteFile(string strText, string path) |
|
|
|
{ |
|
|
|
Encoding code = Encoding.GetEncoding("gb2312"); |
|
|
|
StreamWriter sw = null; |
|
|
|
string filename = DateTime.Now.ToString("yyyy-MM-dd") + ".txt"; |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(path)) |
|
|
|
{ |
|
|
|
path = System.AppDomain.CurrentDomain.BaseDirectory; |
|
|
|
} |
|
|
|
|
|
|
|
if (Directory.Exists(path) == false) |
|
|
|
{ |
|
|
|
Directory.CreateDirectory(path); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
string fullpath = System.IO.Path.Combine(path, filename); |
|
|
|
sw = new StreamWriter(fullpath, true, code); |
|
|
|
sw.Write("[" + DateTime.Now.ToString() + "]\r\n--" + strText + "\r\n"); |
|
|
|
sw.Flush(); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
//HttpContext.Current.Response.Write(ex.Message);
|
|
|
|
//HttpContext.Current.Response.End();
|
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
if (sw != null) |
|
|
|
{ |
|
|
|
sw.Close(); |
|
|
|
} |
|
|
|
} |
|
|
|
return filename; |
|
|
|
} |
|
|
|
} |
|
|
|
} |