Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
1eddc320b8
  1. 37
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  2. 4
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettledPartAndErpPartPriceDiffs/SettledPartAndErpPartPriceDiff.cs
  3. 64
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettledPartAndErpPartPriceDiffRepository.cs
  4. 2
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs
  5. 2
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettledPartAndErpPartPriceDiffExportService.cs

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

@ -313,6 +313,43 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
/// <summary>
/// 结算总成和ERP总成价格对比
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpGet]
[Route("BomDiffPrice-Make")]
[DisableRequestSizeLimit]
public async Task<string> SettledPartAndErpPartPriceDiffMake(string version, string customerCode)
{
if (!_relationshipRepository.Any(p => p.Version == version && p.CustomerCode == customerCode))
{
throw new BusinessException("8989", string.Format("不存总成与结算件零件关系{0}期间", version));
}
if (!_settlementPartVersionrepository.Any(p => p.Version == version && p.CustomerCode == customerCode))
{
throw new BusinessException("8989", string.Format("不存结算包价格{0}期间", version));
}
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "Bom定价差异明细" });
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode });
var _taskid = await _service.ExportEnqueueAsync("Bom定价差异明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
/// <summary>
/// 看板未结输出
/// </summary>

4
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettledPartAndErpPartPriceDiffs/SettledPartAndErpPartPriceDiff.cs

@ -19,9 +19,9 @@ namespace Win.Sfs.SettleAccount.Reports.SettledPartAndErpPartPriceDiffs
[ExporterHeader(DisplayName = "ERP物料编号")]
public string ErpMaterialCode { set; get; }
[ExporterHeader(DisplayName = "总成价格")]
[ExporterHeader(DisplayName = "Bom总成价格")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "结算总成价格")]
[ExporterHeader(DisplayName = "总成价格")]
public decimal SumPrice { get; set; }
[ExporterHeader(DisplayName = "差额")]
public decimal DiffPrice { get; set; }

64
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettledPartAndErpPartPriceDiffRepository.cs

@ -21,16 +21,35 @@ namespace Win.Sfs.SettleAccount.Repository.Report
public virtual List<SettledPartAndErpPartPriceDiff> GetDiffReport(string year, string customcode, string version)
{
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" +
string sqlString = "SELECT\n" +
" t1.ErpMaterialCode,\n" +
" t1.Price SumPrice,\n" +
" t2.Price,\n" +
" t3.MaterialDesc,\n" +
" t3.EstimateTypeDesc ,\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";
" (ISNULL(t1.price,0)-ISNULL(t2.price,0)) DiffPrice\n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" ErpMaterialCode,\n" +
" SUM( amt ) Price \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" ErpMaterialCode,\n" +
" SettleMaterialCode,(\n" +
" Qty * isnull( b.Price, 0 )) amt \n" +
" FROM\n" +
" Set_MaterialRelationshipDetail a\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) AND type = 10 ) b ON a.SettleMaterialCode = b.MaterialCode \n" +
" ) temp1 \n" +
" GROUP BY\n" +
" ErpMaterialCode \n" +
" ) t1\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) AND type = 10 ) t2 ON t1.ErpMaterialCode = t2.MaterialCode\n" +
" LEFT JOIN ( SELECT max( Id ) Id, MaterialCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc ) t3 ON t1.ErpMaterialCode = t3.MaterialCode";
string _sql = string.Format(sqlString, version, customcode);
@ -38,5 +57,32 @@ namespace Win.Sfs.SettleAccount.Repository.Report
//var _query = _db.Query<SettledPartAndErpPartPriceDiff>();
return _query.ToList();
}
public virtual List<SettledPartAndErpPartPriceDiff> GetDiffDetailReport(string year, string customcode, string version)
{
string sqlString = "select a.ErpMaterialCode,SettleMaterialCode,a.ShipMaterailCode,d.MaterialDesc,d.EstimateTypeDesc from\n" +
" Set_MaterialRelationshipDetail_pg a left join\n" +
" (\n" +
" SELECT\n" +
" Price,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" version = ( SELECT Max( Version ) FROM Set_PriceList ) and type=10 )\n" +
" b on a.SettleMaterialCode=b.MaterialCode \n" +
" left join \n" +
" set_material d ON a.ShipMaterailCode = d.CustomerPartCode\n" +
" \n" +
" \n" +
" where b.MaterialCode is null";
string _sql = string.Format(sqlString, version, customcode);
var _query = DbConnection.Query<SettledPartAndErpPartPriceDiff>(_sql, null, null, true, 1200, null);
//var _query = _db.Query<SettledPartAndErpPartPriceDiff>();
return _query.ToList();
}
}
}

2
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs

@ -184,7 +184,7 @@ namespace SettleAccount.Job.Services
//.Select(p => p.FirstOrDefault());
_ls = _ls.OrderBy(p => p.SapMaterialCode).ThenBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ToList();
_ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList();
}
_outputService.Export<InvoiceSettledDetailDiff>(id, _filename, _ls);

2
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettledPartAndErpPartPriceDiffExportService.cs

@ -31,7 +31,7 @@ namespace SettleAccount.Job.Services.Report
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value;
var _list= _dapper.GetDiffReport(DateTime.Now.Year.ToString(), customerCode, version);
_outputService.Export<SettledPartAndErpPartPriceDiff>(id,string.Format("总成定价和结算价对比_{0}.xlsx",Guid.NewGuid().ToString()), _list);
_outputService.Export<SettledPartAndErpPartPriceDiff>(id,string.Format("Bom定价对比_{0}.xlsx",Guid.NewGuid().ToString()), _list);
return id.ToString();
}

Loading…
Cancel
Save