|
|
|
@ -31,6 +31,13 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
{
|
|
|
|
|
private static readonly string EdiFilePath = "XHZ";
|
|
|
|
|
|
|
|
|
|
private static readonly string TEMP_REGEX = "(TEMP\\b\\s?\\:.*?\\n)|(TEMP\\b\\s?\\:.*)|(TEMP\\b\\s?\\;.*?\\n)|(TEMP\\b\\s?\\;.*)|(TEMPERATURE\\b\\s?\\:.*?\\n)|(TEMPERATURE\\b\\s?\\:.*)|(TEMPERATURE\\b\\s?\\;.*?\\n)|(TEMPERATURE\\b\\s?\\;.*)|(TEMP\\b\\sSETTING\\sAT\\:.*)|(TEM\\b\\s?\\:.*)|(TEMPERATURE\\s+OF\\n.*)|(TEMP\\s+.*)";
|
|
|
|
|
private static readonly string TEMP_TAKE_REGEX = "((?<=TEMP\\s\\:).*?(?=\\n))|((?<=TEMP\\s\\:).*)|((?<=TEMP\\:).*?(?=\\n))|((?<=TEMP\\:).*)|((?<=TEMP\\s\\;).*?(?=\\n))|((?<=TEMP\\s\\;).*?)|((?<=TEMP\\;).*?(?=\\n))|((?<=TEMP\\;).*)|((?<=TEMPERATURE\\s\\:).*?(?=\\n))|((?<=TEMPERATURE\\s\\:).*?)|((?<=TEMPERATURE\\:).*?(?=\\n))|((?<=TEMPERATURE\\:).*)|((?<=TEMPERATURE\\s\\;).*?(?=\\n))|((?<=TEMPERATURE\\s\\;).*?)|((?<=TEMPERATURE\\;).*?(?=\\n))|((?<=TEMPERATURE\\;).*)|((?<=TEMP\\s+SETTING\\s+AT\\:).*)|((?<=TEM\\:).*)|((?<=TEMPERATURE\\sOF\\n).*(?=DEGREES))|((?<=TEMP\\s\\:).*)|((?<=TEMP\\s+).*)";
|
|
|
|
|
private static readonly string VENT_REGEX = "(VENT\\b\\s?\\:.*?\\n)|(VENT\\b\\s?\\:.*)|(VENT\\b\\s?\\;.*?\\n)|(VENT\\b\\s?\\;.*)|(VENTILATION\\s+HOLE\\b\\s?\\:.*)|(VENTILATION\\b\\s?\\:.*)|(VENT\\s+.*)";
|
|
|
|
|
private static readonly string VENT_TAKE_REGEX = "((?<=VENT\\s\\:).*?(?=\\n))|((?<=VENT\\s\\:).*?)|((?<=VENT\\:).*?(?=\\n))|((?<=VENT\\:).*)|((?<=VENT\\s\\;).*?(?=\\n))|((?<=VENT\\s\\;).*?)|((?<=VENT\\;).*?(?=\\n))|((?<=VENT\\;).*)|((?<=VENTILATION\\s+HOLE\\:).*)|((?<=VENTILATION\\:).*)|((?<=VENT\\s+).*)";
|
|
|
|
|
private static readonly string HUMI_REGEX = "(HUMI\\b\\s?\\:.*?\\n)|(HUMI\\b\\s?\\:.*)|(HUMI\\b\\s?\\;.*?\\n)|(HUMI\\b\\s?\\;.*)|(HDMI\\b\\s?\\:.*?\\n)|(HDMI\\b\\s?\\:.*)|(HDMI\\b\\s?\\;.*?\\n)|(HDMI\\b\\s?\\;.*)|(HDIM\\b\\s?\\:.*?\\n)|(HDIM\\b\\s?\\:.*)|(HDIM\\b\\s?\\;.*?\\n)|(HDIM\\b\\s?\\;.*)|(HUM\\b\\s?\\:.*?\\n)|(HUM\\b\\s?\\:.*)|(HUM\\b\\s?\\;.*?\\n)|(HUM\\b\\s?\\;.*)|(HUMIDITY\\b\\s?\\:.*)|(HUMD\\b\\:.*)";
|
|
|
|
|
private static readonly string HUMI_TAKE_REGEX = "((?<=HUMI\\s\\:).*?(?=\\n))|((?<=HUMI\\s\\:).*?)|((?<=HUMI\\:).*?(?=\\n))|((?<=HUMI\\:).*)|((?<=HUMI\\s\\;).*?(?=\\n))|((?<=HUMI\\s\\;).*?)|((?<=HUMI\\;).*?(?=\\n))|((?<=HUMI\\;).*)|((?<=HDMI\\s\\:).*?(?=\\n))|((?<=HDMI\\s\\:).*?)|((?<=HDMI\\:).*?(?=\\n))|((?<=HDMI\\:).*)|((?<=HDMI\\s\\;).*?(?=\\n))|((?<=HDMI\\s\\;).*?)|((?<=HDMI\\;).*?(?=\\n))|((?<=HDMI\\;).*)|((?<=HDIM\\s\\:).*?(?=\\n))|((?<=HDIM\\s\\:).*?)|((?<=HDIM\\:).*?(?=\\n))|((?<=HDIM\\:).*)|((?<=HDIM\\s\\;).*?(?=\\n))|((?<=HDIM\\s\\;).*?)|((?<=HDIM\\;).*?(?=\\n))|((?<=HDIM\\;).*)|((?<=HUM\\s\\:).*?(?=\\n))|((?<=HUM\\s\\:).*?)|((?<=HUM\\:).*?(?=\\n))|((?<=HUM\\:).*)|((?<=HUM\\s\\;).*?(?=\\n))|((?<=HUM\\s\\;).*?)|((?<=HUM\\;).*?(?=\\n))|((?<=HUM\\;).*)|((?<=HUMIDITY\\:).*)|((?<=HUMD\\:).*)";
|
|
|
|
|
|
|
|
|
|
public static async Task<KeyValuePair<bool, string>> Send(
|
|
|
|
|
long bookingId, string filerole)
|
|
|
|
|
{
|
|
|
|
@ -48,6 +55,8 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
return new KeyValuePair<bool, string>(false, "订舱信息未找到");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var checkRlt = XiahuozhiHelpler.CheckGoodsDescriptionWithInput(order);
|
|
|
|
|
|
|
|
|
|
var ctns = repCtn.Where(c => c.BILLID == bookingId).ToList();
|
|
|
|
|
|
|
|
|
|
var dictData = await cacheService.GetAllDictData();
|
|
|
|
@ -1438,13 +1447,134 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
return portDischargeEdiCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 校验货描里的温度、湿度、通风与单个填写项进行比对
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 校验货描里的温度、湿度、通风与单个填写项进行比对
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="order">订舱详情</param>
|
|
|
|
|
public static void CheckGoodsDescriptionWithInput(BookingOrder order)
|
|
|
|
|
public static KeyValuePair<bool, string> CheckGoodsDescriptionWithInput(BookingOrder order)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
1、先从货描提取温度、湿度、通风。
|
|
|
|
|
2、判断录入框的温度、湿度、通风与货描提取的是否一致,不一致报错。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//温度
|
|
|
|
|
string tempSet = string.Empty;
|
|
|
|
|
//通风
|
|
|
|
|
string reeferf = string.Empty;
|
|
|
|
|
//湿度
|
|
|
|
|
string humidity = string.Empty;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(order.DESCRIPTION))
|
|
|
|
|
{
|
|
|
|
|
if (Regex.IsMatch(order.DESCRIPTION, TEMP_REGEX))
|
|
|
|
|
{
|
|
|
|
|
var currStr = Regex.Match(order.DESCRIPTION, TEMP_TAKE_REGEX).Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(currStr))
|
|
|
|
|
currStr = Regex.Replace(currStr, "\\:", "");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(currStr))
|
|
|
|
|
tempSet = currStr.Replace("#", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(order.DESCRIPTION, VENT_REGEX))
|
|
|
|
|
{
|
|
|
|
|
var currStr = Regex.Match(order.DESCRIPTION, VENT_TAKE_REGEX).Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(currStr))
|
|
|
|
|
{
|
|
|
|
|
reeferf = currStr.Replace("#", "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(order.DESCRIPTION, HUMI_REGEX))
|
|
|
|
|
{
|
|
|
|
|
var currStr = Regex.Match(order.DESCRIPTION, HUMI_TAKE_REGEX).Value;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(currStr))
|
|
|
|
|
{
|
|
|
|
|
if (Regex.IsMatch(currStr, "\\(NO\\s+SHOW\\)"))
|
|
|
|
|
currStr = Regex.Replace(currStr, "\\(NO\\s+SHOW\\)", "");
|
|
|
|
|
|
|
|
|
|
humidity = currStr.Replace("#", "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(order.TEMPSET) && !string.IsNullOrWhiteSpace(tempSet))
|
|
|
|
|
{
|
|
|
|
|
string strA = string.Empty;
|
|
|
|
|
string strB = string.Empty;
|
|
|
|
|
|
|
|
|
|
strA = Regex.Match(order.TEMPSET, "(\\+|\\-)?\\s?[0-9]+(\\.[0-9]+)?").Value?.Trim();
|
|
|
|
|
if (Regex.IsMatch(tempSet, "(\\+|\\-)?\\s?[0-9]+(\\.[0-9]+)?.('C|'\\s+C|℃|ºC|C)?"))
|
|
|
|
|
{
|
|
|
|
|
strB = Regex.Match(tempSet, "(\\+|\\-)?\\s?[0-9]+(\\.[0-9]+)?(?=.('C|'\\s+C|℃|ºC|C)?)").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Regex.IsMatch(strA, "^\\+") && Regex.IsMatch(strB, "^\\+"))
|
|
|
|
|
{
|
|
|
|
|
strB = Regex.Match(strB, "(?<=\\+).*").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!strA.Equals(strB))
|
|
|
|
|
{
|
|
|
|
|
return new KeyValuePair<bool, string>(false, $"货描温度 {tempSet} 与请求设定温度 {order.TEMPSET} 不一致");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(order.REEFERF) && !string.IsNullOrWhiteSpace(reeferf))
|
|
|
|
|
{
|
|
|
|
|
string strA = string.Empty;
|
|
|
|
|
string strB = string.Empty;
|
|
|
|
|
|
|
|
|
|
strA = Regex.Match(order.REEFERF, "[0-9]+(\\.[0-9]+)?").Value?.Trim();
|
|
|
|
|
|
|
|
|
|
if(Regex.IsMatch(reeferf, "[0-9]+(\\.[0-9]+)?\\s?(CBM\\/H)?"))
|
|
|
|
|
{
|
|
|
|
|
strB = Regex.Match(reeferf, "[0-9]+(\\.[0-9]+)?\\s?(?=(CBM\\/HR|CBM\\/HOUR|CBM\\s+\\/\\s+H|CBM\\/H|CMH|CBMH)?)").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strB = Regex.Match(reeferf, "[0-9]+(\\.[0-9]+)?").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!strA.Equals(strB))
|
|
|
|
|
{
|
|
|
|
|
if (!(Regex.IsMatch(reeferf, "(CLOSE(D)?|OFF)") && Regex.IsMatch(order.REEFERF?.Trim(), "^0(\\.0)?")))
|
|
|
|
|
{
|
|
|
|
|
//如果货描通风显示英文 CLOSE、CLOSED、OFF,并且录入通风是 0或者0.0可以认为一致
|
|
|
|
|
return new KeyValuePair<bool, string>(false, $"货描通风 {reeferf} 与请求冷藏通风量 {order.REEFERF} 不一致");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(order.HUMIDITY) && !string.IsNullOrWhiteSpace(humidity))
|
|
|
|
|
{
|
|
|
|
|
string strA = Regex.Match(order.HUMIDITY, "[0-9]+(\\.[0-9]+)?(\\%)?").Value?.Trim();
|
|
|
|
|
string strB = Regex.Match(humidity, "[0-9]+(\\.[0-9]+)?(\\%)?").Value?.Trim();
|
|
|
|
|
|
|
|
|
|
if (order.HUMIDITY.Contains("%") && !humidity.Contains("%"))
|
|
|
|
|
{
|
|
|
|
|
strA = Regex.Match(order.HUMIDITY, "[0-9]+(\\.[0-9]+)?").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!order.HUMIDITY.Contains("%") && humidity.Contains("%"))
|
|
|
|
|
{
|
|
|
|
|
strB = Regex.Match(humidity, "[0-9]+(\\.[0-9]+)?").Value?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!strA.Equals(strB))
|
|
|
|
|
{
|
|
|
|
|
return new KeyValuePair<bool, string>(false, $"货描湿度 {humidity} 与请求湿度 {order.HUMIDITY} 不一致");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new KeyValuePair<bool, string>(true, "货描提取温度、湿度、通风校验通过");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|