|
|
@@ -129,11 +129,12 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
for (Row row : rows) {
|
|
|
saorderamount = saorderamount.add(row.getBigDecimal("amount"));
|
|
|
}
|
|
|
- //查询定制费用
|
|
|
- sql = "SELECT ifnull(sum(costamount),0) costamount from sa_order_cost WHERE sa_orderid=" + sa_orderid;
|
|
|
- BigDecimal costamount = dbConnect.runSqlQuery(0, sql).getBigDecimal("costamount");
|
|
|
- saorderamount = saorderamount.add(costamount);
|
|
|
-
|
|
|
+ if(!controller.siteid.equalsIgnoreCase("CCYOSG")){
|
|
|
+ //查询定制费用
|
|
|
+ sql = "SELECT ifnull(sum(costamount),0) costamount from sa_order_cost WHERE sa_orderid=" + sa_orderid;
|
|
|
+ BigDecimal costamount = dbConnect.runSqlQuery(0, sql).getBigDecimal("costamount");
|
|
|
+ saorderamount = saorderamount.add(costamount);
|
|
|
+ }
|
|
|
|
|
|
BigDecimal balance = agentdecorationtrebatRows.get(0).getBigDecimal("balance");
|
|
|
BigDecimal brate = agentdecorationtrebatRows.get(0).getBigDecimal("brate");
|
|
|
@@ -307,13 +308,13 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
sqlFactory.addParameter("siteid", controller.siteid);
|
|
|
sqlFactory.addParameter("sa_orderid", sa_orderid);
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
- if (rows.isEmpty()) {
|
|
|
+ if(rows.isEmpty()){
|
|
|
//清空费用表
|
|
|
DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(controller, "sa_order_cost");
|
|
|
deleteSQL.setWhere("sa_orderid", sa_orderid);
|
|
|
deleteSQL.delete();
|
|
|
}
|
|
|
- if (rows.isNotEmpty()) {
|
|
|
+ if(rows.isNotEmpty()){
|
|
|
DataFunction df = DataFunction.get(controller, rows.get(0).getString("functionname"));
|
|
|
df.addParameter("sa_orderid", sa_orderid);
|
|
|
df.action();
|
|
|
@@ -386,9 +387,9 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
}
|
|
|
}
|
|
|
RowsMap pRowsMap = promotionitems.toRowsMap("sa_promotion_itemsid");
|
|
|
- long sa_promotionid = 0;
|
|
|
- if (promotionitems.isNotEmpty()) {
|
|
|
- sa_promotionid = promotionitems.get(0).getLong("sa_promotionid");
|
|
|
+ long sa_promotionid =0;
|
|
|
+ if(promotionitems.isNotEmpty()){
|
|
|
+ sa_promotionid = promotionitems.get(0).getLong("sa_promotionid");
|
|
|
}
|
|
|
if (type.equals("促销订单")) {
|
|
|
if (pRowsMap.containsKey(item.getString("sa_promotion_itemsid"))) {
|
|
|
@@ -399,9 +400,9 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
BigDecimal orderaddqty = pRowsMap.get(saPromotionItemsid).get(0).getBigDecimal("orderaddqty");
|
|
|
BigDecimal orderminqty = pRowsMap.get(saPromotionItemsid).get(0).getBigDecimal("orderminqty");
|
|
|
boolean islimit = pRowsMap.get(saPromotionItemsid).get(0).getBoolean("islimit");
|
|
|
- Rows rows = dbConnect.runSqlQuery("select * from sa_promotion where sa_promotionid=" + sa_promotionid);
|
|
|
- if (rows.isNotEmpty()) {
|
|
|
- if (!rows.get(0).getString("type").equals("套餐活动")) {
|
|
|
+ Rows rows =dbConnect.runSqlQuery("select * from sa_promotion where sa_promotionid="+sa_promotionid);
|
|
|
+ if(rows.isNotEmpty()){
|
|
|
+ if(!rows.get(0).getString("type").equals("套餐活动")){
|
|
|
if (orderaddqty.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
if (((qty.subtract(orderminqty)).remainder(orderaddqty)).compareTo(BigDecimal.ZERO) != 0 || qty.compareTo(orderminqty) < 0) {
|
|
|
throw new YosException(false, "品号为" + itemRowsMap.get(itemid).get(0).getString("itemno") + "的商品数量不符合该商品的起订量和增量");
|
|
|
@@ -506,8 +507,8 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
|
|
|
if (!length.equals("0") && !width.equals("0")) {
|
|
|
String size = "尺寸:" + length + "×" + width;
|
|
|
- if (!height.equals("0")) {
|
|
|
- size = size + "×" + height;
|
|
|
+ if(!height.equals("0")){
|
|
|
+ size=size+"×"+height;
|
|
|
}
|
|
|
if (str.isEmpty()) {
|
|
|
str = size;
|
|
|
@@ -539,10 +540,9 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
spec = itemRowsMap.get(itemid).get(0).getString("spec");
|
|
|
} else {
|
|
|
spec = item.getStringValue("length") + "*" + item.getStringValue("width");
|
|
|
- if (!item.getStringValue("height").isEmpty()) {
|
|
|
- spec = spec + "*" + item.getStringValue("height");
|
|
|
+ if(!item.getStringValue("height").isEmpty()){
|
|
|
+ spec=spec+ "*" + item.getStringValue("height");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -595,7 +595,7 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
|
|
|
public InsertSQL getInsertSQL(JSONArray customproperties, long sa_orderitemsid, JSONObject item, Row itemRow, String type,
|
|
|
BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice, BigDecimal marketprice,
|
|
|
- String spec, Rows promotionitems, long width, long length) throws YosException {
|
|
|
+ String spec, Rows promotionitems,long width,long length) throws YosException {
|
|
|
Long itemid = item.getLong("itemid");
|
|
|
BigDecimal qty = item.getBigDecimalValue("qty");
|
|
|
RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("sa_promotion_itemsid");
|
|
|
@@ -691,7 +691,7 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
return insertSQL;
|
|
|
}
|
|
|
|
|
|
- public UpdateSQL getUpdateSQL(long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice, long width, long length) throws YosException {
|
|
|
+ public UpdateSQL getUpdateSQL(long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice,long width,long length) throws YosException {
|
|
|
BigDecimal qty = item.getBigDecimalValue("qty");
|
|
|
|
|
|
UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_orderitems);
|
|
|
@@ -775,7 +775,7 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
BigDecimal price;
|
|
|
switch (type) {
|
|
|
case "促销订单":
|
|
|
- price = itemPrice.getPromotionPrice(sa_promotionid, item.getLong("sa_promotion_itemsid"));
|
|
|
+ price = itemPrice.getPromotionPrice(sa_promotionid,item.getLong("sa_promotion_itemsid"));
|
|
|
if (itemRowsMap.containsKey(item.getString("itemid"))) {
|
|
|
if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {
|
|
|
if (itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize") && itemRowsMap.get(item.getString("itemid")).get(0).getLong("pricingmetod") == 1) {
|
|
|
@@ -800,7 +800,7 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
return price;
|
|
|
}
|
|
|
|
|
|
- public BigDecimal getSalePrice(Row orderRow, ItemPrice itemPrice, JSONObject item, RowsMap itemRowsMap) throws YosException {
|
|
|
+ public BigDecimal getSalePrice(Row orderRow, ItemPrice itemPrice,JSONObject item,RowsMap itemRowsMap) throws YosException {
|
|
|
BigDecimal price = itemPrice.getGraderateprice();
|
|
|
if (itemRowsMap.containsKey(item.getString("itemid"))) {
|
|
|
if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {
|