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

商品增加领域、营销类别查询条件及商品组列表价格显示自经销商对应等级价格

hu пре 3 година
родитељ
комит
216638faa4

+ 3 - 3
src/custom/restcontroller/sale/itemgroup/itemgroup.java

@@ -191,13 +191,13 @@ public class itemgroup extends Controller {
             HashMap<Long, ItemPrice> ItemPriceList = ItemPrice.getItemGroupPrice(this, sys_enterpriseid,
                     row2.getLong("sa_itemgroupid"));
             BigDecimal max = new BigDecimal(0);
-            BigDecimal min = ((ItemPrice) ItemPriceList.values().toArray()[0]).getMarketprice();
+            BigDecimal min = ((ItemPrice) ItemPriceList.values().toArray()[0]).getGraderateprice();
             for (ItemPrice itemPrice : ItemPriceList.values()) {
                 if (itemPrice.getMarketprice().compareTo(max) == 1) {
-                    max = itemPrice.getMarketprice();
+                    max = itemPrice.getGraderateprice();
                 }
                 if (itemPrice.getMarketprice().compareTo(min) == -1) {
-                    min = itemPrice.getMarketprice();
+                    min = itemPrice.getGraderateprice();
                 }
             }
             row2.put("maxprice", max);

+ 24 - 0
src/custom/restcontroller/webmanage/sale/item/Item.java

@@ -312,11 +312,35 @@ public class Item extends Controller {
                 where.append("t1.status ='").append(whereObject.getString("status")).append("' ");
                 where.append(")");
             }
+
+            if (whereObject.containsKey("itemclassids") && !whereObject.getJSONArray("itemclassids").isEmpty()) {
+                if ( whereObject.getJSONArray("itemclassids").size() > 0) {
+                    String sql = " and t1.itemid in ( SELECT itemid from sa_itemsaleclass WHERE itemclassid IN " +  whereObject.getJSONArray("itemclassids") + "  and siteid='" + siteid + "')";
+                    sql = sql.replace("[", "(").replace("]", ")");
+                    System.out.println(sql);
+                    where.append(sql);
+                }
+            }
+
+            if (whereObject.containsKey("tradefield") && !whereObject.getJSONArray("tradefield").isEmpty()) {
+                String where1 =" 1=1 ";
+                if ( whereObject.getJSONArray("tradefield").size() > 0) {
+                    for (Object object:whereObject.getJSONArray("tradefield")) {
+                        String str = String.valueOf(object);
+                        where1=where1 +" or tradefield ='"+str+"' ";
+                    }
+                }
+                where.append("and t1.itemid in (SELECT itemid from plm_item_tradefield WHERE ("+where1+") and siteid = '"+siteid+"')");
+            }
+
         }
 
+
+
         SQLFactory sqlFactory = new SQLFactory(this, "货品档案列表", pageSize, pageNumber, pageSorting);
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter_SQL("where", where);
+         System.out.println(sqlFactory.getSQL());
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         // 默认商品图片
         Rows defaultImageRows = getAttachmentUrl("system", (long) 1, "defaultImage");