|
|
@@ -113,7 +113,16 @@ public class Order extends Controller {
|
|
|
sqlFactory.addParameter("sa_accountclassid", "69");
|
|
|
sqlList.addAll(updateAccountclassinfos(sa_orderid, 69, sys_enterpriseid));
|
|
|
} else {
|
|
|
- sqlFactory.addParameter("sa_accountclassid", beans.order.Order.getDefaultAccount(siteid, type));
|
|
|
+ if(type.equals("促销订单")){
|
|
|
+ Rows accountclassRows = dbConnect.runSqlQuery("select sa_accountclassid from sa_promotion where siteid='"+siteid+"' and sa_promotionid="+content.getLongValue("sa_promotionid"));
|
|
|
+ if(!accountclassRows.isEmpty()){
|
|
|
+ sqlFactory.addParameter("sa_accountclassid", accountclassRows.get(0).getLong("sa_accountclassid"));
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter("sa_accountclassid", beans.order.Order.getDefaultAccount(siteid, type));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter("sa_accountclassid", beans.order.Order.getDefaultAccount(siteid, type));
|
|
|
+ }
|
|
|
sqlList.addAll(updateAccountclassinfos(sa_orderid, beans.order.Order.getDefaultAccount(siteid, type), sys_enterpriseid));
|
|
|
}
|
|
|
//品牌ID
|
|
|
@@ -280,8 +289,19 @@ public class Order extends Controller {
|
|
|
//营销账户类型ID
|
|
|
if ((type.equals("标准订单") || type.equals("特殊订单")) && content.getString("tradefield").equals("整装工程")) {
|
|
|
sqlFactory.addParameter("sa_accountclassid", "69");
|
|
|
+
|
|
|
} else {
|
|
|
- sqlFactory.addParameter("sa_accountclassid", beans.order.Order.getDefaultAccount(siteid, type));
|
|
|
+ if(type.equals("促销订单")){
|
|
|
+ Rows accountclassRows = dbConnect.runSqlQuery("select sa_accountclassid from sa_promotion where siteid='"+siteid+"' and sa_promotionid="+content.getLongValue("sa_promotionid"));
|
|
|
+ if(!accountclassRows.isEmpty()){
|
|
|
+ sqlFactory.addParameter("sa_accountclassid", accountclassRows.get(0).getLong("sa_accountclassid"));
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter("sa_accountclassid", beans.order.Order.getDefaultAccount(siteid, type));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter("sa_accountclassid", beans.order.Order.getDefaultAccount(siteid, type));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//品牌ID
|
|
|
@@ -365,7 +385,17 @@ public class Order extends Controller {
|
|
|
if ((type.equals("标准订单") || type.equals("特殊订单")) && content.getString("tradefield").equals("整装工程")) {
|
|
|
sqlList1.addAll(updateAccountclassinfos(sa_orderid, 69, sys_enterpriseid));
|
|
|
} else {
|
|
|
- sqlList1.addAll(updateAccountclassinfos(sa_orderid, beans.order.Order.getDefaultAccount(siteid, type), sys_enterpriseid));
|
|
|
+ if(type.equals("促销订单")){
|
|
|
+ Rows accountclassRows = dbConnect.runSqlQuery("select sa_accountclassid from sa_promotion where siteid='"+siteid+"' and sa_promotionid="+content.getLongValue("sa_promotionid"));
|
|
|
+ if(!accountclassRows.isEmpty()){
|
|
|
+ sqlList1.addAll(updateAccountclassinfos(sa_orderid, accountclassRows.get(0).getLong("sa_accountclassid"), sys_enterpriseid));
|
|
|
+ }else{
|
|
|
+ sqlList1.addAll(updateAccountclassinfos(sa_orderid, beans.order.Order.getDefaultAccount(siteid, type), sys_enterpriseid));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ sqlList1.addAll(updateAccountclassinfos(sa_orderid, beans.order.Order.getDefaultAccount(siteid, type), sys_enterpriseid));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
dbConnect.runSqlUpdate(sqlList1);
|
|
|
@@ -1573,6 +1603,7 @@ public class Order extends Controller {
|
|
|
return getErrReturnObject().setErrMsg("订单不存在").toString();
|
|
|
}
|
|
|
Row row = rows.get(0);
|
|
|
+
|
|
|
if (dbConnect.runSqlQuery("SELECT 1 from sa_dispatch t1 left join sa_dispatch_items t2 on t1.sa_dispatchid=t2.sa_dispatchid and t1.siteid=t2.siteid left join sa_orderitems t3 on t2.sa_orderitemsid=t3.sa_orderitemsid and t2.siteid=t3.siteid WHERE t1.siteid='" + siteid + "' and t3.sa_orderid=" + sa_orderid).isNotEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("存在发货单,无法反审核").toString();
|
|
|
}
|
|
|
@@ -1750,6 +1781,14 @@ public class Order extends Controller {
|
|
|
if (rows.isEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("订单不存在").toString();
|
|
|
}
|
|
|
+ if (!rows.get(0).getString("status").equals("提交")) {
|
|
|
+ return getErrReturnObject().setErrMsg("订单非提交状态无法退回").toString();
|
|
|
+ }
|
|
|
+ if(rows.get(0).getLong("sa_promotionid")!=0){
|
|
|
+ if (dbConnect.runSqlQuery("SELECT 1 FROM sa_promotion WHERE CURRENT_TIME> enddate AND siteid='" + siteid + "' AND sa_promotionid='" + rows.get(0).getLong("sa_promotionid") + "'").isNotEmpty()) {
|
|
|
+ //return getErrReturnObject().setErrMsg("活动已结束,是否确认退回,退回后无法再次提交").toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
//通过版本更新订单表头数据
|
|
|
beans.order.Order.updateOrderWithVersion(this);
|
|
|
Row row = rows.get(0);
|
|
|
@@ -2509,7 +2548,7 @@ public class Order extends Controller {
|
|
|
} else {
|
|
|
sqlFactory.addParameter("rebate_used", 0);
|
|
|
}
|
|
|
-
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "sa_order", sa_orderid_copy, "订单复制", "由订单" +row.getString("sonum")+"复制而来").getSQL());
|
|
|
sqlList.add(sqlFactory.getSQL());
|
|
|
|
|
|
//复制商品
|
|
|
@@ -2961,6 +3000,7 @@ public class Order extends Controller {
|
|
|
CashbillEntity entity = new CashbillEntity();
|
|
|
entity.setAmount(totalprice.negate());
|
|
|
entity.setSource("订单手工关闭");
|
|
|
+ entity.setSourcenote(orderRow.get(0).getString("sonum"));
|
|
|
entity.setOwnerid(sa_orderid);
|
|
|
entity.setOwnertable("sa_order");
|
|
|
entity.setRemarks("由" + orderRow.get(0).getString("sonum") + "订单手工关闭时自动产生");
|
|
|
@@ -2973,6 +3013,7 @@ public class Order extends Controller {
|
|
|
CashbillEntity entity = new CashbillEntity();
|
|
|
entity.setAmount(orderaccountclassinfo.getBigDecimal("amount").negate());
|
|
|
entity.setSource("订单手工关闭");
|
|
|
+ entity.setSourcenote(orderRow.get(0).getString("sonum"));
|
|
|
entity.setOwnerid(sa_orderid);
|
|
|
entity.setOwnertable("sa_order");
|
|
|
entity.setRemarks("由" + orderRow.get(0).getString("sonum") + "订单手工关闭时自动产生");
|
|
|
@@ -2985,6 +3026,7 @@ public class Order extends Controller {
|
|
|
CashbillEntity promotionentity = new CashbillEntity();
|
|
|
promotionentity.setAmount((totalprice.subtract(orderaccountclassinfo.getBigDecimal("amount"))).negate());
|
|
|
promotionentity.setSource("订单手工关闭");
|
|
|
+ promotionentity.setSourcenote(orderRow.get(0).getString("sonum"));
|
|
|
promotionentity.setOwnerid(sa_orderid);
|
|
|
promotionentity.setOwnertable("sa_order");
|
|
|
promotionentity.setRemarks("由" + orderRow.get(0).getString("sonum") + "订单手工关闭时自动产生");
|