using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Project.Class { public class Reel { public string sid { get; set; } public string lot { get; set; } public string mfg { get; set; } public int qty { get; set; } public string id { get; set; } //public string date { get; set; } public string partnum { get; set; } public string manu { get; set; } public Reel() { Clear(); } public void Clear() { sid = string.Empty; lot = string.Empty; mfg = string.Empty; lot = string.Empty; id = string.Empty; //date = string.Empty; partnum = string.Empty; manu = string.Empty; qty = 0; } public Reel(string _sid, string _lot, string _manu, int _qty, string _id, string _mfgdate, string _partnum) { int sidNum = 0; if (int.TryParse(_sid, out sidNum) && sidNum.ToString().Length == 9) sid = sidNum.ToString(); else throw new Exception("SID가 숫자가 아니거나 9자리 숫자가 아닙니다."); lot = _lot; mfg = _mfgdate; qty = _qty; id = _id; partnum = _partnum; manu = _manu; } public Reel(string qrbarcodestr) { var spData = qrbarcodestr.Split(';'); if (spData.Length < 6) throw new Exception("Barcode Length가 적습니다."); sid = spData[0]; lot = spData[1]; manu = spData[2]; int _qty = 0; if (int.TryParse(spData[3], out _qty)) qty = _qty; else throw new Exception("수량란에 숫자 정보가 아닙니다."); id = spData[4]; mfg = spData[5]; if (spData.Length > 6) partnum = spData[6]; else partnum = string.Empty; } } }