liuyunfeng
11 months ago
23 changed files with 2933 additions and 4 deletions
@ -0,0 +1,131 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive.Dtos |
||||
|
{ |
||||
|
public class ImportRecordCreateDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 工厂
|
||||
|
/// </summary>
|
||||
|
public virtual string Factory { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车位
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工位
|
||||
|
/// </summary>
|
||||
|
public virtual string WorkLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 底盘号
|
||||
|
/// </summary>
|
||||
|
public virtual string Vin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车身号
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleBodyCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型代码
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型名称
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型描述
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格
|
||||
|
/// </summary>
|
||||
|
public virtual string Spec { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格说明
|
||||
|
/// </summary>
|
||||
|
public virtual string SpecDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 类别
|
||||
|
/// </summary>
|
||||
|
public virtual string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 涂装下线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? PaintOfflineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总装上线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? OnlineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 内饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string InteriorColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 外饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string ExteriorTrimmingColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 序列号
|
||||
|
/// </summary>
|
||||
|
public virtual string SerialNum { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流水号
|
||||
|
/// </summary>
|
||||
|
public virtual int HostSN { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线:A/B
|
||||
|
/// </summary>
|
||||
|
public virtual string ProductLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 目的
|
||||
|
/// </summary>
|
||||
|
public virtual string Target { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建人
|
||||
|
/// </summary>
|
||||
|
public virtual string CreatePerson { get; set; } |
||||
|
|
||||
|
public virtual DateTime? ImportTime { get; set; } |
||||
|
|
||||
|
public virtual string ImportPerson { get; set; } |
||||
|
|
||||
|
public virtual string Remark2 { get; set; } |
||||
|
|
||||
|
public virtual string Remark3 { get; set; } |
||||
|
|
||||
|
public virtual string Remark4 { get; set; } |
||||
|
|
||||
|
public virtual string Remark5 { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,197 @@ |
|||||
|
using Magicodes.ExporterAndImporter.Core; |
||||
|
using Magicodes.ExporterAndImporter.Excel; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive.Dtos |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 导入记录表
|
||||
|
/// </summary>
|
||||
|
[ExcelExporter(Name = "导入记录表", AutoFitAllColumn = true, MaxRowNumberOnASheet = 50000)] //一个Sheet最大允许的行数,设置了之后将输出多个Sheet
|
||||
|
[Serializable] |
||||
|
public class ImportRecordDto |
||||
|
{ |
||||
|
[ExporterHeader(IsIgnore = true)] |
||||
|
[ImporterHeader(IsIgnore = true)] |
||||
|
public virtual Guid Id { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 工厂
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "工厂")] |
||||
|
[ImporterHeader(Name = "工厂")] |
||||
|
public virtual string Factory { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车位
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "车位")] |
||||
|
[ImporterHeader(Name = "车位")] |
||||
|
public virtual string VehicleLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工位
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "工位")] |
||||
|
[ImporterHeader(Name = "工位")] |
||||
|
public virtual string WorkLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 底盘号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "底盘号")] |
||||
|
[ImporterHeader(Name = "底盘号")] |
||||
|
public virtual string Vin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车身号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "车身号")] |
||||
|
[ImporterHeader(Name = "车身号")] |
||||
|
public virtual string VehicleBodyCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型代码
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "车型代码")] |
||||
|
[ImporterHeader(Name = "车型代码")] |
||||
|
public virtual string VehicleModelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型名称
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "车型名称")] |
||||
|
[ImporterHeader(Name = "车型名称")] |
||||
|
public virtual string VehicleModelName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型描述
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "车型描述")] |
||||
|
[ImporterHeader(Name = "车型描述")] |
||||
|
public virtual string VehicleModelDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "规格")] |
||||
|
[ImporterHeader(Name = "规格")] |
||||
|
public virtual string Spec { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格说明
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "规格说明")] |
||||
|
[ImporterHeader(Name = "规格说明")] |
||||
|
public virtual string SpecDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 类别
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "类别")] |
||||
|
[ImporterHeader(Name = "类别")] |
||||
|
public virtual string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 涂装下线时间
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "涂装下线时间", Format ="yyyy/MM/dd HH:mm:ss")] |
||||
|
[ImporterHeader(Name = "涂装下线时间", Format = "yyyy/MM/dd HH:mm:ss")] |
||||
|
public virtual DateTime? PaintOfflineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总装上线时间
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "总装上线时间", Format = "yyyy/MM/dd HH:mm:ss")] |
||||
|
[ImporterHeader(Name = "总装上线时间", Format = "yyyy/MM/dd HH:mm:ss")] |
||||
|
public virtual DateTime? OnlineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 内饰颜色
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "内饰颜色")] |
||||
|
[ImporterHeader(Name = "内饰颜色")] |
||||
|
public virtual string InteriorColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 外饰颜色
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "外饰颜色")] |
||||
|
[ImporterHeader(Name = "外饰颜色")] |
||||
|
public virtual string ExteriorTrimmingColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 序列号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "序列号")] |
||||
|
[ImporterHeader(Name = "序列号")] |
||||
|
public virtual string SerialNum { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流水号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "流水号")] |
||||
|
[ImporterHeader(Name = "流水号")] |
||||
|
public virtual int HostSN { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线:A/B
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "生产线:A/B")] |
||||
|
[ImporterHeader(Name = "生产线:A/B")] |
||||
|
public virtual string ProductLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 目的
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "目的")] |
||||
|
[ImporterHeader(Name = "目的")] |
||||
|
public virtual string Target { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "备注")] |
||||
|
[ImporterHeader(Name = "备注")] |
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建时间
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "创建时间", Format = "yyyy/MM/dd HH:mm:ss")] |
||||
|
[ImporterHeader(Name = "创建时间", Format = "yyyy/MM/dd HH:mm:ss")] |
||||
|
public virtual DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建人
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "创建人")] |
||||
|
[ImporterHeader(Name = "创建人")] |
||||
|
public virtual string CreatePerson { get; set; } |
||||
|
|
||||
|
[ExporterHeader(IsIgnore = true)] |
||||
|
[ImporterHeader(IsIgnore = true)] |
||||
|
public virtual DateTime? ImportTime { get; set; } |
||||
|
|
||||
|
[ExporterHeader(IsIgnore = true)] |
||||
|
[ImporterHeader(IsIgnore = true)] |
||||
|
public virtual string ImportPerson { get; set; } |
||||
|
|
||||
|
[ExporterHeader(IsIgnore = true)] |
||||
|
[ImporterHeader(IsIgnore = true)] |
||||
|
public virtual string Remark2 { get; set; } |
||||
|
|
||||
|
[ExporterHeader(IsIgnore = true)] |
||||
|
[ImporterHeader(IsIgnore = true)] |
||||
|
public virtual string Remark3 { get; set; } |
||||
|
|
||||
|
[ExporterHeader(IsIgnore = true)] |
||||
|
[ImporterHeader(IsIgnore = true)] |
||||
|
public virtual string Remark4 { get; set; } |
||||
|
|
||||
|
[ExporterHeader(IsIgnore = true)] |
||||
|
[ImporterHeader(IsIgnore = true)] |
||||
|
public virtual string Remark5 { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,131 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive.Dtos |
||||
|
{ |
||||
|
public class ImportRecordHisCreateDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 工厂
|
||||
|
/// </summary>
|
||||
|
public virtual string Factory { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车位
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工位
|
||||
|
/// </summary>
|
||||
|
public virtual string WorkLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 底盘号
|
||||
|
/// </summary>
|
||||
|
public virtual string Vin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车身号
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleBodyCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型代码
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型名称
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型描述
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格
|
||||
|
/// </summary>
|
||||
|
public virtual string Spec { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格说明
|
||||
|
/// </summary>
|
||||
|
public virtual string SpecDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 类别
|
||||
|
/// </summary>
|
||||
|
public virtual string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 涂装下线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? PaintOfflineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总装上线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? OnlineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 内饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string InteriorColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 外饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string ExteriorTrimmingColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 序列号
|
||||
|
/// </summary>
|
||||
|
public virtual string SerialNum { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流水号
|
||||
|
/// </summary>
|
||||
|
public virtual int HostSN { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线:A/B
|
||||
|
/// </summary>
|
||||
|
public virtual string ProductLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 目的
|
||||
|
/// </summary>
|
||||
|
public virtual string Target { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建人
|
||||
|
/// </summary>
|
||||
|
public virtual string CreatePerson { get; set; } |
||||
|
|
||||
|
public virtual DateTime? ImportTime { get; set; } |
||||
|
|
||||
|
public virtual string ImportPerson { get; set; } |
||||
|
|
||||
|
public virtual string Remark2 { get; set; } |
||||
|
|
||||
|
public virtual string Remark3 { get; set; } |
||||
|
|
||||
|
public virtual string Remark4 { get; set; } |
||||
|
|
||||
|
public virtual string Remark5 { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,132 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive.Dtos |
||||
|
{ |
||||
|
public class ImportRecordHisDto |
||||
|
{ |
||||
|
public Guid Id { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 工厂
|
||||
|
/// </summary>
|
||||
|
public virtual string Factory { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车位
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工位
|
||||
|
/// </summary>
|
||||
|
public virtual string WorkLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 底盘号
|
||||
|
/// </summary>
|
||||
|
public virtual string Vin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车身号
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleBodyCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型代码
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型名称
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型描述
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格
|
||||
|
/// </summary>
|
||||
|
public virtual string Spec { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格说明
|
||||
|
/// </summary>
|
||||
|
public virtual string SpecDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 类别
|
||||
|
/// </summary>
|
||||
|
public virtual string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 涂装下线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? PaintOfflineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总装上线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? OnlineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 内饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string InteriorColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 外饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string ExteriorTrimmingColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 序列号
|
||||
|
/// </summary>
|
||||
|
public virtual string SerialNum { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流水号
|
||||
|
/// </summary>
|
||||
|
public virtual int HostSN { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线:A/B
|
||||
|
/// </summary>
|
||||
|
public virtual string ProductLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 目的
|
||||
|
/// </summary>
|
||||
|
public virtual string Target { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建人
|
||||
|
/// </summary>
|
||||
|
public virtual string CreatePerson { get; set; } |
||||
|
|
||||
|
public virtual DateTime? ImportTime { get; set; } |
||||
|
|
||||
|
public virtual string ImportPerson { get; set; } |
||||
|
|
||||
|
public virtual string Remark2 { get; set; } |
||||
|
|
||||
|
public virtual string Remark3 { get; set; } |
||||
|
|
||||
|
public virtual string Remark4 { get; set; } |
||||
|
|
||||
|
public virtual string Remark5 { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,86 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using WY.NewJit.Common; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive.Dtos |
||||
|
{ |
||||
|
public class ImportRecordInputDto : PagedAndSortedBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 工厂
|
||||
|
/// </summary>
|
||||
|
public virtual string Factory { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 底盘号
|
||||
|
/// </summary>
|
||||
|
public virtual string Vin { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型代码
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 涂装下线时间起
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? PaintOfflineTimeBegin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 涂装下线时间止
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? PaintOfflineTimeEnd { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总装上线时间起
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? OnlineTimeBegin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总装上线时间止
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? OnlineTimeEnd { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 序列号起
|
||||
|
/// </summary>
|
||||
|
public virtual string SerialNumBegin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 序列号止
|
||||
|
/// </summary>
|
||||
|
public virtual string SerialNumEnd { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流水号起
|
||||
|
/// </summary>
|
||||
|
public virtual int? HostSNBegin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流水号止
|
||||
|
/// </summary>
|
||||
|
public virtual int? HostSNEnd { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线:A/B
|
||||
|
/// </summary>
|
||||
|
public virtual string ProductLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建时间起
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? CreateTimeBegin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建时间止
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? CreateTimeEnd { get; set; } |
||||
|
|
||||
|
public virtual DateTime? ImportTimeBegin { get; set; } |
||||
|
public virtual DateTime? ImportTimeEnd { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,69 @@ |
|||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using WY.NewJit.EdiReceive.Dtos; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive.Interfaces |
||||
|
{ |
||||
|
public interface IImportRecordAppService : IApplicationService |
||||
|
{ |
||||
|
#region 接口方法
|
||||
|
|
||||
|
/// 根据筛选条件获取分页实体列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="input">输入查询条件</param>
|
||||
|
/// <param name="page">输入分页条件</param>
|
||||
|
/// <returns>返回符合条件的排序分页列表</returns>
|
||||
|
Task<PagedResultDto<ImportRecordDto>> GetListAsync(ImportRecordInputDto input); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按主键获取唯一实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">主键</param>
|
||||
|
/// <returns>实体信息</returns>
|
||||
|
Task<ObjectResultDto<ImportRecordDto>> GetAsync(Guid id); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 添加实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="input">添加内容</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
Task<ObjectResultDto<Guid>> CreateAsync(ImportRecordCreateDto input); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">更新主键</param>
|
||||
|
/// <param name="input">修改内容</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
Task<ObjectResultDto> UpdateAsync(Guid id, ImportRecordCreateDto input); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">删除主键</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
Task<ObjectResultDto> DeleteAsync(string id); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导出信息
|
||||
|
/// </summary>
|
||||
|
/// <param name="input">导出查询条件</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
Task<ObjectResultDto<string>> ExportAsync(ImportRecordInputDto input); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导入信息
|
||||
|
/// </summary>
|
||||
|
/// <param name="input">导入文件流</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
Task<ObjectResultDto> ImportAsync([FromForm] IFormFileCollection files); |
||||
|
#endregion
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,476 @@ |
|||||
|
using Magicodes.ExporterAndImporter.Core; |
||||
|
using Magicodes.ExporterAndImporter.Core.Models; |
||||
|
using Magicodes.ExporterAndImporter.Excel; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Shouldly; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.IO; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.BlobStoring; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Uow; |
||||
|
using WY.NewJit.Common; |
||||
|
using WY.NewJit.EdiReceive.Dtos; |
||||
|
using WY.NewJit.EdiReceive.Entitys; |
||||
|
using WY.NewJit.EdiReceive.Interfaces; |
||||
|
using WY.NewJit.EntityFrameworkCore; |
||||
|
using WY.NewJit.MsgBaseData; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 零件管理应用服务实现
|
||||
|
/// </summary>
|
||||
|
[Microsoft.AspNetCore.Mvc.Route("api/newjit/import-record")] |
||||
|
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.报文接收)] |
||||
|
public class ImportRecordAppService : ApplicationService, IImportRecordAppService |
||||
|
{ |
||||
|
#region 成员
|
||||
|
/// <summary>
|
||||
|
/// 零件仓储
|
||||
|
/// </summary>
|
||||
|
private readonly IRepository<ImportRecord, Guid> _importRecordRepository; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 日志
|
||||
|
/// </summary>
|
||||
|
private ILogger<ImportRecordAppService> _logger; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Dapper仓储
|
||||
|
/// </summary>
|
||||
|
private readonly NewJitDapperRepository _newJitDapperRepository; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// BLOB存储
|
||||
|
/// </summary>
|
||||
|
private readonly IBlobContainer<OurFileContainer> _blobContainer; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 字典领域服务
|
||||
|
/// </summary>
|
||||
|
private readonly DicDomainService _dicDomainService; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 错误信息前缀
|
||||
|
/// </summary>
|
||||
|
private string _errorMessagePrefix |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "."; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 构造函数
|
||||
|
/// </summary>
|
||||
|
public ImportRecordAppService( |
||||
|
IRepository<ImportRecord, Guid> importRecordRepository, |
||||
|
ILogger<ImportRecordAppService> logger, |
||||
|
NewJitDapperRepository newJitDapperRepository, |
||||
|
IBlobContainer<OurFileContainer> blobContainer, |
||||
|
DicDomainService dicDomainService |
||||
|
) |
||||
|
{ |
||||
|
_importRecordRepository = importRecordRepository; |
||||
|
_logger = logger; |
||||
|
_newJitDapperRepository = newJitDapperRepository; |
||||
|
_blobContainer = blobContainer; |
||||
|
_dicDomainService = dicDomainService; |
||||
|
} |
||||
|
|
||||
|
#region 私有方法
|
||||
|
private static string GetWhere(ImportRecordInputDto input) |
||||
|
{ |
||||
|
string where = ""; |
||||
|
if (input.Factory.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and Factory = '{0}'", input.Factory); |
||||
|
} |
||||
|
if (input.Vin.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and Vin = '{0}'", input.Vin); |
||||
|
} |
||||
|
if (input.VehicleModelCode.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and VehicleModelCode = '{0}'", input.VehicleModelCode); |
||||
|
} |
||||
|
if (input.PaintOfflineTimeBegin.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and PaintOfflineTime >= '{0}'", input.PaintOfflineTimeBegin); |
||||
|
} |
||||
|
if (input.PaintOfflineTimeEnd.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and PaintOfflineTime <= '{0}'", input.PaintOfflineTimeEnd); |
||||
|
} |
||||
|
if (input.OnlineTimeBegin.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and OnlineTime >= '{0}'", input.OnlineTimeBegin); |
||||
|
} |
||||
|
if (input.OnlineTimeEnd.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and OnlineTime <= '{0}'", input.OnlineTimeEnd); |
||||
|
} |
||||
|
if (input.OnlineTimeBegin.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and OnlineTime >= '{0}'", input.OnlineTimeBegin); |
||||
|
} |
||||
|
if (input.OnlineTimeEnd.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and OnlineTime <= '{0}'", input.OnlineTimeEnd); |
||||
|
} |
||||
|
if (input.SerialNumBegin.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and SerialNum >= '{0}'", input.SerialNumBegin); |
||||
|
} |
||||
|
if (input.SerialNumEnd.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and SerialNum <= '{0}'", input.SerialNumEnd); |
||||
|
} |
||||
|
if (input.HostSNBegin.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and HostSN >= '{0}'", input.HostSNBegin); |
||||
|
} |
||||
|
if (input.HostSNEnd.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and HostSN <= '{0}'", input.HostSNEnd); |
||||
|
} |
||||
|
if (input.ProductLine.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and ProductLine = '{0}'", input.ProductLine); |
||||
|
} |
||||
|
if (input.CreateTimeBegin.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and CreateTime >= '{0}'", input.CreateTimeBegin); |
||||
|
} |
||||
|
if (input.CreateTimeEnd.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and CreateTime <= '{0}'", input.CreateTimeEnd); |
||||
|
} |
||||
|
if (input.ImportTimeBegin.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and ImportTime >= '{0}'", input.ImportTimeBegin); |
||||
|
} |
||||
|
if (input.ImportTimeEnd.HasValue()) |
||||
|
{ |
||||
|
where += string.Format(" and ImportTime <= '{0}'", input.ImportTimeEnd); |
||||
|
} |
||||
|
return where; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取单表记录总数
|
||||
|
/// </summary>
|
||||
|
/// <param name="tableName"></param>
|
||||
|
/// <param name="where"></param>
|
||||
|
/// <returns></returns>
|
||||
|
private async Task<int> GetEntityCountAsync(string tableName, string where) |
||||
|
{ |
||||
|
string sql = $"select count(*) from {tableName} where 1=1 {where}"; |
||||
|
var ret = await _newJitDapperRepository.GetSingleBySqlAsync<int>(sql); |
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取单表当前页数据
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="T"></typeparam>
|
||||
|
/// <param name="tableName"></param>
|
||||
|
/// <param name="where"></param>
|
||||
|
/// <param name="orderFieldName"></param>
|
||||
|
/// <param name="pageSize"></param>
|
||||
|
/// <param name="pageIndex"></param>
|
||||
|
/// <returns></returns>
|
||||
|
private async Task<List<T>> GetEntityListAsync<T>(string tableName, string where, string orderFieldName, int pageSize, int pageIndex) |
||||
|
{ |
||||
|
int takeNum = pageSize; |
||||
|
int skipNum = (pageIndex - 1) * pageSize; |
||||
|
string sql = $"select * from {tableName} where 1=1 {where} order by {orderFieldName} offset {skipNum} rows fetch next {takeNum} rows only"; |
||||
|
var ret = await _newJitDapperRepository.GetListBySqlAsync<T>(sql); |
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
private async Task<List<T>> GetEntityListFromToAsync<T>(string tableName, string where, string orderFieldName, int skipNum, int takeNum) |
||||
|
{ |
||||
|
string sql = $"select * from {tableName} where 1=1 {where} order by {orderFieldName} offset {skipNum} rows fetch next {takeNum} rows only"; |
||||
|
var ret = await _newJitDapperRepository.GetListBySqlAsync<T>(sql); |
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据筛选条件获取实体列表
|
||||
|
/// </summary>
|
||||
|
private async Task<PagedResultDto<ImportRecordDto>> QueryByConditionAsync(ImportRecordInputDto input, PagedAndSortedBase page) |
||||
|
{ |
||||
|
PagedResultDto<ImportRecordDto> ret = new PagedResultDto<ImportRecordDto>(); |
||||
|
string where = GetWhere(input); |
||||
|
|
||||
|
ret.TotalCount = await GetEntityCountAsync("FisImportRecord", where); |
||||
|
|
||||
|
//计算分页
|
||||
|
int skipNum = page.SkipCount; |
||||
|
int takeNum = page.MaxResultCount; |
||||
|
|
||||
|
var lst = await GetEntityListFromToAsync<ImportRecordDto>("FisImportRecord", where, "HostSN", skipNum, takeNum); |
||||
|
ret.Items = lst; |
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
|
||||
|
#region 公有方法
|
||||
|
/// <summary>
|
||||
|
/// 根据筛选条件获取分页实体列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="input">输入查询条件</param>
|
||||
|
/// <returns>返回符合条件的排序分页列表</returns>
|
||||
|
[HttpGet] |
||||
|
[UnitOfWork(false)] |
||||
|
[Route("list")] |
||||
|
public async Task<PagedResultDto<ImportRecordDto>> GetListAsync(ImportRecordInputDto input) |
||||
|
{ |
||||
|
_logger.LogDebug(_errorMessagePrefix + "GetListAsync 进入"); |
||||
|
PagedResultDto<ImportRecordDto> ret = new PagedResultDto<ImportRecordDto>(); |
||||
|
try |
||||
|
{ |
||||
|
ret = await QueryByConditionAsync(input, (PagedAndSortedBase)input); |
||||
|
return ret; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
var msg = _errorMessagePrefix + "GetListAsync 执行出错:" + ex.Message; |
||||
|
_logger.LogError(msg); |
||||
|
return ret; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按主键获取唯一实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">主键</param>
|
||||
|
/// <returns>实体信息</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("{id}")] |
||||
|
public async Task<ObjectResultDto<ImportRecordDto>> GetAsync(Guid id) |
||||
|
{ |
||||
|
_logger.LogDebug(_errorMessagePrefix + "GetAsync 进入"); |
||||
|
ObjectResultDto<ImportRecordDto> ret = new ObjectResultDto<ImportRecordDto>(); |
||||
|
try |
||||
|
{ |
||||
|
ImportRecord sourceObj = await _importRecordRepository.GetAsync(id); |
||||
|
ImportRecordDto targetObj = ObjectMapper.Map<ImportRecord, ImportRecordDto>(sourceObj); |
||||
|
ret.Item = targetObj; |
||||
|
return ret; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
ret.Status = false; |
||||
|
ret.Message = _errorMessagePrefix + "GetAsync 执行出错:" + ex.Message; |
||||
|
_logger.LogError(ret.Message); |
||||
|
return ret; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 添加实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="input">添加内容</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
[HttpPost] |
||||
|
[UnitOfWork] |
||||
|
[Route("")]//create
|
||||
|
public async Task<ObjectResultDto<Guid>> CreateAsync(ImportRecordCreateDto input) |
||||
|
{ |
||||
|
_logger.LogDebug(_errorMessagePrefix + "CreateAsync 进入"); |
||||
|
ObjectResultDto<Guid> ret = new ObjectResultDto<Guid>(); |
||||
|
try |
||||
|
{ |
||||
|
ImportRecord obj = ObjectMapper.Map<ImportRecordCreateDto, ImportRecord>(input); |
||||
|
ImportRecord obj2 = await _importRecordRepository.InsertAsync(obj); |
||||
|
ret.Item = obj2.Id; //返回添加对象的主键
|
||||
|
return ret; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
ret.Status = false; |
||||
|
ret.Message = _errorMessagePrefix + "CreateAsync 执行出错:" + ex.Message; |
||||
|
_logger.LogError(ret.Message); |
||||
|
return ret; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">更新主键</param>
|
||||
|
/// <param name="input">修改内容</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
[HttpPut] |
||||
|
[UnitOfWork] |
||||
|
[Route("{id}")]//update/
|
||||
|
public async Task<ObjectResultDto> UpdateAsync(Guid id, ImportRecordCreateDto input) |
||||
|
{ |
||||
|
_logger.LogDebug(_errorMessagePrefix + "UpdateAsync 进入"); |
||||
|
ObjectResultDto ret = new ObjectResultDto(); |
||||
|
try |
||||
|
{ |
||||
|
ImportRecord targetObj = await _importRecordRepository.GetAsync(id); |
||||
|
ObjectMapper.Map<ImportRecordCreateDto, ImportRecord>(input, targetObj); |
||||
|
await _importRecordRepository.UpdateAsync(targetObj); |
||||
|
return ret; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
ret.Status = false; |
||||
|
ret.Message = _errorMessagePrefix + "UpdateAsync 执行出错:" + ex.Message; |
||||
|
_logger.LogError(ret.Message); |
||||
|
return ret; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">删除主键</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
[UnitOfWork] |
||||
|
[HttpDelete] |
||||
|
[Route("{id}")]//delete/
|
||||
|
public async Task<ObjectResultDto> DeleteAsync(string id) |
||||
|
{ |
||||
|
_logger.LogDebug(_errorMessagePrefix + "DeleteAsync 进入"); |
||||
|
ObjectResultDto ret = new ObjectResultDto(); |
||||
|
try |
||||
|
{ |
||||
|
Guid guid = Guid.Parse(id); |
||||
|
await _importRecordRepository.DeleteAsync(guid); |
||||
|
|
||||
|
return ret; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
ret.Status = false; |
||||
|
ret.Message = _errorMessagePrefix + "DeleteAsync 执行出错:" + ex.Message; |
||||
|
_logger.LogError(ret.Message); |
||||
|
return ret; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导出信息
|
||||
|
/// </summary>
|
||||
|
/// <param name="input">导出查询条件</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
[UnitOfWork(false)] |
||||
|
[HttpPost] |
||||
|
[Route("export")] |
||||
|
public async Task<ObjectResultDto<string>> ExportAsync(ImportRecordInputDto input) |
||||
|
{ |
||||
|
_logger.LogDebug(_errorMessagePrefix + "ExportAsync 进入"); |
||||
|
ObjectResultDto<string> ret = new ObjectResultDto<string>(); |
||||
|
try |
||||
|
{ |
||||
|
PagedResultDto<ImportRecordDto> pageLst = await QueryByConditionAsync(input, (PagedAndSortedBase)input); |
||||
|
var items = pageLst.Items.AsEnumerable().ToList(); |
||||
|
//将实体列表转换成excel文件流
|
||||
|
IExporter exporter = new ExcelExporter(); |
||||
|
byte[] byteArr = await exporter.ExportAsByteArray<ImportRecordDto>(items); |
||||
|
byteArr.ShouldNotBeNull(); |
||||
|
//将excel文件流保存到服务器端文件系统
|
||||
|
string fileName = string.Format("导入记录_{0}.xlsx", Guid.NewGuid().ToString()); |
||||
|
await _blobContainer.SaveAsync(fileName, byteArr); |
||||
|
|
||||
|
ret.Item = fileName; |
||||
|
return ret; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
ret.Status = false; |
||||
|
ret.Message = _errorMessagePrefix + "ExportAsync 执行出错:" + ex.Message; |
||||
|
_logger.LogError(ret.Message); |
||||
|
return ret; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导入
|
||||
|
/// </summary>
|
||||
|
/// <param name="files">导入文件</param>
|
||||
|
/// <returns>执行成功返回真</returns>
|
||||
|
[HttpPost] |
||||
|
[Route("import")] |
||||
|
[DisableRequestSizeLimit] |
||||
|
public virtual async Task<ObjectResultDto> ImportAsync([FromForm] IFormFileCollection files) |
||||
|
{ |
||||
|
|
||||
|
_logger.LogDebug(_errorMessagePrefix + "ImportAsync 进入"); |
||||
|
ObjectResultDto ret = new ObjectResultDto(); |
||||
|
try |
||||
|
{ |
||||
|
ImportResult<ImportRecordDto> impResult; |
||||
|
using (var memoryStream = new MemoryStream()) |
||||
|
{ |
||||
|
//保存到内存流
|
||||
|
IFormFile file = files[0]; |
||||
|
await file.CopyToAsync(memoryStream); |
||||
|
memoryStream.Seek(0, SeekOrigin.Begin); |
||||
|
//StreamReader sr = new StreamReader(memoryStream, Encoding.Default);
|
||||
|
IImporter importer = new ExcelImporter(); |
||||
|
impResult = await importer.Import<ImportRecordDto>(memoryStream); |
||||
|
if (impResult.HasError) |
||||
|
{ |
||||
|
string rowErrStr = ""; |
||||
|
foreach (var rowErr in impResult.RowErrors) |
||||
|
{ |
||||
|
string fieldErr = string.Concat(rowErr.FieldErrors.Select(itm => $"字段:{itm.Key},错误信息:{itm.Value}")); |
||||
|
rowErrStr += $"行号:{rowErr.RowIndex},{fieldErr}\r\n"; |
||||
|
} |
||||
|
string templateErrStr = ""; |
||||
|
foreach (var templateErr in impResult.TemplateErrors) |
||||
|
{ |
||||
|
string errorLevel = templateErr.ErrorLevel == ErrorLevels.Error ? "错误" : "警告"; |
||||
|
templateErrStr += $"错误等级:{errorLevel},列名:{templateErr.ColumnName},需要列:{templateErr.RequireColumnName},错误消息:{templateErr.Message}\r\n"; |
||||
|
} |
||||
|
ret.Message = rowErrStr + templateErrStr; |
||||
|
ret.Status = false; |
||||
|
return ret; |
||||
|
} |
||||
|
} |
||||
|
var srcLst = impResult.Data.AsEnumerable().ToList(); |
||||
|
var tarLst = ObjectMapper.Map<List<ImportRecordDto>, List<ImportRecord>>(srcLst); |
||||
|
foreach (var tar in tarLst) |
||||
|
{ |
||||
|
tar.CreatePerson = "导入"; |
||||
|
tar.CreateTime = ServerHelper.CurrentDateTime; |
||||
|
} |
||||
|
//插入“导入记录表”
|
||||
|
await _importRecordRepository.InsertManyAsync(tarLst); |
||||
|
ret.Status = true; |
||||
|
return ret; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
ret.Status = false; |
||||
|
ret.Message = _errorMessagePrefix + "ImportAsync 执行出错:" + ex.Message; |
||||
|
_logger.LogError(ret.Message); |
||||
|
return ret; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
} |
||||
|
} |
@ -0,0 +1,139 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive.Entitys |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 导入记录
|
||||
|
/// </summary>
|
||||
|
public class ImportRecord : Entity<Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 工厂
|
||||
|
/// </summary>
|
||||
|
public virtual string Factory { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车位
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工位
|
||||
|
/// </summary>
|
||||
|
public virtual string WorkLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 底盘号
|
||||
|
/// </summary>
|
||||
|
public virtual string Vin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车身号
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleBodyCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型代码
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型名称
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型描述
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格
|
||||
|
/// </summary>
|
||||
|
public virtual string Spec { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格说明
|
||||
|
/// </summary>
|
||||
|
public virtual string SpecDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 类别
|
||||
|
/// </summary>
|
||||
|
public virtual string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 涂装下线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? PaintOfflineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总装上线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? OnlineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 内饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string InteriorColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 外饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string ExteriorTrimmingColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 序列号
|
||||
|
/// </summary>
|
||||
|
public virtual string SerialNum { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流水号
|
||||
|
/// </summary>
|
||||
|
public virtual int HostSN { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线:A/B
|
||||
|
/// </summary>
|
||||
|
public virtual string ProductLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 目的
|
||||
|
/// </summary>
|
||||
|
public virtual string Target { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建人
|
||||
|
/// </summary>
|
||||
|
public virtual string CreatePerson { get; set; } |
||||
|
|
||||
|
public virtual DateTime? ImportTime { get; set; } |
||||
|
|
||||
|
public virtual string ImportPerson { get; set; } |
||||
|
|
||||
|
public virtual string Remark2 { get; set; } |
||||
|
|
||||
|
public virtual string Remark3 { get; set; } |
||||
|
|
||||
|
public virtual string Remark4 { get; set; } |
||||
|
|
||||
|
public virtual string Remark5 { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,139 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive.Entitys |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 导入记录
|
||||
|
/// </summary>
|
||||
|
public class ImportRecordHis : Entity<Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 工厂
|
||||
|
/// </summary>
|
||||
|
public virtual string Factory { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车位
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工位
|
||||
|
/// </summary>
|
||||
|
public virtual string WorkLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 底盘号
|
||||
|
/// </summary>
|
||||
|
public virtual string Vin { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车身号
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleBodyCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型代码
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型名称
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车型描述
|
||||
|
/// </summary>
|
||||
|
public virtual string VehicleModelDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格
|
||||
|
/// </summary>
|
||||
|
public virtual string Spec { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 规格说明
|
||||
|
/// </summary>
|
||||
|
public virtual string SpecDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 类别
|
||||
|
/// </summary>
|
||||
|
public virtual string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 涂装下线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? PaintOfflineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总装上线时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? OnlineTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 内饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string InteriorColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 外饰颜色
|
||||
|
/// </summary>
|
||||
|
public virtual string ExteriorTrimmingColor { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 序列号
|
||||
|
/// </summary>
|
||||
|
public virtual string SerialNum { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流水号
|
||||
|
/// </summary>
|
||||
|
public virtual int HostSN { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线:A/B
|
||||
|
/// </summary>
|
||||
|
public virtual string ProductLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 目的
|
||||
|
/// </summary>
|
||||
|
public virtual string Target { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建时间
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建人
|
||||
|
/// </summary>
|
||||
|
public virtual string CreatePerson { get; set; } |
||||
|
|
||||
|
public virtual DateTime? ImportTime { get; set; } |
||||
|
|
||||
|
public virtual string ImportPerson { get; set; } |
||||
|
|
||||
|
public virtual string Remark2 { get; set; } |
||||
|
|
||||
|
public virtual string Remark3 { get; set; } |
||||
|
|
||||
|
public virtual string Remark4 { get; set; } |
||||
|
|
||||
|
public virtual string Remark5 { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
|
namespace WY.NewJit.EdiReceive.Entitys |
||||
|
{ |
||||
|
public class LastImportHostSN : Entity<Guid> |
||||
|
{ |
||||
|
public string ProductLineCode { get; set; } |
||||
|
|
||||
|
public int HostSN { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue