using SqlSugar;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Models
{
///
/// 检测记录表
///
//[SugarIndex("index_{table}_ProductId_SerialNum",
// nameof(Records.ProductId), OrderByType.Asc,
// nameof(Records.SerialNum), OrderByType.Desc, isUnique: true)]
public class Records : BaseTable
{
///
/// 产品
///
public int ProductId { get; set; }
[SugarColumn(IsIgnore = true)]//不关联查询,好像无意义
[Navigate(NavigateType.ManyToOne, nameof(ProductId))]
public Product ProductInfo { get; set; }
///
/// 条码
///
public string BarCode { get; set; }
///
/// 品名
///
public string BarCodeName { get; set; }
public string Material { get; set; }//材质名字
public string Color { get; set; }//颜色名字
//产品单号、产品批号、产品卷号
///
/// 单号
///
//public string OrderId { get; set; }
///
/// 批号
///
public string BatchId { get; set; }
///
/// 卷号 1,2,3,4
///
public string ReelId { get; set; }
///
/// 分卷号
///
[SugarColumn(IsNullable = true)]
public string PartReelId { get; set; }
///
/// 大卷第几卷
///
public int ReelNo { get; set; }
public double ErpLen { get; set; }//ERP长度
//[SugarColumn(IsNullable = true)]
//public string SerialNum { get; set; } //流水号=批号+ReelId
///
/// M
///
public double Len { get; set; }//实际数量/长度
public double TensionValue { get; set; }//实际张力
[SugarColumn(IsNullable = true)]
public string ExeStandard { get; set; }//执行标准
///
/// 时长-分
///
public double TimeLen { get; set; }
///
/// 等级划分1-n 对应ABC
///
public int Grade { get; set; }
///
/// 是否合格
///
public bool Qualified { get; set; }
///
/// 缺陷总数
///
public int DefectTotalCount { get; set; }
public bool Succeed { get; set; }
///
/// 失败分类
///
public int FailType { get; set; }
[SugarColumn(IsNullable = true, ColumnDataType = "text", Length = 2048)]
public string Note { get; set; }
public double FaceWidthMin { get; set; }
public double FaceWidthMax { get; set; }
///
/// 门幅线
///
[SqlSugar.SugarColumn(IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public List FacePointList { get; set; } = new List();
///
/// 测厚数据[长度,厚度1,厚度2,厚度3]
///
//[SqlSugar.SugarColumn(IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
//public List ThicknessPointList { get; set; } = new List();
///
/// Defect和Size比对失败的坐标位置
///
[Navigate(NavigateType.OneToMany, nameof(DefectInfo.Pid))]
public List DefectInfoList { get; set; }
///
/// 厚度数据
///
[Navigate(NavigateType.OneToMany, nameof(Thickness.Pid))]
public List ThicknessList { get; set; }
//===计算属性和方法
[SugarColumn(IsIgnore = true)]
public int currKey { get; set; }
//[SugarColumn(IsIgnore = true)]
//public List FaceWidthList { get; set; }=new List();//String.Join(", ", array)
///
/// 拍照1-n
///
[SugarColumn(IsIgnore = true)]
public int ScannerPhotoCount { get; set; }=0;//多个相机拍照张数 ++
[SugarColumn(IsIgnore = true)]
public int ScannerPhotoFinishCount { get; set; } = 0;//多个相机拍照张数 --
//每百米瑕疵数告警起始位
[SugarColumn(IsIgnore = true)]
public int preWarningPhotoIndex { get; set; } = 0;
///
/// 图片索引,是否有瑕疵 key=0-n
///
[SugarColumn(IsIgnore = true)]
public ConcurrentDictionary dicPhoto_Defect { get; set; } = new ConcurrentDictionary();
///
/// 单一缺陷报警位置记录,预留50
///
[SugarColumn(IsIgnore = true)]
public int[] preWarningPhotoIndexByLabel { get; set; } = new int[50];
//用户名称
[SugarColumn(IsNullable = true)]
public string UserName { get; set; }
//班组名称
[SugarColumn(IsNullable = true)]
public string WorkTeam { get; set; }
///
/// 降级信息 米数 原因 等级
///
[SqlSugar.SugarColumn(IsNullable = true, IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public List DowngradeInformation { get; set; } = new List();
///
/// 分卷结论
///
[SugarColumn(IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string PartReelNote { get; set; }
///
/// 分卷结论2
///
[SugarColumn(IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string PartReelNote2 { get; set; }
///
/// 放码信息 0:名称 1:个数 2:让码 3:y位置m
///
[SqlSugar.SugarColumn(IsNullable = true, IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public List FMInformation { get; set; } = new List();
///
/// 分段信息信息 0:分段长度 1:y位置m
///
[SqlSugar.SugarColumn(IsNullable = true, IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public List FDInfor { get; set; } = new List();
///
/// 分段信息信息 0:卷长 1:让码 2:净长 3:重量
///
[SqlSugar.SugarColumn(IsNullable = true, IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public double[] LengthWeightInfor { get; set; } = new double[4];
//品名
[SugarColumn(IsNullable = true)]
public string PJXTBH { get; set; }
//成检半检
[SugarColumn(IsNullable = true)]
public string DefectType { get; set; }
}
///
/// 瑕疵明细表
///
[SugarIndex("index_{table}_pid", nameof(DefectInfo.Pid), OrderByType.Asc,
nameof(DefectInfo.Code), OrderByType.Asc,
nameof(DefectInfo.Target), OrderByType.Asc,
isUnique: false)]
public class DefectInfo : BaseTable
{
public int Pid { get; set; }
public int PhotoIndex { get; set; }//原图索引/文件名 0-n
///
/// 类别ID DefectCodeEnum
///
public string Code { get; set; }
public double X { get; set; }//cm
public double Y { get; set; }//cm
public double Width { get; set; }//cm
public double Height { get; set; }//cm
///
/// 置信度
///
public double ZXD { get; set; }
///
/// 对比度
///
public double Contrast { get; set; }//
///
/// 目标
///
public int Target { get; set; }
//--计算属性
[SugarColumn(IsIgnore = true)]
public long uid { get; set; }//程序中的唯一索引,用于移除用索引
[SugarColumn(IsIgnore = true)]
public double CentreX
{
get { return Math.Round(X + Width / 2,2); }
}
[SugarColumn(IsIgnore = true)]
public double CentreY
{
get { return Math.Round(Y + Height / 2,2); }
}
///
/// 面积
///
[SugarColumn(IsIgnore = true)]
public double Area
{
get { return Width * Height; }
}
//[SugarColumn(IsIgnore = true)]
//public Image image{get;set;}
///
/// 图像编号
///
[SugarColumn(IsIgnore = true)]
public string imageID { get; set; }
//[SugarColumn(IsIgnore = true)]
public string Name { get; set; }
[SugarColumn(IsIgnore = true)]
public string TagFilePath { get; set; }//打标小图路径,用于二次瑕疵检测修改和忽略时的改名/删除
///
/// 图片中缺陷当前Y方向位置cm
///
[SugarColumn(IsIgnore = true)]
public double PicY { get; set; }
///
/// 当前图像计米器位置
///
//[SugarColumn(IsIgnore = true)]
public double CurrDis { get; set; }
}
///
/// 厚度检测明细表
///
[SugarIndex("index_{table}_pid", nameof(Thickness.Pid), OrderByType.Asc,
isUnique: false)]
public class Thickness : BaseTable
{
public int Pid { get; set; }
public double Y_Dis { get; set; }//Y cm
public double Value1 { get; set; }//mm
public double Value2 { get; set; }//mm
public double Value3 { get; set; }//mm
}
///
/// 上报服务器记录表
///
public class UploadDataRecords : BaseTable
{
///
/// 条码
///
public string BarCode { get; set; }
///
/// 品名
///
public string BarCodeName { get; set; }
///
/// 材质
///
public string Material { get; set; }//材质名字
///
/// 颜色名字
///
public string Color { get; set; }//颜色名字
///
/// 批号
///
public string BatchId { get; set; }
///
/// 卷号 1,2,3,4
///
public string ReelId { get; set; }
///
/// 分卷号
///
[SugarColumn(IsNullable = true)]
public string PartReelId { get; set; }
public double ErpLen { get; set; }//ERP长度
///
/// 名称
///
[SugarColumn(IsNullable = true)]
public string Name { get; set; }
///
/// 规格 绑定的ERP信息
///
[SugarColumn(IsNullable = true, Length = 4096)]
public string Spec { get; set; }
///
/// 光源亮度
///
public int LightValue { get; set; }//亮度
///
/// 曝光时长
///
public double ExposureTime { get; set; }//曝光时长
///
/// 增益
///
public double Gain { get; set; }//增益
///
/// 张力
///
public double TensionValue { get; set; }//张力
[SugarColumn(IsNullable = true)]
public string Note { get; set; }
///
/// 合格判断标准
///
[Navigate(NavigateType.OneToMany, nameof(QualifiedLimit.Pid))]
public List QualifiedLimitList { get; set; }
///
/// 等级划分标准
///
[Navigate(NavigateType.OneToMany, nameof(GradeLimit.Pid))]
public List GradeLimitList { get; set; }
///
/// 模型算法
///
[SugarColumn(IsNullable = true)]
public string ModelName { get; set; }
///
/// 瑕疵面积
///
public double DefectAreaLimit { get; set; }//面积
///
/// 每百米瑕疵数
///
public int DefectCountLimit { get; set; }//瑕疵数
///
/// 二次判定
///
public bool DefectPauseForUser { get; set; }//瑕疵二次确认
[SqlSugar.SugarColumn(IsJson = true, IsNullable = true)]//, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public List DefectPauseOption { get; set; } = new List();//二次确认过滤瑕疵
///
/// 缺陷计数长度
///
[SugarColumn(IsNullable = true)]
public double DefectCntLength { get; set; }
///
/// 缺陷警告
///
[SugarColumn(IsNullable = true)]
public string WarnDefect { get; set; }
///
/// 开启厚度检测
///
[SugarColumn(IsNullable = true)]
public bool OpenThicknessDetection { get; set; }
///
/// 厚度检测暂停距离m
///
[SugarColumn(IsNullable = true)]
public int ThicknessDetectionStopDis { get; set; }
///
/// 剩余长度提醒
///
[SugarColumn(IsNullable = true)]
public double residueWarnningLen { get; set; }
//////////20241024新增传统算法参数/////////////////
///
/// 分类
///
[SugarColumn(IsNullable = true)]
public string ClassType { get; set; }
///
/// 面积过滤大小像素
///
[SugarColumn(IsNullable = true)]
public double HalconAreaThr { get; set; }
///
/// M
///
public double Len { get; set; }//实际数量/长度
[SugarColumn(IsNullable = true)]
public string ExeStandard { get; set; }//执行标准
///
/// 时长-分
///
public double TimeLen { get; set; }
///
/// 等级划分1-n 对应ABC
///
public int Grade { get; set; }
///
/// 是否合格
///
public bool Qualified { get; set; }
///
/// 缺陷总数
///
public int DefectTotalCount { get; set; }
public bool Succeed { get; set; }
///
/// 失败分类
///
public int FailType { get; set; }
public double FaceWidthMin { get; set; }
public double FaceWidthMax { get; set; }
///
/// 门幅线
///
[SqlSugar.SugarColumn(IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public List FacePointList { get; set; } = new List();
///
/// Defect和Size比对失败的坐标位置
///
[Navigate(NavigateType.OneToMany, nameof(DefectInfo.Pid))]
public List DefectInfoList { get; set; }
///
/// 厚度数据
///
[Navigate(NavigateType.OneToMany, nameof(Thickness.Pid))]
public List ThicknessList { get; set; }
[SugarColumn(IsNullable = true)]
public int cm2px_x { get; set; }
[SugarColumn(IsNullable = true)]
public int cm2px_y { get; set; }
//用户名称
[SugarColumn(IsNullable = true)]
public string UserName { get; set; }
//班组名称
[SugarColumn(IsNullable = true)]
public string WorkTeam { get; set; }
///
/// 降级信息
///
[SqlSugar.SugarColumn(IsNullable = true, IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public List DowngradeInformation { get; set; } = new List();
///
/// 分卷结论
///
[SugarColumn(IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string PartReelNote { get; set; }
///
/// 分卷结论2
///
[SugarColumn(IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string PartReelNote2 { get; set; }
}
}