|
@@ -72,7 +72,7 @@ public class Item extends Controller {
|
|
|
return getErrReturnObject().setErrMsg("该商品定制方案" + row.getString("schemename") + "下" + row.getString("description") + "不可为空").toString();
|
|
|
} else if (StringUtils.isBlank(itemRows.get(0).getString(row.getString("value"))) || StringUtils.isBlank(content.getStringValue(row.getString("value")))) {
|
|
|
//System.out.println(1111);
|
|
|
- // System.out.println(StringUtils.isBlank(itemRows.get(0).getString(row.getString("value"))));
|
|
|
+ // System.out.println(StringUtils.isBlank(itemRows.get(0).getString(row.getString("value"))));
|
|
|
where = where + " and " + row.getString("value") + "='" + (StringUtils.isBlank(itemRows.get(0).getString(row.getString("value"))) ? content.getStringValue(row.getString("value")) : itemRows.get(0).getString(row.getString("value"))) + "'";
|
|
|
|
|
|
} else if (StringUtils.isNotBlank(itemRows.get(0).getString(row.getString("value"))) && StringUtils.isNotBlank(content.getStringValue(row.getString("value"))))
|
|
@@ -92,8 +92,8 @@ public class Item extends Controller {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(content.getBooleanValue("iscustomsize")){
|
|
|
- if(content.getLongValue("widthschemeid")<=0 || content.getLongValue("lengthschemeid")<=0){
|
|
|
+ if (content.getBooleanValue("iscustomsize")) {
|
|
|
+ if (content.getLongValue("widthschemeid") <= 0 || content.getLongValue("lengthschemeid") <= 0) {
|
|
|
return getErrReturnObject().setErrMsg("定制商品长度定制方案及宽度定制方案必选").toString();
|
|
|
}
|
|
|
}
|
|
@@ -111,10 +111,10 @@ public class Item extends Controller {
|
|
|
sqlFactory.addParameter("model", content.getString("model"));
|
|
|
sqlFactory.addParameter("spec", content.getString("spec"));
|
|
|
// 订单起订量
|
|
|
- if(content.getBigDecimalValue("orderminqty").compareTo(BigDecimal.ZERO)<=0){
|
|
|
+ if (content.getBigDecimalValue("orderminqty").compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
return getErrReturnObject().setErrMsg("起订量必须大于零").toString();
|
|
|
}
|
|
|
- if(content.getBigDecimalValue("orderaddqty").compareTo(BigDecimal.ZERO)<=0){
|
|
|
+ if (content.getBigDecimalValue("orderaddqty").compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
return getErrReturnObject().setErrMsg("增量必须大于零").toString();
|
|
|
}
|
|
|
sqlFactory.addParameter("orderminqty", content.getBigDecimalValue("orderminqty"));
|
|
@@ -180,7 +180,7 @@ public class Item extends Controller {
|
|
|
sqlFactory.addParameter("customprice", content.getBigDecimalValue("customprice"));
|
|
|
sqlFactory.addParameter("widthschemeid", content.getBigDecimalValue("widthschemeid"));
|
|
|
sqlFactory.addParameter("lengthschemeid", content.getBigDecimalValue("lengthschemeid"));
|
|
|
- sqlFactory.addParameter("pricingmetod", content.getLongValue("pricingmetod")==0?1:content.getLongValue("pricingmetod"));
|
|
|
+ sqlFactory.addParameter("pricingmetod", content.getLongValue("pricingmetod") == 0 ? 1 : content.getLongValue("pricingmetod"));
|
|
|
|
|
|
sqlList.add(sqlFactory.getSQL());
|
|
|
// 货品档案扩展属性字段表
|
|
@@ -328,22 +328,22 @@ public class Item extends Controller {
|
|
|
object.put("method", "getMsg");
|
|
|
|
|
|
JSONObject content = new JSONObject();
|
|
|
- content.put("fitemnos", rows.toJsonArray("itemno"));
|
|
|
+ content.put("fitemnos", rows.toJsonArray("itemno"));
|
|
|
object.put("content", content);
|
|
|
|
|
|
- WebRequest request = new WebRequest();
|
|
|
- String result ="";
|
|
|
+ WebRequest request = new WebRequest();
|
|
|
+ String result = "";
|
|
|
// String result = request.doPost(object.toString(),
|
|
|
// "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
|
|
|
for (Row row : rows) {
|
|
|
JSONArray jsonArrayResult = new JSONArray();
|
|
|
- if(isJSONArray(result)){
|
|
|
- jsonArrayResult = JSONArray.parseArray(result);
|
|
|
+ if (isJSONArray(result)) {
|
|
|
+ jsonArrayResult = JSONArray.parseArray(result);
|
|
|
}
|
|
|
- if(!jsonArrayResult.isEmpty()){
|
|
|
- row.put("invbal_qty",((JSONObject)jsonArrayResult.get(0)).getBigDecimal("fqty"));
|
|
|
- }else{
|
|
|
- row.put("invbal_qty",0);
|
|
|
+ if (!jsonArrayResult.isEmpty()) {
|
|
|
+ row.put("invbal_qty", ((JSONObject) jsonArrayResult.get(0)).getBigDecimal("fqty"));
|
|
|
+ } else {
|
|
|
+ row.put("invbal_qty", 0);
|
|
|
}
|
|
|
if (attRowsMap.getOrDefault(row.getString("itemid"), new Rows()).isEmpty()) {
|
|
|
row.put("attinfos", defaultImageRows);
|
|
@@ -362,7 +362,7 @@ public class Item extends Controller {
|
|
|
public String queryInvbalQty() throws YosException {
|
|
|
|
|
|
Long itemid = content.getLong("itemid");
|
|
|
- Rows rows = dbConnect.runSqlQuery("select itemno from plm_item where siteid='"+siteid+"' and itemid="+itemid);
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select itemno from plm_item where siteid='" + siteid + "' and itemid=" + itemid);
|
|
|
|
|
|
// JSONObject object = new JSONObject();
|
|
|
// object.put("classname", "getIcinvbal");
|
|
@@ -447,7 +447,7 @@ public class Item extends Controller {
|
|
|
}
|
|
|
}
|
|
|
if (whereObject.containsKey("hasprice") && !"".equals(whereObject.getString("hasprice"))) {
|
|
|
- if(whereObject.getBooleanValue("hasprice")){
|
|
|
+ if (whereObject.getBooleanValue("hasprice")) {
|
|
|
where.append(" and(");
|
|
|
where.append(" exists(select * from sa_itemprice where sa_itemprice.siteid=t1.siteid and sa_itemprice.itemid=t1.itemid and price>0)");
|
|
|
where.append(")");
|
|
@@ -675,12 +675,12 @@ public class Item extends Controller {
|
|
|
|
|
|
JSONArray jsonArray = content.getJSONArray("itemids");
|
|
|
String status = content.getString("status");
|
|
|
- Rows itemRows =new Rows();
|
|
|
- Rows itemclassRows=new Rows();
|
|
|
- if(!jsonArray.isEmpty()){
|
|
|
- itemRows = dbConnect.runSqlQuery("SELECT t1.*,t2.material from plm_item t1 left join plm_itemextend t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.itemid in"+jsonArray.toJSONString().replace("[", "(").replace("]", ")"));
|
|
|
- itemclassRows = dbConnect.runSqlQuery("select itemid,itemclassid from sa_itemsaleclass where siteid='" + siteid + "' and itemid in"+jsonArray.toJSONString().replace("[", "(").replace("]", ")"));
|
|
|
- }else{
|
|
|
+ Rows itemRows = new Rows();
|
|
|
+ Rows itemclassRows = new Rows();
|
|
|
+ if (!jsonArray.isEmpty()) {
|
|
|
+ itemRows = dbConnect.runSqlQuery("SELECT t1.*,t2.material from plm_item t1 left join plm_itemextend t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.itemid in" + jsonArray.toJSONString().replace("[", "(").replace("]", ")"));
|
|
|
+ itemclassRows = dbConnect.runSqlQuery("select itemid,itemclassid from sa_itemsaleclass where siteid='" + siteid + "' and itemid in" + jsonArray.toJSONString().replace("[", "(").replace("]", ")"));
|
|
|
+ } else {
|
|
|
return getErrReturnObject().setErrMsg("未选择商品,无法审核").toString();
|
|
|
}
|
|
|
RowsMap itemRowsMap = itemRows.toRowsMap("itemid");
|
|
@@ -688,6 +688,12 @@ public class Item extends Controller {
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
for (Object obj : jsonArray) {
|
|
|
int id = (int) obj;
|
|
|
+ //审核
|
|
|
+ if (status.equals("1")) {
|
|
|
+ if (dbConnect.runSqlQuery("SELECT 1 from sa_itemsaleclass WHERE itemid=" + id + " and siteid='" + siteid + "'").isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("审核失败,请先维护营销分类").toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "货品档案审核");
|
|
|
sqlFactory.addParameter("itemid", id);
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
@@ -695,16 +701,16 @@ public class Item extends Controller {
|
|
|
sqlFactory.addParameter("status", status.equals("0") ? "新建" : "审核");
|
|
|
if (itemRowsMap.containsKey(String.valueOf(id))) {
|
|
|
if (!itemRowsMap.get(String.valueOf(id)).isEmpty()) {
|
|
|
- if (itemRowsMap.get(String.valueOf(id)).get(0).getLong("sa_customschemeid")>0) {
|
|
|
+ if (itemRowsMap.get(String.valueOf(id)).get(0).getLong("sa_customschemeid") > 0) {
|
|
|
Rows customschemeRows = dbConnect.runSqlQuery("SELECT t1.*,t2.schemename from sa_customscheme_items t1 left join sa_customscheme t2 on t1.sa_customschemeid=t2.sa_customschemeid and t1.siteid=t2.siteid WHERE t1.sa_customschemeid=" + itemRowsMap.get(String.valueOf(id)).get(0).getLong("sa_customschemeid") + " and t1.siteid ='" + siteid + "'");
|
|
|
String where = " and 1=1 and t1.itemid != " + id + " and sa_customschemeid=" + itemRowsMap.get(String.valueOf(id)).get(0).getLong("sa_customschemeid");
|
|
|
if (!customschemeRows.isEmpty()) {
|
|
|
for (Row row : customschemeRows) {
|
|
|
|
|
|
if (StringUtils.isBlank(itemRowsMap.get(String.valueOf(id)).get(0).getString(row.getString("value")))) {
|
|
|
- return getErrReturnObject().setErrMsg("该商品【"+itemRowsMap.get(String.valueOf(id)).get(0).getString("itemname")+"】定制方案" + row.getString("schemename") + "下" + row.getString("description") + "不可为空").toString();
|
|
|
+ return getErrReturnObject().setErrMsg("该商品【" + itemRowsMap.get(String.valueOf(id)).get(0).getString("itemname") + "】定制方案" + row.getString("schemename") + "下" + row.getString("description") + "不可为空").toString();
|
|
|
} else {
|
|
|
- where = where + " and " + row.getString("value") + "='" + itemRowsMap.get(String.valueOf(id)).get(0).getString(row.getString("value")) + "'";
|
|
|
+ where = where + " and " + row.getString("value") + "='" + itemRowsMap.get(String.valueOf(id)).get(0).getString(row.getString("value")) + "'";
|
|
|
}
|
|
|
}
|
|
|
//System.out.println("select * from plm_item where siteid='" + siteid + "'" + where);
|
|
@@ -718,14 +724,14 @@ public class Item extends Controller {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(itemclassRowsMap.containsKey(String.valueOf(id))){
|
|
|
- if(itemclassRowsMap.get(String.valueOf(id)).isNotEmpty()){
|
|
|
+ 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_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 (rows.isNotEmpty()) {
|
|
|
+ sqlList.add("update plm_item set marketingcategory='" + rows.get(0).getString("itemclassid") + "' where siteid='" + siteid + "' and itemid=" + id);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -815,8 +821,8 @@ public class Item extends Controller {
|
|
|
sqlFactory.addParameter("isonsale", isonsale);
|
|
|
sqlList.add(sqlFactory.getSQL(false));
|
|
|
if (isonsale.equals("1")) {
|
|
|
- sqlList.add(DataContrlLog.createLog(this, "plm_item", id, "商品上架", "商品上架成功" ).getSQL());
|
|
|
- }else{
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "plm_item", id, "商品上架", "商品上架成功").getSQL());
|
|
|
+ } else {
|
|
|
sqlList.add(DataContrlLog.createLog(this, "plm_item", id, "商品下架", "商品下架成功").getSQL());
|
|
|
}
|
|
|
|