Administrator
3 years ago
11 changed files with 314 additions and 65 deletions
@ -0,0 +1,27 @@ |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Win.Sfs.SettleAccount.Reports; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.UnSettle |
|||
{ |
|||
public class UnSettleDetailReport:ReportDetailBase |
|||
{ |
|||
[ExporterHeader(DisplayName = "结算平台未结数量 ")] |
|||
public decimal Qty { set; get; } |
|||
[ExporterHeader(DisplayName = "定价 ")] |
|||
public decimal Price { set; get; } |
|||
[ExporterHeader(DisplayName = "金额 ")] |
|||
public decimal Amt { set; get; } |
|||
[ExporterHeader(DisplayName = "漏结标识 ")] |
|||
public string Flag { set; get; } |
|||
[ExporterHeader(DisplayName = "漏结期间 ")] |
|||
public string UNSettleVersion { set; get; } |
|||
[ExporterHeader(DisplayName = "说明 ")] |
|||
public string Remark { set; get; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,39 @@ |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Reports |
|||
{ |
|||
public class ReportDetailBase |
|||
{ |
|||
[ExporterHeader(DisplayName = "交货单号 ")] |
|||
public string WmsBillNum { set; get; } |
|||
[ExporterHeader(DisplayName = "实际发货日期 ")] |
|||
public DateTime CP5Time { set; get; } |
|||
[ExporterHeader(DisplayName = "KENN号")] |
|||
public string KENNCode { set; get; } |
|||
[ExporterHeader(DisplayName = "底盘号")] |
|||
public string ChassisNumber { set; get; } |
|||
[ExporterHeader(DisplayName = "M100交货状态 ")] |
|||
public string WmsState { set; get; } |
|||
[ExporterHeader(DisplayName = "物料号")] |
|||
public string SapMaterialCode { set; get; } |
|||
[ExporterHeader(DisplayName = "物料描述 ")] |
|||
public string MaterialDesc { set; get; } |
|||
[ExporterHeader(DisplayName = "客户物料 ")] |
|||
public string MaterialCode { set; get; } |
|||
[ExporterHeader(DisplayName = "组件组物料 ")] |
|||
public string ParentMaterialCode { set; get; } |
|||
[ExporterHeader(DisplayName = "组件组物料描述 ")] |
|||
public string ParentMaterialDesc { set; get; } |
|||
[ExporterHeader(DisplayName = "物料组(车型) ")] |
|||
public string MaterialGroup { set; get; } |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,118 @@ |
|||
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.Entities.FISes; |
|||
using Dapper; |
|||
using Win.Sfs.SettleAccount.FISes; |
|||
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.ExportDto; |
|||
using Win.Sfs.SettleAccount.Entities.UnSettle; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report |
|||
{ |
|||
public class UnSettledDetailDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency |
|||
{ |
|||
//ERP总成开票报表
|
|||
public UnSettledDetailDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public virtual List<UnSettleDetailReport> GetDiffReport(string year, string begin, string end, string customcode, string version,string materialCode,string materialGroup,string sapCode) |
|||
{ |
|||
|
|||
string str = string.Empty; |
|||
|
|||
|
|||
if (!string.IsNullOrEmpty(begin)) |
|||
{ |
|||
str += string.Format(" and beginTime>'{0}' ",begin); |
|||
} |
|||
if (!string.IsNullOrEmpty(end)) |
|||
{ |
|||
str += string.Format(" and beginTime<'{0}' ", end); |
|||
} |
|||
if (!string.IsNullOrEmpty(materialCode)) |
|||
{ |
|||
str += string.Format(" and MaterialCode='{0}' ", materialCode); |
|||
} |
|||
if (!string.IsNullOrEmpty(materialGroup)) |
|||
{ |
|||
str += string.Format(" and MaterialGroup='{0}' ", materialGroup); |
|||
} |
|||
if (!string.IsNullOrEmpty(sapCode)) |
|||
{ |
|||
str += string.Format(" and MaterialGroup='{0}' ", materialGroup); |
|||
} |
|||
var sqlString = |
|||
" SELECT\n" + |
|||
" A.*,\n" + |
|||
" C.Price,\n" + |
|||
" ISNULL( A.QTY, 0 )* ISNULL( C.Price, 0 ) AMT \n" + |
|||
"FROM\n" + |
|||
" (\n" + |
|||
" SELECT DISTINCT\n" + |
|||
" '' WMSState,\n" + |
|||
" '' UnSettleVersion,\n" + |
|||
" '' WMSBillNum,\n" + |
|||
" BeginTime CP5Time,\n" + |
|||
" ErpMaterialCode MaterialCode,\n" + |
|||
" ChassisNumber,\n" + |
|||
" KENNCode,\n" + |
|||
" 1 QTY,\n" + |
|||
" ErpMaterialCode ParentMaterialCode,\n" + |
|||
" '' FLAG \n" + |
|||
" FROM\n" + |
|||
" Set_fis \n" + |
|||
" WHERE\n" + |
|||
" 1 = 1 \n" + |
|||
" AND STATE = 0 {0} UNION ALL\n" + |
|||
" SELECT\n" + |
|||
" WMSState,\n" + |
|||
" UnSettleVersion,\n" + |
|||
" WMSBillNum,\n" + |
|||
" BeginTime CP5Time,\n" + |
|||
" ItemCode MaterialCode,\n" + |
|||
" ChassisNumber,\n" + |
|||
" KENNCode,\n" + |
|||
" QTY,\n" + |
|||
" ErpMaterialCode,\n" + |
|||
" '' FLAG \n" + |
|||
" FROM\n" + |
|||
" [Set_fis] \n" + |
|||
" WHERE\n" + |
|||
" 1 = 1 \n" + |
|||
" AND STATE = 0 {0} UNION ALL\n" + |
|||
" SELECT\n" + |
|||
" WMSState,\n" + |
|||
" UnSettleVersion,\n" + |
|||
" WMSBillNum,\n" + |
|||
" BeginTime CP5Time,\n" + |
|||
" ItemCode MaterialCode,\n" + |
|||
" ChassisNumber,\n" + |
|||
" KENNCode,\n" + |
|||
" QTY,\n" + |
|||
" ErpMaterialCode,\n" + |
|||
" 'L' FLAG \n" + |
|||
" FROM\n" + |
|||
" [Set_fis] \n" + |
|||
" WHERE\n" + |
|||
" 1 = 1 \n" + |
|||
" AND STATE = 4 {0}\n" + |
|||
" ) A\n" + |
|||
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) C ON a.MaterialCode = c.MaterialCode"; |
|||
|
|||
|
|||
|
|||
string _sql = string.Format(sqlString, version); |
|||
; |
|||
var _query = DbConnection.Query<UnSettleDetailReport>(_sql); |
|||
|
|||
return _query.ToList(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,48 @@ |
|||
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.Entities.UnSettle; |
|||
using Win.Sfs.SettleAccount.FISes; |
|||
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; |
|||
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.ExportDto; |
|||
|
|||
namespace SettleAccount.Job.Services.Report |
|||
{ |
|||
public class UnsettledDetailReportService : ITransientDependency, IExportJob |
|||
{ |
|||
private readonly UnSettledDetailDapperRepository _dapper; |
|||
private readonly OutputService _outputService; |
|||
|
|||
public UnsettledDetailReportService(UnSettledDetailDapperRepository dapper, OutputService outputService) |
|||
{ |
|||
_dapper = dapper; |
|||
_outputService = outputService; |
|||
} |
|||
|
|||
|
|||
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) |
|||
{ |
|||
var _first = exportName.FirstOrDefault(); |
|||
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value; |
|||
var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value; |
|||
var materailCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value; |
|||
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value; |
|||
var sapcode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value; |
|||
var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value; |
|||
var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value; |
|||
//var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value;
|
|||
//var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value;
|
|||
|
|||
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), DateTime.Parse(begin), DateTime.Parse(end), customerCode, version); |
|||
|
|||
_outputService.Export<UnSettleDetailReport>(id, _first, _list); |
|||
return id.ToString(); |
|||
|
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue