|
|
@@ -22,7 +22,6 @@ import common.annotation.CACHEING;
|
|
|
import common.annotation.CACHEING_CLEAN;
|
|
|
import common.data.*;
|
|
|
import common.data.db.DBConnect;
|
|
|
-import common.data.db.SQLiteTable;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import restcontroller.R;
|
|
|
import restcontroller.sale.cashbill.cashbill;
|
|
|
@@ -32,10 +31,12 @@ import restcontroller.webmanage.executorService.Executor;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
|
|
|
import static beans.order.Order.*;
|
|
|
-import static com.alibaba.fastjson.util.TypeUtils.castToBigDecimal;
|
|
|
|
|
|
/**
|
|
|
* 销售订单
|
|
|
@@ -667,8 +668,8 @@ public class Order extends Controller {
|
|
|
row.replace("defaultamount", row.getBigDecimal("defaultamount").add(costamount));
|
|
|
|
|
|
//订单套餐
|
|
|
- Rows packagetypemxrows =dbConnect.runSqlQuery("select t2.packagetypemx,min(t1.qty/t2.orderminqty) packagetypeqty from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='"+siteid+"' and t1.sa_orderid="+sa_orderid+" and ifnull(t2.packagetypemx,'')!='' group by t2.packagetypemx");
|
|
|
- row.put("packagetypemxrows",packagetypemxrows);
|
|
|
+ Rows packagetypemxrows = dbConnect.runSqlQuery("select t2.packagetypemx,min(t1.qty/t2.orderminqty) packagetypeqty from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.sa_orderid=" + sa_orderid + " and ifnull(t2.packagetypemx,'')!='' group by t2.packagetypemx");
|
|
|
+ row.put("packagetypemxrows", packagetypemxrows);
|
|
|
return getSucReturnObject().setData(row).toString();
|
|
|
}
|
|
|
|
|
|
@@ -812,7 +813,7 @@ public class Order extends Controller {
|
|
|
|
|
|
// SQLFactory ischangeSQl = new SQLFactory("sql:SELECT distinct sa_orderid from sa_orderitems_change WHERE siteid='" + siteid + "' and sa_orderid in $sa_orderids$ ");
|
|
|
// ischangeSQl.addParameter_in("sa_orderids", rows.toArrayList("sa_orderid"));
|
|
|
- ArrayList<Long> ischangesa_orderidList = dbConnect.runSqlQuery("SELECT distinct sa_orderid from sa_orderitems_change WHERE siteid='" + siteid + "' and sa_orderid in"+rows.toArrayList("sa_orderid").toString().replace("[", "(").replace("]", ")")).toArrayList("sa_orderid", new ArrayList<>());
|
|
|
+ ArrayList<Long> ischangesa_orderidList = dbConnect.runSqlQuery("SELECT distinct sa_orderid from sa_orderitems_change WHERE siteid='" + siteid + "' and sa_orderid in" + rows.toArrayList("sa_orderid").toString().replace("[", "(").replace("]", ")")).toArrayList("sa_orderid", new ArrayList<>());
|
|
|
|
|
|
for (Row row : rows) {
|
|
|
Long id = row.getLong("sa_orderid");
|
|
|
@@ -977,7 +978,7 @@ public class Order extends Controller {
|
|
|
|
|
|
// SQLFactory ischangeSQl = new SQLFactory("sql:SELECT distinct sa_orderid from sa_orderitems_change WHERE siteid='" + siteid + "' and sa_orderid in $sa_orderids$ ");
|
|
|
// ischangeSQl.addParameter_in("sa_orderids", rows.toArrayList("sa_orderid"));
|
|
|
- ArrayList<Long> ischangesa_orderidList = dbConnect.runSqlQuery("SELECT distinct sa_orderid from sa_orderitems_change WHERE siteid='" + siteid + "' and sa_orderid in "+rows.toArrayList("sa_orderid").toString().replace("[", "(").replace("]", ")")).toArrayList("sa_orderid", new ArrayList<>());
|
|
|
+ ArrayList<Long> ischangesa_orderidList = dbConnect.runSqlQuery("SELECT distinct sa_orderid from sa_orderitems_change WHERE siteid='" + siteid + "' and sa_orderid in " + rows.toArrayList("sa_orderid").toString().replace("[", "(").replace("]", ")")).toArrayList("sa_orderid", new ArrayList<>());
|
|
|
|
|
|
for (Row row : rows) {
|
|
|
Long id = row.getLong("sa_orderid");
|
|
|
@@ -1275,7 +1276,9 @@ public class Order extends Controller {
|
|
|
sqlList.add(DataContrlLog.createLog(this, "sa_order", sa_orderid, "删除", "订单删除").getSQL());
|
|
|
}
|
|
|
dbConnect.runSqlUpdate(sqlList);
|
|
|
- ClearData.clearOrder(this);
|
|
|
+
|
|
|
+ //伪删除,此步多余,如确实必要仅通过定时任务触发即可,sjw
|
|
|
+ //ClearData.clearOrder(this);
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
@@ -1492,18 +1495,18 @@ public class Order extends Controller {
|
|
|
}
|
|
|
|
|
|
Rows promotionRows = dbConnect.runSqlQuery("SELECT isauth,orderminamount FROM sa_promotion WHERE siteid='" + siteid + "' AND sa_promotionid='" + sa_promotionid + "'");
|
|
|
- if(promotionRows.isNotEmpty()){
|
|
|
- if(amount.compareTo(promotionRows.get(0).getBigDecimal("orderminamount"))<0){
|
|
|
- return getErrReturnObject().setErrMsg("订单未满足最低起订金额:"+promotionRows.get(0).getBigDecimal("orderminamount")+",请勿提交!").toString();
|
|
|
+ if (promotionRows.isNotEmpty()) {
|
|
|
+ if (amount.compareTo(promotionRows.get(0).getBigDecimal("orderminamount")) < 0) {
|
|
|
+ return getErrReturnObject().setErrMsg("订单未满足最低起订金额:" + promotionRows.get(0).getBigDecimal("orderminamount") + ",请勿提交!").toString();
|
|
|
}
|
|
|
}
|
|
|
- if(!promotionRows.get(0).getBoolean("isauth")){
|
|
|
+ if (!promotionRows.get(0).getBoolean("isauth")) {
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "促销方案经销商授权区域查询");
|
|
|
- sqlFactory.addParameter("sys_enterpriseid",sys_enterpriseid);
|
|
|
- sqlFactory.addParameter("siteid",siteid);
|
|
|
+ sqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
Rows spromotionsaleareaRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
RowsMap spromotionsaleareaRowsMap = spromotionsaleareaRows.toRowsMap("sa_promotionid");
|
|
|
- if ((dbConnect.runSqlQuery("SELECT 1 FROM sa_promotion_auth t1 inner join sa_promotion t2 on t1.sa_promotionid=t2.sa_promotionid and t1.siteid=t2.siteid WHERE if(t2.authmethod=1,not exists(select 1 from sa_promotion_auth where sa_promotionid=t1.sa_promotionid and sys_enterpriseid= "+sys_enterpriseid+"),t1.sys_enterpriseid= "+sys_enterpriseid+") AND t1.siteid='" + siteid + "' AND t1.sa_promotionid='" + sa_promotionid + "'").isEmpty() && !spromotionsaleareaRowsMap.containsKey(String.valueOf(sa_promotionid)))) {
|
|
|
+ if ((dbConnect.runSqlQuery("SELECT 1 FROM sa_promotion_auth t1 inner join sa_promotion t2 on t1.sa_promotionid=t2.sa_promotionid and t1.siteid=t2.siteid WHERE if(t2.authmethod=1,not exists(select 1 from sa_promotion_auth where sa_promotionid=t1.sa_promotionid and sys_enterpriseid= " + sys_enterpriseid + "),t1.sys_enterpriseid= " + sys_enterpriseid + ") AND t1.siteid='" + siteid + "' AND t1.sa_promotionid='" + sa_promotionid + "'").isEmpty() && !spromotionsaleareaRowsMap.containsKey(String.valueOf(sa_promotionid)))) {
|
|
|
return getErrReturnObject().setErrMsg("该促销活动已过期,无法提交").toString();
|
|
|
}
|
|
|
}
|
|
|
@@ -1533,9 +1536,9 @@ public class Order extends Controller {
|
|
|
}
|
|
|
//促销订单:提交时商品必须是上架状态,并且活动方案中的商品必须也是上架状态,否则不允许提交
|
|
|
if (type.equals("促销订单")) {
|
|
|
- Rows promotionitemsRows = dbConnect.runSqlQuery("select t2.itemno from sa_promotion_items t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.sa_promotionid=" + sa_promotionid + " and t1.siteid='" + siteid + "' and t1.isonsale=0 and t1.itemid in(select itemid from sa_orderitems where sa_orderid="+sa_orderid+")");
|
|
|
- if(promotionitemsRows.isNotEmpty()){
|
|
|
- return getErrReturnObject().setErrMsg("商品:"+promotionitemsRows.get(0).getString("itemno")+"已下架,无法提交。").toString();
|
|
|
+ Rows promotionitemsRows = dbConnect.runSqlQuery("select t2.itemno from sa_promotion_items t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.sa_promotionid=" + sa_promotionid + " and t1.siteid='" + siteid + "' and t1.isonsale=0 and t1.itemid in(select itemid from sa_orderitems where sa_orderid=" + sa_orderid + ")");
|
|
|
+ if (promotionitemsRows.isNotEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("商品:" + promotionitemsRows.get(0).getString("itemno") + "已下架,无法提交。").toString();
|
|
|
}
|
|
|
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()) {
|
|
|
@@ -1637,23 +1640,23 @@ public class Order extends Controller {
|
|
|
Rows promotion = dbConnect.runSqlQuery(" select * from sa_promotion where siteid='" + siteid + "'and sa_promotionid=" + sa_promotionid);
|
|
|
Rows promotion_auth = dbConnect.runSqlQuery(" select * from sa_promotion_auth where siteid='" + siteid + "'and sys_enterpriseid=" + sys_enterpriseid + " and sa_promotionid=" + sa_promotionid);
|
|
|
if (promotion.isNotEmpty()) {
|
|
|
- if(promotion.get(0).getString("type").equals("套餐活动")){
|
|
|
+ if (promotion.get(0).getString("type").equals("套餐活动")) {
|
|
|
ArrayList<Long> sa_promotion_itemsids = new ArrayList<Long>();
|
|
|
sa_promotion_itemsids.add((long) 0);
|
|
|
for (Row orderdetail : orderdetails) {
|
|
|
sa_promotion_itemsids.add(orderdetail.getLong("sa_promotion_itemsid"));
|
|
|
}
|
|
|
- int eachlimitqty=promotion.get(0).getInteger("eachlimitqty");
|
|
|
- if(promotion.get(0).getBoolean("eachneedadd") && eachlimitqty>0){
|
|
|
- String sql ="select ifnull(packagetypemx,'') packagetypemx,count(1) count from sa_promotion_items where siteid='"+siteid+"' and sa_promotionid="+sa_promotionid +" and sa_promotion_itemsid in "+sa_promotion_itemsids +" group by ifnull(packagetypemx,'')";
|
|
|
+ int eachlimitqty = promotion.get(0).getInteger("eachlimitqty");
|
|
|
+ if (promotion.get(0).getBoolean("eachneedadd") && eachlimitqty > 0) {
|
|
|
+ String sql = "select ifnull(packagetypemx,'') packagetypemx,count(1) count from sa_promotion_items where siteid='" + siteid + "' and sa_promotionid=" + sa_promotionid + " and sa_promotion_itemsid in " + sa_promotion_itemsids + " group by ifnull(packagetypemx,'')";
|
|
|
sql = sql.replace("[", "(").replace("]", ")");
|
|
|
Rows promotionItemsRows = dbConnect.runSqlQuery(sql);
|
|
|
- for(Row row1 :promotionItemsRows){
|
|
|
- if(StringUtils.isBlank(row1.getString("packagetypemx"))){
|
|
|
+ for (Row row1 : promotionItemsRows) {
|
|
|
+ if (StringUtils.isBlank(row1.getString("packagetypemx"))) {
|
|
|
return getErrReturnObject().setErrMsg("促销方案维护出错").toString();
|
|
|
}
|
|
|
- if(eachlimitqty!=row1.getInteger("count")){
|
|
|
- return getErrReturnObject().setErrMsg(row1.getString("packagetypemx")+"套餐未满足限购品数"+eachlimitqty+"的要求,禁止创建订单,请修改后重试!").toString();
|
|
|
+ if (eachlimitqty != row1.getInteger("count")) {
|
|
|
+ return getErrReturnObject().setErrMsg(row1.getString("packagetypemx") + "套餐未满足限购品数" + eachlimitqty + "的要求,禁止创建订单,请修改后重试!").toString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2846,7 +2849,7 @@ public class Order extends Controller {
|
|
|
for (Row row : rows) {
|
|
|
Rows rows2 = rowsMap.getOrDefault(row.getString("sa_dispatchid"), new Rows());
|
|
|
if (rows2.isNotEmpty()) {
|
|
|
- row.putIfAbsent("sumamount", rows2.get(0).getBigDecimal("sumamount").setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
+ row.putIfAbsent("sumamount", rows2.get(0).getBigDecimal("sumamount").setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
row.putIfAbsent("sumqty", rows2.get(0).getBigDecimal("sumqty").setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
}
|
|
|
row.putIfAbsent("sumamount", 0);
|
|
|
@@ -2895,7 +2898,7 @@ public class Order extends Controller {
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sa_dispatch_items", "t6", "t6.sa_dispatch_itemsid = t2.sa_dispatch_itemsid AND t6.siteid = t2.siteid");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sa_orderitems", "t7", "t6.sa_orderitemsid = t7.sa_orderitemsid AND t6.siteid = t7.siteid", "sa_orderid");
|
|
|
querySQL.addJoinTable(JOINTYPE.inner, "sa_logistics", "t9", "t9.sa_logisticsid = t1.sa_logisticsid AND t9.siteid = t1.siteid",
|
|
|
- "billno", "billdate", "logisticsstatus","packageqty","logisticsamount","address","remarks");
|
|
|
+ "billno", "billdate", "logisticsstatus", "packageqty", "logisticsamount", "address", "remarks");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
querySQL.setWhere("t9.`status` != '新建'");
|
|
|
querySQL.setWhere(" t7.sa_orderid", sa_orderid);
|
|
|
@@ -2920,14 +2923,14 @@ public class Order extends Controller {
|
|
|
where.append(")");
|
|
|
}
|
|
|
}
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "订单_出库单列表" );
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "订单_出库单列表");
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
sqlFactory.addParameter("sa_orderid", sa_orderid);
|
|
|
// Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
- querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t", "t1.siteid ='111' ","*");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t", "t1.siteid ='111' ", "*");
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
Rows rows = querySQL.query();
|
|
|
@@ -2957,9 +2960,9 @@ public class Order extends Controller {
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
String sql = sqlFactory.getSQL();
|
|
|
// Rows rows = dbConnect.runSqlQuery(sql);
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
querySQL.setTableAlias("t");
|
|
|
- querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "t.siteid = '111' ","*");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "t.siteid = '111' ", "*");
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
Rows rows = querySQL.query();
|
|
|
@@ -2996,12 +2999,12 @@ public class Order extends Controller {
|
|
|
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_invoicebill", "*");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
- querySQL.addQueryFields("sumtaxincludedamount","ifnull((select sum(taxincludedamount) sumtaxincludedamount\n" +
|
|
|
+ querySQL.addQueryFields("sumtaxincludedamount", "ifnull((select sum(taxincludedamount) sumtaxincludedamount\n" +
|
|
|
" from sa_invoicebill_item\n" +
|
|
|
" where sa_invoicebillid = t1.sa_invoicebillid\n" +
|
|
|
" and siteid = t1.siteid), 0)");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
- querySQL.setWhere("t1.sa_invoiceapplyid in (SELECT sa_invoiceapplyid from sa_invoiceapply_order WHERE sa_orderid = '"+sa_orderid+"' and siteid = '"+siteid+"')");
|
|
|
+ querySQL.setWhere("t1.sa_invoiceapplyid in (SELECT sa_invoiceapplyid from sa_invoiceapply_order WHERE sa_orderid = '" + sa_orderid + "' and siteid = '" + siteid + "')");
|
|
|
querySQL.setWhere(where.toString());
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
@@ -3237,16 +3240,16 @@ public class Order extends Controller {
|
|
|
// sqlFactory.addParameter_SQL("where", where);
|
|
|
// Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_writeoffbill", "sa_writeoffbillid", "createuserid",
|
|
|
- "createby", "createdate", "checkby","checkdate","billnodate","status","sys_enterpriseid","remarks","unwriteoffamount","writeoffamount","sa_cashbillid");
|
|
|
+ "createby", "createdate", "checkby", "checkdate", "billnodate", "status", "sys_enterpriseid", "remarks", "unwriteoffamount", "writeoffamount", "sa_cashbillid");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t1.siteid = t2.siteid and t1.sys_enterpriseid = t2.sys_enterpriseid", "enterprisename", "abbreviation");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t5", "t2.siteid = t5.siteid and t2.sys_enterpriseid = t5.sys_enterpriseid","agentnum");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_accountclass", "t3", "t1.siteid = t3.siteid and t1.sa_accountclassid = t3.sa_accountclassid" );
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t5", "t2.siteid = t5.siteid and t2.sys_enterpriseid = t5.sys_enterpriseid", "agentnum");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_accountclass", "t3", "t1.siteid = t3.siteid and t1.sa_accountclassid = t3.sa_accountclassid");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sa_cashbill", "t4", "t1.siteid = t4.siteid and t1.sa_cashbillid = t4.sa_cashbillid");
|
|
|
- querySQL.addQueryFields("writeoffbillidbillno","t1.billno");
|
|
|
- querySQL.addQueryFields("cashbillidbillno","t4.billno");
|
|
|
+ querySQL.addQueryFields("writeoffbillidbillno", "t1.billno");
|
|
|
+ querySQL.addQueryFields("cashbillidbillno", "t4.billno");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
- querySQL.setWhere("t1.sa_writeoffbillid in(SELECT sa_writeoffbillid from sa_writeoffbill_order WHERE sa_orderid = '"+sa_orderid+"' and siteid = '"+siteid+"')");
|
|
|
+ querySQL.setWhere("t1.sa_writeoffbillid in(SELECT sa_writeoffbillid from sa_writeoffbill_order WHERE sa_orderid = '" + sa_orderid + "' and siteid = '" + siteid + "')");
|
|
|
querySQL.setWhere(where.toString());
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
@@ -3279,9 +3282,9 @@ public class Order extends Controller {
|
|
|
// String sql = sqlFactory.getSQL();
|
|
|
// Rows rows = dbConnect.runSqlQuery(sql);
|
|
|
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
querySQL.setTableAlias("t2");
|
|
|
- querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "'111' = t2.siteid ","*");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "'111' = t2.siteid ", "*");
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
Rows rows = querySQL.query();
|
|
|
@@ -3366,10 +3369,10 @@ public class Order extends Controller {
|
|
|
|
|
|
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_rebatesettlement_items", "sa_rebatesettlement_itemsid", "qty",
|
|
|
- "marketprice", "discountrate", "price","amount","rebate_discountrate","rebate_price","rebate");
|
|
|
+ "marketprice", "discountrate", "price", "amount", "rebate_discountrate", "rebate_price", "rebate");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "plm_item", "t2", "t1.itemid = t2.itemid and t1.siteid = t2.siteid", "itemno", "itemname");
|
|
|
- querySQL.addQueryFields("rebate_unit_price","t1.price-t1.rebate_price");
|
|
|
+ querySQL.addQueryFields("rebate_unit_price", "t1.price-t1.rebate_price");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
querySQL.setWhere("t1.sa_rebatesettlementid", sa_rebatesettlementid);
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
@@ -3422,8 +3425,8 @@ public class Order extends Controller {
|
|
|
querySQL.addJoinTable(JOINTYPE.inner, "sa_cashbill", "t3", "t1.sa_cashbillid = t3.sa_cashbillid and t1.siteid = t3.siteid");
|
|
|
querySQL.addJoinTable(JOINTYPE.inner, "sa_orderitems", "t4", "t2.siteid = t4.siteid and t2.sa_orderitemsid = t4.sa_orderitemsid",
|
|
|
"rowno", "itemno", "itemname");
|
|
|
- querySQL.addQueryFields("cashbillbillno","t3.billno");
|
|
|
- querySQL.addQueryFields("ordetitemwriteoffamount","t2.writeoffamount");
|
|
|
+ querySQL.addQueryFields("cashbillbillno", "t3.billno");
|
|
|
+ querySQL.addQueryFields("ordetitemwriteoffamount", "t2.writeoffamount");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
querySQL.setWhere("t1.status = '审核'");
|
|
|
querySQL.setWhere("t2.sa_orderid", sa_orderid);
|
|
|
@@ -3442,9 +3445,9 @@ public class Order extends Controller {
|
|
|
sqlFactory.addParameter("sa_orderid", sa_orderid);
|
|
|
// Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
querySQL.setTableAlias("t");
|
|
|
- querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "t.siteid = '111' ","*");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "t.siteid = '111' ", "*");
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
Rows rows = querySQL.query();
|
|
|
@@ -3721,7 +3724,7 @@ public class Order extends Controller {
|
|
|
}
|
|
|
BigDecimal amount_orderaccount = orderaccountclassinfo.getBigDecimal("amount");
|
|
|
if (amount_orderaccount == null || amount_orderaccount.equals("")) {
|
|
|
- amount_orderaccount=BigDecimal.ZERO;
|
|
|
+ amount_orderaccount = BigDecimal.ZERO;
|
|
|
}
|
|
|
if (deliedqty.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
totalprice = amount_orderaccount;
|
|
|
@@ -3804,7 +3807,7 @@ public class Order extends Controller {
|
|
|
@CACHEING
|
|
|
public String newApiMethod() throws YosException {
|
|
|
Long sa_orderid = content.getLong("sa_orderid");
|
|
|
- Rows rows =dbConnect.runSqlQuery("select t2.itemno,t1.* from sa_orderitems t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.sa_orderid=" + sa_orderid + " and t1.siteid='" + siteid + "' and t1.price<=0");
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select t2.itemno,t1.* from sa_orderitems t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.sa_orderid=" + sa_orderid + " and t1.siteid='" + siteid + "' and t1.price<=0");
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|