diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
index f076ebf8..59ddc9f1 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
@@ -1,9 +1,6 @@
-using System;
-using System.Collections.Generic;
+using Magicodes.ExporterAndImporter.Core;
+using System;
using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
@@ -35,9 +32,66 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
///
/// 导入
///
- public class PUB_SA_IMPORT_DTO
+ public class ZGJ_PUB_SA_DETAIL_IMPORT_DTO
{
-
+ /////
+ ///// 期间
+ /////
+ //public int Version { set; get; }
+
+ /////
+ ///// 单价
+ /////
+ //public decimal Price { set; get; }
+
+ /////
+ ///// 结算单
+ /////
+ //public string BillNum { set; get; }
+
+ ///
+ /// 结算日期
+ ///
+ [ImporterHeader(Name = "Pstng Date")]
+ public DateTime SettleDate { set; get; }
+
+ ///
+ /// 零件号
+ ///
+ [ImporterHeader(Name = "Material")]
+ public string LU { get; set; }
+
+ ///
+ /// 生产号
+ ///
+ [ImporterHeader(Name = "External Delivery ID")]
+ public string PN { get; set; }
+
+ /////
+ ///// 组合键值(LU+PN)
+ /////
+ //public string KeyCode
+ //{
+ // get => LU + PN;
+ //}
+
+ /////
+ /// 数量
+ ///
+ [ImporterHeader(Name = "Quantity")]
+ public decimal Qty { get; set; }
+
+ ///
+ /// 结算分组号
+ ///
+ [ImporterHeader(Name = "Delivery")]
+ public string GroupNum { get; set; }
+
+ ///////
+ /////// 工厂地点
+ ///////
+ ////[Display(Name = "工厂地点")]
+ ////public string Site { get; set; }
}
///
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
index ec5c25f1..238b4ed8 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
@@ -1,10 +1,12 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using NPOI.Util;
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;
@@ -23,37 +25,69 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
///
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
- public class PUB_SA_SERVICE : SettleAccountApplicationBase
+ public class PUB_SA_SERVICE : SettleAccountApplicationBase
{
///
/// PUB结算仓储
///
private readonly INormalEfCoreRepository _repository;
+ ///
+ /// PUB结算明细仓储
+ ///
+ private readonly INormalEfCoreRepository _pubSaDetailRepository;
+
///
/// 构造
///
public PUB_SA_SERVICE(INormalEfCoreRepository repository,
- IDistributedCache cache,
+ INormalEfCoreRepository pubSaDetailRepository,
+ IDistributedCache cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_repository = repository;
+ _pubSaDetailRepository = pubSaDetailRepository;
}
+ #region 直供件
+
+ #endregion
+
#region 导入、导出
///
/// 导入
///
[HttpPost]
- public async Task ImportAsync([FromForm] IFormFileCollection files)
+ public async Task ZGJImportAsync([FromForm] IFormFileCollection files)
{
ExportImporter _exportImporter = new ExportImporter();
- var result = await _exportImporter.UploadExcelImport(files, _excelImportService);
- var _ls = ObjectMapper.Map, List>(result);
- await _repository.InsertManyAsync(_ls);
+ var result = await _exportImporter.UploadExcelImport(files, _excelImportService);
+ var _ls = ObjectMapper.Map, List>(result);
+
+ var billNum = GuidGenerator.Create().ToString();
+ var pubSa = new PUB_SA()
+ {
+ BillNum = billNum,
+ State = "1"
+ };
+
+ _ls.ForEach(s =>
+ {
+ string[] luArr = s.LU.Split(" ");
+ var lus = luArr.Reverse();
+ var result = lus.Aggregate(" ", (current, index) => current + index);
+
+ //s.LU = s.LU.Replace(" ", "").Replace(" ", " ");
+ s.BillNum = billNum;
+ s.Site = "直供件";
+ s.KeyCode = s.LU + s.PN;
+ });
+
+ //await _repository.InsertAsync(pubSa);
+ //await _pubSaDetailRepository.InsertManyAsync(_ls);
return ApplicationConsts.SuccessStr;
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
index 25c97c58..d80ca761 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
@@ -819,6 +819,8 @@ namespace Win.Sfs.SettleAccount
private void CreateMapPUB_SA()
{
CreateMap();
+
+ CreateMap();
}
}