|
|
@@ -1208,7 +1208,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
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)
|
|
|
@@ -1267,6 +1267,8 @@ namespace TeamAAS_VP.Core
|
|
|
Int16[] _LastMesCheck = new Int16[10];
|
|
|
Int16 _LastPickINC = 0;
|
|
|
DateTime[] _LastMesCheckTime = new DateTime[10];
|
|
|
+ string ProductMainSN = "";//产品主sn
|
|
|
+ string wo = "";
|
|
|
/// <summary>
|
|
|
/// PLC命令触发时
|
|
|
/// </summary>
|
|
|
@@ -1582,9 +1584,19 @@ namespace TeamAAS_VP.Core
|
|
|
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 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)
|
|
|
{
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
|
@@ -1876,7 +1888,7 @@ namespace TeamAAS_VP.Core
|
|
|
SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
|
COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
|
REVISION = cdata.REVISION,
|
|
|
- WO = cdata.WO,
|
|
|
+ WO = wo,
|
|
|
MFG_LOT = cdata.MFG_LOT,
|
|
|
MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
|
PROCESS_OUTCOME = torqueRes ? "PASS" : "FAIL",
|
|
|
@@ -1897,7 +1909,7 @@ namespace TeamAAS_VP.Core
|
|
|
SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
|
COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
|
REVISION = cdata.REVISION,
|
|
|
- WO = cdata.WO,
|
|
|
+ WO = wo,
|
|
|
MFG_LOT = cdata.MFG_LOT,
|
|
|
MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
|
PROCESS_OUTCOME = turnRes ? "PASS" : "FAIL",
|
|
|
@@ -1918,7 +1930,7 @@ namespace TeamAAS_VP.Core
|
|
|
SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
|
COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
|
REVISION = cdata.REVISION,
|
|
|
- WO = cdata.WO,
|
|
|
+ WO = wo,
|
|
|
MFG_LOT = cdata.MFG_LOT,
|
|
|
MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
|
PROCESS_OUTCOME = pressureRes ? "PASS" : "FAIL",
|
|
|
@@ -2147,6 +2159,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (qrCodeResult && outputCollection.Contains("QR"))
|
|
|
{
|
|
|
code = outputCollection["QR"].Value as string;
|
|
|
+ code = code.ToUpper();
|
|
|
if (!string.IsNullOrEmpty(code))
|
|
|
{
|
|
|
SendTaskMessage($"二维码扫码成功:{code}", MessageLevel.Info);
|
|
|
@@ -2183,7 +2196,7 @@ namespace TeamAAS_VP.Core
|
|
|
_LastMesCheckTime[i] = DateTime.UtcNow;
|
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
|
- (bool isSuccess, string response) = await _mesService.StationGetAsync(code, "", 2);//询问mes
|
|
|
+ (bool isSuccess, string response) = await _mesService.StationGetExAsync(code, "", 2);//基于电池的SN获取产品SN,询问mes
|
|
|
if (i == 0)
|
|
|
{
|
|
|
SendTaskMessage($"收到当前过站检查请求(当站是否生产)...", MessageLevel.Debug);
|
|
|
@@ -2194,21 +2207,68 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
if (isSuccess)
|
|
|
{
|
|
|
- //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|
|
|
+ string ProductMainSN_Temp = "";
|
|
|
+ LogHelper.WriteLogMes($"询问mes成功");
|
|
|
+ SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
|
|
|
|
|
|
+ if (response != "MES功能未启用!")
|
|
|
+ {
|
|
|
+ string[] item= response.Split('\n');
|
|
|
+ if (item[2].Contains("sn="))
|
|
|
+ {
|
|
|
+ ProductMainSN_Temp = item[2].Replace("sn=", "");
|
|
|
+ SendTaskMessage($"电池sn:{ProductMainSN_Temp}", MessageLevel.Info);
|
|
|
+ }
|
|
|
+ }
|
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
|
- SendTaskMessage($"询问mes成功", MessageLevel.Debug);
|
|
|
+ SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
|
|
|
+
|
|
|
+ //20260214,螺丝机特别版(电池组装)
|
|
|
+ (bool isSuccess2, string response2) = await _mesService.StationGetAsync(ProductMainSN_Temp, "", 2);//询问mes
|
|
|
+ if (isSuccess2)
|
|
|
+ {
|
|
|
+ LogHelper.WriteLogMes($"询问mes成功");
|
|
|
+ SendTaskMessage($"询问mes成功:{response2}", MessageLevel.Debug);
|
|
|
+
|
|
|
+ if (response2 != "MES功能未启用!")
|
|
|
+ {
|
|
|
+ string[] item = response2.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成功");
|
|
|
+ SendTaskMessage($"第二次询问mes成功:{response2}", MessageLevel.Debug);
|
|
|
+
|
|
|
+ //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.WriteLogMes($"第二次询问mes失败");
|
|
|
+ SendTaskMessage($"第二次询问mes失败:{response2}", MessageLevel.Error);
|
|
|
+
|
|
|
+ //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ LogHelper.WriteLogMes($"询问mes失败");
|
|
|
+ SendTaskMessage($"询问mes失败:{response}", MessageLevel.Error);
|
|
|
+
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
-
|
|
|
- LogHelper.WriteLogMes($"询问mes失败");
|
|
|
- SendTaskMessage($"询问mes失败:{response}", MessageLevel.Error);
|
|
|
}
|
|
|
LogHelper.WriteLogMes($"【mes结束QUERY】");
|
|
|
SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
|
|
|
@@ -2233,7 +2293,7 @@ namespace TeamAAS_VP.Core
|
|
|
await _systemDatabaseService.RecordProductionAsync(new ProductionRecord()
|
|
|
{
|
|
|
ProductName = currentProduct.Name,
|
|
|
- ProductCode = code,
|
|
|
+ ProductCode = ProductMainSN,
|
|
|
DeviceId = i,
|
|
|
DeviceName = "",
|
|
|
Category = resultIndex == 1 ? "OK" : "NG",
|
|
|
@@ -2247,7 +2307,7 @@ namespace TeamAAS_VP.Core
|
|
|
string torque = string.Join(",", torqueList);
|
|
|
string pressure = string.Join(",", pressureList);
|
|
|
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)
|
|
|
{
|
|
|
LogHelper.WriteLogMes($"上传mes成功");
|
|
|
@@ -2260,7 +2320,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
|
|
|
- WriteProductLog(lockResultsAll, code, CTtime);
|
|
|
+ WriteProductLog(lockResultsAll, ProductMainSN, CTtime);
|
|
|
|
|
|
LogHelper.WriteLogMes($"【mes结束ADD】");
|
|
|
SendTaskMessage($"mes结束ADD", MessageLevel.Info);
|