|
@@ -256,7 +256,7 @@ public class Order extends Controller {
|
|
|
return selectDetail();
|
|
|
}
|
|
|
|
|
|
- @API(title = "购物车转化订单", apiversion = R.ID20221128183202.v1.class,intervaltime = 2000)
|
|
|
+ @API(title = "购物车转化订单", apiversion = R.ID20221128183202.v1.class, intervaltime = 2000)
|
|
|
@CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class})
|
|
|
public String ship() throws YosException {
|
|
|
ArrayList<String> sqlList1 = new ArrayList<>();
|
|
@@ -1492,8 +1492,8 @@ public class Order extends Controller {
|
|
|
//促销订单:提交时商品必须是上架状态,并且活动方案中的商品必须也是上架状态,否则不允许提交
|
|
|
if (type.equals("促销订单")) {
|
|
|
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")){
|
|
|
+ if (promotionauthRows.isNotEmpty()) {
|
|
|
+ if (promotionauthRows.get(0).getBoolean("settlestatus")) {
|
|
|
return getErrReturnObject().setErrMsg("该促销活动已返利完结,无法提交,请删除或联系总部。").toString();
|
|
|
}
|
|
|
}
|
|
@@ -1503,23 +1503,23 @@ public class Order extends Controller {
|
|
|
|
|
|
if (type.equals("标准订单") || type.equals("促销订单")) {
|
|
|
Rows orderiteminfos = dbConnect.runSqlQuery("select t1.* from sa_orderitems t1 where t1.sa_orderid=" + sa_orderid + " and t1.siteid='" + siteid + "'");
|
|
|
- JSONArray jsonArray =new JSONArray();
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
//批量查询商品信息
|
|
|
- for (Row orderiteminfo :orderiteminfos) {
|
|
|
- JSONObject jsonObject =new JSONObject();
|
|
|
- jsonObject.put("itemid",orderiteminfo.getLong("itemid"));
|
|
|
+ for (Row orderiteminfo : orderiteminfos) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("itemid", orderiteminfo.getLong("itemid"));
|
|
|
jsonArray.add(jsonObject);
|
|
|
}
|
|
|
RowsMap itemRowsMap = orderItemsHelper.getItemRowsMap(jsonArray);
|
|
|
for (Row row1 : orderiteminfos) {
|
|
|
ItemPrice itemPrice = ItemPrice.getItemPrice(this, rows.get(0).getLong("sys_enterpriseid"), row1.getLong("itemid"));
|
|
|
if (row1.getBigDecimal("saleprice").compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- JSONObject item =new JSONObject();
|
|
|
- item.put("itemid",row1.getString("itemid"));
|
|
|
- item.put("length",row1.getString("length"));
|
|
|
- item.put("width",row1.getString("width"));
|
|
|
+ JSONObject item = new JSONObject();
|
|
|
+ item.put("itemid", row1.getString("itemid"));
|
|
|
+ item.put("length", row1.getString("length"));
|
|
|
+ item.put("width", row1.getString("width"));
|
|
|
|
|
|
- if (orderItemsHelper.getSalePrice(rows.get(0), itemPrice,item,itemRowsMap).compareTo(row1.getBigDecimal("saleprice")) != 0) {
|
|
|
+ if (orderItemsHelper.getSalePrice(rows.get(0), itemPrice, item, itemRowsMap).compareTo(row1.getBigDecimal("saleprice")) != 0) {
|
|
|
return getErrReturnObject().setErrMsg("商品:" + row1.getString("itemno") + "销售价格有更新,请删除后重新添加!").toString();
|
|
|
}
|
|
|
}
|
|
@@ -1677,7 +1677,7 @@ public class Order extends Controller {
|
|
|
}
|
|
|
JSONObject cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), entity, true);
|
|
|
// sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
|
|
|
- ArrayList<String> sqlList2= (ArrayList<String>) cashbillPay.getJSONArray("sqlList").toJavaList(String.class);
|
|
|
+ ArrayList<String> sqlList2 = (ArrayList<String>) cashbillPay.getJSONArray("sqlList").toJavaList(String.class);
|
|
|
dbConnect.runSqlUpdate(sqlList2);
|
|
|
sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
|
|
|
|
|
@@ -1716,7 +1716,7 @@ public class Order extends Controller {
|
|
|
CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "订单提交", sonum, "由" + sonum + "订单提交时自动产生");
|
|
|
JSONObject cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true);
|
|
|
// sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
|
|
|
- ArrayList<String> sqlList2= (ArrayList<String>) cashbillPay.getJSONArray("sqlList").toJavaList(String.class);
|
|
|
+ ArrayList<String> sqlList2 = (ArrayList<String>) cashbillPay.getJSONArray("sqlList").toJavaList(String.class);
|
|
|
dbConnect.runSqlUpdate(sqlList2);
|
|
|
sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
|
|
|
|
|
@@ -3452,7 +3452,14 @@ public class Order extends Controller {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- Rows rows = dbConnect.runSqlQuery("SELECT cast(sum(undeliqty*price) as DECIMAL(16,2)) totalprice from sa_orderitems WHERE sa_orderid=" + sa_orderid + " and siteid = '" + siteid + "'");
|
|
|
+ //已发货数量
|
|
|
+ BigDecimal deliedqty = BigDecimal.ZERO;
|
|
|
+ Rows rows = dbConnect.runSqlQuery("SELECT ifnull(sum(deliedqty),0) deliedqty from sa_orderitems WHERE sa_orderid=" + sa_orderid + " and siteid = '" + siteid + "'");
|
|
|
+ if (rows.isNotEmpty()) {
|
|
|
+ deliedqty = rows.get(0).getBigDecimal("deliedqty");
|
|
|
+ }
|
|
|
+
|
|
|
+ rows = dbConnect.runSqlQuery("SELECT cast(sum(undeliqty*price) as DECIMAL(16,2)) totalprice from sa_orderitems WHERE sa_orderid=" + sa_orderid + " and siteid = '" + siteid + "'");
|
|
|
ArrayList<Long> sa_cashbillidList = new ArrayList<>();
|
|
|
if (rows.isNotEmpty()) {
|
|
|
BigDecimal totalprice = rows.get(0).getBigDecimal("totalprice");
|
|
@@ -3473,6 +3480,9 @@ public class Order extends Controller {
|
|
|
sa_promotion_authid = promotion_auth.get(0).getLong("sa_promotion_authid");
|
|
|
}
|
|
|
BigDecimal amount_orderaccount = orderaccountclassinfo.getBigDecimalValue("amount", 0);
|
|
|
+ if (deliedqty.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ totalprice = amount_orderaccount;
|
|
|
+ }
|
|
|
if (amount_orderaccount.compareTo(totalprice) >= 0) {
|
|
|
System.out.println("1111");
|
|
|
CashbillEntity entity = new CashbillEntity();
|