Browse Source

提交

FoShanPG
44673626 3 years ago
parent
commit
45aff2652a
  1. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs
  2. 105
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  3. 40
      src/Modules/SettleAccount/src/SettleAccount.HttpApi/BlobFileController.cs

2
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs

@ -410,7 +410,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "差异总金额")] [ExporterHeader(DisplayName = "差异总金额")]
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "寄销库数量")] [ExporterHeader(DisplayName = "寄销库数量",IsIgnore =true)]
public decimal { set; get; } public decimal { set; get; }

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

@ -86,7 +86,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" temp1.外部单号,\n" + " temp1.外部单号,\n" +
" temp1.结算数量,\n" + " temp1.结算数量,\n" +
" temp3.Price AS 结算单价,\n" + " temp3.Price AS 结算单价,\n" +
" ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" + " --( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" +
" ISNULL( temp1.结算金额, 0 ) AS 结算金额,\n" +
" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
" isnull( temp1.发货数量, 0 ) - ISNULL( temp4.Qty, 0 ) AS 实际发货数量,\n" + " isnull( temp1.发货数量, 0 ) - ISNULL( temp4.Qty, 0 ) AS 实际发货数量,\n" +
" ( isnull( temp1.发货数量, 0 ) - ISNULL( temp4.Qty, 0 ) ) * isnull( TEMP2.Price, 0 ) AS 实际发货总金额,\n" + " ( isnull( temp1.发货数量, 0 ) - ISNULL( temp4.Qty, 0 ) ) * isnull( TEMP2.Price, 0 ) AS 实际发货总金额,\n" +
@ -112,7 +113,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" C.EstimateTypeDesc AS 物料组,\n" + " C.EstimateTypeDesc AS 物料组,\n" +
" a.Factory AS 工厂,\n" + " a.Factory AS 工厂,\n" +
" '' AS 看板编号,\n" + " '' AS 看板编号,\n" +
" '' AS 验收单日期 \n" + " '' AS 验收单日期, \n" +
" isnull( a.Amt, 0 ) AS 结算金额\n" +
" FROM\n" + " FROM\n" +
" (\n" + " (\n" +
" SELECT SUM\n" + " SELECT SUM\n" +
@ -123,7 +125,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" StorageLocation,\n" + " StorageLocation,\n" +
" StorageLocationDesc,\n" + " StorageLocationDesc,\n" +
" Factory,\n" + " Factory,\n" +
" ExternalKanbanNumber \n" + " ExternalKanbanNumber,Amt \n" +
" FROM\n" + " FROM\n" +
" Set_HQ_H_Platform \n" + " Set_HQ_H_Platform \n" +
" GROUP BY\n" + " GROUP BY\n" +
@ -133,7 +135,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" StorageLocation,\n" + " StorageLocation,\n" +
" StorageLocationDesc,\n" + " StorageLocationDesc,\n" +
" Factory,\n" + " Factory,\n" +
" ExternalKanbanNumber \n" + " ExternalKanbanNumber,Amt \n" +
" ) AS a\n" + " ) AS a\n" +
" INNER JOIN ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) AS b ON a.HQHKanBan = b.Kanban \n" + " INNER JOIN ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) AS b ON a.HQHKanBan = b.Kanban \n" +
" AND a.MaterialCode = b.MaterialCode\n" + " AND a.MaterialCode = b.MaterialCode\n" +
@ -164,6 +166,101 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND temp1.Sap编码= temp4.MaterialCode"; " AND temp1.Sap编码= temp4.MaterialCode";
//string str = "SELECT\n" +
//" isnull( temp1.交货单号, '' ) 交货单号,\n" +
//" temp1.交货时间,\n" +
//" temp1.[工厂],\n" +
//" temp1.收货仓库,\n" +
//" temp1.收货仓库描述,\n" +
//" temp1.订货看板编号,\n" +
//" temp1.订货零件号,\n" +
//" temp1.验收单日期,\n" +
//" temp1.Sap编码,\n" +
//" temp1.看板编号,\n" +
//" temp1.物料组,\n" +
//" temp1.零件中文名称,\n" +
//" temp1.发货数量,\n" +
//" temp1.外部单号,\n" +
//" temp1.结算数量,\n" +
//" temp3.Price AS 结算单价,\n" +
//" ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" +
//" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
//" isnull( temp1.发货数量, 0 ) - ISNULL( temp4.Qty, 0 ) AS 实际发货数量,\n" +
//" ( isnull( temp1.发货数量, 0 ) - ISNULL( temp4.Qty, 0 ) ) * isnull( TEMP2.Price, 0 ) AS 实际发货总金额,\n" +
//" ( isnull( temp1.发货数量, 0 ) - ISNULL( temp4.Qty, 0 ) - isnull( temp1.[结算数量], 0 ) ) AS 量差,\n" +
//" ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
//" ( ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 ,\n" +
//" temp4.Qty 退货数量 \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' AS 交货单号,\n" +
//" NULL AS 交货时间,\n" +
//" a.StorageLocation AS 收货仓库,\n" +
//" a.StorageLocationDesc AS 收货仓库描述,\n" +
//" a.HQHKanBan AS 订货看板编号,\n" +
//" a.MaterialCode AS 订货零件号,\n" +
//" c.MaterialCode Sap编码,\n" +
//" a.MaterialCode 结算物料代码,\n" +
//" c.MaterialDesc AS 零件中文名称,\n" +
//" isnull( b.Qty, 0 ) AS 发货数量,\n" +
//" a.[ExternalKanbanNumber] AS 外部单号,\n" +
//" isnull( a.Qty, 0 ) AS 结算数量,\n" +
//" C.EstimateTypeDesc AS 物料组,\n" +
//" a.Factory AS 工厂,\n" +
//" '' AS 看板编号,\n" +
//" '' AS 验收单日期 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT SUM\n" +
//" ( Qty ) AS Qty,\n" +
//" HQHKanBan,\n" +
//" MaterialCode,\n" +
//" Version,\n" +
//" StorageLocation,\n" +
//" StorageLocationDesc,\n" +
//" Factory,\n" +
//" ExternalKanbanNumber \n" +
//" FROM\n" +
//" Set_HQ_H_Platform \n" +
//" GROUP BY\n" +
//" HQHKanBan,\n" +
//" MaterialCode,\n" +
//" Version,\n" +
//" StorageLocation,\n" +
//" StorageLocationDesc,\n" +
//" Factory,\n" +
//" ExternalKanbanNumber \n" +
//" ) AS a\n" +
//" INNER JOIN ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) AS b ON a.HQHKanBan = b.Kanban \n" +
//" AND a.MaterialCode = b.MaterialCode\n" +
//" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
//" WHERE\n" +
//" ( a.Version= '{0}' AND a.HQHKanBan IS NOT NULL ) \n" +
//" AND a.HQHKanBan <> 'BJ' \n" +
//" ) AS temp1\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
//" LEFT JOIN (\n" +
//" SELECT\n" +
//" ROUND( SUM ( Amt ) / SUM ( Qty ), 4 ) price,\n" +
//" HQHKanBan,\n" +
//" MaterialCode,\n" +
//" Version \n" +
//" FROM\n" +
//" Set_HQ_H_Platform \n" +
//" WHERE\n" +
//" Version = '{0}' \n" +
//" AND HQHKanBan <> 'BJ' \n" +
//" GROUP BY\n" +
//" HQHKanBan,\n" +
//" MaterialCode,\n" +
//" Version \n" +
//" ) AS TEMP3 ON temp1.[结算物料代码] = TEMP3.MaterialCode \n" +
//" AND temp1.订货看板编号 = TEMP3.HQHKanBan\n" +
//" LEFT JOIN set_backQty temp4 ON temp1.订货看板编号 = temp4.Code \n" +
//" AND temp1.Sap编码= temp4.MaterialCode";
//var _sql = string.Format(str, version, condition); //var _sql = string.Format(str, version, condition);

