Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
e8806ae3ab
  1. 96
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs

96
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs

@ -44,12 +44,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
var datestr= version.Substring(0, 4) +"-"+ version.Substring(4, 2) + "-01";
var date= DateTime.Parse(datestr).AddMonths(1).AddDays(-1);
var datetime=date.ToShortDateString()+" 23:59:59 ";
string sqlString = "SELECT\n" +
" temp1.* ,\n" +
@ -110,61 +106,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
// string sqlString = "SELECT\n" +
//" * ,\n" +
//" ISNULL ( temp1.InvoicePrice * Qty, 0 ) AS InvoiceMoney,--开票金额\n" +
//" ISNULL ( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" +
//" ISNULL ( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" +
//" ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" +
//" ISNULL ( Price * Qty - InvoicePrice * Qty, 0 ) AS SumDiffMoney,--总金额差异\n" +
//" '' DeliveryOrderNo --出库单号\n" +
//" \n" +
//"FROM\n" +
//" (\n" +
//" SELECT ROW_NUMBER\n" +
//" ( ) OVER ( ORDER BY b.EstimateTypeDesc ) AS RowId,\n" +
//"--c.WMSDeliveryNote,--交货单号\n" +
//"--CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" +
//" A.Kanban,--条码号\n" +
//" b.MaterialCode SapMaterialCode,--厂内物料号\n" +
//" b.MaterialDesc,--物料描述\n" +
//" b.CustomerPartCode,--客户物料\n" +
//" b.EstimateTypeDesc,--物料组(车型)\n" +
//" C.WMSDeliveryQty,--交货数量\n" +
//" ISNULL ( A.Qty, 0 ) AS SettleNumber,--结算数量\n" +
//" CONVERT ( VARCHAR ( 100 ), A.SettleDate, 23 ) SettleDate,--结算日期\n" +
//" ISNULL ( A.Qty, 0 ) AS Qty,--用于计算\n" +
//" ( ISNULL ( A.Qty, 0 ) - ISNULL ( C.WMSDeliveryQty, 0 ) ) AS SettleWMSDiffQty,--结算与发货差异\n" +
//" 0 AS SettleInvoiceDiffQty,--结算与开票差异\n" +
//" ISNULL ( A.Qty, 0 ) AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
//" ISNULL ( d.InvoicePrice, 0 ) InvoicePrice --开票单价\n" +
//" \n" +
//" FROM\n" +
//" Set_KanBanSettle\n" +
//" AS A LEFT JOIN Set_material AS b ON A.MaterialCode = b.CustomerPartCode\n" +
//" LEFT JOIN (\n" +
//"   SELECT\n" +
//" ( temp1.Qty - ISNULL ( temp2.Qty, 0 ) ) WMSDeliveryQty,\n" +
//" temp1.MaterialCode,\n" +
//" temp1.Kanban \n" +
//" FROM\n" +
//" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle WHERE VERSION < '{0}' GROUP BY kanban, MaterialCode ) temp1\n" +
//" INNER JOIN ( SELECT SUM ( WMSDeliveryQty ) Qty, KanBan, MaterialCode FROM Set_WMSKanBanSettle WHERE WMSActualGoodsDate < '{2}' GROUP BY KanBan, MaterialCode ) temp2 ON temp1.Kanban = temp2.KanBan \n" +
//" AND temp1.MaterialCode = temp2.KanBan \n" +
//" ) C ON A.Kanban = C.Kanban \n" +
//" AND A.MaterialCode = C.MaterialCode\n" +
//" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE VERSION = '{0}' GROUP BY materialcode ) d ON A.MaterialCode = d.MaterialCode \n" +
//" WHERE\n" +
//" A.VERSION = '{0}' {1}\n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, --定价\n" +
//" MaterialCode --厂内物料号\n" +
//" FROM Set_PriceList WHERE VERSION = ( SELECT MAX ( VERSION ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode \n" +
//"WHERE\n" +
//" 1 = 1;";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version, condition,datetime);
@ -185,13 +126,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
// addwhere += string.Format(" AND EstimateTypeDesc LIKE '{0}%' ", estimateTypeDesc);
//}
string _sql = string.Format(addSqlStr, addwhere);
var _query = DbConnection.Query<SettleKBWithCode>(_sql, null, null, true, 1200, null);
@ -199,14 +133,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var _lst = _query.ToList();
var sql1 = "SELECT A\n" +
" .WMSDeliveryNote WmsBillNum,\n" +
var sql1 = "SELECT \n" +
" A.WMSDeliveryNote WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" +
" A.Kanban,\n" +
" A.WMSActualGoodsDate WmsDate \n" +
"FROM\n" +
" FROM\n" +
" Set_WMSKanBanSettle\n" +
" A INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT ( 1 ) = 1 ) B ON A.Kanban = B.Kanban \n" +
" A INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT(1) = 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";
@ -247,14 +181,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var sql2 = "SELECT A\n" +
" .WMSDeliveryNote WmsBillNum,\n" +
var sql2 = "SELECT \n" +
" A.WMSDeliveryNote WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" +
" A.Kanban,\n" +
" A.WMSActualGoodsDate WmsDate \n" +
" A.WMSActualGoodsDate WmsDate \n" +
" FROM\n" +
" Set_WMSKanBanSettle\n" +
" A INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT ( * ) > 1 ) B ON A.Kanban = B.Kanban \n" +
" A 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";
@ -308,21 +242,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
return _lst;
}

Loading…
Cancel
Save