Browse Source

更新版本

branch_ccpg_220107
Administrator 3 years ago
parent
commit
c943dd76cc
  1. 36
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  2. 11
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  3. 9
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs
  4. 7
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs
  5. 11
      src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/ReportDetailBase.cs
  6. 85
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs
  7. 163
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDiffDapperRepository.cs
  8. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleFisDiffDetailDapperRepository.cs
  9. 159
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs
  10. 175
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs
  11. 20
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/OutputService.cs
  12. 8
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDiffExportService.cs
  13. 139
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleFisDiffExportService.cs

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

@ -55,10 +55,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
ISettleAccountBranchEfCoreRepository<SettlementPartVersion, Guid> settlementPartVersionrepository, ISettleAccountBranchEfCoreRepository<SettlementPartVersion, Guid> settlementPartVersionrepository,
ISettleAccountBranchEfCoreRepository<FISVersion, Guid> fisVersionrepository, ISettleAccountBranchEfCoreRepository<FISVersion, Guid> fisVersionrepository,
ISettleAccountBranchEfCoreRepository<ItemInvoicePriceVersion, Guid> itemInvoicePriceVersionrepository, ISettleAccountBranchEfCoreRepository<ItemInvoicePriceVersion, Guid> itemInvoicePriceVersionrepository,
//ISettleAccountBranchEfCoreRepository<Material, Guid> materialRepository,
//ISettleAccountBranchEfCoreRepository<InvoiceSettledDiff, Guid> repository,
//ISettleAccountBranchEfCoreRepository<InvoiceSettledDiffVersion, Guid> versionRepository,
//IDistributedCache<InvoiceSettledDiff> cache,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
//ISnowflakeIdGenerator snowflakeIdGenerator, //ISnowflakeIdGenerator snowflakeIdGenerator,
//ICommonManager commonManager, //ICommonManager commonManager,
@ -197,7 +194,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
/// <summary> /// <summary>
/// 导入功能 /// 1.大众发票与结算核对汇总表
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns> /// <returns></returns>
@ -225,14 +222,14 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与开票数据对比" }); customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与开票数据对比" });
customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() }); customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? DateTime.Now.Year.ToString() });
var _taskid = await _service.ExportEnqueueAsync("结算与开票数据对比", ExportExtentsion.Excel, CurrentUser, typeof(InvoiceSettledDiffExportService), customConditionList, (rs) => var _taskid = await _service.ExportEnqueueAsync("大众发票与结算核对汇总表", ExportExtentsion.Excel, CurrentUser, typeof(InvoiceSettledDiffExportService), customConditionList, (rs) =>
{ {
}); });
return _taskid; return _taskid;
} }
/// <summary> /// <summary>
/// 导入功能 /// 3.大众准时化结算数量差异比对表
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns> /// <returns></returns>
@ -254,9 +251,34 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
} }
/// <summary>
///6.大众准时化未结差异比对表
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpGet]
[Route("UnSettleDiffExport-Make")]
[DisableRequestSizeLimit]
public async Task<string> UnSettleDiffExportServiceMake(string version, string materialCode, string begin, string end)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = materialCode });
customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = begin });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end });
var _taskid = await _service.ExportEnqueueAsync("大众准时化未结差异比对表", ExportExtentsion.Excel, CurrentUser, typeof(UnSettleDiffExportService), customConditionList, (rs) =>
{
});
return _taskid;
}

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

@ -2289,18 +2289,25 @@
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.InvoiceSettledDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String)"> <member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.InvoiceSettledDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary> <summary>
导入功能 1.大众发票与结算核对汇总表
</summary> </summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param> <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettleFisDiffExportMake(System.String,System.String,System.String,System.String)"> <member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettleFisDiffExportMake(System.String,System.String,System.String,System.String)">
<summary> <summary>
导入功能 3.大众准时化结算数量差异比对表
</summary> </summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param> <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnSettleDiffExportServiceMake(System.String,System.String,System.String,System.String)">
<summary>
6.大众准时化未结差异比对表
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettledPartAndErpPartPriceDiffMake(System.String,System.String)"> <member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettledPartAndErpPartPriceDiffMake(System.String,System.String)">
<summary> <summary>
结算总成和ERP总成价格对比 结算总成和ERP总成价格对比

9
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs

@ -3,9 +3,18 @@ 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 Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
namespace Win.Sfs.SettleAccount.Entities namespace Win.Sfs.SettleAccount.Entities
{ {
public class CacheManager
{
public static List<Material> CacheMaterials { set; get; }
public static List<PriceList> CachePriceList { set; get; }
}
public interface ISettleAccountEntityBase public interface ISettleAccountEntityBase
{ {
public string Version { set; get; } public string Version { set; get; }

7
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs

@ -12,14 +12,11 @@ namespace Win.Sfs.SettleAccount.Entities.UnSettle
{ {
[ExporterHeader(DisplayName = "结算平台未结数量 ")] [ExporterHeader(DisplayName = "结算平台未结数量 ")]
public decimal Qty { set; get; } public decimal Qty { set; get; }
[ExporterHeader(DisplayName = "定价 ")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额 ")]
public decimal Amt { set; get; }
[ExporterHeader(DisplayName = "漏结标识 ")] [ExporterHeader(DisplayName = "漏结标识 ")]
public string Flag { set; get; } public string Flag { set; get; }
[ExporterHeader(DisplayName = "漏结期间 ")] [ExporterHeader(DisplayName = "漏结期间 ")]
public string UNSettleVersion { set; get; } public string UnSettleVersion { set; get; }
[ExporterHeader(DisplayName = "说明 ")] [ExporterHeader(DisplayName = "说明 ")]
public string Remark { set; get; } public string Remark { set; get; }

11
src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/ReportDetailBase.cs

@ -7,6 +7,7 @@ using System.Threading.Tasks;
namespace Win.Sfs.SettleAccount.Reports namespace Win.Sfs.SettleAccount.Reports
{ {
public class ReportDetailBase public class ReportDetailBase
{ {
[ExporterHeader(DisplayName = "交货单号 ")] [ExporterHeader(DisplayName = "交货单号 ")]
@ -17,7 +18,7 @@ namespace Win.Sfs.SettleAccount.Reports
public string KENNCode { set; get; } public string KENNCode { set; get; }
[ExporterHeader(DisplayName = "底盘号")] [ExporterHeader(DisplayName = "底盘号")]
public string ChassisNumber { set; get; } public string ChassisNumber { set; get; }
[ExporterHeader(DisplayName = "M100交货状态 ")] [ExporterHeader(DisplayName = "交货状态 ")]
public string WmsState { set; get; } public string WmsState { set; get; }
[ExporterHeader(DisplayName = "物料号")] [ExporterHeader(DisplayName = "物料号")]
public string SapMaterialCode { set; get; } public string SapMaterialCode { set; get; }
@ -26,13 +27,15 @@ namespace Win.Sfs.SettleAccount.Reports
[ExporterHeader(DisplayName = "客户物料 ")] [ExporterHeader(DisplayName = "客户物料 ")]
public string MaterialCode { set; get; } public string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料 ")] [ExporterHeader(DisplayName = "组件组物料 ")]
public string ParentMaterialCode { set; get; } public string ParentSapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料描述 ")] [ExporterHeader(DisplayName = "组件组物料描述 ")]
public string ParentMaterialDesc { set; get; } public string ParentMaterialDesc { set; get; }
[ExporterHeader(DisplayName = "物料组(车型) ")] [ExporterHeader(DisplayName = "物料组(车型) ")]
public string MaterialGroup { set; get; } public string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "定价 ")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额 ")]
public decimal Amt { set; get; }
} }

85
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs

@ -0,0 +1,85 @@
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.Entities;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Reports;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
/// <summary>
/// 主数据Dapper表
/// </summary>
public class ErpPartDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public ErpPartDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public virtual List<T> GetDiffReport<T>(List<T> childList) where T : ReportDetailBase, new()
{
List<Material> _materialList = new List<Material>();
List<PriceList> _priceList = new List<PriceList>();
if (CacheManager.CacheMaterials != null)
{
_materialList = CacheManager.CacheMaterials;
}
else
{
_materialList = DbConnection.Query<Material>("select * from set_material").ToList();
}
if (CacheManager.CachePriceList != null)
{
_priceList = CacheManager.CachePriceList;
}
else
{
_priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
}
List<T> _list = new List<T>();
foreach (var itm in childList)
{
var parentMaterial = new T();
parentMaterial.WmsBillNum = itm.WmsBillNum;
parentMaterial.CP5Time = itm.CP5Time;
parentMaterial.KENNCode = itm.KENNCode;
parentMaterial.ChassisNumber = itm.ChassisNumber;
parentMaterial.WmsState = itm.WmsState;
parentMaterial.SapMaterialCode = itm.ParentSapMaterialCode;
parentMaterial.MaterialDesc = itm.ParentMaterialDesc;
parentMaterial.MaterialCode = itm.ParentSapMaterialCode;
parentMaterial.ParentSapMaterialCode = itm.ParentSapMaterialCode;
parentMaterial.ParentMaterialDesc = itm.ParentMaterialDesc;
var _price = _priceList.Where(p => p.MaterialCode == itm.ParentSapMaterialCode).FirstOrDefault();
if (_price != null)
{
parentMaterial.Price = _price.Price;
parentMaterial.Amt = _price.Price;
}
var _material = _materialList.Where(p => p.MaterialCode == itm.ParentSapMaterialCode).FirstOrDefault();
if (_material != null)
{
parentMaterial.MaterialGroup = _material.EstimateTypeDesc;
}
_list.Add(parentMaterial);
}
return _list;
}
}
}

163
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDiffDapperRepository.cs

@ -20,74 +20,117 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob
public virtual List<InvoiceSettledDiff> GetInvoiceSettledDiffReportList(string version,string year, string tablename ,string materialcode) public virtual List<InvoiceSettledDiff> GetInvoiceSettledDiffReportList(string version,string year, string tablename ,string materialcode)
{ {
//string str = string.Empty;
//str += " where 1=1 ";
////if (!string.IsNullOrEmpty(year)) // string sqlString =
////{ //"SELECT \n" + string.Format(" '{0}' as Version ,", version) + "\n" +
//// str += string.Format(" and year='{0}' ", year); //" b.*,\n" +
////} //" ISnull(\n" +
//if (!string.IsNullOrEmpty(version)) //" c.Qty,\n" +
//{ //" IsNull( d.qty, 0 )) SettleQty,\n" +
// str += string.Format(" and version='{0}' ", version); //"CASE\n" +
//} //" \n" +
//" WHEN e.Type = 'CP7报废' THEN\n" +
//" isnull( e.Qty, 0 ) ELSE 0 \n" +
//// string sqlString = "select "+ string.Format(" {0} as Version ,",version) + "a.MaterialCode,isnull(b.qty,0) InvoiceQty,isnull(c.qty,0) SettleQty, (isnull(b.qty,0)-isnull(c.qty,0)) as DiffQty from (\n" + //" END AS CP7ScrapQty,\n" +
//// " select distinct MaterialCode from( \n"+ //"CASE\n" +
////"select distinct MaterialCode from Set_Invoice {0}\n" + //" \n" +
//// "union all\n" + //" WHEN e.Type = '索赔' THEN\n" +
//// "select distinct MaterialCode from {1} {0}\n" + //" isnull( e.Qty, 0 ) ELSE 0 \n" +
//// ") temp \n"+ //" END AS ClaimQty,\n" +
//// ") as a\n" + //" (\n" +
//// "left join\n" + //" b.InvoiceQty - ISnull(\n" +
//// "\n" + //" c.Qty,\n" +
//// "(select SUM(QTY) qty,MaterialCode from Set_Invoice {0} GROUP BY MaterialCode) b on a.MaterialCode=b.MaterialCode\n" + //" IsNull( d.qty, 0 ))) DiffQty,\n" +
//// "\n" + //" Isnull( f.Price, 0 ) SalePrice,\n" +
//// "left join\n" + //" b.InvoicePrice - Isnull( f.Price, 0 ) DiffPrice,\n" +
//// "(select SUM(QTY) qty,MaterialCode from {1} {0} GROUP BY MaterialCode) c on a.MaterialCode=c.MaterialCode"; //" '' AS SapMaterialCode \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" Factory, MaterialCode,\n" +
//" SUM( QTY ) InvoiceQty,\n" +
//" sum( amt ) InvoiceAmt,\n" +
//" sum( amt )/ sum( Qty ) InvoicePrice \n" +
//" FROM\n" +
//" Set_Invoice \n" +
//" WHERE\n" +
//" version = '{0}' \n" +
//" GROUP BY\n" +
//" MaterialCode,Factory \n" +
//" ) b\n" +
//" LEFT JOIN ( SELECT SUM( QTY ) Qty, MaterialCode FROM Set_settle WHERE version = '{0}' GROUP BY MaterialCode ) c ON b.MaterialCode = c.MaterialCode\n" +
//" LEFT JOIN ( SELECT SUM( QTY ) qty, MaterialCode FROM Set_KanbanSettle WHERE version = '{0}' GROUP BY MaterialCode ) d ON b.MaterialCode = d.MaterialCode\n" +
//" LEFT JOIN ( SELECT * FROM Set_ScrapClaims WHERE version = '{0}' ) e ON b.MaterialCode = e.MaterialCode\n" +
//" LEFT JOIN ( SELECT * FROM Set_PriceList WHERE version = '{0}' ) f ON b.MaterialCode = f.MaterialCode";
string sqlString = string sqlString =
"SELECT \n" + string.Format(" '{0}' as Version ,", version) + "\n" + "SELECT\n" +
" b.*,\n" + " temp1.*, temp1.InvoicePrice - Isnull( temp2.Price, 0 ) DiffPrice , \n" +
" ISnull(\n" + " temp2.Price SalePrice\n" +
" c.Qty,\n" +
" IsNull( d.qty, 0 )) SettleQty,\n" +
"CASE\n" +
" \n" +
" WHEN e.Type = 'CP7报废' THEN\n" +
" isnull( e.Qty, 0 ) ELSE 0 \n" +
" END AS CP7ScrapQty,\n" +
"CASE\n" +
" \n" +
" WHEN e.Type = '索赔' THEN\n" +
" isnull( e.Qty, 0 ) ELSE 0 \n" +
" END AS ClaimQty,\n" +
" (\n" +
" b.InvoiceQty - ISnull(\n" +
" c.Qty,\n" +
" IsNull( d.qty, 0 ))) DiffQty,\n" +
" Isnull( f.Price, 0 ) SalePrice,\n" +
" b.InvoicePrice - Isnull( f.Price, 0 ) DiffPrice,\n" +
" '' AS SapMaterialCode \n" +
"FROM\n" + "FROM\n" +
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
" Factory, MaterialCode,\n" + string.Format(" '{0}' as Version ,", version)+"\n" +
" SUM( QTY ) InvoiceQty,\n" + " b.*,\n" +
" sum( amt ) InvoiceAmt,\n" + " ISnull(\n" +
" sum( amt )/ sum( Qty ) InvoicePrice \n" + " c.Qty,\n" +
" IsNull( d.qty, 0 )) SettleQty,\n" +
" CASE\n" +
" \n" +
" WHEN e.Type = 'CP7报废' THEN\n" +
" isnull( e.Qty, 0 ) ELSE 0 \n" +
" END AS CP7ScrapQty,\n" +
" CASE\n" +
" \n" +
" WHEN e.Type = '索赔' THEN\n" +
" isnull( e.Qty, 0 ) ELSE 0 \n" +
" END AS ClaimQty,\n" +
" (\n" +
" b.InvoiceQty - ISnull(\n" +
" c.Qty,\n" +
" IsNull( d.qty, 0 ))) DiffQty,\n" +
//" Isnull( f.Price, 0 ) SalePrice,\n" +
//" b.InvoicePrice - Isnull( f.Price, 0 ) DiffPrice,\n" +
" g.MaterialCode AS SapMaterialCode,\n" +
" g.MaterialDesc AS MaterialDesc \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" Factory,\n" +
" MaterialCode,\n" +
" SUM( QTY ) InvoiceQty,\n" +
" sum( amt ) InvoiceAmt,\n" +
" sum( amt )/ sum( Qty ) InvoicePrice \n" +
" FROM\n" +
" Set_Invoice \n" +
" WHERE\n" +
" version = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Factory \n" +
" ) b\n" +
" LEFT JOIN ( SELECT SUM( QTY ) Qty, MaterialCode FROM Set_settle WHERE version = '{0}' GROUP BY MaterialCode ) c ON b.MaterialCode = c.MaterialCode\n" +
" LEFT JOIN ( SELECT SUM( QTY ) qty, MaterialCode FROM Set_KanbanSettle WHERE version = '{0}' GROUP BY MaterialCode ) d ON b.MaterialCode = d.MaterialCode\n" +
" LEFT JOIN ( SELECT * FROM Set_ScrapClaims WHERE version = '{0}' ) e ON b.MaterialCode = e.MaterialCode\n" +
//" LEFT JOIN ( SELECT * FROM Set_PriceList WHERE version = '{0}' ) f ON b.MaterialCode = f.MaterialCode\n" +
" LEFT JOIN Set_material g ON b.MaterialCode = g.CustomerPartCode \n" +
" ) temp1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" Price,\n" +
" MaterialCode \n" +
" FROM\n" + " FROM\n" +
" Set_Invoice \n" + " Set_PriceList \n" +
" WHERE\n" + " WHERE\n" +
" version = '{0}' \n" + " version =(\n" +
" GROUP BY\n" + " SELECT\n" +
" MaterialCode,Factory \n" + " max( version ) \n" +
" ) b\n" + " FROM\n" +
" LEFT JOIN ( SELECT SUM( QTY ) Qty, MaterialCode FROM Set_settle WHERE version = '{0}' GROUP BY MaterialCode ) c ON b.MaterialCode = c.MaterialCode\n" + " Set_PriceListVersion \n" +
" LEFT JOIN ( SELECT SUM( QTY ) qty, MaterialCode FROM Set_KanbanSettle WHERE version = '{0}' GROUP BY MaterialCode ) d ON b.MaterialCode = d.MaterialCode\n" + " )) temp2 ON temp1.SapMaterialCode = temp2.MaterialCode";
" LEFT JOIN ( SELECT * FROM Set_ScrapClaims WHERE version = '{0}' ) e ON b.MaterialCode = e.MaterialCode\n" +
" LEFT JOIN ( SELECT * FROM Set_PriceList WHERE version = '{0}' ) f ON b.MaterialCode = f.MaterialCode";

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

@ -46,6 +46,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public string SapCode { set; get; } public string SapCode { set; get; }
} }
[ExcelExporter(Name = "未结汇总", AutoFitAllColumn = true, MaxRowNumberOnASheet = 500000)]
public class SettleFisDiffSum public class SettleFisDiffSum
{ {

159
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs

@ -32,6 +32,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
/// <summary>
/// 6.大众准时化未结差异比对表
/// </summary>
public class UnSettleDiffDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency public class UnSettleDiffDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{ {
public UnSettleDiffDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider) public UnSettleDiffDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider)
@ -44,71 +47,125 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string str1 = "where 1=1 "; string str1 = "where 1=1 ";
string sql1 = "SELECT\n" +
" a.MaterialCode,\n" + string sql1 = "SELECT\n" +
" a.KENNCode,\n" + " a.MaterialCode,\n" +
" a.ChassisNumber,\n" + " a.KENNCode,\n" +
" a.qty unsettleQty,\n" + " a.ChassisNumber,\n" +
" b.qty \n" + " a.qty UNSettleQty,\n" +
" a.Cp5Time \n"+ " b.qty,\n" +
" a.CP5A CP5Time,\n" +
"FROM\n" + " c.MaterialCode SapMaterialCode,\n" +
" Set_unsettle a\n" + " c.MaterialDesc MaterialDesc,\n" +
" LEFT JOIN (\n" + " a.model Factory \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" + "FROM\n" +
" (\n" + " Set_unsettle a\n" +
" LEFT JOIN (\n" +
" SELECT\n" + " SELECT\n" +
" WMSState,\n" +
" WMSBillNum,\n" +
" ItemCode,\n" + " ItemCode,\n" +
" KENNCode,\n" + " KENNCode,\n" +
" ChassisNumber2,\n" + " ChassisNumber2,\n" +
" sum( qty ) qty,\n" + " sum( qty ) qty \n" +
" ErpMaterialCode,\n" +
" ChassisNumber \n" +
" FROM\n" + " FROM\n" +
" Set_fis \n" + " Set_fis \n" +
" WHERE\n" + " WHERE\n" +
" state = 0 \n" + " state = 0 \n" +
" OR state = 4 \n" +
" GROUP BY\n" + " GROUP BY\n" +
" ItemCode,\n" + " ItemCode,\n" +
" KENNCode,\n" + " KENNCode,\n" +
" ChassisNumber2,\n" + " ChassisNumber2,\n" +
" WMSState,\n" + " Model \n" +
" WMSBillNum,\n" + " ) b ON a.ChassisNumber = b.ChassisNumber2 \n" +
" ErpMaterialCode,\n" + " AND a.MaterialCode = b.ItemCode \n" +
" ChassisNumber \n" + " AND a.KENNCode = b.KENNCode\n" +
" Cp5Time \n" + " LEFT JOIN Set_material c ON a.MaterialCode = c.CustomerPartCode {0}";
" ) 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 sql2 =
"SELECT\n" +
" t1.*,\n" +
" t1.Qty * T2.Price AMT,\n" +
" T2.Price,\n" +
" Qty -(\n" +
" ISNULL( UnSettleQty, 0 )) DiffQty,\n" +
" Qty -(\n" +
" ISNULL( UnSettleQty, 0 ))* isnull( t2.Price, 0 ) DiffPrice \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" temp1.WMSState,\n" +
" temp1.WMSBillNum,\n" +
" temp1.MaterialCode,\n" +
" temp1.KENNCode,\n" +
" temp1.ChassisNumber2,\n" +
" temp1.Qty,\n" +
" temp1.ChassisNumber,\n" +
" temp1.CP5Time,\n" +
" temp1.UnSettleQty,\n" +
" temp1.SapMaterialCode,\n" +
" temp1.MaterialDesc,\n" +
" temp1.MaterialGroup,\n" +
" temp2.MaterialCode AS ParentSapMaterialCode,\n" +
" temp2.MaterialDesc AS ParentMaterialDesc \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" a.WMSState,\n" +
" a.WMSBillNum,\n" +
" a.MaterialCode,\n" +
" a.KENNCode,\n" +
" a.ChassisNumber2,\n" +
" a.Qty,\n" +
" a.ParentCode,\n" +
" a.ChassisNumber,\n" +
" a.CP5Time,\n" +
" b.Qty AS UnSettleQty,\n" +
" C.MaterialCode AS SapMaterialCode,\n" +
" C.MaterialDesc,\n" +
" C.EstimateTypeDesc AS MaterialGroup \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" WMSState,\n" +
" WMSBillNum,\n" +
" ItemCode AS MaterialCode,\n" +
" KENNCode,\n" +
" ChassisNumber2,\n" +
" SUM( Qty ) AS Qty,\n" +
" ErpMaterialCode AS ParentCode,\n" +
" ChassisNumber,\n" +
" CP5Time \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" +
" ) AS a\n" +
" LEFT OUTER JOIN Set_Unsettle AS b ON a.ChassisNumber2 = b.ChassisNumber \n" +
" AND b.MaterialCode = a.MaterialCode \n" +
" AND a.KENNCode = b.KENNCode\n" +
" LEFT OUTER JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN Set_material AS temp2 ON temp1.ParentCode = temp2.CustomerPartCode \n" +
" ) t1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" MaterialCode,\n" +
" Price \n" +
" FROM\n" +
" Set_PriceList \n" +
"WHERE\n" +
" version = ( SELECT max( version ) FROM Set_PriceListVersion )) t2 ON t1.MaterialCode = t2.MaterialCode";
string _sql = string.Empty; string _sql = string.Empty;

175
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs

@ -11,18 +11,23 @@ using Dapper;
using Win.Sfs.SettleAccount.FISes; using Win.Sfs.SettleAccount.FISes;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.ExportDto; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.ExportDto;
using Win.Sfs.SettleAccount.Entities.UnSettle; using Win.Sfs.SettleAccount.Entities.UnSettle;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
/// <summary>
/// 7.大众准时化未结明细表(包含漏结,漏结要有标识)
/// </summary>
public class UnSettledDetailDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency public class UnSettledDetailDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{ {
//ERP总成开票报表
public UnSettledDetailDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider) public UnSettledDetailDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider)
{ {
} }
public virtual List<UnSettleDetailReport> GetDiffReport(string year, string begin, string end, string customcode, string version,string materialCode,string materialGroup,string sapCode) public virtual List<UnSettleDetailReport> GetDiffReport(string year, string begin, string end, string customcode, string version, string materialCode, string materialGroup, string sapCode)
{ {
string str = string.Empty; string str = string.Empty;
@ -30,7 +35,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
if (!string.IsNullOrEmpty(begin)) if (!string.IsNullOrEmpty(begin))
{ {
str += string.Format(" and beginTime>'{0}' ",begin); str += string.Format(" and beginTime>'{0}' ", begin);
} }
if (!string.IsNullOrEmpty(end)) if (!string.IsNullOrEmpty(end))
{ {
@ -38,81 +43,113 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
if (!string.IsNullOrEmpty(materialCode)) if (!string.IsNullOrEmpty(materialCode))
{ {
str += string.Format(" and MaterialCode='{0}' ", materialCode); str += string.Format(" and ItemCode='{0}' ", materialCode);
} }
if (!string.IsNullOrEmpty(materialGroup)) if (!string.IsNullOrEmpty(materialGroup))
{ {
str += string.Format(" and MaterialGroup='{0}' ", materialGroup); str += string.Format(" and MaterialGroup='{0}' ", materialGroup);
} }
if (!string.IsNullOrEmpty(sapCode)) //if (!string.IsNullOrEmpty(sapCode))
{ //{
str += string.Format(" and MaterialGroup='{0}' ", materialGroup); // str += string.Format(" and SapCode='{0}' ", materialGroup);
} //}
var sqlString = var sqlString =
" SELECT\n" + "SELECT\n" +
" A.*,\n" + " A.*,\n" +
" C.Price,\n" + " C.Price,\n" +
" ISNULL( A.QTY, 0 )* ISNULL( C.Price, 0 ) AMT \n" + " ISNULL( A.QTY, 0 )* ISNULL( C.Price, 0 ) AMT,\n" +
"FROM\n" + " B.EstimateTypeDesc MaterialGroup,\n" +
" (\n" + " B.MaterialDesc MaterialDesc,\n" +
" SELECT DISTINCT\n" + " d.MaterialDesc ParentMaterialDesc \n" +
" '' WMSState,\n" + "FROM\n" +
" '' UnSettleVersion,\n" + " (\n" +
" '' WMSBillNum,\n" + " SELECT\n" +
" BeginTime CP5Time,\n" + " WMSState,\n" +
" ErpMaterialCode MaterialCode,\n" + " WMSBillNum,\n" +
" ChassisNumber,\n" + " UnSettleVersion,\n" +
" KENNCode,\n" + " BeginTime CP5Time,\n" +
" 1 QTY,\n" + " ItemCode MaterialCode,\n" +
" ErpMaterialCode ParentMaterialCode,\n" + " ChassisNumber,\n" +
" '' FLAG \n" + " KENNCode,\n" +
" FROM\n" + " QTY,\n" +
" Set_fis \n" + " ErpMaterialCode ParentSapMaterialCode,\n" +
" WHERE\n" + " '' FLAG \n" +
" 1 = 1 \n" + " FROM\n" +
" AND STATE = 0 {0} UNION ALL\n" + " Set_fis {0} \n" +
" SELECT\n" + " WHERE\n" +
" WMSState,\n" + " 1 = 1 \n" +
" UnSettleVersion,\n" + " AND STATE = 0 UNION ALL\n" +
" WMSBillNum,\n" + " SELECT\n" +
" BeginTime CP5Time,\n" + " WMSState,\n" +
" ItemCode MaterialCode,\n" + " UnSettleVersion,\n" +
" ChassisNumber,\n" + " WMSBillNum,\n" +
" KENNCode,\n" + " BeginTime CP5Time,\n" +
" QTY,\n" + " ItemCode MaterialCode,\n" +
" ErpMaterialCode,\n" + " ChassisNumber,\n" +
" '' FLAG \n" + " KENNCode,\n" +
" FROM\n" + " QTY,\n" +
" [Set_fis] \n" + " ErpMaterialCode ParentSapMaterialCode,\n" +
" WHERE\n" + " 'L' FLAG \n" +
" 1 = 1 \n" + " FROM\n" +
" AND STATE = 0 {0} UNION ALL\n" + " Set_fis {0} \n" +
" SELECT\n" + " WHERE\n" +
" WMSState,\n" + " 1 = 1 \n" +
" UnSettleVersion,\n" + " AND STATE = 4 \n" +
" WMSBillNum,\n" + " ) A\n" +
" BeginTime CP5Time,\n" + " LEFT JOIN Set_material B ON a.MaterialCode = b.CustomerPartCode\n" +
" ItemCode MaterialCode,\n" + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) C ON a.MaterialCode = c.MaterialCode\n" +
" ChassisNumber,\n" + " LEFT JOIN Set_material d ON a.ParentSapMaterialCode = d.MaterialCode";
" KENNCode,\n" +
" QTY,\n" +
" ErpMaterialCode,\n" +
" 'L' FLAG \n" +
" FROM\n" +
" [Set_fis] \n" +
" WHERE\n" +
" 1 = 1 \n" + var _materialList = DbConnection.Query<Material>("select * from set_material").ToList();
" AND STATE = 4 {0}\n" + var _priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
" ) A\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) C ON a.MaterialCode = c.MaterialCode";
string _sql = string.Format(sqlString, str);
string _sql = string.Format(sqlString, version);
; ;
var _query = DbConnection.Query<UnSettleDetailReport>(_sql); var _query = DbConnection.Query<UnSettleDetailReport>(_sql);
return _query.ToList();
var _list = _query.ToList();
var _ls = _list.Where(p=>p.Flag!="L").GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
foreach (var itm in _ls)
{
var parentMaterial = new UnSettleDetailReport();
parentMaterial.WmsBillNum = itm.WmsBillNum;
parentMaterial.CP5Time = itm.CP5Time;
parentMaterial.KENNCode = itm.KENNCode;
parentMaterial.ChassisNumber = itm.ChassisNumber;
parentMaterial.WmsState = itm.WmsState;
parentMaterial.SapMaterialCode = itm.ParentSapMaterialCode;
parentMaterial.MaterialDesc = itm.ParentMaterialDesc;
parentMaterial.MaterialCode = itm.ParentSapMaterialCode;
parentMaterial.ParentSapMaterialCode = itm.ParentSapMaterialCode;
parentMaterial.ParentMaterialDesc = itm.ParentMaterialDesc;
var _price=_priceList.Where(p => p.MaterialCode == itm.ParentSapMaterialCode).FirstOrDefault();
if (_price != null)
{
parentMaterial.Price = _price.Price;
parentMaterial.Amt = _price.Price;
}
var _material=_materialList.Where(p => p.MaterialCode == itm.ParentSapMaterialCode).FirstOrDefault();
if (_material != null)
{
parentMaterial.MaterialGroup = _material.EstimateTypeDesc;
}
_list.Add(parentMaterial);
}
return _list;
} }
} }
} }

20
src/Modules/SettleAccount/src/SettleAccount.Job/Services/OutputService.cs

@ -57,8 +57,26 @@ namespace SettleAccount.Job.Services
_taskjobRepository.UpdateTaskJob(Id, _task); _taskjobRepository.UpdateTaskJob(Id, _task);
//保存导出文件到服务器存成二进制 //保存导出文件到服务器存成二进制
} }
public void Export<T1,T2>(Guid Id, string fileName, List<T1> p_list, List<T2> p_list1) where T1 : class, new()
where T2: class, new()
{
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter
.Append(p_list, "sheet1")
.SeparateBySheet()
.Append(p_list1)
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(fileName, result.Result, true);
var _task = new Win.Sfs.SettleAccount.Entities.TaskJob() { DownFileName = fileName };
_taskjobRepository.UpdateTaskJob(Id, _task);
//保存导出文件到服务器存成二进制
}

8
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDiffExportService.cs

@ -70,8 +70,12 @@ namespace SettleAccount.Job.Services
SalePrice =itm. SalePrice , SalePrice =itm. SalePrice ,
DiffPrice =itm. DiffPrice , DiffPrice =itm. DiffPrice ,
SapMaterialCode =itm.SapMaterialCode , SapMaterialCode =itm.SapMaterialCode ,
Factory = itm.Factory MaterialDesc=itm.MaterialDesc,
Factory = itm.Factory,

139
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleFisDiffExportService.cs

@ -1,5 +1,8 @@
using System; using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
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;
@ -12,12 +15,18 @@ using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
{ {
/// <summary>
/// 3.大众准时化结算数量差异比对表
/// </summary>
public class SettleFisDiffExportService : ITransientDependency, IExportJob public class SettleFisDiffExportService : ITransientDependency, IExportJob
{ {
private readonly SettleFisDiffDetailDapperRepository _dapper; private readonly SettleFisDiffDetailDapperRepository _dapper;
private readonly OutputService _outputService; private readonly OutputService _outputService;
public SettleFisDiffExportService(SettleFisDiffDetailDapperRepository dapper, OutputService outputService) public SettleFisDiffExportService(SettleFisDiffDetailDapperRepository dapper, OutputService outputService)
{ {
_dapper = dapper; _dapper = dapper;
@ -33,7 +42,7 @@ namespace SettleAccount.Job.Services.Report
var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var _list= _dapper.GetReportList(version, materialCode, begin,end); var _list= _dapper.GetReportList(version, materialCode, begin,end);
_list.GroupBy(p => new { p.MaterialCode,p.SapCode }).Select(p =>new SettleFisDiffSum var _ls= _list.GroupBy(p => new { p.MaterialCode,p.SapCode }).Select(p =>new SettleFisDiffSum
{ {
MaterialCode= p.Key.MaterialCode, MaterialCode= p.Key.MaterialCode,
@ -46,18 +55,132 @@ namespace SettleAccount.Job.Services.Report
}); });
//_outputService.Export(id, string.Format("大众准时化结算数量差异比对表_{0}.xlsx", Guid.NewGuid().ToString()),_list.ToList(),_ls.ToList());
_outputService.Export<SettleFisDiffSum>(id, string.Format("大众准时化结算数量合计_{0}.xlsx", Guid.NewGuid().ToString()), _ls.ToList());
_outputService.Export<SettleFisDiffDetail>(id,string.Format("大众准时化结算数量差异比对表_{0}.xlsx", Guid.NewGuid().ToString()), _list);
return id.ToString();
}
/// <summary>
/// 将数个Excel文件中的第一个工作表合并至一个Excel文件中
/// </summary>
/// <param name="excelFilePaths">需要合并的数个Excel文件路径</param>
/// <param name="desFilePath">合并成的一个Excel文件路径</param>
private void MergeExcels(string[] excelFilePaths, string desFilePath)
{
XSSFWorkbook mergeWorkBook = new XSSFWorkbook();
for (int i = 0; i < excelFilePaths.Length; i++)
{
if (File.Exists(excelFilePaths[i]))
{
using (FileStream fs = new FileStream(excelFilePaths[i], FileMode.Open, FileAccess.Read, FileShare.Write))
{
XSSFWorkbook tmpWorkBook = new XSSFWorkbook(fs);
XSSFSheet tmpSheet = tmpWorkBook.GetSheetAt(0) as XSSFSheet;
if (excelFilePaths[i].Contains("当月结算表"))
{
IRow row = null;
for (int j = 2; j < tmpSheet.PhysicalNumberOfRows && tmpSheet.GetRow(j) != null; j++)/*j=1 从索引的第一行开始过滤掉表头*/
{
row = tmpSheet.GetRow(j);
try
{
if (!string.IsNullOrWhiteSpace(row.GetCell(1).ToString()))/*验证数值非空*/
{
//cell.CSS("color:red;font-weight:bold;font-size:11;font-name:宋体;border-type:thin;")
/*修改样式关键代码*/
ICellStyle style = tmpWorkBook.CreateCellStyle();
style.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Orange.Index;
style.FillPattern = FillPattern.SolidForeground;
style.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.Orange.Index;
style.BorderTop = BorderStyle.Thin;//上
style.BorderBottom = BorderStyle.Thin;//下
style.BorderLeft = BorderStyle.Thin;//左
style.BorderRight = BorderStyle.Thin;//右
style.VerticalAlignment = VerticalAlignment.Center;
style.Alignment = HorizontalAlignment.Center;
IFont font = tmpWorkBook.CreateFont();
font.FontHeightInPoints = 10; // 字体大小 直接对应Excel中的字体大小
font.FontName = "宋体"; //跟Excel中的字体值一样,直接写对应的名称即可
font.IsBold = true;//加粗
style.SetFont(font);
/*修改指定单元格样式 如果要修改行样式则需要将row.Cells.Count循环出来,挨个设置!*/
for (int g = 0; g < row.Cells.Count; g++)
{
row.Cells[g].CellStyle = style;
}
row.RowStyle = style;
if (row.GetCell(1).ToString() == "核算表不存在")
{
ICellStyle style1 = tmpWorkBook.CreateCellStyle();
style1.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Yellow.Index;
style1.FillPattern = FillPattern.SolidForeground;
style1.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.Yellow.Index;
style1.BorderTop = BorderStyle.Thin;//上
style1.BorderBottom = BorderStyle.Thin;//下
style1.BorderLeft = BorderStyle.Thin;//左
style1.BorderRight = BorderStyle.Thin;//右
style1.VerticalAlignment = VerticalAlignment.Center;
style1.Alignment = HorizontalAlignment.Center;
IFont font1 = tmpWorkBook.CreateFont();
font1.FontHeightInPoints = 10; // 字体大小 直接对应Excel中的字体大小
font1.FontName = "宋体"; //跟Excel中的字体值一样,直接写对应的名称即可
font1.IsBold = true;//加粗
font1.Color = NPOI.HSSF.Util.HSSFColor.White.Index;
style1.SetFont(font);
//style.fon
//HSSFFont font = workbookAll.CreateFont();
//font.FontHeightInPoints = 9; // 字体大小 直接对应Excel中的字体大小
//font.FontName = "宋体"; //跟Excel中的字体值一样,直接写对应的名称即可
//font.Boldweight = HSSFFont.BOLDWEIGHT_BOLD;//加粗
//style.SetFont(font);
/*修改指定单元格样式 如果要修改行样式则需要将row.Cells.Count循环出来,挨个设置!*/
for (int g = 0; g < row.Cells.Count; g++)
{
row.Cells[g].CellStyle = style1;
}
row.RowStyle = style1;
}
/*重新修改文件指定单元格样式*/
}
}
catch
{ }
}
}
tmpSheet.CopyTo(mergeWorkBook, Path.GetFileNameWithoutExtension(excelFilePaths[i]), true, true);
}
}
/* 考虑数据量,此处可以限制最多可以合并工作表的数量 */
//if (mergeWorkBook.NumberOfSheets >= 200)
//{
// break;
//}
}
if (mergeWorkBook.NumberOfSheets != 0)
{
FileStream fsDesFile = new FileStream(desFilePath, FileMode.OpenOrCreate, FileAccess.Write);
mergeWorkBook.Write(fsDesFile);
fsDesFile.Close();
mergeWorkBook.Close();
}
else
{
mergeWorkBook.Close();
}
}
_outputService.Export<SettleFisDiffDetail>(id,string.Format("大众准时化结算数量差异比对表_{0}.xlsx", Guid.NewGuid().ToString()), _list);
return id.ToString();
}
} }
} }

Loading…
Cancel
Save