Browse Source

更新版本

branch_ccpg_220107
Administrator 3 years ago
parent
commit
af4a491971
  1. 3
      .gitignore
  2. BIN
      .vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo
  3. 8
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json
  4. 6
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  5. 79
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  6. 6
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  7. 3
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs
  8. 51
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs
  9. 42
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs
  10. 81
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
  11. 10
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs
  12. 316
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs
  13. 130
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs
  14. 148
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs
  15. 5
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDiffExportService.cs
  16. 82
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs
  17. 3
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs
  18. 7
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs
  19. 49
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs
  20. 19
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs
  21. 5
      src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

3
.gitignore

@ -7,4 +7,5 @@
/src/.vs/SmartFactorySuite/DesignTimeBuild/.dtbcache.v2
/src/.vs/SmartFactorySuite/v16/.suo
/src/.vs/SettleAccount/v16/.suo
/src/Shared

BIN
.vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo

Binary file not shown.

8
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json

@ -6,9 +6,11 @@
// "Default": "Server=LAPTOP-V3U07C2O;Database=ABP;user id=sa;Password=1q2w!@#",
// "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService;user id=sa;Password=1q2w!@#;"
//},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;"
"ConnectionStrings": {
//"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
//"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;"
"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;",
"SettleAccountService": "Server=192.168.0.140;Database=SettleAccountService;user id=sa;password=Microsoft2008;"
},
"Logging": {
"LogLevel": {

6
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -7,8 +7,10 @@
// "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService;user id=sa;Password=1q2w!@#;"
//},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=127.0.0.1;"
//"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
//"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;"
"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;",
"SettleAccountService": "Server=192.168.0.140;Database=SettleAccountService;user id=sa;password=Microsoft2008;"
},
"Logging": {
"LogLevel": {

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

@ -97,10 +97,9 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
string cp7end,
string kenncode,
string chassisNumber,
string materialGroup
string materialGroup
)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(version) ? string.Empty : version });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(materialCode) ? string.Empty : materialCode });
@ -136,7 +135,6 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
public async Task<string> SettledKanBanWithCode(string kanBan, string sapMaterialCode, string version, string customerCode, string customerPartCode, string estimateTypeDesc,
string state, DateTime begin, DateTime end)
{
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 });
@ -366,10 +364,16 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
string cp7end,
string kenncode,
string chassisNumber,
string materialGroup
List<string> materialGroup
)
{
string str1 = string.Empty;
if(materialGroup!=null)
{
str1 = string.Join(',', materialGroup.ToArray());
}
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value =string.IsNullOrEmpty(version) ?string.Empty:version });
@ -380,7 +384,9 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(cp7end) ? string.Empty : cp7end });
customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(kenncode) ? string.Empty : kenncode });
customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(str1) ? string.Empty : str1 });
var _taskid = await _service.ExportEnqueueAsync("大众发票与结算核对明细表", ExportExtentsion.Excel, CurrentUser, typeof(InvoiceSettledDetailDiffExportService), customConditionList, (rs) =>
@ -406,7 +412,9 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
string cp7begin,
string cp7end,
string kenncode,
string chassisNumber
string chassisNumber,
string materialGroup
)
{
@ -420,6 +428,10 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(cp7end) ? string.Empty : cp7end });
customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(kenncode) ? string.Empty : kenncode });
customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber });
customConditionList.Add(new CustomCondition() { Name = "Mater", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup });
var _taskid = await _service.ExportEnqueueAsync("大众结算未发运核对明细表", ExportExtentsion.Excel, CurrentUser, typeof(UnInvoiceSettledDetailDiffExportService), customConditionList, (rs) =>
{
});
@ -458,32 +470,27 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
[Route("UnsettledDetailReportService-Make")]
[DisableRequestSizeLimit]
public async Task<string> UnsettledDetailReportServiceMake(string version,string customerCode,string materialGroup, string materialCode, string begin, string end,string sapCode)
public async Task<string> UnsettledDetailReportServiceMake(
string version,
string materialCode,
string begin,
string end,
string kenncode,
string chassisNumber,
string materialGroup
)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = !string.IsNullOrEmpty(version)?version:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = !string.IsNullOrEmpty(customerCode)?version:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value =string.Empty });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(materialCode)?materialCode:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = !string.IsNullOrEmpty(materialGroup)? materialGroup:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value =!string.IsNullOrEmpty(sapCode)?sapCode:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value =string.Empty });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(materialCode)?materialCode:string.Empty });
customConditionList.Add(new CustomCondition() { Name = "Begin", Value = !string.IsNullOrEmpty(begin)?string.Empty: begin });
customConditionList.Add(new CustomCondition() { Name = "End", Value = !string.IsNullOrEmpty(end)?string.Empty: end });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(end) ? string.Empty : end });
//var _first = exportName.FirstOrDefault();
//var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
//var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value;
//var materailCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
//var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
//var sapcode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
//var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
//var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(kenncode) ? string.Empty : kenncode });
customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber });
var _taskid = await _service.ExportEnqueueAsync("大众准时化未结明细表", ExportExtentsion.Excel, CurrentUser, typeof(UnsettledDetailReportService), customConditionList, (rs) =>
{
@ -512,7 +519,19 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
[Route("UnSettleDiffExport-Make")]
[DisableRequestSizeLimit]
public async Task<string> UnSettleDiffExportServiceMake(string version, string type,string year,string materialCode,string sapMaterialCode, string begin, string end)
public async Task<string> UnSettleDiffExportServiceMake(
string version,
string materialCode,
string begin,
string end,
string kenncode,
string chassisNumber,
string materialGroup,
string type
)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version });
@ -520,11 +539,15 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = begin });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end });
customConditionList.Add(new CustomCondition() { Name = "Type", Value = type });
customConditionList.Add(new CustomCondition() { Name = "Year", Value = year });
customConditionList.Add(new CustomCondition() { Name = "Year", Value = string.Empty });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = materialCode });
customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = sapMaterialCode });
customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = string.Empty });
customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(kenncode) ? string.Empty : kenncode });
customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(chassisNumber) ? string.Empty : chassisNumber });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup });
// var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
//var type = p_list.Where(p => p.Name == "Type").FirstOrDefault().Value;
//var year = p_list.Where(p => p.Name == "Year").FirstOrDefault().Value;
//var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;

6
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -2735,14 +2735,14 @@
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.InvoiceSettledDetailDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.InvoiceSettledDetailDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Collections.Generic.List{System.String})">
<summary>
2.大众发票与结算核对明细表
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnInvoiceSettledDetailDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnInvoiceSettledDetailDiffMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
3.大众准时化结算数量差异比对表
</summary>
@ -2756,7 +2756,7 @@
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnSettleDiffExportServiceMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnSettleDiffExportServiceMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
6.大众准时化未结差异比对表
</summary>

3
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs

@ -11,6 +11,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public class ErpPrice
{
public string SapErpPartCode { set; get; }
public decimal SapPrice { set; get; }
}
public class PriceList:FullAuditedAggregateRootBase<Guid>

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

@ -60,57 +60,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
_priceList = DbConnection.Query<ErpPrice>("select Price SapPrice, MaterialCode SapErpPartCode from Set_PriceList where type='10' and version=(select max(version) from Set_PriceListVersion)").ToList();
}
List<T> tmpList = new List<T>();
if (isNotHistoryPart == true)
{
var str = "SELECT\n" +
" temp2.ErpMaterialCode,\n" +
" temp2.OrderBillNum KENNCode ,\n" +
" temp2.ChassisNumber\n" +
" FROM\n" +
" (\n" +
" SELECT DISTINCT\n" +
" ErpMaterialCode,\n" +
" b.OrderBillNum, \n" +
" " +
"b.KENNCode,\n" +
" b.ChassisNumber2, \n" +
" b.ChassisNumber \n" +
" FROM\n" +
" Set_fis b\n" +
" INNER JOIN set_settle a ON a.KENNCode = b.KENNCode \n" +
" AND a.ChassisNumber = b.ChassisNumber2 \n" +
" AND a.MaterialCode = b.ItemCode \n" +
" WHERE\n" +
" a.Version = '{0}' \n" +
" ) temp1\n" +
" INNER JOIN (\n" +
" SELECT DISTINCT\n" +
" ErpMaterialCode,\n" +
" d.OrderBillNum, \n" +
" d.KENNCode,\n" +
" d.ChassisNumber2 ,\n" +
" d.ChassisNumber \n" +
" FROM\n" +
" Set_fis d\n" +
" INNER JOIN set_settle c ON c.KENNCode = d.KENNCode \n" +
" AND c.ChassisNumber = d.ChassisNumber2 \n" +
" AND c.MaterialCode = d.ItemCode \n" +
" WHERE\n" +
" c.Version < '{0}' \n" +
" ) temp2 ON temp1.ChassisNumber2 = temp2.ChassisNumber2 \n" +
" AND temp1.ErpMaterialCode = temp2.ErpMaterialCode \n" +
" AND temp1.KENNCode = temp2.KENNCode";
var _list = DbConnection.Query<SettleInfo>(string.Format(str, version)).ToList();
var str = "select * from Set_ExistErpMaterialCodeDiff";
var _list = DbConnection.Query<SettleInfo>
(string.Format(str, version),null,null,true,1200).ToList();

42
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs

@ -17,6 +17,32 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public class InvoiceSettledDetailDiff
: ReportDetailBase
{
//public InvoiceSettledDetailDiff(string wmsBillNum, DateTime cP5Time, string kENNCode, string chassisNumber, string wmsState, string sapMaterialCode, string materialDesc, string materialCode, string parentSapMaterialCode, string parentMaterialDesc, string materialGroup, decimal price, decimal amt, decimal qty, decimal settledQty, DateTime cP7Time, decimal diffSettleFisQty, decimal diffSettleInvQty, decimal invoiceQty, decimal invoicePrice, decimal invocieAmt, decimal settleAmt, decimal diffPrice)
//{
// WmsBillNum = wmsBillNum;
// CP5Time = cP5Time;
// KENNCode = kENNCode;
// ChassisNumber = chassisNumber;
// WmsState = wmsState;
// SapMaterialCode = sapMaterialCode;
// MaterialDesc = materialDesc;
// MaterialCode = materialCode;
// ParentSapMaterialCode = parentSapMaterialCode;
// ParentMaterialDesc = parentMaterialDesc;
// MaterialGroup = materialGroup;
// Price = price;
// Amt = amt;
// Qty = qty;
// SettledQty = settledQty;
// CP7Time = cP7Time;
// DiffSettleFisQty = diffSettleFisQty;
// DiffSettleInvQty = diffSettleInvQty;
// InvoiceQty = invoiceQty;
// InvoicePrice = invoicePrice;
// InvocieAmt = invocieAmt;
// SettleAmt = settleAmt;
// DiffPrice = diffPrice;
//}
[ExporterHeader(DisplayName = "交货单号 ")]
public override string WmsBillNum { set; get; }
@ -124,14 +150,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
condition += string.Format(" and B.cp7<='{0}' ", cp7end);
}
if (!string.IsNullOrEmpty(kennCode))
{
condition += string.Format(" and B.kenncode='{0}' ", kennCode);
}
if (!string.IsNullOrEmpty(chassisNumber))
{
condition += string.Format(" and B.chassisNumber='{0}' ", chassisNumber);
}
//if (!string.IsNullOrEmpty(kennCode))
//{
// condition += string.Format(" and B.kenncode='{0}' ", kennCode);
//}
//if (!string.IsNullOrEmpty(chassisNumber))
//{
// condition += string.Format(" and B.chassisNumber='{0}' ", chassisNumber);
//}
//if (!string.IsNullOrEmpty(materialGroup))
//{
// condition += string.Format(" B.chassisNumber='{0}' ", materialGroup);

81
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs

@ -95,6 +95,87 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _query.ToList();
}
/// <summary>
///
/// </summary>
/// <param name="kanBan">看板号</param>
/// <param name="version">版本</param>
/// <param name="sapMaterialCode">厂内物料号</param>
/// <param name="customerPartCode">客户物料号</param>
/// <param name="estimateTypeDesc">物料组车型</param>
/// <param name="begintime"></param>
/// <param name="endtime"></param>
/// <returns></returns>
//public virtual List<SettleKBWithCode> GetSettleKBWithCodeReportList(string kanBan, string version, string sapMaterialCode,
// string customerPartCode, string estimateTypeDesc, string begintime, string endtime)
//{
// string sqlString = "SELECT\n" +
// " * ,\n" +
// " ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" +
// " ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" +
// " ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" +
// " ISNULL( Price * Qty - InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异\n" +
// " \n" +
// "FROM\n" +
// " (\n" +
// " SELECT\n" +
// " row_number() over(order by b.EstimateTypeDesc) as RowId ,\n" +
// " c.WMSDeliveryNote,--交货单号\n" +
// " c.WMSActualGoodsDate,--实际发货日期\n" +
// " a.Kanban,--条码号\n" +
// " b.MaterialCode SapMaterialCode,--厂内物料号\n" +
// " b.MaterialDesc,--物料描述\n" +
// " b.CustomerPartCode,--客户物料\n" +
// " b.EstimateTypeDesc,--物料组(车型)\n" +
// " c.WMSDeliveryQty,--交货数量\n" +
// " a.Qty AS SettleNumber,--结算数量\n" +
// " a.SettleDate,--结算日期\n" +
// " a.Qty,--用于计算\n" +
// " ( a.Qty- c.WMSDeliveryQty ) AS SettleWMSDiffQty,--结算与发货差异\n" +
// " ( a.Qty- a.Qty ) AS SettleInvoiceDiffQty,--结算与发货差异\n" +
// " 0 AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
// " d.InvoicePrice,--开票单价\n" +
// " 0 AS InvoiceMoney,--开票金额\n" +
// " c.DeliveryOrderNo --出库单号\n" +
// " \n" +
// " FROM\n" +
// " Set_KanBanSettle AS a\n" +
// " LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" +
// " LEFT JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" +
// " AND a.MaterialCode= c.MaterialCode\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" +
// " ) TEMP1\n" +
// " LEFT JOIN ( SELECT Price, --定价\n" +
// " MaterialCode --厂内物料号\n" +
// " FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode= TEMP2.MaterialCode \n" +
// "WHERE 1=1 {1}";
// string addwhere = string.Empty;
// string addSqlStr = string.Format(sqlString, version);
// if (!string.IsNullOrEmpty(kanBan))
// {
// addwhere += string.Format(" AND Kanban LIKE '{0}%' ", kanBan);
// }
// else if (!string.IsNullOrEmpty(sapMaterialCode))
// {
// addwhere += string.Format(" AND SapMaterialCode LIKE '{0}%' ", sapMaterialCode);
// }
// else if (!string.IsNullOrEmpty(customerPartCode))
// {
// addwhere += string.Format(" AND CustomerPartCode LIKE '{0}%' ", customerPartCode);
// }
// else if (!string.IsNullOrEmpty(estimateTypeDesc))
// {
// addwhere += string.Format(" AND EstimateTypeDesc LIKE '{0}%' ", estimateTypeDesc);
// }
// string _sql = string.Format(addSqlStr, addwhere);
// var _query = DbConnection.Query<SettleKBWithCode>(_sql, null, null, true, 1200, null);
// return _query.ToList();
//}
}

