|
|
@ -1,6 +1,9 @@ |
|
|
|
package org.nl.wms.cockpit.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.date.*; |
|
|
|
import cn.hutool.core.date.DatePattern; |
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
import cn.hutool.core.date.DateUnit; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
@ -9,20 +12,22 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.nl.config.thread.ThreadPoolExecutorUtil; |
|
|
|
import org.nl.modules.common.utils.PointUpdateUtil; |
|
|
|
import org.nl.modules.common.utils.enums.IsOrNotEnum; |
|
|
|
import org.nl.modules.common.utils.enums.ProductionStatisticsEnum; |
|
|
|
import org.nl.modules.wql.WQL; |
|
|
|
import org.nl.modules.wql.core.bean.WQLObject; |
|
|
|
import org.nl.wms.cockpit.service.CockpitService; |
|
|
|
import org.nl.wms.cockpit.service.dto.*; |
|
|
|
import org.nl.wms.sch.manage.DeviceEnum; |
|
|
|
import org.nl.wms.sch.manage.PointEnum; |
|
|
|
import org.nl.wms.util.MapOf; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.time.Duration; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.text.DecimalFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.function.Consumer; |
|
|
|
|
|
|
|
/** |
|
|
|
* 大屏服务实现1 |
|
|
@ -364,6 +369,367 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
|
return hashMap; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ConcurrentHashMap<String, Object> processProduction() { |
|
|
|
// 工序生产:混料、压制(成型)、包装、成品
|
|
|
|
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); |
|
|
|
ConcurrentHashMap<String, Object> map = new ConcurrentHashMap<>(2); |
|
|
|
// 1.1 获取混料当日计划与实际生产、生产率 单位(吨)需要除1000
|
|
|
|
CompletableFuture<List<NumberDto>> mixMaterialStorage = CompletableFuture.supplyAsync(() -> { |
|
|
|
List<NumberDto> res = new CopyOnWriteArrayList<>(); |
|
|
|
// 查找所有混料设备的数据
|
|
|
|
JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "1", "region_code", "HL")).process().getResultJSONArray(0); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
res = result.toJavaList(NumberDto.class); |
|
|
|
// 设备空数据值
|
|
|
|
setResultCompleteInProcessProduction(res, "HL"); |
|
|
|
} |
|
|
|
return res; |
|
|
|
}, pool); |
|
|
|
mixMaterialStorage.thenAccept((result) -> { |
|
|
|
// 整理数据
|
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
int sumRealDay = 0; |
|
|
|
int sumPlanDay = 0; |
|
|
|
for (NumberDto numberDto : result) { |
|
|
|
sumRealDay += numberDto.getReal_qty(); |
|
|
|
sumPlanDay += numberDto.getPlan_qty(); |
|
|
|
} |
|
|
|
res.put("hl_plan_day", BigDecimal.valueOf((double) sumPlanDay / 1000).setScale(2, RoundingMode.HALF_UP).toString()); |
|
|
|
res.put("hl_real_day", BigDecimal.valueOf((double) sumRealDay / 1000).setScale(2, RoundingMode.HALF_UP).toString()); |
|
|
|
res.put("hl_productivity", sumRealDay / sumPlanDay); |
|
|
|
res.put("HLDayList", result); |
|
|
|
if (map.containsKey("HL")) { // 如果存在
|
|
|
|
JSONObject hl = (JSONObject) map.get("HL"); |
|
|
|
res.put("HLWeekList", hl.getJSONArray("HLWeekList")); |
|
|
|
map.put("HL", res); |
|
|
|
} else { |
|
|
|
map.put("HL", res); |
|
|
|
} |
|
|
|
}).exceptionally((e) -> { |
|
|
|
log.error("获取混料设备生产信息: {}", e.getMessage(), e); |
|
|
|
List<NumberDto> dtos = new ArrayList<>(); |
|
|
|
setResultCompleteInProcessProduction(dtos, "HL"); |
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("hl_plan_day", "0.00"); |
|
|
|
res.put("hl_real_day", "0.00"); |
|
|
|
res.put("hl_productivity", 0); |
|
|
|
res.put("HLDayList", dtos); |
|
|
|
if (map.containsKey("HL")) { // 如果存在
|
|
|
|
JSONObject hl = (JSONObject) map.get("HL"); |
|
|
|
res.put("HLWeekList", hl.getJSONArray("HLWeekList")); |
|
|
|
map.put("HL", res); |
|
|
|
} else { |
|
|
|
map.put("HL", res); |
|
|
|
} |
|
|
|
return null; |
|
|
|
}); |
|
|
|
// 1.2 获取每台混捻设备的每周数据
|
|
|
|
CompletableFuture<List<NumberDto>> mixDeviceWeekDayStorage = CompletableFuture.supplyAsync(() -> { |
|
|
|
List<NumberDto> res = new CopyOnWriteArrayList<>(); |
|
|
|
// 查找所有混捻每周的数据
|
|
|
|
JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "2", "region_code", "HL")).process().getResultJSONArray(0); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
res = result.toJavaList(NumberDto.class); |
|
|
|
setResultCompleteInProcessProduction(res, "HL"); |
|
|
|
} |
|
|
|
return res; |
|
|
|
}, pool); |
|
|
|
mixDeviceWeekDayStorage.thenAccept((result) -> { |
|
|
|
//每周的数据
|
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("HLWeekList", result); |
|
|
|
if (map.containsKey("HL")) { // 如果存在
|
|
|
|
JSONObject hl = (JSONObject) map.get("HL"); |
|
|
|
res.put("hl_plan_day", hl.getString("hl_plan_day")); |
|
|
|
res.put("hl_real_day", hl.getString("hl_real_day")); |
|
|
|
res.put("hl_productivity", hl.getString("hl_productivity")); |
|
|
|
res.put("HLDayList", hl.getJSONArray("HLDayList")); |
|
|
|
map.put("HL", res); |
|
|
|
} else { |
|
|
|
map.put("HL", res); |
|
|
|
} |
|
|
|
}).exceptionally((e) -> { |
|
|
|
log.error("获取混捻(每周)信息: {}", e.getMessage(), e); |
|
|
|
List<NumberDto> dtos = new ArrayList<>(); |
|
|
|
setResultCompleteInProcessProduction(dtos, "HL"); |
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("HLWeekList", dtos); |
|
|
|
if (map.containsKey("HL")) { // 如果存在
|
|
|
|
JSONObject hl = (JSONObject) map.get("HL"); |
|
|
|
res.put("hl_plan_day", hl.getString("hl_plan_day")); |
|
|
|
res.put("hl_real_day", hl.getString("hl_real_day")); |
|
|
|
res.put("hl_productivity", hl.getString("hl_productivity")); |
|
|
|
res.put("HLDayList", hl.getJSONArray("HLDayList")); |
|
|
|
map.put("HL", res); |
|
|
|
} else { |
|
|
|
map.put("HL", res); |
|
|
|
} |
|
|
|
return null; |
|
|
|
}); |
|
|
|
// 2.1 获取成型的计划与实际生产数量:单位万块, 每天的合格与不合格数量
|
|
|
|
CompletableFuture<List<NumberDto>> yzPlanAndRealStorage = CompletableFuture.supplyAsync(() -> { |
|
|
|
List<NumberDto> res = new CopyOnWriteArrayList<>(); |
|
|
|
// 查找所有混捻每周的数据
|
|
|
|
JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "1", "region_code", "YZ")).process().getResultJSONArray(0); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
res = result.toJavaList(NumberDto.class); |
|
|
|
setResultCompleteInProcessProduction(res, "YZ"); |
|
|
|
} |
|
|
|
return res; |
|
|
|
}, pool); |
|
|
|
yzPlanAndRealStorage.thenAccept((result) -> { |
|
|
|
// 整理数据
|
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
int sumRealDay = 0; |
|
|
|
int sumPlanDay = 0; |
|
|
|
for (NumberDto numberDto : result) { |
|
|
|
sumRealDay += numberDto.getReal_qty(); |
|
|
|
sumPlanDay += numberDto.getPlan_qty(); |
|
|
|
} |
|
|
|
res.put("yz_plan_day", BigDecimal.valueOf((double) sumPlanDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); |
|
|
|
res.put("yz_real_day", BigDecimal.valueOf((double) sumRealDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); |
|
|
|
res.put("yz_productivity", sumRealDay / sumPlanDay); |
|
|
|
res.put("YZDayList", result); |
|
|
|
if (map.containsKey("YZ")) { // 如果存在
|
|
|
|
JSONObject yz = (JSONObject) map.get("YZ"); |
|
|
|
res.put("YZWeekList", yz.getJSONArray("YZWeekList")); |
|
|
|
map.put("YZ", res); |
|
|
|
} else { |
|
|
|
map.put("YZ", res); |
|
|
|
} |
|
|
|
}).exceptionally((e) -> { |
|
|
|
log.error("获取压制设备生产信息: {}", e.getMessage(), e); |
|
|
|
List<NumberDto> dtos = new ArrayList<>(); |
|
|
|
setResultCompleteInProcessProduction(dtos, "YZ"); |
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("yz_plan_day", "0.00"); |
|
|
|
res.put("yz_real_day", "0.00"); |
|
|
|
res.put("yz_productivity", 0); |
|
|
|
res.put("YZDayList", dtos); |
|
|
|
if (map.containsKey("YZ")) { // 如果存在
|
|
|
|
JSONObject yz = (JSONObject) map.get("YZ"); |
|
|
|
res.put("YZWeekList", yz.getJSONArray("YZWeekList")); |
|
|
|
map.put("YZ", res); |
|
|
|
} else { |
|
|
|
map.put("YZ", res); |
|
|
|
} |
|
|
|
return null; |
|
|
|
}); |
|
|
|
// 2.2 压制每周的合格与不合格数量
|
|
|
|
CompletableFuture<List<NumberDto>> yzDeviceWeekDayStorage = CompletableFuture.supplyAsync(() -> { |
|
|
|
List<NumberDto> res = new CopyOnWriteArrayList<>(); |
|
|
|
// 查找所有压制每周的数据
|
|
|
|
JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "2", "region_code", "YZ")).process().getResultJSONArray(0); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
res = result.toJavaList(NumberDto.class); |
|
|
|
setResultCompleteInProcessProduction(res, "YZ"); |
|
|
|
} |
|
|
|
return res; |
|
|
|
}, pool); |
|
|
|
yzDeviceWeekDayStorage.thenAccept((result) -> { |
|
|
|
//每周的数据
|
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("YZWeekList", result); |
|
|
|
if (map.containsKey("YZ")) { // 如果存在
|
|
|
|
JSONObject yz = (JSONObject) map.get("YZ"); |
|
|
|
res.put("yz_plan_day", yz.getString("yz_plan_day")); |
|
|
|
res.put("yz_real_day", yz.getString("yz_real_day")); |
|
|
|
res.put("yz_productivity", yz.getString("yz_productivity")); |
|
|
|
res.put("YZDayList", yz.getJSONArray("YZDayList")); |
|
|
|
map.put("YZ", res); |
|
|
|
} else { |
|
|
|
map.put("YZ", res); |
|
|
|
} |
|
|
|
}).exceptionally((e) -> { |
|
|
|
log.error("获取压制(每周)信息: {}", e.getMessage(), e); |
|
|
|
List<NumberDto> dtos = new ArrayList<>(); |
|
|
|
setResultCompleteInProcessProduction(dtos, "YZ"); |
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("YZWeekList", dtos); |
|
|
|
if (map.containsKey("YZ")) { // 如果存在
|
|
|
|
JSONObject yz = (JSONObject) map.get("YZ"); |
|
|
|
res.put("yz_plan_day", yz.getString("yz_plan_day")); |
|
|
|
res.put("yz_real_day", yz.getString("yz_real_day")); |
|
|
|
res.put("yz_productivity", yz.getString("yz_productivity")); |
|
|
|
res.put("YZDayList", yz.getJSONArray("YZDayList")); |
|
|
|
map.put("YZ", res); |
|
|
|
} else { |
|
|
|
map.put("YZ", res); |
|
|
|
} |
|
|
|
return null; |
|
|
|
}); |
|
|
|
// 3.1 获取包装的计划与实际生产数量:单位万块, 每天的合格与不合格数量
|
|
|
|
CompletableFuture<List<NumberDto>> bzPlanAndRealStorage = CompletableFuture.supplyAsync(() -> { |
|
|
|
List<NumberDto> res = new CopyOnWriteArrayList<>(); |
|
|
|
// 查找所有包装每天的数据
|
|
|
|
JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "3")).process().getResultJSONArray(0); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
res = result.toJavaList(NumberDto.class); |
|
|
|
} |
|
|
|
return res; |
|
|
|
}, pool); |
|
|
|
bzPlanAndRealStorage.thenAccept((result) -> { |
|
|
|
// 整理数据
|
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
int sumRealDay = 0; |
|
|
|
int sumPlanDay = 0; |
|
|
|
for (NumberDto numberDto : result) { |
|
|
|
sumRealDay += numberDto.getReal_qty(); |
|
|
|
sumPlanDay += numberDto.getPlan_qty(); |
|
|
|
} |
|
|
|
res.put("bz_plan_day", BigDecimal.valueOf((double) sumPlanDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); |
|
|
|
res.put("bz_real_day", BigDecimal.valueOf((double) sumRealDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); |
|
|
|
res.put("bz_productivity", sumRealDay / sumPlanDay); |
|
|
|
res.put("BZDayList", result); |
|
|
|
if (map.containsKey("BZ")) { // 如果存在
|
|
|
|
JSONObject bz = (JSONObject) map.get("BZ"); |
|
|
|
res.put("BZWeekList", bz.getJSONArray("BZWeekList")); |
|
|
|
map.put("BZ", res); |
|
|
|
} else { |
|
|
|
map.put("BZ", res); |
|
|
|
} |
|
|
|
}).exceptionally((e) -> { |
|
|
|
log.error("获取包装设备生产信息: {}", e.getMessage(), e); |
|
|
|
List<NumberDto> dtos = new ArrayList<>(); |
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("bz_plan_day", "0.00"); |
|
|
|
res.put("bz_real_day", "0.00"); |
|
|
|
res.put("bz_productivity", 0); |
|
|
|
res.put("BZDayList", dtos); |
|
|
|
if (map.containsKey("BZ")) { // 如果存在
|
|
|
|
JSONObject bz = (JSONObject) map.get("BZ"); |
|
|
|
res.put("BZWeekList", bz.getJSONArray("BZWeekList")); |
|
|
|
map.put("BZ", res); |
|
|
|
} else { |
|
|
|
map.put("BZ", res); |
|
|
|
} |
|
|
|
return null; |
|
|
|
}); |
|
|
|
// 3.2 包装每周的合格与不合格数量
|
|
|
|
CompletableFuture<List<NumberDto>> bzDeviceWeekDayStorage = CompletableFuture.supplyAsync(() -> { |
|
|
|
List<NumberDto> res = new CopyOnWriteArrayList<>(); |
|
|
|
// 查找所有包装每周的数据
|
|
|
|
JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "4")).process().getResultJSONArray(0); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
res = result.toJavaList(NumberDto.class); |
|
|
|
} |
|
|
|
return res; |
|
|
|
}, pool); |
|
|
|
bzDeviceWeekDayStorage.thenAccept((result) -> { |
|
|
|
//每周的数据
|
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("BZWeekList", result); |
|
|
|
if (map.containsKey("BZ")) { // 如果存在
|
|
|
|
JSONObject bz = (JSONObject) map.get("BZ"); |
|
|
|
res.put("bz_plan_day", bz.getString("bz_plan_day")); |
|
|
|
res.put("bz_real_day", bz.getString("bz_real_day")); |
|
|
|
res.put("bz_productivity", bz.getString("bz_productivity")); |
|
|
|
res.put("BZDayList", bz.getJSONArray("BZDayList")); |
|
|
|
map.put("BZ", res); |
|
|
|
} else { |
|
|
|
map.put("BZ", res); |
|
|
|
} |
|
|
|
}).exceptionally((e) -> { |
|
|
|
log.error("获取包装(每周)信息: {}", e.getMessage(), e); |
|
|
|
List<NumberDto> dtos = new ArrayList<>(); |
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("BZWeekList", dtos); |
|
|
|
if (map.containsKey("BZ")) { // 如果存在
|
|
|
|
JSONObject bz = (JSONObject) map.get("BZ"); |
|
|
|
res.put("bz_plan_day", bz.getString("bz_plan_day")); |
|
|
|
res.put("bz_real_day", bz.getString("bz_real_day")); |
|
|
|
res.put("bz_productivity", bz.getString("bz_productivity")); |
|
|
|
res.put("BZDayList", bz.getJSONArray("BZDayList")); |
|
|
|
map.put("BZ", res); |
|
|
|
} else { |
|
|
|
map.put("BZ", res); |
|
|
|
} |
|
|
|
return null; |
|
|
|
}); |
|
|
|
// 4 成品出入库
|
|
|
|
CompletableFuture<List<InventoryDto>> cpDeviceDataStorage = CompletableFuture.supplyAsync(() -> { |
|
|
|
List<InventoryDto> res = new CopyOnWriteArrayList<>(); |
|
|
|
// 查找所有包装每周的数据
|
|
|
|
return res; |
|
|
|
}, pool); |
|
|
|
cpDeviceDataStorage.thenAccept((result) -> { |
|
|
|
//数据
|
|
|
|
JSONObject result1 = new JSONObject(); |
|
|
|
JSONArray jsonArray = new JSONArray(); |
|
|
|
for (int i = 1; i <= 5; i++) { |
|
|
|
InventoryDto dto = new InventoryDto(); |
|
|
|
dto.setInventory_qty(1000000); |
|
|
|
dto.setRegion_out_qty(5000); |
|
|
|
dto.setRegion_in_qty(9995000); |
|
|
|
dto.setMaterial_code("成品" + i); |
|
|
|
jsonArray.add(dto); |
|
|
|
} |
|
|
|
result1.put("in_qty", "100.00"); |
|
|
|
result1.put("out_qty", "10.00"); |
|
|
|
result1.put("inventory_qty", "90.00"); |
|
|
|
result1.put("in_productivity", 30); |
|
|
|
result1.put("out_productivity", 60); |
|
|
|
result1.put("inv_productivity", 80); |
|
|
|
result1.put("KCDayList", jsonArray); |
|
|
|
result1.put("KCWeekList", jsonArray); |
|
|
|
map.put("KC", result1); |
|
|
|
}).exceptionally((e) -> { |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
JSONArray jsonArray = new JSONArray(); |
|
|
|
for (int i = 1; i <= 5; i++) { |
|
|
|
InventoryDto dto = new InventoryDto(); |
|
|
|
dto.setInventory_qty(1000000); |
|
|
|
dto.setRegion_out_qty(5000); |
|
|
|
dto.setRegion_in_qty(9995000); |
|
|
|
dto.setMaterial_code("成品" + i); |
|
|
|
jsonArray.add(dto); |
|
|
|
} |
|
|
|
result.put("in_qty", "100.00"); |
|
|
|
result.put("out_qty", "10.00"); |
|
|
|
result.put("inventory_qty", "90.00"); |
|
|
|
result.put("in_productivity", 30); |
|
|
|
result.put("out_productivity", 60); |
|
|
|
result.put("inv_productivity", 80); |
|
|
|
result.put("KCDayList", jsonArray); |
|
|
|
result.put("KCWeekList", jsonArray); |
|
|
|
map.put("KC", result); |
|
|
|
return null; |
|
|
|
}); |
|
|
|
CompletableFuture<Void> allQuery = CompletableFuture.allOf(mixMaterialStorage |
|
|
|
, mixDeviceWeekDayStorage |
|
|
|
, yzPlanAndRealStorage |
|
|
|
, yzDeviceWeekDayStorage |
|
|
|
, bzPlanAndRealStorage |
|
|
|
, bzDeviceWeekDayStorage |
|
|
|
, cpDeviceDataStorage); |
|
|
|
CompletableFuture<ConcurrentHashMap<String, Object>> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { |
|
|
|
log.error(e.getMessage(), e); |
|
|
|
return null; |
|
|
|
}); |
|
|
|
future.join(); |
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断静置状态 |
|
|
|
*/ |
|
|
|
private void getStandingStatus(SchBasePointDto schBasePointDto) { |
|
|
|
if (StringUtils.isNotBlank(schBasePointDto.getInstorage_time()) && null != schBasePointDto.getStanding_time()) { |
|
|
|
DateTime nowTime = DateUtil.parse(DateUtil.now(), DatePattern.NORM_DATETIME_FORMAT); |
|
|
|
DateTime inStorageTime = DateUtil.parse(schBasePointDto.getInstorage_time(), DatePattern.NORM_DATETIME_FORMAT); |
|
|
|
long minute = DateUtil.between(nowTime, inStorageTime, DateUnit.MINUTE); |
|
|
|
if (minute < schBasePointDto.getStanding_time().longValue()) { |
|
|
|
schBasePointDto.setStanding_status("静置中"); |
|
|
|
} else { |
|
|
|
schBasePointDto.setStanding_status("静置完成"); |
|
|
|
} |
|
|
|
if (schBasePointDto.getPoint_status().equals(PointEnum.POINT_STATUS_EMPTY_POSITION.getCode())) { |
|
|
|
schBasePointDto.setPoint_status("空盅"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 处理空白数据设置默认值 |
|
|
|
*/ |
|
|
@ -394,21 +760,43 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断静置状态 |
|
|
|
* 处理空白数据 - 工序 |
|
|
|
* |
|
|
|
* @param result |
|
|
|
*/ |
|
|
|
private void getStandingStatus(SchBasePointDto schBasePointDto) { |
|
|
|
if (StringUtils.isNotBlank(schBasePointDto.getInstorage_time()) && null != schBasePointDto.getStanding_time()) { |
|
|
|
DateTime nowTime = DateUtil.parse(DateUtil.now(), DatePattern.NORM_DATETIME_FORMAT); |
|
|
|
DateTime inStorageTime = DateUtil.parse(schBasePointDto.getInstorage_time(), DatePattern.NORM_DATETIME_FORMAT); |
|
|
|
long minute = DateUtil.between(nowTime, inStorageTime, DateUnit.MINUTE); |
|
|
|
if (minute < schBasePointDto.getStanding_time().longValue()) { |
|
|
|
schBasePointDto.setStanding_status("静置中"); |
|
|
|
private void setResultCompleteInProcessProduction(List<NumberDto> result, String region_code) { |
|
|
|
HashSet<String> existingLabels = new HashSet<>(); // 创建一个 HashSet 对象
|
|
|
|
// 遍历 result 列表中的每个 ProductionStatisticsDto 对象
|
|
|
|
for (NumberDto dto : result) { |
|
|
|
// 检查 device_code 字段是否存在于 existingLabels 集合中
|
|
|
|
if (!existingLabels.contains(dto.getDevice_code())) { |
|
|
|
// 将缺少的标签值添加到 existingLabels 集合中
|
|
|
|
existingLabels.add(dto.getDevice_code()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取所有设备编码
|
|
|
|
WQLObject deviceTab = WQLObject.getWQLObject("pdm_bi_device"); |
|
|
|
JSONArray resultJSONArray = deviceTab.query("region_code = '" + region_code + "' AND is_workorder = '1'").getResultJSONArray(0); |
|
|
|
for (int i = 0; i < resultJSONArray.size(); i++) { |
|
|
|
JSONObject jsonObject = resultJSONArray.getJSONObject(i); |
|
|
|
if (!existingLabels.contains(jsonObject.getString("device_code"))) { |
|
|
|
NumberDto dto = new NumberDto(); |
|
|
|
dto.setDevice_code(jsonObject.getString("device_code")); |
|
|
|
dto.setRegion_code(jsonObject.getString("region_code")); |
|
|
|
dto.setDevice_name(jsonObject.getString("device_name")); |
|
|
|
dto.setPlan_qty(0); |
|
|
|
dto.setReal_qty(0); |
|
|
|
dto.setQualified_qty(0); |
|
|
|
dto.setUnqualified_qty(0); |
|
|
|
result.add(dto); |
|
|
|
} else { |
|
|
|
schBasePointDto.setStanding_status("静置完成"); |
|
|
|
result.forEach(numberDto -> { |
|
|
|
if (numberDto.getDevice_code().equals(jsonObject.getString("device_code"))) { |
|
|
|
numberDto.setDevice_name(jsonObject.getString("device_name")); |
|
|
|
} |
|
|
|
if (schBasePointDto.getPoint_status().equals(PointEnum.POINT_STATUS_EMPTY_POSITION.getCode())) { |
|
|
|
schBasePointDto.setPoint_status("空盅"); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
Collections.sort(result, Comparator.comparing(NumberDto::getDevice_code)); |
|
|
|
} |
|
|
|
} |
|
|
|