|
|
@@ -1252,7 +1252,8 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
foreach (var item in current.PickPoints)
|
|
|
{
|
|
|
- await item.WriteToPlcAddress(addressConfig.Out_Pick, plc, item.Feeder);
|
|
|
+ //await item.WriteToPlcAddress(addressConfig.Out_Pick, plc, item.Feeder);
|
|
|
+ await item.WriteToPlcAddress(addressConfig.Out_Pick, plc);
|
|
|
}
|
|
|
}
|
|
|
if (current.SecPosCameraPoints != null && current.SecPosCameraPoints.Count > 0)
|
|
|
@@ -1365,6 +1366,7 @@ namespace TeamAAS_VP.Core
|
|
|
Int16[] _LastMesCheck = new Int16[10];
|
|
|
Int16 _LastPickINC = 0;
|
|
|
DateTime[] _LastMesCheckTime = new DateTime[10];
|
|
|
+ Dictionary<string, string> mes_cc = new Dictionary<string, string>();
|
|
|
string[] ProductMainSN { get; set; } = new string[10];//产品主sn
|
|
|
string[] model_num { get; set; } = new string[10];//产品model_num
|
|
|
string[] wo { get; set; } = new string[10];//产品wo
|
|
|
@@ -1388,6 +1390,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
|
|
|
var addressConfig = _configService.GetPlcAddresses();
|
|
|
+
|
|
|
var plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
|
|
|
if (plc == null || !plc.IsConnected) return;
|
|
|
// 获取当前产品
|
|
|
@@ -1450,7 +1453,7 @@ namespace TeamAAS_VP.Core
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
ImageParameters imgPara = new ImageParameters();
|
|
|
imgPara.SNCode = productSn;
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, null, _cts.Token, cameraIndex, null, imgPara);
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, null, _cts.Token, cameraIndex, cameraIndex, null, imgPara);
|
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
|
//披头偏差
|
|
|
@@ -1519,7 +1522,7 @@ namespace TeamAAS_VP.Core
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
ImageParameters imgPara = new ImageParameters();
|
|
|
imgPara.SNCode = productSn;
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, null, _cts.Token, cameraIndex, null, imgPara);
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, null, _cts.Token, cameraIndex, cameraIndex, null, imgPara);
|
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
|
//披头偏差
|
|
|
@@ -1606,6 +1609,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ int num = plcPoints.Count;
|
|
|
//获取锁付拍照的点位
|
|
|
var pos = plcPoints[cameraIndex - 1];
|
|
|
if (pos != null)
|
|
|
@@ -1632,16 +1636,29 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
}
|
|
|
var currentPosition = robot.GetRobotPos();
|
|
|
-
|
|
|
+ var systemConfig = _configService.GetSystemConfiguration();
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
ImageParameters imgPara = new ImageParameters();
|
|
|
imgPara.SNCode = productSn;
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, null, imgPara);
|
|
|
+
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, num, null, imgPara);
|
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
|
//是拍一个锁一个还是拍两个点锁所有
|
|
|
- var systemConfig = _configService.GetSystemConfiguration();
|
|
|
+
|
|
|
+
|
|
|
+ if (systemConfig.IsBasePartOpenLightKB)
|
|
|
+ {
|
|
|
+ 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]);
|
|
|
+ }
|
|
|
+ }
|
|
|
//拍1打1
|
|
|
if (systemConfig.WorkMode == 1)
|
|
|
{
|
|
|
@@ -1660,6 +1677,25 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ if (systemConfig.IsBasePartOpenLightKB)
|
|
|
+ {
|
|
|
+ if (mes_cc.ContainsKey(visionResult.distance.Split(',')[0]))
|
|
|
+ {
|
|
|
+ mes_cc[visionResult.distance.Split(',')[0]] = visionResult.distance.Split(',')[1];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (mes_cc.ContainsKey(cameraIndex.ToString()))
|
|
|
+ {
|
|
|
+ mes_cc[cameraIndex.ToString()] = "0";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mes_cc.Add(cameraIndex.ToString(), "0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (!resultToMes.Contains($"Screw{cameraIndex}_Fail"))
|
|
|
{
|
|
|
resultToMes.Add($"Screw{cameraIndex}_Fail");
|
|
|
@@ -1706,6 +1742,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ int num = plcPoints.Count;
|
|
|
//视觉流程ID
|
|
|
Guid procedureId = Guid.Empty;
|
|
|
//获取锁付拍照的点位
|
|
|
@@ -1736,9 +1773,14 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, null, null);
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, num, null, null);
|
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
|
+
|
|
|
+ //if ()
|
|
|
+ //{
|
|
|
+
|
|
|
+ //}
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
|
SendTaskMessage($"点位{cameraIndex}检测OK", MessageLevel.Debug);
|
|
|
}
|
|
|
@@ -2423,19 +2465,12 @@ namespace TeamAAS_VP.Core
|
|
|
//询问mes
|
|
|
if (state == 1)
|
|
|
{
|
|
|
- if (_configService.GetDeviceInfo().EnableMES)
|
|
|
- {
|
|
|
- if (i == 0)
|
|
|
- {
|
|
|
- SendTaskMessage($"收到当前过站检查请求(当站是否生产)...", MessageLevel.Debug);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SendTaskMessage($"收到{i}过站检查请求(当站是否生产)...", MessageLevel.Debug);
|
|
|
- }
|
|
|
|
|
|
- //获取过站时间
|
|
|
- _LastMesCheckTime[i] = (await _mesService.GetServerTimeAsync(i, code, 2)).Now;
|
|
|
+ SendTaskMessage($"收到{i}过站检查请求(当站是否生产)...", MessageLevel.Debug);
|
|
|
+ //获取过站时间
|
|
|
+ _LastMesCheckTime[i] = (await _mesService.GetServerTimeAsync(i, code, 2)).Now;
|
|
|
+ if (_configService.GetDeviceInfo().EnableMES)
|
|
|
+ {
|
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
|
dataToMes.Clear();
|
|
|
@@ -2700,48 +2735,215 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
// 上传本站数据
|
|
|
else if (state == 2)
|
|
|
- {
|
|
|
- if (_configService.GetDeviceInfo().EnableMES == true)
|
|
|
- {
|
|
|
- DFC.Clear();//CTQ数据集合
|
|
|
+ {
|
|
|
+ DFC.Clear();//CTQ数据集合
|
|
|
|
|
|
- //获取当前工位的配置
|
|
|
- var stationConfig = _configService.GetDeviceInfo(i);
|
|
|
- SendTaskMessage($"收到{i}:{stationConfig.DeviceName}上传本站数据请求...", MessageLevel.Debug);
|
|
|
- //从服务器中获取当前时间
|
|
|
- LogHelper.WriteLogMes($"【从服务器中获取当前时间】");
|
|
|
- SendTaskMessage($"从服务器中获取当前时间", MessageLevel.Info);
|
|
|
- var serverTimeResult = await _mesService.GetServerTimeAsync(i, ProductMainSN[i], 2);
|
|
|
+ //获取当前工位的配置
|
|
|
+ var stationConfig = _configService.GetDeviceInfo(i);
|
|
|
+ SendTaskMessage($"收到{i}:{stationConfig.DeviceName}上传本站数据请求...", MessageLevel.Debug);
|
|
|
+ //从服务器中获取当前时间
|
|
|
+ LogHelper.WriteLogMes($"【从服务器中获取当前时间】");
|
|
|
+ SendTaskMessage($"从服务器中获取当前时间", MessageLevel.Info);
|
|
|
+ var serverTimeResult = await _mesService.GetServerTimeAsync(i, ProductMainSN[i], 2);
|
|
|
|
|
|
- //这里缺少上传MES的本站数据结果及开始和结束时间,需要补充
|
|
|
+ //这里缺少上传MES的本站数据结果及开始和结束时间,需要补充
|
|
|
|
|
|
- if (i == 0)
|
|
|
- {
|
|
|
- CTtime = serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds;
|
|
|
- _eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
- }
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ CTtime = serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds;
|
|
|
+ _eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
+ }
|
|
|
|
|
|
- //读取产品结果
|
|
|
- Int16 resultIndex = plc.ReadNode<Int16>(string.Format(addressConfig.In_Result.Address, i));
|
|
|
+ //读取产品结果
|
|
|
+ Int16 resultIndex = plc.ReadNode<Int16>(string.Format(addressConfig.In_Result.Address, i));
|
|
|
|
|
|
- //目前只记录当前站
|
|
|
- if (i == 0)
|
|
|
- await _systemDatabaseService.RecordProductionAsync(new ProductionRecord()
|
|
|
+ //目前只记录当前站
|
|
|
+ if (i == 0)
|
|
|
+ await _systemDatabaseService.RecordProductionAsync(new ProductionRecord()
|
|
|
+ {
|
|
|
+ ProductName = currentProduct.Name,
|
|
|
+ ProductCode = ProductMainSN[i],
|
|
|
+ DeviceId = i,
|
|
|
+ DeviceName = "",
|
|
|
+ Category = resultIndex == 1 ? "OK" : "NG",
|
|
|
+ Quantity = 1,
|
|
|
+ Remark = $"TotalSeconds:{serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds.ToString("F2")}",
|
|
|
+ });
|
|
|
+
|
|
|
+ LogHelper.WriteLogMes($"【mes开始ADD】");
|
|
|
+ SendTaskMessage($"mes开始ADD", MessageLevel.Info);
|
|
|
+
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ foreach (var lockResult in lockResultsAll)
|
|
|
+ {
|
|
|
+ bool torqueRes, turnRes, pressureRes;
|
|
|
+ if (lockResult.LockTorque >= lockResult.TargetTorqueLowerLimit && lockResult.LockTorque <= lockResult.TargetTorqueUpperLimit)
|
|
|
{
|
|
|
- ProductName = currentProduct.Name,
|
|
|
- ProductCode = ProductMainSN[i],
|
|
|
- DeviceId = i,
|
|
|
- DeviceName = "",
|
|
|
- Category = resultIndex == 1 ? "OK" : "NG",
|
|
|
- Quantity = 1,
|
|
|
- Remark = $"TotalSeconds:{serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds.ToString("F2")}",
|
|
|
- });
|
|
|
+ torqueRes = true;
|
|
|
+ }
|
|
|
+ else torqueRes = false;
|
|
|
+ if (lockResult.Pressure >= stationConfig.DataInfo.CTQ_LSL_Pressure && lockResult.Pressure <= stationConfig.DataInfo.CTQ_USL_Pressure)
|
|
|
+ {
|
|
|
+ pressureRes = true;
|
|
|
+ }
|
|
|
+ else pressureRes = false;
|
|
|
+ if (lockResult.LockTurns >= lockResult.TargetTurnsLowerLimit && lockResult.LockTurns <= lockResult.TargetTurnsUpperLimit)
|
|
|
+ {
|
|
|
+ turnRes = true;
|
|
|
+ }
|
|
|
+ else turnRes = false;
|
|
|
|
|
|
- LogHelper.WriteLogMes($"【mes开始ADD】");
|
|
|
- SendTaskMessage($"mes开始ADD", MessageLevel.Info);
|
|
|
- //上传mes
|
|
|
- //这里现在上传的结果都是锁付站的,如果存在其他附属站的数据需要上传时,将不适用,要根据实际情况进行调整
|
|
|
- //(bool isSuccess, string response) = await _mesService.SubmitGetAsync(ProductMainSN[i], "", dataToMes, resultIndex == 1 ? true : false, _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
+ string midValue = "NA", saveppid = "NA";
|
|
|
+ if (stationConfig.SaveCsvPPID) saveppid = ppid[i];
|
|
|
+ midValue = ((lockResult.TargetTorqueLowerLimit + lockResult.TargetTorqueUpperLimit) / 2).ToString("F3");
|
|
|
+ DFC.Add(new DataFormCtq
|
|
|
+ {
|
|
|
+ PPID = saveppid,
|
|
|
+ ScrewNum = lockResult.Number,
|
|
|
+ PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
+ PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ CTQ_NAME = "Torque",
|
|
|
+ CTQ_VALUE = lockResult.LockTorque,
|
|
|
+ CTQ_LSL = lockResult.TargetTorqueLowerLimit,
|
|
|
+ CTQ_USL = lockResult.TargetTorqueUpperLimit,
|
|
|
+ PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
+ COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
+ REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
|
|
|
+ WO = wo[i],
|
|
|
+ MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
+ MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
+ PROCESS_OUTCOME = torqueRes ? "PASS" : "FAIL",
|
|
|
+ PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
+ CTQ_UNIT_OF_MEASURE = "kgf.cm",
|
|
|
+ ERROR_MESSAGE = torqueRes ? "NA" : "Torque_Spec OOS",
|
|
|
+ PD_ATTR_01 = ProductMainSN[i],
|
|
|
+ PD_ATTR_02 = midValue,
|
|
|
+ PD_ATTR_03 = "NA",
|
|
|
+ PD_ATTR_04 = productSn,
|
|
|
+ PD_ATTR_05 = "NA",
|
|
|
+ });
|
|
|
+ midValue = ((lockResult.TargetTurnsLowerLimit + lockResult.TargetTurnsUpperLimit) / 2).ToString("F3");
|
|
|
+ DFC.Add(new DataFormCtq
|
|
|
+ {
|
|
|
+ PPID = saveppid,
|
|
|
+ ScrewNum = lockResult.Number,
|
|
|
+ PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
+ PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ CTQ_NAME = "Turn",
|
|
|
+ CTQ_VALUE = lockResult.LockTurns,
|
|
|
+ CTQ_LSL = lockResult.TargetTurnsLowerLimit,
|
|
|
+ CTQ_USL = lockResult.TargetTurnsUpperLimit,
|
|
|
+ PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
+ COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
+ REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
|
|
|
+ WO = wo[i],
|
|
|
+ MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
+ MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
+ PROCESS_OUTCOME = turnRes ? "PASS" : "FAIL",
|
|
|
+ PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
+ CTQ_UNIT_OF_MEASURE = "圈",
|
|
|
+ ERROR_MESSAGE = turnRes ? "NA" : "Turn_Spec OOS",
|
|
|
+ PD_ATTR_01 = ProductMainSN[i],
|
|
|
+ PD_ATTR_02 = midValue,
|
|
|
+ PD_ATTR_03 = "NA",
|
|
|
+ PD_ATTR_04 = productSn,
|
|
|
+ PD_ATTR_05 = "NA",
|
|
|
+ });
|
|
|
+ midValue = ((stationConfig.DataInfo.CTQ_LSL_Pressure + stationConfig.DataInfo.CTQ_USL_Pressure) / 2).ToString("F3");
|
|
|
+ DFC.Add(new DataFormCtq
|
|
|
+ {
|
|
|
+ PPID = saveppid,
|
|
|
+ ScrewNum = lockResult.Number,
|
|
|
+ PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
+ PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ CTQ_NAME = "Pressure",
|
|
|
+ CTQ_VALUE = lockResult.Pressure,
|
|
|
+ CTQ_LSL = stationConfig.DataInfo.CTQ_LSL_Pressure,
|
|
|
+ CTQ_USL = stationConfig.DataInfo.CTQ_USL_Pressure,
|
|
|
+ PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
+ COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
+ REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
|
|
|
+ WO = wo[i],
|
|
|
+ MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
+ MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
+ PROCESS_OUTCOME = pressureRes ? "PASS" : "FAIL",
|
|
|
+ PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
+ CTQ_UNIT_OF_MEASURE = "N",
|
|
|
+ ERROR_MESSAGE = pressureRes ? "NA" : "Pressure_Spec OOS",
|
|
|
+ PD_ATTR_01 = ProductMainSN[i],
|
|
|
+ PD_ATTR_02 = midValue,
|
|
|
+ PD_ATTR_03 = "NA",
|
|
|
+ PD_ATTR_04 = productSn,
|
|
|
+ PD_ATTR_05 = "NA",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (systemConfig.IsBasePartOpenLightKB)
|
|
|
+ {
|
|
|
+ string midValue = "999", saveppid = "NA";
|
|
|
+ double upvlalue = 0, doenvlaue = 0;
|
|
|
+ if (stationConfig.SaveCsvPPID) saveppid = ppid[i];
|
|
|
+ bool pressureRes=true;
|
|
|
+ foreach (var item in mes_cc)
|
|
|
+ {
|
|
|
+ switch(item.Key)
|
|
|
+ {
|
|
|
+ case "1":
|
|
|
+ upvlalue = Convert.ToDouble(currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3"));
|
|
|
+ doenvlaue = Convert.ToDouble(currentProduct.GlobalParamEx.CC1UpLimit.ToString("F3"));
|
|
|
+ midValue = ((currentProduct.GlobalParamEx.CC1DownLimit + currentProduct.GlobalParamEx.CC1UpLimit) / 2).ToString("F3");
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ upvlalue = Convert.ToDouble(currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3"));
|
|
|
+ doenvlaue = Convert.ToDouble(currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3"));
|
|
|
+ midValue = ((currentProduct.GlobalParamEx.CC2DownLimit + currentProduct.GlobalParamEx.CC2UpLimit) / 2).ToString("F3");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (doenvlaue<= currentProduct.GlobalParamEx.CC1DownLimit|| doenvlaue >= currentProduct.GlobalParamEx.CC1UpLimit)
|
|
|
+ {
|
|
|
+ pressureRes = false;
|
|
|
+ }
|
|
|
+ if (doenvlaue <= currentProduct.GlobalParamEx.CC2DownLimit|| doenvlaue >= currentProduct.GlobalParamEx.CC2UpLimit)
|
|
|
+ {
|
|
|
+ pressureRes = false;
|
|
|
+ }
|
|
|
+ dataToMes.Add($"CC{item.Key}", $"{item.Value}");
|
|
|
+ DFC.Add(new DataFormCtq
|
|
|
+ {
|
|
|
+ PPID = saveppid,
|
|
|
+ ScrewNum = 1,
|
|
|
+ PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
+ PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ CTQ_NAME = $"CC{item.Key}",
|
|
|
+ CTQ_VALUE = Convert.ToDouble(item.Value.ToString()),
|
|
|
+ CTQ_LSL = doenvlaue,
|
|
|
+ CTQ_USL = upvlalue,
|
|
|
+ PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
+ COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
+ REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
|
|
|
+ WO = wo[i],
|
|
|
+ MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
+ MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
+ PROCESS_OUTCOME = pressureRes ? "PASS" : "FAIL",
|
|
|
+ PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
+ CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
+ ERROR_MESSAGE = pressureRes ? "NA" : $"CC{item.Key} OOS",
|
|
|
+ PD_ATTR_01 = ProductMainSN[i],
|
|
|
+ PD_ATTR_02 = midValue,
|
|
|
+ PD_ATTR_03 = "NA",
|
|
|
+ PD_ATTR_04 = productSn,
|
|
|
+ PD_ATTR_05 = "NA",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //上传mes
|
|
|
+ if (stationConfig.EnableMES)
|
|
|
+ {
|
|
|
(bool isSuccess, string response) = await _mesService.SubmitGetExAsync(ProductMainSN[i], "", dataToMes, resultToMes, _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
if (isSuccess)
|
|
|
{
|
|
|
@@ -2753,257 +2955,132 @@ namespace TeamAAS_VP.Core
|
|
|
LogHelper.WriteLogMes($"上传mes失败");
|
|
|
SendTaskMessage($"上传mes失败", MessageLevel.Error);
|
|
|
}
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.WriteLogMes($"上传mes成功");
|
|
|
+ SendTaskMessage($"上传mes成功", MessageLevel.Debug);
|
|
|
+ }
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
|
|
|
- //是否保存当前的产品记录至CSV?
|
|
|
- if (stationConfig.SaveCsv)
|
|
|
+ if (stationConfig.SaveCsv)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(stationConfig.SaveCsvPath))
|
|
|
{
|
|
|
- //判断锁付路径字符串是否为空,如果不为空则保存,否则不保存
|
|
|
- if (!string.IsNullOrEmpty(stationConfig.SaveCsvPath))
|
|
|
+ bool recordResult = false;
|
|
|
+ recordResult = RecordStationResult(i, DFC, ProductMainSN[i], serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds, _LastMesCheckTime[i], stationConfig.SaveCsvPath);
|
|
|
+ if (recordResult)
|
|
|
{
|
|
|
- bool recordResult = false;
|
|
|
- if (i == 0)
|
|
|
+ SendTaskMessage($"{i}:{stationConfig.DeviceName}产品记录保存成功", MessageLevel.Debug);
|
|
|
+ //上传数据
|
|
|
+ try
|
|
|
{
|
|
|
- foreach (var lockResult in lockResultsAll)
|
|
|
+ if (stationConfig.EnableMES)
|
|
|
{
|
|
|
- bool torqueRes, turnRes, pressureRes;
|
|
|
- if (lockResult.LockTorque >= lockResult.TargetTorqueLowerLimit && lockResult.LockTorque <= lockResult.TargetTorqueUpperLimit)
|
|
|
- {
|
|
|
- torqueRes = true;
|
|
|
- }
|
|
|
- else torqueRes = false;
|
|
|
- if (lockResult.Pressure >= stationConfig.DataInfo.CTQ_LSL_Pressure && lockResult.Pressure <= stationConfig.DataInfo.CTQ_USL_Pressure)
|
|
|
- {
|
|
|
- pressureRes = true;
|
|
|
- }
|
|
|
- else pressureRes = false;
|
|
|
- if (lockResult.LockTurns >= lockResult.TargetTurnsLowerLimit && lockResult.LockTurns <= lockResult.TargetTurnsUpperLimit)
|
|
|
- {
|
|
|
- turnRes = true;
|
|
|
- }
|
|
|
- else turnRes = false;
|
|
|
+ DateTime dt = DateTime.Now;
|
|
|
+ string filename = $"{ProductMainSN[i]}_{dt.ToString("yyyyMMddHHmmss")}";
|
|
|
+ var device = _configService.GetDeviceInfo();
|
|
|
+ var config = _configService.GetSystemConfiguration();
|
|
|
|
|
|
- string midValue = "NA", saveppid = "NA";
|
|
|
- if (stationConfig.SaveCsvPPID) saveppid = ppid[i];
|
|
|
- midValue = ((lockResult.TargetTorqueLowerLimit + lockResult.TargetTorqueUpperLimit) / 2).ToString("F3");
|
|
|
- DFC.Add(new DataFormCtq
|
|
|
- {
|
|
|
- PPID = saveppid,
|
|
|
- ScrewNum = lockResult.Number,
|
|
|
- PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
- PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
- CTQ_NAME = "Torque",
|
|
|
- CTQ_VALUE = lockResult.LockTorque,
|
|
|
- CTQ_LSL = lockResult.TargetTorqueLowerLimit,
|
|
|
- CTQ_USL = lockResult.TargetTorqueUpperLimit,
|
|
|
- PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
- SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
- COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
- REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
|
|
|
- WO = wo[i],
|
|
|
- MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
- MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
- PROCESS_OUTCOME = torqueRes ? "PASS" : "FAIL",
|
|
|
- PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
- CTQ_UNIT_OF_MEASURE = "kgf.cm",
|
|
|
- ERROR_MESSAGE = torqueRes ? "NA" : "Torque_Spec OOS",
|
|
|
- PD_ATTR_01 = ProductMainSN[i],
|
|
|
- PD_ATTR_02 = midValue,
|
|
|
- PD_ATTR_03 = "NA",
|
|
|
- PD_ATTR_04 = productSn,
|
|
|
- PD_ATTR_05 = "NA",
|
|
|
- });
|
|
|
- midValue = ((lockResult.TargetTurnsLowerLimit + lockResult.TargetTurnsUpperLimit) / 2).ToString("F3");
|
|
|
- DFC.Add(new DataFormCtq
|
|
|
- {
|
|
|
- PPID = saveppid,
|
|
|
- ScrewNum = lockResult.Number,
|
|
|
- PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
- PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
- CTQ_NAME = "Turn",
|
|
|
- CTQ_VALUE = lockResult.LockTurns,
|
|
|
- CTQ_LSL = lockResult.TargetTurnsLowerLimit,
|
|
|
- CTQ_USL = lockResult.TargetTurnsUpperLimit,
|
|
|
- PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
- SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
- COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
- REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
|
|
|
- WO = wo[i],
|
|
|
- MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
- MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
- PROCESS_OUTCOME = turnRes ? "PASS" : "FAIL",
|
|
|
- PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
- CTQ_UNIT_OF_MEASURE = "圈",
|
|
|
- ERROR_MESSAGE = turnRes ? "NA" : "Turn_Spec OOS",
|
|
|
- PD_ATTR_01 = ProductMainSN[i],
|
|
|
- PD_ATTR_02 = midValue,
|
|
|
- PD_ATTR_03 = "NA",
|
|
|
- PD_ATTR_04 = productSn,
|
|
|
- PD_ATTR_05 = "NA",
|
|
|
- });
|
|
|
- midValue = ((stationConfig.DataInfo.CTQ_LSL_Pressure + stationConfig.DataInfo.CTQ_USL_Pressure) / 2).ToString("F3");
|
|
|
- DFC.Add(new DataFormCtq
|
|
|
- {
|
|
|
- PPID = saveppid,
|
|
|
- ScrewNum = lockResult.Number,
|
|
|
- PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
- PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
- CTQ_NAME = "Pressure",
|
|
|
- CTQ_VALUE = lockResult.Pressure,
|
|
|
- CTQ_LSL = stationConfig.DataInfo.CTQ_LSL_Pressure,
|
|
|
- CTQ_USL = stationConfig.DataInfo.CTQ_USL_Pressure,
|
|
|
- PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
- SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
- COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
- REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
|
|
|
- WO = wo[i],
|
|
|
- MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
- MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
- PROCESS_OUTCOME = pressureRes ? "PASS" : "FAIL",
|
|
|
- PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
- CTQ_UNIT_OF_MEASURE = "N",
|
|
|
- ERROR_MESSAGE = pressureRes ? "NA" : "Pressure_Spec OOS",
|
|
|
- PD_ATTR_01 = ProductMainSN[i],
|
|
|
- PD_ATTR_02 = midValue,
|
|
|
- PD_ATTR_03 = "NA",
|
|
|
- PD_ATTR_04 = productSn,
|
|
|
- PD_ATTR_05 = "NA",
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- recordResult = RecordStationResult(i, DFC, ProductMainSN[i], serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds, _LastMesCheckTime[i], stationConfig.SaveCsvPath);
|
|
|
- if (recordResult)
|
|
|
- {
|
|
|
- SendTaskMessage($"{i}:{stationConfig.DeviceName}产品记录保存成功", MessageLevel.Debug);
|
|
|
- //上传数据
|
|
|
- try
|
|
|
- {
|
|
|
- if (stationConfig.EnableMES)
|
|
|
+ (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
|
|
|
+ if (isSuc)
|
|
|
{
|
|
|
- DateTime dt = DateTime.Now;
|
|
|
- string filename = $"{ProductMainSN[i]}_{dt.ToString("yyyyMMddHHmmss")}";
|
|
|
- var device = _configService.GetDeviceInfo();
|
|
|
- var config = _configService.GetSystemConfiguration();
|
|
|
-
|
|
|
- (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
|
|
|
- if (isSuc)
|
|
|
+ LogHelper.WriteLogMes($"上传数据成功");
|
|
|
+ SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
|
+ string filePath = $"D:\\image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
+ //string source_csv2 = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}";
|
|
|
+ if (!Directory.Exists(filePath))
|
|
|
{
|
|
|
- LogHelper.WriteLogMes($"上传数据成功");
|
|
|
- SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
|
- string filePath = $"D:\\image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
- //string source_csv2 = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}";
|
|
|
- if (!Directory.Exists(filePath))
|
|
|
- {
|
|
|
- Directory.CreateDirectory(filePath);
|
|
|
- }
|
|
|
- string csvfilename = $"{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}";
|
|
|
- //复制csv
|
|
|
- string source_csv = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}.csv";
|
|
|
- string target_csv = Path.Combine(filePath, Path.GetFileName(source_csv));
|
|
|
- File.Copy(source_csv, target_csv, true);
|
|
|
- //复制log
|
|
|
- string source_log = $"..\\Log\\LogInfo\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}.txt";
|
|
|
- string target_log = Path.Combine(filePath, Path.GetFileName(source_log));
|
|
|
- File.Copy(source_log, target_log, true);
|
|
|
-
|
|
|
- //判断是否保存锁付曲线
|
|
|
- if (systemConfig.IsSaveScrewCurve)
|
|
|
+ Directory.CreateDirectory(filePath);
|
|
|
+ }
|
|
|
+ string csvfilename = $"{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}";
|
|
|
+ //复制csv
|
|
|
+ string source_csv = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}.csv";
|
|
|
+ string target_csv = Path.Combine(filePath, Path.GetFileName(source_csv));
|
|
|
+ File.Copy(source_csv, target_csv, true);
|
|
|
+ //复制log
|
|
|
+ string source_log = $"..\\Log\\LogInfo\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}.txt";
|
|
|
+ string target_log = Path.Combine(filePath, Path.GetFileName(source_log));
|
|
|
+ File.Copy(source_log, target_log, true);
|
|
|
+
|
|
|
+ //判断是否保存锁付曲线
|
|
|
+ if (systemConfig.IsSaveScrewCurve)
|
|
|
+ {
|
|
|
+ string target_Directory = filePath + "\\扭力曲线\\";
|
|
|
+ string source_Torque_Image = config.ScrewCurvePath + $"\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
+ try
|
|
|
{
|
|
|
- string target_Directory = filePath + "\\扭力曲线\\";
|
|
|
- string source_Torque_Image = config.ScrewCurvePath + $"\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
- try
|
|
|
- {
|
|
|
- var col = Directory.GetFiles(source_Torque_Image);
|
|
|
- Directory.CreateDirectory(target_Directory);
|
|
|
- foreach (var item in col)
|
|
|
- {
|
|
|
- string target_Torque = target_Directory + item.Replace(source_Torque_Image, "");
|
|
|
- File.Copy(item, target_Torque, true);
|
|
|
- }
|
|
|
- }
|
|
|
- //string target_Directory = Path.Combine(filePath, "扭力曲线"); 待测试
|
|
|
- //string source_Torque_Image = config.ScrewCurvePath + $"\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
- //try
|
|
|
- //{
|
|
|
- // var col = Directory.GetFiles(source_Torque_Image);
|
|
|
- // Directory.CreateDirectory(target_Directory);
|
|
|
- // foreach (var item in col)
|
|
|
- // {
|
|
|
- // string fileName = Path.GetFileName(item); // 获取文件名(带后缀)
|
|
|
- // string target_Torque = Path.Combine(target_Directory, fileName); // 拼路径(推荐)
|
|
|
- // File.Copy(item, target_Torque, true);
|
|
|
- // }
|
|
|
- //}
|
|
|
- catch (Exception)
|
|
|
+ var col = Directory.GetFiles(source_Torque_Image);
|
|
|
+ Directory.CreateDirectory(target_Directory);
|
|
|
+ foreach (var item in col)
|
|
|
{
|
|
|
- SendTaskMessage($"扭力曲线图读取失败", MessageLevel.Error);
|
|
|
+ string target_Torque = target_Directory + item.Replace(source_Torque_Image, "");
|
|
|
+ File.Copy(item, target_Torque, true);
|
|
|
}
|
|
|
}
|
|
|
- CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
|
- //上传csv
|
|
|
- bool isAfter20 = dt.Hour >= 20;
|
|
|
- //判断是否是新的一天
|
|
|
- bool isNewDay = dt.Date != _lastCompressDate.Date;
|
|
|
- //当天还没执行过压缩
|
|
|
- if (isAfter20 && isNewDay && !_hasCompressedToday)
|
|
|
+ catch (Exception)
|
|
|
{
|
|
|
- // 执行压缩
|
|
|
- CompressionSingleCsv(source_csv, csvfilename, device.Station, device.FixtureId);
|
|
|
- _lastCompressDate = dt;
|
|
|
- _hasCompressedToday = true;
|
|
|
- LogHelper.WriteLogMes("csv上传数据成功");
|
|
|
- SendTaskMessage($"csv上传数据成功", MessageLevel.Debug);
|
|
|
+ SendTaskMessage($"扭力曲线图读取失败", MessageLevel.Error);
|
|
|
}
|
|
|
- // 跨天后重置当天执行标记
|
|
|
- if (!isNewDay && _hasCompressedToday)
|
|
|
- {
|
|
|
- _hasCompressedToday = false;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
- else
|
|
|
+ CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
|
+ //上传csv
|
|
|
+ bool isAfter20 = dt.Hour >= 20;
|
|
|
+ //判断是否是新的一天
|
|
|
+ bool isNewDay = dt.Date != _lastCompressDate.Date;
|
|
|
+ //当天还没执行过压缩
|
|
|
+ if (isAfter20 && isNewDay && !_hasCompressedToday)
|
|
|
{
|
|
|
- LogHelper.WriteLogMes($"上传数据失败");
|
|
|
- SendTaskMessage($"上传数据失败", MessageLevel.Error);
|
|
|
+ // 执行压缩
|
|
|
+ CompressionSingleCsv(source_csv, csvfilename, device.Station, device.FixtureId);
|
|
|
+ _lastCompressDate = dt;
|
|
|
+ _hasCompressedToday = true;
|
|
|
+ LogHelper.WriteLogMes("csv上传数据成功");
|
|
|
+ SendTaskMessage($"csv上传数据成功", MessageLevel.Debug);
|
|
|
}
|
|
|
+ // 跨天后重置当天执行标记
|
|
|
+ if (!isNewDay && _hasCompressedToday)
|
|
|
+ {
|
|
|
+ _hasCompressedToday = false;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LogHelper.WriteLogMes($"未启用mes");
|
|
|
- SendTaskMessage($"未启用mes", MessageLevel.Error);
|
|
|
+ LogHelper.WriteLogMes($"上传数据失败");
|
|
|
+ SendTaskMessage($"上传数据失败", MessageLevel.Error);
|
|
|
}
|
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
+ else
|
|
|
{
|
|
|
- SendTaskMessage($"上传数据时出错:{ex.Message}", MessageLevel.Error);
|
|
|
- LogHelper.WriteLogError($"上传数据时出错", ex);
|
|
|
+ LogHelper.WriteLogMes($"未启用mes");
|
|
|
+ SendTaskMessage($"未启用mes", MessageLevel.Error);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- SendTaskMessage($"{i}:{stationConfig.DeviceName}产品记录保存失败", MessageLevel.Error);
|
|
|
+ SendTaskMessage($"上传数据时出错:{ex.Message}", MessageLevel.Error);
|
|
|
+ LogHelper.WriteLogError($"上传数据时出错", ex);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SendTaskMessage($"{i}:{stationConfig.DeviceName}工位未配置保存路径,无法保存产品记录", MessageLevel.Error);
|
|
|
+ SendTaskMessage($"{i}:{stationConfig.DeviceName}产品记录保存失败", MessageLevel.Error);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SendTaskMessage($"{i}:{stationConfig.DeviceName}工位未配置保存产品记录", MessageLevel.Debug);
|
|
|
+ SendTaskMessage($"{i}:{stationConfig.DeviceName}工位未配置保存路径,无法保存产品记录", MessageLevel.Error);
|
|
|
}
|
|
|
-
|
|
|
- WriteProductLog(lockResultsAll, ProductMainSN[i], CTtime);
|
|
|
-
|
|
|
- LogHelper.WriteLogMes($"【mes结束ADD】");
|
|
|
- SendTaskMessage($"mes结束ADD", MessageLevel.Info);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
+ SendTaskMessage($"{i}:{stationConfig.DeviceName}工位未配置保存产品记录", MessageLevel.Debug);
|
|
|
}
|
|
|
+ WriteProductLog(lockResultsAll, ProductMainSN[i], CTtime);
|
|
|
+ mes_cc.Clear();
|
|
|
+ LogHelper.WriteLogMes($"【mes结束ADD】");
|
|
|
+ SendTaskMessage($"mes结束ADD", MessageLevel.Info);
|
|
|
}
|
|
|
else
|
|
|
{
|