123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- using Microsoft.Extensions.FileSystemGlobbing.Internal;
- using System.ComponentModel;
- using static System.Collections.Specialized.BitVector32;
- namespace EInk.Dtos
- {
- public class Lot2Lot3Dto
- {
- public string id { get; set; }
- public string slidesNumber { get; set; }
- public string topic { get; set; }
- public string createTime { get; set; }
- public string result { get; set; }
- public List<itemCheckData> itemCheckDatas { get; set; } = new List<itemCheckData>();
- public void Valid()
- {
- if (String.IsNullOrEmpty(id.Trim()))
- {
- throw new Exception("Empty id");
- }
- if (String.IsNullOrEmpty(slidesNumber.Trim()))
- {
- throw new Exception("Empty slidesNumber");
- }
- if (String.IsNullOrEmpty(result.Trim()))
- {
- throw new Exception("Empty result");
- }
- if (result!="NG"&&result!="OK")
- {
- throw new Exception("Incorrect result");
- }
- try
- {
- DateTime valid = Convert.ToDateTime(createTime);
- }
- catch
- {
- throw new Exception("Incorrect createTime");
- }
- foreach (var itemCheckData in itemCheckDatas)
- {
- itemCheckData.Valid();
- }
- }
- }
- public class itemCheckData
- {
- public string station { get; set; }
- public string method { get; set; }
- public string pattern { get; set; }
- public string result { get; set; }
- public string imagePath { get; set; }
- public string detailImagePath { get; set; }
- public List<detail> details { get; set; } = new List<detail>();
- public void Valid()
- {
- if (String.IsNullOrEmpty(station.Trim()))
- {
- throw new Exception("Empty station");
- }
- if (String.IsNullOrEmpty(method.Trim()))
- {
- throw new Exception("Empty method");
- }
- if (String.IsNullOrEmpty(pattern.Trim()))
- {
- throw new Exception("Empty pattern");
- }
- if (String.IsNullOrEmpty(result.Trim()))
- {
- throw new Exception("Empty result");
- }
- if (result != "NG" && result != "OK")
- {
- throw new Exception("Incorrect result");
- }
- foreach (var itemdetail in details)
- {
- itemdetail.Valid();
- }
- }
- }
- public class detail
- {
- public string defectCode { get; set; }
- public string defectName { get; set; }
- public string x { get; set; }
- public string y { get; set; }
- public string width { get; set; }
- public string height { get; set; }
- public string area { get; set; }
- public void Valid()
- {
- if (String.IsNullOrEmpty(defectCode.Trim()))
- {
- throw new Exception("Empty defectCode");
- }
- if (String.IsNullOrEmpty(defectName.Trim()))
- {
- throw new Exception("Empty defectName");
- }
- if (String.IsNullOrEmpty(x.Trim()))
- {
- throw new Exception("Empty x");
- }
- if (String.IsNullOrEmpty(y.Trim()))
- {
- throw new Exception("Empty y");
- }
- if (String.IsNullOrEmpty(width.Trim()))
- {
- throw new Exception("Empty width");
- }
- if (String.IsNullOrEmpty(height.Trim()))
- {
- throw new Exception("Empty height");
- }
- if (String.IsNullOrEmpty(area.Trim()))
- {
- throw new Exception("Empty area");
- }
- //try
- //{
- // double valid = Convert.ToDouble(x);
- //}
- //catch
- //{
- // throw new Exception("Incorrect x");
- //}
- //try
- //{
- // double valid = Convert.ToDouble(y);
- //}
- //catch
- //{
- // throw new Exception("Incorrect y");
- //}
- //try
- //{
- // double valid = Convert.ToDouble(width);
- //}
- //catch
- //{
- // throw new Exception("Incorrect width");
- //}
- //try
- //{
- // double valid = Convert.ToDouble(height);
- //}
- //catch
- //{
- // throw new Exception("Incorrect height");
- //}
- //try
- //{
- // double valid = Convert.ToDouble(area);
- //}
- //catch
- //{
- // throw new Exception("Incorrect area");
- //}
- }
- }
- }
|