Administrator 3 years ago
parent
commit
c898cbc108
  1. 44
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  2. 55
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  3. 1581
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  4. 101
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
  5. 238
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
  6. 2
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs
  7. 18
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

44
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -4,17 +4,21 @@ using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Job.Services.Report;
using Shouldly; using Shouldly;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TaskJob.EventArgs;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.Filter;
@ -32,15 +36,53 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
private readonly PriceListManager _mng; private readonly PriceListManager _mng;
private readonly IExcelImportAppService _excelImportService; private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository; private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly TaskJobService _service;
public PriceListAppService( public PriceListAppService(
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository, ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
PriceListManager mng PriceListManager mng,
TaskJobService service
) )
{ {
_mapRepository = mapRepository; _mapRepository = mapRepository;
_excelImportService = excelImportService; _excelImportService = excelImportService;
_mng = mng; _mng = mng;
_service = service;
}
/// <summary>
/// 结算总成和ERP总成价格对比
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpGet]
[Route("BomDiffPrice-Make")]
[DisableRequestSizeLimit]
[Authorize(SettleAccountPermissions.PriceLists.Default)]
public async Task<string> SettledPartAndErpPartPriceDiffMake(string version, string customerCode)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "Bom定价差异明细" });
customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(version) ? string.Empty : version });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.IsNullOrEmpty(customerCode) ? string.Empty : customerCode });
var _taskid = await _service.ExportEnqueueAsync("Bom定价差异明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
[HttpPost]
[Route("job/list")]
[Authorize(SettleAccountPermissions.PriceLists.Default)]
[UnitOfWork(false)]
virtual public async Task<List<JobDto>> GetListAsync(JobRequestDto input)
{
return await _service.GetListAsync(input);
} }
/// <summary> /// <summary>

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

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

1581
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs

File diff suppressed because it is too large

101
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs

