|
|
@@ -1163,6 +1163,19 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
//订阅PLC地址变化
|
|
|
plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger);
|
|
|
+ // 2. 监听重连事件,重连成功后自动重新订阅
|
|
|
+ plc.ConnectChangedEvent -= Plc_ConnectChanged; // 防止重复注册
|
|
|
+ plc.ConnectChangedEvent += Plc_ConnectChanged;
|
|
|
+
|
|
|
+ // 定义重连处理方法(写在同一个类里即可)
|
|
|
+ void Plc_ConnectChanged(object sender, bool isConnected)
|
|
|
+ {
|
|
|
+ if (isConnected)
|
|
|
+ {
|
|
|
+ // 重连成功后,重新订阅节点
|
|
|
+ plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -1237,14 +1250,41 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
await item.WriteToPlcAddress(addressConfig.Out_RemovePos, plc);
|
|
|
}
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_RemoveNum.Address, (Int16)current.RemovePoints.Count);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_RemoveNum.Address, (Int16)0);
|
|
|
+ }
|
|
|
+ //if (current.PressurePlacePoints != null && current.PressurePlacePoints.Count > 0)
|
|
|
+ //{
|
|
|
+ // foreach (var item in current.PressurePlacePoints)
|
|
|
+ // {
|
|
|
+ // await item.WriteToPlcAddress(addressConfig.Out_PressurePlace, plc);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ if (current.CameraCodePlcPoints != null && current.CameraCodePlcPoints.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item in current.CameraCodePlcPoints)
|
|
|
+ {
|
|
|
+ await item.WriteToPlcAddress(addressConfig.Out_Photo_Positipn, plc);
|
|
|
+ }
|
|
|
}
|
|
|
- if (current.PressurePlacePoints != null && current.PressurePlacePoints.Count > 0)
|
|
|
+ if (current.ProductPlacePoints != null && current.ProductPlacePoints.Count > 0)
|
|
|
{
|
|
|
- foreach (var item in current.PressurePlacePoints)
|
|
|
+ foreach (var item in current.ProductPlacePoints)
|
|
|
{
|
|
|
- await item.WriteToPlcAddress(addressConfig.Out_PressurePlace, plc);
|
|
|
+ await item.WriteToPlcAddress(addressConfig.Out_ProductPlace_Positipn, plc);
|
|
|
}
|
|
|
}
|
|
|
+ if (current.GunPressurePoints != null && current.GunPressurePoints.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item in current.GunPressurePoints)
|
|
|
+ {
|
|
|
+ await item.WriteToPlcAddress(addressConfig.Out_GunPressure_Positipn, plc);
|
|
|
+ }
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_GunYaNum.Address, (Int16)current.GunPressurePoints.Count);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -1341,6 +1381,8 @@ namespace TeamAAS_VP.Core
|
|
|
string[] color = new string[10];//产品color
|
|
|
string[] ppid = new string[10];//产品ppid
|
|
|
string[] revision { get; set; } = new string[10];//产品revision
|
|
|
+
|
|
|
+ List<string> resultToMes { get; set; }=new List<string>();
|
|
|
/// <summary>
|
|
|
/// 二次定位相机的工具坐标
|
|
|
/// </summary>
|
|
|
@@ -1513,6 +1555,8 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
float toolX = (float)(visionResults[0].X + visionResults[1].X) / 2;
|
|
|
float toolY = (float)(visionResults[0].Y + visionResults[1].Y) / 2;
|
|
|
+ SendTaskMessage($"流程1相机拍照结果: {visionResults[0].X:F3},{visionResults[0].Y:F3}", MessageLevel.Info);
|
|
|
+ SendTaskMessage($"流程2相机拍照结果: {visionResults[1].X:F3},{visionResults[1].Y:F3}", MessageLevel.Info);
|
|
|
_FixedUpCameraAngle = Common.CalculateAngleBetweenPointsDegrees(new PointF((float)visionResults[0].X, (float)visionResults[0].Y), new PointF((float)visionResults[1].X, (float)visionResults[1].Y));
|
|
|
DowmCameraResults[cameraIndex] = new OpenCvSharp.Point3f(toolX, toolY, (float)_FixedUpCameraAngle);
|
|
|
DownTool = new PointF(toolX, toolY);
|
|
|
@@ -2226,6 +2270,7 @@ namespace TeamAAS_VP.Core
|
|
|
upCameraX = (UpCameraPutResults[1].X + UpCameraPutResults[2].X) / 2;
|
|
|
upCameraY = (UpCameraPutResults[1].Y + UpCameraPutResults[2].Y) / 2;
|
|
|
upCameraU = Common.CalculateAngleBetweenPointsDegrees(new PointF((float)UpCameraPutResults[1].X, (float)UpCameraPutResults[1].Y), new PointF((float)UpCameraPutResults[2].X, (float)UpCameraPutResults[2].Y));
|
|
|
+ SendTaskMessage($"移动相机拍照壳体中心结果: {upCameraX:F3},{upCameraY:F3},{upCameraU:F3}", MessageLevel.Info);
|
|
|
}
|
|
|
|
|
|
var point = currentProduct.ScrewPoints[0].Clone();
|
|
|
@@ -2472,11 +2517,65 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
|
|
|
+
|
|
|
+
|
|
|
+ //var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
|
|
|
+ var code = "";
|
|
|
string comp = "";
|
|
|
//过站请求
|
|
|
if (state == 1)
|
|
|
{
|
|
|
+ if (state == 1)
|
|
|
+ {
|
|
|
+ SendTaskMessage("收到PLC二维码拍照请求", MessageLevel.Debug);
|
|
|
+ // 四、几个非常重要的细节(工程级)
|
|
|
+ //1.Reset() 一定在发送命令前
|
|
|
+ //_scanDoneEvent.Reset();
|
|
|
+ //否则:
|
|
|
+ //上一次扫码的 Set() 还在
|
|
|
+ //本次 Wait() 会直接通过(严重 bug)
|
|
|
+ // 2.Wait() 不要直接在 UI 线程
|
|
|
+ //你这里是 async,用:
|
|
|
+ //await Task.Run(() => _scanDoneEvent.Wait(3000));
|
|
|
+ ScanValue = "";
|
|
|
+ _scanDoneEvent.Reset(); // 重要:先关门
|
|
|
+
|
|
|
+ await Scan_Client.SendAsync("T");
|
|
|
+
|
|
|
+ // 等待扫码结果,最多 3 秒
|
|
|
+ bool scanOk = await Task.Run(() => _scanDoneEvent.Wait(3000));
|
|
|
+
|
|
|
+ if (scanOk && !ScanValue.IsNullOrWhiteSpace()&& ScanValue.Length>5)
|
|
|
+ {
|
|
|
+ PartSN = ScanValue;
|
|
|
+ code = PartSN;
|
|
|
+ //await plc.WriteNodeAsync(addressConfig.Out_PartCode.Address, PartSN);
|
|
|
+ SendTaskMessage($"二维码拍照成功,接收到值:{ScanValue}", MessageLevel.Info);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_PartCode.Address), PartSN);
|
|
|
+ //var stationConfig2 = _configService.GetDeviceInfo(0);
|
|
|
+ //if (stationConfig2.EnableMES)
|
|
|
+ //{
|
|
|
+ // (bool isSuccess, string response) = await _mesService.StationGetExAsync(0, PartSN, "", 2);//询问零件码,是否可以使用
|
|
|
+ // if (!isSuccess)//如果二维码已使用,则返回false
|
|
|
+ // {
|
|
|
+ // //await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
|
+ // await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SendTaskMessage($"二维码拍照失败或超时:{ScanValue}", MessageLevel.Alarm);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+ //await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (short)2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
|
|
|
+ }
|
|
|
+
|
|
|
//获取过站时间
|
|
|
_LastMesCheckTime[i] = (await _mesService.GetServerTimeAsync(i, code, 2)).Now;
|
|
|
|
|
|
@@ -2589,7 +2688,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知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)3);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -2599,7 +2698,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知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)3);
|
|
|
}
|
|
|
LogHelper.WriteLogMes($"【mes结束QUERY】");
|
|
|
SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
|
|
|
@@ -2695,7 +2794,7 @@ namespace TeamAAS_VP.Core
|
|
|
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);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
}
|
|
|
LogHelper.WriteLogMes($"【mes结束QUERY】");
|
|
|
SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
|
|
|
@@ -2736,6 +2835,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
//读取产品结果
|
|
|
Int16 resultIndex = plc.ReadNode<Int16>(string.Format(addressConfig.In_Result.Address, i));
|
|
|
+ SendTaskMessage($"读取PLC结果为{resultIndex}",MessageLevel.Debug);
|
|
|
//读取压力值
|
|
|
float pressure = plc.ReadNode<float>(string.Format(addressConfig.In_PressureValue.Address, i));
|
|
|
|
|
|
@@ -2796,66 +2896,106 @@ namespace TeamAAS_VP.Core
|
|
|
//data.Add("CC1", mes_cc["2"]);
|
|
|
//SendTaskMessage($"CC1:{mes_cc["1"]},CC2:{mes_cc["2"]}", MessageLevel.Info);
|
|
|
assypress = currentPressure[i].ToString("F2");
|
|
|
+
|
|
|
SendTaskMessage($"cc:{cc},组装压力:{assypress}", MessageLevel.Debug);
|
|
|
+
|
|
|
#region CSV数据
|
|
|
DFC.Clear();
|
|
|
bool assyPress = resultIndex == 1 ? true : false;
|
|
|
+ bool cc1result = true; bool cc2result = true;
|
|
|
string midValue = "NA", saveppid = "NA";
|
|
|
- midValue = ((currentProduct.GlobalParamEx.CC1DownLimit + currentProduct.GlobalParamEx.CC1UpLimit) / 2).ToString("F3");
|
|
|
+
|
|
|
+ // midValue = ((currentProduct.GlobalParamEx.CC1DownLimit + currentProduct.GlobalParamEx.CC1UpLimit) / 2).ToString("F3");
|
|
|
if (stationConfig.SaveCsvPPID) saveppid = ppid[i];
|
|
|
- DFC.Add(new DataFormCtq
|
|
|
- {
|
|
|
- PPID = saveppid,
|
|
|
- PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
- PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
- CTQ_NAME = "CC1",
|
|
|
- CTQ_VALUE = mes_cc["1"],
|
|
|
- CTQ_LSL = currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3"),
|
|
|
- CTQ_USL = currentProduct.GlobalParamEx.CC1UpLimit.ToString("F3"),
|
|
|
- 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 = assyPress ? "Pass" : "Fail",
|
|
|
- PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
- CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
- ERROR_MESSAGE = assyPress ? "NA" : "CC OOS",
|
|
|
- PD_ATTR_01 = ProductMainSN[i],
|
|
|
- PD_ATTR_02 = midValue,
|
|
|
- PD_ATTR_03 = PartSN,
|
|
|
- PD_ATTR_04 = code,
|
|
|
- PD_ATTR_05 = "NA",
|
|
|
- });
|
|
|
- midValue = ((currentProduct.GlobalParamEx.CC2DownLimit + currentProduct.GlobalParamEx.CC2UpLimit) / 2).ToString("F3");
|
|
|
- DFC.Add(new DataFormCtq
|
|
|
+ //if (mes_cc.Keys.Contains("1"))
|
|
|
+ //{
|
|
|
+ // if (Convert.ToDouble(mes_cc["1"]) < Convert.ToDouble(currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3")) || Convert.ToDouble(mes_cc["1"]) > Convert.ToDouble(currentProduct.GlobalParamEx.CC1UpLimit.ToString("F3")))
|
|
|
+ // {
|
|
|
+ // if (!resultToMes.Contains("CC1_Fail"))
|
|
|
+ // {
|
|
|
+ // resultToMes.Add($"CC1_Fail");
|
|
|
+ // }
|
|
|
+ // cc1result = false;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //if (mes_cc.Keys.Contains("2"))
|
|
|
+ //{
|
|
|
+ // if (Convert.ToDouble(mes_cc["2"]) < Convert.ToDouble(currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3")) || Convert.ToDouble(mes_cc["2"]) > Convert.ToDouble(currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3")))
|
|
|
+ // {
|
|
|
+ // if (!resultToMes.Contains("CC2_Fail"))
|
|
|
+ // {
|
|
|
+ // resultToMes.Add($"CC2_Fail");
|
|
|
+ // }
|
|
|
+ // cc2result = false;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ if (Convert.ToDouble(Math.Round(double.Parse(assypress), 3).ToString())<Convert.ToDouble(currentProduct.GlobalParamEx.DownPressure.PressureDownLimit.ToString("F3"))|| Convert.ToDouble(Math.Round(double.Parse(assypress), 3).ToString())>Convert.ToDouble(currentProduct.GlobalParamEx.DownPressure.PressureUpLimit.ToString("F3")))
|
|
|
{
|
|
|
- PPID = saveppid,
|
|
|
- PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
- PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
- CTQ_NAME = "CC2",
|
|
|
- CTQ_VALUE = mes_cc["2"],
|
|
|
- CTQ_LSL = currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3"),
|
|
|
- CTQ_USL = currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3"),
|
|
|
- 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 = assyPress ? "Pass" : "Fail",
|
|
|
- PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
- CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
- ERROR_MESSAGE = assyPress ? "NA" : "CC OOS",
|
|
|
- PD_ATTR_01 = ProductMainSN[i],
|
|
|
- PD_ATTR_02 = midValue,
|
|
|
- PD_ATTR_03 = PartSN,
|
|
|
- PD_ATTR_04 = code,
|
|
|
- PD_ATTR_05 = "NA",
|
|
|
- });
|
|
|
+ if (!resultToMes.Contains("Assy_Pressure_Fail"))
|
|
|
+ {
|
|
|
+ resultToMes.Add($"Assy_Pressure_Fail");
|
|
|
+ }
|
|
|
+ //assyPress = false;
|
|
|
+ }
|
|
|
+ //if (mes_cc.Keys.Contains("1"))
|
|
|
+ //{
|
|
|
+ // DFC.Add(new DataFormCtq
|
|
|
+ // {
|
|
|
+ // PPID = saveppid,
|
|
|
+ // PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
+ // PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ // CTQ_NAME = "CC1",
|
|
|
+ // CTQ_VALUE = mes_cc["1"],
|
|
|
+ // CTQ_LSL = currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3"),
|
|
|
+ // CTQ_USL = currentProduct.GlobalParamEx.CC1UpLimit.ToString("F3"),
|
|
|
+ // 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 = cc1result ? "Pass" : "Fail",
|
|
|
+ // PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
+ // CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
+ // ERROR_MESSAGE = cc1result ? "NA" : "CC1 OOS",
|
|
|
+ // PD_ATTR_01 = ProductMainSN[i],
|
|
|
+ // PD_ATTR_02 = midValue,
|
|
|
+ // PD_ATTR_03 = PartSN,
|
|
|
+ // PD_ATTR_04 = code,
|
|
|
+ // PD_ATTR_05 = "NA",
|
|
|
+ // });
|
|
|
+ //}
|
|
|
+ //if (mes_cc.Keys.Contains("2"))
|
|
|
+ //{
|
|
|
+ // midValue = ((currentProduct.GlobalParamEx.CC2DownLimit + currentProduct.GlobalParamEx.CC2UpLimit) / 2).ToString("F3");
|
|
|
+ // DFC.Add(new DataFormCtq
|
|
|
+ // {
|
|
|
+ // PPID = saveppid,
|
|
|
+ // PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
+ // PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
+ // CTQ_NAME = "CC2",
|
|
|
+ // CTQ_VALUE = mes_cc["2"],
|
|
|
+ // CTQ_LSL = currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3"),
|
|
|
+ // CTQ_USL = currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3"),
|
|
|
+ // 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 = cc2result ? "Pass" : "Fail",
|
|
|
+ // PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
+ // CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
+ // ERROR_MESSAGE = cc2result ? "NA" : "CC2 OOS",
|
|
|
+ // PD_ATTR_01 = ProductMainSN[i],
|
|
|
+ // PD_ATTR_02 = midValue,
|
|
|
+ // PD_ATTR_03 = PartSN,
|
|
|
+ // PD_ATTR_04 = code,
|
|
|
+ // PD_ATTR_05 = "NA",
|
|
|
+ // });
|
|
|
+ //}
|
|
|
midValue = ((currentProduct.GlobalParamEx.DownPressure.PressureDownLimit + currentProduct.GlobalParamEx.DownPressure.PressureUpLimit) / 2).ToString("F3");
|
|
|
DFC.Add(new DataFormCtq
|
|
|
{
|
|
|
@@ -2885,7 +3025,7 @@ namespace TeamAAS_VP.Core
|
|
|
});
|
|
|
#endregion
|
|
|
//cc-复检cc,assypress-组装站压力
|
|
|
- (bool isSuccess, string response) = await _mesService.SubmitGetAsync(i, ProductMainSN[i], comp, cc, assypress, resultIndex == 1 ? true : false, _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
+ (bool isSuccess, string response) = await _mesService.SubmitGetAsync(i, ProductMainSN[i], comp, resultToMes, cc, assypress, resultIndex == 1 ? true : false, _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
if (!stationConfig.EnableMES || isSuccess)
|
|
|
{
|
|
|
LogHelper.WriteLogMes($"上传mes成功");
|
|
|
@@ -2896,8 +3036,8 @@ namespace TeamAAS_VP.Core
|
|
|
LogHelper.WriteLogMes($"上传mes失败");
|
|
|
SendTaskMessage($"上传mes失败", MessageLevel.Error);
|
|
|
}
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
|
|
|
-
|
|
|
|
|
|
//是否保存当前的产品记录至CSV?
|
|
|
if (stationConfig.SaveCsv)
|
|
|
@@ -2920,11 +3060,10 @@ namespace TeamAAS_VP.Core
|
|
|
var device = _configService.GetDeviceInfo(i);
|
|
|
var systemConfig = _configService.GetSystemConfiguration();
|
|
|
var pressureSensorConfig = systemConfig.PressureSensorConfig.FirstOrDefault();
|
|
|
- (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
|
|
|
- if (isSuc)
|
|
|
+ //(bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
|
|
|
+ if (true)
|
|
|
{
|
|
|
- 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))
|
|
|
@@ -2952,7 +3091,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
string target_Torque = target_Directory + item.Replace(source_Torque_Image, "");
|
|
|
File.Copy(item, target_Torque, true);
|
|
|
- SendTaskMessage($"曲线图{i}保存成功", MessageLevel.Error);
|
|
|
+ SendTaskMessage($"曲线图{i}保存成功", MessageLevel.Debug);
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
@@ -2962,6 +3101,8 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
|
|
|
CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
|
+ LogHelper.WriteLogMes($"上传数据成功");
|
|
|
+ SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
|
|
|
|
//上传csv
|
|
|
bool isAfter20 = dt.Hour >= 20;
|
|
|
@@ -2985,8 +3126,8 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LogHelper.WriteLogMes($"上传数据失败");
|
|
|
- SendTaskMessage($"上传数据失败", MessageLevel.Error);
|
|
|
+ // LogHelper.WriteLogMes($"上传数据失败");
|
|
|
+ //SendTaskMessage($"上传数据失败", MessageLevel.Error);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -3015,10 +3156,10 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
SendTaskMessage($"{i}:{stationConfig.DeviceName}工位未配置保存产品记录", MessageLevel.Debug);
|
|
|
}
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
LogHelper.WriteLogMes($"【mes结束ADD】");
|
|
|
SendTaskMessage($"mes结束ADD", MessageLevel.Info);
|
|
|
mes_cc.Clear();
|
|
|
+ resultToMes.Clear();
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
|
@@ -3075,6 +3216,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
if (state == 1)
|
|
|
{
|
|
|
+
|
|
|
SendTaskMessage($"收到停止压力信号[{i}]...", MessageLevel.Debug);
|
|
|
//获取当前锁付点
|
|
|
//var screwPoint = currentProduct.ScrewPoints.FirstOrDefault(p => p.Number == positionIndex);
|
|
|
@@ -3233,7 +3375,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- float pressure = plc.ReadNode<float>(string.Format(addressConfig.In_CurPressureValue.Address, Index));
|
|
|
+ float pressure = plc.ReadNode<float>(string.Format(addressConfig.In_CurPressureValue.Address, Index+1));
|
|
|
lock (_pressureSamples[Index])
|
|
|
{
|
|
|
_pressureSamples[Index].Add((DateTime.Now, pressure));
|