Browse Source

订单生成凭证添加sourcenote

hu 2 năm trước cách đây
mục cha
commit
8513a3bd21

BIN
lib/yos.core-2.1.0-sources.jar


BIN
lib/yos.core-2.1.0.jar


+ 20 - 18
src/custom/restcontroller/webmanage/sale/order/Order.java

@@ -1289,7 +1289,7 @@ public class Order extends Controller {
                     for (Object object : accountclassinfos) {
                         JSONObject jsonObject = (JSONObject) object;
                         if (Accountbalance.judgeBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), jsonObject.getBigDecimal("amount"))) {
-                            CashbillEntity entity = getCashbillEntity(jsonObject.getBigDecimal("amount"), sa_orderid, "订单提交", "由" + sonum + "订单提交时," + jsonObject.getString("accountname") + "账户自动支出产生");
+                            CashbillEntity entity = getCashbillEntity(jsonObject.getBigDecimal("amount"), sa_orderid, "订单提交", sonum,"由" + sonum + "订单提交时," + jsonObject.getString("accountname") + "账户自动支出产生");
                             //
                             if (accountclassrowsMap.containsKey(jsonObject.getString("sa_accountclassid")) && accountclassrowsMap.get(jsonObject.getString("sa_accountclassid")).isNotEmpty()) {
                                 jsonObject.put("balance", accountclassrowsMap.get(jsonObject.getString("sa_accountclassid")).get(0).getBigDecimal("balance").subtract(jsonObject.getBigDecimal("amount")));
@@ -1304,7 +1304,7 @@ public class Order extends Controller {
                     }
                 } else {
                     if (Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
-                        CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "订单提交", "由" + sonum + "订单提交时自动产生");
+                        CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "订单提交",sonum, "由" + sonum + "订单提交时自动产生");
                         sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
                     } else {
                         return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, sa_accountclassid, amount) + "元!").toString();
@@ -1358,7 +1358,7 @@ public class Order extends Controller {
         //金额=金额-返利金金额
         BigDecimal amount = beans.order.Order.getAmount(this, sa_orderid);
         //创建支出凭证
-        CashbillEntity entity = getCashbillEntity(amount, sa_orderid, source, "由" + sonum + source + "时自动产生");
+        CashbillEntity entity = getCashbillEntity(amount, sa_orderid, source,sonum, "由" + sonum + source + "时自动产生");
         sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
         //创建返利金支出凭证
         Rows cashbillRows = dbConnect.runSqlQuery("SELECT * from sa_cashbill WHERE class='返利金' and STATUS ='审核' and rebate_enddate>=CURRENT_TIME and rebate_balance>0 and sys_enterpriseid= " + pay_enterpriseid + " and siteid = '" + siteid + "'  ORDER BY  rebate_enddate ");
@@ -1374,7 +1374,7 @@ public class Order extends Controller {
 
             //返利代金券小于返利金金额,例如:rebate_balance:10,rebateamount:50
             if (rebate_balance.compareTo(rebateamount) == -1) {
-                entity2 = getCashbillEntity(rebate_balance, sa_orderid, source, "【返利金】由" + sonum + source + "时自动产生");
+                entity2 = getCashbillEntity(rebate_balance, sa_orderid, source,sonum,"【返利金】由" + sonum + source + "时自动产生");
                 rebateamount = rebateamount.subtract(rebate_balance);
                 rebate_balance = BigDecimal.ZERO;
 
@@ -1382,14 +1382,14 @@ public class Order extends Controller {
             }
             //返利代金券等于返利金金额
             if (rebate_balance.compareTo(rebateamount) == 0) {
-                entity2 = getCashbillEntity(rebate_balance, sa_orderid, source, "【返利金】由" + sonum + source + "时自动产生");
+                entity2 = getCashbillEntity(rebate_balance, sa_orderid, source,sonum, "【返利金】由" + sonum + source + "时自动产生");
                 rebateamount = BigDecimal.ZERO;
                 rebate_balance = BigDecimal.ZERO;
 
             }
             //返利代金券大于返利金金额
             if (rebate_balance.compareTo(rebateamount) == 1) {
-                entity2 = getCashbillEntity(rebateamount, sa_orderid, source, "【返利金】由" + sonum + source + "时自动产生");
+                entity2 = getCashbillEntity(rebateamount, sa_orderid, source, sonum,"【返利金】由" + sonum + source + "时自动产生");
                 rebate_balance = rebate_balance.subtract(rebateamount);
                 rebateamount = BigDecimal.ZERO;
 
@@ -1474,7 +1474,7 @@ public class Order extends Controller {
                     for (Object object : accountclassinfos) {
                         JSONObject jsonObject = (JSONObject) object;
                         if (Accountbalance.judgeBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), jsonObject.getBigDecimal("amount"))) {
-                            CashbillEntity entity = getCashbillEntity(jsonObject.getBigDecimal("amount"), sa_orderid, "订单审核", "由" + sonum + "订单审核时," + jsonObject.getString("accountname") + "账户自动支出产生");
+                            CashbillEntity entity = getCashbillEntity(jsonObject.getBigDecimal("amount"), sa_orderid, "订单审核",sonum, "由" + sonum + "订单审核时," + jsonObject.getString("accountname") + "账户自动支出产生");
                             jsonObject.put("balance", jsonObject.getBigDecimalValue("balance").subtract(jsonObject.getBigDecimal("amount")));
                             sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), entity, true));
                         } else {
@@ -1483,7 +1483,7 @@ public class Order extends Controller {
                     }
                 } else {
                     if (Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
-                        CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "订单审核", "由" + sonum + "订单审核时自动产生");
+                        CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "订单审核", sonum,"由" + sonum + "订单审核时自动产生");
                         sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
                     } else {
                         return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, sa_accountclassid, amount) + "元!").toString();
