|
|
@@ -116,69 +116,53 @@ public class invbal extends Controller {
|
|
|
@API(title = "查询Erp库存列表", apiversion = R.ID20230408091703.v1.class)
|
|
|
public String queryErpInvbalList() throws YosException, IOException {
|
|
|
boolean isExport = content.getBooleanValue("isExport");
|
|
|
- String iteminfo = content.getStringValue("iteminfo");
|
|
|
- String agentinfo = content.getStringValue("agentinfo");
|
|
|
- boolean all = content.getBooleanValue("all");
|
|
|
- JSONArray itemclassids = content.getJSONArray("itemclassids");
|
|
|
- String where ="1=2";
|
|
|
+ //String iteminfo = content.getStringValue("iteminfo");
|
|
|
+ //String agentinfo = content.getStringValue("agentinfo");
|
|
|
+ //boolean all = content.getBooleanValue("all");
|
|
|
+ //JSONArray itemclassids = content.getJSONArray("itemclassids");
|
|
|
+ String where =" 1=1 ";
|
|
|
SQLFactory sqlFactory =new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
|
|
|
if (isExport) {
|
|
|
sqlFactory = new SQLFactory(this,"商品列表");
|
|
|
}
|
|
|
- if(!StringUtils.isBlank(iteminfo)){
|
|
|
- sqlFactory=new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
|
|
|
- if (isExport) {
|
|
|
- sqlFactory = new SQLFactory(this,"商品列表");
|
|
|
- }
|
|
|
- where=where+" or t2.itemno like '%"+iteminfo+"%' or t2.itemname like '%"+iteminfo+"%' ";
|
|
|
- }
|
|
|
-// if(!StringUtils.isBlank(itemname)){
|
|
|
-// sqlFactory=new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
|
|
|
-// if (isExport) {
|
|
|
-// sqlFactory = new SQLFactory(this,"商品列表");
|
|
|
-// }
|
|
|
-// where=where+" or t2.itemname like '%"+itemname+"%' ";
|
|
|
-// }
|
|
|
- if (itemclassids.size() > 0) {
|
|
|
- sqlFactory=new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
|
|
|
- if (isExport) {
|
|
|
- sqlFactory = new SQLFactory(this,"商品列表");
|
|
|
- }
|
|
|
- ArrayList<Long> itemclassList = new ArrayList<Long>();
|
|
|
- for (Object object : itemclassids) {
|
|
|
- //System.out.println(row.getLong("itemclassid"));
|
|
|
-
|
|
|
- long itemclassid = Long.valueOf(String.valueOf(object));
|
|
|
- itemclassList.add(itemclassid);
|
|
|
- itemclassList.addAll(ItemClass.getSubItemClassIds(this,itemclassid));
|
|
|
- }
|
|
|
- String sql = " or t2.itemid in ( SELECT itemid from sa_itemsaleclass WHERE itemclassid IN " + itemclassList + " and siteid='" + siteid + "')";
|
|
|
- sql = sql.replace("[", "(").replace("]", ")");
|
|
|
- where=where+sql;
|
|
|
- }
|
|
|
- if(all){
|
|
|
- where=where+" or 1=1 ";
|
|
|
- }
|
|
|
if (content.containsKey("where")) {
|
|
|
JSONObject whereObject = content.getJSONObject("where");
|
|
|
- if (whereObject.containsKey("isonsale") && !"".equals(whereObject.getString("isonsale"))) {
|
|
|
- where = where+" or t2.isonsale ='"+whereObject.getString("isonsale") + "' ";
|
|
|
+ if(!StringUtils.isBlank(whereObject.getStringValue("iteminfo"))){
|
|
|
+ where=where+" and (t2.itemno like '%"+whereObject.getStringValue("iteminfo")+"%' or t2.itemname like '%"+whereObject.getStringValue("iteminfo")+"%') ";
|
|
|
}
|
|
|
- }
|
|
|
+ if (whereObject.getJSONArray("itemclassids").size() > 0) {
|
|
|
+ ArrayList<Long> itemclassList = new ArrayList<Long>();
|
|
|
+ for (Object object : whereObject.getJSONArray("itemclassids")) {
|
|
|
+ //System.out.println(row.getLong("itemclassid"));
|
|
|
|
|
|
- if(!StringUtils.isBlank(agentinfo)){
|
|
|
- sqlFactory =new SQLFactory(this,"订单明细未发商品列表", pageSize, pageNumber, pageSorting);
|
|
|
- if (isExport) {
|
|
|
- sqlFactory = new SQLFactory(this,"订单明细未发商品列表");
|
|
|
+ long itemclassid = Long.valueOf(String.valueOf(object));
|
|
|
+ itemclassList.add(itemclassid);
|
|
|
+ itemclassList.addAll(ItemClass.getSubItemClassIds(this,itemclassid));
|
|
|
+ }
|
|
|
+ String sql = " and t2.itemid in ( SELECT itemid from sa_itemsaleclass WHERE itemclassid IN " + itemclassList + " and siteid='" + siteid + "')";
|
|
|
+ sql = sql.replace("[", "(").replace("]", ")");
|
|
|
+ where=where+sql;
|
|
|
}
|
|
|
- //System.out.println(StringUtils.isBlank(itemname) && StringUtils.isBlank(itemno) && itemclassids.size()==0);
|
|
|
- if(StringUtils.isBlank(iteminfo) && StringUtils.isBlank(iteminfo) && itemclassids.size()==0){
|
|
|
- where=where+" or 1=1 and (t6.agentnum like '%"+agentinfo+"%' or t5.enterprisename like '%"+agentinfo+"%') ";
|
|
|
- }else {
|
|
|
- where=where+" and (t6.agentnum like '%"+agentinfo+"%' or t5.enterprisename like '%"+agentinfo+"%') ";
|
|
|
+ if (whereObject.containsKey("all") && !"".equals(whereObject.getString("all"))) {
|
|
|
+ if(!whereObject.getBooleanValue("all")){
|
|
|
+ where = where+" and 1=2 ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("isonsale") && !"".equals(whereObject.getString("isonsale"))) {
|
|
|
+ where = where+" and t2.isonsale ='"+whereObject.getString("isonsale") + "' ";
|
|
|
+ }
|
|
|
+ if(!StringUtils.isBlank(whereObject.getStringValue("agentinfo"))){
|
|
|
+ sqlFactory =new SQLFactory(this,"订单明细未发商品列表", pageSize, pageNumber, pageSorting);
|
|
|
+ if (isExport) {
|
|
|
+ sqlFactory = new SQLFactory(this,"订单明细未发商品列表");
|
|
|
+ }
|
|
|
+ //System.out.println(StringUtils.isBlank(itemname) && StringUtils.isBlank(itemno) && itemclassids.size()==0);
|
|
|
+ if(!StringUtils.isBlank(whereObject.getStringValue("agentinfo"))){
|
|
|
+ where=where+" and (t6.agentnum like '%"+whereObject.getStringValue("agentinfo")+"%' or t5.enterprisename like '%"+whereObject.getStringValue("agentinfo")+"%') ";
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
//System.out.println(sqlFactory.getSQL());
|
|
|
@@ -195,9 +179,13 @@ public class invbal extends Controller {
|
|
|
sqlFactory1.addParameter_SQL("where", where);
|
|
|
Rows sumQtyRows = dbConnect.runSqlQuery(sqlFactory1);
|
|
|
RowsMap sumAllQtyRowsMap= sumQtyRows.toRowsMap("itemno");
|
|
|
- if(!StringUtils.isBlank(agentinfo)){
|
|
|
- where=where+" and (t6.agentnum like '%"+agentinfo+"%' or t5.enterprisename like '%"+agentinfo+"%') ";
|
|
|
+ if (content.containsKey("where")) {
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
+ if(!StringUtils.isBlank(whereObject.getStringValue("agentinfo"))){
|
|
|
+ where=where+" and (t6.agentnum like '%"+whereObject.getStringValue("agentinfo")+"%' or t5.enterprisename like '%"+whereObject.getStringValue("agentinfo")+"%') ";
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
sqlFactory1.addParameter_SQL("where", where);
|
|
|
sumQtyRows = dbConnect.runSqlQuery(sqlFactory1);
|
|
|
RowsMap sumQtyRowsMap= sumQtyRows.toRowsMap("itemno");
|
|
|
@@ -208,9 +196,13 @@ public class invbal extends Controller {
|
|
|
sqlFactory2.addParameter_SQL("where", where);
|
|
|
Rows sumUnQtyRows = dbConnect.runSqlQuery(sqlFactory2);
|
|
|
RowsMap sumUnAllQtyRowsMap= sumUnQtyRows.toRowsMap("itemno");
|
|
|
- if(!StringUtils.isBlank(agentinfo)){
|
|
|
- where=where+" and (t6.agentnum like '%"+agentinfo+"%' or t5.enterprisename like '%"+agentinfo+"%') ";
|
|
|
+ if (content.containsKey("where")) {
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
+ if(!StringUtils.isBlank(whereObject.getStringValue("agentinfo"))){
|
|
|
+ where=where+" and (t6.agentnum like '%"+whereObject.getStringValue("agentinfo")+"%' or t5.enterprisename like '%"+whereObject.getStringValue("agentinfo")+"%') ";
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
sqlFactory2.addParameter_SQL("where", where);
|
|
|
sumUnQtyRows = dbConnect.runSqlQuery(sqlFactory2);
|
|
|
RowsMap sumUnQtyRowsMap= sumUnQtyRows.toRowsMap("itemno");
|