Просмотр исходного кода

查询erp库存 有查询条件时查询全部商品

hu 2 лет назад
Родитель
Сommit
3905ad7d3a

+ 16 - 0
src/custom/restcontroller/webmanage/sale/invbal/SQL/商品列表.sql

@@ -0,0 +1,16 @@
+SELECT t2.itemno,
+       t2.itemid,
+       t2.itemname,
+       t2.isonsale,
+       t4.unitname,
+       t2.packageqty
+FROM plm_item t2
+         left join plm_unit t4 on t2.unitid=t4.unitid and t2.siteid=t4.siteid
+	where t2.siteid = $siteid$
+	and ($where$)
+	group by t2.itemno,
+       t2.itemid,
+       t2.itemname,
+       t2.isonsale,
+       t4.unitname,
+       t2.packageqty

+ 4 - 1
src/custom/restcontroller/webmanage/sale/invbal/invbal.java

@@ -119,14 +119,18 @@ public class invbal extends Controller {
 		boolean all = content.getBooleanValue("all");
 		JSONArray itemclassids = content.getJSONArray("itemclassids");
 		String where ="1=2";
+		SQLFactory sqlFactory =new SQLFactory(this,"订单明细未发商品列表", pageSize, pageNumber, pageSorting);
 		if(!StringUtils.isBlank(itemno)){
+			sqlFactory=new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
 			where=where+" or t2.itemno like '%"+itemno+"%'";
 		}
 		if(!StringUtils.isBlank(itemname)){
+			sqlFactory=new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
 			where=where+" or t2.itemname like '%"+itemname+"%' ";
 		}
 
 		if (itemclassids.size() > 0) {
+			sqlFactory=new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
 			ArrayList<Long> itemclassList = new ArrayList<Long>();
 			for (Object object : itemclassids) {
 				//System.out.println(row.getLong("itemclassid"));
@@ -143,7 +147,6 @@ public class invbal extends Controller {
 			where=where+" or 1=1 ";
 		}
 
-		SQLFactory sqlFactory =new SQLFactory(this,"订单明细未发商品列表", pageSize, pageNumber, pageSorting);
 		sqlFactory.addParameter("siteid", siteid);
 		sqlFactory.addParameter_SQL("where", where);