diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs new file mode 100644 index 00000000..3a581541 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs @@ -0,0 +1,131 @@ +using Dapper; +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories.Dapper; +using Volo.Abp.EntityFrameworkCore; +using Win.Sfs.SettleAccount.Reports; + +namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report +{ + public class UnSettleDiff: ReportDetailBase + { + [ExporterHeader(DisplayName = "结算平台未结数量")] + public decimal Qty { set; get; } + [ExporterHeader(DisplayName = "大众R3未结数量")] + public decimal UNSettleQty { set; get; } + [ExporterHeader(DisplayName = "定价")] + public decimal Price { set; get; } + [ExporterHeader(DisplayName = "金额")] + public decimal Amt { set; get; } + [ExporterHeader(DisplayName = "差异")] + public decimal DiffQty { set; get; } + [ExporterHeader(DisplayName = "差异金额")] + public decimal DiffAmt { set; get; } + + //交货单号 实际发货日期 KENN号 底盘号 底盘格式整理 M100交货状态 物料号 物料描述 客户物料 组件组物料 组件组物料描述 物料组(车型) 结算平台未结数量 定价 金额 大众R3未结数量 差异 差异金额 + + + + } + public class UnSettleDiffDapperRepository : DapperRepository, ITransientDependency + { + public UnSettleDiffDapperRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + + } + + public virtual List GetDiffReport(int type,string year, string begin, string end, string materialCode, string sapCode) + { + + + string str1 = "where 1=1 "; + +string sql1 = "SELECT\n" + + +" a.MaterialCode,\n" + +" a.KENNCode,\n" + +" a.ChassisNumber,\n" + +" a.qty unsettleQty,\n" + +" b.qty \n" + +" a.Cp5Time \n"+ + +"FROM\n" + +" Set_unsettle a\n" + +" LEFT JOIN (\n" + +" SELECT\n" + +" ItemCode,\n" + +" KENNCode,\n" + +" ChassisNumber2,\n" + +" sum( qty ) qty \n" + +" FROM\n" + +" Set_fis \n" + +" WHERE\n" + +" state = 0 \n" + +" OR state = 4 \n" + +" GROUP BY\n" + +" ItemCode,\n" + +" KENNCode,\n" + +" ChassisNumber2 \n" + +" ) b ON a.ChassisNumber = b.ChassisNumber2 \n" + +" AND a.MaterialCode = b.ItemCode \n" + +" AND a.KENNCode = b.KENNCode {0}"; + + + + string sql2 = + "SELECT\n" + + " a.*,\n" + + " b.Qty unsettleQty \n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " WMSState,\n" + + " WMSBillNum,\n" + + " ItemCode,\n" + + " KENNCode,\n" + + " ChassisNumber2,\n" + + " sum( qty ) qty,\n" + + " ErpMaterialCode,\n" + + " ChassisNumber \n" + + " FROM\n" + + " Set_fis \n" + + " WHERE\n" + + " state = 0 \n" + + " GROUP BY\n" + + " ItemCode,\n" + + " KENNCode,\n" + + " ChassisNumber2,\n" + + " WMSState,\n" + + " WMSBillNum,\n" + + " ErpMaterialCode,\n" + + " ChassisNumber \n" + + " Cp5Time \n" + + " ) a\n" + + " LEFT JOIN Set_unsettle b ON a.ChassisNumber2 = b.ChassisNumber \n" + + " AND b.MaterialCode = a.ItemCode \n" + + " AND a.KENNCode = b.KENNCode {0}"; + + + string _sql = string.Empty; + if (type == 1 ) + { + _sql = string.Format(sql2, str1); + + } + else + { + _sql = string.Format(sql1, str1); + + } + + var _query = DbConnection.Query(_sql); + return _query.ToList(); + + } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs new file mode 100644 index 00000000..f21311c3 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TaskJob.EventArgs; +using TaskJob.Interfaces; +using Volo.Abp.DependencyInjection; +using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; + +namespace SettleAccount.Job.Services.Report +{ + public class UnSettleDiffExportService : ITransientDependency, IExportJob + { + private readonly UnSettleDiffDapperRepository _dapper; + private readonly OutputService _outputService; + + public UnSettleDiffExportService(UnSettleDiffDapperRepository dapper, OutputService outputService) + { + _dapper = dapper; + _outputService = outputService; + } + + public string ExportFile(Guid id, List exportName, List p_list) + { + var type = p_list.Where(p => p.Name == "Type").FirstOrDefault().Value; + var year = p_list.Where(p => p.Name == "Year").FirstOrDefault().Value; + var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value; + var sapCode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value; + + var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value; + var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; + + var _first = exportName.FirstOrDefault(); + var _ls = new List(); + _ls = _dapper.GetDiffReport(int.Parse(type),year,beginTime,endTime, materialCode,sapCode); + var _id = Guid.NewGuid(); + + + + + List _lsExport = new List(); + //foreach (var itm in _ls) + //{ + // var dto = new FISExportDto() + // { + // ChassisNumber = itm.ChassisNumber, + // ChassisNumber2 = itm.ChassisNumber2, + // CP5Time = itm.CP5Time, + // ItemCode = itm.ItemCode, + // CP7Time = itm.CP7Time, + // KENNCode = itm.KENNCode, + // OrderBillNum = itm.OrderBillNum, + // //Model = itm.Model, + // SequenceNumber = itm.SequenceNumber, + // ErpMaterialCode = itm.ErpMaterialCode, + // SettledQty = itm.SettledQty, + // //State = itm.State, + // Qty = itm.Qty, + // Version = itm.Version, + + // }; + + + + + + + // _lsExport.Add(dto); + //} + _outputService.Export(id, _first, _lsExport); + return id.ToString(); + } + } +} diff --git a/src/Shared/Win.Abp.Snowflakes/obj/Debug/netcoreapp5/Win.Abp.Snowflakes.csproj.AssemblyReference.cache b/src/Shared/Win.Abp.Snowflakes/obj/Debug/netcoreapp5/Win.Abp.Snowflakes.csproj.AssemblyReference.cache index f5e894ae..45b1455d 100644 Binary files a/src/Shared/Win.Abp.Snowflakes/obj/Debug/netcoreapp5/Win.Abp.Snowflakes.csproj.AssemblyReference.cache and b/src/Shared/Win.Abp.Snowflakes/obj/Debug/netcoreapp5/Win.Abp.Snowflakes.csproj.AssemblyReference.cache differ diff --git a/src/Shared/Win.Sfs.Shared/obj/Debug/netcoreapp5/Win.Sfs.Shared.csproj.AssemblyReference.cache b/src/Shared/Win.Sfs.Shared/obj/Debug/netcoreapp5/Win.Sfs.Shared.csproj.AssemblyReference.cache index 5875492b..5ca9bbba 100644 Binary files a/src/Shared/Win.Sfs.Shared/obj/Debug/netcoreapp5/Win.Sfs.Shared.csproj.AssemblyReference.cache and b/src/Shared/Win.Sfs.Shared/obj/Debug/netcoreapp5/Win.Sfs.Shared.csproj.AssemblyReference.cache differ diff --git a/src/Shared/Win.Utils/obj/Debug/netcoreapp5/Win.Utils.csproj.AssemblyReference.cache b/src/Shared/Win.Utils/obj/Debug/netcoreapp5/Win.Utils.csproj.AssemblyReference.cache index f5e894ae..5624f718 100644 Binary files a/src/Shared/Win.Utils/obj/Debug/netcoreapp5/Win.Utils.csproj.AssemblyReference.cache and b/src/Shared/Win.Utils/obj/Debug/netcoreapp5/Win.Utils.csproj.AssemblyReference.cache differ