@ -175,8 +175,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
strDate += string.Format(" and WMSActualGoodsDate<='{0}' ", endtime); strDate += string.Format(" and WMSActualGoodsDate<='{0}' ", endtime);
} }
//财务又要把 有发货有结算,发货数量大于结算数量加上,又变了
string sql = "SELECT\n" + string sql = "SELECT\n" +
" * \n" + " * \n" +
"FROM\n" + "FROM\n" +
@ -216,13 +215,105 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ) TEMP1\n" + " ) TEMP1\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" +
" ) UNION1\n" + " ) UNION1\n" +
" LEFT JOIN temp_vwkanban UNION2 ON UNION1.Kanban= UNION2.[看板号] \n" + " LEFT JOIN temp_vwkanban UNION2 ON UNION1.Kanban= UNION2.[看板号] \n" +
" AND UNION1.CustomerPartCode= UNION2.[客户零件号] \n" + " AND UNION1.CustomerPartCode= UNION2.[客户零件号] \n" +
" WHERE\n" + " WHERE\n" +
" UNION2.[看板号] IS NULL \n" + " UNION2.[看板号] IS NULL \n" +
" AND UNION2.[客户零件号] IS NULL \n" + " AND UNION2.[客户零件号] IS NULL \n" +
" ) aaa \n" + " ) UNION1 UNION ALL\n" +
" WHERE 1=1"; "SELECT\n" +
" * \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" * \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" TEMP1.*,\n" +
" TEMP2.Price,\n" +
" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" '' WmsBillNum,\n" +
" NULL BeginDate,\n" +
" a.Kanban,\n" +
" C.MaterialCode SapCode,\n" +
" C.MaterialDesc,\n" +
" C.CustomerPartCode,\n" +
" C.EstimateTypeDesc MaterialGroup,\n" +
" ISNULL( B.Qty, 0 ) SettleQty,\n" +
" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
" isnull( tt.qty, 0 ) BackQty,\n" +
" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
" FROM\n" +
" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1 = 1 {1} GROUP BY MaterialCode, Kanban ) A\n" +
" INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, Extend1 AS MaterialCode FROM Set_WmsKanbanOutPutDetial {0} GROUP BY Kanban, Extend1 ) B ON A.Kanban = B.Kanban \n" +
" AND A.MaterialCode = B.MaterialCode\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" +
" AND c.MaterialCode = tt.MaterialCode \n" +
" WHERE\n" +
" a.WMSDeliveryQty> B.Qty \n" +
" AND ( a.WMSDeliveryQty- tt.Qty ) != B.Qty \n" +
" ) TEMP1\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" +
" ) UNION1\n" +
" LEFT JOIN temp_vwkanban UNION2 ON UNION1.Kanban= UNION2.[看板号] \n" +
" AND UNION1.CustomerPartCode= UNION2.[客户零件号] \n" +
" WHERE\n" +
" UNION2.[看板号] IS NULL \n" +
" AND UNION2.[客户零件号] IS NULL \n" +
" ) UNION2";
//更改方案一
//string sql = "SELECT\n" +
//" * \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" * \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" TEMP1.*,\n" +
//" TEMP2.Price,\n" +
//" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' WmsBillNum,\n" +
//" NULL BeginDate,\n" +
//" a.Kanban,\n" +
//" C.MaterialCode SapCode,\n" +
//" C.MaterialDesc,\n" +
//" C.CustomerPartCode,\n" +
//" C.EstimateTypeDesc MaterialGroup,\n" +
//" ISNULL( B.Qty, 0 ) SettleQty,\n" +
//" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
//" isnull( tt.qty, 0 ) BackQty,\n" +
//" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
//" FROM\n" +
//" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1 = 1 {1} GROUP BY MaterialCode, Kanban ) A\n" +
//" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, Extend1 AS MaterialCode FROM Set_WmsKanbanOutPutDetial {0} GROUP BY Kanban, Extend1 ) B ON A.Kanban = B.Kanban \n" +
//" AND A.MaterialCode = B.MaterialCode\n" +
//" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
//" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" +
//" AND c.MaterialCode = tt.MaterialCode \n" +
//" WHERE\n" +
//" B.Kanban IS NULL \n" +
//" AND B.MaterialCode IS NULL \n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" +
//" ) UNION1\n" +
//" LEFT JOIN temp_vwkanban UNION2 ON UNION1.Kanban= UNION2.[看板号] \n" +
//" AND UNION1.CustomerPartCode= UNION2.[客户零件号] \n" +
//" WHERE\n" +
//" UNION2.[看板号] IS NULL \n" +
//" AND UNION2.[客户零件号] IS NULL \n" +
//" ) aaa \n" +
//" WHERE 1=1";

238
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

