From 6fa31416ea0bc389da333ebf3d88ef688f863393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Thu, 23 Nov 2023 08:40:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/Syncs/BalanceSumService .cs | 46 + .../BQ/Syncs/PendingDeductionService.cs | 17 +- .../Entities/BQ/VmiAsyncBalanceService.cs | 10 + .../ReportServices/ReportMakeService.cs | 811 +----------------- .../BalanceSum/BalanceSumDapperRepository.cs | 373 ++++++++ .../SettleAccount.Job/Services/PD_SERVICE.cs | 118 +-- 6 files changed, 518 insertions(+), 857 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BalanceSumService .cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BalanceSumService .cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BalanceSumService .cs new file mode 100644 index 00000000..46cfdec2 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BalanceSumService .cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using EFCore.BulkExtensions; +using NPOI.OpenXmlFormats.Spreadsheet; +using SettleAccount.Bases; +using SettleAccount.Domain.BQ; +using TaskJob.EventArgs; +using TaskJob.Interfaces; +using Volo.Abp.Application.Services; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Emailing; +using Volo.Abp.Uow; +using Win.Sfs.SettleAccount.Entities.BQ.Vmi; +using Win.Sfs.SettleAccount.Entities.CodeSettings; +using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; + +namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs +{ + public class BalanceSumService : ApplicationService, ITransientDependency, IExportJob + { + + //protected readonly SettleAccountDbContext _dbcontext; + protected readonly BalanceSumDapperRepository _dapper; + + public BalanceSumService( + BalanceSumDapperRepository dapper + ) + { + _dapper = dapper; + + //_dbcontext = dbcontext; + + } + [UnitOfWork(false)] + public string ExportFile(Guid id, List exportName, List property) + { + var year = property.Where(p => p.Name == "Year").FirstOrDefault().Value; + var list=_dapper.GetBalanceSum(year); + + return id.ToString(); + } + + + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs index 48106ff2..03c54076 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs @@ -44,6 +44,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs var projectList = _dbcontext.Set().Where(p => p.Project == "库位").ToList(); var jisbbac = projectList.FirstOrDefault(p => p.Value == "JisBBAC").Description; var jisbbac_sy = projectList.FirstOrDefault(p => p.Value == "JisBBAC顺义").Description; + + + var jism = projectList.FirstOrDefault(p => p.Value == "MaiDanJianBBAC").Description; + + var maidanhbpo = projectList.FirstOrDefault(p => p.Value == "MaiDanJianHBPO").Description; + + + var jism_sy = projectList.FirstOrDefault(p => p.Value == "MaiDanJianBBAC顺义").Description; + + + var yindujian = projectList.FirstOrDefault(p => p.Value == "YinDuJian").Description; var beijian = projectList.FirstOrDefault(p => p.Value == "BeiJian").Description; if (type == "JisBBAC" || type == "ZhiGongJianBBAC" || type == "MaiDanJianBBAC" || type == "BeiJian" || type == "YinDuJian") @@ -73,13 +84,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs { if (itm.Site == "1040" && string.IsNullOrEmpty(itm.Extend2)) { - itm.Extend2 = jisbbac; + itm.Extend2 = jism; itm.Extend3 = "有结算无发运"; } if (itm.Site == "1046" && string.IsNullOrEmpty(itm.Extend2)) { - itm.Extend2 = jisbbac_sy; + itm.Extend2 = jism_sy; itm.Extend3 = "有结算无发运"; } } @@ -152,7 +163,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs { if (string.IsNullOrEmpty(itm.Extend2)) { - itm.Extend2 = "CC004"; + itm.Extend2 = maidanhbpo; itm.Extend3 = "有结算无发运"; } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs index 5e06c78a..4b7aa76c 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs @@ -58,6 +58,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ return (DateTime.Now - now).TotalMinutes; } + + + + + + + + + + [NonAction] [DisableValidation] public async Task Invoke(IServiceProvider serviceProvider) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index a5a88237..0b4386ec 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -9,6 +9,7 @@ using TaskJob.EventArgs; using Volo.Abp.Application.Services; using Volo.Abp.Uow; using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Entities.Invoices; using Win.Sfs.SettleAccount.Entities.ItemInvoicePrices; using Win.Sfs.SettleAccount.Entities.MaterialRelationships; @@ -20,18 +21,18 @@ using Win.Sfs.SettleAccount.Reports.ReportRequestDto; namespace Win.Sfs.SettleAccount.Reports.ReportServices { - [Authorize(SettleAccountPermissions.Reports.Default)] + [AllowAnonymous] - [Route("api/settleaccount/ReportMakeService")] - public class ReportService : ApplicationService + [Route("api/settleaccount/[controller]/[action]")] + public class ReportService : BASE_SERVICE { - private readonly ISettleAccountBranchEfCoreRepository _invoiceVersionRepository; - private readonly ISettleAccountBranchEfCoreRepository _settleAccountVersionrepository; - private readonly ISettleAccountBranchEfCoreRepository _fisVersionrepository; - private readonly ISettleAccountBranchEfCoreRepository _itemInvoicePriceVersionrepository; - private readonly ISettleAccountBranchEfCoreRepository _relationshipRepository; - private readonly ISettleAccountBranchEfCoreRepository _settlementPartVersionrepository; + //private readonly ISettleAccountBranchEfCoreRepository _invoiceVersionRepository; + //private readonly ISettleAccountBranchEfCoreRepository _settleAccountVersionrepository; + //private readonly ISettleAccountBranchEfCoreRepository _fisVersionrepository; + //private readonly ISettleAccountBranchEfCoreRepository _itemInvoicePriceVersionrepository; + //private readonly ISettleAccountBranchEfCoreRepository _relationshipRepository; + //private readonly ISettleAccountBranchEfCoreRepository _settlementPartVersionrepository; //private readonly ISettleAccountBranchEfCoreRepository _versionRepository; private readonly TaskJobService _service; /// @@ -41,806 +42,26 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices /// 仓储接口 /// 缓存 public ReportService( - ISettleAccountBranchEfCoreRepository invoiceVersionRepository, - ISettleAccountBranchEfCoreRepository settleAccountVersionrepository, - ISettleAccountBranchEfCoreRepository relationshipRepository, - ISettleAccountBranchEfCoreRepository settlementPartVersionrepository, - ISettleAccountBranchEfCoreRepository fisVersionrepository, - ISettleAccountBranchEfCoreRepository itemInvoicePriceVersionrepository, - - IExcelImportAppService excelImportService, - //ISnowflakeIdGenerator snowflakeIdGenerator, - //ICommonManager commonManager, - TaskJobService service + IExcelImportAppService excelImportService, + TaskJobService service ) { - _relationshipRepository = relationshipRepository; - _settlementPartVersionrepository = settlementPartVersionrepository; - _settleAccountVersionrepository = settleAccountVersionrepository; - _invoiceVersionRepository = invoiceVersionRepository; - _fisVersionrepository = fisVersionrepository; - _itemInvoicePriceVersionrepository = itemInvoicePriceVersionrepository; - _service = service; } - - //#region 派格大众看板-备件结算报表 - - ///// - ///// 大众准时化结算门板价格差异比对报表 - ///// - ///// 客户物料号 - ///// 版本 - ///// - ///// 厂内物料号 - ///// 物料组 - ///// - //[HttpPost] - //[Route("SettleDoorPanel")] - //[DisableRequestSizeLimit] - - //public async Task SettleDoorPanel( - // BaseRequestDto input - // ) - //{ - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(input.Version) ? string.Empty : input.Version }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(input.MaterialCode) ? string.Empty : input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = string.IsNullOrEmpty(input.Begin) ? string.Empty : input.Begin }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = string.IsNullOrEmpty(input.End) ? string.Empty : input.End }); - // customConditionList.Add(new CustomCondition() { Name = "Cp7BeginTime", Value = string.IsNullOrEmpty(input.Cp7Begin) ? string.Empty : input.Cp7Begin }); - // customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(input.Cp7End) ? string.Empty : input.Cp7End }); - // customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode }); - // customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(input.ChassisNumber) ? string.Empty : input.ChassisNumber }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - // var _taskid = await _service.ExportEnqueueAsync("准时化结算门板价格差异比对报表", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(SettleDoorPanelExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - ///// - ///// 有条码看板结算核对 - ///// - ///// 看板号 - ///// 厂内零件号 - ///// 版本 - ///// - ///// 客户物料号 - ///// 物料组(车型) - ///// - ///// - ///// - ///// - //[HttpPost] - //[Route("SettleKanBan-WithCode")] - //[DisableRequestSizeLimit] - - //public async Task SettledKanBanWithCode(BaseKanbanReqestDto input) - //{ - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = input.CustomerCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerPartCode", Value = input.CustomerPartCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "State", Value = input.State ?? "0" }); - // customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = input.EstimateTypeDesc ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "有条码看板结算核对" }); - // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.KanBan ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = input.SapMaterialCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = input.Begin ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End ?? string.Empty }); - // var _taskid = await _service.ExportEnqueueAsync("看板结算输出", ExportExtentsion.Excel,input.Version ,string.Empty,CurrentUser, typeof(SettleKBWithCodeExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - - //[HttpPost] - //[Route("SettleKanBan-WithOutCode")] - //[DisableRequestSizeLimit] - - //public async Task SettledKanBanWithOutCode(BaseKanbanReqestDto input) - //{ - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = input.CustomerCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerPartCode", Value = input.CustomerPartCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "State", Value = input.State ?? "0" }); - // customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = input.EstimateTypeDesc ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "有条码看板结算核对" }); - // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.KanBan ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = input.SapMaterialCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = input.Begin ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End ?? string.Empty }); - // var _taskid = await _service.ExportEnqueueAsync("无条码看板结算输出", ExportExtentsion.Excel, input.Version,string.Empty, CurrentUser, typeof(SettleKBWithOutCodeExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - //#region 大众备件0-90天和90天以上输出 - - ///// - ///// 大众备件数据调整结算输出 - ///// - ///// - ///// - ///// - ///// - ///// - ///// - ///// - ///// - ///// - ///// - //[HttpGet] - //[Route("SettleSparePart90Export")] - //[DisableRequestSizeLimit] - - //public async Task SettledSparePart90(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - // string state, DateTime begin, DateTime end) - //{ - - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - // customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); - // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); - - // var _taskid = await _service.ExportEnqueueAsync("大众备件数据调整结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePart90ExportService), customConditionList, (rs) => - // { - - // }); - // return _taskid; - //} - - ///// - ///// 大众备件输出(包括带订货单号和无订单号) - ///// - ///// 采购订单号 - ///// 厂内物料号 - ///// 版本 - ///// - ///// - ///// 物料代码 - ///// - ///// - ///// - ///// - //[HttpGet] - //[Route("SettleSparePartExport")] - //[DisableRequestSizeLimit] - - //public async Task SettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - // string state, DateTime begin, DateTime end) - //{ - - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - // customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); - // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); - - // var _taskid = await _service.ExportEnqueueAsync("大众备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) => - // { - - // }); - // return _taskid; - //} - - ///// - ///// 大众备件未结明细 - ///// - ///// - ///// - ///// - ///// - ///// - ///// - ///// - ///// - ///// - ///// - //[HttpGet] - //[Route("UnSettleSparePartExport")] - //[DisableRequestSizeLimit] - - //public async Task UnSettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - // string state, DateTime begin, DateTime end) - //{ - - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - // customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); - // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); - - // var _taskid = await _service.ExportEnqueueAsync("大众备件未结输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleUnSparePartExportService), customConditionList, (rs) => - // { - - // }); - // return _taskid; - //} - //#endregion - ///// - ///// 无订单备件结算输出 - ///// - ///// 采购订单号 - ///// 厂内物料号 - ///// 版本 - ///// - ///// - ///// 物料代码 - ///// - ///// - ///// - ///// - //[HttpGet] - //[Route("SettleSparePartExportExtend")] - //[DisableRequestSizeLimit] - - //public async Task SettledSparePartExtend(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - // string state, DateTime begin, DateTime end) - //{ - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - // customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? "0" }); - // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); - // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); - // var _taskid = await _service.ExportEnqueueAsync("无订单备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) => - // { - - // }); - // return _taskid; - //} - //#endregion - - [HttpGet] - [Route("SharePartUnSettledExport")] - [DisableRequestSizeLimit] - - public async Task SharePartUnSettled(string sapCode, string version, - DateTime begin, DateTime end) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); - var _taskid = await _service.ExportEnqueueAsync("备件未结明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SharePartUnSettledExport), customConditionList, (rs) => - { - - }).ConfigureAwait(false); - return _taskid; - } - - ///// - ///// 结算总成和ERP总成价格对比 - ///// - ///// 上传的文件(前端已经限制只能上传一个附件) - ///// - //[HttpGet] - //[Route("BomDiffPrice-Make")] - //[DisableRequestSizeLimit] - - //public async Task SettledPartAndErpPartPriceDiffMake(string version, string customerCode) - //{ - - // //if (!_relationshipRepository.Any(p => p.Version == version && p.CustomerCode == customerCode)) - // //{ - // // throw new BusinessException("8989", string.Format("不存总成与结算件零件关系{0}期间", version)); - // //} - // //if (!_settlementPartVersionrepository.Any(p => p.Version == version && p.CustomerCode == customerCode)) - // //{ - // // throw new BusinessException("8989", string.Format("不存结算包价格{0}期间", version)); - // //} - - // List customConditionList = new List(); - - // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "Bom定价差异明细" }); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(version) ? string.Empty : version }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.IsNullOrEmpty(customerCode)?string.Empty: customerCode }); - - // var _taskid = await _service.ExportEnqueueAsync("Bom定价差异明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) => - // { - - // }); - // return _taskid; - //} - - /// - /// 看板未结输出 - /// - /// - /// - /// - /// - /// - /// - [HttpGet] - [Route("KanbanUnSettledExport")] - [DisableRequestSizeLimit] - - public async Task KanbanUnSettled(string sapCode, string version, - DateTime begin, DateTime end, string materialGroup, string matialCode, string isContainVersion) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = materialGroup }); - customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = isContainVersion }); - var _taskid = await _service.ExportEnqueueAsync("看板未结明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(KanBanUnSettledExport), customConditionList, (rs) => - { - - }).ConfigureAwait(false); - return _taskid; - } - - /// - /// 1.大众发票与结算核对汇总表 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpGet] - [Route("InvoiceSettledDiff-Make")] - [DisableRequestSizeLimit] - - public async Task InvoiceSettledDiffMake( - string year, string period, string version, string sapCode, string customerCode, string factory, string matialCode, string state - ) - { - - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = sapCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与开票数据对比" }); - customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() }); - var _taskid = await _service.ExportEnqueueAsync("发票与结算核对汇总表", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(InvoiceSettledDiffExportService), customConditionList, (rs) => - { - - }).ConfigureAwait(false); - return _taskid; - } - /// - ///发票与结算核对明细表 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("VersionSum")] - [DisableRequestSizeLimit] - - public async Task VersionSumMake( - BaseRequestDto request - ) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(request.Version) ? string.Empty : request.Version }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(request.MaterialCode) ? string.Empty : request.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = string.IsNullOrEmpty(request.Begin) ? string.Empty : request.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = string.IsNullOrEmpty(request.End) ? string.Empty : request.End }); - customConditionList.Add(new CustomCondition() { Name = "Cp7BeginTime", Value = string.IsNullOrEmpty(request.Cp7Begin) ? string.Empty : request.Cp7Begin }); - customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(request.Cp7End) ? string.Empty : request.Cp7End }); - customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(request.Kenncode) ? string.Empty : request.Kenncode }); - customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(request.ChassisNumber) ? string.Empty : request.ChassisNumber }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(request.SapCode) ? string.Empty : request.SapCode }); - var _taskid = await _service.ExportEnqueueAsync("", ExportExtentsion.Excel, request.Version, string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup, CurrentUser, typeof(InvoiceSettledDetailDiffExportService), customConditionList, (rs) => - { - }).ConfigureAwait(false); - return _taskid; - } - - /// - ///发票与结算核对明细表 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// [HttpPost] - [Route("InvoiceSettledDetailDiff-Make")] [DisableRequestSizeLimit] - [UnitOfWork(IsDisabled = false)] - public async Task InvoiceSettledDetailDiffMake( - BaseRequestDto request - ) + public async Task GetBalance(string p_year) { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(request.Version) ? string.Empty : request.Version }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(request.MaterialCode) ? string.Empty : request.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = string.IsNullOrEmpty(request.Begin) ? string.Empty : request.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = string.IsNullOrEmpty(request.End) ? string.Empty : request.End }); - customConditionList.Add(new CustomCondition() { Name = "Cp7BeginTime", Value = string.IsNullOrEmpty(request.Cp7Begin) ? string.Empty : request.Cp7Begin }); - customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(request.Cp7End) ? string.Empty : request.Cp7End }); - customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(request.Kenncode) ? string.Empty : request.Kenncode }); - customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(request.ChassisNumber) ? string.Empty : request.ChassisNumber }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(request.SapCode) ? string.Empty : request.SapCode }); - - var _taskid = await _service.ExportEnqueueAsync("准时化结算核对明细", ExportExtentsion.Excel, request.Version, string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup, CurrentUser, typeof(InvoiceSettledDetailDiffExportService), customConditionList, (rs) => + customConditionList.Add(new CustomCondition() { Name = "Year", Value = p_year ?? DateTime.Now.Year.ToString() }); + var _taskid = await _service.ExportEnqueueAsync("库存余额汇总", ExportExtentsion.Excel, p_year, string.Empty, CurrentUser, typeof(SharePartUnSettledExport), customConditionList, (rs) => { - }).ConfigureAwait(false); - return _taskid; - } - /// - ///3.准时化结算数量差异比对表 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("UnInvoiceSettledDetailDiff-Make")] - [DisableRequestSizeLimit] - [UnitOfWork(IsDisabled = false)] - public async Task UnInvoiceSettledDetailDiffMake( - BaseRequestDto request - ) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(request.Version) ? string.Empty : request.Version }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(request.MaterialCode) ? string.Empty : request.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = string.IsNullOrEmpty(request.Begin) ? string.Empty : request.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = string.IsNullOrEmpty(request.End) ? string.Empty : request.End }); - customConditionList.Add(new CustomCondition() { Name = "Cp7BeginTime", Value = string.IsNullOrEmpty(request.Cp7Begin) ? string.Empty : request.Cp7Begin }); - customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(request.Cp7End) ? string.Empty : request.Cp7End }); - customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(request.Kenncode) ? string.Empty : request.Kenncode }); - customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(request.ChassisNumber) ? string.Empty : request.ChassisNumber }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(request.SapCode) ? string.Empty : request.SapCode }); - var _taskid = await _service.ExportEnqueueAsync("准时化结算数量差异比对输出", ExportExtentsion.Excel, request.Version, string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup, CurrentUser, typeof(UnInvoiceSettledDetailDiffExportService), customConditionList, (rs) => - { }).ConfigureAwait(false); return _taskid; } - /// - /// 准时化未结明细表(包含漏结,漏结要有标识) - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("UnsettledDetailReportService-Make")] - [DisableRequestSizeLimit] - [UnitOfWork(IsDisabled = false)] - public async Task UnsettledDetailReportServiceMake( - - BaseRequestDto input - - ) - { - - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = !string.IsNullOrEmpty(input.Version) ? input.Version : string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(input.MaterialCode) ? input.MaterialCode : string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = !string.IsNullOrEmpty(input.MaterialGroup) ? input.MaterialGroup : string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "Begin", Value = string.IsNullOrEmpty(input.Begin) ? string.Empty : input.Begin }); - customConditionList.Add(new CustomCondition() { Name = "End", Value = string.IsNullOrEmpty(input.End) ? string.Empty : input.End }); - customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode }); - customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(input.ChassisNumber) ? string.Empty : input.ChassisNumber }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - var _taskid = await _service.ExportEnqueueAsync("准时化未结明细表", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(UnsettledDetailReportService), customConditionList, (rs) => - { - }).ConfigureAwait(false); - return _taskid; - } - - /// - ///准时化未结差异比对表 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("UnSettleDiffExport-Make")] - [DisableRequestSizeLimit] - public async Task UnSettleDiffExportServiceMake( - BaseRequestDto input - ) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode }); - customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(input.ChassisNumber) ? string.Empty : input.ChassisNumber }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - var _taskid = await _service.ExportEnqueueAsync("准时化未结差异比对输出", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(UnSettleDiffExportService), customConditionList, (rs) => - { - }).ConfigureAwait(false); - return _taskid; - } - - /// - ///统计汇总表 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("WmsOutputSumExport-Make")] - [DisableRequestSizeLimit] - public async Task WmsOutputSumExport( - BaseRequestDto input - ) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = string.IsNullOrEmpty(input.State) ? string.Empty : input.State }); - var _taskid = await _service.ExportEnqueueAsync("出库单合计汇总输出", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(WmsOutputSumExportService), customConditionList, (rs) => - { - }).ConfigureAwait(false); - return _taskid; - - } - - ///// - ///// 结算总成和ERP总成价格对比 - ///// - ///// 上传的文件(前端已经限制只能上传一个附件) - ///// - //[HttpGet] - //[Route("SettledPartAndErpPartPriceDiff-Make")] - //[DisableRequestSizeLimit] - - //public async Task SettledPartAndErpPartPriceDiffMake( string version, string customerCode) - //{ - - // if (!_relationshipRepository.Any(p => p.Version == version && p.CustomerCode == customerCode)) - // { - // throw new BusinessException("8989", string.Format("不存总成与结算件零件关系{0}期间", version)); - // } - // if (!_settlementPartVersionrepository.Any(p => p.Version == version && p.CustomerCode == customerCode)) - // { - // throw new BusinessException("8989", string.Format("不存结算包价格{0}期间", version)); - // } - - // List customConditionList = new List(); - - // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算总成和ERP总成价格对比" }); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version??string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode }); - // var _taskid = await _service.ExportEnqueueAsync("结算总成和ERP总成价格对比", ExportExtentsion.Excel,version,string.Empty,CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - - ///// - ///// 结算总成和ERP总成价格对比 - ///// - ///// 上传的文件(前端已经限制只能上传一个附件) - ///// - //[HttpGet] - //[Route("SecMatchBaseMake-Make")] - //[DisableRequestSizeLimit] - - //public async Task SecMatchBaseMake(string version) - //{ - - // if (!_relationshipRepository.Any(p => p.Version == version )) - // { - // throw new BusinessException("8989", string.Format("不存总成与结算件零件关系{0}期间", version)); - // } - // //if (!_settlementPartVersionrepository.Any(p => p.Version == version && p.CustomerCode == customerCode)) - // //{ - // // throw new BusinessException("8989", string.Format("不存结算包价格{0}期间", version)); - // //} - - // List customConditionList = new List(); - - // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "二配当月结算表" }); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - // //customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode }); - // var _taskid = await _service.ExportEnqueueAsync("二配当月结算表", ExportExtentsion.Excel, CurrentUser, typeof(SecMatchBaseExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - - //#region 红旗、一汽轿车的输出报表 - - ///// - /////红旗工厂核对明细 - ///// - ///// 上传的文件(前端已经限制只能上传一个附件) - ///// - //[HttpPost] - //[Route("HQHSettledDetailDiffExportService")] - //[DisableRequestSizeLimit] - //[UnitOfWork(IsDisabled = false)] - //public async Task HQHSettledDetailDiffExportServiceMake( - // HQKanbanRequestDto input - // ) - //{ - - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); - // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); - // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - // var _taskid = await _service.ExportEnqueueAsync("红旗工厂核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSettledDetailDiffExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - - ///// - /////红旗工厂未结明细 - ///// - ///// 上传的文件(前端已经限制只能上传一个附件) - ///// - //[HttpPost] - //[Route("HQHUnSettledDetailDiffExportService")] - //[DisableRequestSizeLimit] - //public async Task HQHUnSettledDetailDiffExportServiceMake( - // HQKanbanRequestDto input - // ) - //{ - - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); - // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); - // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - // customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = input.IsContainVersion }); - // var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHUnSettledDetailDiffExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - - ///// - /////红旗未结核对 - ///// - ///// 上传的文件(前端已经限制只能上传一个附件) - ///// - //[HttpPost] - //[Route("HQFactoryUnSettledDetailDiffExportService")] - //[DisableRequestSizeLimit] - //public async Task HQFactoryUnSettledDetailDiffExportService( - // HQKanbanRequestDto input - // ) - //{ - - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); - // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); - // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - // customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = input.IsContainVersion }); - // var _taskid = await _service.ExportEnqueueAsync("红旗未结核对", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQFactoryUnSettledDetailDiffExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - - ///// - ///// 红旗工厂备件明细 - ///// - ///// - ///// - //[HttpPost] - //[Route("HQHSharePartSettledDetailDiffExportService")] - //[DisableRequestSizeLimit] - //public async Task HQHSharePartSettledDetailDiffExportServiceMake( - // HQKanbanRequestDto input - // ) - //{ - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - - // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); - // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); - // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - // var _taskid = await _service.ExportEnqueueAsync("H平台备件核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSharePartSettledDetailDiffExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - - //[HttpPost] - //[Route("FisUpdateExportService")] - //[DisableRequestSizeLimit] - //[UnitOfWork(isTransactional: false)] - //public async Task FisUpdateExportServiceMake( - // HQKanbanRequestDto input - // ) - //{ - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - // var _taskid = await _service.ExportEnqueueAsync("Fis发货数据更新状态", ExportExtentsion.Excel, input.Version, null, CurrentUser, typeof(FisUpdateExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - - ///// - ///// 结算未结寄售核对表 - ///// - ///// 上传的文件(前端已经限制只能上传一个附件) - ///// - //[HttpPost] - //[Route("UnSettledSum-Make")] - //[DisableRequestSizeLimit] - //[UnitOfWork(IsDisabled = false)] - //public async Task UnSettledSumServiceMake( - - // BaseRequestDto input - - // ) - //{ - - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = !string.IsNullOrEmpty(input.Version) ? input.Version : string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(input.MaterialCode) ? input.MaterialCode : string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = !string.IsNullOrEmpty(input.MaterialGroup) ? input.MaterialGroup : string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = string.Empty }); - // customConditionList.Add(new CustomCondition() { Name = "Begin", Value = string.IsNullOrEmpty(input.Begin) ? string.Empty : input.Begin }); - // customConditionList.Add(new CustomCondition() { Name = "End", Value = string.IsNullOrEmpty(input.End) ? string.Empty : input.End }); - // customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode }); - // customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(input.ChassisNumber) ? string.Empty : input.ChassisNumber }); - // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - // var _taskid = await _service.ExportEnqueueAsync("结算未结寄售核对表", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(UnSettledSumService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} - - //#endregion + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs new file mode 100644 index 00000000..7df5de5a --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs @@ -0,0 +1,373 @@ +using System.Collections.Generic; +using System.Linq; +using Dapper; +using Magicodes.ExporterAndImporter.Core; +using SettleAccount.Domain.BQ; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories.Dapper; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Uow; +using Win.Sfs.SettleAccount.Entities.BQ.Temp; + +namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report +{ + public class Meta + { + public class SettleInvoiceDiff + { + + + [ExporterHeader(DisplayName = "零件号", IsBold = true)] + public string MaterialCode { set; get; } + [ExporterHeader(DisplayName = "零件名称", IsBold = true)] + public string MaterialDesc { set; get; } + + + + [ExporterHeader(DisplayName = "全年发票合计", IsBold = true)] + public string SumInvoice { set; get; } + [ExporterHeader(DisplayName = "全年结算合计", IsBold = true)] + public string SumSettle { set; get; } + [ExporterHeader(DisplayName = "全年合计差异", IsBold = true)] + public string SumDiff { set; get; } + + + + [ExporterHeader(DisplayName = "1月发票", IsBold = true)] + public string January { set; get; } + [ExporterHeader(DisplayName = "1月结算", IsBold = true)] + public string SettleJanuary { set; get; } + + [ExporterHeader(DisplayName = "2月发票", IsBold = true)] + public string InvoiceFebruary { set; get; } + + [ExporterHeader(DisplayName = "2月结算", IsBold = true)] + public string SettleFebruary { set; get; } + + + + + + [ExporterHeader(DisplayName = "3月发票", IsBold = true)] + public string InvoiceMarch { set; get; } + + [ExporterHeader(DisplayName = "3月结算", IsBold = true)] + public string SettleMarch { set; get; } + + [ExporterHeader(DisplayName = "4月发票", IsBold = true)] + public string InvoiceApril { set; get; } + [ExporterHeader(DisplayName = "4月结算", IsBold = true)] + public string SettleApril { set; get; } + + [ExporterHeader(DisplayName = "5月发票", IsBold = true)] + public string InvoiceMay { set; get; } + + [ExporterHeader(DisplayName = "5月结算", IsBold = true)] + public string SettleMay { set; get; } + + [ExporterHeader(DisplayName = "6月发票", IsBold = true)] + public string InvoiceJune { set; get; } + [ExporterHeader(DisplayName = "6月结算", IsBold = true)] + public string SettleJune { set; get; } + + + [ExporterHeader(DisplayName = "7月发票", IsBold = true)] + public string InvoiceJuly { set; get; } + + [ExporterHeader(DisplayName = "7月结算", IsBold = true)] + public string SettleJuly { set; get; } + + + + [ExporterHeader(DisplayName = "8月发票", IsBold = true)] + public string InvoiceAugust { set; get; } + + [ExporterHeader(DisplayName = "8月结算", IsBold = true)] + public string SettleAugust { set; get; } + + + + + [ExporterHeader(DisplayName = "9月发票", IsBold = true)] + public string InvoiceSeptember { set; get; } + + [ExporterHeader(DisplayName = "9月结算", IsBold = true)] + public string SettleSeptember { set; get; } + + + + + + [ExporterHeader(DisplayName = "10月发票", IsBold = true)] + public string InvoiceOctober { set; get; } + + + + [ExporterHeader(DisplayName = "10月结算", IsBold = true)] + public string SettleOctober { set; get; } + + + + + [ExporterHeader(DisplayName = "11月发票", IsBold = true)] + public string InvoiceNovember { set; get; } + + [ExporterHeader(DisplayName = "11月结算", IsBold = true)] + + public string DiffNovember { set; get; } + + [ExporterHeader(DisplayName = "12月发票", IsBold = true)] + public string InvoiceDecember { set; get; } + [ExporterHeader(DisplayName = "12月结算", IsBold = true)] + public string SettleDecember { set; get; } + + + + + + } + + } + + + + /// + /// 2.大众发票与结算核对明细表-准时化 + /// + public class BalanceSumDapperRepository : DapperRepository, ITransientDependency + { + public BalanceSumDapperRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + /// + /// 获取库存余额汇总 + /// + /// + /// + public virtual object GetBalanceSum(string p_year) + { + var sql = "declare @lastyear as varchar(50)\n" + + "declare @lastTime as varchar(50)\n" + + "declare @BeforeYear as varchar(50)\n" + + "Set @lastyear='{0}'\n" + + "Set @BeforeYear=CAST(@lastyear as int)-1\n" + + "Set @lastTime=dateadd(ms,-3,DATEADD(yy,DATEDIFF(yy,0,@lastyear+'01'+'01')+1, 0))\n" + + "select * into #temp_js from (\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'01' version1 from (\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@BeforeYear+'-12-26 08:00:00' AND BillTime<=@lastyear+'-01-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'02' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-01-26 08:00:00' AND BillTime<=@lastyear+'-02-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'03' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-02-26 08:00:00' AND BillTime<=@lastyear+'-03-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'04' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-03-26 08:00:00' AND BillTime<=@lastyear+'-04-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'05' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-04-26 08:00:00' AND BillTime<=@lastyear+'-05-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'06' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-05-26 08:00:00' AND BillTime<=@lastyear+'-06-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'07' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-06-26 08:00:00' AND BillTime<=@lastyear+'-07-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'09' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-07-26 08:00:00' AND BillTime<=@lastyear+'-08-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'09' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-08-26 08:00:00' AND BillTime<=@lastyear+'-09-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "union all\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'10' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-09-26 08:00:00' AND BillTime<=@lastyear+'-10-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "union all\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'11' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-10-26 08:00:00' AND BillTime<=@lastyear+'-11-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "union all\n" + + "select sum(changedQty) changedqty,RealPartCode,ErpToLoc,@lastyear+'12' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-11-26 08:00:00' AND BillTime<=@lastyear+'-12-26 07:59:59' and (LogType>200 OR LogType<200)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "union all\n" + + "select sum(changedQty) changedqty,RealPartCode,ErpToLoc, version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc,FORMAT(BillTime,'yyyyMM') version1\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where LogType=200\n" + + ") a group by RealPartCode,ErpToLoc,version1\n" + + ") temp\n" + + "PIVOT ( SUM( changedqty )\n" + + "FOR VERSION1 IN ([{0}01],[{0}02],[{0}03],[{0}04],[{0}05],[{0}06],[{0}07],[{0}08],[{0}09],[{0}10],[{0}11],[{0}12]) ) b\n" + + "select * into #temp_bh from (\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'01' version1 from (\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@BeforeYear+'-12-26 08:00:00' AND BillTime<=@lastyear+'-01-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'02' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-01-26 08:00:00' AND BillTime<=@lastyear+'-02-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'03' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-02-26 08:00:00' AND BillTime<=@lastyear+'-03-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'04' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-03-26 08:00:00' AND BillTime<=@lastyear+'-04-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'05' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-04-26 08:00:00' AND BillTime<=@lastyear+'-05-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'06' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-05-26 08:00:00' AND BillTime<=@lastyear+'-06-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'07' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-06-26 08:00:00' AND BillTime<=@lastyear+'-07-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'08' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-07-26 08:00:00' AND BillTime<=@lastyear+'-08-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "UNION ALL\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'09' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-08-26 08:00:00' AND BillTime<=@lastyear+'-09-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "union all\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'10' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-09-26 08:00:00' AND BillTime<=@lastyear+'-10-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "union all\n" + + "select sum(changedQty) ChangedQty,RealPartCode,ErpToLoc,@lastyear+'11' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-10-26 08:00:00' AND BillTime<=@lastyear+'-11-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "union all\n" + + "select sum(changedQty) changedqty,RealPartCode,ErpToLoc,@lastyear+'12' version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where BillTime>=@lastyear+'-11-26 08:00:00' AND BillTime<=@lastyear+'-12-26 07:59:59' and (LogType=500)\n" + + ") a group by RealPartCode,ErpToLoc\n" + + "union all\n" + + "select sum(changedQty) changedqty,RealPartCode,ErpToLoc, version1 from\n" + + "(\n" + + "SELECT ChangedQty,RealPartCode,ErpToLoc,FORMAT(BillTime,'yyyyMM') version1\n" + + "FROM [BQ_SA].[dbo].[Set_VmiLog] where LogType=200 and ReMark ='有结算无发运'\n" + + ") a group by RealPartCode,ErpToLoc,version1\n" + + ") temp\n" + + "\n" + + "PIVOT ( SUM( changedqty )\n" + + "FOR VERSION1 IN ([{0}01],[{0}02],[{0}03],[{0}04],[{0}05],[{0}06],[{0}07],[{0}08],[{0}09],[{0}10],[{0}11],[{0}12]) ) b\n" + + "select\n" + + "isnull(a.ErpToLoc,b.ErpToLoc) ErpToLoc,\n" + + "Isnull(b.RealPartCode,a.RealPartCode) RealPartCode,\n" + + "isnull(a.[{0}01],0)+\n" + + "isnull(a.[{0}02],0)+\n" + + "isnull(a.[{0}03],0)+\n" + + "isnull(a.[{0}04],0)+\n" + + "isnull(a.[{0}05],0)+\n" + + "isnull(a.[{0}06],0)+\n" + + "isnull(a.[{0}07],0)+\n" + + "isnull(a.[{0}08],0)+\n" + + "isnull(a.[{0}09],0)+\n" + + "isnull(a.[{0}10],0)+\n" + + "isnull(a.[{0}11],0)+\n" + + "isnull(a.[{0}12],0) 库存余额数量,\n" + + "isnull(b.[{0}01],0) +\n" + + "isnull(b.[{0}02],0) +\n" + + "isnull(b.[{0}03],0) +\n" + + "isnull(b.[{0}04],0) +\n" + + "isnull(b.[{0}05],0) +\n" + + "isnull(b.[{0}06],0) +\n" + + "isnull(b.[{0}07],0) +\n" + + "isnull(b.[{0}08],0) +\n" + + "isnull(b.[{0}09],0) +\n" + + "isnull(b.[{0}10],0) +\n" + + "isnull(b.[{0}11],0) +\n" + + "isnull(b.[{0}12],0) 有结无发合计,\n" + + "isnull(a.[{0}01],0) [{0}01],isnull(b.[{0}01],0) [有结无发],\n" + + "isnull(a.[{0}02],0) [{0}02],isnull(b.[{0}02],0) [有结无发],\n" + + "isnull(a.[{0}03],0) [{0}03],isnull(b.[{0}03],0) [有结无发],\n" + + "isnull(a.[{0}04],0) [{0}04],isnull(b.[{0}04],0) [有结无发],\n" + + "isnull(a.[{0}05],0) [{0}05],isnull(b.[{0}05],0) [有结无发],\n" + + "isnull(a.[{0}06],0) [{0}06],isnull(b.[{0}06],0) [有结无发],\n" + + "isnull(a.[{0}07],0) [{0}07],isnull(b.[{0}07],0) [有结无发],\n" + + "isnull(a.[{0}08],0) [{0}08],isnull(b.[{0}08],0) [有结无发],\n" + + "isnull(a.[{0}09],0) [{0}09],isnull(b.[{0}09],0) [有结无发],\n" + + "isnull(a.[{0}10],0) [{0}10],isnull(b.[{0}10],0) [有结无发],\n" + + "isnull(a.[{0}11],0) [{0}11],isnull(b.[{0}11],0) [有结无发],\n" + + "isnull(a.[{0}12],0) [{0}12],isnull(b.[{0}12],0) [有结无发] \n" + + "from #temp_js a full join #temp_bh b on a.ErpToLoc=b.ErpToLoc and a.RealPartCode=b.RealPartCode\n" + + "drop table #temp_js\n" + + "drop table #temp_bh\n"; + + + + var query = string.Format(sql, p_year); + + var list = DbConnection.Query(query,null,null,false,1200,null); + + + return ""; + } + + + } +} + diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/PD_SERVICE.cs index b8ea761f..58bb4c09 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/PD_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/PD_SERVICE.cs @@ -13,13 +13,13 @@ namespace SettleAccount.Job.Services { public class PD_SERVICE : ITransientDependency, IExportJob { - private readonly PendingDeductionDapperRepository _dapper; + private readonly BalanceSumDapperRepository _dapper; //private readonly BBAC_PD_MNG _pdmng; readonly IServiceProvider _serviceProvider; public PD_SERVICE( - PendingDeductionDapperRepository dapper, + BalanceSumDapperRepository dapper, //BBAC_PD_MNG pdmng, IServiceProvider serviceProvider @@ -41,68 +41,68 @@ namespace SettleAccount.Job.Services public string ExportFile(Guid id, List exportName, List customConditions) { - var invgroup = customConditions.Where(p => p.Name == "InvGroupNum").FirstOrDefault().Value;//获取发票分 - var ls = _dapper.GetInvoiceList(invgroup); - if (ls != null && ls.Count > 0) - { - var first = ls.FirstOrDefault(); - if (first.BusinessType == EnumBusinessType.JisHBPO) - { - var pd = _dapper.GenerationPendingDeductionHBPO(invgroup); - if (pd.Count > 0) - { - foreach (var c in pd) - { - var main = c.Key; - var detail = c.Value; - //_invRepository.GetDbContext().BulkInsert(new List() { main }); - //_invRepository.GetDbContext().BulkInsert(detail); - } - } - else - { + //var invgroup = customConditions.Where(p => p.Name == "InvGroupNum").FirstOrDefault().Value;//获取发票分 + //var ls = _dapper.GetInvoiceList(invgroup); + //if (ls != null && ls.Count > 0) + //{ + // var first = ls.FirstOrDefault(); + // if (first.BusinessType == EnumBusinessType.JisHBPO) + // { + // var pd = _dapper.GenerationPendingDeductionHBPO(invgroup); + // if (pd.Count > 0) + // { + // foreach (var c in pd) + // { + // var main = c.Key; + // var detail = c.Value; + // //_invRepository.GetDbContext().BulkInsert(new List() { main }); + // //_invRepository.GetDbContext().BulkInsert(detail); + // } + // } + // else + // { - } - } - else if (first.BusinessType == EnumBusinessType.JisBBAC) - { - var pd = _dapper.GenerationPendingDeductionBBAC(invgroup); - if (pd.Count > 0) - { - foreach (var c in pd) - { - var main = c.Key; - var detail = c.Value; + // } + // } + // else if (first.BusinessType == EnumBusinessType.JisBBAC) + // { + // var pd = _dapper.GenerationPendingDeductionBBAC(invgroup); + // if (pd.Count > 0) + // { + // foreach (var c in pd) + // { + // var main = c.Key; + // var detail = c.Value; - //_pdmng.InsertDetail(detail); - //_pdmng.InsertMain(main); - } - } - else - { + // //_pdmng.InsertDetail(detail); + // //_pdmng.InsertMain(main); + // } + // } + // else + // { - } + // } - } - else - { - var pd = _dapper.GenerationPendingDeductionPUB(invgroup); - if (pd.Count > 0) - { - foreach (var c in pd) - { - var main = c.Key; - var detail = c.Value; - //_invRepository.DbContext.BulkInsert(new List() { main }); - //_invRepository.DbContext.BulkInsert(detail); - } - } - else - { + // } + // else + // { + // var pd = _dapper.GenerationPendingDeductionPUB(invgroup); + // if (pd.Count > 0) + // { + // foreach (var c in pd) + // { + // var main = c.Key; + // var detail = c.Value; + // //_invRepository.DbContext.BulkInsert(new List() { main }); + // //_invRepository.DbContext.BulkInsert(detail); + // } + // } + // else + // { - } - } - } + // } + // } + //} return id.ToString(); }