|
@ -18,12 +18,10 @@ import org.nl.wms.sch.manage.DeviceEnum; |
|
|
import org.nl.wms.sch.manage.PointEnum; |
|
|
import org.nl.wms.sch.manage.PointEnum; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.time.Duration; |
|
|
import java.time.Duration; |
|
|
import java.time.LocalDateTime; |
|
|
import java.time.LocalDateTime; |
|
|
import java.util.ArrayList; |
|
|
import java.util.*; |
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
import java.util.concurrent.CompletableFuture; |
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
import java.util.concurrent.CopyOnWriteArrayList; |
|
|
import java.util.concurrent.CopyOnWriteArrayList; |
|
@ -57,7 +55,6 @@ public class CockpitServiceImpl implements CockpitService{ |
|
|
if(ObjectUtil.isNotEmpty(result)) { |
|
|
if(ObjectUtil.isNotEmpty(result)) { |
|
|
res = result.toJavaList(WorkorderDto.class); |
|
|
res = result.toJavaList(WorkorderDto.class); |
|
|
// res.forEach(r -> {
|
|
|
// res.forEach(r -> {
|
|
|
// todo: 未根据实际,可以不需要客户
|
|
|
|
|
|
// r.setCust_name("新余钢铁");
|
|
|
// r.setCust_name("新余钢铁");
|
|
|
// if(StringUtils.isNotEmpty(r.getLabel())) {
|
|
|
// if(StringUtils.isNotEmpty(r.getLabel())) {
|
|
|
// r.setLabel(r.getLabel().substring(0, 2));
|
|
|
// r.setLabel(r.getLabel().substring(0, 2));
|
|
@ -77,7 +74,17 @@ public class CockpitServiceImpl implements CockpitService{ |
|
|
*/ |
|
|
*/ |
|
|
// 2、获取原料计划完成情况
|
|
|
// 2、获取原料计划完成情况
|
|
|
CompletableFuture<JSONArray> materialTask = CompletableFuture.supplyAsync(() -> WQL.getWO("COCKPIT_PRODUCTION").addParam("flag", "5").process().getResultJSONArray(0), pool); |
|
|
CompletableFuture<JSONArray> materialTask = CompletableFuture.supplyAsync(() -> WQL.getWO("COCKPIT_PRODUCTION").addParam("flag", "5").process().getResultJSONArray(0), pool); |
|
|
materialTask.thenAccept((result) -> map.put("materialTask", result)).exceptionally((e) -> { |
|
|
materialTask.thenAccept((result) -> { |
|
|
|
|
|
if (ObjectUtil.isEmpty(result)) { |
|
|
|
|
|
JSONObject object = new JSONObject(); |
|
|
|
|
|
object.put("workorder_procedure", "原料"); |
|
|
|
|
|
object.put("label", "1"); |
|
|
|
|
|
object.put("plan_qty", "0"); |
|
|
|
|
|
object.put("real_qty", "0"); |
|
|
|
|
|
result.add(object); |
|
|
|
|
|
} |
|
|
|
|
|
map.put("materialTask", result); |
|
|
|
|
|
}).exceptionally((e) -> { |
|
|
log.error("获取原料计划完成情况: {}", e.getMessage(), e); |
|
|
log.error("获取原料计划完成情况: {}", e.getMessage(), e); |
|
|
map.put("materialTask", ""); |
|
|
map.put("materialTask", ""); |
|
|
return null; |
|
|
return null; |
|
@ -90,10 +97,10 @@ public class CockpitServiceImpl implements CockpitService{ |
|
|
if(ObjectUtil.isNotEmpty(result)) { |
|
|
if(ObjectUtil.isNotEmpty(result)) { |
|
|
//成品计划完成情况,应前端要求分开两个一样的数据结果,简化调用数据采集
|
|
|
//成品计划完成情况,应前端要求分开两个一样的数据结果,简化调用数据采集
|
|
|
planRes = result.toJavaList(ProductionStatisticsDto.class); |
|
|
planRes = result.toJavaList(ProductionStatisticsDto.class); |
|
|
// getProcedureName(planRes, 1);
|
|
|
setResultComplete(planRes); |
|
|
//今日压制量,干燥量,成品量
|
|
|
//今日压制量,干燥量,成品量
|
|
|
finishedRes = result.toJavaList(ProductionStatisticsDto.class); |
|
|
finishedRes = result.toJavaList(ProductionStatisticsDto.class); |
|
|
// getProcedureName(finishedRes, 2);
|
|
|
setResultComplete(finishedRes); |
|
|
} |
|
|
} |
|
|
map.put("planRes", planRes); |
|
|
map.put("planRes", planRes); |
|
|
map.put("finishedRes", finishedRes); |
|
|
map.put("finishedRes", finishedRes); |
|
@ -314,25 +321,52 @@ public class CockpitServiceImpl implements CockpitService{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 处理工序字段 |
|
|
* 处理空白数据设置默认值 |
|
|
*/ |
|
|
*/ |
|
|
private void getProcedureName(List<ProductionStatisticsDto> result, Integer type) { |
|
|
private void setResultComplete(List<ProductionStatisticsDto> result) { |
|
|
if(type == 1) { |
|
|
HashSet<String> existingLabels = new HashSet<>(); // 创建一个 HashSet 对象
|
|
|
result.forEach(r -> { |
|
|
// 遍历 result 列表中的每个 ProductionStatisticsDto 对象
|
|
|
if(StringUtils.isNotEmpty(r.getWorkorder_procedure())) { |
|
|
for (ProductionStatisticsDto dto : result) { |
|
|
r.setWorkorder_procedure(ProductionStatisticsEnum.getName(r.getWorkorder_procedure())); |
|
|
// 检查 label 字段是否存在于 existingLabels 集合中
|
|
|
} |
|
|
if (!existingLabels.contains(dto.getLabel())) { |
|
|
}); |
|
|
// 将缺少的标签值添加到 existingLabels 集合中
|
|
|
|
|
|
existingLabels.add(dto.getLabel()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else{ |
|
|
// 检查 1、2、3、4 标签值是否全部存在,如果有缺失则创建新的 ProductionStatisticsDto 对象并添加到 result 列表中
|
|
|
result.forEach(r -> { |
|
|
for (int i = 1; i <= 4; i++) { |
|
|
if(StringUtils.isNotEmpty(r.getWorkorder_procedure())) { // 处理字段
|
|
|
if (!existingLabels.contains(i+"")) { |
|
|
r.setWorkorder_procedure(ProductionStatisticsEnum.getName(r.getWorkorder_procedure())); |
|
|
result.add(ProductionStatisticsDto |
|
|
} |
|
|
.builder() |
|
|
}); |
|
|
.workorder_procedure(ProductionStatisticsEnum.getName(String.valueOf(i))) |
|
|
|
|
|
.label(String.valueOf(i)) |
|
|
|
|
|
.real_qty(BigDecimal.valueOf(0)) |
|
|
|
|
|
.plan_qty(BigDecimal.valueOf(0)) |
|
|
|
|
|
.build()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 处理工序字段 |
|
|
|
|
|
*/ |
|
|
|
|
|
private void getProcedureName(List<ProductionStatisticsDto> result, int type) { |
|
|
|
|
|
// if(type == 1) {
|
|
|
|
|
|
// result.forEach(r -> {
|
|
|
|
|
|
// if(StringUtils.isNotEmpty(r.getWorkorder_procedure())) {
|
|
|
|
|
|
// r.setWorkorder_procedure(ProductionStatisticsEnum.getName(r.getWorkorder_procedure()));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else{
|
|
|
|
|
|
// result.forEach(r -> {
|
|
|
|
|
|
// if(StringUtils.isNotEmpty(r.getWorkorder_procedure())) { // 处理字段
|
|
|
|
|
|
// r.setWorkorder_procedure(ProductionStatisticsEnum.getName(r.getWorkorder_procedure()));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 判断静置状态 |
|
|
* 判断静置状态 |
|
|
*/ |
|
|
*/ |
|
|