10
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs

@ -24,7 +24,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
: base(dbContextProvider)
{
}
public virtual List<InvoiceSettledDetailDiff> GetDetailDiffReportList(string version, string materialCode, string begin, string end ,string cp7begin,string cp7end,string kennCode,string chassisNumber)
public virtual List<InvoiceSettledDetailDiff> GetDetailDiffReportList(string version, string materialCode, string begin, string end ,string cp7begin,string cp7end,string kennCode,string chassisNumber,string materialGroup)
{
List<InvoiceSettledDetailDiff> _list = new List<InvoiceSettledDetailDiff>();
@ -107,6 +107,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var _query = DbConnection.Query<InvoiceSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list=_query.ToList();
if (_list.Count > 0)
{
if(!string.IsNullOrEmpty(materialGroup))
{
_list = _list.Where(p => p.MaterialGroup == materialGroup).ToList();
}
}
return _list;

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

@ -42,8 +42,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public override decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额 ")]
public override decimal Amt { set; get; }
[ExporterHeader(DisplayName = "结算平台未结数量")]
public decimal Qty { set; get; }
[ExporterHeader(DisplayName = "大众R3未结数量")]
@ -59,6 +57,52 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
public class UnSettleDiff1
{
//[ExporterHeader(DisplayName = "交货单号 ")]
//public string WmsBillNum { set; get; }
[ExporterHeader(DisplayName = "实际发货日期 ")]
public DateTime CP5Time { set; get; }
[ExporterHeader(DisplayName = "KENN号")]
public string KENNCode { set; get; }
[ExporterHeader(DisplayName = "底盘号")]
public string ChassisNumber { set; get; }
[ExporterHeader(DisplayName = "交货状态 ")]
public string WmsState { set; get; }
[ExporterHeader(DisplayName = "物料号")]
public string SapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料描述 ")]
public string MaterialDesc { set; get; }
[ExporterHeader(DisplayName = "客户物料 ")]
public string MaterialCode { set; get; }
//[ExporterHeader(DisplayName = "组件组物料 ")]
//public string ParentSapMaterialCode { set; get; }
//[ExporterHeader(DisplayName = "组件组物料描述 ")]
//public string ParentMaterialDesc { set; get; }
[ExporterHeader(DisplayName = "物料组(车型) ")]
public string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "定价 ")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额 ")]
public decimal Amt { set; get; }
[ExporterHeader(DisplayName = "结算平台未结数量")]
public decimal Qty { set; get; }
[ExporterHeader(DisplayName = "大众R3未结数量")]
public decimal UNSettleQty { set; get; }
[ExporterHeader(DisplayName = "差异")]
public decimal DiffQty { set; get; }
//[ExporterHeader(DisplayName = "差异金额")]
//public decimal DiffAmt { set; get; }
//交货单号 实际发货日期 KENN号 底盘号 底盘格式整理 M100交货状态 物料号 物料描述 客户物料 组件组物料 组件组物料描述 物料组(车型) 结算平台未结数量 定价 金额 大众R3未结数量 差异 差异金额
}
/// <summary>
/// 6.大众准时化未结差异比对表
@ -70,121 +114,76 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
public virtual List<UnSettleDiff> GetDiffReport(int type,string year, string begin, string end, string materialCode, string sapCode)
public virtual List<UnSettleDiff1> GetDiffReport(int type, string begin, string end, string materialCode, string kennCode,string chassisNumber)
{
string condition = " where 1=1 ";
if (!string.IsNullOrEmpty(materialCode))
{
condition += string.Format(" and d.MaterialCode='{0}' ", materialCode);
}
if (!string.IsNullOrEmpty(begin))
{
condition += string.Format(" and a.BeginTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
condition += string.Format(" and a.BeginTime<='{0}' ", end);
}
if (!string.IsNullOrEmpty(kennCode))
{
condition += string.Format(" and a.kenncode='{0}' ", kennCode);
}
if (!string.IsNullOrEmpty(chassisNumber))
{
condition += string.Format(" and a.chassisNumber='{0}' ", chassisNumber);
}
string str1 = "where 1=1 ";
string sql1 = "SELECT\n" +
" a.MaterialCode,\n" +
" a.KENNCode,\n" +
" a.ChassisNumber,\n" +
" a.qty UNSettleQty,\n" +
" b.qty,\n" +
" a.CP5A CP5Time,\n" +
" c.MaterialCode SapMaterialCode,\n" +
" c.MaterialDesc MaterialDesc,\n" +
" a.model Factory \n" +
"FROM\n" +
" Set_unsettle a\n" +
" LEFT JOIN (\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" +
" Model \n" +
" ) b ON a.ChassisNumber = b.ChassisNumber2 \n" +
" AND a.MaterialCode = b.ItemCode \n" +
" AND a.KENNCode = b.KENNCode\n" +
" LEFT JOIN Set_material c ON a.MaterialCode = c.CustomerPartCode {0}";
string sql2 =
"SELECT\n" +
string sql1 =
" SELECT\n" +
" t1.*,\n" +
" t1.Qty * T2.Price AMT,\n" +
" isnull( t1.UNSettleQty, 0 ) * isnull( T2.Price, 0 ) AMT,\n" +
" T2.Price,\n" +
" Qty -(\n" +
" ISNULL( UnSettleQty, 0 )) DiffQty,\n" +
" Qty -(\n" +
" ISNULL( UnSettleQty, 0 ))* isnull( t2.Price, 0 ) DiffPrice \n" +
" ISNULL( UnSettleQty, 0 )) DiffQty \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" +
" a.MaterialCode,\n" +
" a.KENNCode,\n" +
" a.ChassisNumber,\n" +
" a.qty UNSettleQty,\n" +
" isnull( b.qty, 0 ) qty,\n" +
" a.CP5A CP5Time,\n" +
" c.MaterialCode SapMaterialCode,\n" +
" c.MaterialDesc MaterialDesc,\n" +
" c.EstimateTypeDesc MaterialGroup,\n" +
" a.model Factory \n" +
" FROM\n" +
" (\n" +
" Set_unsettle a\n" +
" LEFT JOIN (\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" +
" ItemCode,\n" +
" KENNCode,\n" +
" ChassisNumber2,\n" +
" sum( qty ) qty \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" +
" Set_fis \n" +
" WHERE\n" +
" state = 0 \n" +
" OR state = 4 \n" +
" GROUP BY\n" +
" ItemCode,\n" +
" KENNCode,\n" +
" ChassisNumber2,\n" +
" Model \n" +
" ) b ON a.ChassisNumber = b.ChassisNumber2 \n" +
" AND a.MaterialCode = b.ItemCode \n" +
" AND a.KENNCode = b.KENNCode\n" +
" LEFT JOIN Set_material c ON a.MaterialCode = c.CustomerPartCode {0}\n" +
" ) t1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
@ -192,23 +191,104 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" Price \n" +
" FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" version = ( SELECT max( version ) FROM Set_PriceListVersion )) t2 ON t1.SapMaterialCode = t2.MaterialCode";
" WHERE\n" +
" version = ( SELECT max( version ) FROM Set_PriceListVersion )) t2 ON t1.SapMaterialCode = t2.MaterialCode \n" +
"WHERE\n" +
" 1 = 1";
string _sql = string.Empty;
if (type == 1 )
{
_sql = string.Format(sql2, str1);
}
else
{
_sql = string.Format(sql1, str1);
// 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 {0}\n" +
//" ) AS temp1\n" +
//" LEFT OUTER JOIN Set_material AS temp2 ON temp1.ParentCode = temp2.MaterialCode \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.SapMaterialCode = t2.MaterialCode";
var _sql = string.Format(sql1, condition);
}
var _query = DbConnection.Query<UnSettleDiff>(_sql);
var _query = DbConnection.Query<UnSettleDiff1>(_sql);
return _query.ToList();
}

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

