|
|
|
@ -57,6 +57,9 @@ using Microsoft.VisualBasic.FileIO;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using AnyDiff.Extensions;
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using LanguageExt;
|
|
|
|
|
using Masuit.Tools.Models;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Op.Method
|
|
|
|
|
{
|
|
|
|
@ -4525,36 +4528,73 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var diff = req.NewOrder.Diff(req.OldOrder);
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
foreach (var item in diff)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"{item.PropertyType} - {item.Property}: {item.LeftValue} => {item.RightValue}");
|
|
|
|
|
//StringBuilder sb = new StringBuilder();
|
|
|
|
|
//foreach (var item in diff)
|
|
|
|
|
//{
|
|
|
|
|
// Console.WriteLine($"{item.PropertyType} - {item.Property}: {item.LeftValue} => {item.RightValue}");
|
|
|
|
|
|
|
|
|
|
if (item.LeftValue.IsNotNull() && item.RightValue.IsNotNull())
|
|
|
|
|
{
|
|
|
|
|
if (IgnoreColumns.Contains(item.Property))
|
|
|
|
|
continue;
|
|
|
|
|
if (!item.LeftValue.Equals(item.RightValue))
|
|
|
|
|
{
|
|
|
|
|
sb.Append($"[字段:{item.Property},修改前:{item.LeftValue},修改后:{item.RightValue}]");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// if (item.LeftValue.IsNotNull() && item.RightValue.IsNotNull())
|
|
|
|
|
// {
|
|
|
|
|
// if (IgnoreColumns.Contains(item.Property))
|
|
|
|
|
// continue;
|
|
|
|
|
// if (!item.LeftValue.Equals(item.RightValue))
|
|
|
|
|
// {
|
|
|
|
|
// sb.Append($"[字段:{item.Property},修改前:{item.LeftValue},修改后:{item.RightValue}]");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
var log = new OpBusinessLog()
|
|
|
|
|
{
|
|
|
|
|
BusinessId = req.NewOrder.Id,
|
|
|
|
|
OperateType = "Update",
|
|
|
|
|
OldValue = JsonConvert.SerializeObject(req.OldOrder),
|
|
|
|
|
NewValue = JsonConvert.SerializeObject(req.NewOrder),
|
|
|
|
|
DiffData = sb.ToString(),
|
|
|
|
|
//OldValue = JsonConvert.SerializeObject(req.OldOrder),
|
|
|
|
|
//NewValue = JsonConvert.SerializeObject(req.NewOrder),
|
|
|
|
|
//DiffData = sb.ToString(),
|
|
|
|
|
SourceCode = req.SourceCode,
|
|
|
|
|
SourceName = req.SourceName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await tenantDb.Insertable(log).ExecuteCommandAsync();
|
|
|
|
|
//await tenantDb.Insertable(log).ExecuteCommandAsync();
|
|
|
|
|
var logId = await tenantDb.Insertable(log).ExecuteReturnEntityAsync();
|
|
|
|
|
var detail = new List<OpBusinessLogDetail>();
|
|
|
|
|
var list = TypeDescriptor.GetProperties(req.NewOrder);
|
|
|
|
|
foreach (PropertyDescriptor descriptor in list)
|
|
|
|
|
{
|
|
|
|
|
string name = descriptor.Name;
|
|
|
|
|
if (IgnoreColumns.Contains(name))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
object value = descriptor.GetValue(req.NewOrder);
|
|
|
|
|
var oldvalue = req.OldOrder.GetType().GetProperty(name).GetValue(req.OldOrder, null);
|
|
|
|
|
|
|
|
|
|
if (name == "KGS" || name == "CBM")
|
|
|
|
|
{
|
|
|
|
|
if (Convert.ToDecimal(value) == Convert.ToDecimal(oldvalue))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
string _oldvalue = oldvalue != null ? oldvalue.ToString() : "";
|
|
|
|
|
string _value = value != null ? value.ToString() : "";
|
|
|
|
|
if (_oldvalue != _value && !string.IsNullOrWhiteSpace(descriptor.Description))
|
|
|
|
|
{
|
|
|
|
|
detail.Add(new OpBusinessLogDetail()
|
|
|
|
|
{
|
|
|
|
|
Pid = logId.Id,
|
|
|
|
|
OldValue = _oldvalue,
|
|
|
|
|
NewValue = _value,
|
|
|
|
|
FieldValue = descriptor.Description,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (detail.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
await tenantDb.Insertable(detail).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|