Browse Source

Merge branch 'master' of https://e.coding.net/ccwin-in/PG/Win.sfs.SmartSettlementSystem.PG

# Conflicts:
#	src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
#	src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs
FoShanPG
44673626 3 years ago
parent
commit
8c93ca5b40
  1. BIN
      .vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo
  2. 2
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  3. 89
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  4. 7
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs
  5. 36
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs

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

Binary file not shown.

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

@ -676,7 +676,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
var _taskid = await _service.ExportEnqueueAsync("H平台核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSettledDetailDiffExportService), customConditionList, (rs) =>
var _taskid = await _service.ExportEnqueueAsync("红旗工厂核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSettledDetailDiffExportService), customConditionList, (rs) =>
{
});
return _taskid;

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

@ -100,7 +100,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" +
" SELECT\n" +
" b.WmsBillNum AS 交货单号,\n" +
" b.LastModificationTime AS 交货时间,\n" +
" CONVERT ( VARCHAR ( 100 ), b.LastModificationTime, 23 ) AS 交货时间,\n" +
" b.IsAuto AS 手工或自动,\n" +
" a.StorageLocation AS 收货仓库,\n" +
" a.StorageLocationDesc AS 收货仓库描述,\n" +
@ -117,17 +117,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" C.EstimateTypeDesc AS 物料组,\n" +
" a.Factory AS 工厂,\n" +
" a.KanbanNumber AS 看板编号,\n" +
" a.AcceptanceDate AS 验收单日期 \n" +
" CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS 验收单日期 \n" +
" FROM\n" +
" Set_HQ_H_Platform AS a\n" +
" LEFT OUTER JOIN Set_HQ_H_Kanban AS b ON a.HQHKanBan = b.Kanban \n" +
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" ( a.HQHKanBan <> 'BJ' ) \n" +
" AND a.Version= '{0}' { 1 } \n" +
" a.Version= '{0}' {1} \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode";
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode WHERE temp1.[交货单号] is not null ";
var _sql = string.Format(str, version, condition);
var _query = DbConnection.Query<HQHSettledDetailDiff>(_sql, null, null, true, 1200, null);
@ -136,6 +136,83 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
/// <summary>
/// 有结算无发货报表
/// </summary>
/// <param name="version"></param>
/// <param name="materialCode"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <param name="materialGroup"></param>
/// <returns></returns>
public virtual List<HQHSettledDetailDiff> GetNOInvoiceSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
{
List<HQHSettledDetailDiff> _list = new List<HQHSettledDetailDiff>();
string str = "SELECT\n" +
" temp1.交货时间,\n" +
" isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
" isnull( temp1.交货单号, '' ) 交货单号,\n" +
" temp1.[工厂],\n" +
" temp1.收货仓库,\n" +
" temp1.收货仓库描述,\n" +
" temp1.订货看板编号,\n" +
" temp1.订货零件号,\n" +
" temp1.验收单日期,\n" +
" temp1.Sap编码,\n" +
" temp1.看板编号,\n" +
" temp1.物料组,\n" +
" temp1.零件中文名称,\n" +
" temp1.发货数量,\n" +
" temp1.发货状态,\n" +
" temp1.结算验收单号,\n" +
" temp1.结算数量,\n" +
" temp1.结算单价,\n" +
" temp1.结算金额,\n" +
" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
" isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
" 0 AS 数量差异,\n" +
" temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
" ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" b.WmsBillNum AS 交货单号,\n" +
" CONVERT ( VARCHAR ( 100 ), b.LastModificationTime, 23 ) AS 交货时间,\n" +
" b.IsAuto AS 手工或自动,\n" +
" a.StorageLocation AS 收货仓库,\n" +
" a.StorageLocationDesc AS 收货仓库描述,\n" +
" a.HQHKanBan AS 订货看板编号,\n" +
" a.MaterialCode AS 订货零件号,\n" +
" c.MaterialCode Sap编码,\n" +
" c.MaterialDesc AS 零件中文名称,\n" +
" isnull( b.Qty, 0 ) AS 发货数量,\n" +
" isnull( b.State, 0 ) AS 发货状态,\n" +
" a.AcceptanceNo AS 结算验收单号,\n" +
" isnull( a.Qty, 0 ) AS 结算数量,\n" +
" isnull( a.Price, 0 ) AS 结算单价,\n" +
" isnull( a.Amt, 0 ) AS 结算金额 ,\n" +
" C.EstimateTypeDesc AS 物料组,\n" +
" a.Factory AS 工厂,\n" +
" a.KanbanNumber AS 看板编号,\n" +
" CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS 验收单日期 \n" +
" FROM\n" +
" Set_HQ_H_Platform AS a\n" +
" LEFT OUTER JOIN Set_HQ_H_Kanban AS b ON a.HQHKanBan = b.Kanban \n" +
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" a.Version= '{0}' \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode WHERE temp1.[交货单号] is null ";
var _sql = string.Format(str, version);
var _query = DbConnection.Query<HQHSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
return _list;
}
/// <summary>
/// 反向对比,有发货无结算报表
/// </summary>
@ -188,7 +265,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" +
" SELECT\n" +
" a.WmsBillNum AS 交货单号,\n" +
" a.LastModificationTime AS 交货时间,\n" +
" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" +
" a.IsAuto AS 手工或自动,\n" +
" b.StorageLocation AS 收货仓库,\n" +
" b.StorageLocationDesc AS 收货仓库描述,\n" +

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

@ -59,6 +59,9 @@ namespace SettleAccount.Job.Services.Report
var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//有结算无发货报表
var _lsnoSettle = _dapperRepository.GetNOInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//反向对比,有发货无结算
var _reversels = _dapperRepository.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
@ -130,7 +133,9 @@ namespace SettleAccount.Job.Services.Report
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(_ls.ToList(), "红旗工厂核对明细")
.SeparateBySheet()
.Append(_reversels.ToList(), "有发货无结算对比")
.Append(_lsnoSettle.ToList(), "有结算无发货对比")
//.SeparateBySheet()
//.Append(_reversels.ToList(), "有发货无结算对比")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true);

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

@ -184,6 +184,12 @@ namespace SettleAccount.Job.Services
var list1= LSettleSum(id, exportName, p_list);
var report1 = report2List.ToList();
foreach (var itm in list1)
{
itm.MaterialGroup = itm.MaterialGroup + "(漏结)";
}
report1.AddRange(list1);
ExcelExporter _exporter = new ExcelExporter();//导出Excel
@ -331,14 +337,14 @@ namespace SettleAccount.Job.Services
{
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;
var materialCode = p_list.Where(p => p.Name == "MaterialCode").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 sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
@ -350,7 +356,7 @@ namespace SettleAccount.Job.Services
var _end = DateTime.Parse(_beginstr).AddMonths(1).AddDays(-1);
end=_end.ToString("yyyy-MM-dd")+" 23:59:59";
var _list = _dapperRepository2.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, customerCode, version, materailCode, materialGroup, sapcode);
var _list = _dapperRepository2.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, "", version,"", materialGroup, sapCode);
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 =>
@ -394,14 +400,14 @@ namespace SettleAccount.Job.Services
_list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
}
}
if (!string.IsNullOrEmpty(materailCode))
{
var _groupList = materailCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
}
}
//if (!string.IsNullOrEmpty(materailCode))
//{
// var _groupList = materailCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
// }
//}
_list = _list.OrderBy(p => p.ChassisNumber).ThenBy(p => p.SapMaterialCode).ThenBy(p => p.Flag).ToList();
var report2List = _list.Select(p => new { p.MaterialGroup, DiffAmt = p.Price * p.Qty }).GroupBy(p => new { p.MaterialGroup }).Select(p => new SettleDoorPanelSumExport { MaterialGroup = p.Key.MaterialGroup, InvoiceDiffPrice = p.Sum(itm => itm.DiffAmt), Version = version });

Loading…
Cancel
Save