@ -57,7 +57,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
// str += string.Format(" and SapCode='{0}' ", materialGroup);
//}
var sqlString =
" SELECT\n" +
" SELECT\n" +
" temp1.*,\n" +
" temp2.Price,\n" +
" ISNULL( temp1.QTY, 0 )* ISNULL( temp2.Price, 0 ) AMT \n" +
@ -90,8 +90,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND STATE = 0 UNION ALL\n" +
" SELECT\n" +
" WMSState,\n" +
" UnSettleVersion,\n" +
" WMSBillNum,\n" +
" UnSettleVersion,\n" +
" BeginTime CP5Time,\n" +
" ItemCode MaterialCode,\n" +
" ChassisNumber,\n" +
@ -112,6 +112,123 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) temp2 ON temp1.SapMaterialCode = temp2.MaterialCode";
//var _materialList = DbConnection.Query<Material>("select * from set_material").ToList();
//var _priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
string _sql = string.Format(sqlString, str);
;
var _query = DbConnection.Query<UnSettleDetailReport>(_sql);
var _list = _query.ToList();
//_list= _list.Where(p => p.SapMaterialCode == sapCode).ToList();
return _list;
}
/// <summary>
/// 漏结
/// </summary>
/// <param name="year"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <param name="customcode"></param>
/// <param name="version"></param>
/// <param name="materialCode"></param>
/// <param name="materialGroup"></param>
/// <param name="sapCode"></param>
/// <returns></returns>
public virtual List<UnSettleDetailReport> GetErrorSettleDetail(string year, string begin, string end, string customcode, string version, string materialCode, string materialGroup, string sapCode)
{
string str = " ";
if (!string.IsNullOrEmpty(begin))
{
str += string.Format(" and beginTime>'{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
str += string.Format(" and beginTime<'{0}' ", end);
}
if (!string.IsNullOrEmpty(materialCode))
{
str += string.Format(" and ItemCode='{0}' ", materialCode);
}
//string str2 = " ";
//if (!string.IsNullOrEmpty(sapCode))
//{
// str2 += string.Format(" and b.MaterialCode='{0}' ", sapCode);
//}
//if (!string.IsNullOrEmpty(materialGroup))
//{
// str += string.Format(" and MaterialGroup='{0}' ", materialGroup);
//}
//if (!string.IsNullOrEmpty(sapCode))
//{
// str += string.Format(" and SapCode='{0}' ", materialGroup);
//}
var sqlString =
" SELECT\n" +
" temp1.*,\n" +
" temp2.Price,\n" +
" ISNULL( temp1.QTY, 0 )* ISNULL( temp2.Price, 0 ) AMT \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" A.*,\n" +
" Isnull(F.Qty, 0) UnSettleQty,\n" +
" B.EstimateTypeDesc MaterialGroup,\n" +
" B.MaterialDesc MaterialDesc,\n" +
" d.MaterialDesc ParentMaterialDesc,\n" +
" B.MaterialCode SapMaterialCode \n" +
" FROM\n" +
" (\n" +
//" SELECT\n" +
//" WMSState,\n" +
//" WMSBillNum,\n" +
//" UnSettleVersion,\n" +
//" BeginTime CP5Time,\n" +
//" ItemCode MaterialCode,\n" +
//" ChassisNumber,\n" +
//" OrderBillNum KENNCode,\n" +
//" QTY,\n" +
//" ErpMaterialCode ParentSapMaterialCode,\n" +
//" '' FLAG \n" +
//" FROM\n" +
//" Set_fis where 1=1 {0}\n" +
////" WHERE\n" +
////" 1 = 1 \n" +
//" AND STATE = 0" +
//" UNION ALL\n" +
" SELECT\n" +
" WMSState,\n" +
" UnSettleVersion,\n" +
" WMSBillNum,\n" +
" BeginTime CP5Time,\n" +
" ItemCode MaterialCode,\n" +
" ChassisNumber,\n" +
" OrderBillNum KENNCode,\n" +
" QTY,\n" +
" ErpMaterialCode ParentSapMaterialCode,\n" +
" 'L' FLAG \n" +
" FROM\n" +
" Set_fis \n" +
" WHERE\n" +
" 1 = 1 \n" +
" AND STATE = 4 {0}\n" +
" ) A\n" +
" left join Set_Unsettle f on a.MaterialCode=f.MaterialCode and a.KENNCode=f.KENNCode and a.ChassisNumber=f.ChassisNumber \n" +
" LEFT JOIN Set_material B ON a.MaterialCode = b.CustomerPartCode \n" +
" LEFT JOIN Set_material d ON a.ParentSapMaterialCode = d.MaterialCode \n" +
" ) temp1\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) temp2 ON temp1.SapMaterialCode = temp2.MaterialCode";
@ -129,10 +246,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var _list = _query.ToList();
_list = _list.Where(p => p.SapMaterialCode == sapCode).ToList();
return _list;
}
}
}

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

