Explorar o código

订单手工关闭bug修复

hu %!s(int64=3) %!d(string=hai) anos
pai
achega
e199e0e49a

+ 1 - 0
src/custom/restcontroller/webmanage/sale/dispatch/dispatchItems.java

@@ -79,6 +79,7 @@ public class dispatchItems extends Controller {
                 where.append(" and(");
                 where.append("t1.itemname like'%").append(whereObject.getString("condition")).append("%' ");
                 where.append("or t1.itemno like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.unit like'%").append(whereObject.getString("condition")).append("%' ");
                 where.append(")");
             }
             if (whereObject.containsKey("sa_orderid") && !"".equals(whereObject.getString("sa_orderid"))) {

+ 6 - 2
src/custom/restcontroller/webmanage/sale/order/Order.java

@@ -2390,6 +2390,10 @@ public class Order extends Controller {
         if (orderRow.isEmpty()) {
             return getErrReturnObject().setErrMsg("订单不存在").toString();
         }
+        if (orderRow.get(0).getString("status").equals("关闭")) {
+            return getErrReturnObject().setErrMsg("订单已关闭,无法再次手工关闭").toString();
+        }
+
 
         Long sys_enterpriseid = orderRow.get(0).getLong("sys_enterpriseid");
         Long sa_accountclassid = orderRow.get(0).getLong("sa_accountclassid");
@@ -2406,10 +2410,10 @@ public class Order extends Controller {
             BigDecimal totalprice = rows.get(0).getBigDecimal("totalprice");
             if (totalprice.compareTo(BigDecimal.ZERO) > 0) {
                 CashbillEntity entity = new CashbillEntity();
-                entity.setAmount(totalprice);
+                entity.setAmount(totalprice.negate());
                 entity.setOwnerid(sa_orderid);
                 entity.setOwnertable("sa_order");
-                Accountbalance.createCashbillIncome(this, sys_enterpriseid, sa_accountclassid, entity, true);
+                sqlList.addAll(Accountbalance.createCashbillPay(this, sys_enterpriseid, sa_accountclassid, entity, true)) ;
             }
 
         }