@ -679,67 +679,185 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
conditionDate += string.Format(" and SpareDate<='{0}' ", endtime); conditionDate += string.Format(" and SpareDate<='{0}' ", endtime);
} }
//第三次更改,财务又要求把有发货有结算,发货数量 大于 结算数量 加上
string sqlString = "SELECT\n" + string sqlString = "SELECT\n" +
" * \n" + " * \n" +
"FROM\n" + "FROM\n" +
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
" temp1.交货单号,\n" + " temp1.交货单号,\n" +
" temp1.交货日期,\n" + " temp1.交货日期,\n" +
" temp1.采购订单号,\n" + " temp1.采购订单号,\n" +
" temp1.SAP编码,\n" + " temp1.SAP编码,\n" +
" temp1.物料代码,\n" + " temp1.物料代码,\n" +
" temp1.物料描述,\n" + " temp1.物料描述,\n" +
" temp1.发货数量,\n" + " temp1.发货数量,\n" +
" temp1.开票数量,\n" + " temp1.开票数量,\n" +
" temp1.收货与交货差异,\n" + " temp1.收货与交货差异,\n" +
" ISNULL( temp3.Qty, 0 ) 退货数量,\n" + " ISNULL( temp3.Qty, 0 ) 退货数量,\n" +
" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 实际发货数量,\n" + " ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 未结数量,\n" +
" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) 未结数量,\n" + " ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) 实际发货数量,\n" +
" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" + " ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
" ISNULL( TEMP2.Price, 0 ) * ( ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) ) 实际发货总金额 \n" + " ISNULL( TEMP2.Price, 0 ) * ( ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) ) 实际发货总金额 \n" +
" FROM\n" + " FROM\n" +
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
" '' AS 交货单号,\n" + " '' AS 交货单号,\n" +
" NULL AS 交货日期,\n" + " NULL AS 交货日期,\n" +
" a.PurchaseOrderNo AS 采购订单号,\n" + " a.PurchaseOrderNo AS 采购订单号,\n" +
" c.MaterialCode AS SAP编码,\n" + " c.MaterialCode AS SAP编码,\n" +
" c.CustomerPartCode AS 物料代码,\n" + " c.CustomerPartCode AS 物料代码,\n" +
" c.MaterialDesc AS 物料描述,\n" + " c.MaterialDesc AS 物料描述,\n" +
" c.EstimateTypeDesc AS 物料组,\n" + " c.EstimateTypeDesc AS 物料组,\n" +
" ISNULL( a.ReceiptQty, 0 ) AS 发货数量,\n" + " ISNULL( a.ReceiptQty, 0 ) AS 发货数量,\n" +
" ISNULL( b.Qty, 0 ) AS 开票数量,\n" + " ISNULL( b.Qty, 0 ) AS 开票数量,\n" +
" ( ISNULL( a.ReceiptQty, 0 ) - ISNULL( b.Qty, 0 ) ) AS 收货与交货差异 \n" + " ( ISNULL( a.ReceiptQty, 0 ) - ISNULL( b.Qty, 0 ) ) AS 收货与交货差异 \n" +
" FROM\n" + " FROM\n" +
" (\n" + " (\n" +
" SELECT SUM\n" + " SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" + " ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" + " PurchaseOrderNo,\n" +
" MaterialCode,\n" + " MaterialCode,\n" +
" SapCode \n" + " SapCode \n" +
" FROM\n" + " FROM\n" +
" Set_WMSSparePart \n" + " Set_WMSSparePart \n" +
" WHERE\n" + " WHERE\n" +
" PurchaseOrderNo IS NOT NULL \n" + " PurchaseOrderNo IS NOT NULL \n" +
" AND PurchaseOrderNo != '' {0}\n" + " AND PurchaseOrderNo != '' {0}\n" +
" GROUP BY\n" + " GROUP BY\n" +
" PurchaseOrderNo,\n" + " PurchaseOrderNo,\n" +
" MaterialCode,\n" + " MaterialCode,\n" +
" SapCode \n" + " SapCode \n" +
" ) AS a\n" + " ) AS a\n" +
" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode\n" + " LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode\n" +
" LEFT JOIN ( SELECT SUM ( Qty ) Qty, OrderBillNum, MaterialCode FROM Set_WmsSharePart90OutPutDetial WHERE State = 2 GROUP BY OrderBillNum, MaterialCode ) AS b ON a.PurchaseOrderNo= b.OrderBillNum \n" + " LEFT JOIN ( SELECT SUM ( Qty ) Qty, OrderBillNum, MaterialCode FROM Set_WmsSharePart90OutPutDetial WHERE State = 2 GROUP BY OrderBillNum, MaterialCode ) AS b ON a.PurchaseOrderNo= b.OrderBillNum \n" +
" AND a.SapCode = b.MaterialCode \n" + " AND a.SapCode = b.MaterialCode \n" +
" WHERE\n" + " WHERE\n" +
" b.OrderBillNum IS NULL \n" + " b.OrderBillNum IS NULL \n" +
" AND b.MaterialCode IS NULL \n" + " AND b.MaterialCode IS NULL \n" +
" ) AS temp1\n" + " ) AS temp1\n" +
" LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" + " LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
" AND temp1.SAP编码= temp3.MaterialCode\n" + " AND temp1.SAP编码= temp3.MaterialCode\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
" ) unint1"; " ) unint1 UNION ALL\n" +
"SELECT\n" +
" * \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" temp1.交货单号,\n" +
" temp1.交货日期,\n" +
" temp1.采购订单号,\n" +
" temp1.SAP编码,\n" +
" temp1.物料代码,\n" +
" temp1.物料描述,\n" +
" temp1.发货数量,\n" +
" temp1.开票数量,\n" +
" temp1.收货与交货差异,\n" +
" ISNULL( temp3.Qty, 0 ) 退货数量,\n" +
" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 未结数量,\n" +
" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) 实际发货数量,\n" +
" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
" ISNULL( TEMP2.Price, 0 ) * (ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) ) 实际发货总金额 \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" '' AS 交货单号,\n" +
" NULL AS 交货日期,\n" +
" a.PurchaseOrderNo AS 采购订单号,\n" +
" c.MaterialCode AS SAP编码,\n" +
" c.CustomerPartCode AS 物料代码,\n" +
" c.MaterialDesc AS 物料描述,\n" +
" c.EstimateTypeDesc AS 物料组,\n" +
" ISNULL( a.ReceiptQty, 0 ) AS 发货数量,\n" +
" ISNULL( b.ReceiptQty, 0 ) AS 开票数量,\n" +
" ( ISNULL( b.ReceiptQty, 0 ) - ISNULL( a.ReceiptQty, 0 ) ) AS 收货与交货差异 \n" +
" FROM\n" +
" (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_WMSSparePart \n" +
" WHERE\n" +
" PurchaseOrderNo IS NOT NULL \n" +
" AND PurchaseOrderNo != '' {0}\n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
" ) a\n" +
" INNER JOIN ( SELECT SUM ( Qty ) ReceiptQty, OrderBillNum, MaterialCode FROM Set_WmsSharePart90OutPutDetial WHERE State = 2 GROUP BY OrderBillNum, MaterialCode ) AS b ON a.PurchaseOrderNo= b.OrderBillNum \n" +
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" a.ReceiptQty> b.ReceiptQty \n" +
" ) AS temp1\n" +
" LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
" AND temp1.SAP编码= temp3.MaterialCode\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
" ) unint2;";
//string sqlString = "SELECT\n" +
//" * \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" temp1.交货单号,\n" +
//" temp1.交货日期,\n" +
//" temp1.采购订单号,\n" +
//" temp1.SAP编码,\n" +
//" temp1.物料代码,\n" +
//" temp1.物料描述,\n" +
//" temp1.发货数量,\n" +
//" temp1.开票数量,\n" +
//" temp1.收货与交货差异,\n" +
//" ISNULL( temp3.Qty, 0 ) 退货数量,\n" +
//" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 实际发货数量,\n" +
//" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) 未结数量,\n" +
//" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
//" ISNULL( TEMP2.Price, 0 ) * ( ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) ) 实际发货总金额 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' AS 交货单号,\n" +
//" NULL AS 交货日期,\n" +
//" a.PurchaseOrderNo AS 采购订单号,\n" +
//" c.MaterialCode AS SAP编码,\n" +
//" c.CustomerPartCode AS 物料代码,\n" +
//" c.MaterialDesc AS 物料描述,\n" +
//" c.EstimateTypeDesc AS 物料组,\n" +
//" ISNULL( a.ReceiptQty, 0 ) AS 发货数量,\n" +
//" ISNULL( b.Qty, 0 ) AS 开票数量,\n" +
//" ( ISNULL( a.ReceiptQty, 0 ) - ISNULL( b.Qty, 0 ) ) AS 收货与交货差异 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT SUM\n" +
//" ( ReceiptQty ) AS ReceiptQty,\n" +
//" PurchaseOrderNo,\n" +
//" MaterialCode,\n" +
//" SapCode \n" +
//" FROM\n" +
//" Set_WMSSparePart \n" +
//" WHERE\n" +
//" PurchaseOrderNo IS NOT NULL \n" +
//" AND PurchaseOrderNo != '' {0}\n" +
//" GROUP BY\n" +
//" PurchaseOrderNo,\n" +
//" MaterialCode,\n" +
//" SapCode \n" +
//" ) AS a\n" +
//" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode\n" +
//" LEFT JOIN ( SELECT SUM ( Qty ) Qty, OrderBillNum, MaterialCode FROM Set_WmsSharePart90OutPutDetial WHERE State = 2 GROUP BY OrderBillNum, MaterialCode ) AS b ON a.PurchaseOrderNo= b.OrderBillNum \n" +
//" AND a.SapCode = b.MaterialCode \n" +
//" WHERE\n" +
//" b.OrderBillNum IS NULL \n" +
//" AND b.MaterialCode IS NULL \n" +
//" ) AS temp1\n" +
//" LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
//" AND temp1.SAP编码= temp3.MaterialCode\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
//" ) unint1";
#region old #region old
//string sqlString = "SELECT\n" + //string sqlString = "SELECT\n" +

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

