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; }
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; }
#region 缺陷种类
public int DKCount { get; set; }//堵孔数量
public int ZWCount { get; set; }//脏污数量
public int GSYCCount { get; set; }//钢丝异常数量
public int XWSCount { get; set; }//纤维丝数量
public int QKCount { get; set; }//缺口数量
public int ZKCount { get; set; }//针孔数量
public int PPCount { get; set; }//泡泡数量
public int HSCount { get; set; }//划伤数量
public int YXCount { get; set; }//压线数量
public int XBCount { get; set; }//斜边数量 new
public int SXCount { get; set; }//栅线数量 new
#endregion
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();
///
/// Defect和Size比对失败的坐标位置
///
[Navigate(NavigateType.OneToMany, nameof(DefectInfo.Pid))]
public List DefectInfoList { 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];
}
///
/// 瑕疵明细表
///
[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 Name { get; set; }
[SugarColumn(IsIgnore = true)]
public string TagFilePath { get; set; }//打标小图路径,用于二次瑕疵检测修改和忽略时的改名/删除
}
}