This commit is contained in:
余宇波 2025-04-22 11:34:03 +08:00
parent fc29be4a38
commit 647a247326
11 changed files with 1638 additions and 9 deletions

View File

@ -0,0 +1,599 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilot_KD_Parino.Common
{
public static class Conv
{
#region ToByte(byte)
/// <summary>
/// 转换为8位可空整型
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static byte ToByte(object input)
{
return ToByte(input, default(byte));
}
/// <summary>
/// 转换为8位可空整型
/// </summary>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <returns></returns>
public static byte ToByte(object input, byte defaultValue)
{
return ToByteOrNull(input) ?? defaultValue;
}
/// <summary>
/// 转换为8位可空整型
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static byte? ToByteOrNull(object input)
{
byte result;
var success = byte.TryParse(input.SafeString(), out result);
if (success)
{
return result;
}
return null;
}
#endregion
#region ToChar(char)
/// <summary>
/// 转换为字符
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static char ToChar(object input)
{
return ToChar(input, default(char));
}
/// <summary>
/// 转换为字符
/// </summary>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <returns></returns>
public static char ToChar(object input, char defaultValue)
{
return ToCharOrNull(input) ?? defaultValue;
}
/// <summary>
/// 转换为可空字符
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static char? ToCharOrNull(object input)
{
char result;
var success = char.TryParse(input.SafeString(), out result);
if (success)
{
return result;
}
return null;
}
#endregion
#region ToShort(short)
/// <summary>
/// 转换为16位整型
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static short ToShort(object input)
{
return ToShort(input, default(short));
}
/// <summary>
/// 转换为16位整型
/// </summary>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <returns></returns>
public static short ToShort(object input, short defaultValue)
{
return ToShortOrNull(input) ?? defaultValue;
}
/// <summary>
/// 转换为16位可空整型
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static short? ToShortOrNull(object input)
{
short result;
var success = short.TryParse(input.SafeString(), out result);
if (success)
{
return result;
}
return null;
}
#endregion
#region ToInt(int)
/// <summary>
/// 转换为32位整型
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static int ToInt(object input)
{
return ToInt(input, default(int));
}
/// <summary>
/// 转换为32位整型
/// </summary>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <returns></returns>
public static int ToInt(object input, int defaultValue)
{
return ToIntOrNull(input) ?? defaultValue;
}
/// <summary>
/// 转换为32位可空整型
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static int? ToIntOrNull(object input)
{
int result;
var success = int.TryParse(input.SafeString(), out result);
if (success)
{
return result;
}
try
{
var temp = ToDoubleOrNull(input, 0);
if (temp == null)
{
return null;
}
return System.Convert.ToInt32(temp);
}
catch
{
return null;
}
}
#endregion
#region ToLong(long)
/// <summary>
/// 转换为64位整型
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static long ToLong(object input)
{
return ToLong(input, default(long));
}
/// <summary>
/// 转换为64位整型
/// </summary>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <returns></returns>
public static long ToLong(object input, long defaultValue)
{
return ToLongOrNull(input) ?? defaultValue;
}
/// <summary>
/// 转换为64位可空整型
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static long? ToLongOrNull(object input)
{
long result;
var success = long.TryParse(input.SafeString(), out result);
if (success)
{
return result;
}
try
{
var temp = ToDecimalOrNull(input, 0);
if (temp == null)
{
return null;
}
return System.Convert.ToInt64(temp);
}
catch
{
return null;
}
}
#endregion
#region ToFloat(float)
/// <summary>
/// 转换为32位浮点型并按指定小数位舍入
/// </summary>
/// <param name="input">输入值</param>
/// <param name="digits">小数位数</param>
/// <returns></returns>
public static float ToFloat(object input, int? digits = null)
{
return ToFloat(input, default(float), digits);
}
/// <summary>
/// 转换为32位浮点型并按指定小数位舍入
/// </summary>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <param name="digits">小数位数</param>
/// <returns></returns>
public static float ToFloat(object input, float defaultValue, int? digits = null)
{
return ToFloatOrNull(input, digits) ?? defaultValue;
}
/// <summary>
/// 转换为32位可空浮点型并按指定小数位舍入
/// </summary>
/// <param name="input">输入值</param>
/// <param name="digits">小数位数</param>
/// <returns></returns>
public static float? ToFloatOrNull(object input, int? digits = null)
{
float result;
var success = float.TryParse(input.SafeString(), out result);
if (!success)
{
return null;
}
if (digits == null)
{
return result;
}
return (float)Math.Round(result, digits.Value);
}
#endregion
#region ToDouble(double)
/// <summary>
/// 转换为64位浮点型并按指定小数位舍入温馨提示4舍6入5成双
/// </summary>
/// <param name="input">输入值</param>
/// <param name="digits">小数位数</param>
/// <returns></returns>
public static double ToDouble(object input, int? digits = null)
{
return ToDouble(input, default(double), digits);
}
/// <summary>
/// 转换为64位浮点型并按指定小数位舍入温馨提示4舍6入5成双
/// </summary>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <param name="digits">小数位数</param>
/// <returns></returns>
public static double ToDouble(object input, double defaultValue, int? digits = null)
{
return ToDoubleOrNull(input, digits) ?? defaultValue;
}
/// <summary>
/// 转换为64位可空浮点型并按指定小数位舍入温馨提示4舍6入5成双
/// </summary>
/// <param name="input">输入值</param>
/// <param name="digits">小数位数</param>
/// <returns></returns>
public static double? ToDoubleOrNull(object input, int? digits = null)
{
double result;
var success = double.TryParse(input.SafeString(), out result);
if (!success)
{
return null;
}
return digits == null ? result : Math.Round(result, digits.Value);
}
#endregion
#region ToDecimal(decimal)
/// <summary>
/// 转换为128位浮点型并按指定小数位舍入温馨提示4舍6入5成双
/// </summary>
/// <param name="input">输入值</param>
/// <param name="digits">小数位数</param>
/// <returns></returns>
public static decimal ToDecimal(object input, int? digits = null)
{
return ToDecimal(input, default(decimal), digits);
}
/// <summary>
/// 转换为128位浮点型并按指定小数位舍入温馨提示4舍6入5成双
/// </summary>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <param name="digits">小数位数</param>
/// <returns></returns>
public static decimal ToDecimal(object input, decimal defaultValue, int? digits = null)
{
return ToDecimalOrNull(input, digits) ?? defaultValue;
}
/// <summary>
/// 转换为128位可空浮点型并按指定小数位舍入温馨提示4舍6入5成双
/// </summary>
/// <param name="input">输入值</param>
/// <param name="digits">小数位数</param>
/// <returns></returns>
public static decimal? ToDecimalOrNull(object input, int? digits = null)
{
decimal result;
var success = decimal.TryParse(input.SafeString(), out result);
if (!success)
{
return null;
}
if (digits == null)
{
return result;
}
return Math.Round(result, digits.Value);
}
#endregion
#region ToBool(bool)
/// <summary>
/// 转换为布尔值
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static bool ToBool(object input)
{
return ToBool(input, default(bool));
}
/// <summary>
/// 转换为布尔值
/// </summary>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <returns></returns>
public static bool ToBool(object input, bool defaultValue)
{
return ToBoolOrNull(input) ?? defaultValue;
}
/// <summary>
/// 转换为可空布尔值
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static bool? ToBoolOrNull(object input)
{
bool? value = GetBool(input);
if (value != null)
{
return value.Value;
}
bool result;
return bool.TryParse(input.SafeString(), out result) ? (bool?)result : null;
}
/// <summary>
/// 获取布尔值
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
private static bool? GetBool(object input)
{
switch (input.SafeString().ToLower())
{
case "0":
case "否":
case "不":
case "no":
case "fail":
return false;
case "1":
case "是":
case "ok":
case "yes":
return true;
default:
return null;
}
}
#endregion
#region ToDate(DateTime)
/// <summary>
/// 转换为日期
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static DateTime ToDate(object input)
{
return ToDateOrNull(input) ?? DateTime.MinValue;
}
/// <summary>
/// 转换为可空日期
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static DateTime? ToDateOrNull(object input)
{
DateTime result;
return DateTime.TryParse(input.SafeString(), out result) ? (DateTime?)result : null;
}
#endregion
#region ToGuid(Guid)
/// <summary>
/// 转换为Guid
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static Guid ToGuid(object input)
{
return ToGuidOrNull(input) ?? Guid.Empty;
}
/// <summary>
/// 转换为可空Guid
/// </summary>
/// <param name="input">输入值</param>
/// <returns></returns>
public static Guid? ToGuidOrNull(object input)
{
Guid result;
return Guid.TryParse(input.SafeString(), out result) ? (Guid?)result : null;
}
/// <summary>
/// 转换为Guid集合
/// </summary>
/// <param name="input">输入值以逗号分隔的Guid集合字符串范例83B0233C-A24F-49FD-8083-1337209EBC9A,EAB523C6-2FE7-47BE-89D5-C6D440C3033A</param>
/// <returns></returns>
public static List<Guid> ToGuidList(string input)
{
return ToList<Guid>(input);
}
#endregion
#region ToList()
/// <summary>
/// 泛型集合转换
/// </summary>
/// <typeparam name="T">目标元素类型</typeparam>
/// <param name="input">输入值以逗号分隔的元素集合字符串范例83B0233C-A24F-49FD-8083-1337209EBC9A,EAB523C6-2FE7-47BE-89D5-C6D440C3033A</param>
/// <returns></returns>
public static List<T> ToList<T>(string input)
{
var result = new List<T>();
if (string.IsNullOrWhiteSpace(input))
{
return result;
}
var array = input.Split(',');
result.AddRange(from each in array where !string.IsNullOrWhiteSpace(each) select To<T>(each));
return result;
}
#endregion
#region ToEnum()
/// <summary>
/// 转换为枚举
/// </summary>
/// <typeparam name="T">枚举类型</typeparam>
/// <param name="input">输入值</param>
/// <returns></returns>
public static T ToEnum<T>(object input) where T : struct
{
return ToEnum<T>(input, default(T));
}
/// <summary>
/// 转换为枚举
/// </summary>
/// <typeparam name="T">枚举类型</typeparam>
/// <param name="input">输入值</param>
/// <param name="defaultValue">默认值</param>
/// <returns></returns>
public static T ToEnum<T>(object input, T defaultValue) where T : struct
{
return ToEnumOrNull<T>(input) ?? defaultValue;
}
/// <summary>
/// 转换为可空枚举
/// </summary>
/// <typeparam name="T">枚举类型</typeparam>
/// <param name="input">输入值</param>
/// <returns></returns>
public static T? ToEnumOrNull<T>(object input) where T : struct
{
T result;
var success = System.Enum.TryParse(input.SafeString(), true, out result);
if (success)
{
return result;
}
return null;
}
#endregion
#region To()
/// <summary>
/// 通用泛型转换
/// </summary>
/// <typeparam name="T">目标类型</typeparam>
/// <param name="input">输入值</param>
/// <returns></returns>
public static T To<T>(object input)
{
if (input == null)
{
return default(T);
}
if (input is string && string.IsNullOrWhiteSpace(input.ToString()))
{
return default(T);
}
Type type = Reflection.GetType<T>();
try
{
if (type.Name.ToLower() == "string")
{
return (T)(object)input.ToString();
}
if (type.Name.ToLower() == "guid")
{
return (T)(object)new Guid(input.ToString());
}
if (type.IsEnum)
{
return EnumHelper.Parse<T>(input);
}
if (input is IConvertible)
{
return (T)System.Convert.ChangeType(input, type);
}
return (T)input;
}
catch
{
return default(T);
}
}
#endregion
}
}