@ -9,6 +9,7 @@ using TaskJob.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
@ -44,6 +45,7 @@ namespace SettleAccount.Job.Services.Report
_dapperRepository = dapperRepository; _dapperRepository = dapperRepository;
} }
[UnitOfWork(false)]
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{ {
var _filename = exportName.FirstOrDefault(); var _filename = exportName.FirstOrDefault();

18
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

@ -239,7 +239,7 @@ namespace SettleAccount.Job.Services.Report
} }
//DiffQty 为实际发货数量=发货数量-结算数量-退货数量 财务要求
var kanbanList = _ls.GroupBy(p => new { p.SapCode, p.MaterialDesc, p.MaterialGroup, p.CustomerPartCode }) var kanbanList = _ls.GroupBy(p => new { p.SapCode, p.MaterialDesc, p.MaterialGroup, p.CustomerPartCode })
.Select(p => new UnSettledSum .Select(p => new UnSettledSum
{ {
@ -249,7 +249,7 @@ namespace SettleAccount.Job.Services.Report
//客户物料 = p.Key.CustomerPartCode, //客户物料 = p.Key.CustomerPartCode,
= p.Key.MaterialDesc, = p.Key.MaterialDesc,
= p.Key.MaterialGroup, = p.Key.MaterialGroup,
SAS未结明细汇总 = p.Sum(p => p.WMSDeliveryQty).ToString() SAS未结明细汇总 = p.Sum(p => p.DiffQty).ToString()
}).ToList(); }).ToList();
@ -305,14 +305,20 @@ namespace SettleAccount.Job.Services.Report
//客户物料 = p.Key.客户物料号, //客户物料 = p.Key.客户物料号,
= p.Key., = p.Key.,
= p.Key., = p.Key.,
SAS未结明细汇总 = p.Sum(p => p.).ToString() SAS未结明细汇总 = p.Sum(p => p.).ToString()
}).ToList(); }).ToList();
return kanbanList; return kanbanList;
} }
/// <summary>
/// 大众备件未对
/// </summary>
/// <param name="id"></param>
/// <param name="exportName"></param>
/// <param name="p_list"></param>
/// <returns></returns>
public List<UnSettledSum> GetSparePartSum(Guid id, List<string> exportName, List<CustomCondition> p_list) public List<UnSettledSum> GetSparePartSum(Guid id, List<string> exportName, List<CustomCondition> p_list)
{ {
var fileName = exportName.FirstOrDefault(); var fileName = exportName.FirstOrDefault();
@ -337,7 +343,7 @@ namespace SettleAccount.Job.Services.Report
_ls = _ls.Where(p => _groupList.Contains(p.SAP编码)).ToList(); _ls = _ls.Where(p => _groupList.Contains(p.SAP编码)).ToList();
} }
} }
//说明 为实际发货数量=发货数量-结算数量-退货数量 财务要求
var kanbanList = _ls.GroupBy(p => new { p.SAP编码, p., p. }) var kanbanList = _ls.GroupBy(p => new { p.SAP编码, p., p. })
.Select(p => new UnSettledSum .Select(p => new UnSettledSum
{ {
@ -347,7 +353,7 @@ namespace SettleAccount.Job.Services.Report
//客户物料 = p.Key.物料代码, //客户物料 = p.Key.物料代码,
= p.Key., = p.Key.,
= string.Empty, = string.Empty,
SAS未结明细汇总 = p.Sum(p => p.).ToString() SAS未结明细汇总 = p.Sum(p =>Convert.ToDecimal(p.)).ToString()
}).ToList(); }).ToList();

Loading…
Cancel
Save