fix:修复总览,涂板,固化,暂存页面没数据问题;

add:增加搬运管理接口
This commit is contained in:
2024-09-18 09:22:51 +08:00
parent 38a3588e3b
commit e2446637d7
5 changed files with 307 additions and 172 deletions

View File

@@ -38,8 +38,8 @@ public class CockpitController {
} }
@PostMapping("/allDeviceStatus") @PostMapping("/allDeviceStatus")
@Log("设备ui") @Log("秒刷接口")
@ApiOperation("设备ui") @ApiOperation("秒刷接口")
public ResponseEntity<Object> allDeviceStatus() { public ResponseEntity<Object> allDeviceStatus() {
return new ResponseEntity<>(cockpitService.allDeviceStatus(), HttpStatus.OK); return new ResponseEntity<>(cockpitService.allDeviceStatus(), HttpStatus.OK);
} }
@@ -55,8 +55,8 @@ public class CockpitController {
@PostMapping("/acceptDeviceFaultInfo") @PostMapping("/acceptDeviceFaultInfo")
@Log("接收acs推送的设备故障信息") @Log("查询当天的设备故障信息")
@ApiOperation("接收acs推送的设备故障信息") @ApiOperation("查询当天的设备故障信息")
public ResponseEntity<Object> acceptDeviceFaultInfo() { public ResponseEntity<Object> acceptDeviceFaultInfo() {
return new ResponseEntity<>(cockpitService.acceptDeviceFaultInfo(),HttpStatus.OK); return new ResponseEntity<>(cockpitService.acceptDeviceFaultInfo(),HttpStatus.OK);
} }

View File

@@ -16,6 +16,8 @@ public class TaskInfo extends ErrorData {
private String point_code1; private String point_code1;
private String point_code2; private String point_code2;
private String material_name; private String material_name;
private String material_spec;
private String qty;
private String vehicle_type; private String vehicle_type;
private String vehicle_code; private String vehicle_code;
private String task_type; private String task_type;

View File

@@ -24,7 +24,6 @@ import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint; import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.task.service.ISchBaseTaskService; import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task_manage.enums.RegionCodeConstant; import org.nl.wms.sch.task_manage.enums.RegionCodeConstant;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
@@ -89,22 +88,22 @@ public class CockpitServiceImpl implements CockpitService {
JSONObject getHomeInfo = new JSONObject(); JSONObject getHomeInfo = new JSONObject();
//生产任务目标达成 //生产任务目标达成
JSONObject target_achievement = cockpitMapper.getProductTarget(); JSONObject target_achievement = cockpitMapper.getProductTarget();
List<Map<String, Object>> productionSummaryList = new ArrayList<>();
for (String itemName : Arrays.asList("1", "2", "3")) {
//固化汇总 Map<String, Object> item = new HashMap<>();
CompletableFuture<List<DayData>> task2 = CompletableFuture.supplyAsync(() -> { item.put("item_name", itemName);
List<DayData> dayDataList = new ArrayList<>(); item.put("item_qty", "0");
try { productionSummaryList.add(item);
dayDataList = cockpitMapper.getGhCuringSummary(); }
} catch (Exception e) { JSONObject production_summary = cockpitMapper.getProductionsummary();
DayData dayData = new DayData(); if (ObjectUtil.isNotEmpty(production_summary)) {
dayData.setError_info(e.toString()); productionSummaryList.forEach(item -> {
dayDataList.add(dayData); String key = item.get("item_name").toString().toLowerCase();
} if (ObjectUtil.isNotEmpty(production_summary.get(key))) {
return dayDataList; item.put("item_qty", production_summary.get(key).toString());
}, pool); }
});
}
//暂存库库存结构 //暂存库库存结构
JSONObject zc_storage_info = new JSONObject(); JSONObject zc_storage_info = new JSONObject();
List<Map<String, Object>> material_info = cockpitMapper.getZcMaterialmsg(); List<Map<String, Object>> material_info = cockpitMapper.getZcMaterialmsg();
@@ -116,36 +115,20 @@ public class CockpitServiceImpl implements CockpitService {
List<Map<String, Object>> today_work = cockpitMapper.getTdWorkmsg(); List<Map<String, Object>> today_work = cockpitMapper.getTdWorkmsg();
if (ObjectUtil.isEmpty(today_work)) { if (ObjectUtil.isEmpty(today_work)) {
Map<String, Object> item1 = new HashMap<>(); Map<String, Object> item1 = new HashMap<>();
item1.put("workorder_code", "240712001"); item1.put("workorder_code", "240918001");
item1.put("material_name", "13.2正"); item1.put("material_name", "TS_12Z中负");
item1.put("plan_qty", "100"); item1.put("plan_qty", "100");
item1.put("real_qty", "0"); item1.put("real_qty", "0");
item1.put("point_name", "普涂线01"); item1.put("point_name", "普涂线01");
item1.put("workorder_status", "生产中"); item1.put("workorder_status", "生产中");
today_work.add(item1); today_work.add(item1);
} }
List<Map<String, Object>> tb_real_qty = cockpitMapper.getTxQty("7", "TBX");
// todo 7天生产统计
List<Map<String, Object>> tb_real_qty = cockpitMapper.getTxQty("7");
List<Map<String, Object>> gh_real_qty = cockpitMapper.getGhsQty("7"); List<Map<String, Object>> gh_real_qty = cockpitMapper.getGhsQty("7");
if (ObjectUtil.isEmpty(tb_real_qty)) { List<Map<String, Object>> tb_real_qty_default = new ArrayList<>();
for (int i = 0; i < 7; i++) { List<Map<String, Object>> gh_real_qty_default = new ArrayList<>();
Map<String, Object> item = new HashMap<>(); getWeekWorkStatistics(tb_real_qty, tb_real_qty_default, "TBX", 7);
item.put("region_name", "TBX"); getWeekWorkStatistics(gh_real_qty, gh_real_qty_default, "GHS", 7);
item.put("total_qty", "0");
item.put("date", today.minusDays(i).format(formatter));
tb_real_qty.add(item);
}
}
if (ObjectUtil.isEmpty(gh_real_qty)) {
for (int i = 0; i < 7; i++) {
Map<String, Object> item = new HashMap<>();
item.put("region_name", "GHS");
item.put("total_qty", "0");
item.put("date", today.minusDays(i).format(formatter));
gh_real_qty.add(item);
}
}
//设备运行状态 //设备运行状态
JSONObject device_status = new JSONObject(); JSONObject device_status = new JSONObject();
//状态信息 //状态信息
@@ -156,24 +139,66 @@ public class CockpitServiceImpl implements CockpitService {
device_status.put("storage_info", storage_info); device_status.put("storage_info", storage_info);
//实时故障告警 //实时故障告警
List<Map<String, Object>> fault_alarm = cockpitMapper.faultAlarm(); List<Map<String, Object>> fault_alarm = cockpitMapper.faultAlarm();
faultAlarmDefault(fault_alarm, "GHS02"); faultAlarmDefault(fault_alarm, "TS_GHS02");
//近30日故障统计 //近30日故障统计
JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics(); JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics();
monthlyFaultStatisticsDefault(monthly_fault_statistics, "GHS02"); monthlyFaultStatisticsDefault(monthly_fault_statistics, "TS_GHS02");
//设备报警前十 //设备报警前十
List<Map<String, Object>> gh_statistics = cockpitMapper.ghStatistics(); List<Map<String, Object>> gh_statistics = cockpitMapper.ghStatistics();
getHomeInfo.put("target_achievement", target_achievement); getHomeInfo.put("target_achievement", target_achievement);
getHomeInfo.put("zc_storage_info", zc_storage_info); getHomeInfo.put("zc_storage_info", zc_storage_info);
getHomeInfo.put("today_work", today_work); getHomeInfo.put("today_work", today_work);
getHomeInfo.put("tbx_produce", tb_real_qty); getHomeInfo.put("tbx_produce", tb_real_qty_default);
getHomeInfo.put("ghs_produce", gh_real_qty); getHomeInfo.put("ghs_produce", gh_real_qty_default);
getHomeInfo.put("device_status", device_status); getHomeInfo.put("device_status", device_status);
getHomeInfo.put("fault_alarm", fault_alarm); getHomeInfo.put("fault_alarm", fault_alarm);
getHomeInfo.put("monthly_fault_statistics", monthly_fault_statistics); getHomeInfo.put("monthly_fault_statistics", monthly_fault_statistics);
getHomeInfo.put("gh_statistics", gh_statistics); getHomeInfo.put("gh_statistics", gh_statistics);
getHomeInfo.put("production_summary", productionSummaryList);
return getHomeInfo; return getHomeInfo;
} }
private void getWeekWorkStatistics(List<Map<String, Object>> gh_real_qty, List<Map<String, Object>> tb_real_qty_default, String region_name, Integer days) {
for (int i = 0; i < days; i++) {
Map<String, Object> item = new HashMap<>();
item.put("region_name", region_name);
item.put("total_qty", "0");
item.put("date", today.minusDays(i).format(formatter));
tb_real_qty_default.add(item);
}
Map<String, BigDecimal> ghRealQtyMap = gh_real_qty.stream()
.collect(Collectors.toMap(
item -> (String) item.get("date"),
item -> (BigDecimal) item.get("total_qty")
));
tb_real_qty_default.forEach(tbItem -> {
String date = (String) tbItem.get("date");
if (ghRealQtyMap.containsKey(date)) {
tbItem.put("total_qty", ghRealQtyMap.get(date));
}
});
}
private void getMonthlyWorkStatistics(List<Map<String, Object>> gh_real_qty, List<Map<String, Object>> tb_real_qty_default, String region_name) {
for (int i = 0; i < 7; i++) {
Map<String, Object> item = new HashMap<>();
item.put("region_name", region_name);
item.put("total_qty", "0");
item.put("date", today.minusDays(i).format(formatter));
tb_real_qty_default.add(item);
}
Map<String, BigDecimal> ghRealQtyMap = gh_real_qty.stream()
.collect(Collectors.toMap(
item -> (String) item.get("date"),
item -> (BigDecimal) item.get("total_qty")
));
tb_real_qty_default.forEach(tbItem -> {
String date = (String) tbItem.get("date");
if (ghRealQtyMap.containsKey(date)) {
tbItem.put("total_qty", ghRealQtyMap.get(date));
}
});
}
/** /**
@@ -188,71 +213,83 @@ public class CockpitServiceImpl implements CockpitService {
JSONObject target_achievement = new JSONObject(); JSONObject target_achievement = new JSONObject();
JSONObject lt_production = cockpitMapper.ltProduction(); JSONObject lt_production = cockpitMapper.ltProduction();
JSONObject pt_production = cockpitMapper.ptProduction(); JSONObject pt_production = cockpitMapper.ptProduction();
if (ObjectUtil.isEmpty(lt_production)) { target_achievement.put("lt_production", getTargetProduction(lt_production));
lt_production = new JSONObject(); target_achievement.put("pt_production", getTargetProduction(pt_production));
lt_production.put("plan_production", "0");
lt_production.put("actual_production", "0");
lt_production.put("percentage", "0");
}
if (ObjectUtil.isEmpty(pt_production)) {
pt_production = new JSONObject();
pt_production.put("plan_production", "0");
pt_production.put("actual_production", "0");
pt_production.put("percentage", "0");
}
target_achievement.put("lt_production", lt_production);
target_achievement.put("pt_production", pt_production);
//今日涂板任务 //今日涂板任务
JSONArray today_work = cockpitMapper.todayTbTask(); JSONArray today_work = cockpitMapper.todayTbTask();
if (ObjectUtil.isEmpty(today_work)) { if (ObjectUtil.isEmpty(today_work)) {
JSONObject item1 = new JSONObject(); JSONObject item1 = new JSONObject();
item1.put("workorder_code", "240712002"); item1.put("workorder_code", "test_240712002");
item1.put("material_name", "13.2正"); item1.put("material_name", "13.2正");
item1.put("plan_qty", "100"); item1.put("plan_qty", "100");
item1.put("real_qty", "0"); item1.put("real_qty", "0");
item1.put("point_name", "连涂线01"); item1.put("point_name", "连涂线01");
item1.put("workorder_status", "生产中"); item1.put("workorder_status", "就绪");
today_work.add(item1); today_work.add(item1);
} }
//实时故障告警 //实时故障告警
List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("TBX"); List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("TBX");
faultAlarmDefault(fault_alarm, "LTX02"); faultAlarmDefault(fault_alarm, "TS_LTX02");
//近30日故障统计 //近30日故障统计
JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("TBX"); JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("TBX");
monthlyFaultStatisticsDefault(monthly_fault_statistics, "LTX02"); monthlyFaultStatisticsDefault(monthly_fault_statistics, "TS_LTX02");
List<Map<String, Object>> monthly_produce_statistics = cockpitMapper.getTbxMonthlyStatistics();
//todo 近30日生产 List<Map<String, Object>> tbxMonthlyStatistics = new ArrayList<>();
// JSONArray monthly_produce_statistics = cockpitMapper.FaultTotal("TBX"); for (int i = 0; i < 30; i++) {
List<Map<String, Object>> monthly_produce_statistics = new ArrayList<>(); Map<String, Object> item1 = new HashMap<>();
if (ObjectUtil.isEmpty(monthly_produce_statistics)) { item1.put("region_name", "LT");
for (int i = 0; i < 30; i++) { item1.put("total_qty", "0");
Map<String, Object> item1 = new HashMap<>(); item1.put("date", today.minusDays(i).format(formatter));
item1.put("region_name", "LT"); Map<String, Object> item2 = new HashMap<>();
item1.put("total_qty", "0"); item2.put("region_name", "PT");
item1.put("date", today.minusDays(i).format(formatter)); item2.put("total_qty", "0");
Map<String, Object> item2 = new HashMap<>(); item2.put("date", today.minusDays(i).format(formatter));
item2.put("region_name", "PT"); Map<String, Object> item3 = new HashMap<>();
item2.put("total_qty", "0"); item3.put("region_name", "total");
item2.put("date", today.minusDays(i).format(formatter)); item3.put("total_qty", "0");
Map<String, Object> item3 = new HashMap<>(); item3.put("date", today.minusDays(i).format(formatter));
item3.put("region_name", "total"); tbxMonthlyStatistics.add(item1);
item3.put("total_qty", "0"); tbxMonthlyStatistics.add(item2);
item3.put("date", today.minusDays(i).format(formatter)); tbxMonthlyStatistics.add(item3);
monthly_produce_statistics.add(item1); }
monthly_produce_statistics.add(item2); monthly_produce_statistics.forEach(item -> {
monthly_produce_statistics.add(item3); String key = item.get("region_name").toString().toUpperCase();
} tbxMonthlyStatistics.forEach(r -> {
if (r.get("region_name").equals(key) && item.get("date").equals(r.get("date"))) {
r.put("total_qty", item.get("total_qty").toString());
}
});
});
for (int i = 0; i < tbxMonthlyStatistics.size(); i += 3) {
Map<String, Object> item1 = tbxMonthlyStatistics.get(i);
Map<String, Object> item2 = tbxMonthlyStatistics.get(i + 1);
Map<String, Object> item3 = tbxMonthlyStatistics.get(i + 2);
BigDecimal totalQty1 = new BigDecimal(item1.get("total_qty").toString());
BigDecimal totalQty2 = new BigDecimal(item2.get("total_qty").toString());
BigDecimal totalQtySum = totalQty1.add(totalQty2);
item3.put("total_qty", totalQtySum.toString());
} }
getTbxInfo.put("target_achievement", target_achievement); getTbxInfo.put("target_achievement", target_achievement);
getTbxInfo.put("today_work", today_work); getTbxInfo.put("today_work", today_work);
getTbxInfo.put("fault_alarm", fault_alarm); getTbxInfo.put("fault_alarm", fault_alarm);
getTbxInfo.put("monthly_fault_statistics", monthly_fault_statistics); getTbxInfo.put("monthly_fault_statistics", monthly_fault_statistics);
getTbxInfo.put("monthly_produce_statistics", monthly_produce_statistics); getTbxInfo.put("monthly_produce_statistics", tbxMonthlyStatistics);
return getTbxInfo; return getTbxInfo;
} }
private static JSONObject getTargetProduction(JSONObject production) {
if (ObjectUtil.isEmpty(production)) {
production = new JSONObject();
production.put("plan_production", "0");
production.put("actual_production", "0");
production.put("percentage", "0");
}
return production;
}
/** /**
* 固化室 * 固化室
*
* @return * @return
*/ */
@Override @Override
@@ -262,39 +299,55 @@ public class CockpitServiceImpl implements CockpitService {
JSONArray curing_summary = cockpitMapper.curingSummary(); JSONArray curing_summary = cockpitMapper.curingSummary();
//todo 近30天固化数据 //todo 近30天固化数据
List<Map<String, Object>> monthly_gh_qty = cockpitMapper.getGhsQty("30"); List<Map<String, Object>> monthly_gh_qty = cockpitMapper.getGhsQty("30");
if (ObjectUtil.isEmpty(monthly_gh_qty)) { List<Map<String, Object>> monthly_gh_qty_default = new ArrayList<>();
for (int i = 0; i < 30; i++) { getWeekWorkStatistics(monthly_gh_qty, monthly_gh_qty_default, "GH", 30);
Map<String, Object> item = new HashMap<>(); //今日固化任务
item.put("region_name", "GH");
item.put("total_qty", "0");
item.put("date", today.minusDays(i).format(formatter));
monthly_gh_qty.add(item);
}
}
//todo 近固化物料汇总
List<Map<String, Object>> gh_material_summary = new ArrayList<>(); List<Map<String, Object>> gh_material_summary = new ArrayList<>();
if (ObjectUtil.isEmpty(gh_material_summary)) { CompletableFuture<List<TaskInfo>> task3 = CompletableFuture.supplyAsync(() -> {
List<TaskInfo> tasks = new ArrayList<>();
try {
tasks = getTasks(RegionCodeConstant.CURING_ZONE);
} catch (Exception e) {
TaskInfo taskInfo = new TaskInfo();
taskInfo.setError_info(e.toString());
tasks.add(taskInfo);
}
return tasks;
}, pool);
List<TaskInfo> taskInfos = task3.join();
if (ObjectUtil.isNotEmpty(taskInfos )){
taskInfos.forEach(r -> {
if (r.getError_info() != null) {
Map<String, Object> item = new HashMap<>();
item.put("material_name", r.getMaterial_name());
item.put("material_spec", r.getMaterial_spec());
item.put("qty", r.getQty());
item.put("type", r.getTask_type());
gh_material_summary.add(item);
}
});
} else {
Map<String, Object> item1 = new HashMap<>(); Map<String, Object> item1 = new HashMap<>();
item1.put("material_name", "1.9A正"); item1.put("material_name", "TS_1.9A正");
item1.put("material_spec", "正涂片极板1.9A/大片"); item1.put("material_spec", "正涂片极板1.9A/大片");
item1.put("qty", "2000"); item1.put("qty", "100");
item1.put("type", "入库"); item1.put("type", "入库");
Map<String, Object> item2 = new HashMap<>(); Map<String, Object> item2 = new HashMap<>();
item2.put("material_name", "15A负"); item2.put("material_name", "TS_15A负");
item2.put("material_spec", "负涂片极板15A/大片"); item2.put("material_spec", "负涂片极板15A/大片");
item2.put("qty", "3000"); item2.put("qty", "100");
item2.put("type", "出库"); item2.put("type", "出库");
gh_material_summary.add(item1); gh_material_summary.add(item1);
gh_material_summary.add(item2); gh_material_summary.add(item2);
} }
//实时故障告警 //实时故障告警
List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("GH"); List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("GH");
faultAlarmDefault(fault_alarm,"GHS02"); faultAlarmDefault(fault_alarm, "TS_GHS02");
//近30日故障统计 //近30日故障统计
JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("GH"); JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("GH");
monthlyFaultStatisticsDefault(monthly_fault_statistics, "GHS02"); monthlyFaultStatisticsDefault(monthly_fault_statistics, "TS_GHS02");
getGhsInfo.put("curing_summary", curing_summary); getGhsInfo.put("curing_summary", curing_summary);
getGhsInfo.put("monthly_gh_qty", monthly_gh_qty); getGhsInfo.put("monthly_gh_qty", monthly_gh_qty_default);
getGhsInfo.put("gh_material_summary", gh_material_summary); getGhsInfo.put("gh_material_summary", gh_material_summary);
getGhsInfo.put("fault_alarm", fault_alarm); getGhsInfo.put("fault_alarm", fault_alarm);
getGhsInfo.put("monthly_fault_statistics", monthly_fault_statistics); getGhsInfo.put("monthly_fault_statistics", monthly_fault_statistics);
@@ -331,55 +384,62 @@ public class CockpitServiceImpl implements CockpitService {
JSONObject getHandlingInfo = new JSONObject(); JSONObject getHandlingInfo = new JSONObject();
//设备运行状态 //设备运行状态
JSONObject device_status = new JSONObject(); JSONObject device_status = new JSONObject();
// //状态信息 //todo 点位状态信息状态信息
// List<Map<String, Object>> agv_info = cockpitMapper.statusInfo(); List<Map<String, Object>> agv_info = cockpitMapper.statusInfo();
// //状态信息 List<Map<String, Object>> rgv_info = cockpitMapper.statusInfo();
// List<Map<String, Object>> rgv_info = cockpitMapper.statusInfo(); List<Map<String, Object>> conveyor_info = cockpitMapper.statusInfo();
// //状态信息
// List<Map<String, Object>> conveyor_info = cockpitMapper.statusInfo();
List<Map<String, Object>> agv_info = new ArrayList<>();
List<Map<String, Object>> rgv_info = new ArrayList<>();
List<Map<String, Object>> conveyor_info = new ArrayList<>();
if (ObjectUtil.isEmpty(agv_info) || ObjectUtil.isEmpty(rgv_info)) { if (ObjectUtil.isEmpty(agv_info) || ObjectUtil.isEmpty(rgv_info)) {
Map<String, Object> item1 = new HashMap<>(); Map<String, Object> item1 = new HashMap<>();
item1.put("item_name", "0"); item1.put("item_name", "1");
item1.put("item_qty", "5"); item1.put("item_qty", "8");
Map<String, Object> item2 = new HashMap<>(); Map<String, Object> item2 = new HashMap<>();
item2.put("item_name", "1"); item2.put("item_name", "2");
item2.put("item_qty", "8"); item2.put("item_qty", "2");
Map<String, Object> item3 = new HashMap<>();
item3.put("item_name", "1");
item3.put("item_qty", "9");
Map<String, Object> item4 = new HashMap<>();
item4.put("item_name", "2");
item4.put("item_qty", "1");
if (ObjectUtil.isEmpty(agv_info)) { if (ObjectUtil.isEmpty(agv_info)) {
agv_info.add(item1); agv_info.add(item1);
agv_info.add(item2); agv_info.add(item2);
} }
if (ObjectUtil.isEmpty(rgv_info)) { if (ObjectUtil.isEmpty(rgv_info)) {
rgv_info.add(item1); rgv_info.add(item3);
rgv_info.add(item2); rgv_info.add(item4);
} }
} }
if (ObjectUtil.isEmpty(conveyor_info)) { if (ObjectUtil.isEmpty(conveyor_info)) {
Map<String, Object> item1 = new HashMap<>(); Map<String, Object> item1 = new HashMap<>();
item1.put("item_name", "1"); item1.put("item_name", "3");
item1.put("item_qty", "10"); item1.put("item_qty", "6");
Map<String, Object> item2 = new HashMap<>(); Map<String, Object> item2 = new HashMap<>();
item2.put("item_name", "2"); item2.put("item_name", "4");
item2.put("item_qty", "8"); item2.put("item_qty", "7");
Map<String, Object> item3 = new HashMap<>(); Map<String, Object> item3 = new HashMap<>();
item3.put("item_name", "3"); item3.put("item_name", "5");
item3.put("item_qty", "5"); item3.put("item_qty", "8");
conveyor_info.add(item1); conveyor_info.add(item1);
conveyor_info.add(item2); conveyor_info.add(item2);
conveyor_info.add(item3); conveyor_info.add(item3);
} }
device_status.put("status_info", agv_info); device_status.put("agv_info", agv_info);
device_status.put("status_info", rgv_info); device_status.put("rgv_info", rgv_info);
device_status.put("status_info", conveyor_info); device_status.put("conveyor_info", conveyor_info);
//实时故障告警 //实时故障告警
List<Map<String, Object>> fault_alarm = cockpitMapper.faultAlarm(); List<Map<String, Object>> fault_alarm = cockpitMapper.faultAlarm();
faultAlarmDefault(fault_alarm, "RGV02"); faultAlarmDefault(fault_alarm, "TS_RGV02");
//近30日故障统计 //近30日故障统计
//JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics(); JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics();
JSONArray monthly_fault_statistics = new JSONArray(); if (ObjectUtil.isEmpty(monthly_fault_statistics)) {
monthlyFaultStatisticsDefault(monthly_fault_statistics, "RGV01"); JSONObject item = new JSONObject();
item.put("region_name", "TS_GHS");
item.put("alarm_qty", "1");
monthly_fault_statistics.add(item);
}
getHandlingInfo.put("device_status", device_status); getHandlingInfo.put("device_status", device_status);
getHandlingInfo.put("fault_alarm", fault_alarm); getHandlingInfo.put("fault_alarm", fault_alarm);
getHandlingInfo.put("monthly_fault_statistics", monthly_fault_statistics); getHandlingInfo.put("monthly_fault_statistics", monthly_fault_statistics);
@@ -401,7 +461,7 @@ public class CockpitServiceImpl implements CockpitService {
switch (point.getRegion_code()) { switch (point.getRegion_code()) {
case RegionCodeConstant.COATED_PLATE_LINE_AREA: case RegionCodeConstant.COATED_PLATE_LINE_AREA:
// hint: 涂板线是作为一整台设备显示。point设备点 // hint: 涂板线是作为一整台设备显示。point设备点
JSONArray baoshijian = (JSONArray) redisUtils.get("baoshijian"); JSONArray baoshijian = (JSONArray) redisUtils.get("baoshijian1");
points = pointService.getSubSites(deviceCode); points = pointService.getSubSites(deviceCode);
res.put("device_code", deviceCode); res.put("device_code", deviceCode);
res.put("device_name", point.getPoint_name()); res.put("device_name", point.getPoint_name());
@@ -423,7 +483,7 @@ public class CockpitServiceImpl implements CockpitService {
JSONObject one = new JSONObject(); JSONObject one = new JSONObject();
one.put("device_code", pointObj.getPoint_code()); one.put("device_code", pointObj.getPoint_code());
one.put("device_name", pointObj.getPoint_name()); one.put("device_name", pointObj.getPoint_name());
// one.put("mode", "2"); // one.put("mode", "2");
for (Object object : baoshijian) { for (Object object : baoshijian) {
JSONObject jsonObject = (JSONObject) object; JSONObject jsonObject = (JSONObject) object;
if (pointObj.getPoint_code().equals(jsonObject.getString("device_code"))) { if (pointObj.getPoint_code().equals(jsonObject.getString("device_code"))) {
@@ -449,7 +509,7 @@ public class CockpitServiceImpl implements CockpitService {
case RegionCodeConstant.CURING_ZONE: case RegionCodeConstant.CURING_ZONE:
// hint: 固化室,需要显示整个设备+内部位置明细 // hint: 固化室,需要显示整个设备+内部位置明细
points = pointService.getSubSites(deviceCode); // 小固化位置以及进出口(入口是不管的) points = pointService.getSubSites(deviceCode); // 小固化位置以及进出口(入口是不管的)
JSONArray guhuashi = (JSONArray) redisUtils.get("guhuashi"); JSONArray guhuashi = (JSONArray) redisUtils.get("guhuashi1");
for (Object object : guhuashi) { for (Object object : guhuashi) {
res.put("device_code", deviceCode); res.put("device_code", deviceCode);
res.put("device_name", point.getPoint_name()); res.put("device_name", point.getPoint_name());
@@ -510,8 +570,8 @@ public class CockpitServiceImpl implements CockpitService {
// 货位直接显示,获取组盘信息,组装数据反馈 // 货位直接显示,获取组盘信息,组装数据反馈
res.put("device_code", deviceCode); res.put("device_code", deviceCode);
res.put("device_name", point.getPoint_name()); res.put("device_name", point.getPoint_name());
// res.put("vehicle_code", ObjectUtil.isNotEmpty(point.getVehicle_code()) ? point.getVehicle_code() : "-"); // res.put("vehicle_code", ObjectUtil.isNotEmpty(point.getVehicle_code()) ? point.getVehicle_code() : "-");
// res.put("vehicle_type", ObjectUtil.isNotEmpty(point.getVehicle_type()) ? point.getVehicle_type() : "-"); // res.put("vehicle_type", ObjectUtil.isNotEmpty(point.getVehicle_type()) ? point.getVehicle_type() : "-");
if (ObjectUtil.isNotEmpty(point.getVehicle_type()) && ObjectUtil.isNotEmpty(point.getVehicle_code())) { if (ObjectUtil.isNotEmpty(point.getVehicle_type()) && ObjectUtil.isNotEmpty(point.getVehicle_code())) {
JSONObject groupInfo = cockpitMapper.getVehicleGroupInfo(point.getVehicle_code(), point.getVehicle_type()); JSONObject groupInfo = cockpitMapper.getVehicleGroupInfo(point.getVehicle_code(), point.getVehicle_type());
if (ObjectUtil.isNotEmpty(groupInfo)) { if (ObjectUtil.isNotEmpty(groupInfo)) {
@@ -519,6 +579,8 @@ public class CockpitServiceImpl implements CockpitService {
} }
} }
break; break;
default:
break;
} }
return res; return res;
} }
@@ -565,20 +627,19 @@ public class CockpitServiceImpl implements CockpitService {
@Override @Override
public JSONArray allDeviceStatus() { public JSONArray allDeviceStatus() {
JSONArray array = new JSONArray(); JSONArray array = new JSONArray();
Random random = new Random(); // Random random = new Random();
int lowerBound = 10000; // int lowerBound = 10000;
int upperBound = 18000; // int upperBound = 18000;
JSONArray baoshijian = (JSONArray) redisUtils.get("baoshijian"); JSONArray baoshijian = (JSONArray) redisUtils.get("baoshijian1");
JSONArray guhuashi = (JSONArray) redisUtils.get("guhuashi"); JSONArray guhuashi = (JSONArray) redisUtils.get("guhuashi1");
JSONArray AGV = (JSONArray) redisUtils.get("AGV"); JSONArray AGV = (JSONArray) redisUtils.get("AGV1");
// JSONArray RGV = (JSONArray) redisUtils.get("RGV1");
JSONArray RGV = (JSONArray) redisUtils.get("RGV"); JSONArray site = (JSONArray) redisUtils.get("site1");
JSONArray site = (JSONArray) redisUtils.get("site"); array.add(baoshijian);
// array.add(baoshijian); array.add(guhuashi);
// array.add(guhuashi); array.add(AGV);
// array.add(AGV); array.add(RGV);
// array.add(RGV); array.add(site);
// 固化室详情 // 固化室详情
JSONArray ghsInteriorList = cockpitMapper.getGHSInteriorList(); JSONArray ghsInteriorList = cockpitMapper.getGHSInteriorList();
JSONObject ghsDetail = new JSONObject(); JSONObject ghsDetail = new JSONObject();
@@ -676,20 +737,16 @@ public class CockpitServiceImpl implements CockpitService {
* 今日任务 * 今日任务
*/ */
public List<TaskInfo> getTasks(String type) { public List<TaskInfo> getTasks(String type) {
// 获取今天的日期时间范围
LocalDateTime startOfDay = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endOfDay = startOfDay.plusDays(1).minusNanos(1);
List<TaskInfo> tasks = new ArrayList<>(); List<TaskInfo> tasks = new ArrayList<>();
if (RegionCodeConstant.CURING_ZONE.equals(type)) { if (RegionCodeConstant.CURING_ZONE.equals(type)) {
// 固化室当天出入库任务 // 固化室当天出入库任务
List<SchBaseTask> todayTasks = taskService.list(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getIs_delete, 0).between(SchBaseTask::getCreate_time, startOfDay, endOfDay).and(wrapper -> wrapper.eq(SchBaseTask::getConfig_code, "1").or().eq(SchBaseTask::getConfig_code, "2"))); tasks = cockpitMapper.gettodayGhTaskList();
tasks = ColaBeanUtils.copyListProperties(todayTasks, TaskInfo::new);
} else if (RegionCodeConstant.STAGING_AREA.equals(type)) { } else if (RegionCodeConstant.STAGING_AREA.equals(type)) {
// 暂存区当天出入库任务 // 暂存区当天出入库任务
List<TaskInfo> inTasks = cockpitMapper.getTemporaryInTask(); List<TaskInfo> inTaskList = cockpitMapper.getTemporaryInTask();
List<TaskInfo> outTasks = cockpitMapper.getTemporaryOutTask(); List<TaskInfo> outTaskList = cockpitMapper.getTemporaryOutTask();
tasks.addAll(inTasks); tasks.addAll(inTaskList);
tasks.addAll(outTasks); tasks.addAll(outTaskList);
} }
return tasks; return tasks;
} }

View File

@@ -8,9 +8,7 @@ import org.apache.ibatis.annotations.Select;
import org.nl.wms.cockpit.service.dao.DasDeviceFault; import org.nl.wms.cockpit.service.dao.DasDeviceFault;
import org.nl.wms.cockpit.service.dao.home.DayData; import org.nl.wms.cockpit.service.dao.home.DayData;
import org.nl.wms.cockpit.service.dao.home.TargetAchievement; import org.nl.wms.cockpit.service.dao.home.TargetAchievement;
import org.nl.wms.cockpit.service.dao.zcq.Inventory;
import org.nl.wms.cockpit.service.dao.zcq.TaskInfo; import org.nl.wms.cockpit.service.dao.zcq.TaskInfo;
import org.nl.wms.cockpit.service.dao.zcq.ZcqInfo;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -49,6 +47,8 @@ public interface CockpitMapper {
List<TargetAchievement> getGhActualProduction(@Param("days") Integer days); List<TargetAchievement> getGhActualProduction(@Param("days") Integer days);
List<TaskInfo> gettodayGhTaskList();
@Select("SELECT COUNT(*) AS totalFaults, " + @Select("SELECT COUNT(*) AS totalFaults, " +
" (COUNT(*) / 30.0) * 100 AS faultRate " + " (COUNT(*) / 30.0) * 100 AS faultRate " +
"FROM das_device_fault " + "FROM das_device_fault " +
@@ -73,33 +73,53 @@ public interface CockpitMapper {
*/ */
JSONArray getGHSInteriorList(); JSONArray getGHSInteriorList();
JSONArray getSSXInteriorList(); JSONArray getSSXInteriorList();
JSONArray getZCList(); JSONArray getZCList();
JSONArray getKJList(); JSONArray getKJList();
//目前是获取当天的错误数据 //目前是获取当天的错误数据
JSONArray getError(); JSONArray getError();
//获取生产中的工单数据 //获取生产中的工单数据
JSONObject getProductTarget(); JSONObject getProductTarget();
//获取暂存库库存信息 //获取暂存库库存信息
List<Map<String, Object>> getZcMaterialmsg(); List<Map<String, Object>> getZcMaterialmsg();
//获取暂存库库存信息
JSONObject getProductionsummary();
//库位使用占比 //库位使用占比
String percent(); String percent();
//获取今日创建的每一条工单的信息 //获取今日创建的每一条工单的信息
List<Map<String, Object>> getTdWorkmsg(); List<Map<String, Object>> getTdWorkmsg();
//7天涂板实际生产 //7天涂板实际生产
List<Map<String, Object>> getTxQty(String days); List<Map<String, Object>> getTxQty(String days, String region);
//7天固化室实际生产 //7天固化室实际生产
List<Map<String, Object>> getGhsQty(String days); List<Map<String, Object>> getGhsQty(String days);
//获取连涂普涂月统计数
List<Map<String, Object>> getTbxMonthlyStatistics();
//查询所传设备当前生产的工单信息 //查询所传设备当前生产的工单信息
JSONObject getDeviceWorker(String devicecode); JSONObject getDeviceWorker(String devicecode);
//根据所传的物料id获取物料名称 //根据所传的物料id获取物料名称
String getMaterialName(String material_id); String getMaterialName(String material_id);
//根据所传设备得到该设备日产量 //根据所传设备得到该设备日产量
JSONArray getProductionDay(String devicecode); JSONArray getProductionDay(String devicecode);
//根据所传设备得到该设备班产量 //根据所传设备得到该设备班产量
JSONArray getProductionTeam(String devicecode); JSONArray getProductionTeam(String devicecode);
//根据所传设备得到该设备30天生产记录 //根据所传设备得到该设备30天生产记录
JSONArray getProductionHistory(String devicecode); JSONArray getProductionHistory(String devicecode);
//今日生产连涂生产 //今日生产连涂生产

View File

@@ -62,6 +62,25 @@
</if> </if>
</select> </select>
<select id="gettodayGhTaskList" resultType="org.nl.wms.cockpit.service.dao.zcq.TaskInfo">
SELECT
CASE
t.config_code
WHEN 'TBXMLTask' THEN
'入库'
WHEN 'GHCMLTask' THEN
'出库'
END AS type,
g.material_qty,
m.material_spec,
m.material_name
FROM
sch_base_task t
LEFT JOIN sch_base_vehiclematerialgroup g ON t.group_id = g.group_id
LEFT JOIN md_base_material m ON g.material_id = m.material_id
WHERE
(t.is_delete = 0 AND DATE ( t.create_time )= CURDATE() AND ( t.config_code = 'TBXMLTask' OR t.config_code = 'GHCMLTask' ));
</select>
<select id="getCompletionPercent" resultType="org.nl.wms.cockpit.service.dao.home.TargetAchievement"> <select id="getCompletionPercent" resultType="org.nl.wms.cockpit.service.dao.home.TargetAchievement">
SELECT SELECT
@@ -181,7 +200,7 @@
SELECT CAST(point_status - 1 AS SIGNED) AS move, SELECT CAST(point_status - 1 AS SIGNED) AS move,
point_code AS device_code, point_code AS device_code,
point_name AS device_name, point_name AS device_name,
IF(LENGTH(vehicle_type) > 0, vehicle_type, '-') AS vehicle_type, IF(LENGTH(vehicle_type) > 0, vehicle_type, '0') AS vehicle_type,
parent_point_code AS device parent_point_code AS device
FROM `sch_base_point` FROM `sch_base_point`
WHERE region_code = 'GH' WHERE region_code = 'GH'
@@ -239,6 +258,17 @@
WHERE p.region_code = 'ZC' WHERE p.region_code = 'ZC'
AND p.vehicle_code IS NOT NULL AND p.vehicle_code IS NOT NULL
</select> </select>
<select id="getProductionsummary" resultType="com.alibaba.fastjson.JSONObject">
SELECT
SUM(CASE WHEN region_code LIKE 'TBX%' THEN real_qty ELSE 0 END) AS '1',
SUM(CASE WHEN region_code LIKE 'GH%' THEN real_qty ELSE 0 END) AS '2',
SUM(CASE WHEN region_code LIKE 'ZC%' THEN real_qty ELSE 0 END) AS '3'
FROM
`pdm_bd_workorder`
WHERE
workorder_status = 3
AND DATE(create_time) = CURDATE();
</select>
<select id="getTdWorkmsg" resultType="java.util.HashMap"> <select id="getTdWorkmsg" resultType="java.util.HashMap">
SELECT SELECT
w.workorder_code, w.workorder_code,
@@ -255,12 +285,12 @@
SELECT SELECT
DATE_FORMAT(create_time,'%Y-%m-%d') AS date, DATE_FORMAT(create_time,'%Y-%m-%d') AS date,
SUM(real_qty) AS total_qty, SUM(real_qty) AS total_qty,
'TBX' AS region_name #{region} AS region_name
FROM FROM
pdm_bd_workorder pdm_bd_workorder
WHERE WHERE
create_time >= CURDATE() - INTERVAL #{days} DAY create_time >= CURDATE() - INTERVAL #{days} DAY
AND region_code='TBX' AND region_code=#{region}
GROUP BY GROUP BY
DATE_FORMAT(create_time,'%Y-%m-%d') DATE_FORMAT(create_time,'%Y-%m-%d')
ORDER BY ORDER BY
@@ -281,6 +311,32 @@
ORDER BY ORDER BY
date; date;
</select> </select>
<select id="getTbxMonthlyStatistics" resultType="java.util.HashMap">
SELECT
DATE_FORMAT( create_time, '%m-%d' ) AS date,
SUM( real_qty ) AS total_qty,
'LT' AS region_name
FROM
pdm_bd_workorder
WHERE
create_time >= CURDATE() - INTERVAL 30 DAY
AND point_code LIKE 'LT%'
GROUP BY
DATE_FORMAT( create_time, '%Y-%m-%d' ) UNION ALL
SELECT
DATE_FORMAT( create_time, '%m-%d' ) AS DATE,
SUM( real_qty ) AS total_qty,
'PT' AS region_name
FROM
pdm_bd_workorder
WHERE
create_time >= CURDATE() - INTERVAL 30 DAY
AND point_code LIKE 'PT%'
GROUP BY
DATE_FORMAT( create_time, '%Y-%m-%d' )
ORDER BY
DATE;
</select>
<select id="getDeviceWorker" resultType="com.alibaba.fastjson.JSONObject"> <select id="getDeviceWorker" resultType="com.alibaba.fastjson.JSONObject">
SELECT * SELECT *
FROM FROM
@@ -550,7 +606,7 @@ GROUP BY
<![CDATA[ <![CDATA[
SELECT SELECT
m.material_name AS material_name, m.material_name AS material_name,
SUM(g.material_qty) AS total_qty SUM(g.material_qty) AS quantity
FROM FROM
sch_base_point p sch_base_point p
RIGHT JOIN sch_base_vehiclematerialgroup g ON p.vehicle_code = g.vehicle_code RIGHT JOIN sch_base_vehiclematerialgroup g ON p.vehicle_code = g.vehicle_code