|
|
@@ -13,6 +13,7 @@ import common.data.Row;
|
|
|
import common.data.Rows;
|
|
|
import common.data.RowsMap;
|
|
|
import common.data.SQLFactory;
|
|
|
+import jdk.nashorn.internal.objects.annotations.Where;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import restcontroller.R;
|
|
|
|
|
|
@@ -213,6 +214,10 @@ public class databoard extends Controller {
|
|
|
public String SalesOrderByMonthAnalysis() throws Exception {
|
|
|
|
|
|
String datatype = content.getString("datatype");
|
|
|
+ String where = " 1=1 ";
|
|
|
+ if(sys_enterpriseid>0){
|
|
|
+ where=where+" and t1.sys_enterpriseid="+sys_enterpriseid;
|
|
|
+ }
|
|
|
/*
|
|
|
* 过滤条件设置
|
|
|
*/
|
|
|
@@ -235,6 +240,7 @@ public class databoard extends Controller {
|
|
|
return getErrReturnObject().setErrMsg("datatype类型错误").toString();
|
|
|
}
|
|
|
factory.addParameter("siteid", siteid);
|
|
|
+ factory.addParameter_SQL("where", where);
|
|
|
Rows rows = dbConnect.runSqlQuery(factory.getSQL(false));
|
|
|
String year = new SimpleDateFormat("yyyy").format(new Date());
|
|
|
String lastyear = String.valueOf(Integer.parseInt(new SimpleDateFormat("yyyy").format(new Date())) - 1);
|
|
|
@@ -393,6 +399,10 @@ public class databoard extends Controller {
|
|
|
whereLastYear.append(" and DATE_FORMAT(t1.checkdate, '%Y-%m-%d') <='").append(sdf.format(cal.getTime())).append("' ");
|
|
|
}
|
|
|
|
|
|
+ if(sys_enterpriseid>0){
|
|
|
+ where.append(" and t1.sys_enterpriseid="+sys_enterpriseid);
|
|
|
+ }
|
|
|
+
|
|
|
if (datatype.equals("标准")) {
|
|
|
where.append(" and t1.type='标准订单' ");
|
|
|
whereLastYear.append(" and t1.type='标准订单' ");
|
|
|
@@ -446,7 +456,8 @@ public class databoard extends Controller {
|
|
|
row.put("proportion", row.getBigDecimal("amount").divide(sumamount, 4, BigDecimal.ROUND_HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ topItemclassRows.sort(Comparator.comparingDouble(o ->o.getDouble("amount")));
|
|
|
+ Collections.reverse(topItemclassRows);
|
|
|
return getSucReturnObject().setData(topItemclassRows).toString();
|
|
|
}
|
|
|
|
|
|
@@ -734,6 +745,52 @@ public class databoard extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 工厂待发明细
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @API(title = "工厂待发明细", apiversion = R.ID20230803140903.v1.class)
|
|
|
+ @CACHEING
|
|
|
+ public String factoryPendingDetails() throws YosException {
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 过滤条件设置
|
|
|
+ */
|
|
|
+ StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
+ if(sys_enterpriseid>0){
|
|
|
+ where.append(" and t2.sys_enterpriseid="+sys_enterpriseid);
|
|
|
+ }
|
|
|
+ if (content.containsKey("where")) {
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
+ if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
|
|
|
+ where.append(" and DATE_FORMAT(t2.checkdate, '%Y-%m-%d') >='").append(whereObject.getString("begindate")).append("' ");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
|
|
|
+ where.append(" and DATE_FORMAT(t2.checkdate, '%Y-%m-%d') <='").append(whereObject.getString("enddate")).append("' ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ SQLFactory factory = new SQLFactory(this, "工厂待发明细查询");
|
|
|
+ factory.addParameter("siteid", siteid);
|
|
|
+ factory.addParameter_SQL("where", where);
|
|
|
+ Rows rows = dbConnect.runSqlQuery(factory.getSQL(false));
|
|
|
+
|
|
|
+ SQLFactory sumfactory = new SQLFactory(this, "工厂待发合计金额及数量查询");
|
|
|
+ sumfactory.addParameter("siteid", siteid);
|
|
|
+ sumfactory.addParameter_SQL("where", where);
|
|
|
+ Rows sumrows = dbConnect.runSqlQuery(sumfactory.getSQL(false));
|
|
|
+ if(rows.isNotEmpty()){
|
|
|
+ rows.get(0).put("sumrows", sumrows);
|
|
|
+ }
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @Description: 获取季度第一天
|
|
|
* 1.根据给定日期计算当前季度的第一个月份
|