@ -28,7 +28,7 @@ namespace SettleAccount.Job.Services
public InvoiceSettledDetailDiffExportService(
ErpPartDapperRepository erpdapperRepository,
InvoiceSettledDetailDiffDapperRepository dapperRepository,
InvoiceSettledDetailDiffDapperRepository dapperRepository,
OutputService outputService,
InputService inputService
)
@ -51,54 +51,120 @@ namespace SettleAccount.Job.Services
var cp7end = p_list.Where(p => p.Name == "Cp7EndTime").FirstOrDefault().Value;
var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber,materialGroup);
var _list = _ls.Where(p=>p.ParentSapMaterialCode!=p.SapMaterialCode).GroupBy(p =>new { p.ParentSapMaterialCode,p.ChassisNumber,p.KENNCode }).Select(p => p.FirstOrDefault()).ToList();
var rangeList = _erpdapperRepository.GetSapList<InvoiceSettledDetailDiff>(_list,version,false);
var erpPriceList= _erpdapperRepository.GetErpPartCodePriceList(version);
var diffList=_erpdapperRepository.GetSettleInvoiceDiff(version);
rangeList.ForEach(p => {
p.Qty = 1;
p.InvoiceQty = 1;
p.SettledQty = 1;
p.DiffSettleFisQty = 0;
p.DiffSettleInvQty = 0;
var _first= erpPriceList.FirstOrDefault(itm => itm.SapErpPartCode == p.SapMaterialCode);
if (_first != null)
var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
var _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode })
.Select(p => p.FirstOrDefault()).ToList();
var rangeList = _erpdapperRepository.GetSapList<InvoiceSettledDetailDiff>(_list, version, false);
var erpPriceList = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode })
.Select(p => new { ParentSapMaterialCode = p.Key.ParentSapMaterialCode, ChassisNumber = p.Key.ChassisNumber, KENNCode = p.Key.KENNCode, Price = p.Sum(itm => itm.InvoicePrice) }).ToList();
// var erpPriceList= _erpdapperRepository.GetErpPartCodePriceList(version);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
if (_ls.Count > 0)
{
var rangList = from itm1 in rangeList
join itm2 in erpPriceList on new { itm1.ParentSapMaterialCode, itm1.KENNCode, itm1.ChassisNumber } equals new { itm2.ParentSapMaterialCode, itm2.KENNCode, itm2.ChassisNumber }
into temp1
from tm1 in temp1.DefaultIfEmpty()
select new InvoiceSettledDetailDiff
{
WmsBillNum = itm1.WmsBillNum,
CP5Time = itm1.CP5Time,
KENNCode = itm1.KENNCode,
ChassisNumber = itm1.ChassisNumber,
WmsState = itm1.WmsState,
SapMaterialCode = itm1.SapMaterialCode,
MaterialDesc = itm1.MaterialDesc,
MaterialCode = itm1.MaterialCode,
ParentSapMaterialCode = itm1.ParentSapMaterialCode,
ParentMaterialDesc = itm1.ParentMaterialDesc,
MaterialGroup = itm1.MaterialGroup,
Price = itm1.Price,
Amt = itm1.Amt,
Qty = 1,
SettledQty = 1,
CP7Time = itm1.CP7Time,
DiffSettleFisQty = 0,
DiffSettleInvQty = 0,
InvoiceQty = 1,
InvoicePrice = tm1.Price,
InvocieAmt = tm1.Price,
SettleAmt = tm1.Price,
DiffPrice = tm1.Price-itm1.Price
};
rangeList = rangList.ToList();
//rangeList.ForEach(p =>
//{
// p.Qty = 1;
// p.InvoiceQty = 1;
// p.SettledQty = 1;
// p.DiffSettleFisQty = 0;
// p.DiffSettleInvQty = 0;
// var _first = erpPriceList.FirstOrDefault(itm => itm.ParentSapMaterialCode == p.ParentSapMaterialCode && itm.ChassisNumber == p.ChassisNumber && itm.KENNCode == p.KENNCode);
// //var _first = erpPriceList.FirstOrDefault(itm => itm.SapErpPartCode == p.SapMaterialCode);
// if (_first != null)
// {
// p.InvoicePrice = _first.Price;
// p.Amt = p.Price * 1;
// p.InvocieAmt = p.InvoicePrice * 1;
// p.SettleAmt = p.SettledQty * p.Price;
// }
// p.DiffPrice = p.InvoicePrice - p.Price;
//});
foreach (var itm in diffList)
{
p.InvoicePrice= _first.SapPrice;
p.Amt = p.Price * 1;
p.InvocieAmt = p.InvoicePrice * 1;
p.SettleAmt = p.SettledQty * p.Price;
var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
_first.InvoiceQty = _first.SettledQty + itm.DiffQty;
_first.DiffSettleInvQty = itm.DiffQty;
}
p.DiffPrice = p.InvoicePrice - p.Price;
});
foreach (var itm in diffList)
{
var _first= _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
_first.InvoiceQty= _first.SettledQty + itm.DiffQty;
_first.DiffSettleInvQty = itm.DiffQty;
}
foreach (var itm in _ls)
{
itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice;
itm.DiffPrice = itm.Price - itm.InvoicePrice;
}
foreach (var itm in _ls)
{
itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice;
itm.DiffPrice = itm.Price - itm.InvoicePrice;
}
_ls.AddRange(rangeList);
if (!string.IsNullOrEmpty(materialGroup))
{
var _groupList= materialGroup.Split(new char[] { ',' }).ToList();
_ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup) ).ToList();
}
if (!string.IsNullOrEmpty(kenncode))
{
_ls = _ls.Where(p => p.KENNCode.Contains(kenncode)).ToList();
}
if (!string.IsNullOrEmpty(chassisNumber))
{
_ls = _ls.Where(p => p.ChassisNumber.Contains(chassisNumber)).ToList();
}
_ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList();
_ls.AddRange(rangeList);
if (!string.IsNullOrEmpty(materialGroup))
{
_ls= _ls.Where(p => p.MaterialGroup == materialGroup).ToList();
}
_ls =_ls.OrderBy(p => p.ChassisNumber).ThenBy(p=>p.KENNCode).ThenBy(p=>p.SapMaterialCode).ToList();
_outputService.Export<InvoiceSettledDetailDiff>(id, string.Format("大众发票与结算核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _ls);
return id.ToString();

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

@ -82,10 +82,7 @@ namespace SettleAccount.Job.Services
});
}
_outputService.Export<InvoiceSettledDiffExportDto>(id, string.Format("结算与开票数据对比_{0}.xlsx",Guid.NewGuid().ToString()), _lsExport);
_outputService.Export<InvoiceSettledDiffExportDto>(id, string.Format("大众发票与结算核对汇总表({1})_{0}.xlsx", Guid.NewGuid().ToString(),version), _lsExport);
//_repository.Insert(_list);
//_versionRepository.Insert(_id, version, customerCode, customerCode, string.Empty, string.Empty, projectName);

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

