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
|
||||
@@ -28,9 +28,11 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
@@ -58,6 +60,7 @@ public class StructattrServiceImpl implements StructattrService {
|
||||
map.put("stor_id", (String) whereJson.get("stor_id"));
|
||||
map.put("sect_id", (String) whereJson.get("sect_id"));
|
||||
map.put("lock_type", (String) whereJson.get("lock_type"));
|
||||
map.put("layer_num", (String) whereJson.get("layer_num"));
|
||||
|
||||
//获取人员对应的仓库
|
||||
UserStorServiceImpl userStorService = new UserStorServiceImpl();
|
||||
@@ -264,6 +267,17 @@ public class StructattrServiceImpl implements StructattrService {
|
||||
.addParamMap(MapOf.of("struct_id", struct_id, "flag", "1"))
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
// 计算合计
|
||||
JSONObject json = array.getJSONObject(0);
|
||||
if (ObjectUtil.isNotEmpty(json.getString("net_weight"))) {
|
||||
BigDecimal container_weight = array.stream().map(row -> ((JSONObject) row).getBigDecimal("net_weight")).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
for (int j = 0; j < array.size(); j++) {
|
||||
JSONObject jsonObject = array.getJSONObject(j);
|
||||
jsonObject.put("container_weight",container_weight);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取仓位表中的信息
|
||||
JSONObject strInfo = attrTab
|
||||
.query("struct_id = '" + struct_id + "'")
|
||||
@@ -271,6 +285,9 @@ public class StructattrServiceImpl implements StructattrService {
|
||||
if (strInfo.getString("is_used").equals("0")) {
|
||||
// 被禁用
|
||||
struct_status = 4;
|
||||
} else if (strInfo.getString("sect_code").equals("PD01")) {
|
||||
// 盘点位
|
||||
struct_status = 5;
|
||||
} else if (ObjectUtil.isEmpty(strInfo.getString("storagevehicle_code"))) {
|
||||
// 空位
|
||||
struct_status = 3;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
输入.is_used TYPEAS s_string
|
||||
输入.is_delete TYPEAS s_string
|
||||
输入.have_vehicle TYPEAS s_string
|
||||
输入.layer_num TYPEAS s_string
|
||||
输入.in_stor_id TYPEAS f_string
|
||||
|
||||
[临时表]
|
||||
@@ -71,6 +72,9 @@
|
||||
OPTION 输入.lock_type <> ""
|
||||
struct.lock_type = 输入.lock_type
|
||||
ENDOPTION
|
||||
OPTION 输入.layer_num <> ""
|
||||
struct.layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
OPTION 输入.lock_type = "1"
|
||||
(struct.storagevehicle_code is null or struct.storagevehicle_code = '')
|
||||
ENDOPTION
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -169,7 +170,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
result.put("message", "下发成功,但未连接ACS!");
|
||||
result.put("data", new JSONArray());
|
||||
|
||||
/* // 测试数据
|
||||
// 测试数据
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
JSONObject a = new JSONObject();
|
||||
a.put("electricity", "86");
|
||||
@@ -199,9 +200,15 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
JSONArray ArrA1 = new JSONArray(); // A1车间
|
||||
JSONArray ArrLk = new JSONArray(); // LK车间
|
||||
|
||||
String run_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("AGV_RUN_TIME").getValue();
|
||||
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject json = data.getJSONObject(i);
|
||||
|
||||
// 工作时长:电量百分比*6
|
||||
String electricity = json.getString("electricity");
|
||||
json.put("run_time", NumberUtil.round(NumberUtil.div(NumberUtil.mul(electricity, run_time),100), 1));
|
||||
|
||||
if ("2,3".contains(json.getString("car_no"))) {
|
||||
ArrA1.add(json);
|
||||
}
|
||||
@@ -211,7 +218,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
nowJson.put("jsonA1",ArrA1);
|
||||
nowJson.put("jsonLK",ArrLk);
|
||||
result.put("data", nowJson);*/
|
||||
result.put("data", nowJson);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -233,9 +240,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
JSONArray ArrA1 = new JSONArray(); // A1车间
|
||||
JSONArray ArrLk = new JSONArray(); // LK车间
|
||||
|
||||
String run_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("AGV_RUN_TIME").getValue();
|
||||
|
||||
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject json = data.getJSONObject(i);
|
||||
|
||||
// 工作时长:电量百分比*6
|
||||
String electricity = json.getString("electricity");
|
||||
json.put("run_time", NumberUtil.round(NumberUtil.div(NumberUtil.mul(electricity, run_time),100), 1));
|
||||
|
||||
if ("2,3".contains(json.getString("car_no"))) {
|
||||
ArrA1.add(json);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user