diff --git a/.vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo b/.vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo index e3209a30..d884462a 100644 Binary files a/.vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo and b/.vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo differ diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index 9b6b204a..8ac1f19c 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/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; diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs index 7d7f137c..00a24751 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs +++ b/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(_sql, null, null, true, 1200, null); @@ -136,6 +136,83 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } + /// + /// 有结算无发货报表 + /// + /// + /// + /// + /// + /// + /// + public virtual List GetNOInvoiceSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup) + { + + List _list = new List(); + + 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(_sql, null, null, true, 1200, null); + _list = _query.ToList(); + return _list; + + } /// /// 反向对比,有发货无结算报表 /// @@ -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" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs index 0c6d6beb..b96825b3 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs +++ b/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); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs index 5d3dffd2..43335a1e 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs +++ b/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 });