Browse Source

未发库存添加经销商查询

hu 2 năm trước cách đây
mục cha
commit
0ab6893ec2

+ 2 - 0
src/custom/restcontroller/webmanage/sale/invbal/SQL/订单明细未发商品列表.sql

@@ -8,6 +8,8 @@ FROM sa_orderitems t1
          inner join plm_item t2 on t1.siteid = t2.siteid and t1.itemid = t2.itemid
          inner join sa_order t3 on t1.siteid=t3.siteid and t1.sa_orderid=t3.sa_orderid
          left join plm_unit t4 on t2.unitid=t4.unitid and t2.siteid=t4.siteid
+        LEFT JOIN sys_enterprise t5 ON t5.sys_enterpriseid = t3.sys_enterpriseid and t5.siteid = t3.siteid
+         left join sa_agents t6 on t6.sys_enterpriseid=t3.sys_enterpriseid and t6.siteid = t3.siteid
 WHERE t3.STATUS in ('提交','审核')
   and ifnull(t1.undeliqty, 0) !=0
 	AND t1.siteid = $siteid$

+ 9 - 6
src/custom/restcontroller/webmanage/sale/invbal/invbal.java

@@ -114,8 +114,9 @@ public class invbal extends Controller {
 
 	@API(title = "查询Erp库存列表", apiversion = R.ID20230408091703.v1.class)
 	public String queryErpInvbalList() throws YosException {
-		String itemno = content.getString("itemno");
-		String itemname = content.getString("itemname");
+		String itemno = content.getStringValue("itemno");
+		String itemname = content.getStringValue("itemname");
+		String agentinfo = content.getStringValue("agentinfo");
 		boolean all = content.getBooleanValue("all");
 		JSONArray itemclassids = content.getJSONArray("itemclassids");
 		String where ="1=2";
@@ -128,7 +129,6 @@ public class invbal extends Controller {
 			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>();
@@ -146,10 +146,14 @@ public class invbal extends Controller {
 		if(all){
 			where=where+" or 1=1 ";
 		}
-
+		if(!StringUtils.isBlank(agentinfo)){
+			sqlFactory =new SQLFactory(this,"订单明细未发商品列表", pageSize, pageNumber, pageSorting);
+			where ="1=2";
+			where=where+" or t6.agentnum like '%"+agentinfo+"%' or t5.enterprisename like '%"+agentinfo+"%' ";
+		}
 		sqlFactory.addParameter("siteid", siteid);
 		sqlFactory.addParameter_SQL("where", where);
-
+		 System.out.println(sqlFactory.getSQL());
 		Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
 		Rows rowsitemclass = dbConnect.runSqlQuery(" select  t7.itemclassname,t6.itemid,t8.brandname from sa_itemsaleclass t6 LEFT JOIN plm_itemclass t7 ON t7.itemclassid = t6.itemclassid AND t7.siteid = t6.siteid LEFT JOIN sa_brand t8 ON t8.sa_brandid = t7.sa_brandid AND t8.siteid = t7.siteid where t6.siteid='" + siteid + "'");
 		RowsMap itemclassRowsMap = rowsitemclass.toRowsMap("itemid");
@@ -188,7 +192,6 @@ public class invbal extends Controller {
 		}
 		for (Row row:rows) {
 			String itemclass=itemclassRowsMap.get(row.getString("itemid")).toJsonArray("itemclassname").toString().substring(1,itemclassRowsMap.get(row.getString("itemid")).toJsonArray("itemclassname").toString().length()-1);
-			System.out.println(itemclass.replaceAll("\"", ""));
 			row.put("itemclass", itemclass.replaceAll("\"", ""));
 			if(sumQtyRowsMap.get(row.getString("itemno")).isNotEmpty()){
 				row.put("unsoldqty", sumQtyRowsMap.get(row.getString("itemno")).get(0).getBigDecimal("qty"));