..
This commit is contained in:
@@ -19,6 +19,7 @@ namespace Project
|
||||
//var patterns = PUB.Result.BCDPattern;
|
||||
IgnoreBarcode = false;
|
||||
findregex = false;
|
||||
if (barcodeSymbol == "6") barcodeSymbol = "11"; //250930
|
||||
|
||||
//get : same symbol data
|
||||
List<Class.RegexPattern> pats;
|
||||
@@ -46,19 +47,19 @@ namespace Project
|
||||
{
|
||||
if (vm.BCD_DM == false && barcodeSymbol == "2")
|
||||
{
|
||||
PUB.log.AddAT($"Inactive in model(DM):{bcd}");
|
||||
PUB.log.AddAT($"Inactive in model Symbol Setting(DM):{bcd}");
|
||||
IgnoreBarcode = true;
|
||||
return new Tuple<int, List<string>>(0, new List<string>());
|
||||
}
|
||||
else if (vm.BCD_1D == false && (barcodeSymbol == "6" || barcodeSymbol == "11"))
|
||||
{
|
||||
PUB.log.AddAT($"Inactive in model(1D):{bcd}");
|
||||
PUB.log.AddAT($"Inactive in model Symbol Setting(1D):{bcd}");
|
||||
IgnoreBarcode = true;
|
||||
return new Tuple<int, List<string>>(0, new List<string>());
|
||||
}
|
||||
else if (vm.BCD_QR == false && (barcodeSymbol == "1"))
|
||||
{
|
||||
PUB.log.AddAT($"Inactive in model(QR):{bcd}");
|
||||
PUB.log.AddAT($"Inactive in model Symbol Setting(QR):{bcd}");
|
||||
IgnoreBarcode = true;
|
||||
return new Tuple<int, List<string>>(0, new List<string>());
|
||||
}
|
||||
@@ -162,44 +163,52 @@ namespace Project
|
||||
//skip disable item
|
||||
if (pt.IsEnable == false) continue;
|
||||
|
||||
var regx = new Regex(pt.Pattern, RegexOptions.IgnoreCase, new TimeSpan(0, 0, 10));
|
||||
if (regx.IsMatch(bcd))
|
||||
var regx = new Regex(pt.Pattern, RegexOptions.IgnoreCase, new TimeSpan(0, 0, 5));
|
||||
try
|
||||
{
|
||||
findregex = true;
|
||||
//find data
|
||||
var matchs = regx.Matches(bcd);
|
||||
foreach (System.Text.RegularExpressions.Match mat in matchs)
|
||||
if (regx.IsMatch(bcd))
|
||||
{
|
||||
|
||||
if (vdata == null) ValueApplyCount += 1;
|
||||
else
|
||||
findregex = true;
|
||||
//find data
|
||||
var matchs = regx.Matches(bcd);
|
||||
foreach (System.Text.RegularExpressions.Match mat in matchs)
|
||||
{
|
||||
foreach (var matchdata in pt.Groups)
|
||||
|
||||
if (vdata == null) ValueApplyCount += 1;
|
||||
else
|
||||
{
|
||||
if (matchdata.GroupNo <= mat.Groups.Count)
|
||||
foreach (var matchdata in pt.Groups)
|
||||
{
|
||||
var data = mat.Groups[matchdata.GroupNo];
|
||||
if (PUB.SetBCDValue(vdata, matchdata.TargetPos, data.Value, pt.IsTrust))
|
||||
ValueApplyCount += 1;
|
||||
if (matchdata.GroupNo <= mat.Groups.Count)
|
||||
{
|
||||
var data = mat.Groups[matchdata.GroupNo];
|
||||
if (PUB.SetBCDValue(vdata, matchdata.TargetPos, data.Value, pt.IsTrust))
|
||||
ValueApplyCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vdata != null && pt.IsAmkStd)// && bcdObj.barcodeSymbol == "1")
|
||||
if (vdata != null && pt.IsAmkStd)// && bcdObj.barcodeSymbol == "1")
|
||||
{
|
||||
vdata.QRInputRaw = bcd;
|
||||
}
|
||||
|
||||
if (vdata != null)
|
||||
PUB.log.AddI($"[{pt.Description}]=>{bcd}");
|
||||
|
||||
list.Add(pt.Customer + "|" + pt.Description);
|
||||
}
|
||||
else
|
||||
{
|
||||
vdata.QRInputRaw = bcd;
|
||||
//PUB.log.AddAT($"(X)Match ({pt.Pattern}) Data={bcd}");
|
||||
}
|
||||
|
||||
if (vdata != null)
|
||||
PUB.log.AddI($"[{pt.Description}]=>{bcd}");
|
||||
|
||||
list.Add(pt.Customer + "|" + pt.Description);
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
//PUB.log.AddAT($"(X)Match ({pt.Pattern}) Data={bcd}");
|
||||
PUB.log.AddE($"BarcodeRegEx Error : {ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
return new Tuple<int, List<string>>(ValueApplyCount, list);
|
||||
}
|
||||
@@ -209,12 +218,8 @@ namespace Project
|
||||
/// </summary>
|
||||
void BarcodeProcess()
|
||||
{
|
||||
//coffee
|
||||
//get regexpress patterns
|
||||
var patterns = PUB.Result.BCDPattern;
|
||||
var itemC = PUB.Result.ItemDataC;
|
||||
var vdata = itemC.VisionData;
|
||||
bool vQtyOK = false;
|
||||
|
||||
//No Run - Confirm Data
|
||||
if (vdata.Confirm) return;
|
||||
@@ -231,15 +236,21 @@ namespace Project
|
||||
//already checked
|
||||
if (bcdObj.RegExConfirm) continue;
|
||||
|
||||
var ValueApplyCount = BarcodeRegExProcess(PUB.Result.BCDPattern, PUB.Result.BCDIgnorePattern, vdata, bcdObj.barcodeSymbol, bcd, out bool IgnoreBcd, out bool findregex);
|
||||
bcdObj.Ignore = IgnoreBcd;
|
||||
lock (PUB.Result.BCDPatternLock)
|
||||
{
|
||||
var ValueApplyCount = BarcodeRegExProcess(PUB.Result.BCDPattern, PUB.Result.BCDIgnorePattern, vdata, bcdObj.barcodeSymbol, bcd, out bool IgnoreBcd, out bool findregex);
|
||||
bcdObj.Ignore = IgnoreBcd;
|
||||
|
||||
//기타바코드 무시기능 적용 221018
|
||||
if (vm != null && vm.IgnoreOtherBarcode == true && findregex == false)
|
||||
bcdObj.Ignore = true;
|
||||
|
||||
bcdObj.RefExApply = (ValueApplyCount?.Item1 ?? 0);
|
||||
bcdObj.RegExConfirm = true;
|
||||
}
|
||||
|
||||
|
||||
//기타바코드 무시기능 적용 221018
|
||||
if (vm != null && vm.IgnoreOtherBarcode == true && findregex == false)
|
||||
bcdObj.Ignore = true;
|
||||
|
||||
bcdObj.RefExApply = (ValueApplyCount?.Item1 ?? 0) > 0;
|
||||
bcdObj.RegExConfirm = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user