+" acg.nSaleUnits SaleUnit, acg.nMarketPrice MarketPrice, sum(a.nSaleQty) SaleQty from tAgentGoodsDailyOnline a join tGoods g on a.nGoodsID = g.nGoodsID "
+" acg.nSaleUnits SaleUnit, acg.nMarketPrice MarketPrice, sum(a.nSaleQty) SaleQty from tAgentGoodsDailyOnline a join tGoods g on a.nGoodsID = g.nGoodsID "
+" join tAgentContractGoods acg on a.sAgentContractNO = acg.sAgentContractNO and a.nGoodsID = acg.nGoodsID ";
+" join tAgentContractGoods acg on a.sAgentContractNO = acg.sAgentContractNO and a.nGoodsID = acg.nGoodsID ";
sql+=" ,tUserOrg tu, tUserAgent ua where acg.sOrgNO = '"+orgNO+"' and acg.sOrgNO = tu.sOrgNO and tu.sUserNO = '"+userNO+"' and tu.nTag&1 = 0"
sql+=" ,tUserOrg tu, tUserAgent ua where acg.sOrgNO = '"+orgNO+"' and acg.sOrgNO = tu.sOrgNO and tu.sUserNO = '"+userNO+"' and tu.nTag&1 = 0"
+" and acg.nAgentID = ua.nAgentID and ua.sUserNO = '"+userNO+"' and ua.nTag&1 = 0 and a.dTradeDate >= '"+beginDate+"' and a.dTradeDate < '"+endDate+"' ";
+" and acg.nAgentID = ua.nAgentID and ua.sUserNO = '"+userNO+"' and ua.nTag&1 = 0 and a.dTradeDate >= '"+beginDate+"' and a.dTradeDate < '"+endDate+"' ";
}else{
}else{
sql+=" where acg.sOrgNO = '"+orgNO+"' and a.dTradeDate >= '"+beginDate+"' and a.dTradeDate < '"+endDate+"'";
sql+=" where acg.sOrgNO = '"+orgNO+"' and a.dTradeDate >= '"+beginDate+"' and a.dTradeDate < '"+endDate+"'";
}
}
sql+=" group by a.nGoodsID, g.sGoodsNO, g.sGoodsDesc, acg.nSalePrice, acg.sSpec, acg.sUnit, acg.nMinSaleQty, acg.nSaleUnits, acg.nMarketPrice, acg.sMarketUnit";
sql+=" group by a.nGoodsID, g.sGoodsNO, g.sGoodsDesc, acg.nSalePrice, acg.sSpec, acg.sUnit, acg.nMinSaleQty, acg.nSaleUnits, acg.nMarketPrice, acg.sMarketUnit";
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 = ?";
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 t.nGoodsID, t.sSubCode, t.nParentID, t.sSpecName, t.sSpec, isnull(ap.nRealSalePrice, og.nRealSalePrice) nRealSalePrice, og.nStockQty, og.nLockedQty from tGoodsSubCode t left join V_OrgGoods og on og.sOrgNO = ? and og.sAgentContractNO = ? and og.nGoodsID = t.nGoodsID left join tAgentCustTypePrice ap on ap.sCustTypeID = ? and ap.sAgentContractNO = og.sAgentContractNO and ap.nGoodsID = og.nGoodsID where t.nParentID = ? and t.nTag&1 = 0";
Stringsql="select t.nGoodsID, t.sSubCode, t.nParentID, t.sSpecName, t.sSpec, isnull(ap.nRealSalePrice, og.nRealSalePrice) nRealSalePrice, og.nStockQty, og.nLockedQty from tGoodsSubCode t left join V_OrgGoods og on og.sOrgNO = ? and og.sAgentContractNO = ? and og.nGoodsID = t.nGoodsID left join tAgentCustTypePrice ap on ap.sCustTypeID = ? and ap.sAgentContractNO = og.sAgentContractNO and ap.nGoodsID = og.nGoodsID where t.nParentID = ? and t.nTag&1 = 0";
StringpromoSql="select pm.* from tYWPromoMain pm, tYWPromoDtl pd, tPromoCustBWList bw where pm.sPromoPaperNO = bw.sPromoPaperNO and bw.sShopNO = ? and pm.sPromoActionTypeID != '3' and pm.sOrgNO = ? and pm.sPromoPaperNO = pd.sPromoPaperNO and pm.nTag&3 = 2 and (pd.sAgentContractNO = ?) and (pd.nGoodsID = ?)";
StringpromoSql="select pm.* from tYWPromoMain pm, tYWPromoDtl pd, tPromoCustBWList bw where pm.sPromoPaperNO = bw.sPromoPaperNO and bw.sShopNO = ? and pm.sPromoActionTypeID != '3' and pm.sOrgNO = ? and pm.sPromoPaperNO = pd.sPromoPaperNO and pm.nTag&3 = 2 and (pd.sAgentContractNO = ?) and (pd.nGoodsID = ?)";
Stringsql1="select agp.sURL, agp.nLength, agp.sPicTypeID from tAgentGoodsPic agp, tAgentContractGoods acg where agp.nAgentID = acg.nAgentID and agp.nGoodsID = acg.nGoodsID and acg.sAgentContractNO = ? and acg.nGoodsID = ? and agp.nTag&1 = 0 order by agp.nIdx";
Stringsql1="select agp.sURL, agp.nLength, agp.sPicTypeID from tAgentGoodsPic agp, tAgentContractGoods acg where agp.nAgentID = acg.nAgentID and agp.nGoodsID = acg.nGoodsID and acg.sAgentContractNO = ? and acg.nGoodsID = ? and agp.nTag&1 = 0 order by agp.nIdx";
args.add("(t.sAgentContractNO = '"+kv[0]+"' and t.nGoodsID = "+kv[1]+")");
args.add("(t.sAgentContractNO = '"+kv[0]+"' and t.nGoodsID = "+kv[1]+")");
}
}
StringsCustTypeID="99999999999999";
StringsCustTypeID="99999999999999";
try{
try{
sCustTypeID=jdbcTemplate.queryForString("select c.sCustTypeID from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ?",shopNo);
sCustTypeID=jdbcTemplate.queryForString("select c.sCustTypeID from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ?",shopNo);
}catch(Exceptione){
}catch(Exceptione){
//shopNo为空,没有登陆
//shopNo为空,没有登陆
}
}
Stringsql="select t.sAgentContractNO, t.nGoodsID, t.nStockQty, t.nDefaultPrice, isnull(ap.nRealSalePrice, t.nRealSalePrice) nRealSalePrice from V_OrgGoods t left join tAgentCustTypePrice ap on ap.sCustTypeID = '"+sCustTypeID+"' and t.sAgentContractNO = ap.sAgentContractNO and t.nGoodsID = ap.nGoodsID where t.sOrgNO = '"+orgNo+"' "+StringUtil.join(" OR "," and (",")"," and (1 = 0) ",args);
Stringsql="select t.sAgentContractNO, t.nGoodsID, t.nStockQty, t.nRealStockQty, t.nDefaultPrice, isnull(ap.nRealSalePrice, t.nRealSalePrice) nRealSalePrice from V_OrgGoods t left join tAgentCustTypePrice ap on ap.sCustTypeID = '"+sCustTypeID+"' and t.sAgentContractNO = ap.sAgentContractNO and t.nGoodsID = ap.nGoodsID where t.sOrgNO = '"+orgNo+"' "+StringUtil.join(" OR "," and (",")"," and (1 = 0) ",args);
Stringsql1="select t.sAgentContractNO, t.nGoodsID, p.sPromoTheme, p.sPromoName, p.sPromoPaperNO, p.sPromoActionTypeID, t.sGroupNO sPromoGroupNO from tYWPromoDtl t, tYWPromoMain p where p.sPromoActionTypeID != '3' and t.sPromoPaperNO = p.sPromoPaperNO and p.nTag&3 = 2 and p.sOrgNO = '"+orgNo+"' "+StringUtil.join(" OR "," and (",")"," and (1 = 0) ",args)+" group by t.sAgentContractNO, t.nGoodsID, p.sPromoTheme, p.sPromoName, p.sPromoPaperNO, p.sPromoActionTypeID, t.sGroupNO";
Stringsql1="select t.sAgentContractNO, t.nGoodsID, p.sPromoTheme, p.sPromoName, p.sPromoPaperNO, p.sPromoActionTypeID, t.sGroupNO sPromoGroupNO from tYWPromoDtl t, tYWPromoMain p where p.sPromoActionTypeID != '3' and t.sPromoPaperNO = p.sPromoPaperNO and p.nTag&3 = 2 and p.sOrgNO = '"+orgNo+"' "+StringUtil.join(" OR "," and (",")"," and (1 = 0) ",args)+" group by t.sAgentContractNO, t.nGoodsID, p.sPromoTheme, p.sPromoName, p.sPromoPaperNO, p.sPromoActionTypeID, t.sGroupNO";