Commit 9fbdbc13 authored by 张永's avatar 张永

需求 #15246

parent e82e0950
...@@ -201,8 +201,21 @@ public class OrderServiceImpl implements OrderService { ...@@ -201,8 +201,21 @@ public class OrderServiceImpl implements OrderService {
if (orderList.size() > 0) { if (orderList.size() > 0) {
List<String> orderIds = orderList.stream().map(o -> (String) o.get("sSalesOrderID")) List<String> orderIds = orderList.stream().map(o -> (String) o.get("sSalesOrderID"))
.collect(Collectors.toList()); .collect(Collectors.toList());
String sql2 = "select sod.*,PromoSalePrice=CONVERT(NUMERIC(12,2),case when sod.nSaleQty = 0 then 0 else ROUND((sod.nSaleAmount)/sod.nSaleQty,2) end),OriginaSaleAmount=sod.nSaleAmount+sod.nDisAmount,ISGift = sod.nTag&1,agp.sURL " //需求 #15246
+ " from tSalesOrderDtl sod left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1 " String sql2 = "select sod.sSalesOrderID, sod.nIdx, sod.sAgentContractNO, sod.nAgentID, " +
" sod.sWarehouseNO, sod.sBarcode, sod.nGoodsID, sod.sGoodsDesc, " +
" nSaleQty = case when sod.nOrderRate > 1 then sod.nPackQty else sod.nSaleQty end, " +
" nSalePrice = case when sod.nOrderRate > 1 then sod.nSaleAmount / sod.nPackQty else sod.nSalePrice end, sod.nSaleAmount, " +
" sod.nDisAmount, sod.sMemo, sod.dUpdate, sod.nTag, " +
" sod.dLastUpdateTime, sod.sPromoActionTypeID, sod.sPromoActionType, " +
" sod.sPromoPaperNO, sod.nExpressFee, " +
" nOldSaleQty = case when sod.nOrderRate > 1 then sod.nOldSaleQty / sod.nOrderRate else sod.nOldSaleQty end, " +
" nOldSalePrice = case when sod.nOrderRate > 1 then sod.nOldSalePrice * sod.nOrderRate else sod.nOldSalePrice end, " +
" sod.sSaleUnit, sod.nPackQty, sod.nOrderRate," +
" PromoSalePrice=CONVERT(NUMERIC(12,2),case when sod.nSaleQty = 0 then 0 else ROUND((sod.nSaleAmount)/sod.nSaleQty,2) end)," +
" OriginaSaleAmount=sod.nSaleAmount+sod.nDisAmount," +
" ISGift = sod.nTag&1, agp.sURL" +
" from tSalesOrderDtl sod left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1 "
+ " where sod.sSalesOrderID in (" + StringUtil.join("', '", "'", "'", orderIds) + ")"; + " where sod.sSalesOrderID in (" + StringUtil.join("', '", "'", "'", orderIds) + ")";
List<Map<String, Object>> orderDtlList = jdbcTemplate.queryForList(sql2); List<Map<String, Object>> orderDtlList = jdbcTemplate.queryForList(sql2);
Map<String, List<Map<String, Object>>> dtlML = Util.listToML(orderDtlList, "sSalesOrderID"); Map<String, List<Map<String, Object>>> dtlML = Util.listToML(orderDtlList, "sSalesOrderID");
...@@ -211,8 +224,34 @@ public class OrderServiceImpl implements OrderService { ...@@ -211,8 +224,34 @@ public class OrderServiceImpl implements OrderService {
List<Map<String, Object>> dtlList = dtlML.get(sSalesOrderID); List<Map<String, Object>> dtlList = dtlML.get(sSalesOrderID);
orderMap.put("list", dtlList); orderMap.put("list", dtlList);
} }
String sql3 = "select * from tSalesOrderSub where sSalesOrderID in (" //需求 #15246
+ StringUtil.join("', '", "'", "'", orderIds) + ")"; String sql3 = "select sosd.sSubOrderID, sosd.nIdx, sosd.sSalesOrderID, sosd.sAgentContractNO, " +
" sosd.nAgentID, sosd.sWarehouseNO, sosd.sBarcode, sosd.nGoodsID, sosd.sGoodsDesc, " +
" nSaleQty = case when sosd.nOrderRate > 1 then sosd.nPackQty else sosd.nSaleQty end, " +
" nSalePrice = case when sosd.nOrderRate > 1 then sosd.nSaleAmount/sosd.nPackQty else sosd.nSalePrice end, " +
" sosd.nSaleAmount, " +
" sosd.nDisAmount, " +
" nSendQty = case when sosd.nOrderRate > 1 then sosd.nSendQty / sosd.nOrderRate else sosd.nSendQty end, " +
" sosd.nSendAmount, " +
" nReceiveQty = case when sosd.nOrderRate > 1 then sosd.nReceiveQty / sosd.nOrderRate else sosd.nReceiveQty end, " +
" sosd.nReceiveAmount, " +
" sosd.sMemo, sosd.dUpdate, sosd.nTag, sosd.dLastUpdateTime, " +
" sosd.sPromoActionTypeID, sosd.sPromoActionType, sosd.sOldSubOrderID, " +
" sosd.nAvgStockPrice, sosd.nReturnQty, sosd.sReturnTypeID, " +
" sosd.sReturnType, sosd.sRetunReson, sosd.nCaseUnits, sosd.sUnit, " +
" sosd.sChangeUser, sosd.dChangeDate, sosd.dProduceDate, sosd.nTaxRate, " +
" sosd.nExpressFee, sosd.sPromoPaperNO, " +
" nOldSaleQty = case when sosd.nOrderRate > 1 then sosd.nOldSaleQty / sosd.nOrderRate else sosd.nOldSaleQty end, " +
" nOldSalePrice = case when sosd.nOrderRate > 1 then sosd.nOldSalePrice*sosd.nOrderRate else sosd.nOldSalePrice end, " +
" sosd.nOldLockedQty, sosd.sSaleUnit, " +
" sosd.nPackQty, sosd.nOrderRate, " +
" PromoSalePrice=CONVERT(NUMERIC(12,2),case when sosd.nSaleQty = 0 then 0 else ROUND((sosd.nSaleAmount)/sosd.nSaleQty,2) end)," +
" OriginaSaleAmount=sosd.nSaleAmount+sosd.nDisAmount," +
" ISGift = sosd.nTag&1," +
" agp.sURL " +
"from tSalesOrderSubDtl sosd left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1" +
"where sosd.sSubOrderID in ("+ StringUtil.join("', '", "'", "'", orderIds) + ")";
List<Map<String, Object>> subList = jdbcTemplate.queryForList(sql3); List<Map<String, Object>> subList = jdbcTemplate.queryForList(sql3);
if (subList.size() > 0) { if (subList.size() > 0) {
List<String> subIds = subList.stream().map(o -> (String) o.get("sSubOrderID")) List<String> subIds = subList.stream().map(o -> (String) o.get("sSubOrderID"))
...@@ -384,7 +423,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -384,7 +423,7 @@ public class OrderServiceImpl implements OrderService {
" sosd.sChangeUser, sosd.dChangeDate, sosd.dProduceDate, sosd.nTaxRate, " + " sosd.sChangeUser, sosd.dChangeDate, sosd.dProduceDate, sosd.nTaxRate, " +
" sosd.nExpressFee, sosd.sPromoPaperNO, " + " sosd.nExpressFee, sosd.sPromoPaperNO, " +
" nOldSaleQty = case when sosd.nOrderRate > 1 then sosd.nOldSaleQty / sosd.nOrderRate else sosd.nOldSaleQty end, " + " nOldSaleQty = case when sosd.nOrderRate > 1 then sosd.nOldSaleQty / sosd.nOrderRate else sosd.nOldSaleQty end, " +
" nOldSalePrice = case when sosd.nOrderRate > 1 then sosd.nOldSalePrice*sosd.nOrderRate else sosd.nOldSalePrice end, " + " nOldSalePrice = case when sosd.nOrderRate > 1 then sosd.nOldSalePrice*sosd.nOrderRate else sosd.nOldSalePrice end," +
" sosd.nOldLockedQty, sosd.sSaleUnit, " + " sosd.nOldLockedQty, sosd.sSaleUnit, " +
" sosd.nPackQty, sosd.nOrderRate, " + " sosd.nPackQty, sosd.nOrderRate, " +
" PromoSalePrice=CONVERT(NUMERIC(12,2),case when sosd.nSaleQty = 0 then 0 else ROUND((sosd.nSaleAmount)/sosd.nSaleQty,2) end)," + " PromoSalePrice=CONVERT(NUMERIC(12,2),case when sosd.nSaleQty = 0 then 0 else ROUND((sosd.nSaleAmount)/sosd.nSaleQty,2) end)," +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment