9 changed files with 740 additions and 38 deletions
@ -0,0 +1,18 @@ |
|||||
|
using TaskManager.Contracts.Dtos; |
||||
|
using TaskManager.Entity; |
||||
|
using TaskManager.Entity.Entitys; |
||||
|
using TaskManager.EntityFramework; |
||||
|
|
||||
|
namespace TaskManager.Controllers |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 排产数据
|
||||
|
/// </summary>
|
||||
|
public class CherySupplierProSchedulingService : CheryRecurringJobInputPageController<SUPPLIER_PRO_SCHEDULING, SUPPLIER_PRO_SCHEDULING_DTO> |
||||
|
{ |
||||
|
public CherySupplierProSchedulingService(HttpClient httpClient, JobDbContext jobDbContext, LogController log, IRepository<SUPPLIER_PRO_SCHEDULING> repository) : base(httpClient, jobDbContext, log, repository) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,6 +0,0 @@ |
|||||
namespace TaskManager.Controllers |
|
||||
{ |
|
||||
public class SupplierPoSchedulingService |
|
||||
{ |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,99 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.IO; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Wood.Util |
||||
|
{ |
||||
|
public static class CommonHelper |
||||
|
{ |
||||
|
public static Guid NewGuid |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return Guid.NewGuid(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static string NewGuidStr |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return Guid.NewGuid().ToString(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static DateTime CurrentTime |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return DateTime.Now; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static string CurrentTimeStr |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
DateTime dt = CurrentTime; |
||||
|
return dt.ToString("yyyy-MM-dd HH:mm:ss"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static string CurrentMachineName |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return Environment.MachineName; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static string UserName |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return "Admin"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Expression动态拼接+泛型缓存
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TIn"></typeparam>
|
||||
|
/// <typeparam name="TOut"></typeparam>
|
||||
|
public class ExpressionGenericMapper<TIn, TOut>//Mapper`2
|
||||
|
{ |
||||
|
private static Func<TIn, TOut> _FUNC = null; |
||||
|
static ExpressionGenericMapper() |
||||
|
{ |
||||
|
ParameterExpression parameterExpression = Expression.Parameter(typeof(TIn), "p"); |
||||
|
List<MemberBinding> memberBindingList = new List<MemberBinding>(); |
||||
|
foreach (var item in typeof(TOut).GetProperties()) |
||||
|
{ |
||||
|
MemberExpression property = Expression.Property(parameterExpression, typeof(TIn).GetProperty(item.Name)); |
||||
|
MemberBinding memberBinding = Expression.Bind(item, property); |
||||
|
memberBindingList.Add(memberBinding); |
||||
|
} |
||||
|
foreach (var item in typeof(TOut).GetFields()) |
||||
|
{ |
||||
|
MemberExpression property = Expression.Field(parameterExpression, typeof(TIn).GetField(item.Name)); |
||||
|
MemberBinding memberBinding = Expression.Bind(item, property); |
||||
|
memberBindingList.Add(memberBinding); |
||||
|
} |
||||
|
MemberInitExpression memberInitExpression = Expression.MemberInit(Expression.New(typeof(TOut)), memberBindingList.ToArray()); |
||||
|
Expression<Func<TIn, TOut>> lambda = Expression.Lambda<Func<TIn, TOut>>(memberInitExpression, new ParameterExpression[] |
||||
|
{ |
||||
|
parameterExpression |
||||
|
}); |
||||
|
_FUNC = lambda.Compile();//拼装是一次性的
|
||||
|
} |
||||
|
public static TOut Trans(TIn t) |
||||
|
{ |
||||
|
return _FUNC(t); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue