|
|
@@ -2666,6 +2666,22 @@ public class Order extends Controller {
|
|
|
sqlList.add("UPDATE sa_order SET STATUS='手工关闭',closedate=current_time,closeby='" + username + "' WHERE sa_orderid='" + sa_orderid + "' and siteid = '" + siteid + "'");
|
|
|
sqlList.add("UPDATE sa_orderitems SET isclose=1 WHERE sa_orderid='" + sa_orderid + "' and siteid = '" + siteid + "'");
|
|
|
|
|
|
+ String type = orderRow.get(0).getString("type");
|
|
|
+ if (type.equals("促销订单")) {
|
|
|
+ Rows orderdetails = dbConnect.runSqlQuery("select sa_promotion_itemsid,itemno,sum(undeliqty) qty from sa_orderitems where siteid='" + siteid + "' and sa_orderid=" + sa_orderid +" group by sa_promotion_itemsid,itemno");
|
|
|
+ Rows promotionitems = dbConnect.runSqlQuery("select * from sa_promotion_items where siteid='" + siteid + "' and sa_promotionid=" + orderRow.get(0).getLong("sa_promotionid"));
|
|
|
+ RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("sa_promotion_itemsid");
|
|
|
+ for (Row orderdetail : orderdetails) {
|
|
|
+ String sa_promotion_itemsid = orderdetail.getString("sa_promotion_itemsid");
|
|
|
+ BigDecimal qty = orderdetail.getBigDecimal("qty");
|
|
|
+ if (promotionitemsRowsMap.containsKey(sa_promotion_itemsid)) {
|
|
|
+ if (promotionitemsRowsMap.get(sa_promotion_itemsid).isNotEmpty()) {
|
|
|
+ sqlList.add("update sa_promotion_items set saledqty=saledqty-" + qty + " where sa_promotion_itemsid=" + sa_promotion_itemsid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Rows rows = dbConnect.runSqlQuery("SELECT sum(undeliqty*price) totalprice from sa_orderitems WHERE sa_orderid=" + sa_orderid + " and siteid = '" + siteid + "'");
|
|
|
Long sa_cashbillid = 0L;
|
|
|
if (rows.isNotEmpty()) {
|