From 9d1933a07e81813ce04a508ce9344cf2551b6d22 Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Mon, 17 Oct 2022 09:46:01 +0800 Subject: [PATCH] =?UTF-8?q?2022.10.17=E6=9C=80=E6=96=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/VWKanBanIn/VWKanBanInDto.cs | 75 ++++++ .../Entities/VWKanBanOut/VWKanBanOutDto.cs | 93 ++++++++ .../Entities/WMS/WMSKanbanAppService.cs | 42 +++- .../Entities/WMS/WMSSharePartAppService.cs | 3 +- .../WMS/WmsOneTimeSaleOutputAppService.cs | 6 + ...ttleAccountApplicationAutoMapperProfile.cs | 9 + .../Entities/VWKanBanIn/VWKanBanInEntity.cs | 88 ++++++++ .../Entities/VWKanBanOut/VWKanBanOutEntity.cs | 89 ++++++++ .../SettleAccountDbContext.cs | 2 +- ...AccountDbContextModelCreatingExtensions.cs | 67 +++++- ...nvoiceSettledDetailDiffDapperRepository.cs | 26 +-- .../Report/KanbanUnSettledDapperRepository.cs | 213 ------------------ .../Report/WmsDapperRepository.cs | 12 +- 13 files changed, 491 insertions(+), 234 deletions(-) create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanIn/VWKanBanInDto.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanOut/VWKanBanOutDto.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanIn/VWKanBanInEntity.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanOut/VWKanBanOutEntity.cs diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanIn/VWKanBanInDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanIn/VWKanBanInDto.cs new file mode 100644 index 00000000..de08ddc6 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanIn/VWKanBanInDto.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace Win.Sfs.SettleAccount.Entities.VWKanBanIn +{ + public class VWKanBanInDto : Entity + { + /// + /// 交货单号 + /// + public string WmsBillNum { set; get; } + + /// + /// 订单号/看板号 + /// + public string BillNum { set; get; } + + /// + /// 零件号 + /// + public string ItemCode { set; get; } + + + /// + /// 发货时间 + /// + public DateTime InputTime { set; get; } + + /// + /// 出库时间 + /// + public DateTime OutputTime { set; get; } + + /// + /// 库存数量 + /// + public decimal InputQty { set; get; } + + /// + /// 出库数量 + /// + public decimal OutputQty { set; get; } + + /// + /// /退货数量 + /// + public decimal ReturnQty { set; get; } + + + /// + /// 出库单据号 + /// + public string SettleBillNumber { set; get; } + + /// + /// 发货状态 + /// + public string State { set; get; } + + /// + /// 客户代码 + /// + public string ClientCode { set; get; } + + /// + /// 备注 + /// + public string Remark { set; get; } + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanOut/VWKanBanOutDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanOut/VWKanBanOutDto.cs new file mode 100644 index 00000000..dc0f1ccb --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanOut/VWKanBanOutDto.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace Win.Sfs.SettleAccount.Entities.VWKanBanOut +{ + public class VWKanBanOutDto : Entity + { + /// + /// 关联库存ID + /// + public string KanBanInOfID { set; get; } + + /// + /// 交货单号 + /// + public string WmsBillNum { set; get; } + + /// + /// 订单号/看板号 + /// + public string BillNum { set; get; } + + /// + ///零件号 + /// + public string ItemCode { set; get; } + + + /// + /// 发货时间 + /// + public DateTime InputTime { set; get; } + + /// + /// 出库时间 + /// + public DateTime OutputTime { set; get; } + + /// + /// 库存数量 + /// + public decimal InputQty { set; get; } + + /// + /// 出库数量 + /// + public decimal OutputQty { set; get; } + + /// + /// 退货数量 + /// + public decimal ReturnQty { set; get; } + + + /// + /// 出库单据号 + /// + public string SettleBillNumber { set; get; } + + /// + /// 发货状态 + /// + public string State { set; get; } + + /// + /// 客户代码 + /// + public string ClientCode { set; get; } + + /// + /// 备注 + /// + public string Remark { set; get; } + + + /// + /// 扩展1 + /// + public string Extend1 { set; get; } + /// + /// 扩展2 + /// + public string Extend2 { set; get; } + /// + /// 扩展3 + /// + public string Extend3 { set; get; } + } +} 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 9dd49e7b..26c2b3ab 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs @@ -48,6 +48,7 @@ using Win.Sfs.SettleAccount.Entities.Wms; using Win.Sfs.SettleAccount.Repository; using WY.NewJit.Extends.PaiGe.WMS; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; +using Win.Sfs.SettleAccount.Entities.VWKanBanIn; namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { @@ -63,6 +64,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; + private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; private readonly ISettleAccountBranchEfCoreRepository _wmsRepository1; @@ -79,7 +81,11 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts private readonly TaskJobService _service; private readonly WmsDapperRepository _wmsDapper; - // private readonly ErpPartDapperRepository _erpdapperRepository; + private readonly IRepository _vwkanbanInRepository; + + private readonly IRepository _vwkanbanOutRepository; + + // private readonly ErpPartDapperRepository _erpdapperRepository; /// /// /// @@ -102,6 +108,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts IDistributedCache cache, ISnowflakeIdGenerator snowflakeIdGenerator, // ErpPartDapperRepository erpdapperRepository, + IRepository vwkanbanOutRepository, + IRepository vwkanbanInRepository, ICommonManager commonManager, WmsDapperRepository wmsDapper ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) @@ -115,6 +123,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts _dapper = dapper; // _erpdapperRepository = erpdapperRepository; _wmsDapper = wmsDapper; + _vwkanbanInRepository = vwkanbanInRepository; + _vwkanbanOutRepository = vwkanbanOutRepository; } private async Task GetCountAsync(WmsKanbanOutPutDetialRequestDto input) @@ -430,6 +440,36 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts } return true; } + + /// + /// 大众看板有单号,库存表、出库表和出库详表 + /// + /// + /// + [HttpPost] + [Route("WmsKanbanOutPut-Pass/In")] + [UnitOfWork(false)] + public async Task WmsKanbanOutPutPassIN(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 && p.State != 4).ToListAsync(); + } + else + { + _ls = await _wmsRepository.Where(p => p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2 && p.State != 4).ToListAsync(); + } + if (_ls.Count() > 0) + { + //调用存储过程 + + } + } + return true; + } /// ///出库界面功能, 撤销核准出库 /// diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs index 9721e8a4..f15b3d86 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs @@ -442,7 +442,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts _wmslstBill = _wmslstBill.Select(p => new WmsSharePart90OutPutDetial( GuidGenerator.Create(), - p.WmsBillNum, + //p.WmsBillNum, + !string.IsNullOrEmpty(p.WmsBillNum) ? (p.WmsBillNum.Length > 36 ? "PF" : p.WmsBillNum) : string.Empty, p.OrderBillNum, p.MaterialCode, p.MaterialDesc, diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs index 3ab0e5c5..d0f58e6e 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs @@ -284,6 +284,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS // } //} + //删除版本 + var _versionQuery = _wmsVersionRepository.Where(p => p.Version == version); + await _versionQuery.BatchDeleteAsync(); + //删除明细 + var _query = _wmsRepository.Where(p => p.Version == version); + await _query.BatchDeleteAsync(); var stockList = _wmsDapper.GetSalesStock(); var query = from itm in _list diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index 401791c9..757b2a2f 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -93,6 +93,8 @@ using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts; using Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput; using Win.Sfs.SettleAccount.Errors; using Win.Sfs.SettleAccount.Entities.Errors; +using Win.Sfs.SettleAccount.Entities.VWKanBanIn; +using Win.Sfs.SettleAccount.Entities.VWKanBanOut; namespace Win.Sfs.SettleAccount { @@ -268,12 +270,19 @@ namespace Win.Sfs.SettleAccount CreateMapWMSDiffOutputSum(); CreateMapWMSWithCodeOutputSum(); CreateMapWMSCacelOutputSum(); + CreateMapVWInOutKanBan(); CreateMapWMSErrorBill(); #endregion } #region 派格出库单 + private void CreateMapVWInOutKanBan() + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + } + private void CreateMapCustomerKanban() { CreateMap().ReverseMap(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanIn/VWKanBanInEntity.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanIn/VWKanBanInEntity.cs new file mode 100644 index 00000000..383bd082 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanIn/VWKanBanInEntity.cs @@ -0,0 +1,88 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace Win.Sfs.SettleAccount.Entities.VWKanBanIn +{ + public class VWKanBanInEntity : Entity + { + [ExporterHeader(DisplayName = "交货单号")] + public string WmsBillNum { set; get; } + + [ExporterHeader(DisplayName = "订单号/看板号")] + public string BillNum { set; get; } + + [ExporterHeader(DisplayName = "零件号")] + public string ItemCode { set; get; } + + + [ExporterHeader(DisplayName = "发货时间")] + public DateTime InputTime { set; get; } + + [ExporterHeader(DisplayName = "出库时间")] + public DateTime OutputTime { set; get; } + + [ExporterHeader(DisplayName = "库存数量")] + public decimal InputQty { set; get; } + + [ExporterHeader(DisplayName = "出库数量")] + public decimal OutputQty { set; get; } + + [ExporterHeader(DisplayName = "退货数量")] + public decimal ReturnQty { set; get; } + + + [ExporterHeader(DisplayName = "出库单据号")] + public string SettleBillNumber { set; get; } + + [ExporterHeader(DisplayName = "发货状态")] + public string State { set; get; } + + [ExporterHeader(DisplayName = "客户代码")] + public string ClientCode { set; get; } + + [ExporterHeader(DisplayName = "备注",IsIgnore =true)] + public string Remark { set; get; } + + + [ExporterHeader(DisplayName = "扩展1", IsIgnore = true)] + public string Extend1 { set; get; } + [ExporterHeader(DisplayName = "扩展2", IsIgnore = true)] + public string Extend2 { set; get; } + [ExporterHeader(DisplayName = "扩展3", IsIgnore = true)] + public string Extend3 { set; get; } + + + public void SetValue(Guid guid, string remark) + { + Id = guid; + Remark = remark; + } + + public VWKanBanInEntity(Guid id, string wmsBillNum, string billNum, string itemCode, + DateTime inputTime, DateTime outputTime, decimal inputQty, decimal outputQty, decimal returnQty, + string state, string clientCode, string remark, string extend1, string extend2, string extend3) : base(id) + { + Id = id; + WmsBillNum = wmsBillNum; + BillNum = billNum; + ItemCode = itemCode; + InputTime = inputTime; + OutputTime = outputTime; + InputQty = inputQty; + OutputQty = outputQty; + ReturnQty = returnQty; + State = state; + ClientCode = clientCode; + Remark = remark; + Extend2 = extend2; + Extend1 = extend1; + Extend3 = extend3; + + } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanOut/VWKanBanOutEntity.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanOut/VWKanBanOutEntity.cs new file mode 100644 index 00000000..273c5fd8 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanOut/VWKanBanOutEntity.cs @@ -0,0 +1,89 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace Win.Sfs.SettleAccount.Entities.VWKanBanOut +{ + + public class VWKanBanOutEntity : Entity + { + [ExporterHeader(DisplayName = "关联库存ID",IsIgnore =true)] + public string KanBanInOfID { set; get; } + + [ExporterHeader(DisplayName = "交货单号")] + public string WmsBillNum { set; get; } + + [ExporterHeader(DisplayName = "订单号/看板号")] + public string BillNum { set; get; } + + [ExporterHeader(DisplayName = "零件号")] + public string ItemCode { set; get; } + + + [ExporterHeader(DisplayName = "发货时间")] + public DateTime InputTime { set; get; } + + [ExporterHeader(DisplayName = "出库时间")] + public DateTime OutputTime { set; get; } + + [ExporterHeader(DisplayName = "库存数量")] + public decimal InputQty { set; get; } + + [ExporterHeader(DisplayName = "出库数量")] + public decimal OutputQty { set; get; } + + [ExporterHeader(DisplayName = "退货数量")] + public decimal ReturnQty { set; get; } + + + [ExporterHeader(DisplayName = "出库单据号")] + public string SettleBillNumber { set; get; } + + [ExporterHeader(DisplayName = "发货状态")] + public string State { set; get; } + + [ExporterHeader(DisplayName = "客户代码")] + public string ClientCode { set; get; } + + [ExporterHeader(DisplayName = "备注", IsIgnore = true)] + public string Remark { set; get; } + + + [ExporterHeader(DisplayName = "扩展1", IsIgnore = true)] + public string Extend1 { set; get; } + [ExporterHeader(DisplayName = "扩展2", IsIgnore = true)] + public string Extend2 { set; get; } + [ExporterHeader(DisplayName = "扩展3", IsIgnore = true)] + public string Extend3 { set; get; } + + + + + public VWKanBanOutEntity(Guid id, string kanBanInOfID, string wmsBillNum, string billNum, string itemCode, + DateTime inputTime, DateTime outputTime, decimal inputQty, decimal outputQty, decimal returnQty, + string state, string clientCode, string remark, string extend1, string extend2, string extend3) : base(id) + { + Id = id; + KanBanInOfID = kanBanInOfID; + WmsBillNum = wmsBillNum; + BillNum = billNum; + ItemCode = itemCode; + InputTime = inputTime; + OutputTime = outputTime; + InputQty = inputQty; + OutputQty = outputQty; + ReturnQty = returnQty; + State = state; + ClientCode = clientCode; + Remark = remark; + Extend2 = extend2; + Extend1 = extend1; + Extend3 = extend3; + + } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs index 6b35065d..eed40704 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs @@ -18,7 +18,7 @@ namespace Win.Sfs.SettleAccount public SettleAccountDbContext(DbContextOptions options) : base(options) { - this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(30)); + this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(120)); } protected override void OnModelCreating(ModelBuilder builder) diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs index 10f4b52a..155c2e66 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs @@ -74,6 +74,8 @@ using Win.Sfs.SettleAccount.Entities.WMS; using Win.Sfs.SettleAccount.Entities.HQ_F; using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts; using Win.Sfs.SettleAccount.Errors; +using Win.Sfs.SettleAccount.Entities.VWKanBanIn; +using Win.Sfs.SettleAccount.Entities.VWKanBanOut; namespace Win.Sfs.SettleAccount { @@ -384,6 +386,16 @@ namespace Win.Sfs.SettleAccount #endregion + #region 派格库存改造 + + //大众看板有单号库存 + builder.ConfigureVWINKanban(options); + + builder.ConfigureVWOUTKanban(options); + + + #endregion + } @@ -552,8 +564,61 @@ namespace Win.Sfs.SettleAccount #region PG-派格 + /// + /// 大众看板有单号出库单 + /// + /// + /// + private static void ConfigureVWOUTKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + + b.ToTable($"{options.TablePrefix}_VW_OUT_Kanban", options.Schema); + + b.ConfigureByConvention(); + b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(50);//必填项 + b.Property(x => x.BillNum).IsRequired().HasMaxLength(50); + b.Property(x => x.ItemCode).IsRequired().HasMaxLength(50); + b.Property(x => x.InputTime).IsRequired(); + b.Property(x => x.SettleBillNumber).HasMaxLength(50); + //b.Property(x => x.InputQty).IsRequired(); + b.Property(x => x.ClientCode).HasMaxLength(50); + b.Property(x => x.State).IsRequired(); + //创建组合索引 + b.HasIndex(x => new { x.BillNum, x.ItemCode }); - + }); + } + + /// + /// 大众看板有单号库存表 + /// + /// + /// + private static void ConfigureVWINKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + + b.ToTable($"{options.TablePrefix}_VW_IN_Kanban", options.Schema); + + b.ConfigureByConvention(); + b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(50);//必填项 + b.Property(x => x.BillNum).IsRequired().HasMaxLength(50); + b.Property(x => x.ItemCode).IsRequired().HasMaxLength(50); + b.Property(x => x.InputTime).IsRequired(); + b.Property(x => x.SettleBillNumber).HasMaxLength(50); + b.Property(x => x.InputQty).IsRequired(); + b.Property(x => x.ClientCode).HasMaxLength(50); + b.Property(x => x.State).IsRequired(); + //创建组合索引 + b.HasIndex(x => new { x.BillNum, x.ItemCode }); + + }); + } private static void ConfigureHQFKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) 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 8c8fc90a..a9fd7700 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 @@ -122,19 +122,19 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report _list = _query.ToList(); - if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0) - { - _list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p => p.Version == version).ToList(); - _list = _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); - } - else - { - if (CacheManager.CacheInvoiceSettledDetailDiff == null) - { - CacheManager.CacheInvoiceSettledDetailDiff = new List(); - } - CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list); - } + //if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0) + //{ + // _list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p => p.Version == version).ToList(); + // _list = _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); + //} + //else + //{ + // if (CacheManager.CacheInvoiceSettledDetailDiff == null) + // { + // CacheManager.CacheInvoiceSettledDetailDiff = new List(); + // } + // CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list); + //} 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 df80f958..64a1254c 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 @@ -267,219 +267,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " AND UNION2.[客户零件号] IS NULL \n" + " ) UNION2"; - //更改方案一 - //string sql = "SELECT\n" + - //" * \n" + - //"FROM\n" + - //" (\n" + - //" SELECT\n" + - //" * \n" + - //" FROM\n" + - //" (\n" + - //" SELECT\n" + - //" TEMP1.*,\n" + - //" TEMP2.Price,\n" + - //" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" + - //" FROM\n" + - //" (\n" + - //" SELECT\n" + - //" '' WmsBillNum,\n" + - //" NULL BeginDate,\n" + - //" a.Kanban,\n" + - //" C.MaterialCode SapCode,\n" + - //" C.MaterialDesc,\n" + - //" C.CustomerPartCode,\n" + - //" C.EstimateTypeDesc MaterialGroup,\n" + - //" ISNULL( B.Qty, 0 ) SettleQty,\n" + - //" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" + - //" isnull( tt.qty, 0 ) BackQty,\n" + - //" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" + - //" FROM\n" + - //" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1 = 1 {1} GROUP BY MaterialCode, Kanban ) A\n" + - //" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, Extend1 AS MaterialCode FROM Set_WmsKanbanOutPutDetial {0} GROUP BY Kanban, Extend1 ) B ON A.Kanban = B.Kanban \n" + - //" AND A.MaterialCode = B.MaterialCode\n" + - //" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" + - //" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" + - //" AND c.MaterialCode = tt.MaterialCode \n" + - //" WHERE\n" + - //" B.Kanban IS NULL \n" + - //" AND B.MaterialCode IS NULL \n" + - //" ) TEMP1\n" + - //" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" + - //" ) UNION1\n" + - //" LEFT JOIN temp_vwkanban UNION2 ON UNION1.Kanban= UNION2.[看板号] \n" + - //" AND UNION1.CustomerPartCode= UNION2.[客户零件号] \n" + - //" WHERE\n" + - //" UNION2.[看板号] IS NULL \n" + - //" AND UNION2.[客户零件号] IS NULL \n" + - //" ) aaa \n" + - //" WHERE 1=1"; - - - - #region 原定规则,又改了! - //string sql = "SELECT\n" + - //" * \n" + - //"FROM\n" + - //" (\n" + - //" SELECT\n" + - //" TEMP1.*,\n" + - //" TEMP2.Price,\n" + - //" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" + - //" FROM\n" + - //" (\n" + - //" SELECT\n" + - //" '' WmsBillNum,\n" + - //" NULL BeginDate,\n" + - //" a.Kanban,\n" + - //" C.MaterialCode SapCode,\n" + - //" C.MaterialDesc,\n" + - //" C.CustomerPartCode,\n" + - //" C.EstimateTypeDesc MaterialGroup,\n" + - //" ISNULL( B.Qty, 0 ) SettleQty,\n" + - //" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" + - //" isnull( tt.qty, 0 ) BackQty,\n" + - //" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" + - //" FROM\n" + - //" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1=1 {1} GROUP BY MaterialCode, Kanban ) A\n" + - //" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" + - //" AND A.MaterialCode = B.MaterialCode\n" + - //" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" + - //" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" + - //" AND c.MaterialCode = tt.MaterialCode \n" + - //" WHERE\n" + - //" B.Kanban IS NULL \n" + - //" AND B.MaterialCode IS NULL \n" + - //" ) TEMP1\n" + - //" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" + - //" ) UNION1 UNION ALL\n" + - //"SELECT\n" + - //" * \n" + - //"FROM\n" + - //" (\n" + - //" SELECT\n" + - //" TEMP1.*,\n" + - //" TEMP2.Price,\n" + - //" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" + - //" FROM\n" + - //" (\n" + - //" SELECT\n" + - //" '' WmsBillNum,\n" + - //" NULL BeginDate,\n" + - //" a.Kanban,\n" + - //" C.MaterialCode SapCode,\n" + - //" C.MaterialDesc,\n" + - //" C.CustomerPartCode,\n" + - //" C.EstimateTypeDesc MaterialGroup,\n" + - //" ISNULL( B.Qty, 0 ) SettleQty,\n" + - //" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" + - //" isnull( tt.qty, 0 ) BackQty,\n" + - //" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" + - //" FROM\n" + - //" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1=1 {1} GROUP BY MaterialCode, Kanban ) A\n" + - //" INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" + - //" AND A.MaterialCode = B.MaterialCode\n" + - //" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" + - //" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" + - //" AND c.MaterialCode = tt.MaterialCode \n" + - //" WHERE\n" + - //" a.WMSDeliveryQty> B.Qty AND (a.WMSDeliveryQty-tt.Qty)!=B.Qty \n" + - //" ) TEMP1\n" + - //" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" + - //" ) UNION2"; - - //20220424-财务要求:大众看板待设置不出现在未结数据里-更新 - //string sql = "SELECT\n" + - //" * \n" + - //"FROM\n" + - //" (\n" + - //" SELECT\n" + - //" * \n" + - //" FROM\n" + - //" (\n" + - //" SELECT\n" + - //" * \n" + - //" FROM\n" + - //" (\n" + - //" SELECT\n" + - //" TEMP1.*,\n" + - //" TEMP2.Price,\n" + - //" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" + - //" FROM\n" + - //" (\n" + - //" SELECT\n" + - //" '' WmsBillNum,\n" + - //" NULL BeginDate,\n" + - //" a.Kanban,\n" + - //" C.MaterialCode SapCode,\n" + - //" C.MaterialDesc,\n" + - //" C.CustomerPartCode,\n" + - //" C.EstimateTypeDesc MaterialGroup,\n" + - //" ISNULL( B.Qty, 0 ) SettleQty,\n" + - //" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" + - //" isnull( tt.qty, 0 ) BackQty,\n" + - //" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" + - //" FROM\n" + - //" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1 = 1 {1} GROUP BY MaterialCode, Kanban ) A\n" + - //" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" + - //" AND A.MaterialCode = B.MaterialCode\n" + - //" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" + - //" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" + - //" AND c.MaterialCode = tt.MaterialCode \n" + - //" WHERE\n" + - //" B.Kanban IS NULL \n" + - //" AND B.MaterialCode IS NULL \n" + - //" ) TEMP1\n" + - //" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" + - //" ) UNION1 UNION ALL\n" + - //" SELECT\n" + - //" * \n" + - //" FROM\n" + - //" (\n" + - //" SELECT\n" + - //" TEMP1.*,\n" + - //" TEMP2.Price,\n" + - //" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" + - //" FROM\n" + - //" (\n" + - //" SELECT\n" + - //" '' WmsBillNum,\n" + - //" NULL BeginDate,\n" + - //" a.Kanban,\n" + - //" C.MaterialCode SapCode,\n" + - //" C.MaterialDesc,\n" + - //" C.CustomerPartCode,\n" + - //" C.EstimateTypeDesc MaterialGroup,\n" + - //" ISNULL( B.Qty, 0 ) SettleQty,\n" + - //" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" + - //" isnull( tt.qty, 0 ) BackQty,\n" + - //" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" + - //" FROM\n" + - //" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1 = 1 {1} GROUP BY MaterialCode, Kanban ) A\n" + - //" INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" + - //" AND A.MaterialCode = B.MaterialCode\n" + - //" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" + - //" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" + - //" AND c.MaterialCode = tt.MaterialCode \n" + - //" WHERE\n" + - //" a.WMSDeliveryQty> B.Qty \n" + - //" AND ( a.WMSDeliveryQty- tt.Qty ) != B.Qty \n" + - //" ) TEMP1\n" + - //" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" + - //" ) UNION2 \n" + - //" ) UNION12\n" + - //" LEFT JOIN temp_vwkanban UNION3 ON UNION12.Kanban= UNION3.[看板号] \n" + - //" AND UNION12.CustomerPartCode= UNION3.[客户零件号] \n" + - //" WHERE\n" + - //" UNION3.[看板号] IS NULL \n" + - //" AND UNION3.[客户零件号] IS NULL \n" + - //" ) aaa \n" + - //"WHERE\n" + - //" aaa.CustomerPartCode NOT IN ( '30G839904A041', '80D867172KJ7' ) "; - - //财务香凝要求:交货数量-退货数量=结算数量 这样的不体现在未结中 - - #endregion sql = string.Format(sql,contion,strDate); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsDapperRepository.cs index b58be080..2a03f574 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsDapperRepository.cs @@ -65,8 +65,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public virtual List GetSalesStock() { - string str = " select SUM(Qty) Qty,PartCode SapCode from TS_STOCK_DETAIL where AreaCode='SALE' group by PartCode "; - + //string str = " select SUM(Qty) Qty,PartCode SapCode from TS_STOCK_DETAIL where AreaCode='SALE' group by PartCode "; + string str = " EXEC [dbo].[GetSalesList] @locCode = N'' "; var _list = DbConnection.Query(str); return _list.ToList(); @@ -74,10 +74,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } - + /// + /// 因为运行期间,直接SQL查询报超时,现在改为调用存储过程 + /// + /// + /// public virtual List GetSalesStock(string locCode) { - string str = " select SUM(Qty) Qty,PartCode SapCode from TS_STOCK_DETAIL where AreaCode='SALE' and LocCode='{0}' group by PartCode "; + string str = " EXEC [dbo].[GetSalesList] @locCode = N'{0}' "; str=string.Format(str, locCode); var _list = DbConnection.Query(str);