|
|
@@ -106,7 +106,7 @@ namespace TeamAAS_VP.Core
|
|
|
/// 超时自动停止秒数
|
|
|
/// </summary>
|
|
|
private int _pressureMaxDurationSeconds = 30; //超时自动停止秒数
|
|
|
-
|
|
|
+
|
|
|
DateTime StartCtqTime = DateTime.Now;//开始采集Ctq数据的时间
|
|
|
#endregion
|
|
|
|
|
|
@@ -1322,12 +1322,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);
|
|
|
|
|
|
@@ -1914,7 +1914,7 @@ 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);
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetDistance(1, 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);
|
|
|
@@ -2297,16 +2297,13 @@ namespace TeamAAS_VP.Core
|
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
|
SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
|
|
|
string ProductMainSN_Temp = "";
|
|
|
- if (response != "MES功能未启用!")
|
|
|
+ string[] item = response.Split('\n');
|
|
|
+ //获取过度件sn
|
|
|
+ string snItem = item.FirstOrDefault(f => f.Contains("sn="));
|
|
|
+ if (snItem != null)
|
|
|
{
|
|
|
- string[] item = response.Split('\n');
|
|
|
- //获取过度件sn
|
|
|
- string snItem = item.FirstOrDefault(f => f.Contains("sn="));
|
|
|
- if (snItem != null)
|
|
|
- {
|
|
|
- ProductMainSN_Temp = snItem.Replace("sn=", "").Trim();
|
|
|
- SendTaskMessage($"过度件sn:{ProductMainSN_Temp}", MessageLevel.Info);
|
|
|
- }
|
|
|
+ ProductMainSN_Temp = snItem.Replace("sn=", "").Trim();
|
|
|
+ SendTaskMessage($"过度件sn:{ProductMainSN_Temp}", MessageLevel.Info);
|
|
|
}
|
|
|
|
|
|
(bool isSuccess2, string response2) = await _mesService.StationGetAsync(i, ProductMainSN_Temp, "", 2);//询问mes
|
|
|
@@ -2314,26 +2311,23 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
LogHelper.WriteLogMes($"第二次询问mes成功");
|
|
|
SendTaskMessage($"第二次询问mes成功:{response2}", MessageLevel.Debug);
|
|
|
- if (response2 != "MES功能未启用!")
|
|
|
+ item = response2.Split('\n');
|
|
|
+ //获取产品主sn和wo用于后续上传数据使用
|
|
|
+ snItem = item.FirstOrDefault(f => f.Contains("sn="));
|
|
|
+ if (snItem != null)
|
|
|
{
|
|
|
- string[] item = response2.Split('\n');
|
|
|
- //获取产品主sn和wo用于后续上传数据使用
|
|
|
- string snItem = item.FirstOrDefault(f => f.Contains("sn="));
|
|
|
- if (snItem != null)
|
|
|
- {
|
|
|
- ProductMainSN[i] = snItem.Replace("sn=", "").Trim();
|
|
|
- if (i == 0)
|
|
|
- {
|
|
|
- _productService.CurrentProductCode = ProductMainSN[i];
|
|
|
- }
|
|
|
- SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
|
- }
|
|
|
- string woItem = item.FirstOrDefault(f => f.Contains("wo="));
|
|
|
- if (woItem != null)
|
|
|
+ ProductMainSN[i] = snItem.Replace("sn=", "").Trim();
|
|
|
+ if (i == 0)
|
|
|
{
|
|
|
- wo[i] = woItem.Replace("wo=", "").Trim();
|
|
|
- SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
|
|
|
+ _productService.CurrentProductCode = ProductMainSN[i];
|
|
|
}
|
|
|
+ SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
|
+ }
|
|
|
+ string woItem = item.FirstOrDefault(f => f.Contains("wo="));
|
|
|
+ if (woItem != null)
|
|
|
+ {
|
|
|
+ wo[i] = woItem.Replace("wo=", "").Trim();
|
|
|
+ SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
@@ -2366,7 +2360,7 @@ namespace TeamAAS_VP.Core
|
|
|
LogHelper.WriteLogMes($"【mes结束QUERY】");
|
|
|
SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
|
|
|
}
|
|
|
- else if(stationConfig.EnableMES)
|
|
|
+ else if (stationConfig.EnableMES)
|
|
|
{
|
|
|
SendTaskMessage($"收到{i}:{stationConfig.DeviceName}过站检查请求(当站是否生产)(当前不需要双MES验证)...", MessageLevel.Debug);
|
|
|
|
|
|
@@ -2375,26 +2369,23 @@ namespace TeamAAS_VP.Core
|
|
|
(bool isSuccess, string response) = await _mesService.StationGetAsync(i, code, "", 2);//询问mes
|
|
|
if (isSuccess)
|
|
|
{
|
|
|
- if (response != "MES功能未启用!")
|
|
|
+ string[] item = response.Split('\n');
|
|
|
+ //获取产品主sn和wo用于后续上传数据使用
|
|
|
+ string snItem = item.FirstOrDefault(f => f.Contains("sn="));
|
|
|
+ if (snItem != null)
|
|
|
{
|
|
|
- string[] item = response.Split('\n');
|
|
|
- //获取产品主sn和wo用于后续上传数据使用
|
|
|
- string snItem = item.FirstOrDefault(f => f.Contains("sn="));
|
|
|
- if (snItem != null)
|
|
|
+ ProductMainSN[i] = snItem.Replace("sn=", "").Trim();
|
|
|
+ if (i == 0)
|
|
|
{
|
|
|
- ProductMainSN[i] = snItem.Replace("sn=", "").Trim();
|
|
|
- if (i == 0)
|
|
|
- {
|
|
|
- _productService.CurrentProductCode = ProductMainSN[i];
|
|
|
- }
|
|
|
- SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
|
- }
|
|
|
- string woItem = item.FirstOrDefault(f => f.Contains("wo="));
|
|
|
- if (woItem != null)
|
|
|
- {
|
|
|
- wo[i] = woItem.Replace("wo=", "").Trim();
|
|
|
- SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
|
|
|
+ _productService.CurrentProductCode = ProductMainSN[i];
|
|
|
}
|
|
|
+ SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
|
+ }
|
|
|
+ string woItem = item.FirstOrDefault(f => f.Contains("wo="));
|
|
|
+ if (woItem != null)
|
|
|
+ {
|
|
|
+ wo[i] = woItem.Replace("wo=", "").Trim();
|
|
|
+ SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
|
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
|
@@ -2416,6 +2407,12 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ ProductMainSN[i] = DateTime.Now.ToString();
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ _productService.CurrentProductCode = ProductMainSN[i];
|
|
|
+ }
|
|
|
+
|
|
|
LogHelper.WriteLogMes("未启用mes");
|
|
|
SendTaskMessage("未启用mes", MessageLevel.Error);
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
@@ -2504,7 +2501,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
//cc-复检cc,assypress-组装站压力
|
|
|
(bool isSuccess, string response) = await _mesService.SubmitGetAsync(i, ProductMainSN[i], comp, cc, assypress, resultIndex == 1 ? true : false, _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
- if (isSuccess)
|
|
|
+ if (!stationConfig.EnableMES || isSuccess)
|
|
|
{
|
|
|
LogHelper.WriteLogMes($"上传mes成功");
|
|
|
SendTaskMessage($"上传mes成功", MessageLevel.Debug);
|
|
|
@@ -2518,7 +2515,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);
|
|
|
-
|
|
|
+
|
|
|
//是否保存当前的产品记录至CSV?
|
|
|
if (stationConfig.SaveCsv)
|
|
|
{
|
|
|
@@ -2552,7 +2549,7 @@ namespace TeamAAS_VP.Core
|
|
|
CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
ERROR_MESSAGE = assyPress ? "" : "CC OOS",
|
|
|
});
|
|
|
- }
|
|
|
+ }
|
|
|
DFC.Add(new DataFormCtq
|
|
|
{
|
|
|
PPID = code,
|
|
|
@@ -2654,50 +2651,12 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"收到停止压力信号[{i}]...", MessageLevel.Debug);
|
|
|
//获取当前锁付点
|
|
|
//var screwPoint = currentProduct.ScrewPoints.FirstOrDefault(p => p.Number == positionIndex);
|
|
|
- ////获取当前的机器人点位
|
|
|
- //var robot = _robotService.GetAllRobots().FirstOrDefault();
|
|
|
- //var currentPosition = robot.GetRobotPos();
|
|
|
- ////读取压力值
|
|
|
- //float pressure = plc.ReadNode<float>(addressConfig.In_PressureValue.Address);
|
|
|
//读取压力值
|
|
|
float pressure = plc.ReadNode<float>(string.Format(addressConfig.In_PressureValue.Address, i));
|
|
|
currentPressure[i] = pressure;
|
|
|
SendTaskMessage($"[{i}]压力:{pressure}", MessageLevel.Info);
|
|
|
|
|
|
- //await Task.Delay(60);
|
|
|
- ////获取电批结果
|
|
|
- //bool isSucced = ScrewDriver.GetData();
|
|
|
- //LockResult lockResult = new LockResult();
|
|
|
- //lockResult.ScrewdriverGetDataSucceed = isSucced;
|
|
|
- //lockResult.Number = positionIndex;
|
|
|
- //lockResult.LockPassed = ScrewDriver.Success;
|
|
|
- //lockResult.ProductNumber = _productService.CurrentProductCode;
|
|
|
- //lockResult.LockTurns = (float)ScrewDriver.Truns;
|
|
|
- //lockResult.LockTorque = (float)ScrewDriver.TorqueValue;
|
|
|
- //lockResult.LockDuration = (float)ScrewDriver.FinalTime;
|
|
|
- //lockResult.ScrewdriverProgramNumber = ScrewDriver.ProgramNumber;
|
|
|
- //lockResult.ResultDetails = ScrewDriver.ErrorInfo;
|
|
|
- //lockResult.Pressure = pressure;
|
|
|
- //lockResult.TargetTorque = ScrewDriver.TargetTorque;
|
|
|
- //lockResult.TargetTurnsUpperLimit = ScrewDriver.TargetTurnsUpperLimit;
|
|
|
- //lockResult.TargetTurnsLowerLimit = ScrewDriver.TargetTurnsLowerLimit;
|
|
|
- //lockResult.TargetLockSpeed = ScrewDriver.TargetLockSpeed;
|
|
|
- //lockResult.StartPositionX = currentPosition.X;
|
|
|
- //lockResult.StartPositionY = currentPosition.Y;
|
|
|
- //lockResult.StartPositionZ = screwPoint.Z_Position_Start;
|
|
|
- //lockResult.EndPositionZ = currentPosition.Z;
|
|
|
- //lockResult.LockDescentSpeed = screwPoint.Z_Velocity_Stop;
|
|
|
- //lockResult.FeederNumber = screwPoint != null ? screwPoint.Feeder : 0;
|
|
|
- //lockResult.NozzleNumber = "";
|
|
|
- //lockResult.OperatorName = _systemDatabaseService.GetCurrentUser().UserName;
|
|
|
- //lockResult.ProductImagePath = "";
|
|
|
- //lockResult.WaveDatas = ScrewDriver.WaveDatas;
|
|
|
- //App.Current.Dispatcher.Invoke(() =>
|
|
|
- //{
|
|
|
- // _eventAggregator.GetEvent<LockFinishNotification>().Publish(lockResult);
|
|
|
- //});
|
|
|
- //await _systemDatabaseService.RecordLockResultAsync(lockResult);
|
|
|
- await plc.WriteNodeAsync(addressConfig.In_WorkDone.Address, (Int16)0);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.In_WorkDone.Address, i), (Int16)0);
|
|
|
var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
|
|
|
// 停止采集压力并保存
|
|
|
await StopAndSavePressureCollectionAsync(currentProduct.Name, code, i);
|