fix:立库界面优化
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
package org.nl.modules.mnt.service.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.mnt.service.AutoRiKuService;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AutoRiKuServiceImpl implements AutoRiKuService {
|
||||
@@ -18,21 +26,22 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
|
||||
JSONArray dataArr = new JSONArray();
|
||||
|
||||
// 获取有货货位
|
||||
JSONArray haveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') <> '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray haveArr = WQL.getWO("AUTORIKU").addParam("flag", "1").addParam("layer_num", "1").process().getResultJSONArray(0);
|
||||
|
||||
|
||||
JSONObject jsonHave = new JSONObject();
|
||||
jsonHave.put("name", "有货");
|
||||
jsonHave.put("value", haveArr.size());
|
||||
|
||||
// 获取无货货位
|
||||
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONObject jsonNotHave = new JSONObject();
|
||||
jsonNotHave.put("name", "空闲");
|
||||
jsonNotHave.put("value", notHaveArr.size());
|
||||
|
||||
// 获取禁用货位
|
||||
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONObject jsonUsed = new JSONObject();
|
||||
jsonUsed.put("name", "禁用");
|
||||
@@ -43,7 +52,15 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
|
||||
dataArr.add(jsonUsed);
|
||||
|
||||
int num = haveArr.size() + notHaveArr.size() + usedArr.size();
|
||||
jsonAll.put("pieSubTest", "总仓位:"+num);
|
||||
|
||||
// 获取净重
|
||||
BigDecimal net_weight = haveArr.stream()
|
||||
.map(row -> (JSONObject) row)
|
||||
.filter(row -> !StrUtil.equals(row.getString("sect_code"), "KTP01") && ObjectUtil.isNotEmpty(row.getString("net_weight")))
|
||||
.map(row -> row.getBigDecimal("net_weight"))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
jsonAll.put("pieSubTest", "总仓位: "+num+" "+"总净重: "+ NumberUtil.round(net_weight,2)+"KG");
|
||||
jsonAll.put("data", dataArr);
|
||||
jsonAll.put("name", "立库1层统计");
|
||||
|
||||
@@ -58,21 +75,21 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
|
||||
JSONArray dataArr = new JSONArray();
|
||||
|
||||
// 获取有货货位
|
||||
JSONArray haveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') <> '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray haveArr = WQL.getWO("AUTORIKU").addParam("flag", "1").addParam("layer_num", "2").process().getResultJSONArray(0);
|
||||
|
||||
JSONObject jsonHave = new JSONObject();
|
||||
jsonHave.put("name", "有货");
|
||||
jsonHave.put("value", haveArr.size());
|
||||
|
||||
// 获取无货货位
|
||||
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONObject jsonNotHave = new JSONObject();
|
||||
jsonNotHave.put("name", "空闲");
|
||||
jsonNotHave.put("value", notHaveArr.size());
|
||||
|
||||
// 获取禁用货位
|
||||
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONObject jsonUsed = new JSONObject();
|
||||
jsonUsed.put("name", "禁用");
|
||||
@@ -83,7 +100,15 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
|
||||
dataArr.add(jsonUsed);
|
||||
|
||||
int num = haveArr.size() + notHaveArr.size() + usedArr.size();
|
||||
jsonAll.put("pieSubTest", "总仓位:"+num);
|
||||
|
||||
// 获取净重
|
||||
BigDecimal net_weight = haveArr.stream()
|
||||
.map(row -> (JSONObject) row)
|
||||
.filter(row -> !StrUtil.equals(row.getString("sect_code"), "KTP01") && ObjectUtil.isNotEmpty(row.getString("net_weight")))
|
||||
.map(row -> row.getBigDecimal("net_weight"))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
jsonAll.put("pieSubTest", "总仓位: "+num+" "+"总净重: "+ NumberUtil.round(net_weight,2)+"KG");
|
||||
jsonAll.put("data", dataArr);
|
||||
jsonAll.put("name", "立库2层统计");
|
||||
|
||||
@@ -98,21 +123,20 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
|
||||
JSONArray dataArr = new JSONArray();
|
||||
|
||||
// 获取有货货位
|
||||
JSONArray haveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') <> '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONArray haveArr = WQL.getWO("AUTORIKU").addParam("flag", "1").addParam("layer_num", "3").process().getResultJSONArray(0);
|
||||
JSONObject jsonHave = new JSONObject();
|
||||
jsonHave.put("name", "有货");
|
||||
jsonHave.put("value", haveArr.size());
|
||||
|
||||
// 获取无货货位
|
||||
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONObject jsonNotHave = new JSONObject();
|
||||
jsonNotHave.put("name", "空闲");
|
||||
jsonNotHave.put("value", notHaveArr.size());
|
||||
|
||||
// 获取禁用货位
|
||||
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONObject jsonUsed = new JSONObject();
|
||||
jsonUsed.put("name", "禁用");
|
||||
@@ -123,7 +147,15 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
|
||||
dataArr.add(jsonUsed);
|
||||
|
||||
int num = haveArr.size() + notHaveArr.size() + usedArr.size();
|
||||
jsonAll.put("pieSubTest", "总仓位:"+num);
|
||||
|
||||
// 获取净重
|
||||
BigDecimal net_weight = haveArr.stream()
|
||||
.map(row -> (JSONObject) row)
|
||||
.filter(row -> !StrUtil.equals(row.getString("sect_code"), "KTP01") && ObjectUtil.isNotEmpty(row.getString("net_weight")))
|
||||
.map(row -> row.getBigDecimal("net_weight"))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
jsonAll.put("pieSubTest", "总仓位: "+num+" "+"总净重: "+ NumberUtil.round(net_weight,2)+"KG");
|
||||
jsonAll.put("data", dataArr);
|
||||
jsonAll.put("name", "立库3层统计");
|
||||
|
||||
@@ -138,21 +170,20 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
|
||||
JSONArray dataArr = new JSONArray();
|
||||
|
||||
// 获取有货货位
|
||||
JSONArray haveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') <> '' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONArray haveArr = WQL.getWO("AUTORIKU").addParam("flag", "1").process().getResultJSONArray(0);
|
||||
JSONObject jsonHave = new JSONObject();
|
||||
jsonHave.put("name", "有货");
|
||||
jsonHave.put("value", haveArr.size());
|
||||
|
||||
// 获取无货货位
|
||||
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') = '' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and IFNULL(storagevehicle_code,'') = '' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONObject jsonNotHave = new JSONObject();
|
||||
jsonNotHave.put("name", "空闲");
|
||||
jsonNotHave.put("value", notHaveArr.size());
|
||||
|
||||
// 获取禁用货位
|
||||
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONObject jsonUsed = new JSONObject();
|
||||
jsonUsed.put("name", "禁用");
|
||||
@@ -163,7 +194,15 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
|
||||
dataArr.add(jsonUsed);
|
||||
|
||||
int num = haveArr.size() + notHaveArr.size() + usedArr.size();
|
||||
jsonAll.put("pieSubTest", "总仓位:"+num);
|
||||
|
||||
// 获取净重
|
||||
BigDecimal net_weight = haveArr.stream()
|
||||
.map(row -> (JSONObject) row)
|
||||
.filter(row -> !StrUtil.equals(row.getString("sect_code"), "KTP01") && ObjectUtil.isNotEmpty(row.getString("net_weight")))
|
||||
.map(row -> row.getBigDecimal("net_weight"))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
jsonAll.put("pieSubTest", "总仓位: "+num+" "+"总净重: "+ NumberUtil.round(net_weight,2)+"KG");
|
||||
jsonAll.put("data", dataArr);
|
||||
jsonAll.put("name", "立库汇总统计");
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
[交易说明]
|
||||
交易名: 立库监控
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.layer_num TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
attr.*,
|
||||
sub.net_weight
|
||||
FROM
|
||||
st_ivt_structattr attr
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
SUM(net_weight) AS net_weight,
|
||||
package_box_sn
|
||||
FROM
|
||||
pdm_bi_subpackagerelation
|
||||
WHERE
|
||||
1 = 1
|
||||
group by package_box_sn
|
||||
) sub ON attr.storagevehicle_code = sub.package_box_sn
|
||||
WHERE
|
||||
attr.sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01')
|
||||
and IFNULL(attr.storagevehicle_code,'') <> ''
|
||||
and attr.is_delete = '0'
|
||||
|
||||
OPTION 输入.layer_num <> ""
|
||||
attr.layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user