Commit f5fa07fd authored by 张永's avatar 张永

需求 #14267

parent 6e5afc26
...@@ -285,12 +285,23 @@ public class OrderServiceImpl implements OrderService { ...@@ -285,12 +285,23 @@ public class OrderServiceImpl implements OrderService {
@Override @Override
public String getSubOrderDetail(String subOrderID) { public String getSubOrderDetail(String subOrderID) {
new ArrayList<Map<String, Object>>(); new ArrayList<Map<String, Object>>();
int ReturnDay = 0;
try {
String msql = "select convert(int, sValue1) FROM tSystemCtrl WHERE sCode = 'SaleReturnDays' ";
ReturnDay = jdbcTemplate.queryForInt(msql);
} catch (Exception e) {
}
Map<String, Object> subOrderMap = jdbcTemplate.queryForMap("" Map<String, Object> subOrderMap = jdbcTemplate.queryForMap(""
+ "select " + "select "
+ "sos.*, " + "sos.*, "
+ " IsRefund = case when isnull(sos.sBindPaperNO,'') = '' then 1 when sos.nOrderStatus&17=0 then 0 when datediff(dd,dateadd(dd,1,convert(date,sos.dReceiveDate)),getdate()) >= ? then 0 else 1 end, "
+ " LeftReturnQty = isnull(d.nSendQty,0) - isnull(d.nReturnQty,0), "
+ "case when sos.nOrderStatus&145 = 144 then '16' when sos.nOrderStatus&145 = 128 then '8' when sos.nOrderStatus&145 = 0 then '4' when sos.nOrderStatus&5 = 4 then '2' else '0' end nOrderStatus, " + "case when sos.nOrderStatus&145 = 144 then '16' when sos.nOrderStatus&145 = 128 then '8' when sos.nOrderStatus&145 = 0 then '4' when sos.nOrderStatus&5 = 4 then '2' else '0' end nOrderStatus, "
+ "case when sos.nOrderStatus&145 = 144 then '已完成' when sos.nOrderStatus&145 = 128 then '配送中' when sos.nOrderStatus&145 = 0 then '待发货' when sos.nOrderStatus&5 = 4 then '已审核' else '未审核' end sOrderStatusText " + "case when sos.nOrderStatus&145 = 144 then '已完成' when sos.nOrderStatus&145 = 128 then '配送中' when sos.nOrderStatus&145 = 0 then '待发货' when sos.nOrderStatus&5 = 4 then '已审核' else '未审核' end sOrderStatusText "
+ "from tSalesOrderSub sos where sos.sSubOrderID = ?", subOrderID); + "from tSalesOrderSub sos left join (select sSubOrderID, nSendQty = sum(nSendQty), nReturnQty = sum(nReturnQty) from tSalesOrderSubDtl where sSubOrderID = ? group by sSubOrderID) d on sos.sSubOrderID = d.sSubOrderID "
+ " where sos.sSubOrderID = ?", ReturnDay,subOrderID,subOrderID);
Map<String, Object> orderMap = jdbcTemplate.queryForMap("" Map<String, Object> orderMap = jdbcTemplate.queryForMap(""
+ "select " + "select "
+ "so.*, " + "so.*, "
...@@ -299,14 +310,17 @@ public class OrderServiceImpl implements OrderService { ...@@ -299,14 +310,17 @@ public class OrderServiceImpl implements OrderService {
+ "from tSalesOrder so where so.sSalesOrderID = ?", subOrderMap.get("sSalesOrderID")); + "from tSalesOrder so where so.sSalesOrderID = ?", subOrderMap.get("sSalesOrderID"));
String sql = "" String sql = ""
+ "select " + "select "
+ "sosd.*, LeftReturnQty = sosd.nSendQty - isnull(sosd.nReturnQty,0), " + "sosd.*, sosd.nSendQty - isnull(sosd.nReturnQty,0) LeftReturnQty, ag.nSaleUnits SaleMulti, ag.sSpec sSpec,"
+ "ag.sGoodTypeID GoodTypeID, "
+ "agp.sURL, " + "agp.sURL, "
+ "pm.sPromoTheme, " + "pm.sPromoTheme, "
+ "pm.sPromoActionType sPromoType, " + "pm.sPromoActionType sPromoType, "
+ "pm.sPromoActionTypeID sPromoTypeID " + "pm.sPromoActionTypeID sPromoTypeID "
+ "from tSalesOrderSubDtl sosd " + "from tSalesOrderSubDtl sosd "
+ "left join tYWPromoMain pm on pm.sPromoPaperNO = sosd.sPromoPaperNO " + "left join tYWPromoMain pm on pm.sPromoPaperNO = sosd.sPromoPaperNO "
+ "left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1 where sosd.sSubOrderID = ?"; + "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("SELECT sum(a.nNum) nTotalCount, sum(a.nPrice * a.nNum) nTotalAmount FROM tSalesOrderDeliverSubDtl a where a.sSubOrderID = ?", subOrderID); Map<String, Object> deliver = jdbcTemplate.queryForMap("SELECT sum(a.nNum) nTotalCount, sum(a.nPrice * a.nNum) nTotalAmount FROM tSalesOrderDeliverSubDtl a where a.sSubOrderID = ?", subOrderID);
String sql3 = "select sSubOrderID, nOrderMoney, sAocOrderID, sAocOrderNumber, nOrderNum, nPickupNum, sExpressNO, sExpressName from tSalesOrderDeliverSub where nTag&1 = 0 and sSubOrderID = ?"; String sql3 = "select sSubOrderID, nOrderMoney, sAocOrderID, sAocOrderNumber, nOrderNum, nPickupNum, sExpressNO, sExpressName from tSalesOrderDeliverSub where nTag&1 = 0 and 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