Commit 6a808f74 authored by 张永's avatar 张永

需求 #15246

parent 9fbdbc13
......@@ -201,8 +201,7 @@ public class OrderServiceImpl implements OrderService {
if (orderList.size() > 0) {
List<String> orderIds = orderList.stream().map(o -> (String) o.get("sSalesOrderID"))
.collect(Collectors.toList());
//需求 #15246
String sql2 = "select sod.sSalesOrderID, sod.nIdx, sod.sAgentContractNO, sod.nAgentID, " +
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, " +
......@@ -215,8 +214,9 @@ public class OrderServiceImpl implements OrderService {
" 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) + ")";
"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) + ")";
List<Map<String, Object>> orderDtlList = jdbcTemplate.queryForList(sql2);
Map<String, List<Map<String, Object>>> dtlML = Util.listToML(orderDtlList, "sSalesOrderID");
for (Map<String, Object> orderMap : orderList) {
......@@ -224,8 +224,7 @@ public class OrderServiceImpl implements OrderService {
List<Map<String, Object>> dtlList = dtlML.get(sSalesOrderID);
orderMap.put("list", dtlList);
}
//需求 #15246
String sql3 = "select sosd.sSubOrderID, sosd.nIdx, sosd.sSalesOrderID, sosd.sAgentContractNO, " +
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, " +
......@@ -250,7 +249,7 @@ public class OrderServiceImpl implements OrderService {
" 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) + ")";
"where sosd.sSubOrderID in("+StringUtil.join("', '", "'", "'", orderIds) +")";
List<Map<String, Object>> subList = jdbcTemplate.queryForList(sql3);
if (subList.size() > 0) {
......@@ -294,15 +293,27 @@ public class OrderServiceImpl implements OrderService {
" 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.sPromoPaperNO, sod.nExpressFee, sod.nOldSaleQty, sod.nOldSalePrice, " +
" 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 = ? ";
" nSendQty = case when sod.nOrderRate > 1 then sos.nSendQty / sod.nOrderRate else sos.nSendQty end, " +
" PromoSalePrice = CONVERT(NUMERIC(12,2),ROUND((sod.nSaleAmount)/sod.nSaleQty,2)), " +
" OriginaSaleAmount = sod.nSaleAmount, sod.nDisAmount, ISGift = sod.nTag&1, " +
" agp.sURL, pm.sPromoName, pm.sPromoTheme, pm.sPromoActionType sPromoType, pm.sPromoActionTypeID sPromoTypeID, " +
" BrandID = ag.sBrandID, Brand = ag.sBrand " +
" from tSalesOrderDtl sod join tAgentGoods ag on sod.nAgentID = ag.nAgentID and sod.nGoodsID = ag.nGoodsID " +
" left join (select a.sPromoPaperNO, a.sPromoName, a.sPromoTheme, a.sPromoActionTypeID, a.sPromoActionType, b.nGoodsID " +
" from tYWPromoMain a, tYWPromoDtl b " +
" where a.sPromoPaperNO = b.sPromoPaperNO " +
" and a.sPromoPaperNORuleID = b.sPromoPaperNO + isnull(convert(varchar,b.nRuleID),'') " +
" and a.nTag&1=0 " +
" and b.nTag&1=0 " +
" ) pm on pm.sPromoPaperNO = sod.sPromoPaperNO and pm.nGoodsID = sod.nGoodsID " +
" left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1 " +
" left join tSalesOrderSubDtl sos on sos.sSalesOrderID = sod.sSalesOrderID " +
" and sos.sAgentContractNO = sod.sAgentContractNO " +
" and sos.nGoodsID = sod.nGoodsID " +
" and (sos.nTag&1 = sod.nTag&1 or sos.nTag&1-1 = sod.nTag&1-1) " +
"where sod.sSalesOrderID = ? ";
orderDtlList = jdbcTemplate.queryForList(sql2, salesOrderId);
}
Map<String, Object> payMap = new HashMap<String,Object>();
......@@ -432,7 +443,7 @@ public class OrderServiceImpl implements OrderService {
" 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 = ? ";
List<Map<String, Object>> dtlList = jdbcTemplate.queryForList(sql, subOrderID);
Map<String, Object> deliver = jdbcTemplate.queryForMap(
"SELECT sum(a.nNum) nTotalCount, sum(a.nPrice * a.nNum) nTotalAmount FROM tSalesOrderDeliverSubDtl a where a.sSubOrderID = ?",
......
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