Browse Source

门板结算代码提交

branch_ccpg_220107
44673626 3 years ago
parent
commit
e888a838ed
  1. 30
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  2. 11
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  3. 102
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleDoorPanelDapperRepository.cs
  4. 45
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs

30
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -74,6 +74,36 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
#region 派格大众看板-备件结算报表
/// <summary>
/// 大众准时化结算门板价格差异比对报表
/// </summary>
/// <param name="materialCode">客户物料号</param>
/// <param name="version">版本</param>
/// <param name="customerCode"></param>
/// <param name="sapCode">厂内物料号</param>
/// <param name="estimateTypeDesc">物料组</param>
/// <returns></returns>
[HttpGet]
[Route("SettleDoorPanel")]
[DisableRequestSizeLimit]
public async Task<string> SettledKanBanWithCode( string materialCode, string version, string customerCode, string sapCode, string estimateTypeDesc)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = estimateTypeDesc ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众准时化结算门板价格差异比对报表" });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = materialCode ?? string.Empty });
var _taskid = await _service.ExportEnqueueAsync("大众准时化结算门板价格差异比对报表", ExportExtentsion.Excel, CurrentUser, typeof(SettleKBWithCodeExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
/// <summary>
/// 有条码看板结算核对
/// </summary>

11
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -2406,6 +2406,17 @@
<param name="repository">仓储接口</param>
<param name="cache">缓存</param>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettledKanBanWithCode(System.String,System.String,System.String,System.String,System.String)">
<summary>
大众准时化结算门板价格差异比对报表
</summary>
<param name="materialCode">客户物料号</param>
<param name="version">版本</param>
<param name="customerCode"></param>
<param name="sapCode">厂内物料号</param>
<param name="estimateTypeDesc">物料组</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettledKanBanWithCode(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.DateTime,System.DateTime)">
<summary>
有条码看板结算核对

102
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleDoorPanelDapperRepository.cs

@ -0,0 +1,102 @@
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 SettleDoorPanelDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public SettleDoorPanelDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider)
: base(dbContextProvider)
{ }
public virtual List<SettleDoorPanelExport> GetSettleDoorPanelReportList(string estimateTypeDesc, string version, string sapCode, string matialCode)
{
string sqlString = "SELECT\n" +
" * ,\n" +
" ISNULL( Price - InvoicePrice, 0 ) AS InvoiceDiffPrice --单价差异\n" +
" \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" c.EstimateTypeDesc,--物料组(车型)\n" +
" a.MaterialCode,--物料代码\n" +
" c.MaterialCode AS SAPCode,--厂内零件号\n" +
" c.CustomerPartCode,--客户物料\n" +
" c.MaterialDesc,--物料描述\n" +
" d.InvoicePrice \n" +
" FROM\n" +
" Set_Settle AS a\n" +
" INNER JOIN Set_fis AS b ON a.KENNCode= b.KENNCode \n" +
" AND a.ChassisNumber= b.ChassisNumber2 \n" +
" AND a.MaterialCode= b.ItemCode\n" +
" LEFT JOIN Set_material AS c ON a.MaterialCode= c.CustomerPartCode\n" +
" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode \n" +
" WHERE\n" +
" b.Version= '{0}' \n" +
" ) TEMP1\n" +
" LEFT JOIN ( SELECT Price, --定价\n" +
" MaterialCode --厂内物料号\n" +
" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SAPCode= TEMP2.MaterialCode \n" +
"WHERE\n" +
" 1=1 ";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
if (!string.IsNullOrEmpty(estimateTypeDesc))
{
addwhere += string.Format(" AND EstimateTypeDesc LIKE '{0}%' ", estimateTypeDesc);
}
else if (!string.IsNullOrEmpty(sapCode))
{
addwhere += string.Format(" AND SAPCode LIKE '{0}%' ", sapCode);
}
else if (!string.IsNullOrEmpty(matialCode))
{
addwhere += string.Format(" AND MaterialCode LIKE '{0}%' ", matialCode);
}
string _sql = string.Format(addSqlStr, addwhere);
//string _sql = string.Format(sqlString, version);
var _query = DbConnection.Query<SettleDoorPanelExport>(_sql, null, null, true, 1200, null);
return _query.ToList();
}
}
/// <summary>
/// 大众看板有条码报表
/// </summary>
//[ExcelExporter(Name = "未结明细", AutoFitAllColumn = true, MaxRowNumberOnASheet = 500000)]
public class SettleDoorPanelExport
{
[ExporterHeader(DisplayName = "物料组(车型)")]
public string EstimateTypeDesc { set; get; }
[ExporterHeader(DisplayName = "物料号")]
public string SAPCode { set; get; }
[ExporterHeader(DisplayName = "客户物料")]
public string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料描述")]
public string MaterialDesc { set; get; }
[ExporterHeader(DisplayName = "开票单价")]
public decimal InvoicePrice { set; get; }
[ExporterHeader(DisplayName = "定价")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "单价差异")]
public decimal InvoiceDiffPrice { set; get; }
}
}

45
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs

@ -0,0 +1,45 @@
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 SettleDoorPanelExportService : ITransientDependency, IExportJob
{
private readonly SettleDoorPanelDapperRepository _dapper;
private readonly OutputService _outputService;
public SettleDoorPanelExportService(SettleDoorPanelDapperRepository dapper, OutputService outputService)
{
_dapper = dapper;
_outputService = outputService;
}
//public virtual List<SettleDoorPanelExport> GetSettleDoorPanelReportList(string purchaseOrderNo, string version, string sapCode, string matialCode)
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var estimateTypeDesc = p_list.Where(p => p.Name == "EstimateTypeDesc").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SAPCode").FirstOrDefault().Value;
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var customerPartCode = p_list.Where(p => p.Name == "CustomerPartCode").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.GetSettleDoorPanelReportList(estimateTypeDesc, version, sapCode, customerPartCode);
_outputService.Export<SettleKBWithCode>(id, string.Format("大众看板结算与交货核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _list);
return id.ToString();
}
}
}
Loading…
Cancel
Save