服务项目

optimize
wet 2 years ago
parent 11350bf075
commit 4ffe57b485

@ -364,8 +364,11 @@ namespace Myshipping.Application
{
throw Oops.Bah("请传入正常数据!");
}
if (!JsonUtil.TrimFields(input)) {
throw Oops.Bah("l录入字符存在中文");
}
JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YardContract", "YardContractTel", "YardContractEmail", "MARKS", "DESCRIPTION", "CONSIGNEENAME", "SHIPPERNAME", "NOTIFYPARTYNAME");
JsonUtil.TrimFields(input);
if (input.ctnInputs != null)
{
var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}");

@ -1236,5 +1236,36 @@ namespace Myshipping.Application.Service.DataSync.Dto
/// 品名
/// </summary>
public string GOODSNAME { get; set; }
public string PKGSTOTAL { get; set; }
public string KGSTOTAL { get; set; }
public string CBMTOTAL { get; set; }
public string ROUTEID { get; set; }
public string ROUTE { get; set; }
public string Warehouse { get; set; }
public string WarehouseID { get; set; }
public string EPCode { get; set; }
}
}

@ -127,6 +127,10 @@ namespace Myshipping.Application
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 服务项目
/// </summary>
public string ServiceItem { get; set; }
/// <summary>
/// 联系人
/// </summary>

@ -17033,15 +17033,16 @@
<param name="model">数据对象</param>
<param name="excepProp">不需要转大写的字段</param>
</member>
<member name="M:Myshipping.Core.JsonUtil.MinDateToNull(System.Object)">
<member name="M:Myshipping.Core.JsonUtil.ToDBC(System.String)">
<summary>
处理所有时间字段将Datetime.Min设置为null
全角改为半角
</summary>
<param name="model"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.JsonUtil.TrimFields(System.Object)">
<summary>
空格
长TAB键的识别替换空格
</summary>
</member>
<member name="T:Myshipping.Core.MachineUtil">

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using Furion.JsonSerialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@ -138,12 +139,18 @@ public static class JsonUtil
{
prop.SetValue(model, ToDBC(sourceVal.ToString().ToUpper()));
}
}
}
}
}
}
/// <summary>
/// 全角改为半角
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string ToDBC(string input)
{
char[] c = input.ToCharArray();
@ -160,32 +167,10 @@ public static class JsonUtil
return new string(c);
}
/// <summary>
/// 处理所有时间字段将Datetime.Min设置为null
/// </summary>
/// <param name="model"></param>
public static void MinDateToNull(object model)
{
var props = model.GetType().GetProperties();
foreach (PropertyInfo prop in props)
{
if (prop.PropertyType == typeof(DateTime?))
{
DateTime? sourceVal = (DateTime?)prop.GetValue(model);
if (sourceVal != null && sourceVal.HasValue && sourceVal.Value == DateTime.MinValue)
{
prop.SetValue(model, null);
}
}
}
}
/// <summary>
/// 空格
/// 长TAB键的识别替换空格
/// </summary>
public static void TrimFields(object model)
public static bool TrimFields(object model)
{
var props = model.GetType().GetProperties();
foreach (PropertyInfo prop in props)
@ -196,9 +181,36 @@ public static class JsonUtil
object sourceVal = prop.GetValue(model);
if (sourceVal != null)
{
prop.SetValue(model, ToDBC(sourceVal.ToString().Trim()));
prop.SetValue(model, sourceVal.ToString().Replace(" ", " "));
prop.SetValue(model, sourceVal.ToString().Replace(" "," "));
prop.SetValue(model, sourceVal.ToString().Replace("", ","));
prop.SetValue(model, sourceVal.ToString().Replace("。", "."));
prop.SetValue(model, sourceVal.ToString().Replace("", "?"));
prop.SetValue(model, sourceVal.ToString().Replace("", "!"));
prop.SetValue(model, sourceVal.ToString().Replace("《", "<<"));
prop.SetValue(model, sourceVal.ToString().Replace("》", ">>"));
prop.SetValue(model, sourceVal.ToString().Replace("》", ">>"));
prop.SetValue(model, sourceVal.ToString().Replace("", ";"));
prop.SetValue(model, sourceVal.ToString().Replace("", "'"));
prop.SetValue(model, sourceVal.ToString().Replace("", "'"));
prop.SetValue(model, sourceVal.ToString().Replace("、", ","));
if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]")&&!(propName.ToUpper()=="YARD"|| propName.ToUpper() == "CARRIER" || propName.ToUpper() == "YARDREMARK" || propName.ToUpper() == "SOREMARK"
|| propName.ToUpper() == "SIREMARK" || propName.ToUpper() == "OP" || propName.ToUpper() == "DOC" || propName.ToUpper() == "SALE" || propName.ToUpper() == "CUSTSERVICE"
|| propName.ToUpper() == "CUSTOMERNAME" || propName.ToUpper() == "SIREMARK" || propName.ToUpper() == "SHIPAGENCY"
)) {
return false;
}
}
}
}
return true;
}
}

Loading…
Cancel
Save