|
|
|
@ -708,7 +708,105 @@ namespace DAJYun.Application
|
|
|
|
|
{
|
|
|
|
|
if (drawModifyBCConfig.drawTypeArg.Any(a => a == DrawModifyBCConfigTypeEnum.EraseMore))
|
|
|
|
|
{
|
|
|
|
|
if (Regex.IsMatch(s, "Named\\s+Account\\s+Customer\\:\\s+(\\w|\\s)+(?=Commodity\\s+Description\\:)"))
|
|
|
|
|
{
|
|
|
|
|
string findStr = Regex.Match(s, "Named\\s+Account\\s+Customer\\:\\s+(\\w|\\s)+(?=Commodity\\s+Description\\:)").Value;
|
|
|
|
|
|
|
|
|
|
string name = Regex.Match(s, "Named\\s+Account\\s+Customer\\:").Value;
|
|
|
|
|
|
|
|
|
|
string repStr = Regex.Match(findStr, "(?<="+ name + ")(\\w|\\s)+").Value?.Trim();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "Block\\s+space\\s+plus"))
|
|
|
|
|
{
|
|
|
|
|
string repStr = Regex.Match(s, "Block\\s+space\\s+plus").Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "Allocation\\s+week\\:"))
|
|
|
|
|
{
|
|
|
|
|
string repStr = Regex.Match(s, "Allocation\\s+week\\:.*(?=\\r\\n)").Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "Price\\s+Calculation\\s+Date\\:"))
|
|
|
|
|
{
|
|
|
|
|
string repStr = Regex.Match(s, "Price\\sCalculation\\sDate\\:\\s{0,}[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}").Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "华南客服邮箱"))
|
|
|
|
|
{
|
|
|
|
|
string repStr = Regex.Match(s, "华南客服邮箱.*(?=\\r\\n)").Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "", "Yellow");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "您的华北马士基客服电话"))
|
|
|
|
|
{
|
|
|
|
|
string repStr = Regex.Match(s, "您的华北马士基客服电话.*(?=\\r\\n)").Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "", "Yellow");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "Maersk Go客服热线"))
|
|
|
|
|
{
|
|
|
|
|
string repStr = Regex.Match(s, "Maersk Go客服热线.*(?=\\r\\n)").Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "", "Yellow");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "华北近洋航线客服电话"))
|
|
|
|
|
{
|
|
|
|
|
string repStr = Regex.Match(s, "华北近洋航线客服电话.*(?=\\r\\n)").Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "", "Yellow");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (drawModifyBCConfig.drawTypeArg.Any(a => a == DrawModifyBCConfigTypeEnum.ChangeToSplitBillNo))
|
|
|
|
@ -877,6 +975,18 @@ namespace DAJYun.Application
|
|
|
|
|
|
|
|
|
|
page.Canvas.DrawString(replace, pdfFont, solidbrush, rec.X, rec.Y - 2);
|
|
|
|
|
}
|
|
|
|
|
else if (pdfBrushes == "CMADate")
|
|
|
|
|
{
|
|
|
|
|
Font font3 = new Font("Helvetica", 10, FontStyle.Regular, GraphicsUnit.Point, 1, true);
|
|
|
|
|
PdfTrueTypeFont pdfFont3 = new PdfTrueTypeFont(font3, true);
|
|
|
|
|
|
|
|
|
|
PdfSolidBrush solidbrush = new PdfSolidBrush(Color.Black);
|
|
|
|
|
|
|
|
|
|
PdfBrush brush2 = new PdfSolidBrush(new PdfRGBColor(255, 255, 255));
|
|
|
|
|
page.Canvas.DrawRectangle(brush2, new RectangleF(rec.X, rec.Y, rec.Width, rec.Height + 2));
|
|
|
|
|
|
|
|
|
|
page.Canvas.DrawString(replace, pdfFont3, solidbrush, rec.X, rec.Y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startIndex++;
|
|
|
|
|
}
|
|
|
|
@ -1164,87 +1274,13 @@ namespace DAJYun.Application
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "合约客户\\:\\s+(\\w|\\s)+(?=受理订舱分公司)"))
|
|
|
|
|
{
|
|
|
|
|
string findStr = Regex.Match(s, "合约客户\\:\\s+(\\w|\\s)+(?=受理订舱分公司)").Value;
|
|
|
|
|
|
|
|
|
|
string repStr = Regex.Match(findStr, "(?<=合约客户\\:)(\\w|\\s)+").Value?.Trim();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
if (Regex.IsMatch(s, $"{repStr}(\\.\\,\\sLTD\\.)"))
|
|
|
|
|
{
|
|
|
|
|
string currS = Regex.Match(s, $"{repStr}(\\.\\,\\sLTD\\.)").Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(currS))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, currS, "");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除合约客户{currS} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReplaceText(page, repStr, "");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "联系人\\:\\s+(\\w|\\s)+(?=收货地)") || Regex.IsMatch(s, "Contact\\sName\\:\\s+(\\w|\\s)+(?=From)"))
|
|
|
|
|
if (Regex.IsMatch(s, "SI\\s+Cut\\-off\\s+Date\\/Time\\s?:", RegexOptions.IgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
string findStr = Regex.Match(s, "联系人\\:\\s+(\\w|\\s)+(?=收货地)").Value;
|
|
|
|
|
|
|
|
|
|
string repStr = Regex.Match(findStr, "(?<=联系人\\:)(\\w|\\s)+").Value?.Trim();
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
findStr = Regex.Match(s, "Contact\\sName\\:\\s+(\\w|\\s)+(?=From)").Value;
|
|
|
|
|
repStr = Regex.Match(findStr, "(?<=Contact\\sName\\:)(\\w|\\s)+").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "合约号\\:\\s+(\\w|\\s)+(?=Customer\\sCommodity)") || Regex.IsMatch(s, "Service\\sContract\\:\\s+(\\w|\\s)+(?=Customer\\sCommodity)")
|
|
|
|
|
|| Regex.IsMatch(s, "Service\\sContract\\:\\s+(\\w|\\s)+(?=Cargo\\sDetail)"))
|
|
|
|
|
{
|
|
|
|
|
string findStr = Regex.Match(s, "合约号\\:\\s+(\\w|\\s)+(?=Customer\\sCommodity)").Value;
|
|
|
|
|
|
|
|
|
|
string repStr = Regex.Match(findStr, "(?<=合约号\\:)(\\w|\\s)+").Value?.Trim();
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
findStr = Regex.Match(s, "Service\\sContract\\:\\s+(\\w|\\s)+(?=Customer\\sCommodity)").Value;
|
|
|
|
|
|
|
|
|
|
repStr = Regex.Match(findStr, "(?<=Service\\sContract\\:)(\\w|\\s)+").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
findStr = Regex.Match(s, "Service\\sContract\\:\\s+(\\w|\\s)+(?=Cargo\\sDetail)").Value;
|
|
|
|
|
|
|
|
|
|
repStr = Regex.Match(findStr, "(?<=Service\\sContract\\:)(\\w|\\s)+").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, "");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 擦除信息{repStr} 成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
string name = Regex.Match(s, "SI\\s+Cut\\-off\\s+Date\\/Time\\s?:\\s+", RegexOptions.IgnoreCase).Value;
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(s, "样单截止时间\\(.*?\\)\\:\\s?[0-9]{4}\\-[0-9]{1,2}\\-[0-9]{1,2}\\s?[0-9]{1,2}\\:[0-9]{1,2}(\\:[0-9]{1,2})?"))
|
|
|
|
|
{
|
|
|
|
|
string findStr = Regex.Match(s, "样单截止时间\\(.*?\\)\\:\\s?[0-9]{4}\\-[0-9]{1,2}\\-[0-9]{1,2}\\s?[0-9]{1,2}\\:[0-9]{1,2}(\\:[0-9]{1,2})?(\\s{0,})").Value;
|
|
|
|
|
string findStr = Regex.Match(s, "(?<=" + name.RegexFormat() + ")\\s{0,}[0-9]{1,2}\\-\\w{3,}\\-[0-9]{4}\\s+[0-9]{1,2}:[0-9]{2}(:[0-9]{2})?").Value;
|
|
|
|
|
|
|
|
|
|
string dateRegex = "[0-9]{4}\\-[0-9]{1,2}\\-[0-9]{1,2}\\s?[0-9]{1,2}\\:[0-9]{1,2}(\\:[0-9]{1,2})?";
|
|
|
|
|
string dateRegex = "[0-9]{1,2}\\-\\w{3,}\\-[0-9]{4}\\s+[0-9]{1,2}:[0-9]{2}(:[0-9]{2})?";
|
|
|
|
|
|
|
|
|
|
string siDateStr = Regex.Match(findStr, dateRegex).Value?.Trim();
|
|
|
|
|
|
|
|
|
@ -1273,234 +1309,13 @@ namespace DAJYun.Application
|
|
|
|
|
// siDate = siDate.AddHours(-6);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
string newStr = Regex.Replace(findStr, dateRegex, siDate.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换后 {newStr}");
|
|
|
|
|
|
|
|
|
|
ReplaceText(page, findStr, newStr, "Yellow");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换截止时间完成");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (Regex.IsMatch(s, "样单截止时间\\(.*?\\)\\:\\s?[0-9]{1,}\\/[a-zA-Z]+\\/[0-9]{4}\\s+[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?"))
|
|
|
|
|
{
|
|
|
|
|
string findStr = Regex.Match(s, "样单截止时间\\(.*?\\)\\:\\s?[0-9]{1,}\\/[a-zA-Z]+\\/[0-9]{4}\\s+[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?(\\s{0,})").Value;
|
|
|
|
|
|
|
|
|
|
string dateRegex = "[0-9]{1,}\\/[a-zA-Z]+\\/[0-9]{4}\\s+[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?";
|
|
|
|
|
|
|
|
|
|
string siDateStr = Regex.Match(findStr, dateRegex).Value?.Trim();
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换截止时间 {findStr}");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(siDateStr))
|
|
|
|
|
{
|
|
|
|
|
DateTime siDate = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
if (DateTime.TryParse(siDateStr, out siDate))
|
|
|
|
|
{
|
|
|
|
|
//if (modifySIDateType == "Kangqian")
|
|
|
|
|
//{
|
|
|
|
|
siDate = SICutDateCalculate(siDate);
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// siDate = siDate.AddHours(-6);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
System.Globalization.DateTimeFormatInfo myDTFI = new System.Globalization.CultureInfo("en-US", false).DateTimeFormat;
|
|
|
|
|
string newDate = siDate.ToString("dd/MMM/yyyy HH:mm", myDTFI);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
康乾的默认截单时间更改计算
|
|
|
|
|
1、周一12点之前的,调整到周五的15点
|
|
|
|
|
2、周二至周五,12点之前的,调整到前一天的14点
|
|
|
|
|
3、周一至周五,12点以后的,调整到当天的10点
|
|
|
|
|
4、周末的调整到周五的15点
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
string newStr = Regex.Replace(findStr, dateRegex, newDate);
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换后 {newStr}");
|
|
|
|
|
|
|
|
|
|
ReplaceText(page, findStr, newStr, "Yellow");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换截止时间完成");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (Regex.IsMatch(s, "样单截至参考时间\\((\\w|\\s|\\-)+\\)\\:"))
|
|
|
|
|
{
|
|
|
|
|
string cname = Regex.Match(s, "样单截至参考时间(\\(.*?(\\)))?").Value.Replace("(", "\\(").Replace(")", "\\)");
|
|
|
|
|
|
|
|
|
|
string findStr = Regex.Match(s, cname + "\\:\\s{0,}[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}\\s+[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?.{7}").Value;
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(findStr))
|
|
|
|
|
{
|
|
|
|
|
findStr = Regex.Match(s, cname + "\\:\\s{0,}[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}\\s+(\\s+\\r\\n\\s+)?[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?.{7}").Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string siDateStr = Regex.Match(s, "(?<=" + cname + "\\:)\\s{0,}[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}\\s+[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?").Value;
|
|
|
|
|
|
|
|
|
|
bool isLineFeed = false;
|
|
|
|
|
|
|
|
|
|
//如果这里没有取到截单日期,可能是中间有换行和空格这里重新再提取一遍
|
|
|
|
|
if (string.IsNullOrWhiteSpace(siDateStr))
|
|
|
|
|
{
|
|
|
|
|
siDateStr = Regex.Match(siDateStr, "(?<=" + cname + "\\:)\\s{0,}[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}\\s+(\\s+\\r\\n\\s+)?[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?").Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(siDateStr))
|
|
|
|
|
{
|
|
|
|
|
isLineFeed = Regex.IsMatch(siDateStr, "(\\s+\\r\\n\\s+)");
|
|
|
|
|
|
|
|
|
|
if (isLineFeed)
|
|
|
|
|
siDateStr = Regex.Replace(siDateStr, "(\\s+\\r\\n\\s+)", " ");
|
|
|
|
|
|
|
|
|
|
siDateStr = Regex.Replace(siDateStr, "\\s{2,}", " ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DateTime siDate = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
if (DateTime.TryParse(siDateStr, out siDate))
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
康乾的默认截单时间更改计算
|
|
|
|
|
1、周一12点之前的,调整到周五的15点
|
|
|
|
|
2、周二至周五,12点之前的,调整到前一天的14点
|
|
|
|
|
3、周一至周五,12点以后的,调整到当天的10点
|
|
|
|
|
4、周末的调整到周五的15点
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//if (modifySIDateType == "Kangqian")
|
|
|
|
|
//{
|
|
|
|
|
siDate = SICutDateCalculate(siDate);
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// siDate = siDate.AddHours(-6);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
if (!isLineFeed)
|
|
|
|
|
{
|
|
|
|
|
string dateRegex = "[0-9]{4}\\-[0-9]{1,2}\\-[0-9]{1,2}\\s?[0-9]{1,2}\\:[0-9]{1,2}(\\:[0-9]{1,2})?";
|
|
|
|
|
|
|
|
|
|
string newStr = Regex.Replace(findStr, dateRegex, siDate.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换后 {newStr}");
|
|
|
|
|
|
|
|
|
|
ReplaceText(page, findStr, newStr, "Yellow");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换截止时间完成");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string dateRegex = "[0-9]{4}\\-[0-9]{1,2}\\-[0-9]{1,2}";
|
|
|
|
|
|
|
|
|
|
string findStr1 = Regex.Match(findStr, cname + "\\:\\s{0,}[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}\\s+(?=\\r\\n)").Value;
|
|
|
|
|
string newStr = Regex.Replace(findStr1, dateRegex, siDate.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
string newStr = Regex.Replace(findStr, dateRegex, siDate.ToString("dd-MMM-yyyy HH:mm", new System.Globalization.DateTimeFormatInfo()));
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换后 {newStr}");
|
|
|
|
|
|
|
|
|
|
ReplaceText(page, findStr, newStr, "Yellow");
|
|
|
|
|
ReplaceText(page, $"{name}{findStr}", $"{name}{newStr}", "CMADate");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换截止时间完成");
|
|
|
|
|
|
|
|
|
|
string findStr2 = Regex.Replace(Regex.Match(findStr, "(?<=\\r\\n)\\s+[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?.{7}").Value, "\\s+", "");
|
|
|
|
|
|
|
|
|
|
string removeStr = Regex.Match(findStr2, "[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?").Value;
|
|
|
|
|
string newStr2 = Regex.Replace(findStr2, "[0-9]{2}\\:[0-9]{2}(\\:[0-9]{2})?", "".PadLeft(removeStr.Length - 1));
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换后2 {newStr2}");
|
|
|
|
|
|
|
|
|
|
ReplaceText(page, findStr2, newStr2, "Yellow");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 替换2截止时间完成");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (drawModifyBCConfig != null)
|
|
|
|
|
{
|
|
|
|
|
if (drawModifyBCConfig.drawTypeArg.Any(a => a == DrawModifyBCConfigTypeEnum.EraseMore))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (drawModifyBCConfig.drawTypeArg.Any(a => a == DrawModifyBCConfigTypeEnum.ChangeToSplitBillNo))
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
1、先取bookingno如何跟原号一致,则进行修改覆盖
|
|
|
|
|
*/
|
|
|
|
|
if (Regex.IsMatch(s, "Booking\\s+No\\.:\\s+\\w+\\s+(?=Print\\s+Date:)"))
|
|
|
|
|
{
|
|
|
|
|
string findStr = Regex.Match(s, "Booking\\s+No\\.:\\s+\\w+\\s+(?=Print\\s+Date:)").Value;
|
|
|
|
|
|
|
|
|
|
string repStr = Regex.Match(findStr, "(?<=Booking\\sNo\\.:)\\s+\\w+").Value?.Trim();
|
|
|
|
|
|
|
|
|
|
//这里用取出的单号跟原始单号匹配,如果不一致抛错误终止返回文件流
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
throw new Exception("当前请求的是修改提单号,因为未解析到提单号终止修改文件");
|
|
|
|
|
|
|
|
|
|
if (!repStr.Trim().Equals(drawModifyBCConfig.origBillNo))
|
|
|
|
|
throw new Exception($"当前请求的是修改提单号,因为解析到提单号:{findStr}与 原始提单号:{drawModifyBCConfig.origBillNo} 不一致,终止修改文件");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, repStr, drawModifyBCConfig.newBillNo, "Normal");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 覆盖提单号信息{repStr} 成功 改为{drawModifyBCConfig.newBillNo}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (drawModifyBCConfig.drawTypeArg.Any(a => a == DrawModifyBCConfigTypeEnum.SplitBC))
|
|
|
|
|
{
|
|
|
|
|
if (Regex.IsMatch(s, "Quantity.*Cargo Volume\\s+[0-9]+\\s+(?=[a-zA-Z0-9]+)"))
|
|
|
|
|
{
|
|
|
|
|
string findStr = Regex.Match(s, "Quantity.*Cargo Volume\\s+[0-9]+\\s+(?=[a-zA-Z0-9]+)").Value;
|
|
|
|
|
|
|
|
|
|
string repStr = Regex.Match(findStr, "(?<=Quantity.*Cargo Volume)\\s+[0-9]+\\s+").Value;
|
|
|
|
|
|
|
|
|
|
//这里用取出的单号跟原始单号匹配,如果不一致抛错误终止返回文件流
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
throw new Exception("当前请求的是修改集装箱数量,因为未解析到集装箱数量终止修改文件");
|
|
|
|
|
|
|
|
|
|
int ctnNum = int.Parse(repStr.Trim());
|
|
|
|
|
//if (ctnNum != drawModifyBCConfig.origCtnNum.Value)
|
|
|
|
|
//throw new Exception($"当前请求的是修改集装箱数量,因为解析到集装箱数量:{repStr}与集装箱数量:{drawModifyBCConfig.origCtnNum.Value} 不一致,终止修改文件");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, $" {repStr.Trim()}", drawModifyBCConfig.newCtnNum.Value.ToString(), "CtnNum");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 覆盖提单号信息{repStr} 成功 改为{drawModifyBCConfig.newCtnNum.Value.ToString()}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (Regex.IsMatch(s, "数量.*货物体积\\s+[0-9]+\\s+(?=[a-zA-Z0-9]+)"))
|
|
|
|
|
{
|
|
|
|
|
string findStr = Regex.Match(s, "数量.*货物体积\\s+[0-9]+\\s+(?=[a-zA-Z0-9]+)").Value;
|
|
|
|
|
|
|
|
|
|
string repStr = Regex.Match(findStr, "(?<=数量.*货物体积)\\s+[0-9]+\\s+").Value;
|
|
|
|
|
|
|
|
|
|
//这里用取出的单号跟原始单号匹配,如果不一致抛错误终止返回文件流
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
throw new Exception("当前请求的是修改集装箱数量,因为未解析到集装箱数量终止修改文件");
|
|
|
|
|
|
|
|
|
|
int ctnNum = int.Parse(repStr.Trim());
|
|
|
|
|
//if (ctnNum != drawModifyBCConfig.origCtnNum.Value)
|
|
|
|
|
//throw new Exception($"当前请求的是修改集装箱数量,因为解析到集装箱数量:{repStr}与集装箱数量:{drawModifyBCConfig.origCtnNum.Value} 不一致,终止修改文件");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(repStr))
|
|
|
|
|
{
|
|
|
|
|
ReplaceText(page, $" {repStr.Trim()} ", drawModifyBCConfig.newCtnNum.Value.ToString(), "CtnNum");
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PDF 覆盖提单号信息{repStr} 成功 改为{drawModifyBCConfig.newCtnNum.Value.ToString()}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|