|
|
@@ -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());
|
|
|
// 货品档案扩展属性字段表
|
|
|
|