|
|
@@ -0,0 +1,52 @@
|
|
|
+package beans.order;
|
|
|
+
|
|
|
+import common.BaseClass;
|
|
|
+import common.Controller;
|
|
|
+import common.YosException;
|
|
|
+import common.data.QuerySQL;
|
|
|
+import common.data.Rows;
|
|
|
+import common.data.RowsMap;
|
|
|
+import common.data.SQLFactory;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 销售订单费用明细
|
|
|
+ */
|
|
|
+public class OrderCost extends BaseClass {
|
|
|
+
|
|
|
+ //根据商品方案计算订单明细费用
|
|
|
+ //单位费用:数值(具体一个方案生成的一个单位费用)
|
|
|
+ //订单类型:类型(可多个,具体在哪些订单类型中适用)
|
|
|
+ //计算方式:是否订单内组合计算(若组合计算则在订单中自动汇总同方案商品一起计算)、是否累加计算(若累加计算则订单内满足时则生成费用)
|
|
|
+ //费用分摊:分摊方式(订货数量/订货金额,在组合计算方式下,在订单中同费用方案商品明细行中按比例分摊)
|
|
|
+ //计算规则:商品字段(订货数量、订货重量、订货金额)、满足条件(数值,大于等于某个值时产生费用)
|
|
|
+ //扣款方式:是否独立扣款(独立扣款则在生成订单收支凭证时费用,若生成独立的支出凭证则需再选择支出分类)
|
|
|
+ //退款规则:是否可退款
|
|
|
+ public static void calculateCostAmount(Controller controller, Long sa_orderid) throws YosException {
|
|
|
+ //查询商品是否存在方案
|
|
|
+ Rows rows = queryDataFunction(controller, sa_orderid);
|
|
|
+ if (rows.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询订单的商品方案
|
|
|
+ public static Rows queryDataFunction(Controller controller, Long sa_orderid) throws YosException {
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(controller, "sa_orderitems",
|
|
|
+ "sa_orderid", "sa_orderitemsid", "itemid");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "sys_datafunction_bind", "t2", "t2.ownerid=t1.itemid and t2.ownertable='plm_item'",
|
|
|
+ "sys_datafunctionid");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "sys_datafunction", "t3", "sys_datafunctionid=t2.sys_datafunctionid",
|
|
|
+ "functionname");
|
|
|
+ querySQL.setWhere("t1.sa_orderid", sa_orderid);
|
|
|
+ querySQL.setTableAlias("t1");
|
|
|
+ return querySQL.query();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|