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 0d851ea4..547b9a41 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs @@ -358,11 +358,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts decimal _qty = decimal.Parse(_lst[8].Trim()); string _settlementID = _lst[9].Trim(); string _settlementSupplier = _lst[10].Trim(); - if (_preList.Any(p => p.KENNCode == _kENNCode)) { _precodeList.Add(_kENNCode); - } _setls.Add(new SettleAccount( GuidGenerator.Create(), diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs new file mode 100644 index 00000000..f70980ed --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs @@ -0,0 +1,405 @@ +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/WmsHQKBOutput")] + [AllowAnonymous] + //[Authorize(SettleAccountPermissions.WMSJIT.Default)] + public class WmsHQKBOutputAppService : 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 WmsHQKBOutputAppService( + + + 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) + { + + 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 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 WmsHQWithOutKanbanOutPutDetial( + 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, + itm.Price, + itm.Amt + ); + + return new PagedResultDto(totalCount, entities); + } + + + + + /// + /// 任务明细标记已确认 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("WmsSharePartOutPutModify")] + [DisableRequestSizeLimit] + + public async Task WmsSharePartUpdate(WmsHQWithOutKanbanOutPutDetial 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("ExcelImport")] + [UnitOfWork(false)] + public async Task WmsKanbanOutPut([FromForm] IFormFileCollection files, string version) + { + + var _count1 = _wmsVersionRepository.Count(p => p.Version == version); + if (_count1 > 0) + { + var checkList = new List(); + checkList.Add(new ErrorExportDto() { Message = "有重复期间数据" }); + if (checkList.Count > 0) + { + + return await ExportErrorReportAsync(checkList); + } + } + var _billNum = "HQKB" + DateTime.Now.ToString("yyyyMMddhhmmss"); + + + //var _list = _dapper.GetNoKanbanSettleDetail(input.Version); + + ExportImporter _exportImporter = new ExportImporter(); + var _list = await _exportImporter.ExtendExcelImport(files, _excelImportService); + 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 WmsHQWithOutKanbanOutPutDetial( + GuidGenerator.Create(), + "无看板发货", + itm.SapMaterialCode, + itm.MaterialDesc, + itm.Version, + string.Empty, + string.Empty, + itm.Qty, + tm1 == null ? 0 : tm1.Qty, + itm.Qty, + string.Empty, + _billNum, + 0, + 0, + itm.Price, + itm.Amt + ); + + 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 WmsHQWithOutKanbanOutPut(GuidGenerator.Create(), 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_ou" + + "tput]\n" + + " @billnum = N'{0}',\n" + + " @type = 21,\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 = 21,\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 = 21\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/Reports/ReportServices/ReportMakeService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index a6186e5c..4847fe52 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -171,9 +171,6 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices }); return _taskid; } - - - #region 大众备件0-90天和90天以上输出 /// @@ -568,7 +565,6 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices BaseRequestDto input ) { - List customConditionList = new List(); customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index a1984125..7a7dd139 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -2899,6 +2899,74 @@ + + + 大众看板-出库 + + + + + + + + + + + + + + + 准时化出库主表 + + + + + + + 准时化出库明细 + + + + + + + 任务明细标记已确认 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 选择任务,生成出库单,只包含已确认的单据 + + + + + + + + 出库界面功能,核准出库功能 + + + + + + + + 出库界面功能, 撤销核准出库 + + + + + + + + 出库界面功能删除 + + + + + wms出库-M平台 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs index 402376f7..95e7a3da 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs @@ -15,7 +15,6 @@ namespace Win.Sfs.SettleAccount.Entities public static List CacheMaterials { set; get; } public static List CachePriceList { set; get; } - public static List CacheInvoiceSettledDetailDiff { 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 3eae9d67..0a23290e 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs @@ -439,6 +439,101 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } + public class WmsHQWithOutKanbanOutPut : FullAuditedAggregateRootBase + { + public WmsHQWithOutKanbanOutPut() + { + } + + public WmsHQWithOutKanbanOutPut(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 WmsHQWithOutKanbanOutPutDetial : FullAuditedAggregateRootBase + { + public WmsHQWithOutKanbanOutPutDetial() + { + } + + + + public WmsHQWithOutKanbanOutPutDetial(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, decimal price, decimal amt) : base(id) + { + Type = type; + SapMaterialCode = sapMaterialCode; + MaterialDesc = materialDesc; + Version = version; + IsBack = isBack; + Remark = remark; + Qty = qty; + SockQty = sockQty; + OutputQty = outputQty; + Extend = extend; + BillNum = billnum; + State = state; + RealityNumber = realqty; + Price = price; + Amt = amt; + } + + + + [ImporterHeader(Name = "单据类型", IsIgnore = true)] + public string Type { set; get; } + [ImporterHeader(Name = "物料号")] + public string SapMaterialCode { set; get; } + [ImporterHeader(Name = "物料描述")] + public string MaterialDesc { set; get; } + [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 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; } + [ImporterHeader(Name = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + public decimal Amt { 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 44b2a271..279965e3 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs @@ -365,6 +365,11 @@ namespace Win.Sfs.SettleAccount builder.ConfigurePriceListVersionBJ(options); builder.ConfigurePriceListBJ(options); + builder.ConfigureWmsHQWithOutKanbanOutPutVersion(options); + builder.ConfigureWmsHQWithOutKanbanOutPutDetail(options); + + + #endregion } @@ -1376,15 +1381,43 @@ namespace Win.Sfs.SettleAccount } private static void ConfigureWmsWithOutKanbanOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + b.ToTable($"{options.TablePrefix}_WmsWithOutKanbanOutPutDetial", 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 ConfigureWmsHQWithOutKanbanOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + b.ToTable($"{options.TablePrefix}_WmsHQWithOutKanbanOutPut", 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 ConfigureWmsHQWithOutKanbanOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) { builder.Entity(b => { //b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetialExtend", options.Schema); - b.ToTable($"{options.TablePrefix}_WmsWithOutKanbanOutPutDetial", options.Schema); + b.ToTable($"{options.TablePrefix}_WmsHQWithOutKanbanOutPutDetial", 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 }); @@ -1397,6 +1430,11 @@ namespace Win.Sfs.SettleAccount + + + + + private static void ConfigureWmsSharePartOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) { diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs index 728edbbb..db9cceea 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs @@ -51,7 +51,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } else { - _materialList = DbConnection.Query("select max(Id) Factory,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc,EstimateTypeDesc,EstimateType ").ToList(); + _materialList = DbConnection.Query("select max(Id) ID,'' Factory,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc,EstimateTypeDesc,EstimateType ").ToList(); } if (CacheManager.CachePriceList != null) { 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 619713a6..d92371f3 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 @@ -37,7 +37,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report else { - string isExistSql = string.Format("SELECT count(1) lincount FROM [Set_Settle1] WITH(SNAPSHOT) where Version = '{0}'", version); + string isExistSql = string.Format("SELECT count(1) lincount FROM [Set_Settle_RAM] WITH(SNAPSHOT) where Version = '{0}'", version); int _count = DbConnection.ExecuteScalar(isExistSql); string condition = " where 1=1 "; @@ -132,6 +132,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } else { + if (CacheManager.CacheInvoiceSettledDetailDiff == null) + { + CacheManager.CacheInvoiceSettledDetailDiff = new List(); + } CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list); } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs index dc1a6549..003cd10f 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs @@ -61,72 +61,7 @@ namespace TaskJob.Services { var filePath = fileSavePath + itm;//获取到导入的excel var exten = Path.GetExtension(fileSavePath); - //List _errorList = new List(); - //var checkList = new List(); - ////var _chList = await _relrepository.GetAllAsync(GuidGenerator.Create(), true); - ////var _chls = _chList.Select(p => p.SettleMaterialCode).Distinct(); - //List _precodeList = new List();// - //if (exten.ToUpper() == ".TXT") - //{ - // using (TextReader textReader = new StreamReader(filePath)) - // { - // int i = 0; - // while (true) - // { - // string str = textReader.ReadLine(); - // if (string.IsNullOrEmpty(str)) - // { - // break; - // } - // else - // { - // try - // { - // var _lst = str.Split(new char[] { '|' }).ToList(); - // string _settleyear = _lst[1].Trim(); - // string _kENNCode = _lst[2].Trim(); - // string _chassisNumber = _lst[3].Trim(); - // string _model = _lst[4].Trim(); - // DateTime _cP5A = DateTime.Parse(_lst[5].Trim()); - // DateTime _cP7 = DateTime.Parse(_lst[6].Trim()); - // string _materialCode = _lst[7].Trim(); - // decimal _qty = decimal.Parse(_lst[8].Trim()); - // string _settlementID = _lst[9].Trim(); - // string _settlementSupplier = _lst[10].Trim(); - // _setls.Add(new Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount( - // Guid.NewGuid(), - // Guid.NewGuid(), - // _settleyear, - // _kENNCode, - // _chassisNumber, - // _model, - // _cP5A, - // _cP7, - // _materialCode, - // _qty, - // _settlementID, - // _settlementSupplier, - // DateTime.Now.Year.ToString(), - // DateTime.Now.Month.ToString(), - // _id, - // version, - // DateTime.Now, - // Guid.NewGuid() - // )); - // } - // catch - // { - - // } - // } - // i++; - // } - // textReader.Close(); - // } - //} - //else - //{ - // _setls= _inputService.Input(filePath); + var errorlist = new List(); var dtoList = _inputService.Input(filePath, null, errorlist); foreach (var dto in dtoList) @@ -139,13 +74,12 @@ namespace TaskJob.Services dto.ChassisNumber, dto.Model, dto.CP5A, dto.CP7, Regex.Replace(dto.MaterialCode, @"\s", ""), dto.Qty, dto.SettlementID, dto.SettlementSupplier, DateTime.Now.Month.ToString(), dto.SettleYear, _id, version, DateTime.Now, Guid.NewGuid()); - _setls.Add(_settleaccount); + _setls.Add(_settleaccount); } //} #region //var errorFileName = "错误文件.xlsx"; //checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}底盘号 {1}有重复", "11111111111", "22222222222"), string.Empty)); - //_service.ExportError(id,errorFileName, checkList); #endregion } @@ -158,8 +92,7 @@ namespace TaskJob.Services _setls = _setls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.KENNCode }).Select(p => p.FirstOrDefault()).ToList(); _repository.Insert(_setls); _versionRepository.Insert(_id, version, customerCode, customerCode); - - _repository.GetDbContext().Database.ExecuteSqlRaw( + _repository.GetDbContext().Database.ExecuteSqlRaw( "EXEC sp_settle_fis_update" );