Administrator
3 years ago
3 changed files with 459 additions and 16 deletions
@ -0,0 +1,155 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Caching.Distributed; |
|||
using AutoMapper; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Caching; |
|||
|
|||
using Volo.Abp.ObjectMapping; |
|||
using Win.Sfs.SettleAccount.ExcelImporter; |
|||
using Win.Sfs.Shared.CacheBase; |
|||
using Win.Utils; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using EFCore.BulkExtensions; |
|||
using System.IO; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Win.Sfs.SettleAccount.Entities.SettleAccountVersion; |
|||
using Win.Sfs.SettleAccount.FISes; |
|||
using Win.Sfs.Shared.Enums.SettleAccount; |
|||
using Win.Sfs.Shared.Filter; |
|||
using Shouldly; |
|||
using Magicodes.ExporterAndImporter.Csv; |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using Magicodes.ExporterAndImporter.Excel; |
|||
using System.Data.Common; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp; |
|||
using Win.Abp.Snowflakes; |
|||
using Win.Sfs.SettleAccount.CommonManagers; |
|||
using Win.Sfs.SettleAccount.ExportReports; |
|||
using Win.Sfs.SettleAccount.Constant; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.SettleAccount.Entities.TaskJobs; |
|||
using Magicodes.ExporterAndImporter.Core.Models; |
|||
|
|||
using TaskJob.Services; |
|||
using TaskJob.EventArgs; |
|||
using Win.Sfs.SettleAccount.Entities.WMS; |
|||
using Win.Sfs.SettleAccount.Entities.Wms; |
|||
using Win.Sfs.SettleAccount.Repository; |
|||
using WY.NewJit.Extends.PaiGe.WMS; |
|||
using System.Text.RegularExpressions; |
|||
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.WMS |
|||
{ |
|||
|
|||
|
|||
|
|||
|
|||
[Route("api/settleaccount/WmsOutputSumInterface")] |
|||
|
|||
public class WmsOutputSumInterfaceAppService :ApplicationService |
|||
{ |
|||
private readonly TaskJobService _service; |
|||
private readonly IExcelImportAppService _excelImportService; |
|||
private readonly ISettleAccountBranchEfCoreRepository<TaskJob, Guid> _job; |
|||
|
|||
private readonly ErpSumOutputDapperRepository _dapper; |
|||
|
|||
public WmsOutputSumInterfaceAppService( |
|||
IExcelImportAppService excelImportService, |
|||
ErpSumOutputDapperRepository dapper, |
|||
//ISettleAccountBranchEfCoreRepository<TaskJob, Guid> job,
|
|||
ISnowflakeIdGenerator snowflakeIdGenerator, |
|||
ICommonManager commonManager |
|||
|
|||
) |
|||
{ |
|||
_dapper = dapper; |
|||
|
|||
_excelImportService = excelImportService; |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("ExcelImport")] |
|||
[UnitOfWork(false)] |
|||
//[Authorize(SettleAccountPermissions.PriceLists.Create)]
|
|||
virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files, string version,string accountDate) |
|||
{ |
|||
ExportImporter _exportImporter = new ExportImporter(); |
|||
|
|||
var result = await _exportImporter.UploadExcelImport<WmsOutputSumReport>(files, _excelImportService); |
|||
var _list = result.Where(p => p.实际出库数量 != 0).ToList(); |
|||
|
|||
_dapper.InsertWmsSum(_list, version,DateTime.Parse(accountDate)); |
|||
|
|||
|
|||
return ApplicationConsts.SuccessStr; |
|||
} |
|||
|
|||
|
|||
|
|||
//public async Task<string> GetWmsSum(WmsJitOutPutDetial input)
|
|||
//{
|
|||
// var jobList= _job.Where(p => p.Type == input.Version).ToList();
|
|||
|
|||
// var _fileList= jobList.Where(p=>p.Name == "准时化结算核对明细" && Regex.Replace(p.FileName, @"^[A-Z]+[0-9]+$", string.Empty)==string.Empty);
|
|||
|
|||
|
|||
// List<WmsJitOutPutDetial> _lst = new List<WmsJitOutPutDetial>();
|
|||
// foreach (var filename in _fileList)
|
|||
// {
|
|||
// string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename.RealDownFileName;
|
|||
// ExcelHelper _excelHelper = new ExcelHelper(fileSavePath);
|
|||
// var _list = _excelHelper.ExcelToList<WmsJitOutPutDetial>();
|
|||
// var _ls1 = _list.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList();
|
|||
|
|||
// _ls1.GroupBy(p=>new {p.MaterialCode,p. })
|
|||
// foreach (var itm in _ls1)
|
|||
// {
|
|||
// var _detail = new List<WmsOutputSum>();
|
|||
// }
|
|||
|
|||
// //var _lsCopy = new List<WmsJitOutPutDetial>();
|
|||
// //foreach (var itm in _list)
|
|||
// //{
|
|||
// // WmsJitOutPutDetial _detail = new WmsJitOutPutDetial(
|
|||
// // GuidGenerator.Create(),
|
|||
// // itm.WmsBillNum,
|
|||
// // itm.KennCode,
|
|||
// // itm.ChassisNumber,
|
|||
// // itm.MaterialCode,
|
|||
// // itm.MaterialDesc,
|
|||
// // itm.MaterialGroup,
|
|||
// // string.Empty,
|
|||
// // string.Empty,
|
|||
// // 0,
|
|||
// // string.Empty,
|
|||
// // string.Empty,
|
|||
// // input.Version,
|
|||
// // itm.ParentMaterialCode,
|
|||
// // itm.BillNum,
|
|||
// // GuidGenerator.Create()
|
|||
// // , string.Empty
|
|||
// // , itm.Qty
|
|||
// // );
|
|||
// // _lsCopy.Add(_detail);
|
|||
// //}
|
|||
// //_lst.AddRange(_lsCopy.ToArray());
|
|||
// }
|
|||
//}
|
|||
|
|||
|
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue