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 00a24751..ceba82e8 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 @@ -11,6 +11,15 @@ using Volo.Abp.EntityFrameworkCore; namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report { + public class CompareExtend + { + public string WmsBillNum { set; get; } + public string MaterialCode { set; get; } + public string Kanban { set; get; } + + } + + /// /// 红旗H平台输出报表 /// @@ -99,7 +108,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report "FROM\n" + " (\n" + " SELECT\n" + - " b.WmsBillNum AS 交货单号,\n" + + " '' AS 交货单号,\n" + " CONVERT ( VARCHAR ( 100 ), b.LastModificationTime, 23 ) AS 交货时间,\n" + " b.IsAuto AS 手工或自动,\n" + " a.StorageLocation AS 收货仓库,\n" + @@ -124,12 +133,40 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " AND a.MaterialCode = b.MaterialCode\n" + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " WHERE\n" + - - " 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 WHERE temp1.[交货单号] is not null "; var _sql = string.Format(str, version, condition); + + + var sql2 = "SELECT\n" + + " a.WmsBillNum,\n" + + " a.MaterialCode,\n" + + " a.Kanban \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"; + + + var listCompare= DbConnection.Query(sql2); + + 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; + } + + + } + + + var _query = DbConnection.Query(_sql, null, null, true, 1200, null); _list = _query.ToList(); return _list;