|
|
@@ -1305,7 +1305,7 @@ public class Order extends Controller {
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
String sonum = row.getString("sonum");
|
|
|
if (type.equals("促销订单")) {
|
|
|
- Rows orderdetails = dbConnect.runSqlQuery("select * from sa_orderitems where siteid='" + siteid + "' and sa_orderid=" + sa_orderid);
|
|
|
+ Rows orderdetails = dbConnect.runSqlQuery("select itemid,itemno,sum(qty) qty from sa_orderitems where siteid='" + siteid + "' and sa_orderid=" + sa_orderid+" group by itemid,itemno");
|
|
|
Rows promotionitems = dbConnect.runSqlQuery("select * from sa_promotion_items where siteid='" + siteid + "' and sa_promotionid=" + row.getLong("sa_promotionid"));
|
|
|
RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("itemid");
|
|
|
for (Row orderdetail : orderdetails) {
|
|
|
@@ -1851,7 +1851,7 @@ public class Order extends Controller {
|
|
|
|
|
|
String type = row.getString("type");
|
|
|
if (type.equals("促销订单")) {
|
|
|
- Rows orderdetails = dbConnect.runSqlQuery("select * from sa_orderitems where siteid='" + siteid + "' and sa_orderid=" + sa_orderid);
|
|
|
+ Rows orderdetails = dbConnect.runSqlQuery("select itemid,itemno,sum(qty) qty from sa_orderitems where siteid='" + siteid + "' and sa_orderid=" + sa_orderid+" group by itemid,itemno");
|
|
|
Rows promotionitems = dbConnect.runSqlQuery("select * from sa_promotion_items where siteid='" + siteid + "' and sa_promotionid=" + row.getLong("sa_promotionid"));
|
|
|
RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("itemid");
|
|
|
for (Row orderdetail : orderdetails) {
|
|
|
@@ -1940,7 +1940,7 @@ public class Order extends Controller {
|
|
|
|
|
|
String type = row.getString("type");
|
|
|
if (type.equals("促销订单")) {
|
|
|
- Rows orderdetails = dbConnect.runSqlQuery("select * from sa_orderitems where siteid='" + siteid + "' and sa_orderid=" + sa_orderid);
|
|
|
+ Rows orderdetails = dbConnect.runSqlQuery("select itemid,itemno,sum(qty) qty from sa_orderitems where siteid='" + siteid + "' and sa_orderid=" + sa_orderid+" group by itemid,itemno");
|
|
|
Rows promotionitems = dbConnect.runSqlQuery("select * from sa_promotion_items where siteid='" + siteid + "' and sa_promotionid=" + row.getLong("sa_promotionid"));
|
|
|
RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("itemid");
|
|
|
for (Row orderdetail : orderdetails) {
|
|
|
@@ -3036,15 +3036,15 @@ public class Order extends Controller {
|
|
|
|
|
|
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 orderdetails = dbConnect.runSqlQuery("select itemid,itemno,sum(undeliqty) qty from sa_orderitems where siteid='" + siteid + "' and sa_orderid=" + sa_orderid + " group by itemid,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");
|
|
|
+ RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("itemid");
|
|
|
for (Row orderdetail : orderdetails) {
|
|
|
- String sa_promotion_itemsid = orderdetail.getString("sa_promotion_itemsid");
|
|
|
+ String itemid = orderdetail.getString("itemid");
|
|
|
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);
|
|
|
+ if (promotionitemsRowsMap.containsKey(itemid)) {
|
|
|
+ if (promotionitemsRowsMap.get(itemid).isNotEmpty()) {
|
|
|
+ sqlList.add("update sa_promotion_items set saledqty=saledqty-" + qty + " where sa_promotion_itemsid=" + promotionitemsRowsMap.get(itemid).get(0).getLong("sa_promotion_itemsid"));
|
|
|
}
|
|
|
}
|
|
|
}
|