|
|
@@ -0,0 +1,70 @@
|
|
|
+package restcontroller.sale.report;
|
|
|
+
|
|
|
+import com.alibaba.fastjson2.JSONArray;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import common.Controller;
|
|
|
+import common.YosException;
|
|
|
+import common.annotation.API;
|
|
|
+import common.data.Rows;
|
|
|
+import common.data.db.DBConnect;
|
|
|
+import restcontroller.R;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+
|
|
|
+public class DTPHB extends Controller {
|
|
|
+ public DTPHB(JSONObject content) throws YosException {
|
|
|
+ super(content);
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "动态平衡表查询", apiversion = R.ID2025120115482401.v1.class)
|
|
|
+ public String getData() throws YosException {
|
|
|
+ JSONObject dataObject = new JSONObject();
|
|
|
+ DBConnect dbConnect = new DBConnect();
|
|
|
+ Rows rows = dbConnect.runSqlQuery("CALL DTPHBNEW('1','2025-12-01','','') ");
|
|
|
+ dataObject.put("mx", rows.toJsonArray());
|
|
|
+ ArrayList<String> fieldList = rows.getFieldList();
|
|
|
+ ArrayList<String> pzdhlist = rows.toArrayList("配置代号");
|
|
|
+ {
|
|
|
+ JSONArray pzdharray = new JSONArray();
|
|
|
+ for (String pzdh : pzdhlist) {
|
|
|
+ JSONObject pzdhobject = new JSONObject();
|
|
|
+ pzdhobject.put("配置代号", pzdh);
|
|
|
+ for (String field : fieldList) {
|
|
|
+ if (!Arrays.asList("行号", "配置代号", "配置名称", "货品代号", "货品名称", "型号", "defaultoutplace", "defaultstockno").contains(field)) {
|
|
|
+ pzdhobject.put(field, rows.sum(field, "配置代号", pzdh));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pzdharray.add(pzdhobject);
|
|
|
+ }
|
|
|
+ dataObject.put("pz", pzdharray);
|
|
|
+ }
|
|
|
+
|
|
|
+ ArrayList<String> pmlist = rows.toArrayList("货品名称");
|
|
|
+ {
|
|
|
+ JSONArray pzdharray = new JSONArray();
|
|
|
+ for (String pm : pmlist) {
|
|
|
+ JSONObject pzdhobject = new JSONObject();
|
|
|
+ pzdhobject.put("货品名称", pm);
|
|
|
+ for (String field : fieldList) {
|
|
|
+ if (!Arrays.asList("行号", "配置代号", "配置名称", "货品代号", "货品名称", "型号", "defaultoutplace", "defaultstockno").contains(field)) {
|
|
|
+ pzdhobject.put(field, rows.sum(field, "货品名称", pm));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pzdharray.add(pzdhobject);
|
|
|
+ }
|
|
|
+ dataObject.put("pm", pzdharray);
|
|
|
+ }
|
|
|
+ {
|
|
|
+ JSONObject hzObject = new JSONObject();
|
|
|
+
|
|
|
+ for (String field : fieldList) {
|
|
|
+ if (!Arrays.asList("行号", "配置代号", "配置名称", "货品代号", "货品名称", "型号", "defaultoutplace", "defaultstockno").contains(field)) {
|
|
|
+ hzObject.put(field, rows.sum(field));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataObject.put("hz", hzObject);
|
|
|
+ }
|
|
|
+ return getSucReturnObject().setData(dataObject).toString();
|
|
|
+ }
|
|
|
+}
|