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 19e21ca4..cf251b4f 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 @@ -27,7 +27,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report /// /// /// - public virtual List GetHQFactoryDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup) + public virtual List GetHQFactoryDetailDiffReportList(string version, string materialCode, + string begin, string end, string materialGroup, string iscontionversion) { List _list = new List(); @@ -43,90 +44,144 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report // condition += string.Format(" and a.LastModificationTime<='{0}' ", end); //} + string contion = string.Empty; + //选中,是否过滤掉当期结算数据 + if (iscontionversion == "0") + { + contion += string.Format(" WHERE Version <'{0}' ", version); + } + else + { + contion += " WHERE 1=1 "; + } + string str = "SELECT\n" + - " temp3.StorageLocation 收货仓库,\n" + - " temp3.StorageLocationDesc 收货仓库描述,\n" + - " temp3.HQHKanBan 订货看板编号,\n" + - " temp3.ExternalKanbanNumber 外部验收单号,\n" + - " temp3.AcceptanceDate 验收单日期,\n" + - " temp3.MaterialCode Sap编码,\n" + - " temp3.hqMaterialCode 客户物料号,\n" + - " temp3.EstimateTypeDesc 物料组,\n" + - " temp3.MaterialDesc 零件中文名称,\n" + - " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + - " temp3.UnHQAmt 金额,\n" + - " temp3.系统未结数量,\n" + - " temp3.UnHQQty 红旗未结数量,\n" + - " ( ISNULL( temp3.系统未结数量, 0 ) - ISNULL( temp3.UnHQQty, 0 ) ) 差异 \n" + - "FROM\n" + - " (\n" + - " SELECT\n" + - " * \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " h.StorageLocation,\n" + - " h.StorageLocationDesc,\n" + - " h.HQHKanBan,\n" + - " h.ExternalKanbanNumber,\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" + - " ISNULL( h.Qty, 0 ) AS UnHQQty,\n" + - " ISNULL( h.Amt, 0 ) AS UnHQAmt \n" + - " FROM\n" + - " (\n" + - " SELECT SUM\n" + - " ( Qty ) Qty,\n" + - " Amt,\n" + - " HQHKanBan,\n" + - " StorageLocation,\n" + - " StorageLocationDesc,\n" + - " ExternalKanbanNumber,\n" + - " MaterialCode,\n" + - " AcceptanceDate \n" + - " FROM\n" + - " Set_UnHQSettleAccount \n" + - " GROUP BY\n" + - " HQHKanBan,\n" + - " StorageLocation,\n" + - " StorageLocationDesc,\n" + - " ExternalKanbanNumber,\n" + - " Amt,\n" + - " MaterialCode,\n" + - " AcceptanceDate \n" + - " ) AS h\n" + - " LEFT JOIN Set_material AS m ON h.MaterialCode = m.CustomerPartCode \n" + - " ) AS unhq\n" + - " LEFT JOIN (\n" + - " SELECT\n" + - " a.Kanban AS 订货看板编号,\n" + - " b.MaterialCode AS 订货零件号,\n" + - " c.MaterialCode Sap编码,\n" + - " c.CustomerPartCode 客户物料号,\n" + - " c.MaterialDesc AS 零件中文名称,\n" + - " isnull( a.Qty, 0 ) AS 系统未结数量,\n" + - " b.ExternalKanbanNumber AS 外部验收单号,\n" + - " C.EstimateTypeDesc AS 物料组 \n" + - " FROM\n" + - " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) AS a\n" + - " LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' ) AS b ON a.Kanban = b.HQHKanBan \n" + - " AND a.MaterialCode = b.MaterialCode\n" + - " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + - " WHERE\n" + - " b.HQHKanBan IS NULL \n" + - " AND b.MaterialCode IS NULL \n" + - " ) AS temp1 ON unhq.HQHKanBan = temp1.[订货看板编号] \n" + - " AND unhq.CustomerPartCode= temp1.客户物料号 -- WHERE\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); + " temp3.HQHKanBan 订货看板编号,\n" + + " temp3.MaterialCode Sap编码,\n" + + " temp3.hqMaterialCode 客户物料号,\n" + + " temp3.EstimateTypeDesc 物料组,\n" + + " temp3.MaterialDesc 零件中文名称,\n" + + " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + + " temp3.系统未结数量,\n" + + " temp3.UnHQQty 红旗未结数量,\n" + + " ( ISNULL( temp3.系统未结数量, 0 ) - ISNULL( temp3.UnHQQty, 0 ) ) 差异 \n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " * \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " h.HQHKanBan,\n" + + " m.MaterialCode,\n" + + " h.MaterialCode hqMaterialCode,\n" + + " m.CustomerPartCode,\n" + + " m.MaterialDesc,\n" + + " m.EstimateTypeDesc,\n" + + " ISNULL( h.Qty, 0 ) AS UnHQQty \n" + + " FROM\n" + + " ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_UnHQSettleAccount GROUP BY HQHKanBan, MaterialCode ) AS h\n" + + " LEFT JOIN Set_material AS m ON h.MaterialCode = m.CustomerPartCode \n" + + " ) AS unhq\n" + + " LEFT JOIN (\n" + + " SELECT\n" + + " * \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " isnull( temp1.交货单号, '' ) 交货单号,\n" + + " NULL 交货时间,\n" + + " temp1.订货看板编号,\n" + + " temp1.订货零件号,\n" + + " temp1.Sap编码,\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" + + " isnull( tt.Qty, 0 ) 退货数量,\n" + + " isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量 \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " '' AS 交货单号,\n" + + " a.Kanban AS 订货看板编号,\n" + + " b.MaterialCode AS 订货零件号,\n" + + " c.MaterialCode Sap编码,\n" + + " c.CustomerPartCode 客户物料号,\n" + + " c.MaterialDesc AS 零件中文名称,\n" + + " isnull( a.Qty, 0 ) AS 发货数量,\n" + + " '' AS 外部验收单号,\n" + + " isnull( b.Qty, 0 ) AS 结算数量,\n" + + " C.EstimateTypeDesc AS 物料组 \n" + + " FROM\n" + + " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n" + + " LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + + " AND a.MaterialCode = b.MaterialCode\n" + + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + + " WHERE\n" + + " b.HQHKanBan IS NULL \n" + + " AND b.MaterialCode IS NULL \n" + + " ) AS temp1\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + + " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) tt ON temp1.Sap编码 = tt.MaterialCode \n" + + " AND temp1.订货看板编号 = tt.Code \n" + + " ) UNION1 UNION ALL\n" + + " SELECT\n" + + " * \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " isnull( temp1.交货单号, '' ) 交货单号,\n" + + " NULL 交货时间,\n" + + " temp1.订货看板编号,\n" + + " temp1.订货零件号,\n" + + " temp1.Sap编码,\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" + + " isnull( tt.Qty, 0 ) 退货数量,\n" + + " isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量 \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " '' AS 交货单号,\n" + + " a.Kanban AS 订货看板编号,\n" + + " b.MaterialCode AS 订货零件号,\n" + + " c.MaterialCode Sap编码,\n" + + " c.CustomerPartCode 客户物料号,\n" + + " c.MaterialDesc AS 零件中文名称,\n" + + " isnull( a.Qty, 0 ) AS 发货数量,\n" + + " '' AS 外部验收单号,\n" + + " isnull( b.Qty, 0 ) AS 结算数量,\n" + + " C.EstimateTypeDesc AS 物料组 \n" + + " FROM\n" + + " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n" + + " INNER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + + " AND a.MaterialCode = b.MaterialCode\n" + + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + + " WHERE\n" + + " a.Qty> b.Qty \n" + + " ) AS temp1\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + + " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) tt ON temp1.Sap编码 = tt.MaterialCode \n" + + " AND temp1.订货看板编号 = tt.Code \n" + + " ) UNION2 \n" + + " ) AS temp1 ON unhq.HQHKanBan = temp1.[订货看板编号] \n" + + " AND unhq.CustomerPartCode= temp1.客户物料号 \n" + + " ) temp3\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode"; + + + var _sql = string.Format(str,version, contion); var sql2 = "SELECT\n" + @@ -140,7 +195,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " AND A.MaterialCode = B.MaterialCode " + " left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode "; - var listCompare = DbConnection.Query(sql2); + var listCompare = DbConnection.Query(sql2); var sql3 = "SELECT\n" + @@ -159,7 +214,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report - var listCompare1 = DbConnection.Query(sql3); + var listCompare1 = DbConnection.Query(sql3); var sql10 = "SELECT DISTINCT\n" + @@ -199,7 +254,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " t2.HQHKanBan IS NULL"; - var list11 = DbConnection.Query(string.Format(sql10, version)); + var list11 = DbConnection.Query(string.Format(sql10, version)); var sql11 = "SELECT DISTINCT\n" + @@ -240,7 +295,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " t1.MaterialCode"; - var list12 = DbConnection.Query(string.Format(sql11, version)); + var list12 = DbConnection.Query(string.Format(sql11, version)); var sql12 = "SELECT\n" + @@ -256,17 +311,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Version = '{0}' \n" + " AND HQHKanBan = 'BJ'"; - var list13 = DbConnection.Query(string.Format(sql12, version)); + var list13 = DbConnection.Query(string.Format(sql12, version)); - List _lscopy = new List(); + 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.KanbanNumber += "," + itm.KanbanNumber; + //first.AcceptanceDate += "," + itm.AcceptanceDate; first.ExternalKanbanNumber += "," + itm.ExternalKanbanNumber; } else @@ -284,7 +339,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } - List _ls = new List(); + List _ls = new List(); foreach (var itm in listCompare.ToList()) { var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode); @@ -335,7 +390,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report if (itmcopy != null) { //itm1.看板编号 = itmcopy.KanbanNumber; - itm1.验收单日期 = itmcopy.AcceptanceDate; + //itm1.验收单日期 = itmcopy.AcceptanceDate; itm1.外部验收单号 = itmcopy.ExternalKanbanNumber; } } @@ -346,6 +401,93 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } + #region old + //string str = "SELECT\n" + + //" temp3.StorageLocation 收货仓库,\n" + + //" temp3.StorageLocationDesc 收货仓库描述,\n" + + //" temp3.HQHKanBan 订货看板编号,\n" + + //" temp3.ExternalKanbanNumber 外部验收单号,\n" + + //" temp3.AcceptanceDate 验收单日期,\n" + + //" temp3.MaterialCode Sap编码,\n" + + //" temp3.hqMaterialCode 客户物料号,\n" + + //" temp3.EstimateTypeDesc 物料组,\n" + + //" temp3.MaterialDesc 零件中文名称,\n" + + //" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + + //" temp3.UnHQAmt 金额,\n" + + //" temp3.系统未结数量,\n" + + //" temp3.UnHQQty 红旗未结数量,\n" + + //" ( ISNULL( temp3.系统未结数量, 0 ) - ISNULL( temp3.UnHQQty, 0 ) ) 差异 \n" + + //"FROM\n" + + //" (\n" + + //" SELECT\n" + + //" * \n" + + //" FROM\n" + + //" (\n" + + //" SELECT\n" + + //" h.StorageLocation,\n" + + //" h.StorageLocationDesc,\n" + + //" h.HQHKanBan,\n" + + //" h.ExternalKanbanNumber,\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" + + //" ISNULL( h.Qty, 0 ) AS UnHQQty,\n" + + //" ISNULL( h.Amt, 0 ) AS UnHQAmt \n" + + //" FROM\n" + + //" (\n" + + //" SELECT SUM\n" + + //" ( Qty ) Qty,\n" + + //" Amt,\n" + + //" HQHKanBan,\n" + + //" StorageLocation,\n" + + //" StorageLocationDesc,\n" + + //" ExternalKanbanNumber,\n" + + //" MaterialCode,\n" + + //" AcceptanceDate \n" + + //" FROM\n" + + //" Set_UnHQSettleAccount \n" + + //" GROUP BY\n" + + //" HQHKanBan,\n" + + //" StorageLocation,\n" + + //" StorageLocationDesc,\n" + + //" ExternalKanbanNumber,\n" + + //" Amt,\n" + + //" MaterialCode,\n" + + //" AcceptanceDate \n" + + //" ) AS h\n" + + //" LEFT JOIN Set_material AS m ON h.MaterialCode = m.CustomerPartCode \n" + + //" ) AS unhq\n" + + //" LEFT JOIN (\n" + + //" SELECT\n" + + //" a.Kanban AS 订货看板编号,\n" + + //" b.MaterialCode AS 订货零件号,\n" + + //" c.MaterialCode Sap编码,\n" + + //" c.CustomerPartCode 客户物料号,\n" + + //" c.MaterialDesc AS 零件中文名称,\n" + + //" isnull( a.Qty, 0 ) AS 系统未结数量,\n" + + //" b.ExternalKanbanNumber AS 外部验收单号,\n" + + //" C.EstimateTypeDesc AS 物料组 \n" + + //" FROM\n" + + //" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) AS a\n" + + //" LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' ) AS b ON a.Kanban = b.HQHKanBan \n" + + //" AND a.MaterialCode = b.MaterialCode\n" + + //" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + + //" WHERE\n" + + //" b.HQHKanBan IS NULL \n" + + //" AND b.MaterialCode IS NULL \n" + + //" ) AS temp1 ON unhq.HQHKanBan = temp1.[订货看板编号] \n" + + //" AND unhq.CustomerPartCode= temp1.客户物料号 -- WHERE\n" + + //"-- temp1.[订货看板编号] IS NULL\n" + + //"-- AND temp1.客户物料号 IS NULL\n" + + //" \n" + + //" ) temp3\n" + + //" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode"; + #endregion + + /// /// 红旗系统未对比对红旗主机厂未结 /// @@ -361,7 +503,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report List _list = new List(); - string condition = " "; + string condition = ""; if (!string.IsNullOrEmpty(begin)) { @@ -486,7 +628,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " b.HQHKanBan IS NULL \n" + " AND b.MaterialCode IS NULL \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 OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) tt ON temp1.Sap编码 = tt.MaterialCode \n" + " AND temp1.订货看板编号 = tt.Code \n" + " ) UNION1 UNION ALL\n" + @@ -531,12 +673,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " a.Qty> b.Qty \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 OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) tt ON temp1.Sap编码 = tt.MaterialCode \n" + " AND temp1.订货看板编号 = tt.Code \n" + " ) UNION2 \n" + " ) AS temp\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp.Sap编码 = TEMP2.MaterialCode\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp.Sap编码 = TEMP2.MaterialCode\n" + " LEFT JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_UnHQSettleAccount GROUP BY HQHKanBan, MaterialCode ) temp3 ON temp.[订货看板编号] = temp3.HQHKanBan \n" + " AND temp.[客户物料号] = temp3.MaterialCode"; @@ -579,7 +721,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report "WHERE\n" + " B.Kanban IS NULL {0} "; - var _sql3 = string.Format(sql2, condition); + var _sql3 = string.Format(sql3, condition); var listCompare1 = DbConnection.Query(_sql3); 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 3ee47b00..15b0c1fe 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 @@ -148,7 +148,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ( a.Version= '{0}' AND a.HQHKanBan IS NOT NULL ) \n" + " AND a.HQHKanBan <> 'BJ' \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 OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + " LEFT JOIN (\n" + " SELECT\n" + " ROUND( SUM ( Amt ) / SUM ( Qty ), 4 ) price,\n" + @@ -187,12 +187,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " 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); @@ -461,7 +455,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " b.Kanban IS NULL \n" + " AND b.MaterialCode IS NULL \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 OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode \n" + " ) aaaa UNION ALL\n" + "SELECT\n" + " ccc.* \n" + @@ -537,7 +531,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " 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\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + " LEFT JOIN (\n" + " SELECT\n" + " ROUND( SUM ( Amt ) / SUM ( Qty ), 4 ) price,\n" + @@ -579,7 +573,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report List _list = new List(); - string condition = " "; + string condition = ""; if (!string.IsNullOrEmpty(begin)) { @@ -648,7 +642,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " b.HQHKanBan IS NULL \n" + " AND b.MaterialCode IS NULL \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 OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + " LEFT JOIN (select * from set_backQty WHERE Version='{1}') tt ON temp1.Sap编码 = tt.MaterialCode \n" + " AND temp1.订货看板编号 = tt.Code \n" + " ) UNION1 UNION ALL\n" + @@ -698,7 +692,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " a.Qty> b.Qty \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 OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + " LEFT JOIN (select * from set_backQty WHERE Version='{1}') tt ON temp1.Sap编码 = tt.MaterialCode \n" + " AND temp1.订货看板编号 = tt.Code \n" + " ) UNION2"; @@ -722,7 +716,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode \n" + "WHERE\n" + " 1 = 1 {0} "; - var _sql2 = string.Format(str, condition); + var _sql2 = string.Format(sql2, condition); var listCompare = DbConnection.Query(_sql2); @@ -743,7 +737,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report "WHERE\n" + " B.Kanban IS NULL {0}"; - var _sql3 = string.Format(str, condition); + var _sql3 = string.Format(sql3, condition); var listCompare1 = DbConnection.Query(_sql3); @@ -1039,7 +1033,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " b.HQHKanBan IS NULL \n" + " AND b.MaterialCode IS NULL {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\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" + " AND temp1.订货看板编号 = tt.Code \n" + " ) UNION1 " ; @@ -1137,7 +1131,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " a.Qty> b.Qty {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\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" + " AND temp1.订货看板编号 = tt.Code \n" + " ) UNION2"; @@ -1249,7 +1243,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ) A\n" + " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " ) temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode"; + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode"; var _sql = string.Format(str, version); @@ -1323,7 +1317,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ) A\n" + " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " ) temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" + " LEFT JOIN (\n" + " SELECT SUM\n" + " ( Amt ) / SUM ( Qty ) AS Price,\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 46b7a6b6..f99f67da 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 @@ -177,7 +177,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " (\n" + " SELECT\n" + " '' WmsBillNum,\n" + - " CONVERT ( VARCHAR ( 100 ), a.WMSActualGoodsDate, 23 ) BeginDate,\n" + + " NULL BeginDate,\n" + " a.Kanban,\n" + " C.MaterialCode SapCode,\n" + " C.MaterialDesc,\n" + @@ -188,17 +188,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " isnull( tt.qty, 0 ) BackQty,\n" + " ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" + " FROM\n" + - " ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban, WMSActualGoodsDate FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban, WMSActualGoodsDate ) A\n" + + " ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban ) A\n" + " LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {1} GROUP BY Kanban, MaterialCode ) 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 ( SELECT * FROM set_backQty WHERE Version = '{2}' ) AS tt ON a.Kanban = tt.Code \n" + - " AND a.MaterialCode = b.MaterialCode \n" + + " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) AS tt ON a.Kanban = tt.Code \n" + + " AND a.MaterialCode = tt.MaterialCode \n" + " WHERE\n" + " B.Kanban IS NULL \n" + - " AND B.MaterialCode IS NULL {0} \n" + + " AND B.MaterialCode IS NULL \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 \n" + + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" + " ) UNION1 UNION ALL\n" + "SELECT\n" + " * \n" + @@ -212,7 +212,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " (\n" + " SELECT\n" + " '' WmsBillNum,\n" + - " CONVERT ( VARCHAR ( 100 ), a.WMSActualGoodsDate, 23 ) BeginDate,\n" + + " NULL BeginDate,\n" + " a.Kanban,\n" + " C.MaterialCode SapCode,\n" + " C.MaterialDesc,\n" + @@ -223,21 +223,21 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " isnull( tt.qty, 0 ) BackQty,\n" + " ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" + " FROM\n" + - " ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban, WMSActualGoodsDate FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban, WMSActualGoodsDate ) A\n" + + " ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban ) A\n" + " INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {1} GROUP BY Kanban, MaterialCode ) 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 ( SELECT * FROM set_backQty WHERE Version = '{2}' ) AS tt ON a.Kanban = tt.Code \n" + - " AND a.MaterialCode = b.MaterialCode \n" + + " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) AS tt ON a.Kanban = tt.Code \n" + + " AND a.MaterialCode = tt.MaterialCode \n" + " WHERE\n" + - " a.WMSDeliveryQty> B.Qty {0}\n" + + " a.WMSDeliveryQty> B.Qty \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 \n" + + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" + " ) UNION2"; - sql = string.Format(sql, str, contion,version); + sql = string.Format(sql, version, contion); //发运数据中,查出看板号+物料号相同的重复数据 @@ -250,8 +250,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WMSKanBanSettle A\n" + " INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle 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"; - var listCompare = DbConnection.Query(sql2); + " LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode\n" + + " WHERE 1=1 {0}"; + var _sql2= string.Format(sql2, str); + var listCompare = DbConnection.Query(_sql2); //查询发运表中,看权号+物料号没有重复的数据 @@ -266,9 +268,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " 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); + " B.Kanban IS NULL {0}"; + var _sql3 = string.Format(sql3, str); + var listCompare1 = DbConnection.Query(_sql3); //发运数据比较 @@ -313,7 +315,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report //数据整合,相同看板号+物料号的交货单号合并成一行中以逗号分隔 foreach (var itm1 in _list) { - var itm = _ls.FirstOrDefault(p => p.Kanban == itm1.WmsBillNum && p.MaterialCode == itm1.SapCode); + var itm = _ls.FirstOrDefault(p => p.Kanban == itm1.Kanban && p.MaterialCode == itm1.SapCode); if (itm != null) { itm1.WmsBillNum = itm.WmsBillNum; @@ -388,7 +390,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " 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"; + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode"; @@ -459,7 +461,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " a.WMSDeliveryQty> B.Qty {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"; + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode"; @@ -500,7 +502,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " LEFT JOIN ( SELECT sum( qty ) Qty, MaterialCode FROM Set_KanBanSettle GROUP BY MaterialCode ) b ON a.MaterialCode = b.MaterialCode\n" + " LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode \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"; + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode"; string str = string.Empty; str += " where 1=1 "; var _query = DbConnection.Query(sql, null, null, true, 1200, null); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs index 9383e6b7..91a844ef 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs @@ -102,7 +102,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " ( a.Version = '{0}' ) \n" + " ) AS temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + "ORDER BY\n" + " temp1.采购订单号"; @@ -161,7 +161,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " b.PurchaseOrderNo IS NULL \n" + " ) AS temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + "ORDER BY\n" + " temp1.采购订单号"; diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs index ba73cee4..5ff95b24 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs @@ -117,7 +117,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " ( a.Version = '{0}' ) \n" + " ) AS temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + " ) union1 UNION ALL\n" + "SELECT\n" + " union2.* \n" + @@ -162,10 +162,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " ( a.Version = '{0}' ) \n" + " ) AS temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + " ) union2"; - + //" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp.Sap编码 = TEMP2.MaterialCode\n" + string addwhere = string.Empty; string addSqlStr = string.Format(sqlString, version); @@ -245,7 +245,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " ( a.Version = '{0}' ) \n" + " ) AS temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode"; + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode"; string addwhere = string.Empty; string addSqlStr = string.Format(sqlString, version); @@ -310,7 +310,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " ( b.MaterialCode IS NULL ) \n" + " ) AS temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode"; + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode"; string addwhere = string.Empty; string addSqlStr = string.Format(sqlString, version); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQFactoryUnSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQFactoryUnSettledDetailDiffExportService.cs index 627c577d..22e6d1fe 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQFactoryUnSettledDetailDiffExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQFactoryUnSettledDetailDiffExportService.cs @@ -64,7 +64,7 @@ namespace SettleAccount.Job.Services.Report var _ls = _dapperRepository.GetSettleToFactoryDetailDiffReportList(version, materialCode, begin, end, materialGroup,iscontionversion); //红旗主机厂未结比对红旗系统未对 - var _ls_reversal = _dapperRepository.GetHQFactoryDetailDiffReportList(version, materialCode, begin, end, materialGroup); + var _ls_reversal = _dapperRepository.GetHQFactoryDetailDiffReportList(version, materialCode, begin, end, materialGroup, iscontionversion); //if (!string.IsNullOrEmpty(kanban)) 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 60f5a700..c97a2840 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs @@ -103,7 +103,7 @@ namespace SettleAccount.Job.Services.Report //} ExcelExporter _exporter = new ExcelExporter();//导出Excel - var result = _exporter.Append(_ls.ToList(), "有发货无结算差异原始对比") + var result = _exporter.Append(_ls.ToList(), "有发货无结算差异对比") .SeparateBySheet() .Append(_ls_orgiinal_kanban.ToList(), "原始看板未结对比数据") .SeparateBySheet()