40
src/Modules/SettleAccount/src/SettleAccount.HttpApi/BlobFileController.cs

@ -1,10 +1,16 @@
using Microsoft.AspNetCore.Mvc; using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml;
using Shouldly;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.WMS;
namespace Win.Sfs.SettleAccount namespace Win.Sfs.SettleAccount
{ {
@ -13,7 +19,7 @@ namespace Win.Sfs.SettleAccount
public class BlobFileController:SettleAccountController public class BlobFileController:SettleAccountController
{ {
private readonly IExcelImportAppService _excelImportService; private readonly IExcelImportAppService _excelImportService;
public IExcelImporter Importer = new ExcelImporter();//导入Excel
public BlobFileController(IExcelImportAppService excelImportService) public BlobFileController(IExcelImportAppService excelImportService)
{ {
_excelImportService = excelImportService; _excelImportService = excelImportService;
@ -31,5 +37,35 @@ namespace Win.Sfs.SettleAccount
return File(fileDto.Content, "application/octet-stream", fileDto.Name); return File(fileDto.Content, "application/octet-stream", fileDto.Name);
} }
[HttpPost]
[Route("saveCustomExcelTemplate")]
public async Task<string> SaveSalesContractExcelImportTemplate()
{
string fileName = "大众通用看板模板.xlsx";
var result = await Importer.GenerateTemplateBytes<WmsCustomerKanbanOutPutDetial>();
result.ShouldNotBeNull();
result.Length.ShouldBeGreaterThan(0);
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = fileName,
Content = result
}
);
Stream stream = new MemoryStream(result);
using (var pck = new ExcelPackage(stream))
{
pck.Workbook.Worksheets.Count.ShouldBe(1);
var sheet = pck.Workbook.Worksheets.First();
var attr = typeof(WmsCustomerKanbanOutPutDetial).GetAttribute<ExcelImporterAttribute>();
var text = sheet.Cells["A1"].Text.Replace("\n", string.Empty).Replace("\r", string.Empty);
text.ShouldBe(attr.ImportDescription.Replace("\n", string.Empty).Replace("\r", string.Empty));
}
return fileName;
}
} }
} }

Loading…
Cancel
Save