| | |
| | | /// <summary> |
| | | /// 工序完成 |
| | | /// </summary> |
| | | public class DataCaptureHandler_05: DataCaptureHandler |
| | | public class DataCaptureHandler_05 : DataCaptureHandler |
| | | { |
| | | public static readonly DataCaptureHandler_05 Instance = new DataCaptureHandler_05(); |
| | | |
| | |
| | | wplog.CreatedTime = DateTimeHelper.GetDateTime(); |
| | | wplog.CreatedUserName = DataCapturePointCode; |
| | | wplog.UpdatedTime = DateTimeHelper.GetDateTime(); |
| | | wplog.UpdatedUserName = Environment.MachineName+"自动" + Thread.CurrentThread.ManagedThreadId.ToString(); |
| | | wplog.UpdatedUserName = Environment.MachineName + "自动" + Thread.CurrentThread.ManagedThreadId.ToString(); |
| | | wplog.IsDeleted = false; |
| | | foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode)) |
| | | { |
| | |
| | | } |
| | | set.SetValue(wplog, valuecol);//给动态字段赋值 |
| | | } |
| | | catch(Exception setex) |
| | | catch (Exception setex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(_dataCaptureConfig.WorkingProcedure), $" {DataCapturePointCode}工序监控读码标记 读取工件码动态赋值【{_dataCaptureConfig.WorkingProcedure ?? "空字符串"}】异常{wplog.Id},赋值列名[{col.DataCaptureColumnTabelName ?? "空字符串"}]", setex); |
| | | } |
| | |
| | | { |
| | | files.Add((FileInfo)file); |
| | | } |
| | | files = files.OrderByDescending(o => o.LastWriteTime).ToList(); |
| | | files = files.OrderByDescending(o => o.LastWriteTime).ToList(); |
| | | Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"OP80下线完成读取到文件{files.Count()}个工件{wplog.WorkPieceID} 时间{fileFindTime.Value.ToString()}"); |
| | | |
| | | foreach (var file in files) |
| | | {//取倒序匹配的文件名为工件号的文件 |
| | | if (file.Name.Contains(wplog.WorkPieceID)) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"OP80下线完成读取到文件{file.Name},是指定的工件"); |
| | | Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"OP80下线完成读取到文件{file.Name},是指定的工件{wplog.WorkPieceID}"); |
| | | |
| | | var datatable = CSVHelper.ReadCSVList(file.FullName); |
| | | List<string> rowFirst = new List<string>(); |
| | |
| | | { |
| | | rowFirst = datatable[0].Split(',').ToList(); |
| | | rowSecond = datatable[1].Split(',').ToList(); |
| | | if(rowSecond.Count<11) |
| | | if (rowSecond.Count < 11) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | item.下限 = rowSecond[9 + i * 10]; |
| | | item.状态 = rowSecond[10 + i * 10]; |
| | | oP80Info.OP80ItemInfolist.Add(item); |
| | | if(item.名称.Equals("Weight Class") || item.名称.Equals("Weight Small End") |
| | | || item.名称.Equals("Weight Big End") || item.名称.Equals("Dime Small_End Class") |
| | | if (item.名称.Equals("Weight Class") || item.名称.Equals("Weight Small End") |
| | | || item.名称.Equals("Weight Big End") || item.名称.Equals("Dime Small_End Class") |
| | | || item.名称.Equals("Dime Big_End Class")) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | if(!string.IsNullOrEmpty(item.状态)) |
| | | if (!string.IsNullOrEmpty(item.状态)) |
| | | { |
| | | oP80Info.OP80ItemStatusInfolist.Add(item); |
| | | } |
| | | } |
| | | } |
| | | if(oP80Info.OP80ItemStatusInfolist.Count>0) |
| | | if (oP80Info.OP80ItemStatusInfolist.Count > 0) |
| | | { |
| | | if(oP80Info.OP80ItemStatusInfolist.Any(o=>!o.状态.Equals("OK"))) |
| | | if (oP80Info.OP80ItemStatusInfolist.Any(o => !o.状态.Equals("OK"))) |
| | | { |
| | | wplog.QualityStateStr = "NG"; |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | catch(Exception ex) |
| | | catch (Exception ex) |
| | | { |
| | | threadStatusMonitor.ErrorMsg = $" {RandomHelper.GenerateRandomCode(4)} 读取{DataCapturePointCode}下线标记 完成读取文件数据时异常,请查看日志!"; |
| | | Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"OP80下线完成读取文件数据时异常,避免工序完成异常:", ex); |