From 3a14a739b68d2376dd59d20467096cb5ee773246 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 30 Mar 2022 09:50:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReportServices/ReportMakeService.cs | 51 ++++++++++++++----- .../Report/WmsOutputSumDapperRepository.cs | 44 ++++++++-------- .../Services/Report/UnSettledSumService.cs | 5 +- 3 files changed, 63 insertions(+), 37 deletions(-) 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 9e1e93e5..7e3362cf 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -396,20 +396,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices ) { - - - - - - - //if (!_settleAccountVersionrepository.Any(p => p.Version == version)) - //{ - // throw new BusinessException("8989", string.Format("不存结算{0}期间",version)); - //} - //if (!_invoiceVersionRepository.Any(p => p.Version == version)) - //{ - // throw new BusinessException("8989", string.Format("不存发票{0}期间", version)); - //} + List customConditionList = new List(); customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); @@ -843,6 +830,42 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices + /// + /// 结算未结寄售核对表 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("UnSettledSum-Make")] + [DisableRequestSizeLimit] + public async Task UnSettledSumServiceMake( + + BaseRequestDto input + + ) + { + + List customConditionList = new List(); + customConditionList.Add(new CustomCondition() { Name = "Version", Value = !string.IsNullOrEmpty(input.Version) ? input.Version : string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(input.MaterialCode) ? input.MaterialCode : string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = !string.IsNullOrEmpty(input.MaterialGroup) ? input.MaterialGroup : string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "Begin", Value = string.IsNullOrEmpty(input.Begin) ? string.Empty : input.Begin }); + customConditionList.Add(new CustomCondition() { Name = "End", Value = string.IsNullOrEmpty(input.End) ? string.Empty : input.End }); + customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode }); + customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(input.ChassisNumber) ? string.Empty : input.ChassisNumber }); + customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); + var _taskid = await _service.ExportEnqueueAsync("结算未结寄售核对表", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(UnSettledSumService), customConditionList, (rs) => + { + }); + return _taskid; + } + + + + + #region F及M平台已经合并入H平台 diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs index 6bc92812..0b6f5007 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs @@ -375,7 +375,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsJitOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " GROUP BY\n" + " BillNum,\n" + " MaterialCode,\n" + @@ -395,7 +395,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsKanbanOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " GROUP BY\n" + " BillNum,\n" + " MaterialCode,\n" + @@ -415,7 +415,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsWithOutKanbanOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " GROUP BY\n" + " BillNum,\n" + " SapMaterialCode,\n" + @@ -435,7 +435,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsSharePartOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " GROUP BY\n" + " BillNum,\n" + " MaterialCode,\n" + @@ -455,7 +455,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsSharePart90OutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " GROUP BY\n" + " BillNum,\n" + " MaterialCode,\n" + @@ -475,7 +475,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsHQHKanbanOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " GROUP BY\n" + " BillNum,\n" + " MaterialCode,\n" + @@ -496,7 +496,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQWithOutKanbanOutPutDetial \n" + " WHERE\n" + " IsBack = 0 \n" + -" AND VERSION = '{0}' \n" + +" AND VERSION = '{0} AND STATE<>4' \n" + " AND Extend = '100113' \n" + " GROUP BY\n" + " BillNum,\n" + @@ -519,7 +519,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQWithOutKanbanOutPutDetial \n" + " WHERE\n" + " IsBack = 1 \n" + -" AND VERSION = '{0}' \n" + +" AND VERSION = '{0} AND STATE<>4' \n" + " AND Extend = '100113' \n" + " GROUP BY\n" + " BillNum,\n" + @@ -542,7 +542,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQWithOutKanbanOutPutDetial \n" + " WHERE\n" + " IsBack = 0 \n" + -" AND VERSION = '{0}' \n" + +" AND VERSION = '{0} AND STATE<>4' \n" + " AND Extend = '100053' \n" + " GROUP BY\n" + " BillNum,\n" + @@ -565,7 +565,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQWithOutKanbanOutPutDetial \n" + " WHERE\n" + " IsBack = 1 \n" + -" AND VERSION = '{0}' \n" + +" AND VERSION = '{0} AND STATE<>4' \n" + " AND Extend = '100053' \n" + " GROUP BY\n" + " BillNum,\n" + @@ -589,7 +589,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsOneTimeSaleOutPutDetial\n" + " WHERE\n" + " \n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " GROUP BY\n" + " BillNum,\n" + " SapMaterialCode,\n" + @@ -635,7 +635,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsJitOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " GROUP BY\n" + " BillNum,\n" + @@ -656,7 +656,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsKanbanOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " GROUP BY\n" + " BillNum,\n" + @@ -677,7 +677,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsWithOutKanbanOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " GROUP BY\n" + " BillNum,\n" + @@ -698,7 +698,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsSharePartOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " GROUP BY\n" + " BillNum,\n" + @@ -719,7 +719,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsSharePart90OutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " GROUP BY\n" + " BillNum,\n" + @@ -740,7 +740,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " FROM\n" + " Set_WmsHQHKanbanOutPutDetial \n" + " WHERE\n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " GROUP BY\n" + " BillNum,\n" + @@ -762,7 +762,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQWithOutKanbanOutPutDetial \n" + " WHERE\n" + " IsBack = 0 \n" + -" AND VERSION = '{0}' \n" + +" AND VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " AND Extend = '100113' \n" + " GROUP BY\n" + @@ -786,7 +786,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQWithOutKanbanOutPutDetial \n" + " WHERE\n" + " IsBack = 1 \n" + -" AND VERSION = '{0}' \n" + +" AND VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " AND Extend = '100113' \n" + " GROUP BY\n" + @@ -810,7 +810,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQWithOutKanbanOutPutDetial \n" + " WHERE\n" + " IsBack = 0 \n" + -" AND VERSION = '{0}' \n" + +" AND VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " AND Extend = '100053' \n" + " GROUP BY\n" + @@ -834,7 +834,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQWithOutKanbanOutPutDetial \n" + " WHERE\n" + " IsBack = 1 \n" + -" AND VERSION = '{0}' \n" + +" AND VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " AND Extend = '100053' \n" + " GROUP BY\n" + @@ -859,7 +859,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsOneTimeSaleOutPutDetial\n" + " WHERE\n" + " \n" + -" VERSION = '{0}' \n" + +" VERSION = '{0} AND STATE<>4' \n" + " AND State = 2 \n" + " GROUP BY\n" + " BillNum,\n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs index 26e5cb9f..d3dd9de6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs @@ -68,7 +68,10 @@ namespace SettleAccount.Job.Services.Report public string ExportFile(Guid id, List exportName, List p_list) { - GetReport(id,exportName,p_list); + var _lsExport= GetReport(id,exportName,p_list); + + var _first = exportName.FirstOrDefault(); + _outputService.Export(id, _first, _lsExport); return id.ToString(); } From a5fde318f68e78e835b27c7fee037f610094f6fb Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 30 Mar 2022 14:33:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettleKBWithCodeDapperReportRepository.cs | 179 +++++++++++++----- .../Report/WmsOutputSumDapperRepository.cs | 15 +- 2 files changed, 136 insertions(+), 58 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs index 34572747..37c692d0 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs @@ -43,51 +43,65 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report condition += string.Format(" and c.WMSActualGoodsDate<='{0}' ", endtime); } + var datestr= version.Substring(0, 4) +"-"+ version.Substring(4, 2) + "-01"; + + var date= DateTime.Parse(datestr).AddMonths(1).AddDays(-1); + var datetime=date.ToShortDateString()+" 23:59:59 "; + string sqlString = "SELECT\n" + - " * ,\n" + - " ISNULL( temp1.InvoicePrice * Qty, 0 ) AS InvoiceMoney,--开票金额\n" + - " ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" + - " ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" + - " ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" + - " ISNULL( Price * Qty - InvoicePrice * Qty, 0 ) AS SumDiffMoney,--总金额差异\n" + - " '' DeliveryOrderNo --出库单号\n" + - " \n" + - "FROM\n" + - " (\n" + - " SELECT\n" + - " row_number ( ) OVER ( ORDER BY b.EstimateTypeDesc ) AS RowId,\n" + - " c.WMSDeliveryNote,--交货单号\n" + - " CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" + - " a.Kanban,--条码号\n" + - " b.MaterialCode SapMaterialCode,--厂内物料号\n" + - " b.MaterialDesc,--物料描述\n" + - " b.CustomerPartCode,--客户物料\n" + - " b.EstimateTypeDesc,--物料组(车型)\n" + - " c.WMSDeliveryQty,--交货数量\n" + - " ISNULL( a.Qty, 0 ) AS SettleNumber,--结算数量\n" + - " CONVERT ( VARCHAR ( 100 ), a.SettleDate, 23 ) SettleDate,--结算日期\n" + - " ISNULL( a.Qty, 0 ) AS Qty,--用于计算\n" + - " ( ISNULL( a.Qty, 0 ) - ISNULL( c.WMSDeliveryQty, 0 ) ) AS SettleWMSDiffQty,--结算与发货差异\n" + - " 0 AS SettleInvoiceDiffQty,--结算与开票差异\n" + - " ISNULL( a.Qty, 0 ) AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" + - " ISNULL( d.InvoicePrice, 0 ) InvoicePrice --开票单价\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" + - " WHERE\n" + - " a.VERSION= '{0}' {1} \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\n" + - " 1 =1"; +" * ,\n" + +" ISNULL ( temp1.InvoicePrice * Qty, 0 ) AS InvoiceMoney,--开票金额\n" + +" ISNULL ( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" + +" ISNULL ( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" + +" ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" + +" ISNULL ( Price * Qty - InvoicePrice * Qty, 0 ) AS SumDiffMoney,--总金额差异\n" + +" '' DeliveryOrderNo --出库单号\n" + +" \n" + +"FROM\n" + +" (\n" + +" SELECT ROW_NUMBER\n" + +" ( ) OVER ( ORDER BY b.EstimateTypeDesc ) AS RowId,\n" + +"--c.WMSDeliveryNote,--交货单号\n" + +"--CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" + +" A.Kanban,--条码号\n" + +" b.MaterialCode SapMaterialCode,--厂内物料号\n" + +" b.MaterialDesc,--物料描述\n" + +" b.CustomerPartCode,--客户物料\n" + +" b.EstimateTypeDesc,--物料组(车型)\n" + +" C.WMSDeliveryQty,--交货数量\n" + +" ISNULL ( A.Qty, 0 ) AS SettleNumber,--结算数量\n" + +" CONVERT ( VARCHAR ( 100 ), A.SettleDate, 23 ) SettleDate,--结算日期\n" + +" ISNULL ( A.Qty, 0 ) AS Qty,--用于计算\n" + +" ( ISNULL ( A.Qty, 0 ) - ISNULL ( C.WMSDeliveryQty, 0 ) ) AS SettleWMSDiffQty,--结算与发货差异\n" + +" 0 AS SettleInvoiceDiffQty,--结算与开票差异\n" + +" ISNULL ( A.Qty, 0 ) AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" + +" ISNULL ( d.InvoicePrice, 0 ) InvoicePrice --开票单价\n" + +" \n" + +" FROM\n" + +" Set_KanBanSettle\n" + +" AS A LEFT JOIN Set_material AS b ON A.MaterialCode = b.CustomerPartCode\n" + +" LEFT JOIN (\n" + +"   SELECT\n" + +" ( temp1.Qty - ISNULL ( temp2.Qty, 0 ) ) WMSDeliveryQty,\n" + +" temp1.MaterialCode,\n" + +" temp1.Kanban \n" + +" FROM\n" + +" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle WHERE VERSION < '{0}' GROUP BY kanban, MaterialCode ) temp1\n" + +" INNER JOIN ( SELECT SUM ( WMSDeliveryQty ) Qty, KanBan, MaterialCode FROM Set_WMSKanBanSettle WHERE WMSActualGoodsDate < '{2}' GROUP BY KanBan, MaterialCode ) temp2 ON temp1.Kanban = temp2.KanBan \n" + +" AND temp1.MaterialCode = temp2.KanBan \n" + +" ) 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" + +" WHERE\n" + +" A.VERSION = '{0}' {1}\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\n" + +" 1 = 1;"; string addwhere = string.Empty; - string addSqlStr = string.Format(sqlString, version, condition); + string addSqlStr = string.Format(sqlString, version, condition,datetime); //if (!string.IsNullOrEmpty(kanBan)) //{ @@ -106,9 +120,86 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report // addwhere += string.Format(" AND EstimateTypeDesc LIKE '{0}%' ", estimateTypeDesc); //} + + + + + + + string _sql = string.Format(addSqlStr, addwhere); var _query = DbConnection.Query(_sql, null, null, true, 1200, null); - return _query.ToList(); + + + + + + var sql2 = "SELECT\n" + + " a.WmsBillNum,\n" + + " t1.MaterialCode MaterialCode,\n" + + " a.Kanban ,\n" + + " A.LastModificationTime WmsDate \n" + + "FROM\n" + + " Set_HQ_H_Kanban A\n" + + " INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_HQ_H_Kanban GROUP BY MaterialCode, Kanban HAVING COUNT(*)> 1 ) B ON A.Kanban = B.Kanban \n" + + " AND A.MaterialCode = B.MaterialCode " + + " left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode "; + + var listCompare = DbConnection.Query(sql2); + var _lst=_query.ToList(); + + + List _ls = new List(); + foreach (var itm in listCompare.ToList()) + { + var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode); + if (first != null) + { + if (!string.IsNullOrEmpty(itm.WmsDate)) + { + itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); + } + + first.WmsBillNum += "," + itm.WmsBillNum; + first.WmsDate += "," + itm.WmsDate; + } + else + { + if (!string.IsNullOrEmpty(itm.WmsDate)) + { + itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); + } + _ls.Add(itm); + } + + } + + + foreach (var itm1 in _lst) + { + var itm = _ls.FirstOrDefault(p => p.Kanban == itm1.Kanban && p.MaterialCode == itm1.MaterialCode); + if (itm != null) + { + itm1.WMSDeliveryNote = itm.WmsBillNum; + itm1.WMSActualGoodsDate = itm.WmsDate; + } + + + } + + return _lst; + + + + + + + + + + + + } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs index 0b6f5007..74c1c02b 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs @@ -881,24 +881,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report - - - - - - - - - - - _sql = string.Format(_sql, version); + _sql = string.Format(_sql, version); var _query = DbConnection.Query(_sql, null, null, true, 1200, null); return _query.ToList(); - } - - public virtual List GetWmsSumReportList(string version, string state) {