Kaynağa Gözat

新增商品字段

wu 7 ay önce
ebeveyn
işleme
d25b14bb84

+ 8 - 61
src/custom/restcontroller/webmanage/sale/item/Item.java

@@ -47,14 +47,10 @@ public class Item extends Controller {
         Long itemid = content.getLong("itemid");
         String itemno = content.getString("itemno").trim();
         boolean isauxunit = content.getBoolean("isauxunit");
-        String erpitemno = content.getStringValue("erpitemno");
         String itemname = content.getString("itemname");
         Long plm_itemextendid = content.getLongValue("plm_itemextendid");
         Rows rows = dbConnect.runSqlQuery("SELECT * from plm_item WHERE (itemtype='成品' or isshow=1 ) and itemno='" + itemno + "' and siteid='" + siteid + "'");
 
-//        if (rows.isNotEmpty() && rows.get(0).getString("status").equals("审核")) {
-//            return getErrReturnObject().setErrMsg("当前料号存在审核通过的成品或商品").toString();
-//        }
         if (rows.isNotEmpty()) {
             long tempitemid = rows.get(0).getLong("itemid");
             if (itemid > 0 && itemid != tempitemid) {
@@ -75,9 +71,6 @@ public class Item extends Controller {
             if (dbConnect.runSqlQuery("SELECT 1 from plm_item  WHERE itemno='" + itemno + "' and siteid='" + siteid + "' and (itemtype='成品' or isshow=1 )").isNotEmpty()) {
                 return getErrReturnObject().setErrMsg("商品编号已存在").toString();
             }
-//            if (dbConnect.runSqlQuery("SELECT 1 from plm_itemextend  WHERE erpitemno='" + erpitemno + "' and siteid='" + siteid + "'").isNotEmpty()) {
-//                return getErrReturnObject().setErrMsg("erp品号已存在").toString();
-//            }
             itemid = createTableID("plm_item");
             sqlList.add(DataContrlLog.createLog(this, "plm_item", itemid, "新增", "新建商品:" + itemname).getSQL());
         } else {
@@ -189,56 +182,13 @@ public class Item extends Controller {
         sqlFactory.addParameter("prodline", content.getStringValue("prodline"));
         sqlFactory.addParameter("device", content.getStringValue("device"));
         sqlFactory.addParameter("categories", content.getStringValue("categories"));
+        sqlFactory.addParameter("goodstype", content.getStringValue("goodstype"));
+        sqlFactory.addParameter("explains", content.getStringValue("explains"));
+        sqlFactory.addParameter("assistance", content.getStringValue("assistance"));
 
 
         sqlList.add(sqlFactory.getSQL());
 
-        // 添加领域
-        if (content.containsKey("tradefields")) {
-            JSONArray tradefields = content.getJSONArray("tradefields");
-            for (Object obj : tradefields) {
-                String tradefield = (String) obj;
-                sqlFactory = new SQLFactory(this, "新增领域");
-                sqlFactory.addParameter("siteid", siteid);
-                sqlFactory.addParameter("plm_item_tradefieldid", createTableID("plm_item_tradefield"));
-                sqlFactory.addParameter("tradefield", tradefield);
-                sqlFactory.addParameter("userid", userid);
-                sqlFactory.addParameter("itemid", itemid);
-                sqlList.add(sqlFactory.getSQL());
-            }
-
-            if (tradefields.size() > 0) {
-                sqlFactory = new SQLFactory(this, "删除多余的领域");
-                sqlFactory.addParameter("siteid", siteid);
-                sqlFactory.addParameter_in("tradefield", tradefields.toArray());
-                sqlFactory.addParameter("userid", userid);
-                sqlFactory.addParameter("itemid", itemid);
-                sqlList.add(sqlFactory.getSQL());
-            }
-        }
-
-        if (content.containsKey("itemclassids")) {
-            JSONArray itemclassids = content.getJSONArray("itemclassids");
-            for (Object obj : itemclassids) {
-                int itemclassid = (int) obj;
-                sqlFactory = new SQLFactory(this, "商品营销类别新增");
-                sqlFactory.addParameter("sa_itemsaleclassid", createTableID("sa_itemsaleclass"));
-                sqlFactory.addParameter("siteid", siteid);
-                sqlFactory.addParameter("itemid", itemid);
-                sqlFactory.addParameter("itemno", itemno);
-                sqlFactory.addParameter("itemclassid", itemclassid);
-                sqlList.add(sqlFactory.getSQL());
-            }
-
-            sqlFactory = new SQLFactory(this, "商品营销类别删除");
-            sqlFactory.addParameter("sa_itemsaleclassid", createTableID("sa_itemsaleclass"));
-            sqlFactory.addParameter("siteid", siteid);
-            sqlFactory.addParameter("itemid", itemid);
-            sqlFactory.addParameter("itemno", itemno);
-            sqlFactory.addParameter_in("itemclassid", itemclassids.toArray());
-            sqlList.add(sqlFactory.getSQL());
-        }
-
         dbConnect.runSqlUpdate(sqlList);
 
         content.put("itemid", itemid);
@@ -350,8 +300,6 @@ public class Item extends Controller {
         RowsMap itemClassRowsMap = ItemClass.getAllItemClassRowsMap(this, itemids);
         // 附件
         RowsMap attRowsMap = getAttachmentUrl("plm_item", itemids);
-        // 商品领域
-        RowsMap tradefieldRowsMap = beans.Item.Item.getTradefieldRowsMap(this, itemids);
 
         for (Row row : rows) {
             if (attRowsMap.getOrDefault(row.getString("itemid"), new Rows()).isEmpty()) {
@@ -361,8 +309,6 @@ public class Item extends Controller {
             }
             row.put("brand", brandRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
             row.put("itemclass", itemClassRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
-            row.put("tradefield", tradefieldRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
-            row.put("nominalpressurestr", StringUtils.join(row.getJSONArray("nominalpressure"), "/"));
         }
 
         return getSucReturnObject().setData(rows.isNotEmpty() ? rows.get(0) : new Row()).toString();
@@ -380,8 +326,8 @@ public class Item extends Controller {
                 where.append("or t1.itemname like'%").append(whereObject.getString("condition")).append("%' ");
                 where.append("or t1.model like'%").append(whereObject.getString("condition")).append("%' ");
                 where.append("or t1.spec like'%").append(whereObject.getString("condition")).append("%' ");
-                where.append("or t8.erpitemname like'%").append(whereObject.getString("condition")).append("%' ");
-                where.append("or t8.erpitemno like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t3.erpitemname like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t3.erpitemno like'%").append(whereObject.getString("condition")).append("%' ");
                 where.append(")");
             }
             if (whereObject.containsKey("isonsale") && !"".equals(whereObject.getString("isonsale"))) {
@@ -433,10 +379,8 @@ public class Item extends Controller {
             } else {
                 row.put("attinfos", attRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
             }
-            row.put("tradefield", tradefieldRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
             row.put("brand", brandRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
             row.put("itemclass", itemclassRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
-            row.put("nominalpressurestr", StringUtils.join(row.getJSONArray("nominalpressure"), "/"));
         }
         return getSucReturnObject().setData(rows).toString();
     }
@@ -881,6 +825,9 @@ public class Item extends Controller {
                     // 是否服务物料
                     sqlFactory.addParameter("isservice", row.getString("isservice"));
                     sqlFactory.addParameter("packqty", "1");
+                    sqlFactory.addParameter("explains", "");
+                    sqlFactory.addParameter("goodstype", "");
+                    sqlFactory.addParameter("assistance", "");
                     sqlList.add(sqlFactory.getSQL());
                     // 货品档案扩展属性字段表
 

+ 10 - 43
src/custom/restcontroller/webmanage/sale/item/SQL/货品档案列表.sql

@@ -1,55 +1,22 @@
 SELECT t1.itemid,
        t1.itemno,
        t1.itemname,
+       t1.`status`,
+       t1.onsaledate,
        t1.model,
        t1.spec,
-       t1.marketprice,
-       t2.unitname,
-       t1.unitid,
-       t1.createdate,
        t1.isonsale,
-       t1.status,
+       t1.assistance,
+       t1.goodstype,
+       t1.explains,
        t1.orderaddqty,
        t1.orderminqty,
-       t1.remarks,
-       t1.barcode,
-       t1.skucontrol,
-       t1.batchcontrol,
-       t1.grossweight,
-       t1.weight,
-       t1.height,
-       t1.width,
-       t1.length,
-       t1.delivery,
-       t1.istool,
-       t1.onsaleby,
-       t1.onsaledate,
-       t1.packqty,
-       t6.auxunitid,
-       t6.unitgroupname,
-       t7.unitname axunitname,
-       t8.pressure,
-       t8.material,
-       t8.butterflyplatedrive,
-       t8.connection,
-       t8.valveplatematerial,
-       t8.bodymaterial,
-       t8.actuatortype,
-       t8.actuatorbrand,
-       t8.isbutterfly,
-       t8.erpitemno,
-       t8.erpitemname,
-       t8.specalnote,
-       t8.prodline,
-       t8.device,
-       t8.categories,
-       t8.nominalpressure,
-       t8.caliber,
-       t1.supplier
+       t1.marketprice,
+       t2.unitname,
+       t3.erpitemname,
+       t3.erpitemno
 FROM plm_item t1
          LEFT JOIN plm_unit t2 ON t2.unitid = t1.unitid AND t2.siteid = t1.siteid
-         LEFT JOIN plm_unitgroup t6 ON t6.unitgroupid = t1.unitgroupid
-         LEFT JOIN plm_unit t7 ON t7.unitid = t6.unitid AND t7.siteid = t6.siteid
-         LEFT JOIN plm_itemextend t8 ON t8.itemid = t1.itemid AND t8.siteid = t1.siteid
+         LEFT JOIN plm_itemextend t3 ON t3.itemid = t1.itemid AND t3.siteid = t1.siteid
 WHERE t1.siteid = $siteid$
   and $where$ and t1.isshow=1

+ 2 - 2
src/custom/restcontroller/webmanage/sale/item/SQL/货品档案新增.sql

@@ -2,9 +2,9 @@ insert into plm_item (siteid, itemid, createby, createdate, changeuserid, change
                       isauxunit, unitgroupid, itemname, isonsale, status, model, spec, orderminqty, orderaddqty,
                       orderminqty_auxunit, orderaddqty_auxunit, remarks, barcode, skucontrol, batchcontrol, grossweight,
                       weight, height, width, length, delivery, istool, marketprice, standards,standardsmx, stockstatus2,
-                      stockstatus1, warrantyday, iswuliao, isservice,packqty,isshow)
+                      stockstatus1, warrantyday, iswuliao, isservice,packqty,isshow,explains,goodstype,assistance)
 values ($siteid$, $itemid$, $username$, CURRENT_TIME, $userid$, $username$, CURRENT_TIME, $itemno$, $unitid$,
         $isauxunit$, $unitgroupid$, $itemname$, $isonsale$, '新建', $model$, $spec$, $orderminqty$, $orderaddqty$,
         $orderminqty_auxunit$, $orderaddqty_auxunit$, $remarks$, $barcode$, $skucontrol$, $batchcontrol$, $grossweight$,
         $weight$, $height$, $width$, $length$, $delivery$, $istool$, $marketprice$, $standards$,$standardsmx$,
-        $stockstatus2$, $stockstatus1$, $warrantyday$, $iswuliao$, $isservice$,$packqty$,1)
+        $stockstatus2$, $stockstatus1$, $warrantyday$, $iswuliao$, $isservice$,$packqty$,1,$explains$,$goodstype$,$assistance$)

+ 4 - 1
src/custom/restcontroller/webmanage/sale/item/SQL/货品档案更新.sql

@@ -34,7 +34,10 @@ SET changeuserid=$userid$,
     iswuliao = $iswuliao$,
     isservice = $isservice$,
     packqty=$packqty$,
-    isshow=1
+    isshow=1,
+    explains = $explains$,
+    goodstype=$goodstype$,
+    assistance=$assistance$
 WHERE itemid = $itemid$
   and siteid = $siteid$
 

+ 2 - 22
src/custom/restcontroller/webmanage/sale/item/SQL/货品档案详情.sql

@@ -1,33 +1,13 @@
 SELECT t1.*,
        t2.unitname,
        t8.plm_itemextendid,
-       t8.pressure,
-       t8.material,
-       t8.butterflyplatedrive,
-       t8.connection,
-       t8.valveplatematerial,
-       t8.bodymaterial,
-       t8.actuatortype,
-       t8.actuatorbrand,
-       t8.isbutterfly,
        t8.erpitemno,
        t8.erpitemname,
-       t8.specalnote,
-       t8.prodline,
-       t8.device,
-       (case
-            when t3.cansaleqty >= t1.stockstatus1 then '充足'
-            when t3.cansaleqty <= t1.stockstatus2 then '缺货'
-            else '紧缺' end) stockstatus,
-       ifnull(t3.qty, 0)     invbal_qty,
-       t4.unitgroupname,
-       t8.categories,
-       t8.nominalpressure,
-       t8.caliber
+       t4.unitgroupname
+
 FROM plm_item t1
          LEFT JOIN plm_unit t2 ON t2.unitid = t1.unitid AND t2.siteid = t1.siteid
          LEFT JOIN plm_itemextend t8 ON t8.itemid = t1.itemid AND t8.siteid = t1.siteid
-         LEFT JOIN st_invbal_sale t3 ON t3.siteid = t1.siteid AND t3.itemid = t1.itemid
          left join plm_unitgroup t4 on t1.isauxunit = t4.unitgroupid and t1.siteid = t4.siteid
 WHERE t1.siteid = $siteid$
   and t1.itemid = $itemid$ and t1.isshow=1