Преглед изворни кода

发货单查询报错修复

hu пре 2 година
родитељ
комит
5f2f2baf4b
1 измењених фајлова са 9 додато и 3 уклоњено
  1. 9 3
      src/custom/restcontroller/webmanage/sale/dispatch/dispatch.java

+ 9 - 3
src/custom/restcontroller/webmanage/sale/dispatch/dispatch.java

@@ -215,9 +215,15 @@ public class dispatch extends Controller {
             if (whereObject.containsKey("param") && !"".equals(whereObject.getString("param"))) {
                Rows rowsDispatchid = dbConnect.runSqlQuery("select t1.sa_dispatchid from sa_dispatch_items t1 left join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid " +
                        "left join sa_order t3 on t2.sa_orderid=t3.sa_orderid and t2.siteid=t3.siteid left join plm_item t4 on t1.itemid=t4.itemid and t1.siteid=t4.siteid where t1.siteid='"+siteid+"' and (t4.itemno like '%"+whereObject.getString("param")+"%' or t3.sonum='"+whereObject.getString("param")+"')");
-                String str = rowsDispatchid.toJsonArray("sa_dispatchid").toJSONString();
-                str = str.replace("[", "(").replace("]", ")");
-                where.append(" and t1.sa_dispatchid  in" ).append(str);
+
+               if(rowsDispatchid.toJsonArray("sa_dispatchid").isEmpty()){
+                   where.append(" and t1.sa_dispatchid in (0)");
+               }else {
+                   String str = rowsDispatchid.toJsonArray("sa_dispatchid").toJSONString();
+                   str = str.replace("[", "(").replace("]", ")");
+                   where.append(" and t1.sa_dispatchid  in" ).append(str);
+               }
+
 
             }
         }