@ -18,6 +18,7 @@ namespace SettleAccount.Job.Services.Report
{
private readonly InvoiceSettledDetailDiffDapperRepository _dapperRepository;
private readonly ErpPartDapperRepository _erpdapperRepository;
private readonly UnSettledDetailDapperRepository _unSettledapperRepository;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
private readonly OutputService _outputService;
private readonly InputService _inputService;
@ -26,13 +27,14 @@ namespace SettleAccount.Job.Services.Report
IBlobContainer<MyFileContainer> fileContainer,
ErpPartDapperRepository erpdapperRepository,
InvoiceSettledDetailDiffDapperRepository dapperRepository,
UnSettledDetailDapperRepository unSettledapperRepository,
OutputService outputService,
InputService inputService
)
{
_unSettledapperRepository = unSettledapperRepository;
_fileContainer = fileContainer;
_inputService = inputService;
_outputService = outputService;
@ -55,49 +57,57 @@ namespace SettleAccount.Job.Services.Report
var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
var _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode }).Select(p => p.FirstOrDefault()).ToList();
var rangeList = _erpdapperRepository.GetSapList<InvoiceSettledDetailDiff>(_list, version,true);
var erpPriceList = _erpdapperRepository.GetErpPartCodePriceList(version);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
rangeList.ForEach(p => {
p.Qty = 1;
p.InvoiceQty = 1;
p.SettledQty = 1;
p.DiffSettleFisQty = 0;
p.DiffSettleInvQty = 0;
var _first = erpPriceList.FirstOrDefault(itm => itm.SapErpPartCode == p.SapMaterialCode);
if (_first != null)
if (_ls.Count > 0)
{
var rangeList = _erpdapperRepository.GetSapList<InvoiceSettledDetailDiff>(_list, version, true);
var erpPriceList = _erpdapperRepository.GetErpPartCodePriceList(version);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
rangeList.ForEach(p => {
p.Qty = 1;
p.InvoiceQty = 1;
p.SettledQty = 1;
p.DiffSettleFisQty = 0;
p.DiffSettleInvQty = 0;
var _first = erpPriceList.FirstOrDefault(itm => itm.SapErpPartCode == p.SapMaterialCode);
if (_first != null)
{
p.InvoicePrice = _first.SapPrice;
p.Amt = p.Price * 1;
p.InvocieAmt = p.InvoicePrice * 1;
p.SettleAmt = p.SettledQty * p.Price;
}
p.DiffPrice = p.InvoicePrice - p.Price;
});
foreach (var itm in diffList)
{
p.InvoicePrice = _first.SapPrice;
p.Amt = p.Price * 1;
p.InvocieAmt = p.InvoicePrice * 1;
p.SettleAmt = p.SettledQty * p.Price;
var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
_first.InvoiceQty = _first.SettledQty + itm.DiffQty;
_first.DiffSettleInvQty = itm.DiffQty;
}
p.DiffPrice = p.InvoicePrice - p.Price;
});
foreach (var itm in _ls)
{
itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice;
}
foreach (var itm in diffList)
{
var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
_first.InvoiceQty = _first.SettledQty + itm.DiffQty;
_first.DiffSettleInvQty = itm.DiffQty;
}
_ls.AddRange(rangeList);
_ls = _ls.Where(p => p.DiffPrice != 0).OrderBy(p => p.SapMaterialCode).ToList();
foreach (var itm in _ls)
{
itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice;
if (!string.IsNullOrEmpty(kenncode))
{
_ls = _ls.Where(p => p.KENNCode.Contains(kenncode)).ToList();
}
if (!string.IsNullOrEmpty(chassisNumber))
{
_ls = _ls.Where(p => p.ChassisNumber.Contains(chassisNumber)).ToList();
}
}
_ls.AddRange(rangeList);
_ls = _ls.Where(p=>p.DiffPrice!=0 ).OrderBy(p => p.SapMaterialCode).ToList();
var report1List = _ls.Where(p=>p.DiffPrice!=0).GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.MaterialDesc, p.Price, p.InvoicePrice, p.DiffPrice, p.SapMaterialCode })
.Select(t => new SettleDoorPanelExport{ MaterialGroup = t.FirstOrDefault().MaterialGroup, MaterialCode = t.FirstOrDefault().MaterialCode, MaterialDesc = t.FirstOrDefault().MaterialDesc, Price = t.FirstOrDefault().Price, InvoicePrice = t.FirstOrDefault().InvoicePrice, InvoiceDiffPrice = t.FirstOrDefault().DiffPrice, SAPCode = t.FirstOrDefault().SapMaterialCode, }).ToList();
// _unSettledapperRepository.GetErrorSettleDetail(string.Empty,begin,end,string.Empty,version,materialCode,materialGroup,string.Empty).GroupBy(p=> p.MaterialGroup)
var report2List = report1List.GroupBy(p => new {p.MaterialGroup }).Select(p=>new SettleDoorPanelSumExport { MaterialGroup= p.Key.MaterialGroup, InvoiceDiffPrice=p.Sum(itm=>itm.InvoiceDiffPrice), Version= version });
ExcelExporter _exporter = new ExcelExporter();//导出Excel

