|
@@ -16,6 +16,7 @@ import common.data.Row;
|
|
|
import common.data.Rows;
|
|
|
import common.data.RowsMap;
|
|
|
import common.data.SQLFactory;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import restcontroller.R;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -237,17 +238,24 @@ public class itemgroup extends Controller {
|
|
|
// SQLFactory sqlFactoryquery = new SQLFactory(this, "商品组状态查询");
|
|
|
// sqlFactoryquery.addParameter("siteid", siteid);
|
|
|
// sqlFactoryquery.addParameter_in("sa_itemgroupids", stringArray);
|
|
|
- String whereSql = "select isonsale,groupname,sa_itemgroupid from sa_itemgroup where sa_itemgroupid in " + list + " and siteid='" + siteid + "'";
|
|
|
+ String whereSql = "select isonsale,groupname,sa_itemgroupid,itemno from sa_itemgroup where sa_itemgroupid in " + list + " and siteid='" + siteid + "'";
|
|
|
whereSql = whereSql.replace("[", "(").replace("]", ")");
|
|
|
Rows rows = dbConnect.runSqlQuery(whereSql);
|
|
|
for (Row row : rows) {
|
|
|
if (row.getBoolean("isonsale")) {
|
|
|
return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组已上架,无法再次上架").toString();
|
|
|
}
|
|
|
+ if (StringUtils.isBlank(row.getString("itemno"))) {
|
|
|
+ return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组不存在默认商品,无法再次上架").toString();
|
|
|
+ }
|
|
|
Rows rowscount = dbConnect.runSqlQuery("select distinct ifnull(t2.sa_customschemeid,0) sa_customschemeid from sa_itemgroupmx t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.siteid='"+siteid+"' and t1.sa_itemgroupid="+row.getLong("sa_itemgroupid"));
|
|
|
if(rowscount.size()>1){
|
|
|
return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组存在两个以上方案的商品,无法上架").toString();
|
|
|
}
|
|
|
+ Rows rowsdetailcount = dbConnect.runSqlQuery("select * from sa_itemgroupmx t1 where t1.sa_itemgroupid="+row.getLong("sa_itemgroupid"));
|
|
|
+ if(rowsdetailcount.size()==0){
|
|
|
+ return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组下没有商品,无法上架").toString();
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|