From c5a6329498cd21c99574d1e1332e28321e8cb160 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Thu, 8 Jun 2023 15:44:23 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E5=A4=A7=E5=B1=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/cockpit/rest/BigScreenController.java | 88 +++ .../wms/cockpit/service/BigScreenService.java | 48 ++ .../wms/cockpit/service/enums/ColorEnum.java | 6 +- .../service/enums/DeviceStatusEnum.java | 38 + .../service/impl/BigScreenServiceImpl.java | 676 ++++++++++++++++-- .../wms/cockpit/wql/COCKPIT_FIR_AND_DRY.wql | 124 ++++ .../wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql | 232 ++++++ .../wms/cockpit/wql/COCKPIT_MOLDING_INFO.wql | 217 ++++++ .../wql/COCKPIT_PROCESS_PRODUCTION.wql | 60 +- .../cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql | 209 ++++++ .../nl/wms/sch/manage/DeviceStatusEnum.java | 28 - 11 files changed, 1638 insertions(+), 88 deletions(-) create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/enums/DeviceStatusEnum.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_FIR_AND_DRY.wql create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MOLDING_INFO.wql create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql delete mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceStatusEnum.java diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/BigScreenController.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/BigScreenController.java index 623ad31..78404b5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/BigScreenController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/BigScreenController.java @@ -48,4 +48,92 @@ public class BigScreenController { public CommonResult workshopCondition() { return RestBusinessTemplate.execute(bigScreenService::workshopCondition); } + + /** + * 混碾情况 + */ + @PostMapping("/blendingCondition") + @Log("混碾情况") + @SaIgnore + @ApiOperation("混碾情况") + public CommonResult blendingCondition() { + return RestBusinessTemplate.execute(bigScreenService::blendingCondition); + } + + /** + * 困料情况 + */ + @PostMapping("/trappedMaterialCondition") + @Log("困料情况") + @SaIgnore + @ApiOperation("困料情况") + public CommonResult trappedMaterialCondition() { + return RestBusinessTemplate.execute(bigScreenService::trappedMaterialCondition); + } + + /** + * 成型页面接口 + */ + @PostMapping("/moldingMaterialCondition") + @Log("成型页面接口 - 左边") + @SaIgnore + @ApiOperation("成型页面接口 - 左边") + public CommonResult moldingMaterialCondition() { + return RestBusinessTemplate.execute(bigScreenService::moldingMaterialCondition); + } + + /** + * 成型页面接口 + */ + @PostMapping("/moldingTableDate") + @Log("成型页面接口 - 右边") + @SaIgnore + @ApiOperation("成型页面接口 - 右边") + public CommonResult moldingTableDate() { + return RestBusinessTemplate.execute(bigScreenService::moldingTableDate); + } + + /** + * 烧制干燥接口 + */ + @PostMapping("/firingAndDrying") + @Log("烧制干燥接口 - 右边") + @SaIgnore + @ApiOperation("烧制干燥接口 - 右边") + public CommonResult firingAndDrying() { + return RestBusinessTemplate.execute(bigScreenService::firingAndDrying); + } + + /** + * 烧制干燥接口 + */ + @PostMapping("/firingAndDryingPopover") + @Log("烧制干燥接口 - 左边") + @SaIgnore + @ApiOperation("烧制干燥接口 - 左边") + public CommonResult firingAndDryingPopover() { + return RestBusinessTemplate.execute(bigScreenService::firingAndDryingPopover); + } + + /** + * 分拣包装接口 + */ + @PostMapping("/sortingAndPackaging") + @Log("分拣包装接口 - 右边") + @SaIgnore + @ApiOperation("分拣包装接口 - 右边") + public CommonResult sortingAndPackaging() { + return RestBusinessTemplate.execute(bigScreenService::sortingAndPackaging); + } + + /** + * 分拣包装接口 + */ + @PostMapping("/sortingAndPackagingPopover") + @Log("分拣包装接口 - 左边") + @SaIgnore + @ApiOperation("分拣包装接口 - 左边") + public CommonResult sortingAndPackagingPopover() { + return RestBusinessTemplate.execute(bigScreenService::sortingAndPackagingPopover); + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java index cf3d30d..d7f083a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java @@ -21,4 +21,52 @@ public interface BigScreenService { * @return */ ConcurrentHashMap processProduction(); + + /** + * 混料情况 + * @return + */ + ConcurrentHashMap blendingCondition(); + + /** + * 困料情况 + * @return + */ + ConcurrentHashMap trappedMaterialCondition(); + + /** + * 成型页面接口 + * @return + */ + ConcurrentHashMap moldingMaterialCondition(); + + /** + * 表格数据 + * @return + */ + ConcurrentHashMap moldingTableDate(); + + /** + * 烧纸和干燥 + * @return + */ + ConcurrentHashMap firingAndDrying(); + + /** + * 烧制干燥弹窗 + * @return + */ + ConcurrentHashMap firingAndDryingPopover(); + + /** + * 分拣包装接口 + * @return + */ + ConcurrentHashMap sortingAndPackaging(); + + /** + * 分拣包装接口 + * @return + */ + ConcurrentHashMap sortingAndPackagingPopover(); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/enums/ColorEnum.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/enums/ColorEnum.java index 2bc813f..c3bc1c4 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/enums/ColorEnum.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/enums/ColorEnum.java @@ -12,9 +12,9 @@ import lombok.Getter; @AllArgsConstructor public enum ColorEnum { GREY(0, "灰色"), - GREEN(1, "绿色"), - RED(2, "红色"), - YELLOW(3, "黄色"); + GREEN(2, "绿色"), + RED(3, "红色"), + YELLOW(1, "黄色"); private final Integer index; private final String colorName; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/enums/DeviceStatusEnum.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/enums/DeviceStatusEnum.java new file mode 100644 index 0000000..8949f2a --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/enums/DeviceStatusEnum.java @@ -0,0 +1,38 @@ +package org.nl.wms.cockpit.service.enums; + +/** + * @Author: lyd + * @Description: 设备状态枚举 0关机 1待机 2生产中 3故障 + * @Date: 2023/3/10 + */ +public enum DeviceStatusEnum { + STANDBY(1, "待机"), + RUNNING(2, "运行中"), + FAILURE(3, "故障"), + SHUTDOWN(0, "关机"); + private final Integer code; + private final String description; + + public static DeviceStatusEnum getDeviceStatusEnumByCode(int index) { + DeviceStatusEnum[] enums = DeviceStatusEnum.values(); + for (DeviceStatusEnum deviceStatusEnum : enums) { + if (deviceStatusEnum.getCode() == index) { + return deviceStatusEnum; + } + } + return null; // 如果没有找到对应的枚举常量,可以根据需要返回null或者抛出异常 + } + + DeviceStatusEnum(Integer code, String description) { + this.code = code; + this.description = description; + } + + public Integer getCode() { + return code; + } + + public String getDescription() { + return description; + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java index 073e7ac..33ce6cc 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java @@ -12,6 +12,7 @@ import org.nl.wms.cockpit.service.BigScreenService; import org.nl.wms.cockpit.service.dto.*; import org.nl.wms.cockpit.service.enums.ColorEnum; import org.nl.wms.cockpit.service.enums.DeviceEnum; +import org.nl.wms.cockpit.service.enums.DeviceStatusEnum; import org.nl.wms.util.MapOf; import org.springframework.stereotype.Service; @@ -85,7 +86,7 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("YZDayList", dtos); return null; }); - // 3、当日成品 + // TODO: 3、当日成品 CompletableFuture> manufacturedProductsDayProductionTask = CompletableFuture.supplyAsync(() -> { List res = new ArrayList<>(); Random random = new Random(); @@ -107,7 +108,7 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("CPDayList", null); return null; }); - // 4、设备运行情况 + // TODO: 4、设备运行情况 CompletableFuture> deviceConditionTask = CompletableFuture.supplyAsync(() -> { List res = new ArrayList<>(); for (int i = 0; i < 4; i++) { @@ -129,7 +130,7 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("DeviceConditionList", null); return null; }); - // 5、近一个月故障次数前5台设备 + // TODO: 5、近一个月故障次数前5台设备 CompletableFuture> lastMonthFailureTask = CompletableFuture.supplyAsync(() -> { List res = new ArrayList<>(); Random random = new Random(); @@ -148,7 +149,7 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("LastMonthFailureList", null); return null; }); - // 6、最近10次设备故障 + // TODO: 6、最近10次设备故障 CompletableFuture> lastTenFailureTask = CompletableFuture.supplyAsync(() -> { List res = new ArrayList<>(); for (int i = 0; i < 5; i++) { @@ -177,6 +178,7 @@ public class BigScreenServiceImpl implements BigScreenService { return res; }, pool); stackingPositionTask.thenAccept(result -> { + // TODO: 请求acs系统 for (int i = 0; i < result.size(); i++) { JSONObject jsonObject = result.getJSONObject(i); jsonObject.put("color_status", ColorEnum.RED.getIndex()); @@ -187,11 +189,15 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("StackingPositionList", null); return null; }); - // 8、压机信息显示 + // 8、压机信息显示 todo: 压机的状态,请求acs CompletableFuture pressMachineTask = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "6")) + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "10")) .process() .getResultJSONArray(0); + for (int i = 0; i < res.size(); i++) { + JSONObject jsonObject = res.getJSONObject(i); + jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); + } return res; }, pool); pressMachineTask.thenAccept(result -> { @@ -201,11 +207,15 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("PressMachineList", null); return null; }); - // 9、混料机信息显示 + // 9、混料机信息显示 todo: 设备状态,请求acs CompletableFuture mixMachineTask = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "7")) + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "11")) .process() .getResultJSONArray(0); + for (int i = 0; i < res.size(); i++) { + JSONObject jsonObject = res.getJSONObject(i); + jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); + } return res; }, pool); mixMachineTask.thenAccept(result -> { @@ -215,32 +225,58 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("MixMachineList", null); return null; }); - // 10、困料货架的信息显示 - CompletableFuture trappedMaterialShelfTask = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "8")) - .process() - .getResultJSONArray(0); + // 10、困料货架的信息显示 todo: 数据? +// CompletableFuture trappedMaterialShelfTask = CompletableFuture.supplyAsync(() -> { +// JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "8")) +// .process() +// .getResultJSONArray(0); +// return res; +// }, pool); +// trappedMaterialShelfTask.thenAccept(result -> { +// map.put("TrappedMaterialShelfList", result); +// }).exceptionally((e) -> { +// log.error("困料货架的信息显示: {}", e.getMessage(), e); +// map.put("TrappedMaterialShelfList", null); +// return null; +// }); + // 11、半成品货架数据显示 todo: 数据? +// CompletableFuture semiFinishedProductShelfTask = CompletableFuture.supplyAsync(() -> { +// JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "9")) +// .process() +// .getResultJSONArray(0); +// return res; +// }, pool); +// semiFinishedProductShelfTask.thenAccept(result -> { +// map.put("SemiFinishedProductShelfList", result); +// }).exceptionally((e) -> { +// log.error("半成品货架数据显示: {}", e.getMessage(), e); +// map.put("SemiFinishedProductShelfList", null); +// return null; +// }); + // 12、混料机下料位 + CompletableFuture mixBlankingTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "3")) + .process().getResultJSONArray(0); return res; }, pool); - trappedMaterialShelfTask.thenAccept(result -> { - map.put("TrappedMaterialShelfList", result); + mixBlankingTask.thenAccept(result -> { + map.put("MixBlankingList", result); }).exceptionally((e) -> { - log.error("困料货架的信息显示: {}", e.getMessage(), e); - map.put("TrappedMaterialShelfList", null); + log.error("混料机下料位显示: {}", e.getMessage(), e); + map.put("MixBlankingList", null); return null; }); - // 11、半成品货架数据显示 - CompletableFuture semiFinishedProductShelfTask = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "9")) - .process() - .getResultJSONArray(0); + // 13、困料货架数据显示 + CompletableFuture trappedShelfTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "12")) + .process().getResultJSONArray(0); return res; }, pool); - semiFinishedProductShelfTask.thenAccept(result -> { - map.put("SemiFinishedProductShelfList", result); + trappedShelfTask.thenAccept(result -> { + map.put("TrappedShelfList", result); }).exceptionally((e) -> { - log.error("半成品货架数据显示: {}", e.getMessage(), e); - map.put("SemiFinishedProductShelfList", null); + log.error("获取困料货架数据显示 - 6货位信息: {}", e.getMessage(), e); + map.put("TrappedShelfList", null); return null; }); CompletableFuture allQuery = CompletableFuture.allOf( @@ -252,8 +288,9 @@ public class BigScreenServiceImpl implements BigScreenService { stackingPositionTask, pressMachineTask, mixMachineTask, - trappedMaterialShelfTask, - semiFinishedProductShelfTask); + trappedShelfTask); +// trappedMaterialShelfTask, +// semiFinishedProductShelfTask); CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; @@ -286,15 +323,15 @@ public class BigScreenServiceImpl implements BigScreenService { mixMaterialStorage.thenAccept((result) -> { // 整理数据 JSONObject res = new JSONObject(); - int sumRealDay = 0; - int sumPlanDay = 0; + double sumRealDay = 0; + double 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("hl_plan_day", BigDecimal.valueOf(sumPlanDay / 1000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("hl_real_day", BigDecimal.valueOf(sumRealDay / 1000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("hl_productivity", (int)((sumRealDay / sumPlanDay)*100)); res.put("HLDayList", result); if (map.containsKey("HL")) { // 如果存在 JSONObject hl = (JSONObject) map.get("HL"); @@ -340,7 +377,7 @@ public class BigScreenServiceImpl implements BigScreenService { 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("hl_productivity", hl.getInteger("hl_productivity")); res.put("HLDayList", hl.getJSONArray("HLDayList")); map.put("HL", res); } else { @@ -356,7 +393,7 @@ public class BigScreenServiceImpl implements BigScreenService { 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("hl_productivity", hl.getInteger("hl_productivity")); res.put("HLDayList", hl.getJSONArray("HLDayList")); map.put("HL", res); } else { @@ -367,7 +404,7 @@ public class BigScreenServiceImpl implements BigScreenService { // 2.1 获取成型的计划与实际生产数量:单位万块, 每天的合格与不合格数量 CompletableFuture> yzPlanAndRealStorage = CompletableFuture.supplyAsync(() -> { List 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); @@ -378,15 +415,15 @@ public class BigScreenServiceImpl implements BigScreenService { yzPlanAndRealStorage.thenAccept((result) -> { // 整理数据 JSONObject res = new JSONObject(); - int sumRealDay = 0; - int sumPlanDay = 0; + double sumRealDay = 0; + double 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("yz_plan_day", BigDecimal.valueOf(sumPlanDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("yz_real_day", BigDecimal.valueOf(sumRealDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("yz_productivity", (int)((sumRealDay / sumPlanDay)*100)); res.put("YZDayList", result); if (map.containsKey("YZ")) { // 如果存在 JSONObject yz = (JSONObject) map.get("YZ"); @@ -432,7 +469,7 @@ public class BigScreenServiceImpl implements BigScreenService { 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("yz_productivity", yz.getInteger("yz_productivity")); res.put("YZDayList", yz.getJSONArray("YZDayList")); map.put("YZ", res); } else { @@ -448,7 +485,7 @@ public class BigScreenServiceImpl implements BigScreenService { 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("yz_productivity", yz.getInteger("yz_productivity")); res.put("YZDayList", yz.getJSONArray("YZDayList")); map.put("YZ", res); } else { @@ -469,15 +506,15 @@ public class BigScreenServiceImpl implements BigScreenService { bzPlanAndRealStorage.thenAccept((result) -> { // 整理数据 JSONObject res = new JSONObject(); - int sumRealDay = 0; - int sumPlanDay = 0; + double sumRealDay = 0; + double 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("bz_plan_day", BigDecimal.valueOf(sumPlanDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("bz_real_day", BigDecimal.valueOf(sumRealDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("bz_productivity", (int)((sumRealDay / sumPlanDay)*100)); res.put("BZDayList", result); if (map.containsKey("BZ")) { // 如果存在 JSONObject bz = (JSONObject) map.get("BZ"); @@ -521,7 +558,7 @@ public class BigScreenServiceImpl implements BigScreenService { 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("bz_productivity", bz.getInteger("bz_productivity")); res.put("BZDayList", bz.getJSONArray("BZDayList")); map.put("BZ", res); } else { @@ -536,7 +573,7 @@ public class BigScreenServiceImpl implements BigScreenService { 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("bz_productivity", bz.getInteger("bz_productivity")); res.put("BZDayList", bz.getJSONArray("BZDayList")); map.put("BZ", res); } else { @@ -544,6 +581,7 @@ public class BigScreenServiceImpl implements BigScreenService { } return null; }); + // todo: 假数据 // 4 成品出入库 CompletableFuture> cpDeviceDataStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); @@ -609,6 +647,544 @@ public class BigScreenServiceImpl implements BigScreenService { return map; } + /** + * open_time 开机时间 yyyy-MM-dd HH:mm:ss + * stand_time 待机时间 小时 + * work_time 生产时间 小时 + * error_time 故障时间 小时 + */ + @Override + public ConcurrentHashMap blendingCondition() { + ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); + ConcurrentHashMap map = new ConcurrentHashMap<>(); + // 1、当日混料任务 + CompletableFuture mixedDayListTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "1")) + .process().getResultJSONArray(0); + return res; + }, pool); + mixedDayListTask.thenAccept(result -> { + map.put("MixDayList", result); + }).exceptionally((e) -> { + log.error("获取当日混料任务信息: {}", e.getMessage(), e); + map.put("MixDayList", null); + return null; + }); + // 2、获取混料机的弹窗信息 + CompletableFuture mixDevicePopoverInformationTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "2")) + .process().getResultJSONArray(0); + return res; + }, pool); + mixDevicePopoverInformationTask.thenAccept(result -> { + //todo: 请求acs设置开机状态等等信息 + for (int i = 0; i < result.size(); i++) { + JSONObject device = result.getJSONObject(i); + if (!device.getString("material_code").equals("-")) { + device.put("device_status", DeviceStatusEnum.RUNNING.getCode()); + device.put("device_status_name", DeviceStatusEnum.RUNNING.getDescription()); + device.put("open_time", "2023-06-02 11:12:02"); + device.put("stand_time", "2"); + device.put("work_time", "7"); + } else { + device.put("open_time", "-"); + device.put("device_status", DeviceStatusEnum.STANDBY.getCode()); + device.put("device_status_name", DeviceStatusEnum.STANDBY.getDescription()); + device.put("stand_time", "5"); + device.put("work_time", "0.5"); + } + device.put("error_time", "0"); + } + map.put("MixDeviceInfoList", result); + }).exceptionally((e) -> { + log.error("获取混料机的弹窗信息: {}", e.getMessage(), e); + map.put("MixDeviceInfoList", null); + return null; + }); + // 3、获取料盅货架的显示信息 + CompletableFuture cupRackDisplayTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "3")) + .process().getResultJSONArray(0); + return res; + }, pool); + cupRackDisplayTask.thenAccept(result -> { + map.put("CupRackDisplayList", result); + }).exceptionally((e) -> { + log.error("获取料盅货架的显示信息: {}", e.getMessage(), e); + map.put("CupRackDisplayList", null); + return null; + }); + CompletableFuture allQuery = CompletableFuture.allOf( + mixedDayListTask, + mixDevicePopoverInformationTask, + cupRackDisplayTask); + CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + log.error(e.getMessage(), e); + return null; + }); + future.join(); + return map; + } + + @Override + public ConcurrentHashMap trappedMaterialCondition() { + ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); + ConcurrentHashMap map = new ConcurrentHashMap<>(); + // 1、困料库存 + CompletableFuture trappedStockTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "4")) + .process().getResultJSONArray(0); + return res; + }, pool); + trappedStockTask.thenAccept(result -> { + map.put("TrappedStockList", result); + }).exceptionally((e) -> { + log.error("获取困料库存信息: {}", e.getMessage(), e); + map.put("TrappedStockList", null); + return null; + }); + // 2、当天困料出入库 + CompletableFuture trappedIOStockTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "5")) + .process().getResultJSONArray(0); + return res; + }, pool); + trappedIOStockTask.thenAccept(result -> { + map.put("TrappedIOStockList", result); + }).exceptionally((e) -> { + log.error("获取当天困料出入库信息: {}", e.getMessage(), e); + map.put("TrappedIOStockList", null); + return null; + }); + // 3、困料货架数据显示 - 40货位 + CompletableFuture trappedShelf40Task = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "6", "point_type", "1")) + .process().getResultJSONArray(0); + return res; + }, pool); + trappedShelf40Task.thenAccept(result -> { + map.put("TrappedShelf40List", result); + }).exceptionally((e) -> { + log.error("获取困料货架数据显示 - 40货位信息: {}", e.getMessage(), e); + map.put("TrappedShelf40List", null); + return null; + }); + // 4、困料货架数据显示 - 6货位 + CompletableFuture trappedShelf6Task = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "6", "point_type", "2")) + .process().getResultJSONArray(0); + return res; + }, pool); + trappedShelf6Task.thenAccept(result -> { + map.put("TrappedShelf6List", result); + }).exceptionally((e) -> { + log.error("获取困料货架数据显示 - 6货位信息: {}", e.getMessage(), e); + map.put("TrappedShelf6List", null); + return null; + }); + CompletableFuture allQuery = CompletableFuture.allOf( + trappedStockTask, + trappedIOStockTask, + trappedShelf40Task, + trappedShelf6Task); + CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + log.error(e.getMessage(), e); + return null; + }); + future.join(); + return map; + } + + @Override + public ConcurrentHashMap moldingMaterialCondition() { + ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); + ConcurrentHashMap map = new ConcurrentHashMap<>(); + // 1、压机弹窗数据 + CompletableFuture pressPopoverTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "4")) + .process().getResultJSONArray(0); + return res; + }, pool); + pressPopoverTask.thenAccept(result -> { + //todo: 请求acs获取开机状态等等信息 + for (int i = 0; i < result.size(); i++) { + JSONObject device = result.getJSONObject(i); + if (!device.getString("material_code").equals("-")) { + device.put("device_status", DeviceStatusEnum.RUNNING.getCode()); + device.put("device_status_name", DeviceStatusEnum.RUNNING.getDescription()); + device.put("open_time", "2023-06-02 11:12:02"); + device.put("stand_time", "2"); + device.put("work_time", "7"); + } else { + device.put("open_time", "-"); + device.put("device_status", DeviceStatusEnum.STANDBY.getCode()); + device.put("device_status_name", DeviceStatusEnum.STANDBY.getDescription()); + device.put("stand_time", "5"); + device.put("work_time", "0.5"); + } + device.put("error_time", "0"); + } + map.put("PressPopoverList", result); + }).exceptionally((e) -> { + log.error("获取压机弹窗数据: {}", e.getMessage(), e); + map.put("PressPopoverList", null); + return null; + }); + // 2、码盘工位弹出框 + CompletableFuture trayStationPopoverTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "5")) + .process().getResultJSONArray(0); + // todo: request acs to find device status and other information + return res; + }, pool); + trayStationPopoverTask.thenAccept(result -> { + map.put("TrayStationPopoverList", result); + }).exceptionally((e) -> { + log.error("获取码盘工位弹出框数据: {}", e.getMessage(), e); + map.put("TrayStationPopoverList", null); + return null; + }); + // 3、机械手状态 todo + CompletableFuture manipulatorConditionTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "6")) + .process().getResultJSONArray(0); + for (int i = 0; i < res.size(); i++) { + JSONObject device = res.getJSONObject(i); + device.put("device_status", DeviceStatusEnum.RUNNING.getCode()); + device.put("device_status_name", DeviceStatusEnum.RUNNING.getDescription()); + device.put("open_time", "2023-06-02 11:12:02"); + device.put("stand_time", "2"); + device.put("work_time", "7"); + device.put("error_time", "0"); + } + return res; + }, pool); + manipulatorConditionTask.thenAccept(result -> { + map.put("ManipulatorList", result); + }).exceptionally((e) -> { + log.error("机械手弹出框数据: {}", e.getMessage(), e); + map.put("ManipulatorList", null); + return null; + }); + CompletableFuture allQuery = CompletableFuture.allOf( + pressPopoverTask, + trayStationPopoverTask, + manipulatorConditionTask); + CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + log.error(e.getMessage(), e); + return null; + }); + future.join(); + return map; + } + + @Override + public ConcurrentHashMap moldingTableDate() { + ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); + ConcurrentHashMap map = new ConcurrentHashMap<>(); + // 1、当日压制任务 + CompletableFuture moldingDayTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "1")) + .process().getResultJSONArray(0); + return res; + }, pool); + moldingDayTask.thenAccept(result -> { + map.put("MoldingDayList", result); + }).exceptionally((e) -> { + log.error("获取当日压制任务信息: {}", e.getMessage(), e); + map.put("MoldingDayList", null); + return null; + }); + // 2、成型库存任务半成品货架 + CompletableFuture semiFinishedProductShelfTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "2")) + .process().getResultJSONArray(0); + return res; + }, pool); + semiFinishedProductShelfTask.thenAccept(result -> { + map.put("SemiFinishedProductShelList", result); + }).exceptionally((e) -> { + log.error("获取半成品货架信息: {}", e.getMessage(), e); + map.put("SemiFinishedProductShelList", null); + return null; + }); + // 3、成型出入库信息 + CompletableFuture moldingIOStoringTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "3")) + .process().getResultJSONArray(0); + return res; + }, pool); + moldingIOStoringTask.thenAccept(result -> { + map.put("MoldingIOStoringList", result); + }).exceptionally((e) -> { + log.error("获取半成品货架信息: {}", e.getMessage(), e); + map.put("MoldingIOStoringList", null); + return null; + }); + CompletableFuture allQuery = CompletableFuture.allOf( + moldingDayTask, + semiFinishedProductShelfTask, + moldingIOStoringTask); + CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + log.error(e.getMessage(), e); + return null; + }); + future.join(); + return map; + } + + @Override + public ConcurrentHashMap firingAndDrying() { + ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); + ConcurrentHashMap map = new ConcurrentHashMap<>(); + // 1、半成品库存 + CompletableFuture semiFinishedGoodsTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_FIR_AND_DRY").addParamMap(MapOf.of("flag", "1")) + .process().getResultJSONArray(0); + return res; + }, pool); + semiFinishedGoodsTask.thenAccept(result -> { + map.put("SemiFinishedGoodsList", result); + }).exceptionally((e) -> { + log.error("获取半成品库存信息: {}", e.getMessage(), e); + map.put("SemiFinishedGoodsList", null); + return null; + }); + // 2、半成品出入库 + CompletableFuture semiFinishedIOTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_FIR_AND_DRY").addParamMap(MapOf.of("flag", "2")) + .process().getResultJSONArray(0); + return res; + }, pool); + semiFinishedIOTask.thenAccept(result -> { + map.put("SemiFinishedIOList", result); + }).exceptionally((e) -> { + log.error("获取半成品出入库信息: {}", e.getMessage(), e); + map.put("SemiFinishedIOList", null); + return null; + }); + // todo: 3、烧制窑内物料 + CompletableFuture fireInTheKilnTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = new JSONArray(); + Random random = new Random(); + for (int i = 1; i <= 5; i++) { + JSONObject r = new JSONObject(); + r.put("qty", random.nextInt(2000 - 100 + 1) + 100); + r.put("material_code", "物料" + i); + res.add(r); + } + return res; + }, pool); + fireInTheKilnTask.thenAccept(result -> { + map.put("FireInTheKilnList", result); + }).exceptionally((e) -> { + log.error("获取烧制窑内物料信息: {}", e.getMessage(), e); + map.put("FireInTheKilnList", null); + return null; + }); + // todo: 4、冷却窑内物料 + CompletableFuture coolingInTheKilnTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = new JSONArray(); + Random random = new Random(); + for (int i = 1; i <= 5; i++) { + JSONObject r = new JSONObject(); + r.put("qty", random.nextInt(2000 - 100 + 1) + 100); + r.put("material_code", "物料" + i); + res.add(r); + } + return res; + }, pool); + coolingInTheKilnTask.thenAccept(result -> { + map.put("CoolingInTheKilnList", result); + }).exceptionally((e) -> { + log.error("获取烧制窑内物料信息: {}", e.getMessage(), e); + map.put("CoolingInTheKilnList", null); + return null; + }); + CompletableFuture allQuery = CompletableFuture.allOf( + semiFinishedGoodsTask, + semiFinishedIOTask, + fireInTheKilnTask, + coolingInTheKilnTask); + CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + log.error(e.getMessage(), e); + return null; + }); + future.join(); + return map; + } + + @Override + public ConcurrentHashMap firingAndDryingPopover() { + ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); + ConcurrentHashMap map = new ConcurrentHashMap<>(); + // 1、获取半成品货架弹窗 + CompletableFuture finishedProductShelfTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_FIR_AND_DRY").addParamMap(MapOf.of("flag", "3")) + .process().getResultJSONArray(0); + return res; + }, pool); + finishedProductShelfTask.thenAccept(result -> { + map.put("FinishedProductShelfList", result); + }).exceptionally((e) -> { + log.error("获取半成品货架弹窗信息: {}", e.getMessage(), e); + map.put("FinishedProductShelfList", null); + return null; + }); + CompletableFuture allQuery = CompletableFuture.allOf( + finishedProductShelfTask); + CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + log.error(e.getMessage(), e); + return null; + }); + future.join(); + return map; + } + + @Override + public ConcurrentHashMap sortingAndPackaging() { + ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); + ConcurrentHashMap map = new ConcurrentHashMap<>(); + // 1、半托缓存 + CompletableFuture halfSupportCacheTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_SORTE_AND_PACKAGE").addParamMap(MapOf.of("flag", "1")) + .process().getResultJSONArray(0); + return res; + }, pool); + halfSupportCacheTask.thenAccept(result -> { + map.put("HalfSupportCacheList", result); + }).exceptionally((e) -> { + log.error("获取半托缓存信息: {}", e.getMessage(), e); + map.put("HalfSupportCacheList", null); + return null; + }); + // 2、包装区物料 + CompletableFuture packingAreaTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_SORTE_AND_PACKAGE").addParamMap(MapOf.of("flag", "2")) + .process().getResultJSONArray(0); + return res; + }, pool); + packingAreaTask.thenAccept(result -> { + map.put("PackingAreaTaskList", result); + }).exceptionally((e) -> { + log.error("获取包装区物料信息: {}", e.getMessage(), e); + map.put("PackingAreaTaskList", null); + return null; + }); + // 3、当日拆码垛 + CompletableFuture sortingTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_SORTE_AND_PACKAGE").addParamMap(MapOf.of("flag", "3")) + .process().getResultJSONArray(0); + return res; + }, pool); + sortingTask.thenAccept(result -> { + map.put("SortingDayList", result); + }).exceptionally((e) -> { + log.error("获取当日拆码垛信息: {}", e.getMessage(), e); + map.put("SortingDayList", null); + return null; + }); + // todo: 4、当日成品 + CompletableFuture> manufacturedProductsDayProductionTask = CompletableFuture.supplyAsync(() -> { + List res = new ArrayList<>(); + Random random = new Random(); + // 使用随机数 + for (int i = 1; i <= 5; i++) { + ManufacturedProductsDto manufacturedProductsDto = new ManufacturedProductsDto(); + manufacturedProductsDto.setInventory_qty(random.nextInt(2000 - 100 + 1) + 100); + manufacturedProductsDto.setQualified_in_qty(random.nextInt(2000 - 100 + 1) + 100); + manufacturedProductsDto.setUnqualified_in_qty(random.nextInt(2000 - 100 + 1) + 100); + manufacturedProductsDto.setMaterial_code("成品" + i); + res.add(manufacturedProductsDto); + } + return res; + }, pool); + manufacturedProductsDayProductionTask.thenAccept((result) -> { + map.put("CPDayList", result); + }).exceptionally((e) -> { + log.error("当日成品生产: {}", e.getMessage(), e); + map.put("CPDayList", null); + return null; + }); + CompletableFuture allQuery = CompletableFuture.allOf( + halfSupportCacheTask, + packingAreaTask, + sortingTask, + manufacturedProductsDayProductionTask); + CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + log.error(e.getMessage(), e); + return null; + }); + future.join(); + return map; + } + + @Override + public ConcurrentHashMap sortingAndPackagingPopover() { + ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); + ConcurrentHashMap map = new ConcurrentHashMap<>(); + // 1、拆码工位 + CompletableFuture splitOrPalletizingTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_SORTE_AND_PACKAGE").addParamMap(MapOf.of("flag", "4")) + .process().getResultJSONArray(0); + return res; + }, pool); + splitOrPalletizingTask.thenAccept(result -> { + map.put("SplitOrPalletizingList", result); + }).exceptionally((e) -> { + log.error("拆码工位: {}", e.getMessage(), e); + map.put("SplitOrPalletizingList", null); + return null; + }); + // 2、设备弹窗 + CompletableFuture devicesInfoTask = CompletableFuture.supplyAsync(() -> { + JSONObject resObj = new JSONObject(); + JSONArray res = WQL.getWO("COCKPIT_SORTE_AND_PACKAGE").addParamMap(MapOf.of("flag", "5")) + .process().getResultJSONArray(0); + for (int i = 0; i < res.size(); i++) { + JSONObject device = res.getJSONObject(i); + device.put("device_status", DeviceStatusEnum.RUNNING.getCode()); + device.put("device_status_name", DeviceStatusEnum.RUNNING.getDescription()); + device.put("open_time", "2023-06-02 11:12:02"); + device.put("stand_time", "2"); + device.put("work_time", "7"); + device.put("error_time", "0"); + resObj.put(device.getString("device_code"), device); + } + return resObj; + }, pool); + devicesInfoTask.thenAccept(result -> { + map.put("DevicesInfoList", result); + }).exceptionally((e) -> { + log.error("设备弹窗: {}", e.getMessage(), e); + map.put("DevicesInfoList", null); + return null; + }); + // 3、半托缓存位 + CompletableFuture halfSupportCacheTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_SORTE_AND_PACKAGE").addParamMap(MapOf.of("flag", "6")) + .process().getResultJSONArray(0); + return res; + }, pool); + halfSupportCacheTask.thenAccept(result -> { + map.put("HalfSupportCacheList", result); + }).exceptionally((e) -> { + log.error("获取码盘工位弹出框数据: {}", e.getMessage(), e); + map.put("HalfSupportCacheList", null); + return null; + }); + CompletableFuture allQuery = CompletableFuture.allOf( + splitOrPalletizingTask, + devicesInfoTask, + halfSupportCacheTask); + CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + log.error(e.getMessage(), e); + return null; + }); + future.join(); + return map; + } + /** * 处理空白数据 - 工序 * diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_FIR_AND_DRY.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_FIR_AND_DRY.wql new file mode 100644 index 0000000..3a63f15 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_FIR_AND_DRY.wql @@ -0,0 +1,124 @@ +[交易说明] + 交易名: 烧制和干燥数据 + 所属模块: + 功能简述: + 版权所有: + 表引用: + 版本经历: + +[数据库] + --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 + +[IO定义] + ################################################# + ## 表字段对应输入参数 + ################################################# + 输入.flag TYPEAS s_string + 输入.region_code TYPEAS s_string + 输入.point_type TYPEAS s_string + +[临时表] + --这边列出来的临时表就会在运行期动态创建 + +[临时变量] + --所有中间过程变量均可在此处定义 + +[业务过程] + + ########################################## + # 1、输入输出检查 # + ########################################## + + + ########################################## + # 2、主过程前处理 # + ########################################## + + + ########################################## + # 3、业务主过程 # + ########################################## + IF 输入.flag = "1" + PAGEQUERY + SELECT + p.point_code, + p.point_name, + IF(LENGTH(p.vehicle_code)>0,p.vehicle_code,'-') AS vehicle_code, + IF(LENGTH(LEFT(m.material_code, 11))>0,LEFT(m.material_code, 11),'-') AS material_code, + IF(LENGTH(vd.qty)>0,vd.qty,0) AS qty, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num, + IF(LENGTH(vd.create_time),vd.create_time,'-') AS create_time + FROM + `sch_base_point` p + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = p.vehicle_code + AND vd.vehicle_type = p.vehicle_type + AND vd.is_delete = '0' + LEFT JOIN md_me_materialbase m ON m.material_id = vd.material_id + WHERE p.region_code = 'BCPHJ' + ORDER BY p.point_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "2" + PAGEQUERY + SELECT + IF(ta.task_type = '1','入库','出库') AS io_type, + SUBSTRING(m.material_code, 6, 6) AS bom, + LEFT(m.material_code, 11) AS material_code, + IF(LENGTH(vd.qty)>0,vd.qty,'-') AS qty, + ta.vehicle_code, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num, + IF(ta.task_type = '1',ta.point_code2,ta.point_code1) AS point_code, + ta.create_time + FROM + `sch_base_task` ta + LEFT JOIN md_me_materialbase m ON m.material_id = ta.material_id + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = ta.vehicle_code + AND vd.vehicle_type = ta.vehicle_type + AND vd.is_delete = '0' + WHERE + ta.handle_class IN ('org.nl.wms.sch.task.call.material.FJCallMaterialTask', 'org.nl.wms.sch.task.send.material.SZSendMaterialTask') + AND ta.task_status = '7' + AND DATE(ta.create_time) = CURDATE() + ORDER BY ta.update_time + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "3" + PAGEQUERY + SELECT + IF(LENGTH(material.material_code)>0,LEFT(material.material_code, 11),'-') AS material_code, + IF(LENGTH(vd.create_time)>0,HOUR(TIMEDIFF(NOW(), vd.create_time)),'-') AS standing_time, + IF(LENGTH(vd.qty)>0,vd.qty,'-') AS qty, + IF(LENGTH(vd.create_time)>0,vd.create_time,'-') AS instorage_time, + point.point_code, + point.point_name, + point.point_status, + IF(ISNULL(device.device_name),'-',device.device_name) AS device_name, + CASE point.point_status + WHEN '0' THEN '无货' + WHEN '1' THEN '有货' + ELSE '' + END AS point_status_name, + IF(LENGTH(point.vehicle_code)>0,point.vehicle_code,'-') AS vehicle_code, + IF(LENGTH(material.material_code)>0,SUBSTRING(material.material_code, 6, 6),'-') AS bom, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num + FROM + sch_base_point point + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = point.vehicle_code + AND vd.vehicle_type = point.vehicle_type + AND vd.is_delete = '0' + LEFT JOIN md_me_materialbase material ON material.material_id = vd.material_id + LEFT JOIN pdm_bi_device device ON device.device_code = ( + SELECT p.device_code FROM sch_base_point p WHERE p.point_code = vd.point_code + ) + WHERE + point.region_code = 'BCPHJ' + ORDER BY + point.sort_seq ASC, + point.point_code ASC + ENDSELECT + ENDPAGEQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql new file mode 100644 index 0000000..47c6f1d --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql @@ -0,0 +1,232 @@ +[交易说明] + 交易名: 混料和困料数据 + 所属模块: + 功能简述: + 版权所有: + 表引用: + 版本经历: + +[数据库] + --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 + +[IO定义] + ################################################# + ## 表字段对应输入参数 + ################################################# + 输入.flag TYPEAS s_string + 输入.region_code TYPEAS s_string + 输入.point_type TYPEAS s_string + +[临时表] + --这边列出来的临时表就会在运行期动态创建 + +[临时变量] + --所有中间过程变量均可在此处定义 + +[业务过程] + + ########################################## + # 1、输入输出检查 # + ########################################## + + + ########################################## + # 2、主过程前处理 # + ########################################## + + + ########################################## + # 3、业务主过程 # + ########################################## + IF 输入.flag = "1" + PAGEQUERY + SELECT + w.workorder_id, + w.workorder_code, + w.device_code, + w.plan_qty, + w.real_qty, + w.order_status, + IF(LENGTH(w.realproducestart_date) > 0,w.realproducestart_date, '-') AS realproducestart_date, + IF(LENGTH(w.realproduceend_date) > 0,w.realproduceend_date, '-') AS realproduceend_date, + d.device_name, + d.region_code, + LEFT(m.material_code, 11) AS material_code, + CASE w.order_status + WHEN '1' THEN '未生产' + WHEN '2' THEN '已下发' + WHEN '3' THEN '生产中' + WHEN '4' THEN '暂停' + WHEN '5' THEN '完成' + ELSE '' + END AS order_status_name, + IF(LENGTH(m.material_code)>0,SUBSTRING(m.material_code, 6, 6),'-') AS bom, + ( + SELECT COUNT(vd.vd_id) + FROM st_ivt_vehicle_detail vd + WHERE vd.workorder_id = w.workorder_id + ) AS total_mix_frequency + FROM + pdm_bd_workorder w + LEFT JOIN pdm_bi_device d ON w.device_id = d.device_id + LEFT JOIN md_me_materialbase m ON w.material_id = m.material_id + WHERE + DATE(w.plan_date) = CURDATE() + AND d.region_code = 'HL' + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "2" + PAGEQUERY + SELECT + d.device_code, + d.device_name, + IF(LENGTH(w.real_qty)>0,w.real_qty,0) AS current_qty, + IF(LENGTH(LEFT(m.material_code, 11))>0,LEFT(m.material_code, 11),'-') AS material_code, + ( + SELECT IF(LENGTH(SUM(w.real_qty)) > 0,SUM(w.real_qty),0) + FROM pdm_bd_workorder w + WHERE w.device_code = d.device_code + AND DATE(w.plan_date) = CURDATE() + ) AS total_actual_quantity, + ( + SELECT COUNT(DISTINCT w.material_id) + FROM pdm_bd_workorder w + WHERE w.device_code = d.device_code + AND DATE(w.plan_date) = CURDATE() + ) AS total_classify_material + FROM + `pdm_bi_device` d + LEFT JOIN pdm_bd_workorder w ON w.device_code = d.device_code AND w.order_status = '3' + LEFT JOIN md_me_materialbase m ON m.material_id = w.material_id + WHERE + d.region_code = 'HL' + ORDER BY d.device_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "3" + PAGEQUERY + SELECT + p.point_code, + p.point_name, + p.point_status + FROM + `sch_base_point` p + WHERE + p.region_code = 'HL' + ORDER BY p.point_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "4" + PAGEQUERY + SELECT + p.point_code, + p.point_name, + p.point_status, + IF(LENGTH(p.vehicle_code)>0,p.vehicle_code,'-') AS vehicle_code, + IF(LENGTH(SUBSTRING(m.material_code, 6, 6))>0,SUBSTRING(m.material_code, 6, 6),'-') AS bom, + IF(LENGTH(LEFT(m.material_code, 11))>0,LEFT(m.material_code, 11),'-') AS material_code, + IF(LENGTH(vd.weight)>0,vd.weight,0) AS weight, + IF(LENGTH(CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')))>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num, + IF(LENGTH(HOUR(TIMEDIFF(NOW(), vd.create_time)))>0,HOUR(TIMEDIFF(NOW(), vd.create_time)),'-') AS standing_time, + CASE vd.stand_status + WHEN '2' THEN '静置中' + WHEN '3' THEN '静置完成' + WHEN '4' THEN '静置完成' + WHEN '5' THEN '静置超时' + ELSE '-' + END AS stand_status_name, + CASE vd.stand_status + WHEN '2' THEN '1' + WHEN '3' THEN '2' + WHEN '4' THEN '2' + WHEN '5' THEN '3' + ELSE '' + END AS stand_status_color + FROM + `sch_base_point` p + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = p.vehicle_code + AND vd.vehicle_type = p.vehicle_type + AND vd.is_delete = '0' + LEFT JOIN md_me_materialbase m ON m.material_id = vd.material_id + WHERE p.region_code = 'KLHJ' + AND p.point_type IN ('1','2') + ORDER BY p.point_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "5" + PAGEQUERY + SELECT + IF(ta.task_type = '1','入库','出库') AS io_type, + SUBSTRING(m.material_code, 6, 6) AS bom, + LEFT(m.material_code, 11) AS material_code, + IF(LENGTH(vd.weight)>0,vd.weight,'-') AS weight, + ta.vehicle_code, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num, + IF(ta.task_type = '1',ta.point_code2,ta.point_code1) AS point_code, + ta.create_time + FROM + `sch_base_task` ta + LEFT JOIN md_me_materialbase m ON m.material_id = ta.material_id + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = ta.vehicle_code + AND vd.vehicle_type = ta.vehicle_type + AND vd.is_delete = '0' + WHERE + ta.handle_class IN ('org.nl.wms.sch.task.send.material.HLSendMaterialTask', 'org.nl.wms.sch.task.call.material.YZCallMaterialTask') + AND ta.task_status = '7' + AND DATE(ta.create_time) = CURDATE() + ORDER BY ta.update_time + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "6" + PAGEQUERY + SELECT + IF(LENGTH(material.material_code)>0,LEFT(material.material_code, 11),'-') AS material_code, + IF(LENGTH(vd.create_time)>0,HOUR(TIMEDIFF(NOW(), vd.create_time)),'-') AS standing_time, + IF(LENGTH(vd.weight)>0,vd.weight,'-') AS weight, + IF(LENGTH(vd.create_time)>0,vd.create_time,'-') AS instorage_time, + vd.stand_status, + CASE vd.stand_status + WHEN '2' THEN '静置中' + WHEN '3' THEN '静置完成' + WHEN '4' THEN '静置完成' + WHEN '5' THEN '静置超时' + ELSE '' + END AS stand_status_name, + point.point_code, + point.point_name, + point.point_status, + CASE point.point_status + WHEN '0' THEN '无货' + WHEN '1' THEN '有货' + ELSE '' + END AS point_status_name, + IF(LENGTH(point.vehicle_code)>0,point.vehicle_code,'-') AS vehicle_code, + IF(LENGTH(material.material_code)>0,SUBSTRING(material.material_code, 6, 6),'-') AS bom, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num + FROM + sch_base_point point + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = point.vehicle_code + AND vd.vehicle_type = point.vehicle_type + AND vd.is_delete = '0' + LEFT JOIN md_me_materialbase material ON material.material_id = vd.material_id + WHERE + point.region_code = 'KLHJ' + OPTION 输入.point_type <> "" + point.point_type = 输入.point_type + ENDOPTION + ORDER BY + point.sort_seq ASC, + point.point_code ASC + ENDSELECT + ENDPAGEQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MOLDING_INFO.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MOLDING_INFO.wql new file mode 100644 index 0000000..2695c27 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MOLDING_INFO.wql @@ -0,0 +1,217 @@ +[交易说明] + 交易名: 混料和困料数据 + 所属模块: + 功能简述: + 版权所有: + 表引用: + 版本经历: + +[数据库] + --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 + +[IO定义] + ################################################# + ## 表字段对应输入参数 + ################################################# + 输入.flag TYPEAS s_string + 输入.region_code TYPEAS s_string + 输入.point_type TYPEAS s_string + +[临时表] + --这边列出来的临时表就会在运行期动态创建 + +[临时变量] + --所有中间过程变量均可在此处定义 + +[业务过程] + + ########################################## + # 1、输入输出检查 # + ########################################## + + + ########################################## + # 2、主过程前处理 # + ########################################## + + + ########################################## + # 3、业务主过程 # + ########################################## + IF 输入.flag = "1" + PAGEQUERY + SELECT + w.workorder_id, + w.workorder_code, + w.device_code, + w.plan_qty, + w.real_qty, + w.order_status, + IF(LENGTH(w.realproducestart_date) > 0,w.realproducestart_date, '-') AS realproducestart_date, + IF(LENGTH(w.realproduceend_date) > 0,w.realproduceend_date, '-') AS realproduceend_date, + d.device_name, + d.region_code, + LEFT(m.material_code, 11) AS material_code, + CASE w.order_status + WHEN '1' THEN '未生产' + WHEN '2' THEN '已下发' + WHEN '3' THEN '生产中' + WHEN '4' THEN '暂停' + WHEN '5' THEN '完成' + ELSE '' + END AS order_status_name, + IF(LENGTH(m.material_code)>0,SUBSTRING(m.material_code, 6, 6),'-') AS bom, + ( + SELECT COUNT(vd.vd_id) + FROM st_ivt_vehicle_detail vd + WHERE vd.workorder_id = w.workorder_id + ) AS total_mix_frequency + FROM + pdm_bd_workorder w + LEFT JOIN pdm_bi_device d ON w.device_id = d.device_id + LEFT JOIN md_me_materialbase m ON w.material_id = m.material_id + WHERE + DATE(w.plan_date) = CURDATE() + AND d.region_code = 'YZ' + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "2" + PAGEQUERY + SELECT + p.point_code, + p.point_name, + p.point_status, + vd.qty, + IF(LENGTH(p.vehicle_code)>0,p.vehicle_code,'-') AS vehicle_code, + IF(LENGTH(LEFT(m.material_code, 11))>0,LEFT(m.material_code, 11),'-') AS material_code, + IF(LENGTH(CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')))>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num, + vd.create_time + FROM + `sch_base_point` p + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = p.vehicle_code + AND vd.vehicle_type = p.vehicle_type + AND vd.is_delete = '0' + LEFT JOIN md_me_materialbase m ON m.material_id = vd.material_id + WHERE p.region_code = 'BCPHJ' + ORDER BY p.point_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "3" + PAGEQUERY + SELECT + IF(ta.task_type = '1','入库','出库') AS io_type, + SUBSTRING(m.material_code, 6, 6) AS bom, + LEFT(m.material_code, 11) AS material_code, + IF(LENGTH(vd.weight)>0,vd.weight,'-') AS weight, + ta.vehicle_code, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num, + IF(ta.task_type = '1',ta.point_code2,ta.point_code1) AS point_code, + ta.create_time + FROM + `sch_base_task` ta + LEFT JOIN md_me_materialbase m ON m.material_id = ta.material_id + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = ta.vehicle_code + AND vd.vehicle_type = ta.vehicle_type + AND vd.is_delete = '0' + WHERE + ta.handle_class IN ('org.nl.wms.sch.task.call.material.SZCallMaterialTask', 'org.nl.wms.sch.task.send.material.YZSendMaterialTask') + AND ta.task_status = '7' + AND DATE(ta.create_time) = CURDATE() + ORDER BY ta.update_time + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "4" + PAGEQUERY + SELECT + d.device_code, + d.device_name, + IF(LENGTH(w.real_qty)>0,w.real_qty,0) AS current_qty, + IF(LENGTH(LEFT(m.material_code, 11))>0,LEFT(m.material_code, 11),'-') AS material_code, + ( + SELECT IF(LENGTH(SUM(w.real_qty)) > 0,SUM(w.real_qty),0) + FROM pdm_bd_workorder w + WHERE w.device_code = d.device_code + AND DATE(w.plan_date) = CURDATE() + ) AS total_actual_quantity, + ( + SELECT IF(LENGTH(SUM(w.qualified_qty)) > 0,SUM(w.qualified_qty),0) + FROM pdm_bd_workorder w + WHERE w.device_code = d.device_code + AND DATE(w.plan_date) = CURDATE() + ) AS total_qualified_qty, + ( + SELECT IF(LENGTH(SUM(w.unqualified_qty)) > 0,SUM(w.unqualified_qty),0) + FROM pdm_bd_workorder w + WHERE w.device_code = d.device_code + AND DATE(w.plan_date) = CURDATE() + ) AS total_unqualified_qty, + ( + SELECT COUNT(DISTINCT w.material_id) + FROM pdm_bd_workorder w + WHERE w.device_code = d.device_code + AND DATE(w.plan_date) = CURDATE() + ) AS total_classify_material, + ( + SELECT COUNT(vd.vd_id) + FROM st_ivt_vehicle_detail vd + WHERE vd.workorder_id IN ( + SELECT w2.workorder_id + FROM pdm_bd_workorder w2 + WHERE w2.device_code = d.device_code + AND DATE(w2.plan_date) = CURDATE() + ) + ) AS total_vehicle + FROM + `pdm_bi_device` d + LEFT JOIN pdm_bd_workorder w ON w.device_code = d.device_code AND w.order_status = '3' + LEFT JOIN md_me_materialbase m ON m.material_id = w.material_id + WHERE + d.region_code = 'YZ' + AND d.device_model IN ('3','4') + ORDER BY d.device_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "5" + PAGEQUERY + SELECT + p.point_code, + p.point_name, + p.point_status, + p.device_code, + p.vehicle_code, + d.device_name, + IF(LENGTH(m.material_code)>0,LEFT(m.material_code, 11),'-') AS material_code, + IF(LENGTH(m.material_code)>0,SUBSTRING(m.material_code, 6, 6),'-') AS bom, + '0' AS material_qty, + '否' AS is_full + FROM + `sch_base_point` p + LEFT JOIN pdm_bd_workorder w ON w.device_code = p.device_code AND w.order_status = '3' + LEFT JOIN md_me_materialbase m ON m.material_id = w.material_id + LEFT JOIN pdm_bi_device d ON d.device_code = p.device_code + WHERE p.region_code = 'YZ' AND p.point_type = '1' + ORDER BY p.device_code, p.point_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "6" + PAGEQUERY + SELECT + d.device_code, + d.device_name + FROM + `pdm_bi_device` d + WHERE + d.region_code = 'YZ' AND d.device_model = '5' + ENDSELECT + ENDPAGEQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql index b60e1c6..cd69379 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql @@ -68,7 +68,9 @@ w.device_code, d.region_code, IF(LENGTH(SUM(w.plan_qty)) > 0,SUM(w.plan_qty),0) AS plan_qty, - IF(LENGTH(SUM(w.real_qty)) > 0,SUM(w.real_qty),0) AS real_qty + IF(LENGTH(SUM(w.real_qty)) > 0,SUM(w.real_qty),0) AS real_qty, + IF(LENGTH(SUM(w.qualified_qty)) > 0,SUM(w.qualified_qty),0) AS qualified_qty, + IF(LENGTH(SUM(w.unqualified_qty)) > 0,SUM(w.unqualified_qty),0) AS unqualified_qty FROM pdm_bd_workorder w LEFT JOIN pdm_bi_device d ON w.device_id = d.device_id @@ -88,7 +90,7 @@ IF 输入.flag = "3" PAGEQUERY SELECT - m.material_code, + LEFT(m.material_code, 11) AS material_code, IF(LENGTH(SUM(w.plan_qty)) > 0,SUM(w.plan_qty),0) AS plan_qty, IF(LENGTH(SUM(w.real_qty)) > 0,SUM(w.real_qty),0) AS real_qty, IF(LENGTH(SUM(w.qualified_qty)) > 0,SUM(w.qualified_qty),0) AS qualified_qty, @@ -106,7 +108,7 @@ IF 输入.flag = "4" PAGEQUERY SELECT - m.material_code, + LEFT(m.material_code, 11) AS material_code, IF(LENGTH(SUM(w.plan_qty)) > 0,SUM(w.plan_qty),0) AS plan_qty, IF(LENGTH(SUM(w.real_qty)) > 0,SUM(w.real_qty),0) AS real_qty, IF(LENGTH(SUM(w.qualified_qty)) > 0,SUM(w.qualified_qty),0) AS qualified_qty, @@ -146,7 +148,7 @@ d.device_name, d.region_code, w.material_id, - m.material_code, + LEFT(m.material_code, 11) AS material_code, w.real_qty AS now_capacity FROM `pdm_bi_device` d @@ -195,9 +197,9 @@ END AS stand_status_name, CASE vd.stand_status WHEN '2' THEN '1' - WHEN '3' THEN '3' - WHEN '4' THEN '3' - WHEN '5' THEN '2' + WHEN '3' THEN '2' + WHEN '4' THEN '2' + WHEN '5' THEN '3' ELSE '' END AS stand_status_color FROM @@ -226,3 +228,47 @@ ENDSELECT ENDPAGEQUERY ENDIF + + IF 输入.flag = "10" + PAGEQUERY + SELECT + d.device_code + FROM pdm_bi_device d + WHERE d.region_code = 'YZ' AND d.device_model IN ('3','4') + ORDER BY d.device_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "11" + PAGEQUERY + SELECT + d.device_code + FROM pdm_bi_device d + WHERE d.region_code = 'HL' + ORDER BY d.device_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "12" + PAGEQUERY + SELECT + point.point_code, + point.point_name, + point.point_status, + CASE point.point_status + WHEN '0' THEN '无货' + WHEN '1' THEN '有货' + ELSE '' + END AS point_status_name + FROM + sch_base_point point + WHERE + point.region_code = 'KLHJ' + AND point.point_type IN ('2','3') + ORDER BY + point.point_code ASC + ENDSELECT + ENDPAGEQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql new file mode 100644 index 0000000..49ed8f9 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql @@ -0,0 +1,209 @@ +[交易说明] + 交易名: 混料和困料数据 + 所属模块: + 功能简述: + 版权所有: + 表引用: + 版本经历: + +[数据库] + --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 + +[IO定义] + ################################################# + ## 表字段对应输入参数 + ################################################# + 输入.flag TYPEAS s_string + 输入.region_code TYPEAS s_string + 输入.point_type TYPEAS s_string + +[临时表] + --这边列出来的临时表就会在运行期动态创建 + +[临时变量] + --所有中间过程变量均可在此处定义 + +[业务过程] + + ########################################## + # 1、输入输出检查 # + ########################################## + + + ########################################## + # 2、主过程前处理 # + ########################################## + + + ########################################## + # 3、业务主过程 # + ########################################## + + IF 输入.flag = "1" + PAGEQUERY + SELECT + IF(LENGTH(material.material_code)>0,LEFT(material.material_code, 11),'-') AS material_code, + IF(LENGTH(vd.qty)>0,vd.qty,'-') AS qty, + IF(LENGTH(vd.create_time)>0,vd.create_time,'-') AS instorage_time, + point.point_code, + point.point_name, + point.point_status, + IF(LENGTH(device.device_name)>0,device.device_name,'-') device_name, + IF(LENGTH(device.device_code)>0,device.device_code,'-') device_code, + CASE point.point_status + WHEN '0' THEN '无货' + WHEN '1' THEN '有货' + ELSE '' + END AS point_status_name, + IF(LENGTH(point.vehicle_code)>0,point.vehicle_code,'-') AS vehicle_code, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num + FROM + sch_base_point point + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = point.vehicle_code + AND vd.vehicle_type = point.vehicle_type + AND vd.is_delete = '0' + LEFT JOIN md_me_materialbase material ON material.material_id = vd.material_id + LEFT JOIN pdm_bi_device device ON device.device_code = ( + SELECT w.device_code FROM pdm_bd_workorder w WHERE w.workorder_id = vd.workorder_id + ) + WHERE + point.region_code = 'BTHC' + ORDER BY + point.sort_seq ASC, + point.point_code ASC + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "2" + PAGEQUERY + SELECT + IF(LENGTH(material.material_code)>0,LEFT(material.material_code, 11),'-') AS material_code, + IF(LENGTH(vd.qty)>0,vd.qty,'-') AS qty, + IF(LENGTH(vd.create_time)>0,vd.create_time,'-') AS instorage_time, + point.point_code, + point.point_name, + point.point_status, + IF(LENGTH(device.device_name)>0,device.device_name,'-') device_name, + IF(LENGTH(device.device_code)>0,device.device_code,'-') device_code, + CASE point.point_status + WHEN '0' THEN '无货' + WHEN '1' THEN '有货' + ELSE '' + END AS point_status_name, + IF(LENGTH(point.vehicle_code)>0,point.vehicle_code,'-') AS vehicle_code, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num + FROM + sch_base_point point + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = point.vehicle_code + AND vd.vehicle_type = point.vehicle_type + AND vd.is_delete = '0' + LEFT JOIN md_me_materialbase material ON material.material_id = vd.material_id + LEFT JOIN pdm_bi_device device ON device.device_code = ( + SELECT w.device_code FROM pdm_bd_workorder w WHERE w.workorder_id = vd.workorder_id + ) + WHERE + point.region_code = 'FJ' AND point.point_type = '5' + ORDER BY + point.point_code ASC + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "3" + PAGEQUERY + SELECT + vd.material_id, + LEFT(mm_stripping.material_code, 11) AS material_code, + SUM(CASE WHEN t.handle_class = 'org.nl.wms.sch.task.call.material.FJCallMaterialTask' THEN vd.qty ELSE 0 END) AS total_stripping_qty, + SUM(CASE WHEN t.handle_class = 'org.nl.wms.sch.task.send.material.FJToPackageTask' THEN vd.qty ELSE 0 END) AS total_palletizing_qty + FROM + `sch_base_task` t + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vd_id = t.group_id + LEFT JOIN md_me_materialbase mm_stripping ON mm_stripping.material_id = vd.material_id + WHERE + t.handle_class IN ('org.nl.wms.sch.task.call.material.FJCallMaterialTask', 'org.nl.wms.sch.task.send.material.FJToPackageTask') AND DATE(t.create_time) = CURDATE() + GROUP BY + vd.material_id, mm_stripping.material_code; + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "4" + PAGEQUERY + SELECT + p.point_code, + p.point_name, + p.point_status, + p.vehicle_code, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num, + IF(LENGTH(LEFT(m.material_code, 11))>0,LEFT(m.material_code, 11),'-') AS material_code, + IF(LENGTH(m.material_code)>0,SUBSTRING(m.material_code, 6, 6),'-') AS bom, + IF(LENGTH(vd.qty)>0,vd.qty,'-') AS qty, + CASE vd.is_full + WHEN '0' THEN + '否' + WHEN '1' THEN + '是' + ELSE + '-' + END AS is_full, + IF(LENGTH(d.device_name)>0,d.device_name,'-') AS device_name + FROM + `sch_base_point` p + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = p.vehicle_code + AND vd.vehicle_type = p.vehicle_type + AND vd.is_delete = '0' + LEFT JOIN md_me_materialbase m ON m.material_id = vd.material_id + LEFT JOIN pdm_bd_workorder w ON w.workorder_id = vd.workorder_id + LEFT JOIN pdm_bi_device d ON d.device_code = w.device_code + WHERE p.region_code = 'FJ' AND p.point_type IN ('1','2') + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "5" + PAGEQUERY + SELECT + d.device_code, + d.device_name + FROM + `pdm_bi_device` d + WHERE + d.region_code IN ('FJ', 'GTK') + ORDER BY d.region_code, d.device_code + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "6" + PAGEQUERY + SELECT + p.point_code, + p.point_name, + p.point_status, + CASE p.point_status + WHEN '0' THEN '无货' + WHEN '1' THEN '有货' + ELSE '' + END AS point_status_name, + IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num, + IF(LENGTH(LEFT(m.material_code, 11))>0,LEFT(m.material_code, 11),'-') AS material_code, + IF(LENGTH(m.material_code)>0,SUBSTRING(m.material_code, 6, 6),'-') AS bom, + IF(LENGTH(vd.qty)>0,vd.qty,'-') AS qty, + IF(LENGTH(p.vehicle_code)>0,p.vehicle_code,'-') AS vehicle_code, + IF(LENGTH(vd.create_time)>0,vd.create_time,'-') AS instorage_time, + IF(LENGTH(d.device_name)>0,d.device_name,'-') AS device_name + FROM + `sch_base_point` p + LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = p.vehicle_code + AND vd.vehicle_type = p.vehicle_type + AND vd.is_delete = '0' + LEFT JOIN md_me_materialbase m ON m.material_id = vd.material_id + LEFT JOIN pdm_bd_workorder w ON w.workorder_id = vd.workorder_id + LEFT JOIN pdm_bi_device d ON d.device_code = w.device_code + WHERE p.region_code = 'BTHC' + ORDER BY p.device_code, p.point_code + ENDSELECT + ENDPAGEQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceStatusEnum.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceStatusEnum.java deleted file mode 100644 index d60f443..0000000 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceStatusEnum.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.nl.wms.sch.manage; - -/** - * @Author: lyd - * @Description: 设备状态枚举 - * @Date: 2023/3/10 - */ -public enum DeviceStatusEnum { - STANDBY("1", "待机"), - RUNNING("2", "运行"), - FAILURE("3", "故障"), - SHUTDOWN("0", "关机"); - private final String code; - private final String description; - - DeviceStatusEnum(String code, String description) { - this.code = code; - this.description = description; - } - - public String getCode() { - return code; - } - - public String getDescription() { - return description; - } -}