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 6b26c0ba..5d42c51c 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -326,14 +326,16 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices [DisableRequestSizeLimit] public async Task KanbanUnSettled(string sapCode, string version, - DateTime begin, DateTime end,string materialGroup) + DateTime begin, DateTime end,string materialGroup,string matialCode,string isContainVersion) { List customConditionList = new List(); customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = materialGroup }); + customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = isContainVersion }); var _taskid = await _service.ExportEnqueueAsync("看板未结明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(KanBanUnSettledExport), customConditionList, (rs) => { diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index 91da1ba9..92ad5892 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -4227,7 +4227,7 @@ - + 看板未结输出 diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs index 2d351f02..172a1e66 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs @@ -48,8 +48,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " temp3.StorageLocationDesc 收货仓库描述,\n" + " temp3.HQHKanBan 订货看板编号,\n" + " temp3.AcceptanceNo 结算验收单号,\n" + + " temp3.AcceptanceDate 验收单日期,\n" + " temp3.MaterialCode Sap编码,\n" + - " temp3.CustomerPartCode 客户物料号,\n" + + " temp3.hqMaterialCode 客户物料号,\n" + " temp3.EstimateTypeDesc 物料组,\n" + " temp3.MaterialDesc 零件中文名称,\n" + " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + @@ -68,7 +69,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " h.StorageLocationDesc,\n" + " h.HQHKanBan,\n" + " h.AcceptanceNo,\n" + + " CONVERT ( VARCHAR ( 100 ), h.AcceptanceDate, 23 ) AcceptanceDate,\n" + " m.MaterialCode,\n" + + " h.MaterialCode hqMaterialCode,\n" + " m.CustomerPartCode,\n" + " m.MaterialDesc,\n" + " m.EstimateTypeDesc,\n" + @@ -83,7 +86,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " StorageLocation,\n" + " StorageLocationDesc,\n" + " AcceptanceNo,\n" + - " MaterialCode \n" + + " MaterialCode,\n" + + " AcceptanceDate \n" + " FROM\n" + " Set_UnHQSettleAccount \n" + " GROUP BY\n" + @@ -92,7 +96,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " StorageLocationDesc,\n" + " AcceptanceNo,\n" + " Amt,\n" + - " MaterialCode \n" + + " MaterialCode,\n" + + " AcceptanceDate \n" + " ) AS h\n" + " LEFT JOIN Set_material AS m ON h.MaterialCode = m.CustomerPartCode \n" + " ) AS unhq\n" + @@ -116,15 +121,226 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " AND b.MaterialCode IS NULL \n" + " ) AS temp1 ON unhq.HQHKanBan = temp1.[订货看板编号] \n" + " AND unhq.CustomerPartCode= temp1.客户物料号 -- WHERE\n" + - "-- temp1.[订货看板编号] IS NULL \n" + + "-- temp1.[订货看板编号] IS NULL\n" + "-- AND temp1.客户物料号 IS NULL\n" + " \n" + " ) temp3\n" + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode"; var _sql = string.Format(str, condition); + + 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 sql3 = "SELECT\n" + + " a.WmsBillNum,\n" + + " t1.MaterialCode MaterialCode,\n" + + " a.Kanban,\n" + + " A.LastModificationTime WmsDate \n" + + "FROM\n" + + " Set_HQ_H_Kanban A\n" + + " LEFT 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 \n" + + " left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode \n" + + + "WHERE\n" + + " B.Kanban IS NULL"; + + + + var listCompare1 = DbConnection.Query(sql3); + + + var sql10 = "SELECT DISTINCT\n" + + " t1.* \n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " a.AcceptanceNo AS AcceptanceNo,\n" + + " a.KanbanNumber AS KanbanNumber,\n" + + " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" + + " HQHKanBan,\n" + + " b2.MaterialCode \n" + + " FROM\n" + + " Set_UnHQSettleAccount a\n" + + " LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" + + " WHERE\n" + + " Version = '{0}' \n" + + " AND HQHKanBan <> 'BJ' \n" + + " ) t1\n" + + " LEFT JOIN (\n" + + " SELECT\n" + + " HQHKanBan,\n" + + " MaterialCode \n" + + " FROM\n" + + " Set_UnHQSettleAccount a \n" + + " WHERE\n" + + " Version = '{0}' \n" + + " AND HQHKanBan <> 'BJ' \n" + + " GROUP BY\n" + + " HQHKanBan,\n" + + " MaterialCode \n" + + " HAVING\n" + + " COUNT ( * ) > 1 \n" + + " ) t2 ON t1.HQHKanBan = t2.HQHKanBan \n" + + " AND t1.MaterialCode = t2.MaterialCode \n" + + "WHERE\n" + + " t2.HQHKanBan IS NULL"; + + + var list11 = DbConnection.Query(string.Format(sql10, version)); + + + var sql11 = "SELECT DISTINCT\n" + + " t1.* \n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " a.AcceptanceNo AS AcceptanceNo,\n" + + " a.KanbanNumber AS KanbanNumber,\n" + + " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" + + " HQHKanBan,\n" + + " b2.MaterialCode \n" + + " FROM\n" + + " Set_UnHQSettleAccount a\n" + + " LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" + + " WHERE\n" + + " Version = '{0}' \n" + + " AND HQHKanBan <> 'BJ' \n" + + " ) t1\n" + + " INNER JOIN (\n" + + " SELECT\n" + + " HQHKanBan,\n" + + " MaterialCode \n" + + " FROM\n" + + " Set_UnHQSettleAccount a \n" + + " WHERE\n" + + " Version = '{0}' \n" + + " AND HQHKanBan <> 'BJ' \n" + + " GROUP BY\n" + + " HQHKanBan,\n" + + " MaterialCode \n" + + " HAVING\n" + + " COUNT ( * ) > 1 \n" + + " ) t2 ON t1.HQHKanBan = t2.HQHKanBan \n" + + " AND t1.MaterialCode = t2.MaterialCode \n" + + "ORDER BY\n" + + " t1.HQHKanBan,\n" + + " t1.MaterialCode"; + + + var list12 = DbConnection.Query(string.Format(sql11, version)); + + + var sql12 = "SELECT\n" + + " a.AcceptanceNo AS AcceptanceNo,\n" + + " a.KanbanNumber AS KanbanNumber,\n" + + " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" + + " HQHKanBan,\n" + + " b2.MaterialCode \n" + + "FROM\n" + + " Set_UnHQSettleAccount a\n" + + " LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" + + "WHERE\n" + + " Version = '{0}' \n" + + " AND HQHKanBan = 'BJ'"; + + var list13 = DbConnection.Query(string.Format(sql12, version)); + + List _lscopy = new List(); + + foreach (var itm in list11) + { + var first = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm.HQHKanBan && p.MaterialCode == itm.MaterialCode); + if (first != null) + { + first.KanbanNumber += "," + itm.KanbanNumber; + first.AcceptanceDate += "," + itm.AcceptanceDate; + first.AcceptanceNo += "," + itm.AcceptanceNo; + } + else + { + _lscopy.Add(itm); + } + } + foreach (var itm in list12) + { + _lscopy.Add(itm); + } + foreach (var itm in list13) + { + _lscopy.Add(itm); + } + + + 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 itm in listCompare1.ToList()) + { + if (!string.IsNullOrEmpty(itm.WmsDate)) + { + itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); + } + _ls.Add(itm); + } + var _query = DbConnection.Query(_sql, null, null, true, 1200, null); _list = _query.ToList(); + + + foreach (var itm1 in _list) + { + var itm = _ls.FirstOrDefault(p => p.Kanban == itm1.订货看板编号 && p.MaterialCode == itm1.Sap编码); + if (itm != null) + { + itm1.交货单号 = itm.WmsBillNum; + itm1.交货时间 = itm.WmsDate; + } + + var itmcopy = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm1.订货看板编号 && p.MaterialCode == itm1.Sap编码); + if (itmcopy != null) + { + //itm1.看板编号 = itmcopy.KanbanNumber; + itm1.验收单日期 = itmcopy.AcceptanceDate; + itm1.结算验收单号 = itmcopy.AcceptanceNo; + } + } + + return _list; } @@ -157,7 +373,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report string str = "SELECT\n" + " temp1.交货单号,\n" + - " temp1.交货日期,\n" + + " temp1.交货时间,\n" + " temp1.收货仓库,\n" + " temp1.收货仓库描述,\n" + " temp1.订货看板编号,\n" + @@ -174,7 +390,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " (\n" + " SELECT\n" + " a.WmsBillNum [交货单号],\n" + - " CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) 交货日期,\n" + + " CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) 交货时间,\n" + " b.StorageLocation AS 收货仓库,\n" + " b.StorageLocationDesc AS 收货仓库描述,\n" + " a.Kanban AS 订货看板编号,\n" + @@ -209,8 +425,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report { [ExporterHeader(DisplayName = "交货单号")] public string 交货单号 { set; get; } - [ExporterHeader(DisplayName = "交货日期")] - public string 交货日期 { set; get; } + [ExporterHeader(DisplayName = "交货时间")] + public string 交货时间 { set; get; } [ExporterHeader(DisplayName = "收货仓库")] public string 收货仓库 { set; get; } [ExporterHeader(DisplayName = "收货仓库描述")] 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 cb342d91..e518bfdd 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 @@ -70,98 +70,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report // condition += string.Format(" and b.LastModificationTime<='{0}' ", end); //} - //string str = "SELECT\n" + - // " isnull( temp1.交货单号, '' ) 交货单号,\n" + - // " 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" + - // " temp3.Price AS 结算单价,\n" + - // " ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" + - // " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + - // " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" + - // " ( isnull( temp1.发货数量, 0 ) - isnull( temp1.[结算数量], 0 ) ) AS 数量差异,\n" + - // " ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" + - // " ( ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" + - // "FROM\n" + - // " (\n" + - // " SELECT\n" + - // " '' AS 交货单号,\n" + - // " NULL AS 交货时间,\n" + - // " '' AS 手工或自动,\n" + - // " a.StorageLocation AS 收货仓库,\n" + - // " a.StorageLocationDesc AS 收货仓库描述,\n" + - // " a.HQHKanBan AS 订货看板编号,\n" + - // " a.MaterialCode AS 订货零件号,\n" + - // " c.MaterialCode Sap编码,\n" + - // " a.MaterialCode 结算物料代码,\n" + - // " c.MaterialDesc AS 零件中文名称,\n" + - // " isnull( b.Qty, 0 ) AS 发货数量,\n" + - // " 2 AS 发货状态,\n" + - // " a.[AcceptanceNo] AS 结算验收单号,\n" + - // " isnull( a.Qty, 0 ) AS 结算数量,\n" + - // " C.EstimateTypeDesc AS 物料组,\n" + - // " a.Factory AS 工厂,\n" + - // " '' AS 看板编号,\n" + - // " '' AS 验收单日期 \n" + - // " FROM\n" + - // " (\n" + - // " SELECT SUM\n" + - // " ( Qty ) AS Qty,\n" + - // " HQHKanBan,\n" + - // " MaterialCode,\n" + - // " Version,\n" + - // " StorageLocation,\n" + - // " StorageLocationDesc,\n" + - // " Factory,AcceptanceNo \n" + - // " FROM\n" + - // " Set_HQ_H_Platform \n" + - // " GROUP BY\n" + - // " HQHKanBan,\n" + - // " MaterialCode,\n" + - // " Version,\n" + - // " StorageLocation,\n" + - // " StorageLocationDesc,\n" + - // " Factory,AcceptanceNo \n" + - // " ) AS a\n" + - // " INNER JOIN ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) 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' AND a.HQHKanBan IS NOT NULL ) \n" + - // " AND 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\n" + - // " LEFT JOIN (\n" + - // " SELECT\n" + - // " ROUND( SUM ( Amt ) / SUM ( Qty ), 4 ) price,\n" + - // " HQHKanBan,\n" + - // " MaterialCode,\n" + - // " Version \n" + - // " FROM\n" + - // " Set_HQ_H_Platform \n" + - // " WHERE\n" + - // " HQHKanBan <> 'BJ' \n" + - // " AND Version = '{0}' \n" + - // " GROUP BY\n" + - // " HQHKanBan,\n" + - // " MaterialCode,\n" + - // " Version \n" + - // " ) AS TEMP3 ON temp1.[结算物料代码] = TEMP3.MaterialCode \n" + - // " AND temp1.订货看板编号 = TEMP3.HQHKanBan"; - + string str = "SELECT\n" + " isnull( temp1.交货单号, '' ) 交货单号,\n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs index ea0344aa..4a40a9bb 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs @@ -138,8 +138,29 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report { } - public virtual List GetKanbanReportList(string version, string begintime, string endtime) + public virtual List GetKanbanReportList(string version, string begintime, string endtime, string iscontionversion) { + string contion = string.Empty; + //选中,是否过滤掉当期结算数据 + if (iscontionversion == "0") + { + contion += string.Format(" SELECT * FROM Set_KanBanSettle WHERE Version <'{0}' ", version); + } + else + { + contion += " SELECT * FROM Set_KanBanSettle "; + } + + string str = string.Empty; + //str += " where 1=1 "; + if (!string.IsNullOrEmpty(begintime) && Convert.ToDateTime(begintime) != DateTime.MinValue) + { + str += string.Format(" and a.WMSActualGoodsDate >='{0}' ", begintime); + } + if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(endtime) != DateTime.MinValue) + { + str += string.Format(" and a.WMSActualGoodsDate<='{0}' ", endtime); + } string sql = "SELECT\n" + " TEMP1.*,\n" + @@ -157,34 +178,24 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " C.EstimateTypeDesc MaterialGroup,\n" + " ISNULL( B.Qty, 0 ) SettleQty,\n" + " ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" + - " isnull(tt.qty, 0) BackQty, \n"+ + " isnull(tt.qty, 0) BackQty, \n" + " ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 )-isnull(tt.qty, 0) ) AS DiffQty \n" + " FROM\n" + " Set_WMSKanBanSettle A\n" + - " LEFT JOIN ( SELECT * FROM Set_KanBanSettle ) B ON A.Kanban = B.Kanban \n" + + " LEFT JOIN ( {1}) B ON A.Kanban = B.Kanban \n" + " AND A.MaterialCode = B.MaterialCode\n" + " LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode \n" + - " left join set_backQty as tt on a.Kanban = tt.Code and a.MaterialCode = b.MaterialCode \n"+ + " left join set_backQty as tt on a.Kanban = tt.Code and a.MaterialCode = b.MaterialCode \n" + " WHERE\n" + " B.Kanban IS NULL \n" + " AND B.MaterialCode IS NULL {0}\n" + " ) TEMP1\n" + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode"; - - - - string str = string.Empty; - //str += " where 1=1 "; - if (!string.IsNullOrEmpty(begintime)) - { - str += string.Format(" and a.WMSActualGoodsDate >='{0}' ", begintime); - } - if (string.IsNullOrEmpty(endtime)) - { - str += string.Format(" and a.WMSActualGoodsDate<='{0}' ", endtime); - } - sql = string.Format(sql, str); + + + + sql = string.Format(sql, str, contion); var _query = DbConnection.Query(sql, null, null, true, 1200, null); var _list = _query.ToList(); return _list; diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs index bdeada19..9c3cfa91 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs @@ -40,8 +40,12 @@ namespace SettleAccount.Job.Services.Report var begin = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value; var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value; + var materialCode = p_list.Where(p => p.Name == "MatialCode").FirstOrDefault().Value; var sapCode = p_list.Where(p => p.Name == "SAPCode").FirstOrDefault().Value; - var _ls = _dapper.GetKanbanReportList(version, begin,end); + var iscontionversion = p_list.Where(p => p.Name == "IsContainVersion").FirstOrDefault().Value; + + + var _ls = _dapper.GetKanbanReportList(version, begin,end, iscontionversion); // var _lst = _dapper.GetNoKanbanReportList(version, begin, end); //if (!string.IsNullOrEmpty(materialGroup)) //{ @@ -51,14 +55,7 @@ namespace SettleAccount.Job.Services.Report // _ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList(); // } //} - //if (!string.IsNullOrEmpty(materialCode)) - //{ - // var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList(); - // if (_groupList.Count() > 0) - // { - // _ls = _ls.Where(p => _groupList.Contains(p.CustomerPartCode)).ToList(); - // } - //} + if (!string.IsNullOrEmpty(sapCode)) { var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList(); @@ -67,6 +64,15 @@ namespace SettleAccount.Job.Services.Report _ls = _ls.Where(p => _groupList.Contains(p.SapCode)).ToList(); } } + + if (!string.IsNullOrEmpty(materialCode)) + { + var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList(); + if (_groupList.Count() > 0) + { + _ls = _ls.Where(p => _groupList.Contains(p.CustomerPartCode)).ToList(); + } + } if (!string.IsNullOrEmpty(materialGroup)) { var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); @@ -88,14 +94,7 @@ namespace SettleAccount.Job.Services.Report // _lst = _lst.Where(p => _groupList.Contains(p.MaterialCode)).ToList(); // } //} - if (!string.IsNullOrEmpty(sapCode)) - { - var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList(); - if (_groupList.Count() > 0) - { - _ls = _ls.Where(p => _groupList.Contains(p.SapCode)).ToList(); - } - } + ExcelExporter _exporter = new ExcelExporter();//导出Excel var result = _exporter.Append(_ls.ToList(), "有发货无结算差异对比")