View File

@ -0,0 +1,288 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Pilot_KD_Parino.Common
{
public class EnumHelper
{
#region Parse()
/// <summary>
/// 获取实例
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <param name="member">成员名或值范例Enum1枚举有成员A=0则传入"A"或"0"获取 Enum1.A</param>
/// <returns></returns>
public static TEnum Parse<TEnum>(object member)
{
string value = member.SafeString();
if (string.IsNullOrEmpty(value))
{
if (typeof(TEnum).IsGenericType)
{
return default(TEnum);
}
throw new ArgumentNullException(nameof(member));
}
return (TEnum)System.Enum.Parse(Reflection.GetType<TEnum>(), value, true);
}
#endregion
#region GetName()
/// <summary>
/// 获取成员名
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <param name="member">成员名、值、实例均可范例Enum1枚举有成员A=0则传入Enum1.A或0获取成员名"A"</param>
/// <returns></returns>
public static string GetName<TEnum>(object member)
{
return GetName(Reflection.GetType<TEnum>(), member);
}
/// <summary>
/// 获取成员名
/// </summary>
/// <param name="type">枚举类型</param>
/// <param name="member">成员名、值、实例均可范例Enum1枚举有成员A=0则传入Enum1.A或0获取成员名"A"</param>
/// <returns></returns>
public static string GetName(Type type, object member)
{
if (type == null)
{
return string.Empty;
}
if (member == null)
{
return string.Empty;
}
if (member is string)
{
return member.ToString();
}
if (type.GetTypeInfo().IsEnum == false)
{
return string.Empty;
}
return System.Enum.GetName(type, member);
}
#endregion
#region GetNames()
/// <summary>
/// 获取枚举所有成员名称
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <returns></returns>
public static string[] GetNames<TEnum>()
{
return GetNames(typeof(TEnum));
}
/// <summary>
/// 获取枚举所有成员名称
/// </summary>
/// <param name="type">枚举类型</param>
/// <returns></returns>
public static string[] GetNames(Type type)
{
return System.Enum.GetNames(type);
}
#endregion
#region GetValue()
/// <summary>
/// 获取成员值
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <param name="member">成员名、值、实例均可,范例:Enum1枚举有成员A=0,可传入"A"、0、Enum1.A获取值0</param>
/// <returns></returns>
public static int GetValue<TEnum>(object member)
{
return GetValue(Reflection.GetType<TEnum>(), member);
}
/// <summary>
/// 获取成员值
/// </summary>
/// <param name="type">枚举类型</param>
/// <param name="member">成员名、值、实例均可,范例:Enum1枚举有成员A=0,可传入"A"、0、Enum1.A获取值0</param>
/// <returns></returns>
public static int GetValue(Type type, object member)
{
string value = member.SafeString();
if (string.IsNullOrEmpty(value))
{
throw new ArgumentNullException(nameof(member));
}
return (int)System.Enum.Parse(type, member.ToString(), true);
}
#endregion
#region GetDescription()
/// <summary>
/// 获取描述,使用<see cref="DescriptionAttribute"/> 特性设置描述
/// </summary>
/// <typeparam name = "T" > 枚举 </ typeparam >
/// < param name="member">成员名、值、实例均可,范例:Enum1枚举有成员A=0,可传入"A"、0、Enum1.A获取值0</param>
/// <returns></returns>
public static string GetDescription<T>(object member)
{
return Reflection.GetDescription<T>(GetName<T>(member));
}
///// <summary>
///// 获取描述,使用<see cref="DescriptionAttribute"/>特性设置描述
///// </summary>
///// <param name="type">枚举类型</param>
///// <param name="member">成员名、值、实例均可,范例:Enum1枚举有成员A=0,可传入"A"、0、Enum1.A获取值0</param>
///// <returns></returns>
//public static string GetDescription(Type type, object member)
//{
// return Reflection.GetDescription(type, GetName(type, member));
//}
/// <summary>
/// 取得描述
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string GetDescription(Enum value)
{
Type type = value.GetType();
FieldInfo item = type.GetField(value.ToString(), BindingFlags.Public | BindingFlags.Static);
if (item == null) return null;
var attribute = Attribute.GetCustomAttribute(item, typeof(DescriptionAttribute)) as DescriptionAttribute;
if (attribute != null && !string.IsNullOrEmpty(attribute.Description)) return attribute.Description;
return null;
}
#endregion
#region GetItems()
/// <summary>
/// 获取描述项集合文本设置为Description值为Value
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <returns></returns>
public static List<Item> GetItems<TEnum>()
{
return GetItems(Reflection.GetType<TEnum>());
}
/// <summary>
/// 获取描述项集合文本设置为Description值为Value
/// </summary>
/// <param name="type">枚举类型</param>
/// <returns></returns>
public static List<Item> GetItems(Type type)
{
TypeInfo enumType = type.GetTypeInfo();
if (enumType.IsEnum == false)
{
throw new InvalidOperationException($"类型 {type} 不是枚举");
}
var result = new List<Item>();
foreach (var field in enumType.GetFields())
{
AddItem(type, result, field);
}
return result.OrderBy(t => t.SortId).ToList();
}
/// <summary>
/// 验证是否枚举类型
/// </summary>
/// <param name="enumType">类型</param>
private static void ValidateEnum(Type enumType)
{
if (enumType.IsEnum == false)
{
throw new InvalidOperationException(string.Format("类型 {0} 不是枚举", enumType));
}
}
/// <summary>
/// 添加描述项
/// </summary>
/// <param name="type">枚举类型</param>
/// <param name="result">集合</param>
/// <param name="field">字段</param>
private static void AddItem(Type type, ICollection<Item> result, FieldInfo field)
{
if (!field.FieldType.GetTypeInfo().IsEnum)
{
return;
}
var value = GetValue(type, field.Name);
var description = Reflection.GetDescription(field);
result.Add(new Item(description, value, value));
}
#endregion
#region GetEnumItemByDescription()
/// <summary>
/// 获取指定描述信息的枚举项
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <param name="desc">枚举项描述信息</param>
/// <returns></returns>
public static TEnum GetEnumItemByDescription<TEnum>(string desc)
{
if (string.IsNullOrEmpty(desc))
{
throw new ArgumentNullException(nameof(desc));
}
Type type = typeof(TEnum);
FieldInfo[] fieldInfos = type.GetFields(BindingFlags.Public | BindingFlags.Static);
FieldInfo fieldInfo =
fieldInfos.FirstOrDefault(p => p.GetCustomAttribute<DescriptionAttribute>(false).Description == desc);
if (fieldInfo == null)
{
throw new ArgumentNullException($"在枚举({type.FullName})中,未发现描述为“{desc}”的枚举项。");
}
return (TEnum)System.Enum.Parse(type, fieldInfo.Name);
}
#endregion
#region GetDictionary()
/// <summary>
/// 获取枚举字典
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <returns></returns>
public static Dictionary<int, string> GetDictionary<TEnum>()
{
Type enumType = Reflection.GetType<TEnum>().GetTypeInfo();
ValidateEnum(enumType);
Dictionary<int, string> dic = new Dictionary<int, string>();
foreach (var field in enumType.GetFields())
{
AddItem<TEnum>(dic, field);
}
return dic;
}
/// <summary>
/// 添加描述项
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <param name="result">集合</param>
/// <param name="field">字典</param>
private static void AddItem<TEnum>(Dictionary<int, string> result, FieldInfo field)
{
if (!field.FieldType.GetTypeInfo().IsEnum)
{
return;
}
var value = GetValue<TEnum>(field.Name);
var description = Reflection.GetDescription(field);
result.Add(value, description);
}
#endregion
}
}

View File

@ -0,0 +1,69 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilot_KD_Parino.Common
{
public class Item : IComparable<Item>
{
/// <summary>
/// 文本
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Text { get; set; }
/// <summary>
/// 值
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public object Value { get; set; }
/// <summary>
/// 排序号
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public int? SortId { get; set; }
/// <summary>
/// 组
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Group { get; }
/// <summary>
/// 禁用
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public bool? Disabled { get; }
/// <summary>
/// 初始化一个<see cref="Item"/>类型的实例
/// </summary>
/// <param name="text">文本</param>
/// <param name="value">值</param>
/// <param name="sortId">排序号</param>
/// <param name="group">组</param>
/// <param name="disabled">禁用</param>
public Item(string text, object value, int? sortId = null, string group = null, bool? disabled = null)
{
Text = text;
Value = value;
SortId = sortId;
Group = group;
Disabled = disabled;
}
/// <summary>
/// 比较
/// </summary>
/// <param name="other">其他列表项</param>
/// <returns></returns>
public int CompareTo(Item other)
{
return string.Compare(Text, other.Text, StringComparison.CurrentCulture);
}
}
}

View File

@ -0,0 +1,93 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilot_KD_Parino.Common
{
public class JsonHelper
{
/// <summary>
/// Json序列化器
/// </summary>
static readonly JsonSerializer JsonSerializer = new JsonSerializer();
#region ToObject<T>(Json字符串转换为对象)
/// <summary>
/// 将Json字符串转换为对象
/// </summary>
/// <param name="json">Json字符串</param>
public static T ToObject<T>(string json)
{
if (string.IsNullOrWhiteSpace(json))
return default(T);
return JsonConvert.DeserializeObject<T>(json);
}
#endregion
#region ToObject()
/// <summary>
/// 反序列化对象
/// </summary>
/// <param name="value">值</param>
/// <returns></returns>
public static object ToObject(byte[] value)
{
using (var ms = new MemoryStream(value, writable: false))
{
using (var tr = new StreamReader(ms))
{
using (var jr = new JsonTextReader(tr))
{
jr.Read();
if (jr.TokenType == JsonToken.StartArray)
{
// 读取类型
var typeName = jr.ReadAsString();
var type = Type.GetType(typeName, throwOnError: true);// 获取类型
// 读取对象
jr.Read();
if (type.Name == "String") { return jr.Value; }
return JsonSerializer.Deserialize(jr, type);
}
else if (jr.TokenType == JsonToken.StartObject)
{
return null;
}
else
{
throw new InvalidDataException("JsonTranscoder 仅支持 [\"TypeName\", object]");
}
}
}
}
}
#endregion
#region ToJson(Json字符串)
/// <summary>
/// 将对象转换为Json字符串
/// </summary>
/// <param name="target">目标对象</param>
/// <param name="isConvertToSingleQuotes">是否将双引号转成单引号</param>
public static string ToJson(object target, bool isConvertToSingleQuotes = false)
{
if (target == null)
return "{}";
var result = JsonConvert.SerializeObject(target);
if (isConvertToSingleQuotes)
result = result.Replace("\"", "'");
return result;
}
#endregion
}
}

