+" PlanReturnDays = (select datediff(dd, dEndDate, dReturnDate) from tZHCProject p where p.nProjectID = a.nProjectID), LastUpdateTime = a.dLastUpdateTime ,SaleCount = 0 "
...
...
@@ -73,9 +79,9 @@ public class ActivityServiceImpl implements ActivityService {
+" WHERE a.nProjectID = ? ";
Stringsql0="select so.nPlanID, sum(so.nTotalSaleQty) nSaleQty from tSalesOrder so, tZHCPlan p where so.sB2BOrderTypeID = '3' and so.nPlanID = p.nPlanID and p.nProjectID = "+projectId+" group by so.nPlanID";
level=jdbcTemplate.queryForInt("select GoodsCategoryLevel = isnull((select Convert(int,sValue1) from tSystemCtrl where sCode = 'GoodsCategoryLevel'),0)");
}
Stringthree="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and nCategoryLevel = ? and nTag&1 = 0 order by nSort desc";
Stringthree="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and sUpCategoryNO = ? and nTag&1 = 0 order by nSort desc";
level=readJdbcTemplate.queryForInt("select GoodsCategoryLevel = isnull((select Convert(int,sValue1) from tSystemCtrl where sCode = 'GoodsCategoryLevel'),0)");
}
Stringthree="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and nCategoryLevel = ? and nTag&1 = 0 order by nSort desc";
Stringthree="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and sUpCategoryNO = ? and nTag&1 = 0 order by nSort desc";
@@ -255,14 +261,14 @@ public class OrderServiceImpl implements OrderService {
" from tSalesOrderSubDtl sosd left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1" +
" where sosd.sSalesOrderID in("+StringUtil.join("', '", "'", "'", orderIds) +")";*/
Stringsql4="select sosd.*,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("', '","'","'",subIds)+")";
+" 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, "
+"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 "
+"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);
+"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 "
+"from tSalesOrder so where so.sSalesOrderID = ?",subOrderMap.get("sSalesOrderID"));
...
...
@@ -513,12 +519,12 @@ public class OrderServiceImpl implements OrderService {
" left join tAgentContractGoods ag on sosd.sAgentContractNO = ag.sAgentContractNO and sosd.nGoodsID = ag.nGoodsID \r\n"+
@@ -526,7 +532,7 @@ public class OrderServiceImpl implements OrderService {
StringsqlPay="select sPayTypeID, sPayType, nPayAmount, sOutTradeNO, sTransTraceNO, dPayDateTime, sStatusID = case when nTag&2=2 then '1' else '0' end, sStatus = case when nTag&2=2 then '已付款' else '未付款' end "
+"from tSalesOrderPay "
+"where sSalesOrderID = ? and sOutTradeNO not like '%_D' ";
@@ -557,16 +563,16 @@ public class OrderServiceImpl implements OrderService {
StringstockSql="select og.sWarehouseNO, og.sAgentContractNO, og.nGoodsID, og.nStockQty, og.nLockedQty from tPromoRuleGoods prg, V_OrgGoods og where prg.sAgentContractNO = og.sAgentContractNO and prg.nGoodsID = og.nGoodsID and og.sOrgNO = ? and prg.sPromoPaperNO = ? and prg.sPromoGroupNO = ?";
@@ -865,9 +871,9 @@ public class OrderServiceImpl implements OrderService {
jdbcTemplate.save(dtl);
{
LongnProjectID=jdbcTemplate.queryForLong("select nProjectID from tZHCPlan where nPlanID = ?",planId);
LongnProjectID=readJdbcTemplate.queryForLong("select nProjectID from tZHCPlan where nPlanID = ?",planId);
Stringsql="select count(so.sSalesOrderID) nSalePaperQty, isnull(sum(so.nTotalSaleQty), 0) nSaleQty, isnull(sum(so.nTotalSaleAmount), 0) nSaleAmount from tSalesOrder so, tZHCPlan p where so.sB2BOrderTypeID = '3' and so.nTag&1 = 0 and so.nPlanID = p.nPlanID and p.nProjectID = ?";
Map<String,Object>addrMap=jdbcTemplate.queryForMap("select * from tCustAddress where sAddrID = ?",addrId);
Map<String,Object>addrMap=readJdbcTemplate.queryForMap("select * from tCustAddress where sAddrID = ?",addrId);
List<String>address=newArrayList<String>();
address.add((String)addrMap.get("sProvince"));
address.add((String)addrMap.get("sCity"));
...
...
@@ -911,7 +917,7 @@ public class OrderServiceImpl implements OrderService {
StringsContacts=(String)addrMap.get("sContacts");
StringgSql="select t.*, ap.nRealSalePrice nApSalePrice from V_OrgGoods t left join tAgentCustTypePrice ap on ap.sCustTypeID = ? and ap.sAgentContractNO = t.sAgentContractNO and ap.nGoodsID = t.nGoodsID where t.sOrgNO = ? and t.sAgentContractNO = ? and t.nGoodsID = ?";
Stringsql="select c.*, m.sMobile sSalesmanMobile from tCustomer c left join tSalesman m on m.sSalesmanNO = c.sSalesmanNO1, tB2BUser u where c.sCustNO = u.sCustNO and u.sOpenID = ? and c.nTag&1 = 0 and u.nTag&1 = 0";
List<Map<String,Object>>shopList=jdbcTemplate.queryForList("select s.*, m.sSalesmanName, m.sMobile sSalesmanMobile from tShop s left join tSalesman m on m.sSalesmanNO = s.sSalesmanNO1 where s.sCustNO = ? and s.sOrgNO = ? and s.nTag&1 = 0",custNo,orgNo);
List<Map<String,Object>>shopList=readJdbcTemplate.queryForList("select s.*, m.sSalesmanName, m.sMobile sSalesmanMobile from tShop s left join tSalesman m on m.sSalesmanNO = s.sSalesmanNO1 where s.sCustNO = ? and s.sOrgNO = ? and s.nTag&1 = 0",custNo,orgNo);
returnshopList;
}
...
...
@@ -763,7 +763,7 @@ public class UserServiceImpl implements UserService {
},keyHolder);
Objectkey=keyHolder.getKey();
jdbcTemplate.update("update tShop set sShopNO = RIGHT('00000000'+ CAST(nShopID as varchar(8)), 8) where nShopID = ?",key);
StringsShopNO=jdbcTemplate.queryForString("select sShopNO from tShop where nShopID = ?",key);
StringsShopNO=readJdbcTemplate.queryForString("select sShopNO from tShop where nShopID = ?",key);
map.put("sShopNO",sShopNO);
returnmap;
}
...
...
@@ -838,13 +838,13 @@ public class UserServiceImpl implements UserService {
+"left join tOrg o on o.sOrgNO = s.sOrgNO "
+"where "
+"sm.sSalesmanNO = s.sSalesmanNO1 and s.sShopNO = ?";