3
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs

@ -31,12 +31,9 @@ namespace SettleAccount.Job.Services.Report
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SAPCode").FirstOrDefault().Value;
var matialCode = p_list.Where(p => p.Name == "MatialCode").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.GetSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
if (diffList != null)
{

7
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs

@ -79,7 +79,12 @@ namespace SettleAccount.Job.Services
var cp7end = p_list.Where(p => p.Name == "Cp7EndTime").FirstOrDefault().Value;
var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
var _ls = _dapperRepository.GetDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber);
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
// customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(materialGroup) ? string.Empty : materialGroup });
var _ls = _dapperRepository.GetDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber,materialGroup);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
foreach (var itm in _ls)
{

49
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs

@ -23,17 +23,50 @@ namespace SettleAccount.Job.Services.Report
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var type = p_list.Where(p => p.Name == "Type").FirstOrDefault().Value;
var year = p_list.Where(p => p.Name == "Year").FirstOrDefault().Value;
//var type = p_list.Where(p => p.Name == "Type").FirstOrDefault().Value;
//var year = p_list.Where(p => p.Name == "Year").FirstOrDefault().Value;
//var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
//var sapCode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
//var beginTime = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
//var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
//var type = p_list.Where(p => p.Name == "Type").FirstOrDefault().Value;
var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
var beginTime = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
//var cp7begin = p_list.Where(p => p.Name == "Cp7BeginTime").FirstOrDefault().Value;
//var cp7end = p_list.Where(p => p.Name == "Cp7EndTime").FirstOrDefault().Value;
var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
var _first = exportName.FirstOrDefault();
var _ls = new List<UnSettleDiff>();
_ls = _dapper.GetDiffReport(int.Parse(type),year,beginTime,endTime, materialCode,sapCode);
var _ls = new List<UnSettleDiff1>();
_ls = _dapper.GetDiffReport(0,begin,end, materialCode,kenncode,chassisNumber);
if (!string.IsNullOrEmpty(kenncode))
{
_ls = _ls.Where(p => p.KENNCode.Contains(kenncode)).ToList();
}
if (!string.IsNullOrEmpty(chassisNumber))
{
_ls = _ls.Where(p => p.ChassisNumber.Contains(chassisNumber)).ToList();
}
var _id = Guid.NewGuid();
List<UnSettleDiff> _lsExport = new List<UnSettleDiff>();
//foreach (var itm in _ls)
//{
@ -56,7 +89,7 @@ namespace SettleAccount.Job.Services.Report
// };
// _lsExport.Add(dto);
//}
_outputService.Export<UnSettleDiff>(id, _first, _ls);
_outputService.Export<UnSettleDiff1>(id, _first, _ls);
return id.ToString();
}
}

