Commit c9eb80f9 authored by 张永's avatar 张永

需求 #15246

parent 4041c454
...@@ -247,26 +247,35 @@ public class OrderServiceImpl implements OrderService { ...@@ -247,26 +247,35 @@ public class OrderServiceImpl implements OrderService {
throw new XException("订单编号错误或订单不存在"); throw new XException("订单编号错误或订单不存在");
} }
List<Map<String, Object>> orderDtlList = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> orderDtlList = new ArrayList<Map<String, Object>>();
if (orderMap.size() > 0) { if (orderMap.size() > 0) { //需求 #15246
String sql2 = "select sod.*, sos.nSendQty, PromoSalePrice = CONVERT(NUMERIC(12,2),ROUND((sod.nSaleAmount)/sod.nSaleQty,2)), "
+ " OriginaSaleAmount = sod.nSaleAmount + sod.nDisAmount, ISGift = sod.nTag&1, " String sql2 = "select sod.sSalesOrderID, sod.nIdx, sod.sAgentContractNO, sod.nAgentID, " +
+ " agp.sURL, pm.sPromoName, pm.sPromoTheme, pm.sPromoActionType sPromoType, pm.sPromoActionTypeID sPromoTypeID, " " sod.sWarehouseNO, sod.sBarcode, sod.nGoodsID, sod.sGoodsDesc, " +
+ " BrandID = ag.sBrandID, Brand = ag.sBrand " " nSaleQty = case when sod.nOrderRate > 1 then sod.nPackQty else sod.nSaleQty end, " +
+ " from tSalesOrderDtl sod join tAgentGoods ag on sod.nAgentID = ag.nAgentID and sod.nGoodsID = ag.nGoodsID " " nSalePrice = case when sod.nOrderRate > 1 then sod.nSaleAmount / sod.nPackQty else sod.nSalePrice end, sod.nSaleAmount, " +
+ " left join (select a.sPromoPaperNO, a.sPromoName, a.sPromoTheme, a.sPromoActionTypeID, a.sPromoActionType, b.nGoodsID " " sod.nDisAmount, sod.sMemo, sod.dUpdate, sod.nTag, " +
+ " from tYWPromoMain a, tYWPromoDtl b " " sod.dLastUpdateTime, sod.sPromoActionTypeID, sod.sPromoActionType, " +
+ " where a.sPromoPaperNO = b.sPromoPaperNO " " sod.sPromoPaperNO, sod.nExpressFee, sod.nOldSaleQty, sod.nOldSalePrice, " +
+ " and a.sPromoPaperNORuleID = b.sPromoPaperNO + isnull(convert(varchar,b.nRuleID),'') " " sod.sSaleUnit, sod.nPackQty, sod.nOrderRate," +
+ " and a.nTag&1=0 " " nSendQty = case when sod.nOrderRate > 1 then sos.nSendQty / sod.nOrderRate else sos.nSendQty end, " +
+ " and b.nTag&1=0 " " PromoSalePrice = CONVERT(NUMERIC(12,2),ROUND((sod.nSaleAmount)/sod.nSaleQty,2)), " +
+ " ) pm on pm.sPromoPaperNO = sod.sPromoPaperNO and pm.nGoodsID = sod.nGoodsID " " OriginaSaleAmount = sod.nSaleAmount, sod.nDisAmount, ISGift = sod.nTag&1, " +
+ " left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1 " " agp.sURL, pm.sPromoName, pm.sPromoTheme, pm.sPromoActionType sPromoType, pm.sPromoActionTypeID sPromoTypeID, " +
+ " left join tSalesOrderSubDtl sos on sos.sSalesOrderID = sod.sSalesOrderID " " BrandID = ag.sBrandID, Brand = ag.sBrand " +
+ " and sos.sAgentContractNO = sod.sAgentContractNO " " from tSalesOrderDtl sod join tAgentGoods ag on sod.nAgentID = ag.nAgentID and sod.nGoodsID = ag.nGoodsID " +
+ " and sos.nGoodsID = sod.nGoodsID " " left join (select a.sPromoPaperNO, a.sPromoName, a.sPromoTheme, a.sPromoActionTypeID, a.sPromoActionType, b.nGoodsID " +
+ " and (sos.nTag&1 = sod.nTag&1 or sos.nTag&1-1 = sod.nTag&1-1) " " from tYWPromoMain a, tYWPromoDtl b " +
+ " where sod.sSalesOrderID = ?"; " 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); orderDtlList = jdbcTemplate.queryForList(sql2, salesOrderId);
} }
Map<String, Object> payMap = new HashMap<String,Object>(); Map<String, Object> payMap = new HashMap<String,Object>();
...@@ -368,23 +377,43 @@ public class OrderServiceImpl implements OrderService { ...@@ -368,23 +377,43 @@ public class OrderServiceImpl implements OrderService {
+ "case when so.nOrderStatus&145 = 144 then '16' when so.nOrderStatus&145 = 128 then '8' when so.nOrderStatus&145 = 0 then '4' when so.nOrderStatus&5 = 4 then '2' else '0' end nOrderStatus, " + "case when so.nOrderStatus&145 = 144 then '16' when so.nOrderStatus&145 = 128 then '8' when so.nOrderStatus&145 = 0 then '4' when so.nOrderStatus&5 = 4 then '2' else '0' end nOrderStatus, "
+ "case when so.nOrderStatus&145 = 144 then '已完成' when so.nOrderStatus&145 = 128 then '配送中' when so.nOrderStatus&145 = 0 then '待发货' when so.nOrderStatus&5 = 4 then '已审核' else '未审核' end sOrderStatusText " + "case when so.nOrderStatus&145 = 144 then '已完成' when so.nOrderStatus&145 = 128 then '配送中' when so.nOrderStatus&145 = 0 then '待发货' when so.nOrderStatus&5 = 4 then '已审核' else '未审核' end sOrderStatusText "
+ "from tSalesOrder so where so.sSalesOrderID = ?", subOrderMap.get("sSalesOrderID")); + "from tSalesOrder so where so.sSalesOrderID = ?", subOrderMap.get("sSalesOrderID"));
String sql = "select sosd.*, PromoSalePrice=CONVERT(NUMERIC(12,2),ROUND((sosd.nSaleAmount)/sosd.nSaleQty,2)), "
+ " OriginaSaleAmount=sosd.nSaleAmount+sosd.nDisAmount, ISGift = sosd.nTag&1, " //需求 #15246
+ " sosd.nSendQty - isnull(sosd.nReturnQty,0) LeftReturnQty, ag.nSaleUnits SaleMulti, ag.sSpec sSpec," String sql = "select sosd.sSubOrderID, sosd.nIdx, sosd.sSalesOrderID, sosd.sAgentContractNO, " +
+ " ag.sGoodTypeID GoodTypeID, agp.sURL, pm.sPromoName, pm.sPromoTheme, " " sosd.nAgentID, sosd.sWarehouseNO, sosd.sBarcode, sosd.nGoodsID, sosd.sGoodsDesc, " +
+ " pm.sPromoActionType sPromoType, pm.sPromoActionTypeID sPromoTypeID, " " nSaleQty = case when sosd.nOrderRate > 1 then sosd.nPackQty else sosd.nSaleQty end, " +
+ " BrandID = ag.sBrandID, Brand = ag.sBrand " " nSalePrice = case when sosd.nOrderRate > 1 then sosd.nSaleAmount/sosd.nPackQty else sosd.nSalePrice end, " +
+ " from tSalesOrderSubDtl sosd " " sosd.nSaleAmount, " +
+ " left join (select a.sPromoPaperNO, a.sPromoName, a.sPromoTheme, a.sPromoActionTypeID, a.sPromoActionType, b.nGoodsID " " sosd.nDisAmount, " +
+ " from tYWPromoMain a, tYWPromoDtl b " " nSendQty = case when sosd.nOrderRate > 1 then sosd.nSendQty / sosd.nOrderRate else sosd.nSendQty end, " +
+ " where a.sPromoPaperNO = b.sPromoPaperNO " " sosd.nSendAmount, " +
+ " and a.sPromoPaperNORuleID = b.sPromoPaperNO + isnull(convert(varchar,b.nRuleID),'') " " nReceiveQty = case when sosd.nOrderRate > 1 then sosd.nReceiveQty / sosd.nOrderRate else sosd.nReceiveQty end, " +
+ " and a.nTag&1=0 " " sosd.nReceiveAmount, " +
+ " and b.nTag&1=0 " " sosd.sMemo, sosd.dUpdate, sosd.nTag, sosd.dLastUpdateTime, " +
+ " ) pm on pm.sPromoPaperNO = sosd.sPromoPaperNO and pm.nGoodsID = sosd.nGoodsID " " sosd.sPromoActionTypeID, sosd.sPromoActionType, sosd.sOldSubOrderID, " +
+ " left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1 " " sosd.nAvgStockPrice, sosd.nReturnQty, sosd.sReturnTypeID, " +
+ " left join tAgentContractGoods ag on sosd.sAgentContractNO = ag.sAgentContractNO and sosd.nGoodsID = ag.nGoodsID " " sosd.sReturnType, sosd.sRetunReson, sosd.nCaseUnits, sosd.sUnit, " +
+ " where sosd.sSubOrderID = ?"; " sosd.sChangeUser, sosd.dChangeDate, sosd.dProduceDate, sosd.nTaxRate, " +
" sosd.nExpressFee, sosd.sPromoPaperNO, sosd.nOldSaleQty, " +
" sosd.nOldSalePrice, sosd.nOldLockedQty, sosd.sSaleUnit, " +
" sosd.nPackQty, sosd.nOrderRate, " +
" PromoSalePrice = CONVERT(NUMERIC(12,2),ROUND((sosd.nSaleAmount)/sosd.nSaleQty,2)), " +
" OriginaSaleAmount = sosd.nSaleAmount,sosd.nDisAmount, ISGift = sosd.nTag&1, " +
" LeftReturnQty = case when sosd.nOrderRate > 1 then (sosd.nSendQty - isnull(sosd.nReturnQty,0)) / sosd.nOrderRate else sosd.nSendQty - isnull(sosd.nReturnQty,0) end, " +
" ag.nSaleUnits SaleMulti, ag.sSpec sSpec," +
" ag.sGoodTypeID GoodTypeID, agp.sURL, pm.sPromoName, pm.sPromoTheme, " +
" pm.sPromoActionType sPromoType, pm.sPromoActionTypeID sPromoTypeID, " +
" BrandID = ag.sBrandID, Brand = ag.sBrand " +
"from tSalesOrderSubDtl sosd 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 = sosd.sPromoPaperNO and pm.nGoodsID = sosd.nGoodsID " +
" left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1 " +
" left join tAgentContractGoods ag on sosd.sAgentContractNO = ag.sAgentContractNO and sosd.nGoodsID = ag.nGoodsID " +
"where sosd.sSubOrderID = ?";
List<Map<String, Object>> dtlList = jdbcTemplate.queryForList(sql, subOrderID); List<Map<String, Object>> dtlList = jdbcTemplate.queryForList(sql, subOrderID);
Map<String, Object> deliver = jdbcTemplate.queryForMap( Map<String, Object> deliver = jdbcTemplate.queryForMap(
......
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