From 10feb4fcecbbb4a0f8f93751494aeb56feda91ff Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 29 Dec 2021 20:46:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vs/VSWorkspaceState.json | 1 + .vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo | Bin 79872 -> 79872 bytes .../Entities/Wms/WmsJitOutPutDetialDto.cs | 264 ++++++++++- .../CodeSettingAppService.cs | 3 + .../SettleAccounts/SettleAccountAppService.cs | 65 +-- .../Entities/WMS/WMSAppService.cs | 264 ----------- .../Entities/WMS/WMSJitAppService.cs | 439 ++++++++++++++++++ .../Entities/WMS/WMSKanbanAppService.cs | 381 +++++++++++++++ .../Entities/WMS/WMSSharePartAppService.cs | 382 +++++++++++++++ .../Jobs/TaskJobService.cs | 2 +- .../ReportServices/ReportMakeService.cs | 209 ++++----- .../SettleAccount.Application.xml | 249 +++++++--- .../Entities/TaskJobs/TEA_TASK_SUB.cs | 78 ++++ .../Entities/TaskJobs/TaskJob.cs | 9 +- .../Entities/WMS/TaskList.cs | 298 +++++++++++- ...AccountDbContextModelCreatingExtensions.cs | 122 ++++- ...nvoiceSettledDetailDiffDapperRepository.cs | 16 +- .../Report/UnSettledDetailDapperRepository.cs | 9 +- .../SettleAccounts/SettleAccountRepository.cs | 2 +- .../Tasks/TaskDapperRepository.cs | 2 +- .../UnSettleAccountRepository.cs | 2 +- .../Report/InvoiceSettledDiffExportService.cs | 1 + 22 files changed, 2280 insertions(+), 518 deletions(-) delete mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSAppService.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TEA_TASK_SUB.cs diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json index 6b611411..5f13e167 100644 --- a/.vs/VSWorkspaceState.json +++ b/.vs/VSWorkspaceState.json @@ -2,5 +2,6 @@ "ExpandedNodes": [ "" ], + "SelectedNode": "\\SettleAccount.sln (src\\Modules\\SettleAccount\\SettleAccount.sln)", "PreviewInSolutionExplorer": false } \ No newline at end of file diff --git a/.vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo b/.vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo index 223c4ea48c4dde9069c536e1682550f59ee6c861..caa323f28df59ec7639ee0e3cf8be776bbcbae02 100644 GIT binary patch delta 1405 zcmcJO%WG3n5XN(^w@upKXxb(=+SI<{gS4qhEHTkmBkdxBl0+1(RWNGB7x+pwzT*>o zfw|+Wx{HFYiuNvaBM5e-S*hT{jekPKiWX_>H%+catl-9hA7{?YoO922=G;_HPUYms zt0ZBgMybBcvggYO_4|9#r1eWzgiuJxwK0pqV3>ee3*$I^BmA<$oO9Jhz8QW+VZI*Y zY%s<}uv+-z>3FT^O2^KLNIJIA97QMw)_|GmShaZroF1?d4A8EMNO&K-{onvN2o8Y+ z=m&?v5s(B&!7*?goB$`mDR3I3fGVvj2+cWu3N0nExg1G8B1>b~rXyAYOn~L)qZ1P> zo8_`Jj`6x#@L4v`_4Vwt+0wD*zsQ~Of8`F9cTZFJ2zsX|tvI!W`KqKky3B?e9N1Af zG-oK`h$?&&+%R4?Sw7-WglY|&<`f0##ZsA))+`N69!l7*s?Kg@Ci40f+gqD3COfiug8wL{CVm1Z8vnI>sy@T)`> z&Ch9Ug`&M!sTj5Fv-Ul7aINd9Yk?Rnr;lyf+Yc6sO_rAHpLXxOm+W~vu;uLTUc;-W J7LUjoe*mV6=Ai%p delta 1464 zcmchW-%C?*6u@_GcRA;sU3LB_olc!|mdiQEn!nmaja9<5G?1WLq=Xa{P4FdHy%eS8 z?kScPB=%4cgzZb|gAY=^ls-rX`Px4aMpF5pb-we?RvGlv7e1Wt_nh-RzwZ5pm&EXr zINl~eDi#YxslLf`UGrbwLjmg-t^?>1#Qcu6??0D8qtO_N6e5jCSW0Ox5!+Q=ev*y* ztP(p&$75ySS$%G+ta?~TmJwEBgs>46#7<%tQAyZ|-9#1PAgT!`QG>7bUb%&KJVz_Z zeFWyEnc;AxBg@c9rz5KMN~GhFBDATEn)@~y-HOnoBPU)WFYotuwQ2yKg0F3=FCPOx zr>ZiCByXFKB9};x!~NFV&L#^#{m-^h)SFS(i_D@oZ;^Q2dbJ9SNEQ|{3<`?W%$oB6 z{;)m_Z3if4{W$@Uc-`ito7yfq2)L3FK)v*jX5P>d}&BRDW* zY?lh@I#145yeeO#h~JEJ@c|d9#<(HeAnN$D;%m$*#H=p?o67epHoq>5R2u<8woV;? zni~pV9YwUY$G=OcB4B__vhqip@KDl4(BMi@3{M`+X47ULAoxto3aj+3nM2k_Z`)|!FH=768!feu~U}&Fy;~zkBoAqgat;MI)DJa5~^{%=h^t4+5`z# z@&nB8nKUToCqIk2=$m3w{uZxNHzzJUk9}bCbq>I{183NoYqzpdXw1WKgONx`zBjUP zL#kkP_SQH&)q85~dxE_^c9*BeY4M+fEq`HwMg7F06KvWaAUXe= diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs index 36a8d678..25573de6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs @@ -4,10 +4,46 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Win.Sfs.Shared.DtoBase; namespace Win.Sfs.SettleAccount.Entities.Wms { - public class WmsJitOutPutDetialDto + public class WmsJitOutPutDto + { + public WmsJitOutPutDto() + { + } + + + + public string Version { set; get; } + + public string BillNum { set; get; } + + public string Creator { set; get; } + + + + } + public class WmsJitOutPutRequestDto: RequestDtoBase + { + public WmsJitOutPutRequestDto() + { + } + + + + public string Version { set; get; } + + public string BillNum { set; get; } + + public string Creator { set; get; } + + + + } + public class WmsJitOutPutDetialDto: AuditedEntityDto { [ImporterHeader(Name = "交货单号")] public string WmsBillNum { set; get; } @@ -39,6 +75,232 @@ namespace Win.Sfs.SettleAccount.Entities.Wms + } + public class WmsJitOutPutDetialRequestDto: RequestDtoBase + { + [ImporterHeader(Name = "交货单号")] + public string WmsBillNum { set; get; } + + [ImporterHeader(Name = "KENN号")] + //KENN号 + public string KennCode { set; get; } + [ImporterHeader(Name = "底盘号")] + //底盘号 + public string ChassisNumber { set; get; } + [ImporterHeader(Name = "物料号")] + //物料号 + public string MaterialCode { set; get; } + + [ImporterHeader(Name = "组件组物料")] + //物料号 + public string ParentMaterialCode { set; get; } + + [ImporterHeader(Name = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + + [ImporterHeader(Name = "物料组(车型)")] + //物料组(车型) + public string MaterialGroup { set; get; } + + public string BillNum { set; get; } + + + + } + + public class WmsJitRequestDto + { + public string BillNum { set; get; } + public string Version { set; get; } + public List Guids { set; get; } + + + + } + + + + public class WmsKanbanOutPutDto: AuditedEntityDto + { + public WmsKanbanOutPutDto() + { + } + + + + public string Version { set; get; } + + public string BillNum { set; get; } + + public string Creator { set; get; } + + + + } + public class WmsKanbanOutPutRequestDto : RequestDtoBase + { + public WmsKanbanOutPutRequestDto() + { + } + + + + public string Version { set; get; } + + public string BillNum { set; get; } + + public string Creator { set; get; } + + + + } + public class WmsKanbanOutPutDetialDto: AuditedEntityDto + { + [ImporterHeader(Name = "交货单号")] + public string WmsBillNum { set; get; } + + + [ImporterHeader(Name = "订单号")] + //底盘号 + public string Kanban { set; get; } + [ImporterHeader(Name = "物料号")] + //物料号 + public string MaterialCode { set; get; } + + + [ImporterHeader(Name = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + + [ImporterHeader(Name = "物料组(车型)")] + //物料组(车型) + public string MaterialGroup { set; get; } + + [ImporterHeader(Name = "交货数量")] + public decimal Qty { set; get; } + + + + } + public class WmsKanbanOutPutDetialRequestDto : RequestDtoBase + { + [ImporterHeader(Name = "交货单号")] + public string WmsBillNum { set; get; } + + + [ImporterHeader(Name = "订单号")] + //底盘号 + public string OrderBillNum { set; get; } + [ImporterHeader(Name = "物料号")] + //物料号 + public string MaterialCode { set; get; } + + + + [ImporterHeader(Name = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + + [ImporterHeader(Name = "物料组(车型)")] + //物料组(车型) + public string MaterialGroup { set; get; } + + + + + + } + + public class WmsSharePartOutPutDto + { + public WmsSharePartOutPutDto() + { + } + + + + public string Version { set; get; } + + public string BillNum { set; get; } + + public string Creator { set; get; } + + + + } + public class WmsSharePartOutPutRequestDto : RequestDtoBase + { + public WmsSharePartOutPutRequestDto() + { + } + + + + public string Version { set; get; } + + public string BillNum { set; get; } + + public string Creator { set; get; } + + + + } + public class WmsSharePartOutPutDetialDto + { + [ImporterHeader(Name = "交货单号")] + public string WmsBillNum { set; get; } + + + [ImporterHeader(Name = "订单号")] + //底盘号 + public string SharePart { set; get; } + [ImporterHeader(Name = "物料号")] + //物料号 + public string MaterialCode { set; get; } + + + [ImporterHeader(Name = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + + [ImporterHeader(Name = "物料组(车型)")] + //物料组(车型) + public string MaterialGroup { set; get; } + + [ImporterHeader(Name = "交货数量")] + public decimal Qty { set; get; } + + + + } + public class WmsSharePartOutPutDetialRequestDto : RequestDtoBase + { + [ImporterHeader(Name = "交货单号")] + public string WmsBillNum { set; get; } + + + [ImporterHeader(Name = "订单号")] + //底盘号 + public string Kanban { set; get; } + [ImporterHeader(Name = "物料号")] + //物料号 + public string MaterialCode { set; get; } + + + + [ImporterHeader(Name = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + + [ImporterHeader(Name = "物料组(车型)")] + //物料组(车型) + public string MaterialGroup { set; get; } + + + + + } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs index 625cfb37..4912d2eb 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs @@ -196,6 +196,9 @@ namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables var totalCount = await GetCountAsync(input); var dtos = ObjectMapper.Map, List>(entities); + + dtos=dtos.OrderBy(p => p.Value).ToList(); + return new PagedResultDto(totalCount, dtos); } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs index 18ca23e7..e69c78f1 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs @@ -245,33 +245,6 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts - - - - - - - - - - - - - - - - - - - - - - - - - - - [HttpPost] [Route("testImport")] [DisableRequestSizeLimit] @@ -288,10 +261,6 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts }); return _taskid; } - - - - [HttpPost] [Route("ExcelImport-PG")] [DisableRequestSizeLimit] @@ -304,13 +273,14 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? string.Empty }); customConditionList.Add(new CustomCondition() { Name = "Period", Value = period ?? string.Empty }); customConditionList.Add(new CustomCondition() { Name = "Factory", Value = factory ?? string.Empty }); + var _versionQuery = _versionRepository.Where(p => p.Version == version); + _versionQuery.BatchDelete(); + var _query = _repository.Where(p => p.Version == version); + _query.BatchDelete(); var _taskid = await _service.ImportEnqueueAsync(files, "结算数据", CurrentUser, typeof(SettleAccountImportService), customConditionList, (rs) => { - var _versionQuery = _versionRepository.Where(p => p.Version == version); - _versionQuery.BatchDelete(); - var _query = _repository.Where(p => p.Version == version); - _query.BatchDelete(); + }); return _taskid; @@ -420,17 +390,14 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm, string.Empty, string.Format("关系表中不存在结算物料号{0}!", itm), string.Empty)); } - foreach (var itm in query) { checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}底盘号 {1}有重复", itm.Key.MaterialCode, itm.Key.ChassisNumber), string.Empty)); } - if (checkList.Count > 0) { return await ExportErrorReportAsync(checkList); } - var _existls = _preBatchRepository.Where(p => _precodeList.Contains(p.KENNCode)).ToList(); if (_existls.Count > 0) { @@ -471,8 +438,6 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts var result = await _repository.GetAsync(id); return result; } - - private async Task GetCountAsync(SettleAccountRequestDto input) { return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); @@ -500,27 +465,13 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts IExporter _csv = new CsvExporter(); IExporter _excel = new ExcelExporter(); - - //var prebatchList= await _preBatchRepository.GetAllAsync(GuidGenerator.Create()); - - //if (input.ParentId != Guid.Empty) - //{ - // input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "ParentId", Logic = EnumFilterLogic.And, Value = input.ParentId.ToString() }); - //} - //var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, - //0, true); var _query = from itm1 in _preBatchRepository join itm2 in _repository on new { itm1.KENNCode, itm1.Year } equals new { itm2.KENNCode, itm2.Year } where itm2.Version == version select itm2; - - var _ls=await _query.ToListAsync(); foreach (var itm in _ls) { itm.state = 3; - } - var dtoDetails = ObjectMapper.Map, List>(_ls); - string _fileName = string.Empty; //声明导出容器 @@ -562,7 +513,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts /// /// /// - [HttpPost] + [HttpPost] [Route("Export")] //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] virtual public async Task ExportAsync(SettleAccountRequestDto input) @@ -671,11 +622,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts virtual public async Task> GetAllAsync(Guid branchId) { var entities = await _repository.GetAllAsync(branchId, true); - - var dtos = ObjectMapper.Map, List>(entities); - - return new ListResultDto(dtos); } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSAppService.cs deleted file mode 100644 index 344bc21e..00000000 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSAppService.cs +++ /dev/null @@ -1,264 +0,0 @@ -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; - -namespace Win.Sfs.SettleAccount.Entities.SettleAccounts -{ - /// - /// 大众准时化结算明细导入-R3已结 - /// - //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] - [AllowAnonymous] - [Route("api/settleaccount/wms")] - public class WMSAppService : - ApplicationService - { - - private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; - private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; - private readonly WMSEfCoreRepository _wmsefRespository; - - private readonly WMSEfCoreRepository _wmstbRespository; - private readonly ISettleAccountBranchEfCoreRepository _job; - - private readonly TaskJobService _service; - /// - /// 构建方法 - /// - /// 构建UID - - /// 仓储接口 - /// 缓存 - public WMSAppService( - - ISettleAccountBranchEfCoreRepository wmsRepository, - - ISettleAccountBranchEfCoreRepository job, - - ISettleAccountBranchEfCoreRepository wmsVersionRepository, - WMSEfCoreRepository wmsefRespository, - WMSEfCoreRepository wmstbRespository - ) - { - _job = job; - _wmstbRespository = wmstbRespository; - _wmsRepository = wmsRepository; - _wmsVersionRepository = wmsVersionRepository; - _wmsefRespository = wmsefRespository; - } - - /// - /// 选择结算明细任务列表,选择相关任务合拼导期间出库表 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpGet] - [Route("WmsJitOutPut")] - [DisableRequestSizeLimit] - - public async Task WmsJitOutPut(List ids, string version) - { - - var _joblist=_job.Where(p => ids.Contains(p.Id)).ToList(); - - - var fileList = _joblist.Select(p => p.RealDownFileName).ToList(); - - List _lst = new List(); - foreach (var filename in fileList) - { - string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename; - IExcelImporter Importer = new Magicodes.ExporterAndImporter.Excel.ExcelImporter(); - var _list = await Importer.ImportSameSheets(fileSavePath); - foreach (var itm in _list) - { - var list = itm.Value.Data.ToList(); - _lst.AddRange(list.ToArray()); - } - } - var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); - - - var outPutDetail= await _wmsRepository.Where(p => p.Version == version).ToListAsync(); - - - var _billNum="T" + DateTime.Now.ToString("yyyyMMddhhmmssdddd"); - - - - - var query = from itm1 in _ls1 - join itm2 in outPutDetail on - new { itm1.MaterialCode, itm1.KennCode, itm1.ChassisNumber } - equals - new { itm2.MaterialCode, itm2.KennCode, itm2.ChassisNumber } into temp1 - from tm1 in temp1.DefaultIfEmpty() where tm1==null - select itm1; - - - var _wmslst=query.ToList(); - foreach (var itm in _wmslst) - { - itm.BillNum = _billNum; - } - - await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0 }); - int _count= _wmsVersionRepository.Count(p => p.Version == version); - if (_count == 0) - { - var _version = new List(); - _version.Add(new WmsJitOutPut { Version = version, BillNum = _billNum, Creator = CurrentUser.Email }); - await _wmsVersionRepository.GetDbContext().BulkInsertAsync(_version); - } - else - { - var _ls= _wmsVersionRepository.Where(p => p.Version == version).ToList(); - foreach (var itm in _ls) - { - itm.BillNum = _billNum; - } - await _wmsVersionRepository.UpdateManyAsync(_ls); - } - //_wmsRepository.Where(p=>p) - - return _billNum; - - } - - [HttpGet] - [Route("WmsJitOutPut-Pass")] - - public async Task WmsJitOutPutPass( string version, List p_list=null) - { - if (p_list != null) - { - List _ls = new List(); - if (p_list.Count() > 0) - { - _ls = await _wmsRepository.Where(p => p_list.Contains(p.Id) && p.Version == version && p.State != 2).ToListAsync(); - } - else - { - _ls = await _wmsRepository.Where(p => p.Version == version && p.State != 2).ToListAsync(); - } - if (_ls.Count() > 0) - { - var _first = _ls.FirstOrDefault(); - var _guid = GuidGenerator.Create(); - foreach (var itm in _ls) - { - itm.TaskId = _guid; - } - await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls); - var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", version, "WmsJitOutPutDetail",_first.BillNum, 0,0 ,_guid) - { - TaskId = _guid, - SourceBillNum = _first.BillNum, - TableName = "WmsJitOutPutDetail", - InterfaceType = "1", - Version = version, - SettleAccountState = 0, - WmsState=0 - - }; - var _l = new List(); - _l.Add(uniapi); - await _wmsefRespository.GetDbContext().BulkInsertAsync(_l); - - } - } - //_wmsDapper.GetListBySql("insert into WmsJitOutPutDetial", false); - //_wmsDapper.DbConnection.ConnectionTimeout = 1200; - //_wmsRepository.Where(p=>p) - return true; - - } - - - [HttpGet] - [Route("WmsJitOutPut-Cancel")] - - public async Task WmsJitOutPutCancel(List ids, string version) - { - - //var _guid = GuidGenerator.Create(); - //foreach (var itm in _ls) - //{ - // itm.TaskId = _guid; - //} - var _ls = await _wmsRepository.Where(p => ids.Contains(p.Id) && p.Version == version && p.State == 1).ToListAsync(); - var _first = _ls.FirstOrDefault(); - if (_ls.Count>0) - { - var _guid = GuidGenerator.Create(); - await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls,new BulkConfig() { BulkCopyTimeout=0 }); - var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", version, "WmsJitOutPutDetail", _first.BillNum, 0,0, _guid) - { - TaskId = _guid, - SourceBillNum = _first.BillNum, - TableName = "WmsJitOutPutDetail", - InterfaceType = "1", - Version = version, - WmsState = 0, - SettleAccountState=0 - }; - var _l = new List(); - _l.Add(uniapi); - await _wmsefRespository.GetDbContext().BulkInsertAsync(_l); - - } - return true; - - } - - - - - } -} \ No newline at end of file diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs new file mode 100644 index 00000000..b45679aa --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs @@ -0,0 +1,439 @@ +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; + +namespace Win.Sfs.SettleAccount.Entities.SettleAccounts +{ + /// + /// wms出库 + /// + + [AllowAnonymous] + [Route("api/settleaccount/wmsjitoutput")] + public class WMSJitAppService : + ApplicationService + { + private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; + private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; + private readonly WMSEfCoreRepository _wmsefRespository; + private readonly WMSEfCoreRepository _wmstbRespository; + private readonly ISettleAccountBranchEfCoreRepository _job; + private readonly IExcelImportAppService _excelImportService; + private readonly TaskJobService _service; + /// + /// + /// + /// + /// + /// + /// + /// + public WMSJitAppService( + IExcelImportAppService excelImportService, + ISettleAccountBranchEfCoreRepository wmsRepository, + ISettleAccountBranchEfCoreRepository job, + ISettleAccountBranchEfCoreRepository wmsVersionRepository, + WMSEfCoreRepository wmsefRespository, + WMSEfCoreRepository wmstbRespository + ) + { + _job = job; + _wmstbRespository = wmstbRespository; + _wmsRepository = wmsRepository; + _wmsVersionRepository = wmsVersionRepository; + _wmsefRespository = wmsefRespository; + _excelImportService = excelImportService; + } + + + [HttpPost] + [Route("ExcelImport")] + [DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + public async Task ExcelImport([FromForm] IFormFileCollection files, string version) + { + var _billNum = "T" + DateTime.Now.ToString("yyyyMMddhhmmss"); + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); + List _lst = new List(); + var _lsCopy = new List(); + foreach (var itm in result) + { + 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, + version, + itm.ParentMaterialCode, + itm.BillNum, + GuidGenerator.Create() + , string.Empty + , itm.Qty + ); + _lsCopy.Add(_detail); + } + _lst.AddRange(_lsCopy.ToArray()); + + var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); + var outPutDetail = await _wmsRepository.Where(p => p.Version == version).ToListAsync(); + var query = from itm1 in _ls1 + join itm2 in outPutDetail on + new { itm1.MaterialCode, itm1.KennCode, itm1.ChassisNumber } + equals + new { itm2.MaterialCode, itm2.KennCode, itm2.ChassisNumber } into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm1; + var _wmslst = query.ToList(); + foreach (var itm in _wmslst) + { + itm.BillNum = _billNum; + } + await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum); + if (_count == 0) + { + var _version = new WmsJitOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email); + await _wmsVersionRepository.InsertAsync(_version, true); + } + return _billNum; + } + + + + + + + + + private async Task GetCountAsync(WmsJitOutPutDetialRequestDto input) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum }); + return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + } + + private async Task GetCountAsync(WmsJitOutPutRequestDto input) + { + return await _wmsVersionRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + } + + /// + /// 准时化出库主表 + /// + /// + /// + [HttpPost] + [Route("WmsJitList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync( WmsJitOutPutRequestDto input) + { + + var entities = await _wmsVersionRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + + + return new PagedResultDto(totalCount, entities); + } + + /// + /// 准时化出库明细 + /// + /// + /// + [HttpPost] + [Route("WmsJitDetailList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WmsJitOutPutDetialRequestDto input) + { + + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value =input.BillNum }); + var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + //var dtoDetails = ObjectMapper.Map, List>(entities); + + return new PagedResultDto(totalCount, entities); + } + /// + /// 任务明细标记已确认 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("WmsJitOutPutAudit")] + [DisableRequestSizeLimit] + + public async Task WmsJitAudit(List ids) + { + var _joblist =await _job.Where(p => ids.Contains(p.Id)).ToListAsync(); + foreach (var itm in _joblist) + { + itm.FileName = "已确认"; + await _job.UpdateAsync(itm); + } + + return true; + } + + /// + /// 任务明细标记已确认 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("WmsJitOutPutCancel")] + [DisableRequestSizeLimit] + + public async Task WmsJitCancel(List ids) + { + var _joblist = await _job.Where(p => ids.Contains(p.Id) && p.FileName=="已确认").ToListAsync(); + foreach (var itm in _joblist) + { + itm.FileName = "取消确认"; + await _job.UpdateAsync(itm); + } + + return true; + } + + + + + + + + + + /// + /// 选择任务,生成出库单,只包含已确认的单据 + /// + /// + /// + /// + [HttpPost] + [Route("WmsJitOutPut")] + public async Task WmsJitOutPut(WmsJitRequestDto input) + { + var _billNum = "T" + DateTime.Now.ToString("yyyyMMddhhmmss"); + var _joblist=_job.Where(p => input.Guids.Contains(p.Id) && p.FileName== "已确认").ToList(); + if (_joblist.Count() > 0) + { + var fileList = _joblist.Select(p => p.RealDownFileName).ToList(); + List _lst = new List(); + foreach (var filename in fileList) + { + string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename; + ExcelHelper _excelHelper = new ExcelHelper(fileSavePath); + var _list = _excelHelper.ExcelToList(); + var _lsCopy = new List(); + 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()); + } + var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); + var outPutDetail = await _wmsRepository.Where(p => p.Version ==input.Version).ToListAsync(); + var query = from itm1 in _ls1 + join itm2 in outPutDetail on + new { itm1.MaterialCode, itm1.KennCode, itm1.ChassisNumber } + equals + new { itm2.MaterialCode, itm2.KennCode, itm2.ChassisNumber } into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm1; + var _wmslst = query.ToList(); + foreach (var itm in _wmslst) + { + itm.BillNum = _billNum; + } + await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0 , BatchSize=10000}); + int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum==_billNum); + if (_count == 0) + { + var _version = new WmsJitOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); + //var _ls = new List(); + //_ls.Add(_version); + await _wmsVersionRepository.InsertAsync(_version, true); + } + foreach (var job in _joblist) + { + job.FileName = _billNum; + await _job.UpdateAsync(job); + } + } + else + { + _billNum = string.Empty; + } + return _billNum; + } + /// + /// 出库界面功能,核准出库功能 + /// + /// + /// + /// + [HttpPost] + [Route("WmsJitOutPut-Pass")] + public async Task WmsJitOutPutPass(WmsJitRequestDto input) + { + if (input.Guids != null) + { + List _ls = new List(); + if (input.Guids.Count() > 0) + { + _ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version == input.Version && p.State != 2).ToListAsync(); + } + else + { + _ls = await _wmsRepository.Where(p => p.Version ==input.Version && p.BillNum==input.BillNum && p.State != 2).ToListAsync(); + } + if (_ls.Count() > 0) + { + foreach (var itm in _ls) + { + itm.State = 1; + } + await _wmsRepository.GetDbContext().BulkUpdateAsync(_ls); + //var _first = _ls.FirstOrDefault(); + //var _guid = GuidGenerator.Create(); + //foreach (var itm in _ls) + //{ + // itm.TaskId = _guid; + //} + //await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls); + //var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", version, "WmsJitOutPutDetail",_first.BillNum, 0,0 ,_guid) + //{ + // TaskId = _guid, + // SourceBillNum = _first.BillNum, + // TableName = "WmsJitOutPutDetail", + // InterfaceType = "1", + // Version = version, + // SettleAccountState = 0, + // WmsState=0 + + //}; + //var _l = new List(); + //_l.Add(uniapi); + //await _wmsefRespository.GetDbContext().BulkInsertAsync(_l); + + } + } + + return true; + } + /// + ///出库界面功能, 撤销核准出库 + /// + /// + /// + /// + [HttpPost] + [Route("WmsJitOutPut-Cancel")] + public async Task WmsJitOutPutCancel(WmsJitRequestDto input) + { + var _ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version == input.Version && p.State == 2).ToListAsync(); + var _first = _ls.FirstOrDefault(); + if (_ls.Count > 0) + { + //var _guid = GuidGenerator.Create(); + //await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls,new BulkConfig() { BulkCopyTimeout=0 }); + //var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", version, "WmsJitOutPutDetail", _first.BillNum, 0,0, _guid) + //{ + // TaskId = _guid, + // SourceBillNum = _first.BillNum, + // TableName = "WmsJitOutPutDetail", + // InterfaceType = "1", + // Version = version, + // WmsState = 0, + // SettleAccountState=0 + //}; + //var _l = new List(); + //_l.Add(uniapi); + //await _wmsefRespository.GetDbContext().BulkInsertAsync(_l); + } + return true; + } + + + } +} \ No newline at end of file diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs new file mode 100644 index 00000000..d432f4b3 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs @@ -0,0 +1,381 @@ +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; + +namespace Win.Sfs.SettleAccount.Entities.SettleAccounts +{ + /// + /// wms出库 + /// + + [AllowAnonymous] + [Route("api/settleaccount/wmskanbanoutput")] + public class WMSKanbanAppService : + ApplicationService + { + + private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; + private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; + private readonly WMSEfCoreRepository _wmsefRespository; + + private readonly WMSEfCoreRepository _wmstbRespository; + private readonly ISettleAccountBranchEfCoreRepository _job; + private readonly IExcelImportAppService _excelImportService; + + private readonly TaskJobService _service; + /// + /// + /// + /// + /// + /// + /// + /// + public WMSKanbanAppService( + + + IExcelImportAppService excelImportService, + + ISettleAccountBranchEfCoreRepository wmsRepository, + ISettleAccountBranchEfCoreRepository job, + ISettleAccountBranchEfCoreRepository wmsVersionRepository, + WMSEfCoreRepository wmsefRespository, + WMSEfCoreRepository wmstbRespository + ) + { + _job = job; + _wmstbRespository = wmstbRespository; + _wmsRepository = wmsRepository; + _wmsVersionRepository = wmsVersionRepository; + _wmsefRespository = wmsefRespository; + _excelImportService = excelImportService; + } + + private async Task GetCountAsync(WmsKanbanOutPutDetialRequestDto input) + { + return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + } + + private async Task GetCountAsync(WmsKanbanOutPutRequestDto input) + { + return await _wmsVersionRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + } + + /// + /// 准时化出库主表 + /// + /// + /// + [HttpPost] + [Route("WmsKanbanList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync( WmsKanbanOutPutRequestDto input) + { + + var entities = await _wmsVersionRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + + + return new PagedResultDto(totalCount, entities); + } + + /// + /// 准时化出库明细 + /// + /// + /// + [HttpPost] + [Route("WmsKanbanDetailList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WmsKanbanOutPutDetialRequestDto input) + { + var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + return new PagedResultDto(totalCount, entities); + } + /// + /// 任务明细标记已确认 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpGet] + [Route("WmsKanbanOutPutAudit")] + [DisableRequestSizeLimit] + + public async Task WmsKanbanAudit(List ids) + { + var _joblist =await _job.Where(p => ids.Contains(p.Id)).ToListAsync(); + foreach (var itm in _joblist) + { + itm.FileName = "已确认"; + } + foreach (var itm in _joblist) + { + await _job.UpdateAsync(itm); + } + var _count=await _job.BatchUpdateAsync(_joblist.ToList()); + if (_count > 0) + { + return true; + } + return false; + } + /// + /// 选择任务,生成出库单,只包含已确认的单据 + /// + /// + /// + /// + [HttpGet] + [Route("WmsKanbanOutPut")] + public async Task WmsKanbanOutPut(WmsJitRequestDto input) + { + var _billNum = "K" + DateTime.Now.ToString("yyyyMMddhhmmss"); + + var _joblist = _job.Where(p => input.Guids.Contains(p.Id) && p.FileName == "已确认").ToList(); + if (_joblist.Count() > 0) + { + var fileList = _joblist.Select(p => p.RealDownFileName).ToList(); + List _lst = new List(); + foreach (var filename in fileList) + { + string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename; + ExcelHelper _excelHelper = new ExcelHelper(fileSavePath); + var _list = _excelHelper.ExcelToList(); + foreach (var itm in _list) + { + itm.SetId(GuidGenerator.Create()); + } + _lst.AddRange(_list.ToArray()); + } + var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); + var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version).ToListAsync(); + var query = from itm1 in _ls1 + join itm2 in outPutDetail on + new { itm1.MaterialCode, itm1.Kanban } + equals + new { itm2.MaterialCode, itm2.Kanban } into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm1; + var _wmslst = query.ToList(); + foreach (var itm in _wmslst) + { + itm.BillNum = _billNum; + } + await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); + if (_count == 0) + { + var _version = new WmsKanbanOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); + + await _wmsVersionRepository.InsertAsync(_version, true); + + } + + foreach (var job in _joblist) + { + job.FileName = _billNum; + await _job.UpdateAsync(job); + } + } + else + { + _billNum = string.Empty; + } + return _billNum; + } + /// + /// 出库界面功能,核准出库功能 + /// + /// + /// + /// + [HttpGet] + [Route("WmsKanbanOutPut-Pass")] + public async Task WmsKanbanOutPutPass(WmsJitRequestDto input) + { + if (input.Guids != null) + { + List _ls = new List(); + if (input.Guids.Count() > 0) + { + _ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version ==input.Version && p.BillNum == input.BillNum && p.State != 2).ToListAsync(); + } + else + { + _ls = await _wmsRepository.Where(p => p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2).ToListAsync(); + } + if (_ls.Count() > 0) + { + var _first = _ls.FirstOrDefault(); + var _guid = GuidGenerator.Create(); + foreach (var itm in _ls) + { + itm.TaskId = _guid; + } + await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls); + var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", input.Version, "WmsKanbanOutPutDetail",_first.BillNum, 0,0 ,_guid) + { + TaskId = _guid, + SourceBillNum = _first.BillNum, + TableName = "WmsKanbanOutPutDetail", + InterfaceType = "2", + Version = input.Version, + SettleAccountState = 0, + WmsState=0 + }; + var _l = new List(); + _l.Add(uniapi); + await _wmsefRespository.GetDbContext().BulkInsertAsync(_l); + } + } + return true; + } + /// + ///出库界面功能, 撤销核准出库 + /// + /// + /// + /// + [HttpGet] + [Route("WmsKanbanOutPut-Cancel")] + public async Task WmsKanbanOutPutCancel(WmsJitRequestDto input) + { + var _ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version == input.Version && p.State == 1).ToListAsync(); + var _first = _ls.FirstOrDefault(); + if (_ls.Count()>0) + { + var _guid = GuidGenerator.Create(); + await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls,new BulkConfig() { BulkCopyTimeout=0 }); + var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", input.Version, "WmsKanbanOutPutDetail", _first.BillNum, 0,0, _guid) + { + TaskId = _guid, + SourceBillNum = _first.BillNum, + TableName = "WmsKanbanOutPutDetail", + InterfaceType = "2", + Version = input.Version, + WmsState = 0, + SettleAccountState=0 + }; + var _l = new List(); + _l.Add(uniapi); + await _wmsefRespository.GetDbContext().BulkInsertAsync(_l); + } + return true; + } + [HttpPost] + [Route("ExcelImport")] + [DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + public async Task ExcelImport([FromForm] IFormFileCollection files, string version) + { + var _billNum = "K" + DateTime.Now.ToString("yyyyMMddhhmmss"); + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); + List _lst = new List(); + var _lsCopy = new List(); + foreach (var itm in result) + { + WmsKanbanOutPutDetial _detail = new WmsKanbanOutPutDetial( + GuidGenerator.Create(), + itm.WmsBillNum, + itm.Kanban, + + itm.MaterialCode, + itm.MaterialDesc, + itm.MaterialGroup, + string.Empty, + string.Empty, + 0, + string.Empty, + string.Empty, + version, + itm.ParentMaterialCode, + itm.BillNum, + GuidGenerator.Create() + , string.Empty + , itm.Qty.Value + ); + _lsCopy.Add(_detail); + } + _lst.AddRange(_lsCopy.ToArray()); + + var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); + var outPutDetail = await _wmsRepository.Where(p => p.Version == version).ToListAsync(); + var query = from itm1 in _ls1 + join itm2 in outPutDetail on + new { itm1.MaterialCode, itm1.Kanban } + equals + new { itm2.MaterialCode, itm2.Kanban } into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm1; + var _wmslst = query.ToList(); + foreach (var itm in _wmslst) + { + itm.BillNum = _billNum; + } + await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum); + if (_count == 0) + { + var _version = new WmsKanbanOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email); + await _wmsVersionRepository.InsertAsync(_version, true); + } + return _billNum; + } + + + } +} \ No newline at end of file diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs new file mode 100644 index 00000000..f594b1cf --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs @@ -0,0 +1,382 @@ +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; + +namespace Win.Sfs.SettleAccount.Entities.SettleAccounts +{ + /// + /// wms出库 + /// + + [AllowAnonymous] + [Route("api/settleaccount/wmsSharePartoutput")] + public class WMSSharePartAppService : + ApplicationService + { + + private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; + private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; + private readonly WMSEfCoreRepository _wmsefRespository; + + private readonly WMSEfCoreRepository _wmstbRespository; + private readonly ISettleAccountBranchEfCoreRepository _job; + private readonly IExcelImportAppService _excelImportService; + + private readonly TaskJobService _service; + /// + /// + /// + /// + /// + /// + /// + /// + public WMSSharePartAppService( + + ISettleAccountBranchEfCoreRepository wmsRepository, + ISettleAccountBranchEfCoreRepository job, + ISettleAccountBranchEfCoreRepository wmsVersionRepository, + WMSEfCoreRepository wmsefRespository, + WMSEfCoreRepository wmstbRespository, + IExcelImportAppService excelImportService + ) + { + _excelImportService = excelImportService; + _job = job; + _wmstbRespository = wmstbRespository; + _wmsRepository = wmsRepository; + _wmsVersionRepository = wmsVersionRepository; + _wmsefRespository = wmsefRespository; + } + + private async Task GetCountAsync(WmsSharePartOutPutDetialRequestDto input) + { + return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + } + + private async Task GetCountAsync(WmsSharePartOutPutRequestDto input) + { + return await _wmsVersionRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + } + + /// + /// 准时化出库主表 + /// + /// + /// + [HttpPost] + [Route("WmsSharePartList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync( WmsSharePartOutPutRequestDto input) + { + + var entities = await _wmsVersionRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + + + return new PagedResultDto(totalCount, entities); + } + + /// + /// 准时化出库明细 + /// + /// + /// + [HttpPost] + [Route("WmsSharePartDetailList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WmsSharePartOutPutDetialRequestDto input) + { + var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + return new PagedResultDto(totalCount, entities); + } + /// + /// 任务明细标记已确认 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpGet] + [Route("WmsSharePartOutPutAudit")] + [DisableRequestSizeLimit] + + public async Task WmsSharePartAudit(List ids) + { + var _joblist =await _job.Where(p => ids.Contains(p.Id)).ToListAsync(); + foreach (var itm in _joblist) + { + itm.FileName = "已确认"; + } + foreach (var itm in _joblist) + { + await _job.UpdateAsync(itm); + } + var _count=await _job.BatchUpdateAsync(_joblist.ToList()); + if (_count > 0) + { + return true; + } + return false; + } + /// + /// 选择任务,生成出库单,只包含已确认的单据 + /// + /// + /// + /// + [HttpGet] + [Route("WmsSharePartOutPut")] + + + public async Task WmsSharePartOutPut(WmsJitRequestDto input) + { + var _billNum = "B" + DateTime.Now.ToString("yyyyMMddhhmmss"); + + var _joblist = _job.Where(p => input.Guids.Contains(p.Id) && p.FileName == "已确认").ToList(); + if (_joblist.Count() > 0) + { + var fileList = _joblist.Select(p => p.RealDownFileName).ToList(); + List _lst = new List(); + foreach (var filename in fileList) + { + string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename; + ExcelHelper _excelHelper = new ExcelHelper(fileSavePath); + var _list = _excelHelper.ExcelToList(); + foreach (var itm in _list) + { + itm.SetId(GuidGenerator.Create()); + } + _lst.AddRange(_list.ToArray()); + } + var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); + var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version).ToListAsync(); + var query = from itm1 in _ls1 + join itm2 in outPutDetail on + new { itm1.MaterialCode, itm1.OrderBillNum } + equals + new { itm2.MaterialCode, itm2.OrderBillNum } into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm1; + var _wmslst = query.ToList(); + foreach (var itm in _wmslst) + { + itm.BillNum = _billNum; + } + await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); + if (_count == 0) + { + var _version = new WmsSharePartOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); + //var _ls = new List(); + //_ls.Add(_version); + await _wmsVersionRepository.InsertAsync(_version, true); + + } + + foreach (var job in _joblist) + { + job.FileName = _billNum; + await _job.UpdateAsync(job); + } + } + else + { + _billNum = string.Empty; + } + return _billNum; + } + /// + /// 出库界面功能,核准出库功能 + /// + /// + /// + /// + [HttpGet] + [Route("WmsSharePartOutPut-Pass")] + public async Task WmsSharePartOutPutPass(WmsJitRequestDto input) + { + if (input.Guids != null) + { + List _ls = new List(); + if (input.Guids.Count() > 0) + { + _ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2).ToListAsync(); + } + else + { + _ls = await _wmsRepository.Where(p => p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2).ToListAsync(); + } + if (_ls.Count() > 0) + { + var _first = _ls.FirstOrDefault(); + var _guid = GuidGenerator.Create(); + foreach (var itm in _ls) + { + itm.TaskId = _guid; + } + await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls); + var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", input.Version, "WmsSharePartOutPutDetail",_first.BillNum, 0,0 ,_guid) + { + TaskId = _guid, + SourceBillNum = _first.BillNum, + TableName = "WmsSharePartOutPutDetail", + InterfaceType = "3", + Version = input.Version, + SettleAccountState = 0, + WmsState=0 + }; + var _l = new List(); + _l.Add(uniapi); + await _wmsefRespository.GetDbContext().BulkInsertAsync(_l); + } + } + return true; + } + /// + ///出库界面功能, 撤销核准出库 + /// + /// + /// + /// + [HttpGet] + [Route("WmsSharePartOutPut-Cancel")] + public async Task WmsSharePartOutPutCancel(WmsJitRequestDto input) + { + var _ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version == input.Version && p.State == 1).ToListAsync(); + var _first = _ls.FirstOrDefault(); + if (_ls.Count()>0) + { + var _guid = GuidGenerator.Create(); + await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls,new BulkConfig() { BulkCopyTimeout=0 }); + var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", input.Version, "WmsSharePartOutPutDetail", _first.BillNum, 0,0, _guid) + { + TaskId = _guid, + SourceBillNum = _first.BillNum, + TableName = "WmsSharePartOutPutDetail", + InterfaceType = "3", + Version = input.Version, + WmsState = 0, + SettleAccountState=0 + }; + var _l = new List(); + _l.Add(uniapi); + await _wmsefRespository.GetDbContext().BulkInsertAsync(_l); + } + return true; + } + [HttpPost] + [Route("ExcelImport")] + [DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + public async Task ExcelImport([FromForm] IFormFileCollection files, string version) + { + var _billNum = "B" + DateTime.Now.ToString("yyyyMMddhhmmss"); + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); + List _lst = new List(); + var _lsCopy = new List(); + foreach (var itm in result) + { + WmsSharePartOutPutDetial _detail = new WmsSharePartOutPutDetial( + GuidGenerator.Create(), + itm.WmsBillNum, + itm.OrderBillNum, + + itm.MaterialCode, + itm.MaterialDesc, + itm.MaterialGroup, + string.Empty, + string.Empty, + 0, + string.Empty, + string.Empty, + version, + itm.ParentMaterialCode, + itm.BillNum, + GuidGenerator.Create() + , string.Empty + , itm.Qty.Value + ); + _lsCopy.Add(_detail); + } + _lst.AddRange(_lsCopy.ToArray()); + + var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); + var outPutDetail = await _wmsRepository.Where(p => p.Version == version).ToListAsync(); + var query = from itm1 in _ls1 + join itm2 in outPutDetail on + new { itm1.MaterialCode, itm1.OrderBillNum } + equals + new { itm2.MaterialCode, itm2.OrderBillNum } into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm1; + var _wmslst = query.ToList(); + foreach (var itm in _wmslst) + { + itm.BillNum = _billNum; + } + await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum); + if (_count == 0) + { + var _version = new WmsSharePartOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email); + await _wmsVersionRepository.InsertAsync(_version, true); + } + return _billNum; + } + + + } +} \ No newline at end of file diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Jobs/TaskJobService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Jobs/TaskJobService.cs index 0d1dfaa6..f78df279 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Jobs/TaskJobService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Jobs/TaskJobService.cs @@ -237,7 +237,7 @@ namespace Win.Sfs.SettleAccount.Entities.TaskJobs var _serviceName = moudle.FullName; var guid = Guid.NewGuid(); - await _mng.CreateAsync(new TaskJob(guid,version , currentApplicationName, "导出", string.Empty, user.Name, user.Email, string.Empty, string.Empty, str, str, _serviceName,version,remark)); + var _entity= await _mng.CreateAsync(new TaskJob(guid,version , currentApplicationName, "导出", string.Empty, user.Name, user.Email, string.Empty,string.Empty, str, str, _serviceName,version,remark)); var args = new ExportTaskArgs() { Id=guid, diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index 88b3190e..f4e4d811 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -115,7 +115,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber }); customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup }); customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(sapCode) ? string.Empty : sapCode }); - var _taskid = await _service.ExportEnqueueAsync("大众准时化结算门板价格差异比对报表", ExportExtentsion.Excel,version,string.Empty, CurrentUser, typeof(SettleDoorPanelExportService), customConditionList, (rs) => + var _taskid = await _service.ExportEnqueueAsync("准时化结算门板价格差异比对报表", ExportExtentsion.Excel,version, string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup, CurrentUser, typeof(SettleDoorPanelExportService), customConditionList, (rs) => { }); return _taskid; @@ -216,29 +216,29 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices /// /// /// - [HttpGet] - [Route("UnSettledDiff-Make")] - [DisableRequestSizeLimit] + //[HttpGet] + //[Route("UnSettledDiff-Make")] + //[DisableRequestSizeLimit] - public async Task UnSettledMake(string year, string period, string version, string customerCode, string factory, string matialCode, string state,DateTime begin,DateTime end) - { - - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "Factory", Value = factory ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "未结算对比" }); - customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); + //public async Task UnSettledMake(string year, string period, string version, string customerCode, string factory, string matialCode, string state,DateTime begin,DateTime end) + //{ - var _taskid = await _service.ExportEnqueueAsync("未结算对比", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(UnSettledExportService), customConditionList, (rs) => - { - }); - return _taskid; - } + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "Factory", Value = factory ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "未结算对比" }); + // customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); + + // var _taskid = await _service.ExportEnqueueAsync("未结算对比", ExportExtentsion.Excel,version, string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup, CurrentUser, typeof(UnSettledExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} /// @@ -254,26 +254,26 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices /// /// /// - [HttpGet] - [Route("FisUnSettledDiff-Make")] - [DisableRequestSizeLimit] + //[HttpGet] + //[Route("FisUnSettledDiff-Make")] + //[DisableRequestSizeLimit] - public async Task FisUnSettledMake(string year, string version, string customerCode, string factory, string state) - { + //public async Task FisUnSettledMake(string year, string version, string customerCode, string factory, string state) + //{ - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "Factory", Value = factory ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "ERP总成开票报表" }); - customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() }); + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "Factory", Value = factory ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "ERP总成开票报表" }); + // customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() }); - var _taskid = await _service.ExportEnqueueAsync("ERP总成开票报表", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(fisUnsettledDiffReport), customConditionList, (rs) => - { - }); - return _taskid; - } + // var _taskid = await _service.ExportEnqueueAsync("ERP总成开票报表", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(fisUnsettledDiffReport), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} /// /// 价差量差分析报表 @@ -284,37 +284,37 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices /// /// /// - [HttpGet] - [Route("PriceQtyDiff-Make")] - [DisableRequestSizeLimit] + //[HttpGet] + //[Route("PriceQtyDiff-Make")] + //[DisableRequestSizeLimit] - public async Task PriceQtyDiffMake(string year, string version, string customerCode, string factory, string state) - { - //if (!_invoiceVersionRepository.Any(p => p.Version == version)) - //{ - // throw new BusinessException("8989", string.Format("不存发票{0}期间", version)); - //} - //if (!_settleAccountVersionrepository.Any(p => p.Version == version)) - //{ - // throw new BusinessException("8989", string.Format("不存结算{0}期间", version)); - //} - //if (!_itemInvoicePriceVersionrepository.Any(p => p.Version == version)) - //{ - // throw new BusinessException("8989", string.Format("不存QAD价格导入{0}期间", version)); - //} - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "Factory", Value = factory ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "价差量差分析报表" }); - customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() }); + //public async Task PriceQtyDiffMake(string year, string version, string customerCode, string factory, string state) + //{ + // //if (!_invoiceVersionRepository.Any(p => p.Version == version)) + // //{ + // // throw new BusinessException("8989", string.Format("不存发票{0}期间", version)); + // //} + // //if (!_settleAccountVersionrepository.Any(p => p.Version == version)) + // //{ + // // throw new BusinessException("8989", string.Format("不存结算{0}期间", version)); + // //} + // //if (!_itemInvoicePriceVersionrepository.Any(p => p.Version == version)) + // //{ + // // throw new BusinessException("8989", string.Format("不存QAD价格导入{0}期间", version)); + // //} + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "Factory", Value = factory ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "价差量差分析报表" }); + // customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() }); - var _taskid = await _service.ExportEnqueueAsync("价差量差分析报表", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(PriceQtyDifferenceExportService), customConditionList, (rs) => - { - }); - return _taskid; - } + // var _taskid = await _service.ExportEnqueueAsync("价差量差分析报表", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(PriceQtyDifferenceExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} /// @@ -342,7 +342,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = sapCode ?? string.Empty }); customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与开票数据对比" }); customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() }); - var _taskid = await _service.ExportEnqueueAsync("大众发票与结算核对汇总表", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(InvoiceSettledDiffExportService), customConditionList, (rs) => + var _taskid = await _service.ExportEnqueueAsync("发票与结算核对汇总表", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(InvoiceSettledDiffExportService), customConditionList, (rs) => { }); @@ -350,7 +350,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices } /// - /// 2.大众发票与结算核对明细表 + ///发票与结算核对明细表 /// /// 上传的文件(前端已经限制只能上传一个附件) /// @@ -377,6 +377,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices // str1 = string.Join(',', materialGroup.ToArray()); //} + List customConditionList = new List(); customConditionList.Add(new CustomCondition() { Name = "Version", Value =string.IsNullOrEmpty(version) ?string.Empty:version }); customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(materialCode) ?string.Empty: materialCode }); @@ -388,14 +389,14 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber }); customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup }); customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(sapCode) ? string.Empty : sapCode }); - var _taskid = await _service.ExportEnqueueAsync("大众发票与结算核对明细表", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(InvoiceSettledDetailDiffExportService), customConditionList, (rs) => + var _taskid = await _service.ExportEnqueueAsync("准时化结算核对明细", ExportExtentsion.Excel,version, string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup, CurrentUser, typeof(InvoiceSettledDetailDiffExportService), customConditionList, (rs) => { }); return _taskid; } /// - ///3.大众准时化结算数量差异比对表 + ///3.准时化结算数量差异比对表 /// /// 上传的文件(前端已经限制只能上传一个附件) /// @@ -428,7 +429,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices customConditionList.Add(new CustomCondition() { Name = "Mater", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber }); customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup }); customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(sapCode) ? string.Empty : sapCode }); - var _taskid = await _service.ExportEnqueueAsync("大众准时化结算数量差异比对表", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(UnInvoiceSettledDetailDiffExportService), customConditionList, (rs) => + var _taskid = await _service.ExportEnqueueAsync("准时化结算数量差异比对输出", ExportExtentsion.Excel,version, string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup, CurrentUser, typeof(UnInvoiceSettledDetailDiffExportService), customConditionList, (rs) => { }); return _taskid; @@ -439,7 +440,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices /// - /// 7.大众准时化未结明细表(包含漏结,漏结要有标识) + /// 准时化未结明细表(包含漏结,漏结要有标识) /// /// 上传的文件(前端已经限制只能上传一个附件) /// @@ -469,7 +470,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(kenncode) ? string.Empty : kenncode }); customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber }); customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(sapCode) ? string.Empty : sapCode }); - var _taskid = await _service.ExportEnqueueAsync("大众准时化未结明细表", ExportExtentsion.Excel,version,string.Empty ,CurrentUser, typeof(UnsettledDetailReportService), customConditionList, (rs) => + var _taskid = await _service.ExportEnqueueAsync("准时化未结明细表", ExportExtentsion.Excel,version, string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup, CurrentUser, typeof(UnsettledDetailReportService), customConditionList, (rs) => { }); return _taskid; @@ -477,7 +478,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices /// - ///6.大众准时化未结差异比对表 + ///准时化未结差异比对表 /// /// 上传的文件(前端已经限制只能上传一个附件) /// @@ -505,43 +506,43 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber }); customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup }); customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(sapCode) ? string.Empty : sapCode }); - var _taskid = await _service.ExportEnqueueAsync("大众准时化未结差异比对表", ExportExtentsion.Excel,version,string.Empty, CurrentUser, typeof(UnSettleDiffExportService), customConditionList, (rs) => + var _taskid = await _service.ExportEnqueueAsync("准时化未结差异比对输出", ExportExtentsion.Excel,version, string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup, CurrentUser, typeof(UnSettleDiffExportService), customConditionList, (rs) => { }); return _taskid; } - /// - /// 结算总成和ERP总成价格对比 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpGet] - [Route("SettledPartAndErpPartPriceDiff-Make")] - [DisableRequestSizeLimit] + ///// + ///// 结算总成和ERP总成价格对比 + ///// + ///// 上传的文件(前端已经限制只能上传一个附件) + ///// + //[HttpGet] + //[Route("SettledPartAndErpPartPriceDiff-Make")] + //[DisableRequestSizeLimit] - public async Task SettledPartAndErpPartPriceDiffMake( string version, string customerCode) - { + //public async Task SettledPartAndErpPartPriceDiffMake( string version, string customerCode) + //{ - if (!_relationshipRepository.Any(p => p.Version == version && p.CustomerCode == customerCode)) - { - throw new BusinessException("8989", string.Format("不存总成与结算件零件关系{0}期间", version)); - } - if (!_settlementPartVersionrepository.Any(p => p.Version == version && p.CustomerCode == customerCode)) - { - throw new BusinessException("8989", string.Format("不存结算包价格{0}期间", version)); - } + // if (!_relationshipRepository.Any(p => p.Version == version && p.CustomerCode == customerCode)) + // { + // throw new BusinessException("8989", string.Format("不存总成与结算件零件关系{0}期间", version)); + // } + // if (!_settlementPartVersionrepository.Any(p => p.Version == version && p.CustomerCode == customerCode)) + // { + // throw new BusinessException("8989", string.Format("不存结算包价格{0}期间", version)); + // } - List customConditionList = new List(); + // List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算总成和ERP总成价格对比" }); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version??string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode }); - var _taskid = await _service.ExportEnqueueAsync("结算总成和ERP总成价格对比", ExportExtentsion.Excel,version,string.Empty,CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) => - { - }); - return _taskid; - } + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算总成和ERP总成价格对比" }); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version??string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode }); + // var _taskid = await _service.ExportEnqueueAsync("结算总成和ERP总成价格对比", ExportExtentsion.Excel,version,string.Empty,CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} ///// diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index e1d39fe5..b5c833e8 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -1587,26 +1587,193 @@ 请求条件 实体DTO列表 - + - 大众准时化结算明细导入-R3已结 + wms出库 - + - 构建方法 + - 构建UID - 仓储接口 - 缓存 + + + + + - + - 选择结算明细任务列表,选择相关任务合拼导期间出库表 + 准时化出库主表 + + + + + + + 准时化出库明细 + + + + + + + 任务明细标记已确认 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 任务明细标记已确认 上传的文件(前端已经限制只能上传一个附件) + + + 选择任务,生成出库单,只包含已确认的单据 + + + + + + + + 出库界面功能,核准出库功能 + + + + + + + + 出库界面功能, 撤销核准出库 + + + + + + + + wms出库 + + + + + + + + + + + + + + + 准时化出库主表 + + + + + + + 准时化出库明细 + + + + + + + 任务明细标记已确认 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 选择任务,生成出库单,只包含已确认的单据 + + + + + + + + 出库界面功能,核准出库功能 + + + + + + + + 出库界面功能, 撤销核准出库 + + + + + + + + wms出库 + + + + + + + + + + + + + + + 准时化出库主表 + + + + + + + 准时化出库明细 + + + + + + + 任务明细标记已确认 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 选择任务,生成出库单,只包含已确认的单据 + + + + + + + + 出库界面功能,核准出库功能 + + + + + + + + 出库界面功能, 撤销核准出库 + + + + + 结算包与散件对应关系服务 @@ -2714,47 +2881,6 @@ - - - 未结算对比 - - - - - - - - - - - - - - - ERP总成开票报表功能 - - - - - - - - - - - - - - - 价差量差分析报表 - - - - - - - - 1.大众发票与结算核对汇总表 @@ -2763,40 +2889,33 @@ - - 2.大众发票与结算核对明细表 - - 上传的文件(前端已经限制只能上传一个附件) - + + 发票与结算核对明细表 + + 上传的文件(前端已经限制只能上传一个附件) + - 3.大众准时化结算数量差异比对表 + 3.准时化结算数量差异比对表 上传的文件(前端已经限制只能上传一个附件) - 7.大众准时化未结明细表(包含漏结,漏结要有标识) + 准时化未结明细表(包含漏结,漏结要有标识) 上传的文件(前端已经限制只能上传一个附件) - 6.大众准时化未结差异比对表 + 准时化未结差异比对表 上传的文件(前端已经限制只能上传一个附件) - - - 结算总成和ERP总成价格对比 - - 上传的文件(前端已经限制只能上传一个附件) - - 红旗H平台导入 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TEA_TASK_SUB.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TEA_TASK_SUB.cs new file mode 100644 index 00000000..d1483a15 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TEA_TASK_SUB.cs @@ -0,0 +1,78 @@ +using System; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +using System.Collections.Generic; + +namespace CK.SCP.Models.ExchangeCenterTables +{ + /// + /// ı + /// + [Description("ı")] + public class TEA_TASK_SUB + { + [Description("״̬")] + public int TaskState { get; set; } + + + [Description("")] + public Guid TaskID { get; set; } + + [Description("")] + [StringLength(50)] + public string TableName { get; set; } + + [Description("")] + [StringLength(50)] + public string Creator { get; set; } + + [Description("")] + public int DataCount { get; set; } + + + [Description("")] + [StringLength(50)] + public string Subscriber { get; set; } + + [Description("ʧ")] + public int FailedCount { get; set; } + + [Description("ʧϢ")] + [StringLength(50)] + public string FailedInfo { get; set; } + + [Description("")] + [StringLength(50)] + public string Domain { get; set; } + + [Description("ص")] + [StringLength(50)] + public string Site { get; set; } + + [Key] + public Guid GUID { get; set; } = Guid.NewGuid(); + + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int UID { get; set; } + + [Description("")] + [StringLength(50)] + public string CreateUser { get; set; } + + [Description("ʱ")] + public DateTime CreateTime { get; set; } + + [Description("ע")] + public string Remark { get; set; } + + [Description("޸")] + [StringLength(50)] + public string UpdateUser { get; set; } + + [Description("޸ʱ")] + public DateTime? UpdateTime { get; set; } + + } +} \ No newline at end of file diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TaskJob.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TaskJob.cs index 18a94eca..9c070862 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TaskJob.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TaskJob.cs @@ -40,9 +40,12 @@ namespace Win.Sfs.SettleAccount.Entities { DownFileName = downfileName; } - - - + public void SetRemark(string remark) + { + Remark = remark; + } + + public string Type { set; get; } public string State { set; get; } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs index 584f63f9..b7075954 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs @@ -90,7 +90,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS { } - public WmsJitOutPutDetial(Guid id, string wmsBillNum, string kennCode, string chassisNumber, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode,string billNum,Guid taskId) + + + public WmsJitOutPutDetial(Guid id, string wmsBillNum, string kennCode, string chassisNumber, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode,string billNum,Guid taskId,string remark,decimal qty):base(id) { Id = id; WmsBillNum = wmsBillNum; @@ -108,6 +110,156 @@ namespace Win.Sfs.SettleAccount.Entities.WMS ParentMaterialCode = parentMaterialCode; BillNum = billNum; TaskId = taskId; + Remark = remark; + Qty = qty; + + } + + + + public void SetData(Guid guid,string output,string input,string extend1,string extend2,string version,Guid taskid) + { + Id = guid; + OutPut = output; + InPut = input; + Extend1 = extend1; + Extend2 = extend2; + Version = version; + TaskId=taskid; + } + + + [ImporterHeader(Name = "出库库位", IsIgnore = true)] + //出库库位 + public string OutPut { set; get; } + [ImporterHeader(Name = "入库库位", IsIgnore = true)] + //入库库位 + public string InPut { set; get; } + [ImporterHeader(Name = "状态")] + public int State { get; set; } + [ImporterHeader(Name = "扩展字段1", IsIgnore = true)] + /// + /// 扩展字段1 + /// + public string Extend1 { set; get; } + /// + /// 扩展字段2 + /// + [ImporterHeader(Name = "扩展字段2", IsIgnore = true)] + public string Extend2 { set; get; } + /// + /// 扩展字段3 + /// + [ImporterHeader(Name = "版本号", IsIgnore = true)] + public string Version { set; get; } + + + [ImporterHeader(Name = "单号",IsIgnore =true)] + public string BillNum { set; get; } + + [ImporterHeader(Name = "任务号", IsIgnore = true)] + public Guid TaskId { set; get; } + + + [ImporterHeader(Name = "交货单号", AutoTrim = true)] + public string WmsBillNum { set; get; } + + [ImporterHeader(Name = "KENN号")] + //KENN号 + public string KennCode { set; get; } + [ImporterHeader(Name = "底盘号", AutoTrim = true)] + //底盘号 + public string ChassisNumber { set; get; } + [ImporterHeader(Name = "物料号", AutoTrim = true)] + //物料号 + public string MaterialCode { set; get; } + + [ImporterHeader(Name = "组件组物料",AutoTrim =true)] + //物料号 + public string ParentMaterialCode { set; get; } + + [ImporterHeader(Name = "物料描述", AutoTrim = true)] + //物料描述 + public string MaterialDesc { set; get; } + + [ImporterHeader(Name = "物料组(车型)", AutoTrim = true)] + //物料组(车型) + public string MaterialGroup { set; get; } + + [ImporterHeader(Name = "结算数量")] + public decimal Qty { set; get; } + + + + + + + } + + + + + + + + + public class WmsKanbanOutPut : FullAuditedAggregateRootBase + { + public WmsKanbanOutPut() + { + } + + public WmsKanbanOutPut(Guid id, string version, string billNum, string creator) : base(id) + { + Id = id; + Version = version; + BillNum = billNum; + Creator = creator; + } + + public string Version { set; get; } + + public string BillNum { set; get; } + + public string Creator { set; get; } + + + + } + + + /// + /// + /// + public class WmsKanbanOutPutDetial : FullAuditedAggregateRootBase + { + public WmsKanbanOutPutDetial() + { + } + + public WmsKanbanOutPutDetial(Guid id, string wmsBillNum, string kanban, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId,string remark,decimal qty) + { + Id = id; + WmsBillNum = wmsBillNum; + Kanban = kanban; + MaterialCode = materialCode; + MaterialDesc = materialDesc; + MaterialGroup = materialGroup; + OutPut = outPut; + InPut = inPut; + State = state; + Extend1 = extend1; + Extend2 = extend2; + Version = extend3; + ParentMaterialCode = parentMaterialCode; + BillNum = billNum; + TaskId = taskId; + Remark = remark; + Qty = qty; + } + public void SetId(Guid id) + { + Id = id; } @@ -120,12 +272,133 @@ namespace Win.Sfs.SettleAccount.Entities.WMS public string ParentMaterialCode { set; get; } [ImporterHeader(Name = "交货单号")] public string WmsBillNum { set; get; } - [ImporterHeader(Name = "KENN号")] + [ImporterHeader(Name = "看板号")] //KENN号 - public string KennCode { set; get; } - [ImporterHeader(Name = "底盘号")] - //底盘号 - public string ChassisNumber { set; get; } + public string Kanban { set; get; } + + [ImporterHeader(Name = "物料号")] + //物料号 + public string MaterialCode { set; get; } + [ImporterHeader(Name = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + [ImporterHeader(Name = "物料组(车型)")] + //物料组(车型) + public string MaterialGroup { set; get; } + [ImporterHeader(Name = "出库库位")] + //出库库位 + public string OutPut { set; get; } + [ImporterHeader(Name = "入库库位")] + //入库库位 + public string InPut { set; get; } + [ImporterHeader(Name = "状态")] + public int State { get; set; } + [ImporterHeader(Name = "扩展字段1")] + /// + /// 扩展字段1 + /// + public string Extend1 { set; get; } + /// + /// 扩展字段2 + /// + [ImporterHeader(Name = "扩展字段2")] + public string Extend2 { set; get; } + /// + /// 扩展字段3 + /// + [ImporterHeader(Name = "版本号")] + public string Version { set; get; } + [ImporterHeader(Name = "数量")] + public decimal? Qty { set; get; } + + [ImporterHeader(Name = "数量", IsIgnore = true)] + public string BillNum { set; get; } + + + public Guid TaskId { set; get; } + + + } + + + + + + + public class WmsSharePartOutPut : FullAuditedAggregateRootBase + { + public WmsSharePartOutPut() + { + } + + public WmsSharePartOutPut(Guid id, string version, string billNum, string creator) : base(id) + { + Id = id; + Version = version; + BillNum = billNum; + Creator = creator; + } + + public string Version { set; get; } + + public string BillNum { set; get; } + + public string Creator { set; get; } + + + + } + + + /// + /// + /// + public class WmsSharePartOutPutDetial : FullAuditedAggregateRootBase + { + public WmsSharePartOutPutDetial() + { + } + + public WmsSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId,string remark,decimal qty ) + { + Id = id; + WmsBillNum = wmsBillNum; + OrderBillNum = orderBillNum; + MaterialCode = materialCode; + MaterialDesc = materialDesc; + MaterialGroup = materialGroup; + OutPut = outPut; + InPut = inPut; + State = state; + Extend1 = extend1; + Extend2 = extend2; + Version = extend3; + ParentMaterialCode = parentMaterialCode; + BillNum = billNum; + TaskId = taskId; + Remark = remark; + Qty = qty; + } + + + public void SetId(Guid id) + { + Id = id; + } + + // 交货单号 实际发货日期 KENN号 底盘号 物料号 物料描述 客户物料 组件组物料 组件组物料描述 物料组(车型) 定价 金额 结算平台未结数量 大众R3未结数量 差异金额 差异数量 漏结标识 漏结期间 说明 + + + //交货单号 + + [ImporterHeader(Name = "组件组物料")] + public string ParentMaterialCode { set; get; } + [ImporterHeader(Name = "交货单号")] + public string WmsBillNum { set; get; } + [ImporterHeader(Name = "看板号")] + //KENN号 + public string OrderBillNum { set; get; } + [ImporterHeader(Name = "物料号")] //物料号 public string MaterialCode { set; get; } @@ -159,9 +432,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS [ImporterHeader(Name = "版本号")] public string Version { set; get; } [ImporterHeader(Name = "数量")] - public string Qty { set; get; } + public decimal? Qty { set; get; } - [ImporterHeader(Name = "数量",IsIgnore =true)] + [ImporterHeader(Name = "数量", IsIgnore = true)] public string BillNum { set; get; } @@ -172,4 +445,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS + + + + + + + + + } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs index 4ccd9fa6..08229577 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs @@ -317,7 +317,14 @@ namespace Win.Sfs.SettleAccount //一汽轿车 builder.ConfigureBTCar(options); builder.ConfigureBTCarVersion(options); - + builder.ConfigureWmsJitOutPutDetail(options); + builder.ConfigureWmsJitOutPutVersion(options); + builder.ConfigureWmsJitOutPutDetail(options); + builder.ConfigureWmsJitOutPutVersion(options); + builder.ConfigureWmsKanbanOutPutVersion(options); + builder.ConfigureWmsKanbanOutPutDetail(options); + builder.ConfigureWmsSharePartOutPutDetail(options); + builder.ConfigureWmsSharePartOutPutVersion(options); #endregion } @@ -920,6 +927,119 @@ namespace Win.Sfs.SettleAccount } + private static void ConfigureWmsJitOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + b.ToTable($"{options.TablePrefix}_WmsJitOutPut", options.Schema); + b.ConfigureByConvention(); + b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + + b.HasIndex(x => new { x.BillNum }); + }); + + } + private static void ConfigureWmsJitOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + b.ToTable($"{options.TablePrefix}_WmsJitOutPutDetial", options.Schema); + b.ConfigureByConvention(); + b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.OutPut).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.InPut).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.KennCode).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.ChassisNumber).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.ParentMaterialCode).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Extend1).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Extend2).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.MaterialCode).HasMaxLength(CommonConsts.MaxCodeLength); + b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter); + }); + + } + + private static void ConfigureWmsKanbanOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + b.ToTable($"{options.TablePrefix}_WmsKanbanOutPut", options.Schema); + b.ConfigureByConvention(); + b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + + b.HasIndex(x => new { x.BillNum }); + }); + + } + private static void ConfigureWmsKanbanOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetial", options.Schema); + b.ConfigureByConvention(); + b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.OutPut).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.InPut).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Kanban).HasMaxLength(CommonConsts.MaxCodeLength); + + b.Property(x => x.ParentMaterialCode).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Extend1).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Extend2).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.MaterialCode).HasMaxLength(CommonConsts.MaxCodeLength); + b.HasIndex(x => new { x.BillNum}); + }); + + } + + private static void ConfigureWmsSharePartOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + b.ToTable($"{options.TablePrefix}_WmsSharePartOutPut", options.Schema); + b.ConfigureByConvention(); + b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + + b.HasIndex(x => new { x.BillNum }); + }); + + } + private static void ConfigureWmsSharePartOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + b.ToTable($"{options.TablePrefix}_WmsSharePartOutPutDetial", options.Schema); + b.ConfigureByConvention(); + b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.OutPut).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.InPut).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.OrderBillNum).HasMaxLength(CommonConsts.MaxCodeLength); + + b.Property(x => x.ParentMaterialCode).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Extend1).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Extend2).HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.MaterialCode).HasMaxLength(CommonConsts.MaxCodeLength); + b.HasIndex(x => new { x.BillNum }); + }); + + } + + + #endregion diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs index 4f81d637..2c7e1036 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs @@ -44,27 +44,27 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report // DiffPrice = diffPrice; //} - [ExporterHeader(DisplayName = "交货单号 ")] + [ExporterHeader(DisplayName = "交货单号")] public override string WmsBillNum { set; get; } - [ExporterHeader(DisplayName = "实际发货日期 ")] + [ExporterHeader(DisplayName = "实际发货日期")] public override DateTime CP5Time { set; get; } [ExporterHeader(DisplayName = "KENN号")] public override string KENNCode { set; get; } [ExporterHeader(DisplayName = "底盘号")] public override string ChassisNumber { set; get; } - [ExporterHeader(DisplayName = "交货状态 ")] + [ExporterHeader(DisplayName = "交货状态")] public override string WmsState { set; get; } [ExporterHeader(DisplayName = "物料号")] public override string SapMaterialCode { set; get; } - [ExporterHeader(DisplayName = "物料描述 ")] + [ExporterHeader(DisplayName = "物料描述")] public override string MaterialDesc { set; get; } - [ExporterHeader(DisplayName = "客户物料 ")] + [ExporterHeader(DisplayName = "客户物料")] public override string MaterialCode { set; get; } - [ExporterHeader(DisplayName = "组件组物料 ")] + [ExporterHeader(DisplayName = "组件组物料")] public override string ParentSapMaterialCode { set; get; } - [ExporterHeader(DisplayName = "组件组物料描述 ")] + [ExporterHeader(DisplayName = "组件组物料描述")] public override string ParentMaterialDesc { set; get; } - [ExporterHeader(DisplayName = "物料组(车型) ")] + [ExporterHeader(DisplayName = "物料组(车型)")] public override string MaterialGroup { set; get; } [ExporterHeader(DisplayName = "定价")] public override decimal Price { set; get; } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs index c66e8ae0..cea2a3cd 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs @@ -83,6 +83,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ItemCode MaterialCode,\n" + " ChassisNumber,\n" + " OrderBillNum KENNCode,\n" + +" ChassisNumber2,\n"+ +" KENNCode KENNCode2, \n"+ + + " QTY,\n" + " ErpMaterialCode ParentSapMaterialCode,\n" + " '' FLAG \n" + @@ -99,6 +103,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ItemCode MaterialCode,\n" + " ChassisNumber,\n" + " OrderBillNum KENNCode,\n" + + +" ChassisNumber2,\n" + +" KENNCode KENNCode2, \n" + " QTY,\n" + " ErpMaterialCode ParentSapMaterialCode,\n" + " 'L' FLAG \n" + @@ -109,7 +116,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " AND STATE = 4 {0}\n" + " ) A\n" + " left join (select * from Set_Unsettle where version='{1}') f \n" + -" on a.MaterialCode=f.MaterialCode and a.KENNCode=f.KENNCode and a.ChassisNumber=f.ChassisNumber \n"+ +" on a.MaterialCode=f.MaterialCode and a.KENNCode2=f.KENNCode and a.ChassisNumber2=f.ChassisNumber \n"+ " LEFT JOIN Set_material B ON a.MaterialCode = b.CustomerPartCode \n" + " LEFT JOIN Set_material d ON a.ParentSapMaterialCode = d.MaterialCode \n" + " ) temp1\n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs index d6da20b0..17a95d5a 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs @@ -122,7 +122,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccount } - BulkConfig cfg = new BulkConfig() { BulkCopyTimeout=0, BatchSize=10000,}; + BulkConfig cfg = new BulkConfig() { BulkCopyTimeout=0, BatchSize=10000, UseTempDB=true}; DbContext.BulkInsert(_insertls,cfg); } catch (Exception e) diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Tasks/TaskDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Tasks/TaskDapperRepository.cs index 375a6f4f..d2e0764a 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Tasks/TaskDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Tasks/TaskDapperRepository.cs @@ -23,7 +23,7 @@ namespace Win.Sfs.SettleAccount.Repository public virtual async Task> GetTaskJobsAsync(Job p_task) { string str = string.Empty; - str += "SELECT b.Id, a.StateId,b.Type, a.StateName, a.InvocationData, a.Arguments, a.CreatedAt, a.ExpireAt, b.TaskId, b.Name, \n"; + str += "SELECT b.Id, a.StateId,b.Type, a.StateName, a.InvocationData, a.Arguments, a.CreatedAt, a.ExpireAt, b.TaskId, b.Name,isnull(b.remark,'') remark, \n"; str += " b.ActionName, b.Error, b.Creator, b.Email, b.FileName, b.DownFileName, b.ServiceName,b.RealDownFileName,b.RealFileName \n"; str += " FROM HangFire.Job AS a INNER JOIN \n"; str += " Set_TaskJob AS b ON a.Id = b.TaskId \n"; diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/UnSettleAccount/UnSettleAccountRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/UnSettleAccount/UnSettleAccountRepository.cs index 7370f668..2185dfd7 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/UnSettleAccount/UnSettleAccountRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/UnSettleAccount/UnSettleAccountRepository.cs @@ -57,7 +57,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccount _insertls.Add(s); } } - DbContext.BulkInsert(_insertls); + DbContext.BulkInsert(_insertls,new BulkConfig() { BatchSize=100000, BulkCopyTimeout=0 }); } catch (Exception e) { diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDiffExportService.cs index ed5de12b..1703a0ea 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDiffExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDiffExportService.cs @@ -96,6 +96,7 @@ namespace SettleAccount.Job.Services }); } + _lsExport=_lsExport.OrderBy(p => p.SapMaterialGroup).ToList(); _outputService.Export(id,_first, _lsExport);