View File

@ -0,0 +1,555 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Pilot_KD_Parino.Common
{
public static class Reflection
{
#region GetDescription()
/// <summary>
/// 获取类型描述,使用<see cref="DescriptionAttribute"/>设置描述
/// </summary>
/// <typeparam name="T">类型</typeparam>
/// <returns></returns>
public static string GetDescription<T>()
{
return GetDescription(GetType<T>());
}
/// <summary>
/// 获取类型成员描述,使用<see cref="DescriptionAttribute"/>设置描述
/// </summary>
/// <typeparam name="T">类型</typeparam>
/// <param name="memberName">成员名称</param>
/// <returns></returns>
public static string GetDescription<T>(string memberName)
{
return GetDescription(GetType<T>(), memberName);
}
/// <summary>
/// 获取类型成员描述,使用<see cref="DescriptionAttribute"/>设置描述
/// </summary>
/// <param name="type">类型</param>
/// <param name="memberName">成员名称</param>
/// <returns></returns>
public static string GetDescription(Type type, string memberName)
{
if (type == null)
{
return string.Empty;
}
return string.IsNullOrEmpty(memberName)
? string.Empty
: GetDescription(type.GetTypeInfo().GetMember(memberName).FirstOrDefault());
}
/// <summary>
/// 获取类型成员描述,使用<see cref="DescriptionAttribute"/>设置描述
/// </summary>
/// <param name="member">成员</param>
/// <returns></returns>
public static string GetDescription(MemberInfo member)
{
if (member == null)
{
return string.Empty;
}
var attribute = member.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
return attribute == null ? member.Name : attribute.Description;
}
#endregion
#region GetDisplayName()
/// <summary>
/// 获取类型显示名称,使用<see cref="DisplayNameAttribute"/>设置显示名称
/// </summary>
/// <typeparam name="T">类型</typeparam>
/// <returns></returns>
public static string GetDisplayName<T>()
{
return GetDisplayName(GetType<T>());
}
/// <summary>
/// 获取类型显示名称,使用<see cref="DisplayNameAttribute"/>设置显示名称
/// </summary>
/// <param name="type">类型</param>
/// <returns></returns>
private static string GetDisplayName(Type type)
{
if (type == null)
{
return string.Empty;
}
var attribute = type.GetCustomAttribute(typeof(DisplayNameAttribute)) as DisplayNameAttribute;
return attribute != null ? attribute.DisplayName : string.Empty;
}
/// <summary>
/// 获取类型成员显示名称,,使用<see cref="DisplayNameAttribute"/>或<see cref="DisplayAttribute"/>设置显示名称
/// </summary>
/// <param name="member">成员</param>
/// <returns></returns>
private static string GetDisplayName(MemberInfo member)
{
if (member == null)
{
return string.Empty;
}
var displayNameAttribute = member.GetCustomAttribute(typeof(DisplayNameAttribute)) as DisplayNameAttribute;
if (displayNameAttribute != null)
{
return displayNameAttribute.DisplayName;
}
var displayAttribute = member.GetCustomAttribute(typeof(DisplayAttribute)) as DisplayAttribute;
if (displayAttribute == null)
{
return string.Empty;
}
return displayAttribute.Description;
}
#endregion
#region GetDisplayNameOrDescription()
/// <summary>
/// 获取类型显示名称或描述,使用<see cref="DescriptionAttribute"/>设置描述,使用<see cref="DisplayNameAttribute"/>设置显示名称
/// </summary>
/// <typeparam name="T">类型</typeparam>
/// <returns></returns>
public static string GetDisplayNameOrDescription<T>()
{
var type = GetType<T>();
var result = GetDisplayName(type);
if (string.IsNullOrEmpty(result))
{
result = GetDescription(type);
}
return result;
}
/// <summary>
/// 获取类型显示名称或成员描述,使用<see cref="DescriptionAttribute"/>设置描述,使用<see cref="DisplayNameAttribute"/>或<see cref="DisplayAttribute"/>设置显示名称
/// </summary>
/// <param name="member">成员</param>
/// <returns></returns>
public static string GetDisplayNameOrDescription(MemberInfo member)
{
var result = GetDisplayName(member);
if (!string.IsNullOrEmpty(result))
{
return result;
}
return GetDescription(member);
}
#endregion
#region GetTypesByInterface()
/// <summary>
/// 获取实现了接口的所有具体类型
/// </summary>
/// <typeparam name="TInterface">接口类型</typeparam>
/// <param name="assembly">在该程序集中查找</param>
/// <returns></returns>
public static List<TInterface> GetTypesByInterface<TInterface>(Assembly assembly)
{
var typeInterface = typeof(TInterface);
return
assembly.GetTypes()
.Where(
t =>
typeInterface.GetTypeInfo().IsAssignableFrom(t) && t != typeInterface &&
t.GetTypeInfo().IsAbstract == false)
.Select(t => CreateInstance<TInterface>(t))
.ToList();
}
#endregion
#region CreateInstance()
/// <summary>
/// 动态创建实例
/// </summary>
/// <typeparam name="T">目标类型</typeparam>
/// <param name="type">类型</param>
/// <param name="parameters">传递给构造函数的参数</param>
/// <returns></returns>
public static T CreateInstance<T>(Type type, params object[] parameters)
{
return Conv.To<T>(Activator.CreateInstance(type, parameters));
}
/// <summary>
/// 动态创建实例
/// </summary>
/// <typeparam name="T">目标类型</typeparam>
/// <param name="className">类名,包括命名空间,如果类型不处于当前执行程序集中需要包含程序集名范例Test.Core.Test2,Test.Core</param>
/// <param name="parameters">传递给构造函数的参数</param>
/// <returns></returns>
public static T CreateInstance<T>(string className, params object[] parameters)
{
Type type = Type.GetType(className) ?? Assembly.GetCallingAssembly().GetType(className);
return CreateInstance<T>(type, parameters);
}
#endregion
#region GetAssembly()
/// <summary>
/// 获取程序集
/// </summary>
/// <param name="assemblyName">程序集名称</param>
/// <returns></returns>
public static Assembly GetAssembly(string assemblyName)
{
return Assembly.Load(new AssemblyName(assemblyName));
}
#endregion
#region GetAssemblies()
/// <summary>
/// 从目录获取所有程序集
/// </summary>
/// <param name="directoryPath">目录绝对路径</param>
/// <returns></returns>
public static List<Assembly> GetAssemblies(string directoryPath)
{
return
Directory.GetFiles(directoryPath, "*.*", SearchOption.AllDirectories)
.ToList()
.Where(t => t.EndsWith(".exe") || t.EndsWith(".dll"))
.Select(path => Assembly.Load(new AssemblyName(path)))
.ToList();
}
#endregion
#region GetAttribute()
/// <summary>
/// 获取特性信息
/// </summary>
/// <typeparam name="TAttribute">泛型特性</typeparam>
/// <param name="memberInfo">元数据</param>
/// <returns></returns>
public static TAttribute GetAttribute<TAttribute>(MemberInfo memberInfo) where TAttribute : Attribute
{
return (TAttribute)memberInfo.GetCustomAttributes(typeof(TAttribute), false).FirstOrDefault();
}
#endregion
#region GetAttributes()
/// <summary>
/// 获取特性信息数组
/// </summary>
/// <typeparam name="TAttribute">泛型特性</typeparam>
/// <param name="memberInfo">元数据</param>
/// <returns></returns>
public static TAttribute[] GetAttributes<TAttribute>(MemberInfo memberInfo) where TAttribute : Attribute
{
return Array.ConvertAll(memberInfo.GetCustomAttributes(typeof(TAttribute), false), x => (TAttribute)x);
}
#endregion
#region IsBool()
/// <summary>
/// 是否布尔类型
/// </summary>
/// <param name="member">成员</param>
/// <returns></returns>
public static bool IsBool(MemberInfo member)
{
if (member == null)
{
return false;
}
switch (member.MemberType)
{
case MemberTypes.TypeInfo:
return member.ToString() == "System.Boolean";
case MemberTypes.Property:
return IsBool((PropertyInfo)member);
}
return false;
}
/// <summary>
/// 是否布尔类型
/// </summary>
/// <param name="property">属性</param>
/// <returns></returns>
public static bool IsBool(PropertyInfo property)
{
return property.PropertyType == typeof(bool) || property.PropertyType == typeof(bool?);
}
#endregion
#region IsEnum()
/// <summary>
/// 是否枚举类型
/// </summary>
/// <param name="member">成员</param>
/// <returns></returns>
public static bool IsEnum(MemberInfo member)
{
if (member == null)
{
return false;
}
switch (member.MemberType)
{
case MemberTypes.TypeInfo:
return ((TypeInfo)member).IsEnum;
case MemberTypes.Property:
return IsEnum((PropertyInfo)member);
}
return false;
}
/// <summary>
/// 是否枚举类型
/// </summary>
/// <param name="property">属性</param>
/// <returns></returns>
public static bool IsEnum(PropertyInfo property)
{
if (property.PropertyType.GetTypeInfo().IsEnum)
{
return true;
}
var value = Nullable.GetUnderlyingType(property.PropertyType);
if (value == null)
{
return false;
}
return value.GetTypeInfo().IsEnum;
}
#endregion
#region IsDate()
/// <summary>
/// 是否日期类型
/// </summary>
/// <param name="member">成员</param>
/// <returns></returns>
public static bool IsDate(MemberInfo member)
{
if (member == null)
{
return false;
}
switch (member.MemberType)
{
case MemberTypes.TypeInfo:
return member.ToString() == "System.DateTime";
case MemberTypes.Property:
return IsDate((PropertyInfo)member);
}
return false;
}
/// <summary>
/// 是否日期类型
/// </summary>
/// <param name="property">属性</param>
/// <returns></returns>
public static bool IsDate(PropertyInfo property)
{
if (property.PropertyType == typeof(DateTime))
{
return true;
}
if (property.PropertyType == typeof(DateTime?))
{
return true;
}
return false;
}
#endregion
#region IsInt()
/// <summary>
/// 是否整型
/// </summary>
/// <param name="member">成员</param>
/// <returns></returns>
public static bool IsInt(MemberInfo member)
{
if (member == null)
{
return false;
}
switch (member.MemberType)
{
case MemberTypes.TypeInfo:
return member.ToString() == "System.Int32" || member.ToString() == "System.Int16" ||
member.ToString() == "System.Int64";
case MemberTypes.Property:
return IsInt((PropertyInfo)member);
}
return false;
}
/// <summary>
/// 是否整型
/// </summary>
/// <param name="property">成员</param>
/// <returns></returns>
public static bool IsInt(PropertyInfo property)
{
if (property.PropertyType == typeof(int))
{
return true;
}
if (property.PropertyType == typeof(int?))
{
return true;
}
if (property.PropertyType == typeof(short))
{
return true;
}
if (property.PropertyType == typeof(short?))
{
return true;
}
if (property.PropertyType == typeof(long))
{
return true;
}
if (property.PropertyType == typeof(long?))
{
return true;
}
return false;
}
#endregion
#region IsNumber()
/// <summary>
/// 是否数值类型
/// </summary>
/// <param name="member">成员</param>
/// <returns></returns>
public static bool IsNumber(MemberInfo member)
{
if (member == null)
{
return false;
}
if (IsInt(member))
{
return true;
}
switch (member.MemberType)
{
case MemberTypes.TypeInfo:
return member.ToString() == "System.Double" || member.ToString() == "System.Decimal" ||
member.ToString() == "System.Single";
case MemberTypes.Property:
return IsNumber((PropertyInfo)member);
}
return false;
}
/// <summary>
/// 是否数值类型
/// </summary>
/// <param name="property">属性</param>
/// <returns></returns>
public static bool IsNumber(PropertyInfo property)
{
if (property.PropertyType == typeof(double))
{
return true;
}
if (property.PropertyType == typeof(double?))
{
return true;
}
if (property.PropertyType == typeof(decimal))
{
return true;
}
if (property.PropertyType == typeof(decimal?))
{
return true;
}
if (property.PropertyType == typeof(float))
{
return true;
}
if (property.PropertyType == typeof(float?))
{
return true;
}
return false;
}
#endregion
#region IsGenericCollection()
/// <summary>
/// 是否泛型集合
/// </summary>
/// <param name="type">类型</param>
/// <returns></returns>
public static bool IsGenericCollection(Type type)
{
if (!type.IsGenericType)
{
return false;
}
var typeDefinition = type.GetGenericTypeDefinition();
return typeDefinition == typeof(IEnumerable<>)
|| typeDefinition == typeof(IReadOnlyCollection<>)
|| typeDefinition == typeof(IReadOnlyList<>)
|| typeDefinition == typeof(ICollection<>)
|| typeDefinition == typeof(IList<>)
|| typeDefinition == typeof(List<>);
}
#endregion
#region GetTypeName()
/// <summary>
/// 减去全名正则
/// </summary>
static readonly Regex SubtractFullNameRegex = new Regex(@", Version=\d+.\d+.\d+.\d+, Culture=\w+, PublicKeyToken=\w+", RegexOptions.Compiled);
/// <summary>
/// 获取类型名称
/// </summary>
/// <param name="type">类型</param>
/// <returns></returns>
public static string GetTypeName(Type type)
{
return SubtractFullNameRegex.Replace(type.AssemblyQualifiedName, "");
}
#endregion
#region GetType()
/// <summary>
/// 获取类型
/// </summary>
/// <typeparam name="T">类型</typeparam>
/// <returns></returns>
public static Type GetType<T>()
{
var type = typeof(T);
return Nullable.GetUnderlyingType(type) ?? type;
}
#endregion
}
}

View File

@ -267,8 +267,9 @@
<Reference Include="log4net"> <Reference Include="log4net">
<HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\log4net.dll</HintPath> <HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="NPOI"> <Reference Include="NPOI">
<HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\NPOI.dll</HintPath> <HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\NPOI.dll</HintPath>
@ -287,6 +288,7 @@
<HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\Oracle.DataAccess.dll</HintPath> <HintPath>..\..\派诺(1)\派诺\git\6、程序\GZ_KD_Parino\bin\Debug\Oracle.DataAccess.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.104.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> <Reference Include="System.Data.SQLite, Version=1.0.104.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
@ -314,6 +316,7 @@
<Compile Include="Common\CombinationGenerator.cs" /> <Compile Include="Common\CombinationGenerator.cs" />
<Compile Include="Common\CommonHelper.cs" /> <Compile Include="Common\CommonHelper.cs" />
<Compile Include="Common\HttpClient.cs" /> <Compile Include="Common\HttpClient.cs" />
<Compile Include="Common\JsonHelper.cs" />
<Compile Include="Opportunities\ClickGridCellAndOpenUrlListPlugIn.cs" /> <Compile Include="Opportunities\ClickGridCellAndOpenUrlListPlugIn.cs" />
<Compile Include="Opportunities\OpportunitiesAuditPlugIn.cs" /> <Compile Include="Opportunities\OpportunitiesAuditPlugIn.cs" />
<Compile Include="Opportunities\YJFT_AuditPlugIn.cs" /> <Compile Include="Opportunities\YJFT_AuditPlugIn.cs" />

