diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs index 94972e5e..50228999 100644 --- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs +++ b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs @@ -437,7 +437,6 @@ namespace Win.Sfs.SettleAccount { app.UseMultiTenancy(); } - app.UseAbpRequestLocalization(); app.UseSwagger(); app.UseSwaggerUI(options => @@ -446,7 +445,7 @@ namespace Win.Sfs.SettleAccount options.DocExpansion(DocExpansion.None); //->修改界面打开时自动折叠 }); - new BackgroundJobServerOptions() { WorkerCount = 4, ServerTimeout=TimeSpan.FromSeconds(1200) }; + new BackgroundJobServerOptions() { WorkerCount = 12, ServerTimeout=TimeSpan.FromSeconds(1200) }; app.UseHangfireServer(); app.UseHangfireDashboard(); app.UseAuditing(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs index 9694bd5c..1f03d68c 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs @@ -68,7 +68,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts private readonly ISettleAccountBranchEfCoreRepository _wmsRepository1; private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository1; - + private readonly KanbanUnSettledDapperRepository _dapper; private readonly WMSEfCoreRepository _wmsefRespository; private readonly WMSEfCoreRepository _wmstbRespository; @@ -77,27 +77,30 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts private readonly TaskJobService _service; - /// - /// - /// - /// - /// - /// - /// - /// + private readonly WmsDapperRepository _wmsDapper; + /// + /// + /// + /// + /// + /// + /// + /// public WMSKanbanAppService( IExcelImportAppService excelImportService, - ISettleAccountBranchEfCoreRepository wmsRepository, + ISettleAccountBranchEfCoreRepository wmsRepository, ISettleAccountBranchEfCoreRepository job, ISettleAccountBranchEfCoreRepository wmsVersionRepository, WMSEfCoreRepository wmsefRespository, + KanbanUnSettledDapperRepository dapper, WMSEfCoreRepository wmstbRespository, IDistributedCache cache, ISnowflakeIdGenerator snowflakeIdGenerator, - ICommonManager commonManager + ICommonManager commonManager, + WmsDapperRepository wmsDapper ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) { _job = job; @@ -106,6 +109,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts _wmsVersionRepository = wmsVersionRepository; _wmsefRespository = wmsefRespository; _excelImportService = excelImportService; + _dapper = dapper; + _wmsDapper = wmsDapper; } private async Task GetCountAsync(WmsKanbanOutPutDetialRequestDto input) @@ -179,116 +184,116 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts return true; } - /// - /// 选择任务,生成出库单,只包含已确认的单据 - /// - /// - /// - /// - [HttpPost] - [Route("WmsWithOutKanbanOutPut")] - public async Task WmsWithOutKanbanOutPut(WmsJitRequestDto input) - { - - var _billNum = "KA" + 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) - { - var _entity= new WmsWithOutKanbanOutPutDetial( - GuidGenerator.Create(), - string.Empty, - string.Empty, - itm.MaterialCode, - itm.MaterialDesc, - itm.SapMaterialGroup, - string.Empty, - string.Empty, - 0, - string.Empty, - string.Empty, - input.Version, - itm.SapMaterialCode, - _billNum, - Guid.Empty, - string.Empty, - itm.InvoiceQty - ); - _lst.Add(_entity); - } - } + ///// + ///// 选择任务,生成出库单,只包含已确认的单据 + ///// + ///// + ///// + ///// + //[HttpPost] + //[Route("WmsWithOutKanbanOutPut")] + //public async Task WmsWithOutKanbanOutPut(WmsJitRequestDto input) + //{ + + // var _billNum = "KA" + 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) + // { + // var _entity= new WmsWithOutKanbanOutPutDetial( + // GuidGenerator.Create(), + // string.Empty, + // string.Empty, + // itm.MaterialCode, + // itm.MaterialDesc, + // itm.SapMaterialGroup, + // string.Empty, + // string.Empty, + // 0, + // string.Empty, + // string.Empty, + // input.Version, + // itm.SapMaterialCode, + // _billNum, + // Guid.Empty, + // string.Empty, + // itm.InvoiceQty + // ); + // _lst.Add(_entity); + // } + // } - var outPutDetail = await _wmsRepository1.Where(p => p.Version == input.Version && p.Kanban==string.Empty).ToListAsync(); - - var error = from itm1 in outPutDetail - join itm2 in _lst on - new { itm1.MaterialCode } - equals - new { itm2.MaterialCode } - select itm1; - var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) }); - if (errList.Count() == 0) - { - - var query = from itm1 in _lst - join itm2 in outPutDetail on - new { itm1.MaterialCode} - equals - new { itm2.MaterialCode } into temp1 - from tm1 in temp1.DefaultIfEmpty() - where tm1 == null - select itm1; - var _wmslst = query.ToList(); - foreach (var itm in _lst) - { - itm.BillNum = _billNum; - } - await _wmsRepository1.GetDbContext().BulkInsertAsync(_lst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); - int _count = _wmsVersionRepository1.Count(p => p.Version == input.Version && p.BillNum == _billNum); - if (_count == 0) - { - var _version = new WmsWithOutKanbanOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); - - await _wmsVersionRepository1.InsertAsync(_version, true); - } - - foreach (var job in _joblist) - { - job.FileName = _billNum; - await _job.UpdateAsync(job); - } - } - else - { - StringBuilder _buffer = new StringBuilder(); - foreach (var itm in errList) - { - _buffer.AppendFormat("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number); - } - var _errinfo = _buffer.ToString(); - - foreach (var job in _joblist) - { - job.FileName = _errinfo; - await _job.UpdateAsync(job); - } - } - } - else - { - _billNum = string.Empty; - } - return ApplicationConsts.SuccessStr; ; - } + // var outPutDetail = await _wmsRepository1.Where(p => p.Version == input.Version && p.Kanban==string.Empty).ToListAsync(); + + // var error = from itm1 in outPutDetail + // join itm2 in _lst on + // new { itm1.MaterialCode } + // equals + // new { itm2.MaterialCode } + // select itm1; + // var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) }); + // if (errList.Count() == 0) + // { + + // var query = from itm1 in _lst + // join itm2 in outPutDetail on + // new { itm1.MaterialCode} + // equals + // new { itm2.MaterialCode } into temp1 + // from tm1 in temp1.DefaultIfEmpty() + // where tm1 == null + // select itm1; + // var _wmslst = query.ToList(); + // foreach (var itm in _lst) + // { + // itm.BillNum = _billNum; + // } + // await _wmsRepository1.GetDbContext().BulkInsertAsync(_lst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + // int _count = _wmsVersionRepository1.Count(p => p.Version == input.Version && p.BillNum == _billNum); + // if (_count == 0) + // { + // var _version = new WmsWithOutKanbanOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); + + // await _wmsVersionRepository1.InsertAsync(_version, true); + // } + + // foreach (var job in _joblist) + // { + // job.FileName = _billNum; + // await _job.UpdateAsync(job); + // } + // } + // else + // { + // StringBuilder _buffer = new StringBuilder(); + // foreach (var itm in errList) + // { + // _buffer.AppendFormat("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number); + // } + // var _errinfo = _buffer.ToString(); + + // foreach (var job in _joblist) + // { + // job.FileName = _errinfo; + // await _job.UpdateAsync(job); + // } + // } + // } + // else + // { + // _billNum = string.Empty; + // } + // return ApplicationConsts.SuccessStr; ; + //} /// @@ -489,6 +494,166 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts + + + // 物料 物料组 物料描述 物料号 开始日期 结束日期 单位 出库数量 结算数量 寄售库存数量 + + + + [HttpPost] + [Route("ExcelImportWithOutKanban")] + [DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + public async Task ExcelImportWithOutKanban([FromForm] IFormFileCollection files, string version) + { + var _billNum = "KA" + DateTime.Now.ToString("yyyyMMddhhmmss"); + + + + var _list= _dapper.GetNoKanbanSettleDetail(version); + + + var stockList = _wmsDapper.GetSalesStock(); + var query = from itm in _list + join itm1 in stockList on itm.MaterialCode equals itm1.SapCode + into temp1 + from tm1 in temp1.DefaultIfEmpty() + select new WmsWithOutKanbanOutPutDetial( + GuidGenerator.Create(), + "无看板", + itm.SapMaterialCode, + itm.MaterialDesc, + itm.Version, + string.Empty, + string.Empty, + itm.Qty, + tm1.Qty, + itm.Qty, + string.Empty, + _billNum, + 0, + 0 + ); + + + await _wmsRepository.GetDbContext().BulkInsertAsync(query.ToList(), 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); + } + + + + + + + + + //var _lsCopy = new List(); + //foreach (var itm in query.ToList()) + //{ + + + // WmsWithOutKanbanOutPutDetial _detail = new WmsWithOutKanbanOutPutDetial( + // GuidGenerator.Create(), + // "无看板", + // itm.SapMaterialCode, + // itm.MaterialDesc, + // itm.Version, + // string.Empty, + // string.Empty, + // itm.Qty, + // itm., + // itm.Qty, + // string.Empty, + // _billNum + // ); + // _lsCopy.Add(_detail); + //} + //_lst.AddRange(_lsCopy.ToArray()); + //ExportImporter _exportImporter = new ExportImporter(); + //var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); + //List _lst = new List(); + //var _lsCopy = new List(); + //foreach (var itm in result) + //{ + // WmsWithOutKanbanOutPutDetial _detail = new WmsWithOutKanbanOutPutDetial( + // GuidGenerator.Create(), + // !string.IsNullOrEmpty(itm.Type) ? itm.Type : string.Empty, + // itm.SapMaterialCode, + // itm.MaterialDesc, + // itm.Version, + // itm.IsBack, + // itm.Remark, + // itm.Qty, + // itm.SockQty, + // itm.OutputQty, + // itm.Extend, + // itm.BillNum + // ); + // _lsCopy.Add(_detail); + //} + //_lst.AddRange(_lsCopy.ToArray()); + + + //var outPutDetail = await _wmsRepository1.Where(p => p.Version == version).ToListAsync(); + + + //var error = from itm1 in outPutDetail + // join itm2 in _lst on + // new { itm1.SapMaterialCode } + // equals + // new { itm2.SapMaterialCode } + // select itm1; + //var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) }); + + //var checkList = new List(); + //foreach (var itm in errList) + //{ + // checkList.Add(new ErrorExportDto() { Message = string.Format("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number) }); + //} + //if (checkList.Count > 0) + //{ + + // return await ExportErrorReportAsync(checkList); + //} + + + + //var query = from itm1 in _lst + // join itm2 in outPutDetail on + // new { itm1.SapMaterialCode } + // equals + // new { itm2.SapMaterialCode } 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; + + + + } + + + + + + + [HttpPost] [Route("ExcelImport")] [DisableRequestSizeLimit] diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs new file mode 100644 index 00000000..9fecc9e3 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs @@ -0,0 +1,391 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Caching.Distributed; +using AutoMapper; +using System.Linq; +using System.Text; +using Volo.Abp.Guids; +using Volo.Abp.Application.Services; +using Volo.Abp.Caching; + +using Volo.Abp.ObjectMapping; +using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.Shared.CacheBase; +using Win.Utils; +using Volo.Abp.Application.Dtos; +using Win.Sfs.BaseData.ImportExcelCommon; +using Volo.Abp.Domain.Repositories; +using EFCore.BulkExtensions; +using System.IO; +using Microsoft.EntityFrameworkCore; +using Win.Sfs.SettleAccount.Entities.SettleAccountVersion; +using Win.Sfs.SettleAccount.FISes; +using Win.Sfs.Shared.Enums.SettleAccount; +using Win.Sfs.Shared.Filter; +using Shouldly; +using Magicodes.ExporterAndImporter.Csv; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; +using System.Data.Common; +using Volo.Abp.Uow; +using Volo.Abp; +using Win.Abp.Snowflakes; +using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.ExportReports; +using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.MaterialRelationships; +using Win.Sfs.SettleAccount.Entities.TaskJobs; +using Magicodes.ExporterAndImporter.Core.Models; + +using TaskJob.Services; +using TaskJob.EventArgs; +using Win.Sfs.SettleAccount.Entities.WMS; +using Win.Sfs.SettleAccount.Entities.Wms; +using Win.Sfs.SettleAccount.Repository; +using WY.NewJit.Extends.PaiGe.WMS; +using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; + +namespace Win.Sfs.SettleAccount.Entities.WMS +{ + + [Route("api/settleaccount/wmskanbanoutputextend")] + [AllowAnonymous] + //[Authorize(SettleAccountPermissions.WMSJIT.Default)] + public class WMSKanbanExtendAppService : SettleAccountApplicationBase + { + /// + /// 大众看板-出库 + /// + + + + + //private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; + //private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; + + private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; + private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; + + private readonly KanbanUnSettledDapperRepository _dapper; + private readonly WMSEfCoreRepository _wmsefRespository; + + private readonly WMSEfCoreRepository _wmstbRespository; + private readonly ISettleAccountBranchEfCoreRepository _job; + private readonly IExcelImportAppService _excelImportService; + + + private readonly TaskJobService _service; + private readonly WmsDapperRepository _wmsDapper; + /// + /// + /// + /// + /// + /// + /// + /// + public WMSKanbanExtendAppService( + + + IExcelImportAppService excelImportService, + + ISettleAccountBranchEfCoreRepository wmsRepository, + ISettleAccountBranchEfCoreRepository job, + ISettleAccountBranchEfCoreRepository wmsVersionRepository, + WMSEfCoreRepository wmsefRespository, + KanbanUnSettledDapperRepository dapper, + WMSEfCoreRepository wmstbRespository, + IDistributedCache cache, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager, + WmsDapperRepository wmsDapper + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _job = job; + _wmstbRespository = wmstbRespository; + _wmsRepository = wmsRepository; + _wmsVersionRepository = wmsVersionRepository; + _wmsefRespository = wmsefRespository; + _excelImportService = excelImportService; + _dapper = dapper; + _wmsDapper = wmsDapper; + } + + private async Task GetCountAsync(WmsKanbanOutPutDetialRequestDto 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(WmsKanbanOutPutRequestDto input) + { + return await _wmsVersionRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + } + + /// + /// 准时化出库主表 + /// + /// + /// + [HttpPost] + [Route("WmsKanbanList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WmsKanbanOutPutRequestDto input) + { + + + + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum }); + 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")] + [UnitOfWork(false)] + //[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); + var stockList = _wmsDapper.GetSalesStock(); + var query = from itm in entities + join itm1 in stockList on itm.SapMaterialCode equals itm1.SapCode + into temp1 + from tm1 in temp1.DefaultIfEmpty() + select new WmsWithOutKanbanOutPutDetial( + GuidGenerator.Create(), + "无看板发货", + itm.SapMaterialCode, + itm.MaterialDesc, + itm.Version, + string.Empty, + string.Empty, + itm.Qty, + tm1==null?0: tm1.Qty, + itm.OutputQty, + string.Empty, + itm.BillNum, + itm.State, + itm.RealityNumber + ); + + return new PagedResultDto(totalCount, entities); + } + + + + + /// + /// 任务明细标记已确认 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("WmsSharePartOutPutModify")] + [DisableRequestSizeLimit] + + public async Task WmsSharePartUpdate(WmsWithOutKanbanOutPutDetial detial) + { + var _entityList = _wmsRepository.Where(p => p.Id == detial.BranchId).ToList(); + if (_entityList.Count() > 0) + { + foreach (var itm in _entityList) + { + itm.OutputQty = detial.OutputQty; + await _wmsRepository.UpdateAsync(itm); + } + } + return true; + + } + + /// + /// 选择任务,生成出库单,只包含已确认的单据 + /// + /// + /// + /// + [HttpPost] + [Route("WmsKanbanOutPutExtend")] + [UnitOfWork(false)] + public async Task WmsKanbanOutPut(WmsJitRequestDto input) + { + var _billNum = "KA" + DateTime.Now.ToString("yyyyMMddhhmmss"); + var _list = _dapper.GetNoKanbanSettleDetail(input.Version); + var stockList = _wmsDapper.GetSalesStock(); + var query = from itm in _list + join itm1 in stockList on itm.SapMaterialCode equals itm1.SapCode + into temp1 + from tm1 in temp1.DefaultIfEmpty() + select new WmsWithOutKanbanOutPutDetial( + GuidGenerator.Create(), + "无看板发货", + itm.SapMaterialCode, + itm.MaterialDesc, + itm.Version, + string.Empty, + string.Empty, + itm.InvoiceQty, + tm1==null?0:tm1.Qty, + itm.InvoiceQty, + string.Empty, + _billNum, + 0, + 0 + ); + + + + + + await _wmsRepository.GetDbContext().BulkInsertAsync(query.ToList(), new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); + if (_count == 0) + { + var _version = new WmsWithOutKanbanOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); + await _wmsVersionRepository.InsertAsync(_version, true); + } + return ApplicationConsts.SuccessStr; ; + } + /// + /// 出库界面功能,核准出库功能 + /// + /// + /// + /// + [HttpPost] + [Route("WmsKanbanOutPut-Pass")] + [UnitOfWork(false)] + 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(); + } + _ls = _ls.Where(p => p.SockQty >= p.OutputQty).ToList(); + if (_ls.Count() > 0) + { + var sql = "DECLARE @return_value int\n" + + "EXEC @return_value = [dbo].[p_wms_output]\n" + + " @billnum = N'{0}',\n" + + " @type = 11,\n" + + " @date = N'{1}'\n" + + "SELECT 'Return Value' = @return_value"; + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + string.Format(sql, input.BillNum, input.AccountDate.ToShortDateString())); + + } + } + return true; + } + /// + ///出库界面功能, 撤销核准出库 + /// + /// + /// + /// + [HttpPost] + [Route("WmsKanbanOutPut-Cancel")] + public async Task WmsKanbanOutPutCancel(WmsJitRequestDto input) + { + if (input.Guids != null && input.Guids.Count() > 0) + { + List _ls = new List(); + foreach (var itm in input.Guids) + { + _ls.Add(string.Format("{0}", itm)); + } + + string str = string.Join(",", _ls.ToArray()); + + var sql = "DECLARE @return_value int\n" + + "EXEC @return_value = [dbo].[p_wms_output_cancel]\n" + + " @Guids ='{0}', \n" + + " @billnum = N'{1}',\n" + + " @type = 11,\n" + + " @accountdate = N'{2}'\n" + + "SELECT 'Return Value' = @return_value"; + + sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString()); + + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + sql + ); + + } + return true; + } + /// + /// 出库界面功能删除 + /// + /// + /// + /// + [HttpPost] + [Route("WmsOutPutDelete")] + [UnitOfWork(false)] + public async Task WmsOutPutDelete(WmsJitRequestDto input) + { + var count = _wmsRepository.Count(p => p.BillNum == input.BillNum && p.State != 0); + + if (count > 0) + { + return false; + } + var sql = "DECLARE @return_value int\n" + + "EXEC @return_value = [dbo].[p_wms_output_cancel_all]\n" + + " @billnum = N'{0}',\n" + + " @type = 11\n" + + "SELECT 'Return Value' = @return_value"; + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + string.Format(sql, input.BillNum) + ); + + return true; + } + + + + + + // 物料 物料组 物料描述 物料号 开始日期 结束日期 单位 出库数量 结算数量 寄售库存数量 + + + + + + + + } + + +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index ea66095a..8e7a6251 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -2134,7 +2134,7 @@ 大众看板-出库 - + @@ -2165,14 +2165,6 @@ 上传的文件(前端已经限制只能上传一个附件) - - - 选择任务,生成出库单,只包含已确认的单据 - - - - - 选择任务,生成出库单,只包含已确认的单据 @@ -3043,6 +3035,74 @@ + + + 大众看板-出库 + + + + + + + + + + + + + + + 准时化出库主表 + + + + + + + 准时化出库明细 + + + + + + + 任务明细标记已确认 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 选择任务,生成出库单,只包含已确认的单据 + + + + + + + + 出库界面功能,核准出库功能 + + + + + + + + 出库界面功能, 撤销核准出库 + + + + + + + + 出库界面功能删除 + + + + + 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 7b4fb824..4f6af435 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs @@ -359,88 +359,53 @@ namespace Win.Sfs.SettleAccount.Entities.WMS { } - public WmsWithOutKanbanOutPutDetial(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) + + + public WmsWithOutKanbanOutPutDetial(Guid id ,string type, string sapMaterialCode, string materialDesc, string version, string isBack, string remark, decimal qty, decimal sockQty, decimal outputQty, string extend,string billnum,int state,decimal realqty):base(id) { - Id = id; - WmsBillNum = wmsBillNum; - Kanban = kanban; - MaterialCode = materialCode; + Type = type; + SapMaterialCode = sapMaterialCode; MaterialDesc = materialDesc; - MaterialGroup = materialGroup; - OutPut = outPut; - InPut = inPut; - State = state; - Extend1 = extend1; - Extend2 = extend2; - Version = extend3; - ParentMaterialCode = parentMaterialCode; - BillNum = billNum; - TaskId = taskId; + Version = version; + IsBack = isBack; Remark = remark; Qty = qty; - - } - public void SetData(Guid id, string remark, string wmsbillnum, string version, Guid taskId) - { - Id = id; - Remark = remark; - WmsBillNum = wmsbillnum; - Version = version; - TaskId = taskId; - + SockQty = sockQty; + OutputQty = outputQty; + Extend = extend; + BillNum = billnum; + State = state; + RealityNumber = realqty; } - // 交货单号 实际发货日期 KENN号 底盘号 物料号 物料描述 客户物料 组件组物料 组件组物料描述 物料组(车型) 定价 金额 结算平台未结数量 大众R3未结数量 差异金额 差异数量 漏结标识 漏结期间 说明 - [ImporterHeader(Name = "组件组物料", IsIgnore = true)] - public string ParentMaterialCode { set; get; } - [ImporterHeader(Name = "交货单号")] - public string WmsBillNum { set; get; } - [ImporterHeader(Name = "条码号")] - //KENN号 - public string Kanban { set; get; } + [ImporterHeader(Name = "单据类型")] + public string Type { set; get; } [ImporterHeader(Name = "物料号")] - //物料号 - public string MaterialCode { set; get; } + public string SapMaterialCode { set; get; } [ImporterHeader(Name = "物料描述")] - //物料描述 public string MaterialDesc { set; get; } - [ImporterHeader(Name = "物料组(车型)")] - //物料组(车型) - public string MaterialGroup { set; get; } - [ImporterHeader(Name = "出库库位", IsIgnore = true)] - //出库库位 - public string OutPut { set; get; } - [ImporterHeader(Name = "入库库位", IsIgnore = true)] - //入库库位 - public string InPut { set; get; } - [ImporterHeader(Name = "状态", IsIgnore = true)] - public int State { get; set; } - [ImporterHeader(Name = "客户物料")] - /// - /// 扩展字段1 - /// - public string Extend1 { set; get; } - /// - /// 扩展字段2 - /// - [ImporterHeader(Name = "订单日期")] - public string Extend2 { set; get; } - /// - /// 扩展字段3 - /// - [ImporterHeader(Name = "版本号", IsIgnore = true)] + [ImporterHeader(Name = "版本号")] public string Version { set; get; } + [ImporterHeader(Name = "是否备件")] + public string IsBack { set; get; } [ImporterHeader(Name = "结算数量")] public decimal Qty { set; get; } + [ImporterHeader(Name = "寄售库存数量", IsIgnore = true)] + public decimal SockQty { set; get; } - [ImporterHeader(Name = "单据", IsIgnore = true)] - public string BillNum { set; get; } - - [ImporterHeader(Name = "任务", IsIgnore = true)] - public Guid TaskId { set; get; } + [ImporterHeader(Name = "真实数量", IsIgnore = true)] + public decimal RealityNumber { set; get; } + [ImporterHeader(Name = "出库数量", IsIgnore = true)] + public decimal OutputQty { set; get; } + [ImporterHeader(Name = "Extend", IsIgnore = true)] + public string Extend { set; get; } + [ImporterHeader(Name = "BillNum", IsIgnore = true)] + public string BillNum { set; get; } + [ImporterHeader(Name = "状态", IsIgnore = true)] + public int State { set; get; } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs index 937e6644..44b2a271 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs @@ -1363,10 +1363,10 @@ namespace Win.Sfs.SettleAccount private static void ConfigureWmsWithOutKanbanOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) { - builder.Entity(b => + builder.Entity(b => { //b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutExtend", options.Schema); - b.ToTable($"{options.TablePrefix}_WmsKanbanOutPut", options.Schema); + b.ToTable($"{options.TablePrefix}_WmsWithOutKanbanOutPut", options.Schema); b.ConfigureByConvention(); b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); @@ -1378,22 +1378,15 @@ namespace Win.Sfs.SettleAccount private static void ConfigureWmsWithOutKanbanOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) { - builder.Entity(b => + builder.Entity(b => { //b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetialExtend", options.Schema); - b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetial", options.Schema); + b.ToTable($"{options.TablePrefix}_WmsWithOutKanbanOutPutDetial", 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 }); }); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs index bd755ba0..a72142e6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs @@ -25,7 +25,7 @@ namespace Win.Sfs.SettleAccount public virtual DbSet WmsJitOutPutDetial { get; set; } public virtual DbSet TEA_TASK_SUB { get; set; } - public virtual DbSet WmsKanbanOutPutDetial { get; set; } + //public virtual DbSet WmsKanbanOutPutDetial { get; set; } public virtual DbSet WmsSharePartOutPutDetial { get; set; } #endregion diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs index 5a6ea20c..46b06e8e 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs @@ -34,6 +34,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public string MaterialDesc { get; set; } [ExporterHeader(DisplayName = "开票数量")] public decimal InvoiceQty { get; set; } + [ExporterHeader(DisplayName ="发货数量")] + public decimal Qty { get; set; } [ExporterHeader(DisplayName = "金额")] public decimal InvoiceAmt { get; set; } [ExporterHeader(DisplayName = "开票单价")] @@ -88,7 +90,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public class KanbanUnSettledExtend { - [ExporterHeader(DisplayName = "客户物料号")] + + + + + + + + + +[ExporterHeader(DisplayName = "客户物料号")] public string MaterialCode { set; get; } [ExporterHeader(DisplayName = "物料号")] public string SapCode { set; get; } @@ -186,7 +197,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report var _list = _query.ToList(); return _list; } - public virtual List GetNoKanbanSettleDetail(string version, string begintime, string endtime) + public virtual List GetNoKanbanSettleDetail(string version) { var sql = diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleKBWithOutCodeExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleKBWithOutCodeExportService.cs index 37b785f8..d4e459e6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleKBWithOutCodeExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleKBWithOutCodeExportService.cs @@ -16,9 +16,11 @@ namespace SettleAccount.Job.Services.Report private readonly OutputService _outputService; private readonly ErpPartDapperRepository _erpdapperRepository; - public SettleKBWithOutCodeExportService(KanbanUnSettledDapperRepository dapper, + public SettleKBWithOutCodeExportService( + KanbanUnSettledDapperRepository dapper, OutputService outputService, - ErpPartDapperRepository erpdapperRepository) + ErpPartDapperRepository erpdapperRepository + ) { _dapper = dapper; _outputService = outputService; @@ -41,7 +43,10 @@ namespace SettleAccount.Job.Services.Report var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; - var _list = _dapper.GetNoKanbanSettleDetail(version, beginTime, endTime); + var _list = _dapper.GetNoKanbanSettleDetail(version); + + + //var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version); //if (diffList != null) //{