hu 7 ماه پیش
والد
کامیت
4f0bd74840

+ 31 - 15
src/custom/restcontroller/webmanage/sale/item/Item.java

@@ -235,8 +235,24 @@ public class Item extends Controller {
         sqlFactory.addParameter("outplace", content.getStringValue("outplace"));
         sqlFactory.addParameter("repairattribute", content.getStringValue("repairattribute"));
         sqlFactory.addParameter("shapesize", content.getStringValue("shapesize"));
-        sqlFactory.addParameter("topclassnum", content.getStringValue("topclassnum"));
 
+        String topclassnum="";
+        if (content.containsKey("itemclassids")) {
+            JSONArray itemclassids = content.getJSONArray("itemclassids");
+                for (Object obj : itemclassids) {
+                    JSONObject itemclass = (JSONObject) obj;
+                    if(itemclass.getStringValue("classtype").equals("存货")){
+                        SQLFactory sqlFactory1 = new SQLFactory(this, "获取最上级营销类别名称");
+                        sqlFactory1.addParameter_in("itemclassid", itemclass.getLongValue("itemclassid"));
+                        sqlFactory1.addParameter("siteid", siteid);
+                        Rows rows = dbConnect.runSqlQuery(sqlFactory1.getSQL());
+                        if (rows.isNotEmpty()) {
+                            topclassnum=rows.get(0).getString("itemclassname");
+                        }
+                    }
+                }
+            }
+        sqlFactory.addParameter("topclassnum", topclassnum);
 
         sqlList.add(sqlFactory.getSQL());
         // 货品档案扩展属性字段表
@@ -326,8 +342,8 @@ public class Item extends Controller {
                     sqlFactory.addParameter("itemid", itemid);
                     sqlFactory.addParameter("itemno", itemno);
                     sqlFactory.addParameter("classtype", itemclass.getStringValue("classtype"));
-
                     sqlFactory.addParameter("itemclassid", itemclass.getLongValue("itemclassid"));
+
                     sqlList.add(sqlFactory.getSQL());
                 }
             }
@@ -651,8 +667,8 @@ public class Item extends Controller {
         querySQL.addQueryFields("price4", "t12.price ");
         querySQL.addJoinTable(JOINTYPE.left, "sa_itemprice", "t13", "t13.itemid = t1.itemid AND t13.siteid = t1.siteid and t13.pricegrade=5");
         querySQL.addQueryFields("price5", "t13.price ");
-        querySQL.addJoinTable(JOINTYPE.left, "plm_itemclass", "t14", "t14.itemclassid = t1.marketingcategory AND t14.siteid = t1.siteid",
-                "itemclassname");
+//        querySQL.addJoinTable(JOINTYPE.left, "plm_itemclass", "t14", "t14.itemclassid = t1.marketingcategory AND t14.siteid = t1.siteid",
+//                "itemclassname");
         querySQL.addJoinTable(JOINTYPE.left, "sys_department", "t16", "t16.departmentid = t1.departmentid AND t16.siteid = t1.siteid",
                 "depno","depname");
         querySQL.addJoinTable(JOINTYPE.left, "st_stock", "t17", "t17.stockno = t1.stockno AND t17.siteid = t1.siteid",
@@ -836,17 +852,17 @@ public class Item extends Controller {
 
             }
 
-            if (itemclassRowsMap.containsKey(String.valueOf(id))) {
-                if (itemclassRowsMap.get(String.valueOf(id)).isNotEmpty()) {
-                    SQLFactory sqlFactory1 = new SQLFactory(this, "获取最上级营销类别名称");
-                    sqlFactory1.addParameter_in("itemclassid", itemclassRowsMap.get(String.valueOf(id)).get(0).getLong("itemclassid"));
-                    sqlFactory1.addParameter("siteid", siteid);
-                    Rows rows = dbConnect.runSqlQuery(sqlFactory1.getSQL());
-                    if (rows.isNotEmpty()) {
-                        sqlList.add("update plm_item set marketingcategory='" + rows.get(0).getString("itemclassid") + "' where siteid='" + siteid + "' and itemid=" + id);
-                    }
-                }
-            }
+//            if (itemclassRowsMap.containsKey(String.valueOf(id))) {
+//                if (itemclassRowsMap.get(String.valueOf(id)).isNotEmpty()) {
+//                    SQLFactory sqlFactory1 = new SQLFactory(this, "获取最上级营销类别名称");
+//                    sqlFactory1.addParameter_in("itemclassid", itemclassRowsMap.get(String.valueOf(id)).get(0).getLong("itemclassid"));
+//                    sqlFactory1.addParameter("siteid", siteid);
+//                    Rows rows = dbConnect.runSqlQuery(sqlFactory1.getSQL());
+//                    if (rows.isNotEmpty()) {
+//                        sqlList.add("update plm_item set marketingcategory='" + rows.get(0).getString("itemclassid") + "' where siteid='" + siteid + "' and itemid=" + id);
+//                    }
+//                }
+//            }
 
 
             if (status.equals("0")) {

+ 5 - 0
src/custom/restcontroller/webmanage/sale/itempriceadjust/Itempriceadjust.java

@@ -130,6 +130,11 @@ public class Itempriceadjust extends Controller {
     @CACHEING_CLEAN(apiversions = {R.ID20221024163504.v1.class})
     public String audit() throws YosException {
         Long sa_itempriceadjustid = content.getLong("sa_itempriceadjustid");
+        Rows itempriceadjustItemsRows = dbConnect.runSqlQuery("select t1.sa_itempriceadjustid from sa_itempriceadjust_items t1 where t1.sa_itempriceadjustid ='" + sa_itempriceadjustid + "' and  t1.siteid='" + siteid + "'");
+        if (itempriceadjustItemsRows.isEmpty()) {
+            return getErrReturnObject().setErrMsg("商品价格调整单表体为空,无法审核").toString();
+        }
+
         ArrayList<String> sqlList = new ArrayList<>();
 
         SQLFactory sqlFactory = new SQLFactory(this, "商品调价单商品价格列表查询");