geboshi_V1/LeatherProject/Models/Records.cs

211 lines
7.2 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; }
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; }
//===计算属性和方法
[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];
}
/// <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; }//打标小图路径,用于二次瑕疵检测修改和忽略时的改名/删除
}
}