19
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs

@ -42,20 +42,23 @@ namespace SettleAccount.Job.Services.Report
var sapcode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
//var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value;
//var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value;
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, customerCode, version,materailCode,materialGroup,sapcode);
var _ls = _list.Where(p => p.Flag != "L" ).Where(p=>p.MaterialCode!=p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _ls = _list.Where(p => p.Flag != "L" ).Where(p=>p.ParentSapMaterialCode!=p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _lst= _erpDapper.GetSapList(_ls, version, false);
_lst.ForEach(p =>
{
p.Qty = 1;
}
);
_list.AddRange(_lst);
if (!string.IsNullOrEmpty(sapcode))
{
_list= _list.Where(p => p.SapMaterialCode == sapcode).ToList();
@ -64,6 +67,14 @@ namespace SettleAccount.Job.Services.Report
{
_list= _list.Where(p => p.MaterialGroup == materialGroup).ToList();
}
if (!string.IsNullOrEmpty(kenncode))
{
_list = _list.Where(p => p.KENNCode.Contains(kenncode)).ToList();
}
if (!string.IsNullOrEmpty(chassisNumber))
{
_list = _list.Where(p => p.ChassisNumber .Contains(chassisNumber)).ToList();
}
_list = _list.OrderBy(p => p.ChassisNumber).ThenBy(p => p.SapMaterialCode).ThenBy(p => p.Flag).ToList();
_outputService.Export<UnSettleDetailReport>(id, _first, _list);
return id.ToString();

5
src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

@ -117,8 +117,7 @@ namespace Win.Sfs.SettleAccount
if (key.Equals(typeof(SettleSparePartExportService).FullName))
{
return implementationFactory.GetService<SettleSparePartExportService>();
}
}
if (key.Equals(typeof(InvoiceSettledDetailDiffExportService).FullName))
{
return implementationFactory.GetService<InvoiceSettledDetailDiffExportService>();
@ -127,8 +126,6 @@ namespace Win.Sfs.SettleAccount
{
return implementationFactory.GetService<UnInvoiceSettledDetailDiffExportService>();
}
if (key.Equals(typeof(UnSettleDiffExportService).FullName))
{
return implementationFactory.GetService<UnSettleDiffExportService>();

Loading…
Cancel
Save