|
@@ -1473,12 +1473,25 @@ public class Order extends Controller {
|
|
|
}
|
|
|
Long sa_promotionid = row.getLong("sa_promotionid");
|
|
|
if (sa_promotionid > 0) {
|
|
|
+
|
|
|
if (dbConnect.runSqlQuery("SELECT 1 FROM sa_promotion WHERE siteid='" + siteid + "' AND sa_promotionid='" + sa_promotionid + "'").isEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("该促销活动不存在,无法提交").toString();
|
|
|
}
|
|
|
if (dbConnect.runSqlQuery("SELECT 1 FROM sa_promotion WHERE CURRENT_TIME> enddate AND siteid='" + siteid + "' AND sa_promotionid='" + sa_promotionid + "'").isNotEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("该促销活动已截止,无法提交").toString();
|
|
|
}
|
|
|
+
|
|
|
+ Rows promotionRows = dbConnect.runSqlQuery("SELECT isauth FROM sa_promotion WHERE siteid='" + siteid + "' AND sa_promotionid='" + sa_promotionid + "'");
|
|
|
+ if(!promotionRows.get(0).getBoolean("isauth")){
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "促销方案经销商授权区域查询");
|
|
|
+ sqlFactory.addParameter("sys_enterpriseid","sys_enterpriseid");
|
|
|
+ sqlFactory.addParameter("siteid","siteid");
|
|
|
+ Rows spromotionsaleareaRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
+ RowsMap spromotionsaleareaRowsMap = spromotionsaleareaRows.toRowsMap("sa_promotionid");
|
|
|
+ if (dbConnect.runSqlQuery("SELECT 1 FROM sa_promotion_auth WHERE sys_enterpriseid= "+sys_enterpriseid+" AND siteid='" + siteid + "' AND sa_promotionid='" + sa_promotionid + "'").isEmpty() || !spromotionsaleareaRowsMap.containsKey(String.valueOf(sa_promotionid))) {
|
|
|
+ return getErrReturnObject().setErrMsg("该促销活动已过期,无法提交").toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (!((row.getString("status").equals("新建") && !row.getString("type").equals("特殊订单")) || (row.getString("status").equals("确认") && row.getString("type").equals("特殊订单")))) {
|
|
|
return getErrReturnObject().setErrMsg("新建或非确认无法提交").toString();
|
|
@@ -1504,6 +1517,10 @@ public class Order extends Controller {
|
|
|
}
|
|
|
//促销订单:提交时商品必须是上架状态,并且活动方案中的商品必须也是上架状态,否则不允许提交
|
|
|
if (type.equals("促销订单")) {
|
|
|
+ Rows promotionitemsRows = dbConnect.runSqlQuery("select t2.itemno from sa_promotion_items t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.sa_promotionid=" + sa_promotionid + " and t1.siteid='" + siteid + "' and t1.isonsale=0 and t1.itemid in(select itemid from sa_orderitems where sa_orderid="+sa_orderid+")");
|
|
|
+ if(promotionitemsRows.isNotEmpty()){
|
|
|
+ return getErrReturnObject().setErrMsg("商品:"+promotionitemsRows.get(0).getString("itemno")+"已下架,无法提交。").toString();
|
|
|
+ }
|
|
|
Rows promotionauthRows = dbConnect.runSqlQuery("select * from sa_promotion_auth where sa_promotionid=" + sa_promotionid + " and sys_enterpriseid ='" + sys_enterpriseid + "' and siteid='" + siteid + "'");
|
|
|
if (promotionauthRows.isNotEmpty()) {
|
|
|
if (promotionauthRows.get(0).getBoolean("settlestatus")) {
|