|
@@ -1208,7 +1208,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
foreach (var item in current.PickPoints)
|
|
foreach (var item in current.PickPoints)
|
|
|
{
|
|
{
|
|
|
- await item.WriteToPlcAddress(addressConfig.Out_Pick, plc);
|
|
|
|
|
|
|
+ await item.WriteToPlcAddress(addressConfig.Out_Pick, plc,item.Feeder);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (current.SecPosCameraPoints != null && current.SecPosCameraPoints.Count > 0)
|
|
if (current.SecPosCameraPoints != null && current.SecPosCameraPoints.Count > 0)
|
|
@@ -1267,6 +1267,8 @@ namespace TeamAAS_VP.Core
|
|
|
Int16[] _LastMesCheck = new Int16[10];
|
|
Int16[] _LastMesCheck = new Int16[10];
|
|
|
Int16 _LastPickINC = 0;
|
|
Int16 _LastPickINC = 0;
|
|
|
DateTime[] _LastMesCheckTime = new DateTime[10];
|
|
DateTime[] _LastMesCheckTime = new DateTime[10];
|
|
|
|
|
+ string ProductMainSN = "";//产品主sn
|
|
|
|
|
+ string wo = "";
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// PLC命令触发时
|
|
/// PLC命令触发时
|
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -1582,9 +1584,19 @@ namespace TeamAAS_VP.Core
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 获取机器人当前坐标
|
|
|
|
|
+ var robot = _robotService.GetAllRobots().FirstOrDefault();
|
|
|
|
|
+ if (robot == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ SendTaskMessage("未找到机器人无法执行 上相机检测拍照视觉任务", MessageLevel.Alarm);
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_UpCameraPutStatus.Address, (Int16)2);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ var currentPosition = robot.GetRobotPos();
|
|
|
|
|
+
|
|
|
// 执行视觉任务
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, null, _cts.Token, cameraIndex, null);
|
|
|
|
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, null);
|
|
|
if (visionResult.IsSucceed)
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
{
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
@@ -1876,7 +1888,7 @@ namespace TeamAAS_VP.Core
|
|
|
SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
|
COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
|
REVISION = cdata.REVISION,
|
|
REVISION = cdata.REVISION,
|
|
|
- WO = cdata.WO,
|
|
|
|
|
|
|
+ WO = wo,
|
|
|
MFG_LOT = cdata.MFG_LOT,
|
|
MFG_LOT = cdata.MFG_LOT,
|
|
|
MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
|
PROCESS_OUTCOME = torqueRes ? "PASS" : "FAIL",
|
|
PROCESS_OUTCOME = torqueRes ? "PASS" : "FAIL",
|
|
@@ -1897,7 +1909,7 @@ namespace TeamAAS_VP.Core
|
|
|
SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
|
COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
|
REVISION = cdata.REVISION,
|
|
REVISION = cdata.REVISION,
|
|
|
- WO = cdata.WO,
|
|
|
|
|
|
|
+ WO = wo,
|
|
|
MFG_LOT = cdata.MFG_LOT,
|
|
MFG_LOT = cdata.MFG_LOT,
|
|
|
MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
|
PROCESS_OUTCOME = turnRes ? "PASS" : "FAIL",
|
|
PROCESS_OUTCOME = turnRes ? "PASS" : "FAIL",
|
|
@@ -1918,7 +1930,7 @@ namespace TeamAAS_VP.Core
|
|
|
SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
|
COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
|
REVISION = cdata.REVISION,
|
|
REVISION = cdata.REVISION,
|
|
|
- WO = cdata.WO,
|
|
|
|
|
|
|
+ WO = wo,
|
|
|
MFG_LOT = cdata.MFG_LOT,
|
|
MFG_LOT = cdata.MFG_LOT,
|
|
|
MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
|
PROCESS_OUTCOME = pressureRes ? "PASS" : "FAIL",
|
|
PROCESS_OUTCOME = pressureRes ? "PASS" : "FAIL",
|
|
@@ -2197,9 +2209,24 @@ namespace TeamAAS_VP.Core
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|
|
|
|
|
+
|
|
|
|
|
+ if (response != "MES功能未启用!")
|
|
|
|
|
+ {
|
|
|
|
|
+ string[] item= response.Split('\n');
|
|
|
|
|
+ if (item[3].Contains("sn="))
|
|
|
|
|
+ {
|
|
|
|
|
+ ProductMainSN = item[3].Replace("sn=", "");
|
|
|
|
|
+ SendTaskMessage($"产品主sn:{ProductMainSN}", MessageLevel.Info);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (item[5].Contains("wo="))
|
|
|
|
|
+ {
|
|
|
|
|
+ wo = item[5].Replace("wo=", "");
|
|
|
|
|
+ SendTaskMessage($"产品主wo:{wo}", MessageLevel.Info);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
|
- SendTaskMessage($"询问mes成功", MessageLevel.Debug);
|
|
|
|
|
|
|
+ SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -2247,7 +2274,7 @@ namespace TeamAAS_VP.Core
|
|
|
string torque = string.Join(",", torqueList);
|
|
string torque = string.Join(",", torqueList);
|
|
|
string pressure = string.Join(",", pressureList);
|
|
string pressure = string.Join(",", pressureList);
|
|
|
string turn = string.Join(",", turnList);
|
|
string turn = string.Join(",", turnList);
|
|
|
- (bool isSuccess, string response) = await _mesService.SubmitGetAsync(code, "", torque, pressure, turn, resultIndex == 1 ? true : false, _LastMesCheckTime[i], DateTime.UtcNow);
|
|
|
|
|
|
|
+ (bool isSuccess, string response) = await _mesService.SubmitGetAsync(ProductMainSN, "", torque, pressure, turn, resultIndex == 1 ? true : false, _LastMesCheckTime[i], DateTime.UtcNow);
|
|
|
if (isSuccess)
|
|
if (isSuccess)
|
|
|
{
|
|
{
|
|
|
LogHelper.WriteLogMes($"上传mes成功");
|
|
LogHelper.WriteLogMes($"上传mes成功");
|