View File

@ -460,6 +460,7 @@ namespace Pilot_KD_Parino.QPHY_AutoWrire
var oneToOneTemp = (from q in SaleBILLLIS2Sal var oneToOneTemp = (from q in SaleBILLLIS2Sal
join u in ReceiveBILLLIST on new { q.FClient, q.FDAMOUNT } equals new { u.FClient, u.FDAMOUNT } join u in ReceiveBILLLIST on new { q.FClient, q.FDAMOUNT } equals new { u.FClient, u.FDAMOUNT }
select new { q.FClient, q.FBIllNO, q.FCONTRACTNUMBER, u.FDAMOUNT, UFbillNo = u.FBIllNO }).ToList(); select new { q.FClient, q.FBIllNO, q.FCONTRACTNUMBER, u.FDAMOUNT, UFbillNo = u.FBIllNO }).ToList();
//var dasdsas = oneToOneTemp.Where(h => h.FBIllNO == "PL-XSDD20250400471").FirstOrDefault();
var saleList1 = oneToOneTemp.Select(t => t.FBIllNO).Distinct().ToList(); var saleList1 = oneToOneTemp.Select(t => t.FBIllNO).Distinct().ToList();
var ReceiveList1 = oneToOneTemp.Select(t => t.UFbillNo).Distinct().ToList(); var ReceiveList1 = oneToOneTemp.Select(t => t.UFbillNo).Distinct().ToList();
if (saleList1.Count > ReceiveList1.Count) if (saleList1.Count > ReceiveList1.Count)
@ -704,7 +705,7 @@ namespace Pilot_KD_Parino.QPHY_AutoWrire
//绑定收款单数据 //绑定收款单数据
foreach (var item in ReceiveBILLLIST) foreach (var item in ReceiveBILLLIST2)
{ {
if (!string.IsNullOrWhiteSpace(item.FCONTRACTNUMBER)) if (!string.IsNullOrWhiteSpace(item.FCONTRACTNUMBER))
{ {

View File

@ -130,7 +130,7 @@ namespace Pilot_KD_Parino.SQL
FROM T_AR_RECEIVEBILL A FROM T_AR_RECEIVEBILL A
WHERE A.FDOCUMENTSTATUS = 'C' WHERE A.FDOCUMENTSTATUS = 'C'
AND A.FISINIT != '1' AND A.FISINIT != '1'
AND A.FRECAMOUNT != A.F_AMOUNT AND A.FRECAMOUNT != A.F_AMOUNT
AND A.FRECAMOUNT >= A.F_AMOUNT {where} AND A.FRECAMOUNT >= A.F_AMOUNT {where}
order by FCONTACTUNIT,A.FID desc ", FORGID); order by FCONTACTUNIT,A.FID desc ", FORGID);

View File

@ -16,6 +16,8 @@ using Kingdee.BOS.Orm;
using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper; using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util; using Kingdee.BOS.Util;
using Newtonsoft.Json.Linq;
using Pilot_KD_Parino.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -45,16 +47,29 @@ namespace Pilot_KD_Parino.Sal_Order
var FEntity = this.View.Model.DataObject; var FEntity = this.View.Model.DataObject;
var fid = FEntity.GetPrimaryKeyValue(); var fid = FEntity.GetPrimaryKeyValue();
var json = JsonUtil.Serialize(FEntity); //var json = JsonUtil.Serialize(FEntity);
Logger.Error("FEntity",json,new Exception()); //var row = JsonHelper.ToObject<T_SAL_DELIVERYNOTICE>(json);
//Logger.Error("FEntity",json,new Exception());
var id = FEntity["id"]; var id = FEntity["id"];
var FSALEORGID = FEntity["SaleOrgId"]; var FSALEORGID = FEntity["SaleOrgId"];
this.View.ShowMessage("就是这个按钮"+ id); sBillNo = FEntity["BillNo"].ToString();//发货通知单号
var detailList = (FEntity["SAL_DELIVERYNOTICEENTRY"]);
//sId = row.Id;//发货通知单ID
//sEntryId = row.SAL_DELIVERYNOTICEENTRY Convert.ToInt64(row.EntryPrimaryKeyValue);//发货通知单ID
//string sSql = "select FID from T_SAL_DELIVERYNOTICEENTRY where FID= " + sId + " and FENTRYID= " + sEntryId + " and abs(FBaseUnitQty) > abs(FBASEJOINOUTQTY) ";
//sSql = String.Format(@"/*dialect*/" + sSql);
//var dt = DBServiceHelper.ExecuteDynamicObject(this.Context, sSql);
if (detailList!=null)
{
string getSourceSql = "select FID from T_SAL_DELIVERYNOTICE where FBILLNO='" + sBillNo + "'";
IOperationResult result = Invoke("SAL_DELIVERYNOTICE", "PUR_ReceiveBill", getSourceSql, "7cd93c259999489c97798063f2f7bd70");
}
return; //this.View.ShowMessage("就是这个按钮"+ id);
//ListSelectedRowCollection rows = this.ListView.SelectedRowsInfo;
//ListSelectedRowCollection rows =new ListSelectedRowCollection();
//List<string> pkIds = new List<string>(); //List<string> pkIds = new List<string>();
//List<object> pkEntryIds = new List<object>(); //List<object> pkEntryIds = new List<object>();
//if (rows.Count <= 0) //if (rows.Count <= 0)
@ -106,6 +121,7 @@ namespace Pilot_KD_Parino.Sal_Order
pushArgs.TargetBillTypeId = sargetBillTypeId;//单据类型 pushArgs.TargetBillTypeId = sargetBillTypeId;//单据类型
//转换生成目标单 //转换生成目标单
ConvertOperationResult convertResult = ServiceHelper.GetService<IConvertService>().Push(this.Context, pushArgs); ConvertOperationResult convertResult = ServiceHelper.GetService<IConvertService>().Push(this.Context, pushArgs);
////合并转换操作结果 ////合并转换操作结果
//result.MergeResult(convertResult); //result.MergeResult(convertResult);
@ -114,6 +130,10 @@ namespace Pilot_KD_Parino.Sal_Order
//根据实际情况,处理目标单据数据 //根据实际情况,处理目标单据数据
//destObjs[0]["Date"] = Convert.ToDateTime(sDate); //destObjs[0]["Date"] = Convert.ToDateTime(sDate);
DynamicObjectCollection col_FEntityDetail; DynamicObjectCollection col_FEntityDetail;
var sdsas= JsonHelper.ToJson(destObjs);
Logger.Error("目标单据数据集合", sdsas, new Exception ());
this.View.ShowMessage("好了好了,就是这个按钮");
//return result;
////if (target == "SAL_OUTSTOCK")//销售出库 ////if (target == "SAL_OUTSTOCK")//销售出库
////{ ////{
//col_FEntityDetail = destObjs[0]["SAL_OUTSTOCKENTRY"] as DynamicObjectCollection; //col_FEntityDetail = destObjs[0]["SAL_OUTSTOCKENTRY"] as DynamicObjectCollection;
@ -170,6 +190,7 @@ namespace Pilot_KD_Parino.Sal_Order
//this.View.ShowErrMessage("调用下推, 导致自动保存失败 原因:" + saveResult.ValidationErrors[0].Message.ToString()); //this.View.ShowErrMessage("调用下推, 导致自动保存失败 原因:" + saveResult.ValidationErrors[0].Message.ToString());
throw new KDBusinessException("", "未知原因导致自动保存失败原因:" + errorInfo); throw new KDBusinessException("", "未知原因导致自动保存失败原因:" + errorInfo);
} }
return result;
//this.View.ShowMessage("1"); //this.View.ShowMessage("1");
// 取到需要自动提交、审核的单据内码 // 取到需要自动提交、审核的单据内码
object[] pkArray = (from p in destObjs select p[0]).ToArray(); object[] pkArray = (from p in destObjs select p[0]).ToArray();

Binary file not shown.

Binary file not shown.