Browse Source
# Conflicts: # src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Logs/log-20211119.txtbranch_ccpg_220107
44673626
3 years ago
12 changed files with 639 additions and 104 deletions
@ -0,0 +1,162 @@ |
|||
using Dapper; |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data.Common; |
|||
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 SettleFisDiffDetail |
|||
{ |
|||
[ExporterHeader(DisplayName = "年")] |
|||
public string Year { set; get; } |
|||
[ExporterHeader(DisplayName = "KENN号" )] |
|||
public string KENNCode { set; get; } |
|||
[ExporterHeader(DisplayName = "底盘号")] |
|||
public string ChassisNumber { set; get; } |
|||
[ExporterHeader(DisplayName = "车型" )] |
|||
public string Model { set; get; } |
|||
[ExporterHeader(DisplayName = "CP5A日期" )] |
|||
public string CP5A { set; get; } |
|||
[ExporterHeader(DisplayName = "CP7日期" )] |
|||
public string CP7 { set; get; } |
|||
[ExporterHeader(DisplayName = "零件号" )] |
|||
public string MaterialCode { set; get; } |
|||
[ExporterHeader(DisplayName = "结算数量" )] |
|||
public string SettleQty { set; get; } |
|||
[ExporterHeader(DisplayName = "M100状态" )] |
|||
public string WMSBillNum { set; get; } |
|||
[ExporterHeader(DisplayName = "M100数量" )] |
|||
public string Qty { set; get; } |
|||
[ExporterHeader(DisplayName = "差异")] |
|||
public string DiffQty { set; get; } |
|||
[ExporterHeader(DisplayName = "开票单价" )] |
|||
public string Price{ set; get; } |
|||
[ExporterHeader(DisplayName = "差异金额")] |
|||
public string DiffPrice{ set; get; } |
|||
[ExporterHeader(DisplayName = "SAP编码")] |
|||
public string SapCode { set; get; } |
|||
|
|||
} |
|||
public class SettleFisDiffSum |
|||
{ |
|||
|
|||
// 物料组车型 SAP编码 零件号 结算数量 M100数量 差异总数 开票单价 差异金额
|
|||
|
|||
|
|||
[ExporterHeader(DisplayName = "物料组车型")] |
|||
public string MaterialCodeGroup { set; get; } |
|||
[ExporterHeader(DisplayName = "SAP编码")] |
|||
public string KENNCode { set; get; } |
|||
[ExporterHeader(DisplayName = "零件号")] |
|||
public string MaterialCode { set; get; } |
|||
|
|||
[ExporterHeader(DisplayName = "结算数量")] |
|||
public string SettleQty { set; get; } |
|||
[ExporterHeader(DisplayName = "M100状态")] |
|||
public string WMSBillNum { set; get; } |
|||
[ExporterHeader(DisplayName = "M100数量")] |
|||
public string Qty { set; get; } |
|||
[ExporterHeader(DisplayName = "差异数量")] |
|||
public string DiffQty { set; get; } |
|||
[ExporterHeader(DisplayName = "开票单价")] |
|||
public string Price { set; get; } |
|||
[ExporterHeader(DisplayName = "差异金额")] |
|||
public string DiffPrice { set; get; } |
|||
|
|||
} |
|||
public class SettleFisDiffDetailDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency |
|||
{ |
|||
public SettleFisDiffDetailDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
|
|||
} |
|||
//public virtual List<SettleFisDiffSum> GetSumList(string state, string version, string year, string begintime, string endtime)
|
|||
//{
|
|||
|
|||
// GetReportList(state, version, year, begintime, endtime);
|
|||
|
|||
|
|||
//}
|
|||
|
|||
|
|||
|
|||
|
|||
public virtual List<SettleFisDiffDetail> GetReportList(string version, string year, string begintime, string endtime) |
|||
{ |
|||
//年份 KENN号 底盘号 车型 CP5A日期 CP7日期 零件号 结算数量 M100状态 M100数量 差异 开票单价 差异金额
|
|||
|
|||
string _sql = |
|||
"SELECT\n" + |
|||
" a.*,\n" + |
|||
" ISnull( b.qty, 0 ) Qty,\n" + |
|||
" b.WMSBillNum,\n" + |
|||
" b.WMSState,\n" + |
|||
" Price,\n" + |
|||
" a.SettleQty - isnull( b.Qty, 0 ) DiffQty,(\n" + |
|||
" a.SettleQty - isnull( b.Qty, 0 ))* Price DiffPrice,\n" + |
|||
" d.CustomerPartCode SapCode \n" + |
|||
"FROM\n" + |
|||
" ( SELECT YEAR, KENNCode, ChassisNumber, Model, CP5A, CP7, MaterialCode, Qty SettleQty FROM Set_Settle WHERE version = '{0}' ) a\n" + |
|||
" LEFT JOIN (\n" + |
|||
" SELECT\n" + |
|||
" sum( qty ) Qty,\n" + |
|||
" KENNCode,\n" + |
|||
" ChassisNumber,\n" + |
|||
" ChassisNumber2,\n" + |
|||
" ItemCode,\n" + |
|||
" WMSBillNum,\n" + |
|||
" WMSState \n" + |
|||
" FROM\n" + |
|||
" Set_fis \n" + |
|||
" GROUP BY\n" + |
|||
" KENNCode,\n" + |
|||
" ChassisNumber,\n" + |
|||
" ChassisNumber2,\n" + |
|||
" ItemCode,\n" + |
|||
" WMSBillNum,\n" + |
|||
" WMSState \n" + |
|||
" ) b ON a.ChassisNumber = b.ChassisNumber2 \n" + |
|||
" AND a.KENNCode = b.KENNCode \n" + |
|||
" AND a.MaterialCode = b.ItemCode\n" + |
|||
" LEFT JOIN ( SELECT SUM( Amt )/ sum( Qty ) Price, MaterialCode FROM Set_Invoice WHERE version = '{0}' GROUP BY MaterialCode ) c ON a.MaterialCode = c.MaterialCode\n" + |
|||
" LEFT JOIN Set_material d ON a.MaterialCode = d.CustomerPartCode"; |
|||
|
|||
_sql = string.Format(_sql, version); |
|||
var _query = DbConnection.Query<SettleFisDiffDetail>(_sql, null, null, true, 1200, null); |
|||
|
|||
return _query.ToList(); |
|||
|
|||
|
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -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<SettleAccountDbContext>, ITransientDependency |
|||
{ |
|||
public UnSettleDiffDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public virtual List<UnSettleDiff> 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<UnSettleDiff>(_sql); |
|||
return _query.ToList(); |
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
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.Reports.SettledPartAndErpPartPriceDiffs; |
|||
using Win.Sfs.SettleAccount.Repository.Report; |
|||
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; |
|||
|
|||
namespace SettleAccount.Job.Services.Report |
|||
{ |
|||
public class SettleFisDiffExportService : ITransientDependency, IExportJob |
|||
{ |
|||
|
|||
private readonly SettleFisDiffDetailDapperRepository _dapper; |
|||
private readonly OutputService _outputService; |
|||
|
|||
public SettleFisDiffExportService(SettleFisDiffDetailDapperRepository 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 begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value; |
|||
var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; |
|||
var _list= _dapper.GetReportList(version,string.Empty,begin,end); |
|||
_outputService.Export<SettleFisDiffDetail>(id,string.Format("3.大众准时化结算数量差异比对表_{0}.xlsx", Guid.NewGuid().ToString()), _list); |
|||
return id.ToString(); |
|||
|
|||
} |
|||
} |
|||
} |
@ -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<string> exportName, List<CustomCondition> 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<UnSettleDiff>(); |
|||
_ls = _dapper.GetDiffReport(int.Parse(type),year,beginTime,endTime, materialCode,sapCode); |
|||
var _id = Guid.NewGuid(); |
|||
|
|||
|
|||
|
|||
|
|||
List<UnSettleDiff> _lsExport = new List<UnSettleDiff>(); |
|||
//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<UnSettleDiff>(id, _first, _lsExport); |
|||
return id.ToString(); |
|||
} |
|||
} |
|||
} |
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue