修改舱位自动关联标签功能

master
jianghaiqing 5 months ago
parent 89b620d3ce
commit e74758a61f

@ -22,6 +22,11 @@ namespace Myshipping.Application
/// 值 /// 值
/// </summary> /// </summary>
public string val { get; set; } public string val { get; set; }
/// <summary>
/// 是主要条件,必需满足
/// </summary>
public bool master { get; set; }
} }
public enum LabelRegexOperEnum public enum LabelRegexOperEnum

@ -4299,345 +4299,99 @@ namespace Myshipping.Application
if (regList[j].name.Equals("PORTLOADID",StringComparison.OrdinalIgnoreCase)) if (regList[j].name.Equals("PORTLOADID",StringComparison.OrdinalIgnoreCase))
{ {
if(operEnum == LabelRegexOperEnum.equal) isSucc = CheckLabel("PORTLOADID", dto.DataObj.PORTLOADID, regList[j].val, regList[j].master, operEnum);
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOADID) && dto.DataObj.PORTLOADID.Equals(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true; if(isSucc)
break;
}
}
else if (operEnum == LabelRegexOperEnum.startwith)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOADID) && dto.DataObj.PORTLOADID.StartsWith(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.like)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOADID) && dto.DataObj.PORTLOADID.Contains(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notexists)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOADID) && !dto.DataObj.PORTLOADID.Contains(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notequal)
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOADID) && !dto.DataObj.PORTLOADID.Equals(regList[j].val)) ruleList.Add(labelList[i]);
{ break;
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
} }
else if (operEnum == LabelRegexOperEnum.notstartwith) else
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOADID) && !dto.DataObj.PORTLOADID.StartsWith(regList[j].val)) if (regList[j].master)
{
ruleList.Add(labelList[i]);
isSucc = true;
break; break;
}
continue;
} }
} }
else if (regList[j].name.Equals("PLACERECEIPT", StringComparison.OrdinalIgnoreCase)) else if (regList[j].name.Equals("PLACERECEIPT", StringComparison.OrdinalIgnoreCase))
{ {
if (operEnum == LabelRegexOperEnum.equal) isSucc = CheckLabel("PLACERECEIPT", dto.DataObj.PLACERECEIPT, regList[j].val, regList[j].master, operEnum);
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACERECEIPT) && dto.DataObj.PLACERECEIPT.Equals(regList[j].val)) if (isSucc)
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.startwith)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACERECEIPT) && dto.DataObj.PLACERECEIPT.StartsWith(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.like)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACERECEIPT) && dto.DataObj.PLACERECEIPT.Contains(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notexists)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACERECEIPT) && !dto.DataObj.PLACERECEIPT.Contains(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notequal)
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACERECEIPT) && !dto.DataObj.PLACERECEIPT.Equals(regList[j].val)) ruleList.Add(labelList[i]);
{ break;
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
} }
else if (operEnum == LabelRegexOperEnum.notstartwith) else
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACERECEIPT) && !dto.DataObj.PLACERECEIPT.StartsWith(regList[j].val)) if (regList[j].master)
{
ruleList.Add(labelList[i]);
isSucc = true;
break; break;
} continue;
} }
} }
else if (regList[j].name.Equals("PORTLOAD", StringComparison.OrdinalIgnoreCase)) else if (regList[j].name.Equals("PORTLOAD", StringComparison.OrdinalIgnoreCase))
{ {
if (operEnum == LabelRegexOperEnum.equal) isSucc = CheckLabel("PORTLOAD", dto.DataObj.PORTLOAD, regList[j].val, regList[j].master, operEnum);
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOAD) && dto.DataObj.PORTLOAD.Equals(regList[j].val)) if (isSucc)
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.startwith)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOAD) && dto.DataObj.PORTLOAD.StartsWith(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.like)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOAD) && dto.DataObj.PORTLOAD.Contains(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notequal)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOAD) && !dto.DataObj.PORTLOAD.Equals(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notexists)
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOAD) && !dto.DataObj.PORTLOAD.Contains(regList[j].val)) ruleList.Add(labelList[i]);
{ break;
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
} }
else if (operEnum == LabelRegexOperEnum.notstartwith) else
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTLOAD) && !dto.DataObj.PORTLOAD.StartsWith(regList[j].val)) if (regList[j].master)
{
ruleList.Add(labelList[i]);
isSucc = true;
break; break;
} continue;
} }
} }
else if (regList[j].name.Equals("PORTDISCHARGEID", StringComparison.OrdinalIgnoreCase)) else if (regList[j].name.Equals("PORTDISCHARGEID", StringComparison.OrdinalIgnoreCase))
{ {
if (operEnum == LabelRegexOperEnum.equal) isSucc = CheckLabel("PORTDISCHARGEID", dto.DataObj.PORTDISCHARGEID, regList[j].val, regList[j].master, operEnum);
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGEID) && dto.DataObj.PORTDISCHARGEID.Equals(regList[j].val)) if (isSucc)
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.startwith)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGEID) && dto.DataObj.PORTDISCHARGEID.StartsWith(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.like)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGEID) && dto.DataObj.PORTDISCHARGEID.Contains(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notequal)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGEID) && !dto.DataObj.PORTDISCHARGEID.Equals(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notexists)
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGEID) && !dto.DataObj.PORTDISCHARGEID.Contains(regList[j].val)) ruleList.Add(labelList[i]);
{ break;
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
} }
else if (operEnum == LabelRegexOperEnum.notstartwith) else
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGEID) && !dto.DataObj.PORTDISCHARGEID.StartsWith(regList[j].val)) if (regList[j].master)
{
ruleList.Add(labelList[i]);
isSucc = true;
break; break;
} continue;
} }
} }
else if (regList[j].name.Equals("PORTDISCHARGE", StringComparison.OrdinalIgnoreCase)) else if (regList[j].name.Equals("PORTDISCHARGE", StringComparison.OrdinalIgnoreCase))
{ {
if (operEnum == LabelRegexOperEnum.equal) isSucc = CheckLabel("PORTDISCHARGE", dto.DataObj.PORTDISCHARGE, regList[j].val, regList[j].master, operEnum);
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGE) && dto.DataObj.PORTDISCHARGE.Equals(regList[j].val)) if (isSucc)
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.startwith)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGE) && dto.DataObj.PORTDISCHARGE.StartsWith(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.like)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGE) && dto.DataObj.PORTDISCHARGE.Contains(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notequal)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGE) && !dto.DataObj.PORTDISCHARGE.Equals(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notexists)
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGE) && !dto.DataObj.PORTDISCHARGE.Contains(regList[j].val)) ruleList.Add(labelList[i]);
{ break;
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
} }
else if (operEnum == LabelRegexOperEnum.notstartwith) else
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PORTDISCHARGE) && !dto.DataObj.PORTDISCHARGE.StartsWith(regList[j].val)) if (regList[j].master)
{
ruleList.Add(labelList[i]);
isSucc = true;
break; break;
} continue;
} }
} }
else if (regList[j].name.Equals("PLACEDELIVERY", StringComparison.OrdinalIgnoreCase)) else if (regList[j].name.Equals("PLACEDELIVERY", StringComparison.OrdinalIgnoreCase))
{ {
if (operEnum == LabelRegexOperEnum.equal) isSucc = CheckLabel("PLACEDELIVERY", dto.DataObj.PLACEDELIVERY, regList[j].val, regList[j].master, operEnum);
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACEDELIVERY) && dto.DataObj.PLACEDELIVERY.Equals(regList[j].val)) if (isSucc)
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.startwith)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACEDELIVERY) && dto.DataObj.PLACEDELIVERY.StartsWith(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.like)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACEDELIVERY) && dto.DataObj.PLACEDELIVERY.Contains(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notequal)
{
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACEDELIVERY) && !dto.DataObj.PLACEDELIVERY.Equals(regList[j].val))
{
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
}
else if (operEnum == LabelRegexOperEnum.notexists)
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACEDELIVERY) && !dto.DataObj.PLACEDELIVERY.Contains(regList[j].val)) ruleList.Add(labelList[i]);
{ break;
ruleList.Add(labelList[i]);
isSucc = true;
break;
}
} }
else if (operEnum == LabelRegexOperEnum.notstartwith) else
{ {
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACEDELIVERY) && !dto.DataObj.PLACEDELIVERY.StartsWith(regList[j].val)) if (regList[j].master)
{
ruleList.Add(labelList[i]);
isSucc = true;
break; break;
} continue;
} }
} }
} }
@ -4685,6 +4439,78 @@ namespace Myshipping.Application
} }
} }
#endregion #endregion
private bool CheckLabel(string name,string val,string checkVal, bool isMaster, LabelRegexOperEnum operEnum)
{
if (operEnum == LabelRegexOperEnum.equal)
{
if (!string.IsNullOrWhiteSpace(val) && val.Equals(checkVal))
{
return true;
}
}
else if (operEnum == LabelRegexOperEnum.startwith)
{
if (!string.IsNullOrWhiteSpace(val) && val.StartsWith(checkVal))
{
return true;
}
}
else if (operEnum == LabelRegexOperEnum.like)
{
if (!string.IsNullOrWhiteSpace(val) && val.Contains(checkVal))
{
return true;
}
}
else if (operEnum == LabelRegexOperEnum.notequal)
{
if (!string.IsNullOrWhiteSpace(val))
{
if (!val.Equals(checkVal))
{
return true;
}
else
{
if (isMaster)
return false;
}
}
}
else if (operEnum == LabelRegexOperEnum.notexists)
{
if (!string.IsNullOrWhiteSpace(val))
{
if (!val.Contains(checkVal))
{
return true;
}
else
{
if (isMaster)
return false;
}
}
}
else if (operEnum == LabelRegexOperEnum.notstartwith)
{
if (!string.IsNullOrWhiteSpace(val))
{
if (!val.StartsWith(checkVal))
{
return true;
}
else
{
if (isMaster)
return false;
}
}
}
return false;
}
} }

Loading…
Cancel
Save