geboshi_V1/LeatherProject/Models/Records.cs

521 lines
18 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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