@@ -1548,7 +1548,7 @@ public class Order extends Controller {
         //订单扣款节点(1:订单提交、2:订单审核)
         String order_paymentnode = Parameter.get(siteid, "order_paymentnode");
         if (order_paymentnode.equals("2")) {
-            sqlList.addAll(returnPayBill(row, "订单反审核", "由" + sonum + "订单反审核时自动产生"));
+            sqlList.addAll(returnPayBill(row, "订单反审核",sonum, "由" + sonum + "订单反审核时自动产生"));
         }
 
 
@@ -1748,7 +1748,7 @@ public class Order extends Controller {
 //            sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
 //        }
 
-        sqlList.addAll(returnPayBill(row, "订单退回", "由" + sonum + "订单退回时自动产生"));
+        sqlList.addAll(returnPayBill(row, "订单退回",sonum, "由" + sonum + "订单退回时自动产生"));
 
         String message = "您的订单【" + sonum + "】已退回,退款金额为【" + amount + "】 已转入到您的资金账户";
 
@@ -1811,7 +1811,7 @@ public class Order extends Controller {
         }
 
 
-        sqlList.addAll(returnPayBill(row, "订单撤回", "由" + sonum + "订单撤回时自动产生"));
+        sqlList.addAll(returnPayBill(row, "订单撤回", sonum,"由" + sonum + "订单撤回时自动产生"));
 
         String message = "您的订单【" + sonum + "】 金额为【" + amount + "】 已撤回!";
 
@@ -1937,7 +1937,7 @@ public class Order extends Controller {
         //订单扣款节点(1:订单提交、2:订单审核)
         String order_paymentnode = Parameter.get(siteid, "order_paymentnode");
         if (order_paymentnode.equals("2")) {
-            sqlList.addAll(returnPayBill(row, "订单_交期撤回", "由" + sonum + "订单交期撤回时自动产生"));
+            sqlList.addAll(returnPayBill(row, "订单_交期撤回",sonum, "由" + sonum + "订单交期撤回时自动产生"));
         }
 
         sqlList.add(DataContrlLog.createLog(this, "sa_order", sa_orderid, "订单交期撤回", "订单交期撤回:" + amount).getSQL());
@@ -1947,7 +1947,7 @@ public class Order extends Controller {
     }
 
 
-    public ArrayList<String> returnPayBill(Row orderrow, String source, String remarks) throws YosException {
+    public ArrayList<String> returnPayBill(Row orderrow, String source, String sourcenotes, String remarks) throws YosException {
         Long sa_orderid = orderrow.getLong("sa_orderid");
         JSONArray sa_accountclassinfos = orderrow.getJSONArray("sa_accountclassinfos");
         //Long sa_accountclassid = orderrow.getLong("sa_accountclassid");
@@ -1962,7 +1962,7 @@ public class Order extends Controller {
                 amount = rebateRow.getBigDecimal("amount");
                 if (amount.compareTo(BigDecimal.ZERO) > 0) {
                     Long sa_cashbillid_rebate = rebateRow.getLong("sa_cashbillid_rebate");
-                    CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, source, "【返利金】" + remarks);
+                    CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, source,sourcenotes, "【返利金】" + remarks);
                     sqlList.addAll(beans.order.Order.createRebateBillPay(this, entity, pay_enterpriseid, sa_cashbillid_rebate));
                 }
             }
@@ -1987,7 +1987,7 @@ public class Order extends Controller {
                     }
                 }
                 if (amount.compareTo(BigDecimal.ZERO) > 0) {
-                    CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, source, remarks);
+                    CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, source,sourcenotes, remarks);
                     sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, row.getLong("sa_accountclassid"), entity, true));
                 }
             }
@@ -2711,21 +2711,23 @@ public class Order extends Controller {
 
 
     /**
-     * 创建凭证实体
-     *
+     *  创建凭证实体
      * @param amount
      * @param ownerid
      * @param source
+     * @param sourcenotes
+     * @param remarks
      * @return
      * @throws YosException
      */
-    public CashbillEntity getCashbillEntity(BigDecimal amount, Long ownerid, String source, String remarks) throws YosException {
+    public CashbillEntity getCashbillEntity(BigDecimal amount, Long ownerid, String source, String sourcenotes,String remarks) throws YosException {
         CashbillEntity entity = new CashbillEntity();
         entity.setAmount(amount);
         entity.setOwnerid(ownerid);
         entity.setOwnertable("sa_order");
         entity.setSource(source);
         entity.setRemarks(remarks);
+        entity.setSourcenote(sourcenotes);
         return entity;
 
     }