44673626
3 years ago
15 changed files with 1244 additions and 2 deletions
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win.Sfs.Shared; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
public class BT_Car_PlatformCreateDto : BT_Car_PlatformDtoBase, IBranch<Guid> |
||||
|
{ |
||||
|
public virtual Guid BranchId { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win.Sfs.Shared.DtoBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
public class BT_Car_PlatformDto : AuditedEntityDtoBase<Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
///工厂
|
||||
|
/// </summary>
|
||||
|
public string Factory { get; set; } |
||||
|
/// <summary>
|
||||
|
///外部看板编号
|
||||
|
/// </summary>
|
||||
|
public string ExternalKanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///看板编号
|
||||
|
/// </summary>
|
||||
|
public string KanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///物料凭证号
|
||||
|
/// </summary>
|
||||
|
public string MaterialVoucherNo { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
///会计年度
|
||||
|
/// </summary>
|
||||
|
public string Year { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
public string Period { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
public string Version { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 看板号
|
||||
|
/// </summary>
|
||||
|
public string BTCarKanBan { set; get; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料号
|
||||
|
/// </summary>
|
||||
|
public string MaterialCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 验收单日期
|
||||
|
/// </summary>
|
||||
|
public DateTime AcceptanceDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商
|
||||
|
/// </summary>
|
||||
|
public string Supplier { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点
|
||||
|
/// </summary>
|
||||
|
public string StorageLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点描述
|
||||
|
/// </summary>
|
||||
|
public string StorageLocationDesc { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win.Sfs.Shared.DtoBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
public class BT_Car_PlatformDtoBase : CreateOrUpdateEntityDtoBase<Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
///工厂
|
||||
|
/// </summary>
|
||||
|
public string Factory { get; set; } |
||||
|
/// <summary>
|
||||
|
///外部看板编号
|
||||
|
/// </summary>
|
||||
|
public string ExternalKanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///看板编号
|
||||
|
/// </summary>
|
||||
|
public string KanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///物料凭证号
|
||||
|
/// </summary>
|
||||
|
public string MaterialVoucherNo { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
///会计年度
|
||||
|
/// </summary>
|
||||
|
public string Year { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
public string Period { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
public string Version { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 类型:CP7报废和索赔两种
|
||||
|
/// </summary>
|
||||
|
public string BTCarKanBan { set; get; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料号
|
||||
|
/// </summary>
|
||||
|
public string MaterialCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 验收单日期
|
||||
|
/// </summary>
|
||||
|
public DateTime AcceptanceDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商
|
||||
|
/// </summary>
|
||||
|
public string Supplier { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点描述
|
||||
|
/// </summary>
|
||||
|
public string StorageLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点描述
|
||||
|
/// </summary>
|
||||
|
public string StorageLocationDesc { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
using Magicodes.ExporterAndImporter.Core; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
public class BT_Car_PlatformExportDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
///工厂
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "工厂")] |
||||
|
public string Factory { get; set; } |
||||
|
/// <summary>
|
||||
|
///外部看板编号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "外部看板编号")] |
||||
|
public string ExternalKanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///看板编号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "看板编号")] |
||||
|
public string KanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///物料凭证号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "物料凭证号")] |
||||
|
public string MaterialVoucherNo { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
///会计年度
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "会计年度")] |
||||
|
public string Year { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "期间")] |
||||
|
public string Period { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "版本号")] |
||||
|
public string Version { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 看板号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "看板号")] |
||||
|
public string BTCarKanBan { set; get; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料号
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "物料号")] |
||||
|
public string MaterialCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 验收单日期
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "验收单日期")] |
||||
|
public DateTime AcceptanceDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "供应商")] |
||||
|
public string Supplier { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "存储地点")] |
||||
|
public string StorageLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点描述
|
||||
|
/// </summary>
|
||||
|
[ExporterHeader(DisplayName = "存储地点描述")] |
||||
|
public string StorageLocationDesc { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
using Magicodes.ExporterAndImporter.Core; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
public class BT_Car_PlatformImportDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
///工厂
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "工厂")] |
||||
|
public string Factory { get; set; } |
||||
|
/// <summary>
|
||||
|
///外部看板编号
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "外部看板编号")] |
||||
|
public string ExternalKanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///看板编号
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "看板编号")] |
||||
|
public string KanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///物料凭证号
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "物料凭证号")] |
||||
|
public string MaterialVoucherNo { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
///会计年度
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "会计年度")] |
||||
|
public string Year { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "期间")] |
||||
|
public string Period { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "版本号")] |
||||
|
public string Version { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 看板号
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "看板号")] |
||||
|
public string BTCarKanBan { set; get; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料号
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "物料号")] |
||||
|
public string MaterialCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 验收单日期
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "验收单日期")] |
||||
|
public DateTime AcceptanceDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "供应商")] |
||||
|
public string Supplier { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "存储地点")] |
||||
|
public string StorageLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点描述
|
||||
|
/// </summary>
|
||||
|
[ImporterHeader(Name = "存储地点描述")] |
||||
|
public string StorageLocationDesc { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,81 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win.Sfs.Shared.DtoBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
public class BT_Car_PlatformRequestDto : RequestDtoBase |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
///工厂
|
||||
|
/// </summary>
|
||||
|
public string Factory { get; set; } |
||||
|
/// <summary>
|
||||
|
///外部看板编号
|
||||
|
/// </summary>
|
||||
|
public string ExternalKanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///看板编号
|
||||
|
/// </summary>
|
||||
|
public string KanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///物料凭证号
|
||||
|
/// </summary>
|
||||
|
public string MaterialVoucherNo { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
///会计年度
|
||||
|
/// </summary>
|
||||
|
public string Year { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
public string Period { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
public string Version { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 看板号
|
||||
|
/// </summary>
|
||||
|
public string BTCarKanBan { set; get; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料号
|
||||
|
/// </summary>
|
||||
|
public string MaterialCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 验收单日期
|
||||
|
/// </summary>
|
||||
|
public DateTime AcceptanceDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商
|
||||
|
/// </summary>
|
||||
|
public string Supplier { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点
|
||||
|
/// </summary>
|
||||
|
public string StorageLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点描述
|
||||
|
/// </summary>
|
||||
|
public string StorageLocationDesc { get; set; } |
||||
|
|
||||
|
public virtual Guid ParentId { get; set; } |
||||
|
public virtual Guid BranchId { get; set; } |
||||
|
|
||||
|
public virtual Guid UserId { get; set; } |
||||
|
|
||||
|
public virtual int FileType { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,100 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win.Sfs.Shared; |
||||
|
using Win.Sfs.Shared.DtoBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// SettleAccountVersion
|
||||
|
/// </summary>
|
||||
|
public class BT_Car_PlatformVersionDtoBase : CreateOrUpdateEntityDtoBase<Guid> |
||||
|
{ |
||||
|
|
||||
|
public string Year { get; private set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
public string Period { get; private set; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
public string Version { get; private set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 客户号
|
||||
|
/// </summary>
|
||||
|
public string CustomerCode { private set; get; } |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public class BT_Car_PlatformVersionDto : AuditedEntityDtoBase<Guid>, IBranch<Guid> |
||||
|
{ |
||||
|
public string Year { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
public string Period { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
public string Version { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 客户号
|
||||
|
/// </summary>
|
||||
|
public string CustomerCode { set; get; } |
||||
|
public Guid BranchId { get; set; } |
||||
|
} |
||||
|
|
||||
|
public class BT_Car_PlatformVersionCreateDto : BT_Car_PlatformVersionDtoBase |
||||
|
{ } |
||||
|
public class BT_Car_PlatformVersionUpdateDto : BT_Car_PlatformVersionDtoBase |
||||
|
{ } |
||||
|
public class BT_Car_PlatformVersionRequestDto : RequestDtoBase, IBranch<Guid> |
||||
|
{ |
||||
|
|
||||
|
public string Year { get; private set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
public string Period { get; private set; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
public string Version { get; private set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 客户号
|
||||
|
/// </summary>
|
||||
|
public string CustomerCode { private set; get; } |
||||
|
public Guid BranchId { get; set; } |
||||
|
} |
||||
|
|
||||
|
public class BT_Car_PlatformVersionImportDto |
||||
|
{ |
||||
|
|
||||
|
public string Year { get; private set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
public string Period { get; private set; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
public string Version { get; private set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 客户号
|
||||
|
/// </summary>
|
||||
|
public string CustomerCode { private set; get; } |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
public interface IBT_Car_PlatformAppService |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 导入功能
|
||||
|
/// </summary>
|
||||
|
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
||||
|
/// <returns></returns>
|
||||
|
|
||||
|
Task<string> BT_Car_PlatformUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, |
||||
|
string year, string period, string version, string customerCode); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按ID获取唯一实体
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 返回实体全部属性
|
||||
|
/// </remarks>
|
||||
|
/// <param name="id">ID</param>
|
||||
|
/// <returns>实体DTO</returns>
|
||||
|
|
||||
|
Task<BT_Car_PlatformDto> GetAsync(Guid id); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据筛选条件获取实体列表
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
||||
|
/// </remarks>
|
||||
|
/// <param name="input">请求条件</param>
|
||||
|
/// <returns>实体DTO列表</returns>
|
||||
|
|
||||
|
Task<PagedResultDto<BT_Car_PlatformDto>> GetListAsync(BT_Car_PlatformRequestDto input); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据筛选条件获取实体列表
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
||||
|
/// </remarks>
|
||||
|
/// <param name="input">请求条件</param>
|
||||
|
/// <returns>实体DTO列表</returns>
|
||||
|
|
||||
|
Task<PagedResultDto<BT_Car_PlatformVersionDto>> GetVersionListAsync(BT_Car_PlatformVersionRequestDto input); |
||||
|
|
||||
|
|
||||
|
Task<string> ExportAsync(BT_Car_PlatformRequestDto input); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取实体总数
|
||||
|
/// </summary>
|
||||
|
/// <returns>实体总数</returns>
|
||||
|
|
||||
|
Task<long> GetTotalCountAsync(Guid branchId); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 删除实体
|
||||
|
///// </summary>
|
||||
|
///// <param name="id">ID</param>
|
||||
|
///// <returns>无</returns>
|
||||
|
|
||||
|
Task DeleteAsync(Guid id); |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按IDs删除实体列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="ids">IDs</param>
|
||||
|
/// <returns>是否执行成功</returns>
|
||||
|
|
||||
|
Task<bool> DeleteListAsync(List<Guid> ids); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,316 @@ |
|||||
|
using EFCore.BulkExtensions; |
||||
|
using Magicodes.ExporterAndImporter.Core; |
||||
|
using Magicodes.ExporterAndImporter.Csv; |
||||
|
using Magicodes.ExporterAndImporter.Excel; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Shouldly; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Caching; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Win.Abp.Snowflakes; |
||||
|
using Win.Sfs.BaseData.ImportExcelCommon; |
||||
|
using Win.Sfs.SettleAccount.CommonManagers; |
||||
|
using Win.Sfs.SettleAccount.Constant; |
||||
|
using Win.Sfs.SettleAccount.ExcelImporter; |
||||
|
using Win.Sfs.SettleAccount.ExportReports; |
||||
|
using Win.Sfs.Shared.Filter; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 一汽轿车平台导入
|
||||
|
/// </summary>
|
||||
|
//[Authorize(SettleAccountPermissions.HQ_MPlatform.Default)]
|
||||
|
//[AllowAnonymous]
|
||||
|
[Route("api/settleaccount/BT_Carlatform")] |
||||
|
public class BT_Car_PlatformAppService : SettleAccountApplicationBase<BT_Car_Platform>, IBT_Car_PlatformAppService |
||||
|
{ |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
|
||||
|
private readonly IExcelImportAppService _excelImportService; |
||||
|
|
||||
|
private readonly ISettleAccountBranchEfCoreRepository<BT_Car_PlatformVersion, Guid> _versionRepository; |
||||
|
|
||||
|
private readonly ISettleAccountBranchEfCoreRepository<BT_Car_Platform, Guid> _repository; |
||||
|
/// <summary>
|
||||
|
/// 构建方法
|
||||
|
/// </summary>
|
||||
|
/// <param name="guidGenerator">构建UID</param>
|
||||
|
/// <param name="repository">仓储接口</param>
|
||||
|
/// <param name="cache">缓存</param>
|
||||
|
public BT_Car_PlatformAppService(IGuidGenerator guidGenerator, |
||||
|
ISettleAccountBranchEfCoreRepository<BT_Car_PlatformVersion, Guid> versionRepository, |
||||
|
ISettleAccountBranchEfCoreRepository<BT_Car_Platform, Guid> repository, |
||||
|
IDistributedCache<BT_Car_Platform> cache, |
||||
|
IExcelImportAppService excelImportService, |
||||
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
||||
|
ICommonManager commonManager |
||||
|
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
||||
|
{ |
||||
|
_versionRepository = versionRepository; |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_excelImportService = excelImportService; |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导入功能
|
||||
|
/// </summary>
|
||||
|
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
[Route("ExcelImport")] |
||||
|
[DisableRequestSizeLimit] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
public async Task<string> BT_Car_PlatformUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode) |
||||
|
{ |
||||
|
ExportImporter _exportImporter = new ExportImporter(); |
||||
|
var result = await _exportImporter.UploadExcelImport<BT_Car_PlatformImportDto>(files, _excelImportService); |
||||
|
var entityList = ObjectMapper.Map<List<BT_Car_PlatformImportDto>, List<BT_Car_Platform>>(result); |
||||
|
//删除版本
|
||||
|
var _versionQuery = _versionRepository.Where(p => p.Version == version); |
||||
|
await _versionQuery.BatchDeleteAsync(); |
||||
|
//删除明细
|
||||
|
var _query = _repository.Where(p => p.Version == version); |
||||
|
await _query.BatchDeleteAsync(); |
||||
|
//插入数据前检验
|
||||
|
var checkList = new List<ErrorExportDto>(); |
||||
|
var _group = entityList.GroupBy(x => new { x.KanbanNumber, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), KanbanNumber = p.Key.KanbanNumber, MaterialCode = p.Key.MaterialCode }); |
||||
|
foreach (var itm in _group) |
||||
|
{ |
||||
|
if (string.IsNullOrEmpty(itm.KanbanNumber)) |
||||
|
{ |
||||
|
checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的零件号{0},其看板号{1}有空,请检查!", itm.MaterialCode, itm.KanbanNumber), string.Empty)); |
||||
|
} |
||||
|
} |
||||
|
var _id = GuidGenerator.Create(); |
||||
|
var _bomList = new List<BT_Car_PlatformVersion>(); |
||||
|
_bomList.Add(new BT_Car_PlatformVersion(_id, branchId, year, period, version, customerCode)); |
||||
|
foreach (var itm in entityList) |
||||
|
{ |
||||
|
//赋值上主键ID
|
||||
|
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); |
||||
|
} |
||||
|
if (checkList.Count > 0) |
||||
|
{ |
||||
|
return await ExportErrorReportAsync(checkList); |
||||
|
} |
||||
|
await _repository.GetDbContext().BulkInsertAsync<BT_Car_Platform>(entityList); |
||||
|
await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); |
||||
|
return ApplicationConsts.SuccessStr; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按ID获取唯一实体
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 返回实体全部属性
|
||||
|
/// </remarks>
|
||||
|
/// <param name="id">ID</param>
|
||||
|
/// <returns>实体DTO</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("{id}")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<BT_Car_PlatformDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
var result = await GetFromCacheAsync(id); |
||||
|
var dto = ObjectMapper.Map<BT_Car_Platform, BT_Car_PlatformDto>(result); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private async Task<BT_Car_Platform> GetFromCacheAsync(Guid id) |
||||
|
{ |
||||
|
var result = await _repository.GetAsync(id); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private async Task<long> GetCountAsync(BT_Car_PlatformRequestDto input) |
||||
|
{ |
||||
|
return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); |
||||
|
} |
||||
|
|
||||
|
private async Task<long> GetCountAsync(BT_Car_PlatformVersionRequestDto input) |
||||
|
{ |
||||
|
return await _versionRepository.GetCountByFilterAsync(input.BranchId, input.Filters); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导出文件
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
[Route("Export")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<string> ExportAsync(BT_Car_PlatformRequestDto input) |
||||
|
{ |
||||
|
|
||||
|
IExporter _csv = new CsvExporter(); |
||||
|
IExporter _excel = new ExcelExporter(); |
||||
|
if (!string.IsNullOrEmpty(input.Version)) |
||||
|
{ |
||||
|
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); |
||||
|
} |
||||
|
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, |
||||
|
0, true); |
||||
|
|
||||
|
var dtoDetails = ObjectMapper.Map<List<BT_Car_Platform>, List<BT_Car_PlatformExportDto>>(entities); |
||||
|
|
||||
|
string _fileName = string.Empty; |
||||
|
//声明导出容器
|
||||
|
|
||||
|
byte[] result = null; |
||||
|
switch (input.FileType) |
||||
|
{ |
||||
|
case 0: |
||||
|
_fileName = string.Format("一轿奔腾验收结算明细_{0}.csv", input.UserId.ToString()); |
||||
|
result = await _csv.ExportAsByteArray(dtoDetails); |
||||
|
break; |
||||
|
case 1: |
||||
|
_fileName = string.Format("一轿奔腾验收结算明细_{0}.xlsx", input.UserId.ToString()); |
||||
|
result = await _excel.ExportAsByteArray(dtoDetails); |
||||
|
break; |
||||
|
} |
||||
|
result.ShouldNotBeNull(); |
||||
|
|
||||
|
//保存导出文件到服务器存成二进制
|
||||
|
await _excelImportService.SaveBlobAsync( |
||||
|
new SaveExcelImportInputDto |
||||
|
{ |
||||
|
Name = _fileName, |
||||
|
Content = result |
||||
|
} |
||||
|
); |
||||
|
return _fileName; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据筛选条件获取实体列表
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
|
||||
|
/// </remarks>
|
||||
|
/// <param name="input">请求条件</param>
|
||||
|
/// <returns>实体DTO列表</returns>
|
||||
|
[HttpPost] |
||||
|
[Route("list")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<PagedResultDto<BT_Car_PlatformDto>> GetListAsync(BT_Car_PlatformRequestDto input) |
||||
|
{ |
||||
|
if (!string.IsNullOrEmpty(input.Version)) |
||||
|
{ |
||||
|
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
return new PagedResultDto<BT_Car_PlatformDto>(0, new List<BT_Car_PlatformDto>()); |
||||
|
} |
||||
|
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, |
||||
|
input.SkipCount, true); |
||||
|
|
||||
|
var totalCount = await GetCountAsync(input); |
||||
|
var dtos = ObjectMapper.Map<List<BT_Car_Platform>, List<BT_Car_PlatformDto>>(entities); |
||||
|
|
||||
|
return new PagedResultDto<BT_Car_PlatformDto>(totalCount, dtos); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取实体总数
|
||||
|
/// </summary>
|
||||
|
/// <returns>实体总数</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("count")] |
||||
|
[Authorize(SettleAccountPermissions.SettleAccounts.Default)] |
||||
|
virtual public async Task<long> GetTotalCountAsync(Guid branchId) |
||||
|
{ |
||||
|
return await _repository.GetCountAsync(branchId); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取全部实体列表
|
||||
|
/// </summary>
|
||||
|
/// <returns>实体DTO列表</returns>
|
||||
|
[HttpGet] |
||||
|
[Route("all")] |
||||
|
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
|
||||
|
virtual public async Task<ListResultDto<BT_Car_PlatformDto>> GetAllAsync(Guid branchId) |
||||
|
{ |
||||
|
var entities = await _repository.GetAllAsync(branchId, true); |
||||
|
|
||||
|
|
||||
|
var dtos = ObjectMapper.Map<List<BT_Car_Platform>, List<BT_Car_PlatformDto>>(entities); |
||||
|
|
||||
|
|
||||
|
return new ListResultDto<BT_Car_PlatformDto>(dtos); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">ID</param>
|
||||
|
/// <returns>无</returns>
|
||||
|
[HttpDelete] |
||||
|
[Route("{id}")] |
||||
|
/// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)]
|
||||
|
virtual public async Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
await _repository.DeleteAsync(id); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按IDs删除实体列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="ids">IDs</param>
|
||||
|
/// <returns>是否执行成功</returns>
|
||||
|
[HttpPost] |
||||
|
[Route("delete")] |
||||
|
// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)]
|
||||
|
virtual public async Task<bool> DeleteListAsync(List<Guid> ids) |
||||
|
{ |
||||
|
foreach (var id in ids) |
||||
|
{ |
||||
|
var entity = await GetFromCacheAsync(id); |
||||
|
//await Cache.DeleteAsync<SettleAccount>(id.ToString());
|
||||
|
} |
||||
|
|
||||
|
return await _repository.DeleteListAsync(ids); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 版本列表查询
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
[Route("listversion")] |
||||
|
public async Task<PagedResultDto<BT_Car_PlatformVersionDto>> GetVersionListAsync(BT_Car_PlatformVersionRequestDto input) |
||||
|
{ |
||||
|
var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, |
||||
|
input.SkipCount, true); |
||||
|
|
||||
|
var totalCount = await GetCountAsync(input); |
||||
|
var dtos = ObjectMapper.Map<List<BT_Car_PlatformVersion>, List<BT_Car_PlatformVersionDto>>(entities); |
||||
|
|
||||
|
return new PagedResultDto<BT_Car_PlatformVersionDto>(totalCount, dtos); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,132 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win.Sfs.Shared.DomainBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
public class BT_Car_Platform : FullAuditedAggregateRootBase<Guid>, ISettleAccountEntityBase |
||||
|
{ |
||||
|
public BT_Car_Platform() |
||||
|
{ } |
||||
|
|
||||
|
public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version) |
||||
|
{ |
||||
|
Period = peroid; |
||||
|
Year = year; |
||||
|
Id = guid; |
||||
|
Version = version; |
||||
|
BranchId = branchId; |
||||
|
} |
||||
|
public BT_Car_Platform(Guid Id, string materialVoucherNo, string externalKanbanNumber, |
||||
|
string kanbanNumber, string year, string factory, DateTime acceptanceDate, |
||||
|
string period, string version, string kanBan, string supplier, string storageLocation, string storageLocationDesc, |
||||
|
string materialCode) : base(Id) |
||||
|
{ |
||||
|
MaterialVoucherNo = materialVoucherNo; |
||||
|
KanbanNumber = kanbanNumber; |
||||
|
ExternalKanbanNumber = externalKanbanNumber; |
||||
|
Year = year; |
||||
|
Factory = factory; |
||||
|
AcceptanceDate = acceptanceDate; |
||||
|
Period = period; |
||||
|
Version = version; |
||||
|
MaterialCode = materialCode; |
||||
|
BTCarKanBan = kanBan; |
||||
|
Supplier = supplier; |
||||
|
StorageLocation = storageLocation; |
||||
|
StorageLocationDesc = storageLocationDesc; |
||||
|
} |
||||
|
|
||||
|
//验收单号 外部单号 物料凭证号 物料凭证日期 物料凭证记账日期 看板编号 外部看板编号 物料号 物料描述 数量 单价 金额
|
||||
|
//工厂 备注 创建者 创建时间 修改人 修改时间 公司 验收单号 外部单号 发票号 会计年度 金额 计划员 存储地点
|
||||
|
//存储地点描述 状态 验收单日期 供应商 录入人 录入人描述 看板号
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
///工厂
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工厂")] |
||||
|
public string Factory { get; set; } |
||||
|
/// <summary>
|
||||
|
///外部看板编号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "外部看板编号")] |
||||
|
public string ExternalKanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///看板编号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "看板编号")] |
||||
|
public string KanbanNumber { get; set; } |
||||
|
/// <summary>
|
||||
|
///物料凭证号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "物料凭证号")] |
||||
|
public string MaterialVoucherNo { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
///会计年度
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "会计年度")] |
||||
|
public string Year { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "期间")] |
||||
|
public string Period { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "版本号")] |
||||
|
public string Version { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 看板号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "看板号")] |
||||
|
public string BTCarKanBan { set; get; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "物料号")] |
||||
|
public string MaterialCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 验收单日期
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "验收单日期")] |
||||
|
public DateTime AcceptanceDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "供应商")] |
||||
|
public string Supplier { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "存储地点")] |
||||
|
public string StorageLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 存储地点描述
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "存储地点描述")] |
||||
|
public string StorageLocationDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "备注")] |
||||
|
public string Extend { set; get; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win.Sfs.Shared.DomainBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BT_Car |
||||
|
{ |
||||
|
public class BT_Car_PlatformVersion : FullAuditedAggregateRootBase<Guid>, ISettleAccountEntityBase |
||||
|
{ |
||||
|
|
||||
|
public BT_Car_PlatformVersion() |
||||
|
{ } |
||||
|
|
||||
|
public string Year { get; private set; } |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
public string Period { get; private set; } |
||||
|
/// <summary>
|
||||
|
/// 版本号
|
||||
|
/// </summary>
|
||||
|
public string Version { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 客户号
|
||||
|
/// </summary>
|
||||
|
public string CustomerCode { private set; get; } |
||||
|
|
||||
|
|
||||
|
public BT_Car_PlatformVersion( |
||||
|
Guid id, |
||||
|
Guid branchId, |
||||
|
string year, string period, string version, string customerCode) : base(id) |
||||
|
{ |
||||
|
BranchId = branchId; |
||||
|
Year = year; |
||||
|
Period = period; |
||||
|
Version = version; |
||||
|
CustomerCode = customerCode; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue