schangxiang@126.com
2024-06-13 320422d67d050d4cf3d33380148acb727fabcc81
DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_05.cs
@@ -17,7 +17,7 @@
    /// <summary>
    ///  工序完成
    /// </summary>
    public class DataCaptureHandler_05: DataCaptureHandler
    public class DataCaptureHandler_05 : DataCaptureHandler
    {
        public static readonly DataCaptureHandler_05 Instance = new DataCaptureHandler_05();
@@ -132,7 +132,7 @@
                                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))
                                {
@@ -148,7 +148,7 @@
                                        }
                                        set.SetValue(wplog, valuecol);//给动态字段赋值
                                    }
                                    catch(Exception setex)
                                    catch (Exception setex)
                                    {
                                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(_dataCaptureConfig.WorkingProcedure), $" {DataCapturePointCode}工序监控读码标记 读取工件码动态赋值【{_dataCaptureConfig.WorkingProcedure ?? "空字符串"}】异常{wplog.Id},赋值列名[{col.DataCaptureColumnTabelName ?? "空字符串"}]", setex);
                                    }
@@ -172,14 +172,14 @@
                                        {
                                            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>();
@@ -188,7 +188,7 @@
                                                {
                                                    rowFirst = datatable[0].Split(',').ToList();
                                                    rowSecond = datatable[1].Split(',').ToList();
                                                    if(rowSecond.Count<11)
                                                    if (rowSecond.Count < 11)
                                                    {
                                                        continue;
                                                    }
@@ -213,33 +213,33 @@
                                                        }
                                                        //名称 相对值 相对值单位 绝对值 绝对值单位 名义值 上限 下限  状态/等级 分隔符
                                                        OP80ItemInfo item = new OP80ItemInfo();
                                                        item.分隔符 = rowSecond[1 + i * 10];
                                                        item.名称 = rowSecond[2 + i * 10];
                                                        item.相对值 = rowSecond[3 + i * 10];
                                                        item.相对值单位 = rowSecond[4 + i * 10];
                                                        item.绝对值 = rowSecond[5 + i * 10];
                                                        item.绝对值单位 = rowSecond[6 + i * 10];
                                                        item.名义值 = rowSecond[7 + i * 10];
                                                        item.上限 = rowSecond[8 + i * 10];
                                                        item.下限 = rowSecond[9 + i * 10];
                                                        item.状态 = rowSecond[10 + i * 10];
                                                        item.分隔符 = rowSecond[1 + i * 10];//例如:*   表头:状态
                                                        item.名称 = rowSecond[2 + i * 10];//例如:Weight Big End    表头:*
                                                        item.相对值 = rowSecond[3 + i * 10];//例如:-2.8    表头:简述
                                                        item.相对值单位 = rowSecond[4 + i * 10];//例如:gr    表头:Weight Big End
                                                        item.绝对值 = rowSecond[5 + i * 10];//例如:371.66    表头:测量单位
                                                        item.绝对值单位 = rowSecond[6 + i * 10];//例如:gr    表头:绝对值
                                                        item.名义值 = rowSecond[7 + i * 10];//例如:374.5    表头:绝对值测量单位(UoM)
                                                        item.上限 = rowSecond[8 + i * 10];//例如:10.5    表头:名义值
                                                        item.下限 = rowSecond[9 + i * 10];//例如:-10.5    表头:USL值
                                                        item.状态 = rowSecond[10 + i * 10];//例如:3    表头:LSL值
                                                        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";
                                                        }
@@ -293,7 +293,7 @@
                                    }
                                }
                                catch(Exception ex)
                                catch (Exception ex)
                                {
                                    threadStatusMonitor.ErrorMsg = $" {RandomHelper.GenerateRandomCode(4)} 读取{DataCapturePointCode}下线标记 完成读取文件数据时异常,请查看日志!";
                                    Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"OP80下线完成读取文件数据时异常,避免工序完成异常:", ex);