44673626
3 years ago
8 changed files with 498 additions and 11 deletions
@ -0,0 +1,114 @@ |
|||||
|
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; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report |
||||
|
{ |
||||
|
public class SettleKBWithCodeDapperReportRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency |
||||
|
{ |
||||
|
public SettleKBWithCodeDapperReportRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) |
||||
|
: base(dbContextProvider) |
||||
|
{ } |
||||
|
|
||||
|
public virtual List<SettleKBWithCode> GetSettleKBWithCodeReportList(string state, string version, string year,string customcode, string begintime, string endtime) |
||||
|
{ |
||||
|
string sqlString = " select " + string.Format(" {0} as Version , ", version) + " r1.ErpMaterialCode, r2.Price, r1.SumPrice , r1.MaterialDesc, (isnull(r2.Price,0)-isnull(r1.SumPrice,0)) as diffPrice from \n" + |
||||
|
"( select ErpMaterialCode, MaterialDesc, SUM(Price) as SumPrice from(\n" + |
||||
|
"select a.ErpMaterialCode, b.SettlementPartCode, a.MaterialDesc, (a.Qty * b.Price) as Price from\n" + |
||||
|
"(SELECT ErpMaterialCode, MaterialDesc, SettleMaterialCode, Qty, Version ,CustomerCode \n" + |
||||
|
"FROM [Set_MaterialRelationshipDetail] mdetail \n" + |
||||
|
|
||||
|
" where mdetail.Version='{0}' and mdetail.CustomerCode='{1}' \n" + |
||||
|
") a \n" + |
||||
|
"inner join Set_settlement_part b on a.Version = b.Version and a.SettleMaterialCode = b.SettlementPartCode and a.CustomerCode = b.CustomerCode) temp group by ErpMaterialCode, MaterialDesc) r1 left join set_pricelist r2 " + |
||||
|
" on r2.MaterialCode=r1.ErpMaterialCode and r2.Version='{0}'\n"; |
||||
|
|
||||
|
string _sql = string.Format(sqlString, version, customcode); |
||||
|
|
||||
|
var _query = DbConnection.Query<SettleKBWithCode>(_sql, null, null, true, 1200, null); |
||||
|
return _query.ToList(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 大众看板有条码报表
|
||||
|
/// </summary>
|
||||
|
//[ExcelExporter(Name = "未结明细", AutoFitAllColumn = true, MaxRowNumberOnASheet = 500000)]
|
||||
|
public class SettleKBWithCode |
||||
|
{ |
||||
|
[ExporterHeader(DisplayName = "交货单号")] |
||||
|
public string WMSDeliveryNote { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "实际发货日期")] |
||||
|
public string ActualGoodsDate { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "条码号")] |
||||
|
public string Kanban { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "物料号")] |
||||
|
public string MaterialCode { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "物料描述")] |
||||
|
public string MaterialDesc { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "客户物料")] |
||||
|
public string CustomerMaterial { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "物料组(车型)")] |
||||
|
public string Model { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "交货数量")] |
||||
|
public decimal WMSBillNum { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "定价")] |
||||
|
public decimal Price { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "金额")] |
||||
|
public decimal Amount { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "结算数量")] |
||||
|
public decimal SettleNumber { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "结算日期")] |
||||
|
public DateTime SettleDate { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "结算金额")] |
||||
|
public decimal SettleQty { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "结算与发货差异")] |
||||
|
public decimal SettleWMSDiffQty { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "结算与开票差异")] |
||||
|
public decimal SettleInvoiceDiffQty { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "开票差量")] |
||||
|
public decimal InvoiceDiffQty { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "开票单价")] |
||||
|
public decimal InvoicePrice { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "开票金额")] |
||||
|
public decimal InvoiceMoney { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "单价差异")] |
||||
|
public decimal InvoiceDiffPrice { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "总金额差异")] |
||||
|
public decimal SumDiffMoney { set; get; } |
||||
|
|
||||
|
[ExporterHeader(DisplayName = "出库单号")] |
||||
|
public decimal DeliveryOrderNo { set; get; } |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
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 SettleKBWithCodeExportService : ITransientDependency, IExportJob |
||||
|
{ |
||||
|
private readonly SettleKBWithCodeDapperReportRepository _dapper; |
||||
|
private readonly OutputService _outputService; |
||||
|
|
||||
|
public SettleKBWithCodeExportService(SettleKBWithCodeDapperReportRepository dapper, OutputService outputService) |
||||
|
{ |
||||
|
_dapper = dapper; |
||||
|
_outputService = outputService; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) |
||||
|
{ |
||||
|
var year = p_list.Where(p => p.Name == "Year").FirstOrDefault().Value; |
||||
|
var state = p_list.Where(p => p.Name == "State").FirstOrDefault().Value; |
||||
|
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value; |
||||
|
var customerCode = p_list.Where(p => p.Name == "CustomerCode").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 _list = _dapper.GetSettleKBWithCodeReportList(state, version, year, customerCode, beginTime, endTime); |
||||
|
|
||||
|
_outputService.Export<SettleKBWithCode>(id, string.Format("大众看板结算与交货核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _list); |
||||
|
|
||||
|
return id.ToString(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue