From f58db6f33b246b60f80f27be726e9421c77dd221 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 23 Feb 2022 15:36:54 +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 --- .../Report/HQHSettledDetailDapperRepository.cs | 4 ++++ 1 file changed, 4 insertions(+) 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 79512946..75114389 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 @@ -186,6 +186,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report first.WmsBillNum += itm.WmsBillNum; first.WmsDate += itm.WmsDate; } + else + { + _ls.Add(itm); + } } foreach (var itm in listCompare1.ToList()) From c7d797fcc6161a95ae6745ff5cdf3ded90d94a6a Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 23 Feb 2022 17:38:41 +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 --- .../HQHSettledDetailDapperRepository.cs | 117 +++++++++++++++++- 1 file changed, 115 insertions(+), 2 deletions(-) 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 75114389..0f221e6d 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 @@ -21,6 +21,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } + public class CompareExtend1 + { + public string AcceptanceNo { set; get; } + public string KanbanNumber { set; get; } + public string AcceptanceDate { set; get; } + public string HQHKanBan { set; get; } + public string MaterialCode { set; get; } + } + + + /// /// 红旗H平台输出报表 @@ -154,9 +165,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " AND A.MaterialCode = B.MaterialCode"; + + + + var listCompare= DbConnection.Query(sql2); + + + var sql3 = "SELECT\n" + " a.WmsBillNum,\n" + " a.MaterialCode,\n" + @@ -177,14 +195,109 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report + 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" + + " MaterialCode \n" + + " FROM\n" + + " Set_HQ_H_Platform a \n" + + " WHERE\n" + + " Version = '{0}' \n" + + " AND HQHKanBan <> 'BJ' \n" + + " ) t1\n" + + " LEFT JOIN ( SELECT HQHKanBan, MaterialCode FROM Set_HQ_H_Platform a WHERE Version = '{0}' AND HQHKanBan <> 'BJ' GROUP BY HQHKanBan, MaterialCode HAVING count(*)> 1 ) 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" + + " MaterialCode \n" + + " FROM\n" + + " Set_HQ_H_Platform a \n" + + " WHERE\n" + + " Version = '{0}' \n" + + " AND HQHKanBan <> 'BJ' \n" + + " ) t1\n" + + " INNER JOIN ( SELECT HQHKanBan, MaterialCode FROM Set_HQ_H_Platform a WHERE Version = '{0}' AND HQHKanBan <> 'BJ' GROUP BY HQHKanBan, MaterialCode HAVING count(*)> 1 ) 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" + + " MaterialCode \n" + + "FROM\n" + + " Set_HQ_H_Platform a \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) { - first.WmsBillNum += itm.WmsBillNum; - first.WmsDate += itm.WmsDate; + first.WmsBillNum += "," + itm.WmsBillNum; + first.WmsDate += "," + itm.WmsDate; } else {