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 6ac1c04c..8fd733b1 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 @@ -580,142 +580,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report var listCompare1 = DbConnection.Query(sql3); - string contionCompare = string.Empty; - //选中,是否过滤掉当期结算数据 - if (iscontionversion == "0") - { - contionCompare += string.Format(" WHERE Version <'{0}' AND HQHKanBan <> 'BJ' ", version); - } - else - { - contionCompare += " WHERE 1=1 "; - } - - //红旗结算数据中,看板号+物料号没有重复的数据 - var sql10 = "SELECT DISTINCT\n" + - " t1.* \n" + - "FROM\n" + - " (\n" + - " SELECT\n" + - " a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" + - " a.KanbanNumber AS KanbanNumber,\n" + - " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" + - " HQHKanBan,\n" + - " b2.MaterialCode \n" + - " FROM\n" + - " Set_HQ_H_Platform a\n" + - " LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" + - " {0} \n" + - " ) t1\n" + - " LEFT JOIN (\n" + - " SELECT\n" + - " HQHKanBan,\n" + - " MaterialCode \n" + - " FROM\n" + - " Set_HQ_H_Platform a \n" + - " {0} \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 list_leftjoin_hplatform = DbConnection.Query(string.Format(sql10, contionCompare)); - - - - - //红旗结算数据中,看板号+物料号有重复的数据 - var sql11 = "SELECT DISTINCT\n" + - " t1.* \n" + - "FROM\n" + - " (\n" + - " SELECT\n" + - " a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" + - " a.KanbanNumber AS KanbanNumber,\n" + - " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" + - " HQHKanBan,\n" + - " b2.MaterialCode \n" + - " FROM\n" + - " Set_HQ_H_Platform a\n" + - " LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" + - " {0}\n" + - " ) t1\n" + - " INNER JOIN (\n" + - " SELECT\n" + - " HQHKanBan,\n" + - " MaterialCode \n" + - " FROM\n" + - " Set_HQ_H_Platform a \n" + - " {0}\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 list_innerjoin_hplatform = DbConnection.Query(string.Format(sql11, contionCompare)); - - - string contionCompareBJ = string.Empty; - //选中,是否过滤掉当期结算数据 - if (iscontionversion == "0") - { - contionCompareBJ += string.Format(" WHERE Version <'{0}' AND HQHKanBan = 'BJ' ", version); - } - else - { - contionCompareBJ += " WHERE 1=1 "; - } - - var sql12 = "SELECT\n" + - " a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" + - " a.KanbanNumber AS KanbanNumber,\n" + - " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" + - " HQHKanBan,\n" + - " b2.MaterialCode \n" + - "FROM\n" + - " Set_HQ_H_Platform a\n" + - " LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" + - "{0}"; - - var list_hplaform_bj = DbConnection.Query(string.Format(sql12, contionCompareBJ)); - - - //结算数据比较 - List _lscopy = new List(); - - foreach (var itm in list_leftjoin_hplatform) - { - 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.ExternalKanbanNumber += "," + itm.ExternalKanbanNumber; - } - else - { - _lscopy.Add(itm); - } - } - foreach (var itm in list_innerjoin_hplatform) - { - _lscopy.Add(itm); - } - foreach (var itm in list_hplaform_bj) - { - _lscopy.Add(itm); - } + //发运数据比较 @@ -765,14 +630,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report 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.ExternalKanbanNumber; - } }