|
@@ -9,6 +9,7 @@ import java.util.Map;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.jfinal.aop.Clear;
|
|
import com.jfinal.aop.Clear;
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
|
+import com.jfinal.plugin.activerecord.Page;
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
import com.qlm.annotation.RequestUrl;
|
|
import com.qlm.annotation.RequestUrl;
|
|
|
import com.qlm.common.ApiResponse;
|
|
import com.qlm.common.ApiResponse;
|
|
@@ -99,43 +100,45 @@ public class ProduceOrderController extends CommonController{
|
|
|
public void orderQuery(){
|
|
public void orderQuery(){
|
|
|
int pageSize = getParaToInt("pageSize",10);
|
|
int pageSize = getParaToInt("pageSize",10);
|
|
|
int page = getParaToInt("pageNumber",1);
|
|
int page = getParaToInt("pageNumber",1);
|
|
|
- int pageStart = pageSize*(page-1);
|
|
|
|
|
- String whereSql = " where 1 = 1 ";
|
|
|
|
|
-
|
|
|
|
|
String OrderNo = getPara("OrderNo");
|
|
String OrderNo = getPara("OrderNo");
|
|
|
-
|
|
|
|
|
String LicensePlate = getPara("LicensePlate");
|
|
String LicensePlate = getPara("LicensePlate");
|
|
|
String startdate = getPara("startdate");
|
|
String startdate = getPara("startdate");
|
|
|
-
|
|
|
|
|
String endDate = getPara("enddate");
|
|
String endDate = getPara("enddate");
|
|
|
-
|
|
|
|
|
|
|
+ String columns = "select b.pinxiang AS ProductName, a.LicensePlate AS LicensePlate, a.CaseCode AS CaseCode, a.OrderNo AS OrderNo, a.SKUNo AS SKUNo, a.WarehouseID AS WarehouseID, a.CustomerNo AS CustomerNo, a.OperateUser AS OperateUser, a.DeliveryTime AS DeliveryTime, a.PalletCode AS PalletCode, a.ProductNo AS ProductNo, a.OutWarehouseNo AS OutWarehouseNo, a.OutWarehouse AS OutWarehouse, a.id AS id, a.CustomerName AS CustomerName, b.sku AS SKU";
|
|
|
|
|
+ StringBuilder sql = new StringBuilder();
|
|
|
|
|
+ sql.append(" from deliveryorders a left join jinzai_upload_master b on a.CaseCode = b.id ");
|
|
|
|
|
+ sql.append(" where 1 = 1 ");
|
|
|
|
|
+ List<Object>params = new ArrayList<>();
|
|
|
if(!WxUtil.isNull(OrderNo)){
|
|
if(!WxUtil.isNull(OrderNo)){
|
|
|
- whereSql += " and a.OrderNo = '"+OrderNo+"' ";
|
|
|
|
|
|
|
+ sql.append(" and a.OrderNo = ?");
|
|
|
|
|
+ params.add(OrderNo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(!WxUtil.isNull(LicensePlate)){
|
|
if(!WxUtil.isNull(LicensePlate)){
|
|
|
- whereSql += " and a.LicensePlate = '"+LicensePlate+"' ";
|
|
|
|
|
|
|
+ sql.append(" and a.LicensePlate = ?");
|
|
|
|
|
+ params.add(LicensePlate);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(!WxUtil.isNull(endDate)){
|
|
if(!WxUtil.isNull(endDate)){
|
|
|
endDate = endDate+ " 23:59:59";
|
|
endDate = endDate+ " 23:59:59";
|
|
|
- whereSql += " and a.DeliveryTime <= '"+endDate+"' ";
|
|
|
|
|
|
|
+ sql.append(" and a.DeliveryTime <= ?");
|
|
|
|
|
+ params.add(endDate);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(!WxUtil.isNull(startdate)){
|
|
if(!WxUtil.isNull(startdate)){
|
|
|
startdate = startdate+ " 00:00:00";
|
|
startdate = startdate+ " 00:00:00";
|
|
|
- whereSql += " and a.DeliveryTime >= '"+startdate+"' ";
|
|
|
|
|
|
|
+ sql.append(" and a.DeliveryTime >= ?");
|
|
|
|
|
+ params.add(startdate);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- Long total = Db.queryLong("select count(*) from deliveryorders");
|
|
|
|
|
|
|
|
|
|
- String columns = " b.pinxiang AS ProductName, a.LicensePlate AS LicensePlate, a.CaseCode AS CaseCode, a.OrderNo AS OrderNo, a.SKUNo AS SKUNo, a.WarehouseID AS WarehouseID, a.CustomerNo AS CustomerNo, a.OperateUser AS OperateUser, a.DeliveryTime AS DeliveryTime, a.PalletCode AS PalletCode, a.ProductNo AS ProductNo, a.OutWarehouseNo AS OutWarehouseNo, a.OutWarehouse AS OutWarehouse, a.id AS id, a.CustomerName AS CustomerName, b.sku AS SKU";
|
|
|
|
|
|
|
+ sql.append(" order by a.DeliveryTime desc");
|
|
|
|
|
+
|
|
|
|
|
+ Page<Record> paginate = Db.paginate(page, pageSize, columns, sql.toString(), params.toArray());
|
|
|
|
|
+
|
|
|
|
|
|
|
|
- List<Record> find = Db.find("select "+columns+" from deliveryorders a left join jinzai_upload_master b on a.CaseCode = b.id "+whereSql+" order by a.DeliveryTime desc limit "+pageStart+","+pageSize);
|
|
|
|
|
-
|
|
|
|
|
Record r = new Record();
|
|
Record r = new Record();
|
|
|
- r.set("rows", find);
|
|
|
|
|
- r.set("total", total);
|
|
|
|
|
|
|
+ r.set("rows", paginate.getList());
|
|
|
|
|
+ r.set("total", paginate.getTotalRow());
|
|
|
renderJson(r);
|
|
renderJson(r);
|
|
|
}
|
|
}
|
|
|
|
|
|