|
|
@@ -1290,13 +1290,13 @@ namespace TeamAAS_VP.Core
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- //获取产品编码
|
|
|
- _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);
|
|
|
|
|
|
@@ -1883,7 +1883,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetDistance(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.distance.Split(',')[0] == "1")
|
|
|
{
|
|
|
mes_cc.Clear();
|
|
|
@@ -2270,6 +2270,10 @@ namespace TeamAAS_VP.Core
|
|
|
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="));
|
|
|
@@ -2327,6 +2331,10 @@ namespace TeamAAS_VP.Core
|
|
|
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="));
|
|
|
@@ -2358,6 +2366,8 @@ namespace TeamAAS_VP.Core
|
|
|
// 上传本站数据
|
|
|
else if (state == 2)
|
|
|
{
|
|
|
+ DFC.Clear();
|
|
|
+
|
|
|
//获取当前工位的配置
|
|
|
var stationConfig = _configService.GetDeviceInfo(i);
|
|
|
SendTaskMessage($"收到{i}:{stationConfig.DeviceName}上传本站数据请求...", MessageLevel.Debug);
|
|
|
@@ -2381,7 +2391,7 @@ namespace TeamAAS_VP.Core
|
|
|
assemblyRecord.AssemblyDurationSeconds = ct;
|
|
|
assemblyRecord.AssemblyPressure = pressure;
|
|
|
assemblyRecord.DeviceId = i;
|
|
|
- assemblyRecord.DeviceName = $"";
|
|
|
+ assemblyRecord.DeviceName = stationConfig.DeviceName;
|
|
|
assemblyRecord.OperatorName = _systemDatabaseService.GetCurrentUser().UserName;
|
|
|
assemblyRecord.Success = resultIndex == 1 ? true : false;
|
|
|
assemblyRecord.DownCameraCoord1 = "";
|
|
|
@@ -2454,33 +2464,53 @@ namespace TeamAAS_VP.Core
|
|
|
//判断锁付路径字符串是否为空,如果不为空则保存,否则不保存
|
|
|
if (!string.IsNullOrEmpty(stationConfig.SaveCsvPath))
|
|
|
{
|
|
|
- var cdata = _configService.GetCTQDataInfo();//获取ctq数据参数
|
|
|
bool assyPress = resultIndex == 1 ? true : false;
|
|
|
+ var pre = FileHelper.ReadJsonFile<PressureModel>(FilePath.PressureParamterConfigPath);
|
|
|
DFC.Clear();
|
|
|
DFC.Add(new DataFormCtq
|
|
|
{
|
|
|
PPID = ProductMainSN[i],
|
|
|
- PROCESS_NAME = cdata.PROCESS_NAME,
|
|
|
- PROCESS_START_TIME = StartCtqTime.ToString(),
|
|
|
+ PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
+ PROCESS_START_TIME = _LastMesCheckTime[i].ToString(),
|
|
|
CTQ_NAME = "CC",
|
|
|
CTQ_VALUE = cc.Replace(",", ";"),
|
|
|
//CTQ_VALUE = 0,
|
|
|
- CTQ_LSL = 0,
|
|
|
- CTQ_USL = 10,
|
|
|
- PROCESS_END_TIME = DateTime.Now.ToString(),
|
|
|
- SUPPLIER_NAME = cdata.SUPPLIER_NAME,
|
|
|
- COMMODITY_TYPE = cdata.COMMODITY_TYPE,
|
|
|
- REVISION = cdata.REVISION,
|
|
|
+ CTQ_LSL = "",
|
|
|
+ CTQ_USL = "",
|
|
|
+ PROCESS_END_TIME = serverTimeResult.Now.ToString(),
|
|
|
+ SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
+ COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
+ REVISION = stationConfig.DataInfo.REVISION,
|
|
|
WO = wo[i],
|
|
|
- MFG_LOT = cdata.MFG_LOT,
|
|
|
- MFG_ASSY_LINE = cdata.MFG_ASSY_LINE,
|
|
|
- PROCESS_OUTCOME = assyPress ? "PASS" : "FAIL",
|
|
|
- PROCESS_MACHINE_ID = cdata.PROCESS_MACHINE_ID,
|
|
|
+ MFG_LOT = stationConfig.DataInfo.MFG_LOT,
|
|
|
+ MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
|
|
|
+ PROCESS_OUTCOME = "PASS",
|
|
|
+ PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
|
|
|
CTQ_UNIT_OF_MEASURE = "mm",
|
|
|
ERROR_MESSAGE = assyPress ? "" : "CC OOS"
|
|
|
});
|
|
|
-
|
|
|
- bool recordResult = RecordStationResult(i, DFC[0], ProductMainSN[i], serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds, _LastMesCheckTime[i], stationConfig.SaveCsvPath);
|
|
|
+ DFC.Add(new DataFormCtq
|
|
|
+ {
|
|
|
+ PPID = code,
|
|
|
+ PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
|
|
|
+ PROCESS_START_TIME = _LastMesCheckTime[i].ToString(),
|
|
|
+ CTQ_NAME = "Assy_Pressure",
|
|
|
+ CTQ_VALUE = Math.Round(double.Parse(assypress), 3).ToString(),
|
|
|
+ CTQ_LSL = pre.PressureDownLimit.ToString("F3"),
|
|
|
+ CTQ_USL = pre.PressureUpLimit.ToString("F3"),
|
|
|
+ PROCESS_END_TIME = serverTimeResult.Now.ToString(),
|
|
|
+ SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
+ COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
+ REVISION = stationConfig.DataInfo.REVISION,
|
|
|
+ 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 = "kg",
|
|
|
+ ERROR_MESSAGE = assyPress ? "" : "Assy_Pressure OOS"
|
|
|
+ });
|
|
|
+ bool recordResult = RecordStationResult(i, DFC, ProductMainSN[i], serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds, _LastMesCheckTime[i], stationConfig.SaveCsvPath);
|
|
|
if (recordResult)
|
|
|
{
|
|
|
SendTaskMessage($"{i}:{stationConfig.DeviceName}产品记录保存成功", MessageLevel.Debug);
|
|
|
@@ -2880,14 +2910,14 @@ namespace TeamAAS_VP.Core
|
|
|
/// 记录工位的结果,其他工位要存储的数据项按照键值对集合的形式传入,键为数据项名称,值为数据项的值
|
|
|
/// </summary>
|
|
|
/// <param name="stationIndex"></param>
|
|
|
- /// <param name="dfc"></param>
|
|
|
+ /// <param name="dfcs"></param>
|
|
|
/// <param name="productMainSN"></param>
|
|
|
/// <param name="ct"></param>
|
|
|
/// <param name="timestamp"></param>
|
|
|
/// <param name="savePath"></param>
|
|
|
/// <param name="isFirstEnter"></param>
|
|
|
/// <returns></returns>
|
|
|
- private bool RecordStationResult(int stationIndex, DataFormCtq dfc, string productMainSN, double ct, DateTime timestamp, string savePath, bool isFirstEnter = true)
|
|
|
+ private bool RecordStationResult(int stationIndex, IEnumerable<DataFormCtq> dfcs, string productMainSN, double ct, DateTime timestamp, string savePath, bool isFirstEnter = true)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
@@ -2925,8 +2955,15 @@ namespace TeamAAS_VP.Core
|
|
|
"MFG_ASSY_LINE,PROCESS_OUTCOME,PROCESS_MACHINE_ID,CTQ_UNIT_OF_MEASURE,ERROR_MESSAGE");
|
|
|
sb.AppendLine();
|
|
|
}
|
|
|
- sb.Append($"{dfc.PPID},{dfc.PROCESS_NAME},{dfc.PROCESS_START_TIME},{dfc.CTQ_NAME},{dfc.CTQ_VALUE},{dfc.CTQ_LSL},{dfc.CTQ_USL},{dfc.PROCESS_END_TIME},{dfc.SUPPLIER_NAME},{dfc.COMMODITY_TYPE},{dfc.REVISION},{dfc.WO},{dfc.MFG_LOT},{dfc.MFG_ASSY_LINE},{dfc.PROCESS_OUTCOME},{dfc.PROCESS_MACHINE_ID},{dfc.CTQ_UNIT_OF_MEASURE},{dfc.ERROR_MESSAGE}");
|
|
|
- sb.AppendLine();
|
|
|
+ if (dfcs == null || dfcs.Count() == 0)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ foreach (var dfc in dfcs)
|
|
|
+ {
|
|
|
+ sb.Append($"{dfc.PPID},{dfc.PROCESS_NAME},{dfc.PROCESS_START_TIME},{dfc.CTQ_NAME},{dfc.CTQ_VALUE},{dfc.CTQ_LSL},{dfc.CTQ_USL},{dfc.PROCESS_END_TIME},{dfc.SUPPLIER_NAME},{dfc.COMMODITY_TYPE},{dfc.REVISION},{dfc.WO},{dfc.MFG_LOT},{dfc.MFG_ASSY_LINE},{dfc.PROCESS_OUTCOME},{dfc.PROCESS_MACHINE_ID},{dfc.CTQ_UNIT_OF_MEASURE},{dfc.ERROR_MESSAGE}");
|
|
|
+ sb.AppendLine();
|
|
|
+ }
|
|
|
// 使用 StreamWriter 以追加模式打开文件
|
|
|
StreamWriter sw = new StreamWriter(fullPath, true, Encoding.UTF8);
|
|
|
sw.Write(sb.ToString());
|
|
|
@@ -2946,7 +2983,7 @@ namespace TeamAAS_VP.Core
|
|
|
string datePath = timestamp.ToString("yyyy-MM") + "\\";
|
|
|
string tempDirPath = Path.Combine(savePath, datePath, $"{stationIndex}_{timestamp.ToString("yyyy-MM-dd")}_temp");
|
|
|
string tempFileName = $"{stationIndex}_{timestamp.ToString("yyyy-MM-dd_HH-mm-ss-fff")}_temp.csv";
|
|
|
- RecordStationResult(stationIndex, dfc, productMainSN, ct, timestamp, tempFileName, false);
|
|
|
+ RecordStationResult(stationIndex, dfcs, productMainSN, ct, timestamp, tempFileName, false);
|
|
|
return false;
|
|
|
}
|
|
|
}
|