diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java index 814bb9c..e6735ae 100644 --- a/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java +++ b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java @@ -132,4 +132,14 @@ public class PointUpdateUtil { } return mode.equals("0") ? DeviceStatusEnum.STANDBY.getCode() : DeviceStatusEnum.RUNNING.getCode(); } + + /** + * 查找设备状态 + * @return + */ + public static JSONObject getDevicesStatus(JSONArray deviceCode) { + WmsToAcsServiceImpl wmsToAcsService = new WmsToAcsServiceImpl(); + JSONObject deviceStatus = wmsToAcsService.getDeviceStatus(deviceCode); + return ObjectUtil.isNotEmpty(deviceStatus)?deviceStatus:null; + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceInfoDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceInfoDto.java index 680430a..6bd33ba 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceInfoDto.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceInfoDto.java @@ -52,7 +52,7 @@ public class DeviceInfoDto implements Serializable { /** * 已生产数量 */ - private BigDecimal real_qty; + private String real_qty = "0"; /** * 生产时间 */ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/SchBasePointDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/SchBasePointDto.java index 4b1b85a..99c8119 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/SchBasePointDto.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/SchBasePointDto.java @@ -80,4 +80,5 @@ public class SchBasePointDto implements Serializable{ * 是否满托 */ private String is_full; + private String struct_url; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java index e8140b5..c34e890 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java @@ -205,33 +205,25 @@ public class CockpitServiceImpl implements CockpitService{ public List deviceMonitor() { List res; ConcurrentHashMap> map = new ConcurrentHashMap<>(); - JSONArray result = WQL.getWO("COCKPIT_DEVICE").addParam("flag", "3").process().getResultJSONArray(0); - if(ObjectUtil.isNotEmpty(result)) { + JSONArray result = WQL.getWO("COCKPIT_DEVICE") + .addParam("flag", "3") + .process() + .getResultJSONArray(0); +// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(result); +// if (ObjectUtil.isEmpty(devicesStatus)) { +// return null; +// } +// JSONArray data = ObjectUtil.isNotEmpty( +// devicesStatus.getJSONArray("data"))?devicesStatus.getJSONArray("data"):null; +// if (ObjectUtil.isEmpty(data)) { +// return null; +// } + if(ObjectUtil.isNotEmpty(result)) { //todo: result -> data res = result.toJavaList(DeviceInfoDto.class); res.forEach(d -> { - if (ObjectUtil.isNotEmpty(d.getRealproducestart_date())) { - // 如果时间存在 - LocalDateTime dateTime = LocalDateTimeUtil.parse(d.getRealproducestart_date().replace(" ", "T")); - LocalDateTime now = LocalDateTime.now(); - Duration duration = Duration.between(dateTime, now); - d.setWork_time(duration.toHours() + ""); - } - // 设置设备状态 -// d.setDevice_status(PointUpdateUtil.getDeviceStatus(d.getDevice_code())); DeviceEnum deviceEnum = DeviceEnum.get(d.getDevice_model(), d.getDevice_code()); // 添加图片名字 d.setDevice_url(deviceEnum.getPictureName()); - // todo: 区分窑与其他设备 - if (d.getDevice_model().equals(DeviceEnum.YAO.getModel())) { - // acs上报 - d.setVehicle_qty(15); - d.setVehicle_max_qty(42); // 最大值 已确认 - } - // todo: RGV - if (d.getDevice_model().equals(DeviceEnum.RGV.getModel())) { - d.setDevice_status_name("空位无车,满位有车"); - } - // todo: 包装机、碟盘机 }); return res; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql index 1146bd1..b99234f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql @@ -41,7 +41,7 @@ IF 输入.flag = "1" PAGEQUERY - SELECT point.*, material.material_name + SELECT point.*, material.material_code FROM sch_base_point point LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id WHERE @@ -55,7 +55,7 @@ IF 输入.flag = "2" PAGEQUERY - SELECT point.*, material.material_name + SELECT point.*, material.material_code FROM sch_base_point point LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id WHERE 1=1 @@ -74,10 +74,10 @@ d.device_model, w.real_qty, w.realproducestart_date, - IF(NULLIF(m.material_name, '') IS NULL, '-', m.material_name) as material_name + IF(NULLIF(m.material_code, '') IS NULL, '-', m.material_code) as material_name FROM `pdm_bi_device` d - LEFT JOIN pdm_bd_workorder w ON (d.device_code = w.device_code) AND w.order_status <> '5' + LEFT JOIN pdm_bd_workorder w ON (d.device_code = w.device_code) AND w.order_status = '3' LEFT JOIN md_me_material_detail m ON w.material_id = m.material_id WHERE d.is_used = '1' diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql index 9b255e5..f74d68e 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql @@ -50,7 +50,6 @@ dict.label, dicts.label order_status, material.material_code, - material.material_name, device.device_name, workorder.* FROM diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_STORAGE.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_STORAGE.wql index dd3be01..2e94323 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_STORAGE.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_STORAGE.wql @@ -42,13 +42,23 @@ PAGEQUERY SELECT material.material_code, - material.material_name, + vd.qty as ivt_qty, + vd.weight as ivt_weight, + vd.create_time as instorage_time, + IF(LENGTH(point.vehicle_code)>0, '1', '') AS struct_url, point.* 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_material_detail material ON material.material_id = ( - SELECT ve.material_id FROM st_ivt_vehicle_detail ve WHERE ve.vehicle_code = point.vehicle_code - AND ve.vehicle_type = point.vehicle_type AND ve.is_delete = '0' + SELECT + ve.material_id + FROM + st_ivt_vehicle_detail ve + WHERE + ve.vehicle_code = point.vehicle_code + AND ve.vehicle_type = point.vehicle_type + AND ve.is_delete = '0' ) WHERE point.region_code = 'KLHJ' @@ -61,17 +71,27 @@ IF 输入.flag = "2" PAGEQUERY SELECT - material.material_code, - material.material_name, - point.* + material.material_code, + vd.qty as ivt_qty, + CASE WHEN vd.is_full = '1' THEN '是' ELSE '否' END AS is_full, + IF(LENGTH(point.vehicle_code)>0, '2', '') AS struct_url, + vd.create_time as instorage_time, + point.* FROM - sch_base_point point - LEFT JOIN md_me_material_detail material ON material.material_id = ( - SELECT ve.material_id FROM st_ivt_vehicle_detail ve WHERE ve.vehicle_code = point.vehicle_code - AND ve.vehicle_type = point.vehicle_type AND ve.is_delete = '0' - ) + 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_material_detail material ON material.material_id = ( + SELECT + ve.material_id + FROM + st_ivt_vehicle_detail ve + WHERE + ve.vehicle_code = point.vehicle_code + AND ve.vehicle_type = point.vehicle_type + AND ve.is_delete = '0' + ) WHERE - point.region_code = 'CPHJ' + point.region_code = 'CPHJ' ORDER BY point.create_time DESC ENDSELECT @@ -82,7 +102,6 @@ PAGEQUERY SELECT material.material_code, - material.material_name, point.* FROM sch_base_point point diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java index 7987298..53a4345 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java @@ -56,6 +56,12 @@ public interface WmsToAcsService { */ JSONObject getPointStatus(JSONArray whereJson); + /** + * 获取设备状态 + * @return + */ + JSONObject getDeviceStatus(JSONArray whereJson); + /** * 获取木托盘 * @param whereJson diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java index fbf2142..43768f8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java @@ -54,6 +54,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { return AcsUtil.notifyAcs(api, whereJson); } + @Override + public JSONObject getDeviceStatus(JSONArray whereJson) { + String api = "api/wms/getDeviceStatus"; + return AcsUtil.notifyAcs(api, whereJson); + } + @Override public JSONObject getTray(JSONArray whereJson) { String api = "api/wms/queryTray"; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java index 5845754..93e0217 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java @@ -10,8 +10,8 @@ import cn.hutool.core.util.StrUtil; public enum DeviceEnum { HLJ("1", "混料机", "HLJ", "HLJ"), HLJ_S("2", "高速混料机", "HLJ_S", "HLJ_S"), - YZJ("3", "压制机", "YZJ", "YZJ"), - YZJ_S("4", "高速压制机", "YZJ_S", "YZJ_S"), + YZJ("3", "压机", "YZJ", "YZJ"), + YZJ_S("4", "液压机", "YZJ_S", "YZJ_S"), // FJJXS("5", "分拣机械手", "FJJXS", "FJJXS"), CPX("6", "拆盘线", "CPX", "CPX"), BZX("6", "包装线", "BZX", "BZX"), 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 index b924a0e..d60f443 100644 --- 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 @@ -9,7 +9,7 @@ public enum DeviceStatusEnum { STANDBY("1", "待机"), RUNNING("2", "运行"), FAILURE("3", "故障"), - SHUTDOWN("4", "关机"); + SHUTDOWN("0", "关机"); private final String code; private final String description;