initial commit
This commit is contained in:
74
Handler/Project/Class/Reel.cs
Normal file
74
Handler/Project/Class/Reel.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
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 venderLot { get; set; }
|
||||
public string mfg { get; set; }
|
||||
public int qty { get; set; }
|
||||
public string id { get; set; }
|
||||
//public string date { get; set; }
|
||||
public string PartNo { get; set; }
|
||||
public string venderName { get; set; }
|
||||
|
||||
public Reel()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
public void Clear()
|
||||
{
|
||||
SID = string.Empty;
|
||||
venderLot = string.Empty;
|
||||
mfg = string.Empty;
|
||||
venderLot = string.Empty;
|
||||
id = string.Empty;
|
||||
//date = string.Empty;
|
||||
PartNo = string.Empty;
|
||||
venderName = 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 is not a number or not a 9-digit number.");
|
||||
|
||||
venderLot = _lot;
|
||||
mfg = _mfgdate;
|
||||
qty = _qty;
|
||||
id = _id;
|
||||
PartNo = _partnum;
|
||||
venderName = _manu;
|
||||
}
|
||||
public Reel(string qrbarcodestr)
|
||||
{
|
||||
var spData = qrbarcodestr.Split(';');
|
||||
if (spData.Length < 6)
|
||||
throw new Exception("Barcode length is insufficient.");
|
||||
|
||||
SID = spData[0];
|
||||
venderLot = spData[1];
|
||||
venderName = spData[2];
|
||||
|
||||
int _qty = 0;
|
||||
|
||||
if (int.TryParse(spData[3], out _qty))
|
||||
qty = _qty;
|
||||
else
|
||||
throw new Exception("Quantity field does not contain numeric information.");
|
||||
|
||||
id = spData[4];
|
||||
mfg = spData[5];
|
||||
if (spData.Length > 6) PartNo = spData[6];
|
||||
else PartNo = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user