|
|
@@ -323,6 +323,59 @@ public class OrderItems extends Controller {
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
+ @API(title = "商品行冻结", apiversion = R.ID20230508093003.v1.class)
|
|
|
+ @CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, ToolBill.class})
|
|
|
+ public String freeze() throws YosException {
|
|
|
+ Long sa_orderid = content.getLong("sa_orderid");
|
|
|
+ JSONArray sa_orderitemsids = content.getJSONArray("sa_orderitemsids");
|
|
|
+ boolean isfreeze=content.getBooleanValue("isfreeze");
|
|
|
+ Rows orderRows = dbConnect.runSqlQuery("select * from sa_order where sa_orderid="+sa_orderid+ " and siteid='"+siteid+"'");
|
|
|
+ if(!orderRows.isEmpty()){
|
|
|
+
|
|
|
+ if(!orderRows.get(0).getString("status").equals("审核")){
|
|
|
+ if(isfreeze){
|
|
|
+ return getErrReturnObject().setErrMsg("非审核状态无法进行冻结").toString();
|
|
|
+ }else {
|
|
|
+ return getErrReturnObject().setErrMsg("非审核状态无法进行反冻结").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ return getErrReturnObject().setErrMsg("该订单不存在").toString();
|
|
|
+ }
|
|
|
+ SQLFactory sqlFactory;
|
|
|
+ if(isfreeze){
|
|
|
+ sqlFactory = new SQLFactory(this, "订单商品明细_冻结");
|
|
|
+ }else {
|
|
|
+ sqlFactory = new SQLFactory(this, "订单商品明细_反冻结");
|
|
|
+ }
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter_in("sa_orderitemsid", sa_orderitemsids.toArray());
|
|
|
+ String sql = sqlFactory.getSQL();
|
|
|
+ System.out.println(sql);
|
|
|
+ dbConnect.runSqlUpdate(sql);
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "商品行折扣变更", apiversion = R.ID20230508101703.v1.class)
|
|
|
+ @CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, ToolBill.class})
|
|
|
+ public String updateOrderItemsDiscountrate() throws YosException {
|
|
|
+ Long sa_orderid = content.getLong("sa_orderid");
|
|
|
+ BigDecimal discountrate =content.getBigDecimal("discountrate");
|
|
|
+
|
|
|
+ Rows orderItemsRows = dbConnect.runSqlQuery("select * from sa_orderitems where sa_orderid="+sa_orderid+ " and siteid='"+siteid+"'");
|
|
|
+ ArrayList<String> sqlList =new ArrayList<>();
|
|
|
+ if(!orderItemsRows.isEmpty()){
|
|
|
+ for (Row row :orderItemsRows) {
|
|
|
+ BigDecimal price =row.getBigDecimal("price").multiply(discountrate);
|
|
|
+ BigDecimal amount =row.getBigDecimal("amount").multiply(discountrate);
|
|
|
+ sqlList.add("update sa_orderitems set price="+price+",amount="+amount+" where sa_orderitemsid="+row.getLong("sa_orderitemsid"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
@API(title = "关闭", apiversion = R.ID20221109093802.v1.class)
|
|
|
@CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class})
|
|
|
public String close() throws YosException {
|