|
@@ -1039,7 +1039,7 @@ namespace TeamAAS_VP.Core
|
|
|
addressConfig.In_QrCodePhotoRequest.Address,
|
|
addressConfig.In_QrCodePhotoRequest.Address,
|
|
|
addressConfig.In_PickINC.Address,
|
|
addressConfig.In_PickINC.Address,
|
|
|
addressConfig.In_Throw.Address,
|
|
addressConfig.In_Throw.Address,
|
|
|
- // addressConfig.RunMode.Address,
|
|
|
|
|
|
|
+ //addressConfig.RunMode.Address,
|
|
|
addressConfig.ManualMode.Address,
|
|
addressConfig.ManualMode.Address,
|
|
|
addressConfig.AutoRunning.Address,
|
|
addressConfig.AutoRunning.Address,
|
|
|
addressConfig.ClearMode.Address,
|
|
addressConfig.ClearMode.Address,
|
|
@@ -1255,6 +1255,10 @@ namespace TeamAAS_VP.Core
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
string PartSN = "";
|
|
string PartSN = "";
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
|
|
+ /// 零件2SN
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ string PartSN2 = "";
|
|
|
|
|
+ /// <summary>
|
|
|
/// 产品SN
|
|
/// 产品SN
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
string[] ProductMainSN = new string[10];//产品主sn
|
|
string[] ProductMainSN = new string[10];//产品主sn
|
|
@@ -2584,6 +2588,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
SendTaskMessage($"未找到二维码视觉流程,流程ID: {qrCodeProcedureId}", MessageLevel.Alarm);
|
|
SendTaskMessage($"未找到二维码视觉流程,流程ID: {qrCodeProcedureId}", MessageLevel.Alarm);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
|
|
|
+ SendTaskMessage("1发送plc结果2", MessageLevel.Info);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2608,17 +2613,20 @@ namespace TeamAAS_VP.Core
|
|
|
if (!isSuccess)//如果二维码已使用,则返回false
|
|
if (!isSuccess)//如果二维码已使用,则返回false
|
|
|
{
|
|
{
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)3);
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)3);
|
|
|
|
|
+ SendTaskMessage("发送plc结果3", MessageLevel.Info);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)1);
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)1);
|
|
|
|
|
+ SendTaskMessage("发送plc结果1", MessageLevel.Info);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
PartSN = "";
|
|
PartSN = "";
|
|
|
SendTaskMessage("二维码扫码失败", MessageLevel.Alarm);
|
|
SendTaskMessage("二维码扫码失败", MessageLevel.Alarm);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
|
|
|
+ SendTaskMessage("2发送plc结果2", MessageLevel.Info);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2627,6 +2635,71 @@ namespace TeamAAS_VP.Core
|
|
|
PartSN = "";
|
|
PartSN = "";
|
|
|
SendTaskMessage("二维码扫码失败", MessageLevel.Alarm);
|
|
SendTaskMessage("二维码扫码失败", MessageLevel.Alarm);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
|
|
|
+ SendTaskMessage("3发送plc结果2", MessageLevel.Info);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (state == 2)
|
|
|
|
|
+ {
|
|
|
|
|
+ //相机的编号
|
|
|
|
|
+ //Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_QrCodeCamera_ScanNum.Address);
|
|
|
|
|
+ //SendTaskMessage(string.Format("扫码编号", cameraIndex), MessageLevel.Info);
|
|
|
|
|
+
|
|
|
|
|
+ Guid qrCodeProcedureId = currentProduct.QrCodeProcedureId2;
|
|
|
|
|
+ //视觉流程ID
|
|
|
|
|
+ var qrCodeProcess = _productService.GetCurrentProductProcedureModelById(qrCodeProcedureId);
|
|
|
|
|
+ if (qrCodeProcess == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ SendTaskMessage($"未找到二维码视觉流程2,流程ID: {qrCodeProcedureId}", MessageLevel.Alarm);
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
|
|
|
+ SendTaskMessage("4发送plc结果2", MessageLevel.Info);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SendTaskMessage($"开始执行二维码扫码视觉流程2", MessageLevel.Debug);
|
|
|
|
|
+ var _cts = new CancellationTokenSource();
|
|
|
|
|
+
|
|
|
|
|
+ await _remoteCommandService.SetLightBeforePhoto(qrCodeProcess);
|
|
|
|
|
+ var qrCodeResult = _remoteCommandService.ExecutePhoto(1, qrCodeProcess, out CogToolBlockTerminalCollection outputCollection);
|
|
|
|
|
+
|
|
|
|
|
+ if (qrCodeResult && outputCollection.Contains("QR"))
|
|
|
|
|
+ {
|
|
|
|
|
+ PartSN2 = outputCollection["QR"].Value as string;
|
|
|
|
|
+ if (!string.IsNullOrEmpty(PartSN2))
|
|
|
|
|
+ {
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_PartCode2.Address, PartSN2);
|
|
|
|
|
+ SendTaskMessage($"二维码扫码成功2:{PartSN2}", MessageLevel.Info);
|
|
|
|
|
+
|
|
|
|
|
+ var stationConfig = _configService.GetDeviceInfo(0);
|
|
|
|
|
+ if (stationConfig.EnableMES)
|
|
|
|
|
+ {
|
|
|
|
|
+ (bool isSuccess, string response) = await _mesService.StationGetEx2Async(0, PartSN2, "", 2);//询问零件码,是否可以使用
|
|
|
|
|
+ if (!isSuccess)//如果二维码已使用,则返回false
|
|
|
|
|
+ {
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)3);
|
|
|
|
|
+ SendTaskMessage("2发送plc结果3", MessageLevel.Info);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)1);
|
|
|
|
|
+ SendTaskMessage("2发送plc结果1", MessageLevel.Info);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ PartSN2 = "";
|
|
|
|
|
+ SendTaskMessage("二维码扫码失败", MessageLevel.Alarm);
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
|
|
|
+ SendTaskMessage("5发送plc结果2", MessageLevel.Info);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ PartSN2 = "";
|
|
|
|
|
+ SendTaskMessage("二维码扫码失败", MessageLevel.Alarm);
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
|
|
|
+ SendTaskMessage("6发送plc结果2", MessageLevel.Info);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2634,6 +2707,8 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
SendTaskMessage("二维码拍照点位发送信号已关闭", MessageLevel.Alarm);
|
|
SendTaskMessage("二维码拍照点位发送信号已关闭", MessageLevel.Alarm);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)0);
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)0);
|
|
|
|
|
+ SendTaskMessage("发送plc结果0", MessageLevel.Info);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2766,7 +2841,8 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
}
|
|
|
var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
|
|
var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
|
|
|
string comp = PartSN;
|
|
string comp = PartSN;
|
|
|
- SendTaskMessage($"产品sn:{code},辅料码:{comp}", MessageLevel.Info);
|
|
|
|
|
|
|
+ string comp2 = PartSN2;
|
|
|
|
|
+ SendTaskMessage($"产品sn:{code},辅料码:{comp},辅料码2:{comp2}", MessageLevel.Info);
|
|
|
//询问mes
|
|
//询问mes
|
|
|
if (state == 1)
|
|
if (state == 1)
|
|
|
{
|
|
{
|
|
@@ -2796,7 +2872,7 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"过度件sn:{ProductMainSN_Temp}", MessageLevel.Info);
|
|
SendTaskMessage($"过度件sn:{ProductMainSN_Temp}", MessageLevel.Info);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (bool isSuccess2, string response2) = await _mesService.StationGetAsync(i, ProductMainSN_Temp, PartSN, 2);//询问mes
|
|
|
|
|
|
|
+ (bool isSuccess2, string response2) = await _mesService.StationGetAsync(i, ProductMainSN_Temp, PartSN,PartSN2, 2);//询问mes
|
|
|
if (isSuccess2)
|
|
if (isSuccess2)
|
|
|
{
|
|
{
|
|
|
LogHelper.WriteLogMes($"第二次询问mes成功");
|
|
LogHelper.WriteLogMes($"第二次询问mes成功");
|
|
@@ -2908,7 +2984,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
|
- (bool isSuccess, string response) = await _mesService.StationGetAsync(i, code, PartSN, 2);//询问mes
|
|
|
|
|
|
|
+ (bool isSuccess, string response) = await _mesService.StationGetAsync(i, code, PartSN,PartSN2 ,2);//询问mes
|
|
|
if (isSuccess)
|
|
if (isSuccess)
|
|
|
{
|
|
{
|
|
|
string[] item = response.Split('\n');
|
|
string[] item = response.Split('\n');
|
|
@@ -3034,7 +3110,9 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
|
|
//从PLC获取零件编号
|
|
//从PLC获取零件编号
|
|
|
PartSN = plc.ReadNode<string>(addressConfig.In_PartCode.Address);
|
|
PartSN = plc.ReadNode<string>(addressConfig.In_PartCode.Address);
|
|
|
|
|
+ PartSN2 = plc.ReadNode<string>(addressConfig.In_PartCode2.Address);
|
|
|
comp = PartSN;
|
|
comp = PartSN;
|
|
|
|
|
+ comp2 = PartSN2;
|
|
|
|
|
|
|
|
//读取产品结果
|
|
//读取产品结果
|
|
|
Int16 resultIndex = plc.ReadNode<Int16>(string.Format(addressConfig.In_Result.Address, i));
|
|
Int16 resultIndex = plc.ReadNode<Int16>(string.Format(addressConfig.In_Result.Address, i));
|
|
@@ -3210,7 +3288,7 @@ namespace TeamAAS_VP.Core
|
|
|
ERROR_MESSAGE = "NA",
|
|
ERROR_MESSAGE = "NA",
|
|
|
PD_ATTR_01 = midValue,
|
|
PD_ATTR_01 = midValue,
|
|
|
PD_ATTR_02 = ProductMainSN[i],
|
|
PD_ATTR_02 = ProductMainSN[i],
|
|
|
- PD_ATTR_03 = PartSN,
|
|
|
|
|
|
|
+ PD_ATTR_03 = PartSN + "," + PartSN2,
|
|
|
PD_ATTR_04 = code,
|
|
PD_ATTR_04 = code,
|
|
|
PD_ATTR_05 = CTtime.ToString(),
|
|
PD_ATTR_05 = CTtime.ToString(),
|
|
|
PD_ATTR_06 = CTtime2.ToString(),
|
|
PD_ATTR_06 = CTtime2.ToString(),
|
|
@@ -3240,7 +3318,7 @@ namespace TeamAAS_VP.Core
|
|
|
ERROR_MESSAGE = assyPresRes ? "NA" : "Assy_Pressure OOS",
|
|
ERROR_MESSAGE = assyPresRes ? "NA" : "Assy_Pressure OOS",
|
|
|
PD_ATTR_01 = midValue,
|
|
PD_ATTR_01 = midValue,
|
|
|
PD_ATTR_02 = ProductMainSN[i],
|
|
PD_ATTR_02 = ProductMainSN[i],
|
|
|
- PD_ATTR_03 = PartSN,
|
|
|
|
|
|
|
+ PD_ATTR_03 = PartSN+","+PartSN2,
|
|
|
PD_ATTR_04 = code,
|
|
PD_ATTR_04 = code,
|
|
|
PD_ATTR_05 = CTtime.ToString(),
|
|
PD_ATTR_05 = CTtime.ToString(),
|
|
|
PD_ATTR_06 = CTtime2.ToString(),
|
|
PD_ATTR_06 = CTtime2.ToString(),
|
|
@@ -3391,7 +3469,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//gap-复检gap参数, press-保压站实际压力值, presstime-保压站保压时间, assypress-组装站实际压力值
|
|
//gap-复检gap参数, press-保压站实际压力值, presstime-保压站保压时间, assypress-组装站实际压力值
|
|
|
- (bool isSuccess, string response) = await _mesService.SubmitGetAsync(i, ProductMainSN[i], comp, resultIndex == 1 ? true : false, data, fileresult, _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
|
|
|
|
+ (bool isSuccess, string response) = await _mesService.SubmitGetAsync(i, ProductMainSN[i], comp,comp2, resultIndex == 1 ? true : false, data, fileresult, _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
if (!stationConfig.EnableMES || isSuccess)
|
|
if (!stationConfig.EnableMES || isSuccess)
|
|
|
{
|
|
{
|
|
|
LogHelper.WriteLogMes($"上传mes成功");
|
|
LogHelper.WriteLogMes($"上传mes成功");
|
|
@@ -3429,11 +3507,10 @@ namespace TeamAAS_VP.Core
|
|
|
var device = _configService.GetDeviceInfo(i);
|
|
var device = _configService.GetDeviceInfo(i);
|
|
|
var systemConfig = _configService.GetSystemConfiguration();
|
|
var systemConfig = _configService.GetSystemConfiguration();
|
|
|
var pressureSensorConfig = systemConfig.PressureSensorConfig.FirstOrDefault();
|
|
var pressureSensorConfig = systemConfig.PressureSensorConfig.FirstOrDefault();
|
|
|
- (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename, device);
|
|
|
|
|
- if (isSuc)
|
|
|
|
|
|
|
+ // (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename, device);
|
|
|
|
|
+ if (true)
|
|
|
{
|
|
{
|
|
|
- LogHelper.WriteLogMes($"上传数据成功");
|
|
|
|
|
- SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
|
|
|
|
|
+
|
|
|
string filePath = $"D:\\image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
string filePath = $"D:\\image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
if (!Directory.Exists(filePath))
|
|
if (!Directory.Exists(filePath))
|
|
|
{
|
|
{
|
|
@@ -3471,6 +3548,8 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
|
|
|
|
|
|
|
CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
|
|
|
+ LogHelper.WriteLogMes($"上传数据成功");
|
|
|
|
|
+ SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
|
|
|
|
|
|
//上传csv
|
|
//上传csv
|
|
|
bool isAfter20 = dt.Hour >= 20;
|
|
bool isAfter20 = dt.Hour >= 20;
|