wanggang
1 year ago
51 changed files with 4658 additions and 491 deletions
@ -0,0 +1,148 @@ |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos |
|||
{ |
|||
/// <summary>
|
|||
/// BBAC发运
|
|||
/// </summary>
|
|||
public class BBAC_SE_DETAIL_DTO |
|||
{ |
|||
/// <summary>
|
|||
/// 期间
|
|||
/// </summary>
|
|||
public int Version { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 发货时间
|
|||
/// </summary>
|
|||
public DateTime ShippingDate { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 发运单号
|
|||
/// </summary>
|
|||
public string WmsBillNum { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
public string LU { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生产号
|
|||
/// </summary>
|
|||
public string PN { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 组合键值(LU+PN)
|
|||
/// </summary>
|
|||
public string KeyCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public decimal Qty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 日顺序号
|
|||
/// </summary>
|
|||
[Display(Name = "日顺序号")] |
|||
public string SeqNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 小总成号
|
|||
/// </summary>
|
|||
[Display(Name = "小总成号")] |
|||
public string AssemblyCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 注塑码
|
|||
/// </summary>
|
|||
[Display(Name = "注塑码")] |
|||
public string InjectionCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单时间
|
|||
/// </summary>
|
|||
[Display(Name = "订单时间")] |
|||
public DateTime BeginDate { get; set; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
public class BBAC_SE_DETAIL_EXPORT_DTO |
|||
{ |
|||
/// <summary>
|
|||
/// 期间
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "日顺序号")] |
|||
public int Version { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 发货时间
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "日顺序号")] |
|||
public DateTime ShippingDate { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 发运单号
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "日顺序号")] |
|||
public string WmsBillNum { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "日顺序号")] |
|||
public string LU { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生产号
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "日顺序号")] |
|||
public string PN { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 组合键值(LU+PN)
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "日顺序号")] |
|||
public string KeyCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "日顺序号")] |
|||
public decimal Qty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 日顺序号
|
|||
/// </summary>
|
|||
[Display(Name = "日顺序号")] |
|||
[ExporterHeader(DisplayName = "日顺序号")] |
|||
public string SeqNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 小总成号
|
|||
/// </summary>
|
|||
[Display(Name = "小总成号")] |
|||
[ExporterHeader(DisplayName = "小总成号")] |
|||
public string AssemblyCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 注塑码
|
|||
/// </summary>
|
|||
[Display(Name = "注塑码")] |
|||
[ExporterHeader(DisplayName = "注塑码")] |
|||
public string InjectionCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单时间
|
|||
/// </summary>
|
|||
[Display(Name = "订单时间")] |
|||
[ExporterHeader(DisplayName = "订单时间")] |
|||
public DateTime BeginDate { get; set; } |
|||
} |
|||
|
|||
} |
@ -0,0 +1,104 @@ |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos |
|||
{ |
|||
/// <summary>
|
|||
/// 客户替换件关系
|
|||
/// </summary>
|
|||
public class TB_RePartsRelationship_DTO |
|||
{ |
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
[Display(Name = "零件号")] |
|||
public string LU { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 替换零件号
|
|||
/// </summary>
|
|||
[Display(Name = "替换零件号")] |
|||
public string RepLU { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 客户编码
|
|||
/// </summary>
|
|||
[Display(Name = "客户编码")] |
|||
public string ClientCode { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 业务类型
|
|||
/// </summary>
|
|||
[Display(Name = "业务类型")] |
|||
public string BusinessType { set; get; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 导入
|
|||
/// </summary>
|
|||
public class TB_RePartsRelationship_IMPORT_DTO |
|||
{ |
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
[Display(Name = "零件号")] |
|||
[ImporterHeader(Name = "零件号")] |
|||
public string LU { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 替换零件号
|
|||
/// </summary>
|
|||
[Display(Name = "替换零件号")] |
|||
[ImporterHeader(Name = "替换零件号")] |
|||
public string RepLU { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 客户编码
|
|||
/// </summary>
|
|||
[Display(Name = "客户编码")] |
|||
[ImporterHeader(Name = "客户编码")] |
|||
public string ClientCode { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 业务类型
|
|||
/// </summary>
|
|||
[Display(Name = "业务类型")] |
|||
[ImporterHeader(Name = "业务类型")] |
|||
public string BusinessType { set; get; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
public class TB_RePartsRelationship_EXPORT_DTO |
|||
{ |
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
[Display(Name = "零件号")] |
|||
[ExporterHeader(DisplayName = "零件号")] |
|||
public string LU { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 替换零件号
|
|||
/// </summary>
|
|||
[Display(Name = "替换零件号")] |
|||
[ExporterHeader(DisplayName = "替换零件号")] |
|||
public string RepLU { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 客户编码
|
|||
/// </summary>
|
|||
[Display(Name = "客户编码")] |
|||
[ExporterHeader(DisplayName = "客户编码")] |
|||
public string ClientCode { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 业务类型
|
|||
/// </summary>
|
|||
[Display(Name = "业务类型")] |
|||
[ExporterHeader(DisplayName = "业务类型")] |
|||
public string BusinessType { set; get; } |
|||
} |
|||
|
|||
} |
@ -1,22 +1,6 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.Shared.ApplicationBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships |
|||
namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships |
|||
{ |
|||
public interface IMaterialRelationshipAppService : ICrudAppService<MaterialRelationshipDto, |
|||
MaterialRelationshipDto, |
|||
Guid, |
|||
MaterialRelationshipRequestDto, |
|||
MaterialRelationshipCreateDto, |
|||
MaterialRelationshipUpdateDto>, |
|||
IBranchBaseDataAppService<MaterialRelationshipDto, Guid> |
|||
|
|||
public interface IMaterialRelationshipAppService |
|||
{ |
|||
} |
|||
} |
|||
|
@ -0,0 +1,80 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Shouldly; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|||
using Win.Sfs.SettleAccount.ExcelImporter; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ |
|||
{ |
|||
/// <summary>
|
|||
/// BBAC发运单
|
|||
/// </summary>
|
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/BBAC_SE_DETAIL_SERVICE")] |
|||
public class BBAC_SE_DETAIL_SERVICE : ApplicationService |
|||
{ |
|||
/// <summary>
|
|||
/// BBAC发运单仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> _repository; |
|||
|
|||
/// <summary>
|
|||
/// excel服务
|
|||
/// </summary>
|
|||
private readonly IExcelImportAppService _excelImportService; |
|||
|
|||
/// <summary>
|
|||
/// 构造
|
|||
/// </summary>
|
|||
public BBAC_SE_DETAIL_SERVICE(INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> repository, IExcelImportAppService excelImportService) |
|||
{ |
|||
_repository = repository; |
|||
_excelImportService = excelImportService; |
|||
} |
|||
|
|||
#region 导出
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
[Route("Export")] |
|||
public async Task<string> ExportAsync(RequestDto input) |
|||
{ |
|||
string fileName = $"BBAC发运单_{Guid.NewGuid()}.xlsx"; |
|||
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); |
|||
var dtos = ObjectMapper.Map<List<BBAC_SE_DETAIL>, List<BBAC_SE_DETAIL_EXPORT_DTO>>(entities); |
|||
|
|||
ExportImporter _exportImporter = new ExportImporter(); |
|||
var result = await _exportImporter.ExcelExporter(dtos); |
|||
result.ShouldNotBeNull(); |
|||
|
|||
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }); |
|||
return fileName; |
|||
} |
|||
#endregion
|
|||
|
|||
#region 查询
|
|||
/// <summary>
|
|||
/// 获取列表
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
[Route("list")] |
|||
public async Task<PagedResultDto<BBAC_SE_DETAIL_DTO>> GetListAsync(RequestDto input) |
|||
{ |
|||
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); |
|||
var totalCount = await _repository.GetCountByFilterAsync(input.Filters); |
|||
var dtos = ObjectMapper.Map<List<BBAC_SE_DETAIL>, List<BBAC_SE_DETAIL_DTO>>(entities); |
|||
return new PagedResultDto<BBAC_SE_DETAIL_DTO>(totalCount, dtos); |
|||
} |
|||
#endregion
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,129 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Shouldly; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Caching; |
|||
using Win.Abp.Snowflakes; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.CommonManagers; |
|||
using Win.Sfs.SettleAccount.Constant; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|||
using Win.Sfs.SettleAccount.ExcelImporter; |
|||
using Win.Sfs.SettleAccount.ExportReports; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ |
|||
{ |
|||
/// <summary>
|
|||
/// 客户替换件关系
|
|||
/// </summary>
|
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/TB_RePartsRelationship_SERVICE")] |
|||
public class TB_RePartsRelationship_SERVICE : SettleAccountApplicationBase<TB_RePartsRelationship> |
|||
{ |
|||
/// <summary>
|
|||
/// 客户替换件关系仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<TB_RePartsRelationship, Guid> _repository; |
|||
|
|||
public TB_RePartsRelationship_SERVICE( |
|||
INormalEfCoreRepository<TB_RePartsRelationship, Guid> repository, |
|||
IDistributedCache<TB_RePartsRelationship> cache, |
|||
IExcelImportAppService excelImportService, |
|||
ISnowflakeIdGenerator snowflakeIdGenerator, |
|||
ICommonManager commonManager |
|||
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
#region 导入、导出
|
|||
/// <summary>
|
|||
/// 导入
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
[Route("Import")] |
|||
public async Task<string> ImportAsync([FromForm] IFormFileCollection files) |
|||
{ |
|||
ExportImporter _exportImporter = new ExportImporter(); |
|||
var result = await _exportImporter.UploadExcelImport<TB_RePartsRelationship_IMPORT_DTO>(files, _excelImportService); |
|||
var _ls = ObjectMapper.Map<List<TB_RePartsRelationship_IMPORT_DTO>, List<TB_RePartsRelationship>>(result); |
|||
List<string> _errorList = new List<string>(); |
|||
var checkList = new List<ErrorExportDto>(); |
|||
|
|||
if (_ls.Count > 0) |
|||
{ |
|||
var query = from arc in _ls |
|||
group arc by new { arc.LU } |
|||
into g |
|||
where g.Count() > 1 |
|||
|
|||
select g; |
|||
foreach (var itm in query) |
|||
{ |
|||
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("物料号{0}有重复", itm.Key.LU), string.Empty)); |
|||
} |
|||
} |
|||
foreach (var itm in _ls) |
|||
{ |
|||
var _first = _repository.FirstOrDefault(p => p.LU == itm.LU); |
|||
if (_first != null) |
|||
{ |
|||
_first.Update(itm.LU, itm.RepLU, itm.ClientCode, itm.BusinessType); |
|||
await _repository.UpdateAsync(_first); |
|||
} |
|||
else |
|||
{ |
|||
await _repository.InsertAsync(itm); |
|||
} |
|||
} |
|||
if (checkList.Count > 0) |
|||
{ |
|||
return await ExportErrorReportAsync(checkList); |
|||
} |
|||
return ApplicationConsts.SuccessStr; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
[Route("Export")] |
|||
public async Task<string> ExportAsync(RequestDto input) |
|||
{ |
|||
string fileName = $"客户替换件关系_{Guid.NewGuid()}.xlsx"; |
|||
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); |
|||
var dtos = ObjectMapper.Map<List<TB_RePartsRelationship>, List<TB_RePartsRelationship_EXPORT_DTO>>(entities); |
|||
|
|||
ExportImporter _exportImporter = new ExportImporter(); |
|||
var result = await _exportImporter.ExcelExporter(dtos); |
|||
result.ShouldNotBeNull(); |
|||
|
|||
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }); |
|||
return fileName; |
|||
} |
|||
#endregion
|
|||
|
|||
#region CURD
|
|||
/// <summary>
|
|||
/// 获取列表
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
[Route("list")] |
|||
public async Task<PagedResultDto<TB_RePartsRelationship_DTO>> GetListAsync(RequestDto input) |
|||
{ |
|||
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); |
|||
var totalCount = await _repository.GetCountByFilterAsync(input.Filters); |
|||
var dtos = ObjectMapper.Map<List<TB_RePartsRelationship>, List<TB_RePartsRelationship_DTO>>(entities); |
|||
return new PagedResultDto<TB_RePartsRelationship_DTO>(totalCount, dtos); |
|||
} |
|||
#endregion
|
|||
|
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,41 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class _202307121 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "Set_TB_RePartsRelationship", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
LU = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
RepLU = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
ClientCode = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
BusinessType = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_Set_TB_RePartsRelationship", x => x.Id); |
|||
}); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "Set_TB_RePartsRelationship"); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue