|
|
@@ -1261,7 +1261,7 @@ namespace TeamAAS_VP.Core
|
|
|
Int16 _LastPickINC = 0;
|
|
|
Int16[] _LastMesCheck = new Int16[10];
|
|
|
DateTime[] _LastMesCheckTime = new DateTime[10];
|
|
|
- Dictionary<string, string> mes_cc = new Dictionary<string, string>();
|
|
|
+ Dictionary<string, string> mes_cc { get; set; } = new Dictionary<string, string>();
|
|
|
/// <summary>
|
|
|
/// 当前压力值
|
|
|
/// </summary>
|
|
|
@@ -1291,12 +1291,12 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
|
|
|
////获取产品编码
|
|
|
- //_productService.CurrentProductCode = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, 0));
|
|
|
- ////如果产品编码为空,则以当前的时间戳作为编码
|
|
|
- //if (string.IsNullOrEmpty(_productService.CurrentProductCode))
|
|
|
- //{
|
|
|
- // _productService.CurrentProductCode = DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|
|
- //}
|
|
|
+ _productService.CurrentProductCode = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, 0));
|
|
|
+ //如果产品编码为空,则以当前的时间戳作为编码
|
|
|
+ if (string.IsNullOrEmpty(_productService.CurrentProductCode))
|
|
|
+ {
|
|
|
+ _productService.CurrentProductCode = DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|
|
+ }
|
|
|
|
|
|
bool isDryMode = plc.ReadNode<bool>(addressConfig.In_DryMode.Address);
|
|
|
|
|
|
@@ -1884,27 +1884,24 @@ namespace TeamAAS_VP.Core
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
var visionResult = await _remoteCommandService.ExecutePhotoGetDistance(1,process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, null);
|
|
|
- if (visionResult.distance.Split(',')[0] == "1")
|
|
|
- {
|
|
|
- mes_cc.Clear();
|
|
|
- }
|
|
|
- if (visionResult.distance.Split(',')[0] == "2" && mes_cc.ContainsKey("2"))
|
|
|
- {
|
|
|
- mes_cc.Remove("2");
|
|
|
- }
|
|
|
-
|
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
|
- mes_cc.Add(visionResult.distance.Split(',')[0], visionResult.distance.Split(',')[1]);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
|
SendTaskMessage($"点位{cameraIndex}检测OK", MessageLevel.Debug);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- mes_cc.Add($"{cameraIndex}", "0");
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)2);
|
|
|
SendTaskMessage($"点位{cameraIndex}检测NG", MessageLevel.Error);
|
|
|
}
|
|
|
+ if (mes_cc.ContainsKey(visionResult.distance.Split(',')[0]))
|
|
|
+ {
|
|
|
+ mes_cc[visionResult.distance.Split(',')[0]] = visionResult.distance.Split(',')[1];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mes_cc.Add(visionResult.distance.Split(',')[0], visionResult.distance.Split(',')[1]);
|
|
|
+ }
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
|
}
|
|
|
else
|
|
|
@@ -2109,7 +2106,7 @@ namespace TeamAAS_VP.Core
|
|
|
var point = currentProduct.ScrewPoints[0].Clone();
|
|
|
var pn = Vector<double>.Build.Dense(new double[] { upCameraX, upCameraY });
|
|
|
//目标角度:
|
|
|
- double angle = point.U_Position - (DowmCameraResults[1].Z - currentProduct.FixedUpCameraTempletAngle) - (upCameraU - currentProduct.MoveDownCamerTempletAngle);
|
|
|
+ double angle = point.U_Position - (DowmCameraResults[1].Z - currentProduct.FixedUpCameraTempletAngle) + (upCameraU - currentProduct.MoveDownCamerTempletAngle);
|
|
|
|
|
|
var toolCoord = new ToolCoord();
|
|
|
toolCoord.SetTool(DowmCameraResults[1].X, DowmCameraResults[1].Y);
|
|
|
@@ -2368,7 +2365,7 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage("未启用mes", MessageLevel.Error);
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|
|
|
}
|
|
|
}
|
|
|
// 上传本站数据
|
|
|
@@ -2464,8 +2461,7 @@ namespace TeamAAS_VP.Core
|
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
LogHelper.WriteLogMes($"【mes结束ADD】");
|
|
|
SendTaskMessage($"mes结束ADD", MessageLevel.Info);
|
|
|
- mes_cc.Clear();
|
|
|
-
|
|
|
+
|
|
|
//是否保存当前的产品记录至CSV?
|
|
|
if (stationConfig.SaveCsv)
|
|
|
{
|
|
|
@@ -2475,49 +2471,31 @@ namespace TeamAAS_VP.Core
|
|
|
bool assyPress = resultIndex == 1 ? true : false;
|
|
|
var pre = FileHelper.ReadJsonFile<PressureModel>(FilePath.PressureParamterConfigPath);
|
|
|
DFC.Clear();
|
|
|
- DFC.Add(new DataFormCtq
|
|
|
- {
|
|
|
- PPID = ProductMainSN[i],
|
|
|
- PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
- PROCESS_START_TIME = _LastMesCheckTime[i].ToString(),
|
|
|
- CTQ_NAME = "CC1",
|
|
|
- CTQ_VALUE = cc.Split(",")[0],
|
|
|
- CTQ_LSL = "",
|
|
|
- CTQ_USL = "",
|
|
|
- PROCESS_END_TIME = serverTimeResult.Now.ToString(),
|
|
|
- SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
- COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
- REVISION = stationConfig.DataInfo.REVISION,
|
|
|
- WO = wo[i],
|
|
|
- MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
- MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
- PROCESS_OUTCOME = "PASS",
|
|
|
- PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
- CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
- ERROR_MESSAGE = assyPress ? "" : "CC OOS",
|
|
|
-
|
|
|
- });
|
|
|
- DFC.Add(new DataFormCtq
|
|
|
+
|
|
|
+ foreach (var item in mes_cc)
|
|
|
{
|
|
|
- PPID = ProductMainSN[i],
|
|
|
- PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
- PROCESS_START_TIME = _LastMesCheckTime[i].ToString(),
|
|
|
- CTQ_NAME = "CC2",
|
|
|
- CTQ_VALUE = cc.Split(",")[1],
|
|
|
- CTQ_LSL = "",
|
|
|
- CTQ_USL = "",
|
|
|
- PROCESS_END_TIME = serverTimeResult.Now.ToString(),
|
|
|
- SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
- COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
- REVISION = stationConfig.DataInfo.REVISION,
|
|
|
- WO = wo[i],
|
|
|
- MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
- MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
- PROCESS_OUTCOME = "PASS",
|
|
|
- PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
- CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
- ERROR_MESSAGE = assyPress ? "" : "CC OOS"
|
|
|
- });
|
|
|
+ DFC.Add(new DataFormCtq
|
|
|
+ {
|
|
|
+ PPID = ProductMainSN[i],
|
|
|
+ PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
+ PROCESS_START_TIME = _LastMesCheckTime[i].ToString(),
|
|
|
+ CTQ_NAME = $"CC{item.Key}",
|
|
|
+ CTQ_VALUE = item.Value,
|
|
|
+ CTQ_LSL = "",
|
|
|
+ CTQ_USL = "",
|
|
|
+ PROCESS_END_TIME = serverTimeResult.Now.ToString(),
|
|
|
+ SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
+ COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
+ REVISION = stationConfig.DataInfo.REVISION,
|
|
|
+ WO = wo[i],
|
|
|
+ MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
+ MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
+ PROCESS_OUTCOME = "PASS",
|
|
|
+ PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
+ CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
+ ERROR_MESSAGE = assyPress ? "" : "CC OOS",
|
|
|
+ });
|
|
|
+ }
|
|
|
DFC.Add(new DataFormCtq
|
|
|
{
|
|
|
PPID = code,
|
|
|
@@ -2558,6 +2536,8 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
SendTaskMessage($"{i}:{stationConfig.DeviceName}工位未配置保存产品记录", MessageLevel.Debug);
|
|
|
}
|
|
|
+
|
|
|
+ mes_cc.Clear();
|
|
|
return;
|
|
|
}
|
|
|
else
|