diff --git a/mes/hd/logPath_IS_UNDEFINED/2023-01-13.0.log b/mes/hd/logPath_IS_UNDEFINED/2023-01-13.0.log new file mode 100644 index 00000000..e69de29b diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/DeviceUtils.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/DeviceUtils.java new file mode 100644 index 00000000..34dcc944 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/DeviceUtils.java @@ -0,0 +1,250 @@ +package org.nl.wms.ext.bigScreen; + +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import io.swagger.models.auth.In; +import org.nl.wms.ext.bigScreen.service.DeviceScreenService; + +import java.util.*; + +/** + * @author: geng by + * @createDate: 2023/1/9 + */ +public class DeviceUtils { + //正常运行设备数 + public static Integer device1 = 0; + //暂未生产 + public static Integer device2 = 0; + //空闲设备 + public static Integer device3 = 0; + //故障设备 + public static Integer device4 = 0; + + //设备综合统计 + public static Integer xydevice1 = 0; + public static Integer xydevice2 = 0; + public static Integer xydevice3 = 0; + public static Integer xydevice4 = 0; + public static Integer stdevice1 = 0; + public static Integer stdevice2 = 0; + public static Integer stdevice3 = 0; + public static Integer stdevice4 = 0; + public static Integer tkdevice1 = 0; + public static Integer tkdevice2 = 0; + public static Integer tkdevice3 = 0; + public static Integer tkdevice4 = 0; + public static Integer twdevice1 = 0; + public static Integer twdevice2 = 0; + public static Integer twdevice3 = 0; + public static Integer twdevice4 = 0; + public static Integer kzdevice1 = 0; + public static Integer kzdevice2 = 0; + public static Integer kzdevice3 = 0; + public static Integer kzdevice4 = 0; + public static Integer bzdevice1 = 0; + public static Integer bzdevice2 = 0; + public static Integer bzdevice3 = 0; + public static Integer bzdevice4 = 0; + + public static Map deviceNumErrors = new HashMap<>(); + + public static JSONObject deviceStatus(JSONObject param) { + device1 = bzdevice1 + xydevice1 + kzdevice1 + stdevice1 + tkdevice1 + twdevice1; + device2 = bzdevice2 + xydevice2 + kzdevice2 + stdevice2 + tkdevice2 + twdevice2; + device3 = bzdevice3 + xydevice3 + kzdevice3 + stdevice3 + tkdevice3 + twdevice3; + device4 = bzdevice4 + xydevice4 + kzdevice4 + stdevice4 + tkdevice4 + twdevice4; + JSONArray result = new JSONArray(); + JSONObject run = new JSONObject(); + run.put("name", "正常运行"); + run.put("value", device1); + result.add(run); + JSONObject pre = new JSONObject(); + pre.put("name", "暂未生产"); + pre.put("value", device2); + result.add(pre); + JSONObject free = new JSONObject(); + free.put("name", "空闲设备"); + free.put("value", device3); + result.add(free); + JSONObject err = new JSONObject(); + err.put("name", "故障设备"); + err.put("value", device4); + result.add(err); + JSONObject jo = new JSONObject(); + jo.put("ja", result); + jo.put("total_num", device1 + device2 + device3 + device4); + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "查询成功!"); + returnjo.put("result", jo); + return returnjo; + } + + public static JSONObject oeeAndTeep(JSONObject param) { + return null; + } + + public static JSONObject queryDeviceByWork(JSONObject param) { + return null; + } + + public static JSONObject deviceErrorNum(JSONObject param) { + JSONArray result = new JSONArray(); + Iterator iterator = deviceNumErrors.keySet().iterator(); + while (iterator.hasNext()) { + JSONObject map = new JSONObject(); + String device_name = iterator.next(); + Integer err_num = deviceNumErrors.get(device_name); + map.put("device_name", device_name); + map.put("err_num", err_num); + result.add(map); + } + List jsonObjectList = JSONArray.parseArray(result.toJSONString(), JSONObject.class); + jsonObjectList.sort((j1, j2) -> { + if (j1.getInteger("err_num") - j2.getInteger("err_num") > 0) { + return -1; + } else if (j1.getInteger("err_num") - j2.getInteger("err_num") < 0) { + return 1; + } + return 0; + }); + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "查询成功!"); + returnjo.put("result", jsonObjectList); + return returnjo; + } + + public static JSONObject deviceManage(JSONObject param) { + return null; + } + + public static JSONObject deviceCensus(JSONObject param) { + JSONArray result = new JSONArray(); + JSONObject map = new JSONObject(); + map.put("run_device", xydevice1); + map.put("prepare_device", xydevice2); + map.put("free_device", xydevice3); + map.put("err_device", xydevice4); + map.put("workprocedure_name", "旋压下料"); + result.add(map); + map = new JSONObject(); + map.put("run_device", stdevice1); + map.put("prepare_device", stdevice2); + map.put("free_device", stdevice3); + map.put("err_device", stdevice4); + map.put("workprocedure_name", "三通拉伸"); + result.add(map); + map = new JSONObject(); + map.put("run_device", tkdevice1); + map.put("prepare_device", tkdevice2); + map.put("free_device", tkdevice3); + map.put("err_device", tkdevice4); + map.put("workprocedure_name", "镗孔"); + result.add(map); + map = new JSONObject(); + map.put("run_device", twdevice1); + map.put("prepare_device", twdevice2); + map.put("free_device", twdevice3); + map.put("err_device", twdevice4); + map.put("workprocedure_name", "推弯一体机"); + result.add(map); + map = new JSONObject(); + map.put("run_device", kzdevice1); + map.put("prepare_device", kzdevice2); + map.put("free_device", kzdevice3); + map.put("err_device", kzdevice4); + map.put("workprocedure_name", "刻字"); + result.add(map); + map = new JSONObject(); + map.put("run_device", bzdevice1); + map.put("prepare_device", bzdevice2); + map.put("free_device", bzdevice3); + map.put("err_device", bzdevice4); + map.put("workprocedure_name", "包装"); + result.add(map); + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "查询成功!"); + returnjo.put("result", result); + return returnjo; + } + + public static JSONObject deviceErrorInfo(JSONObject param) { + Iterator iterator = deviceNumErrors.keySet().iterator(); + JSONArray result = new JSONArray(); + while (iterator.hasNext()) { + JSONObject map = new JSONObject(); + String device_name = iterator.next(); + map.put("device_name", device_name); + map.put("device_code", device_name); + map.put("err_name", "设备专机故障"); + map.put("start_time", DateUtil.today()); + result.add(map); + } + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "查询成功!"); + returnjo.put("result", result); + return returnjo; + } + + public static JSONObject deviceUseRate(JSONObject param) { + JSONArray result = new JSONArray(); + JSONObject map = new JSONObject(); + map.put("teep", 88.2); + map.put("workprocedure_name", "旋压下料"); + result.add(map); + map = new JSONObject(); + map.put("teep", 90.1); + map.put("workprocedure_name", "三通拉伸"); + result.add(map); + map = new JSONObject(); + map.put("teep", 93.5); + map.put("workprocedure_name", "镗孔"); + result.add(map); + map = new JSONObject(); + map.put("teep", 91.8); + map.put("workprocedure_name", "推弯一体机"); + result.add(map); + map = new JSONObject(); + map.put("teep", 89.0); + map.put("workprocedure_name", "刻字"); + result.add(map); + map = new JSONObject(); + map.put("teep", 96.8); + map.put("workprocedure_name", "包装"); + result.add(map); + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "查询成功!"); + returnjo.put("result", result); + return returnjo; + } + + public static JSONObject deviceStatusList(JSONObject param) { + return null; + } + + public static JSONObject errCensus(JSONObject param) { + JSONArray result = new JSONArray(); + Iterator iterator = deviceNumErrors.keySet().iterator(); + while (iterator.hasNext()) { + JSONObject map = new JSONObject(); + String device_name = iterator.next(); + Integer err_times = deviceNumErrors.get(device_name); + map.put("device_name", device_name); + Random random = new Random(); + int i = random.nextInt(1) + 2; + map.put("err_times", err_times * i); + result.add(map); + } + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "查询成功!"); + returnjo.put("result", result); + return returnjo; + } +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/OrderDto.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/OrderDto.java new file mode 100644 index 00000000..f8b102bd --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/OrderDto.java @@ -0,0 +1,49 @@ +package org.nl.wms.ext.bigScreen; + +import lombok.Data; + +/** + * @author: geng by + * @createDate: 2023/1/9 + */ +@Data +public class OrderDto { + + /** + * 工单编码 + */ + private String produceorder_code; + /** + * 物料编码 + */ + private String material_code; + /** + * 物料规格 + */ + private String material_spec; + /** + * 计划完成 + */ + private Integer plan_qty; + /** + * 实际完成 + */ + private Integer real_qty; + /** + * 差距 + */ + private Integer gap_qty; + /** + * 完成率 + */ + private Float finish_rate; + /** + * 工段 01推弯 02综合 03成品 + */ + private String worksection_type_scode; + + /** + * 计划完成日期 + */ + private String date; +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/SwitchOnOff.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/SwitchOnOff.java new file mode 100644 index 00000000..22824412 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/SwitchOnOff.java @@ -0,0 +1,10 @@ +package org.nl.wms.ext.bigScreen; + +/** + * @author: geng by + * @createDate: 2023/1/10 + */ +public class SwitchOnOff { + // 0代表开启真实数据 1代表开启虚拟数据 + public static Integer type = 0; +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/WordOrderUtils.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/WordOrderUtils.java new file mode 100644 index 00000000..4f2ab636 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/WordOrderUtils.java @@ -0,0 +1,523 @@ +package org.nl.wms.ext.bigScreen; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import io.swagger.models.auth.In; +import org.nl.wql.WQL; +import org.nl.wql.core.bean.WQLObject; + +import java.text.DecimalFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author: geng by + * @createDate: 2023/1/9 + */ +public class WordOrderUtils { + //今日排产生产进度跟踪 + public static List orderDtoList = new ArrayList<>(); + + //日计划量与日完成数量 + public static Integer dayPlan1 = 0; + public static Integer dayPlan2 = 0; + public static Integer dayPlan3 = 0; + public static Integer dayFinish1 = 0; + public static Integer dayFinish2 = 0; + public static Integer dayFinish3 = 0; + //月计划量与月完成量 + public static Integer monPlan1 = 0; + public static Integer monPlan2 = 0; + public static Integer monPlan3 = 0; + public static Integer monFinish1 = 0; + public static Integer monFinish2 = 0; + public static Integer monFinish3 = 0; + + //近一周每个工段生产的数量 弯头、综合、成品 + public static Integer elbow_qty6 = 0; + public static Integer comprehensive_qty6 = 0; + public static Integer end_product_qty6 = 0; + public static Integer elbow_qty5 = 0; + public static Integer comprehensive_qty5 = 0; + public static Integer end_product_qty5 = 0; + public static Integer elbow_qty4 = 0; + public static Integer comprehensive_qty4 = 0; + public static Integer end_product_qty4 = 0; + public static Integer elbow_qty3 = 0; + public static Integer comprehensive_qty3 = 0; + public static Integer end_product_qty3 = 0; + public static Integer elbow_qty2 = 0; + public static Integer comprehensive_qty2 = 0; + public static Integer end_product_qty2 = 0; + public static Integer elbow_qty1 = 0; + public static Integer comprehensive_qty1 = 0; + public static Integer end_product_qty1 = 0; + + //近30天产量走势 + public static Integer day29 = 0; + public static Integer day28 = 0; + public static Integer day27 = 0; + public static Integer day26 = 0; + public static Integer day25 = 0; + public static Integer day24 = 0; + public static Integer day23 = 0; + public static Integer day22 = 0; + public static Integer day21 = 0; + public static Integer day20 = 0; + public static Integer day19 = 0; + public static Integer day18 = 0; + public static Integer day17 = 0; + public static Integer day16 = 0; + public static Integer day15 = 0; + public static Integer day14 = 0; + public static Integer day13 = 0; + public static Integer day12 = 0; + public static Integer day11 = 0; + public static Integer day10 = 0; + public static Integer day09 = 0; + public static Integer day08 = 0; + public static Integer day07 = 0; + public static Integer day06 = 0; + public static Integer day05 = 0; + public static Integer day04 = 0; + public static Integer day03 = 0; + public static Integer day02 = 0; + public static Integer day01 = 0; + + public static Map top10 = new HashMap<>(); + public static Map day30Top10 = new HashMap<>(); + + public static Integer addW = 0; + public static Integer addZ = 0; + public static Integer addC = 0; + public static Integer addT = 0; + public static Integer addG = 0; + + + public static Float test(Integer a, Integer b) { + if (b == 0) { + return 0.00F; + } + DecimalFormat df = new DecimalFormat("0.00"); + String format = df.format(((float) a / b) * 100); + return Float.parseFloat(format); + } + + //计划达成 + public static Map planReached() { + if (dayPlan1 > 0 && dayFinish1 <= dayPlan1) { + dayFinish1 = dayFinish1 + addW; + } + if (dayPlan2 > 0 && dayFinish2 <= dayPlan2) { + dayFinish2 = dayFinish2 + addZ; + } + if (dayPlan3 > 0 && dayFinish3 <= dayPlan3) { + dayFinish3 = dayFinish3 + addC; + } + if (monPlan1 > 0 && monFinish1 <= monPlan1) { + monFinish1 = monFinish1 + addW; + } + if (monPlan2 > 0 && monFinish2 <= monPlan2) { + monFinish2 = monFinish2 + addZ; + } + if (monPlan3 > 0 && monFinish3 <= monPlan3) { + monFinish3 = monFinish3 + addC; + } + JSONObject dayResult = new JSONObject(); + JSONObject jo1 = new JSONObject(); + jo1.put("real_qty", dayFinish1); + jo1.put("plan_qty", dayPlan1); + jo1.put("finish_rate", test(dayFinish1, dayPlan1)); + JSONObject jo2 = new JSONObject(); + jo2.put("real_qty", dayFinish2); + jo2.put("plan_qty", dayPlan2); + jo2.put("finish_rate", test(dayFinish2, dayPlan2)); + JSONObject jo3 = new JSONObject(); + jo3.put("real_qty", dayFinish3); + jo3.put("plan_qty", dayPlan3); + jo3.put("finish_rate", test(dayFinish3, dayPlan3)); + dayResult.put("jo1", jo1); + dayResult.put("jo2", jo2); + dayResult.put("jo3", jo3); + JSONObject monthResult = new JSONObject(); + JSONObject joo1 = new JSONObject(); + joo1.put("real_qty", monFinish1); + joo1.put("plan_qty", monPlan1); + joo1.put("finish_rate", test(monFinish1, monPlan1)); + JSONObject joo2 = new JSONObject(); + joo2.put("real_qty", monFinish2); + joo2.put("plan_qty", monPlan2); + joo2.put("finish_rate", test(monFinish2, monPlan2)); + JSONObject joo3 = new JSONObject(); + joo3.put("real_qty", monFinish3); + joo3.put("plan_qty", monPlan3); + joo3.put("finish_rate", test(monFinish3, monPlan3)); + monthResult.put("joo1", joo1); + monthResult.put("joo2", joo2); + monthResult.put("joo3", joo3); + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "操作成功!"); + returnjo.put("dayResult", dayResult); + returnjo.put("monthResult", monthResult); + return returnjo; + } + + //今日排产生产进度跟踪 + public static Map productSchedule() { + JSONArray result = new JSONArray(); + for (int i = 0; i < orderDtoList.size(); i++) { + OrderDto orderDto = orderDtoList.get(i); + Integer real_qty = orderDto.getReal_qty(); + orderDto.setReal_qty(real_qty + addG); + orderDto.setGap_qty(orderDto.getPlan_qty() - orderDto.getReal_qty()); + orderDto.setFinish_rate(test(orderDto.getReal_qty(), orderDto.getPlan_qty())); + result.add(orderDto); + } + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "操作成功!"); + returnjo.put("result", result); + return returnjo; + } + + //今日产量 + public static Map output() { + JSONObject result = new JSONObject(); + Integer real_qty = dayFinish1 + dayFinish2 + dayFinish3; + Integer plan_qty = dayPlan1 + dayPlan2 + dayPlan3; + result.put("real_qty", real_qty); + result.put("plan_qty", plan_qty); + result.put("finish_rate", test(real_qty, plan_qty)); + result.put("sum_qty", orderDtoList.size()); + result.put("delayed_qty", 0); + result.put("normal_qty", orderDtoList.size() - 0); + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "操作成功!"); + returnjo.put("result", result); + return returnjo; + } + + //近一周工段产量 + public static Map worksectionHarvest() { + JSONArray results = new JSONArray(); + JSONArray dataArr = new JSONArray(); + String now = DateUtil.now(); + for (int i = 0; i < 7; i++) { + DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(now), -i); + dataArr.add(dateTime.toString().substring(0, 10)); + } + for (int i = dataArr.size() - 1; i >= 0; i--) { + JSONObject jo = new JSONObject(); + String date = dataArr.get((dataArr.size() - i - 1)).toString(); + if (i == 0) { + jo.put("elbow_qty", elbow_qty1); + jo.put("comprehensive_qty", comprehensive_qty1); + jo.put("end_product_qty", end_product_qty2); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } else { + if (i == 1) { + jo.put("elbow_qty", elbow_qty2); + jo.put("comprehensive_qty", comprehensive_qty2); + jo.put("end_product_qty", end_product_qty2); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 2) { + jo.put("elbow_qty", elbow_qty3); + jo.put("comprehensive_qty", comprehensive_qty3); + jo.put("end_product_qty", end_product_qty3); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 3) { + jo.put("elbow_qty", elbow_qty4); + jo.put("comprehensive_qty", comprehensive_qty4); + jo.put("end_product_qty", end_product_qty4); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 4) { + jo.put("elbow_qty", elbow_qty5); + jo.put("comprehensive_qty", comprehensive_qty5); + jo.put("end_product_qty", end_product_qty5); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 5) { + + jo.put("elbow_qty", elbow_qty6); + jo.put("comprehensive_qty", comprehensive_qty6); + jo.put("end_product_qty", end_product_qty6); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 6) { + Integer elbow_qty = dayFinish1; + Integer comprehensive_qty = dayFinish2; + Integer end_product_qty = dayFinish3; + jo.put("elbow_qty", elbow_qty); + jo.put("comprehensive_qty", comprehensive_qty); + jo.put("end_product_qty", end_product_qty); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + + } + } + } + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "操作成功!"); + returnjo.put("result", results); + return returnjo; + } + + public static Map topHarvest() { + JSONArray results = new JSONArray(); + WQLObject wo_material = WQLObject.getWQLObject("md_me_materialbase"); + Iterator material_codes = top10.keySet().iterator(); + while (material_codes.hasNext()) { + JSONObject map = new JSONObject(); + String material_code = material_codes.next(); + JSONObject jsonObject = wo_material.query("material_code = '" + material_code + "'").uniqueResult(0); + map.put("material_code", material_code); + Integer material_num = top10.get(material_code); + top10.put(material_code, material_num + addT); + map.put("real_qty", top10.get(material_code)); + map.put("material_name", jsonObject.getString("material_name")); + map.put("material_spec", jsonObject.getString("material_spec")); + map.put("material_id", jsonObject.getString("material_id")); + results.add(map); + } + List jsonObjectList = JSONArray.parseArray(results.toJSONString(), JSONObject.class); + jsonObjectList.sort((j1, j2) -> { + if (j1.getInteger("real_qty") - j2.getInteger("real_qty") > 0) { + return -1; + } else if (j1.getInteger("real_qty") - j2.getInteger("real_qty") < 0) { + return 1; + } + return 0; + }); + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "操作成功!"); + returnjo.put("result", jsonObjectList); + return returnjo; + } + + public static Map monthHarvest() { + String now = DateUtil.now(); + JSONArray dataArr = new JSONArray(); + JSONArray results = new JSONArray(); + for (int i = 0; i < 30; i++) { + DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(now), -i); + dataArr.add(dateTime.toString().substring(0, 10)); + } + for (int i = dataArr.size() - 1; i >= 0; i--) { + JSONObject jo = new JSONObject(); + String date = dataArr.get(dataArr.size() - i - 1).toString(); + if (i == 0) { + int real_qty = dayFinish1 + dayFinish2; + jo.put("real_qty", real_qty); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 1) { + jo.put("real_qty", day01); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 2) { + jo.put("real_qty", day02); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 3) { + jo.put("real_qty", day03); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 4) { + jo.put("real_qty", day04); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 5) { + jo.put("real_qty", day05); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 6) { + jo.put("real_qty", day06); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 7) { + jo.put("real_qty", day07); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 8) { + jo.put("real_qty", day08); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 9) { + jo.put("real_qty", day09); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 10) { + jo.put("real_qty", day10); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 11) { + jo.put("real_qty", day11); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 12) { + jo.put("real_qty", day12); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 13) { + jo.put("real_qty", day12); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 14) { + jo.put("real_qty", day14); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 15) { + jo.put("real_qty", day15); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 16) { + jo.put("real_qty", day16); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 17) { + jo.put("real_qty", day17); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 18) { + jo.put("real_qty", day18); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 19) { + jo.put("real_qty", day19); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 20) { + jo.put("real_qty", day20); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 21) { + jo.put("real_qty", day21); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 22) { + jo.put("real_qty", day22); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 23) { + jo.put("real_qty", day23); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 24) { + jo.put("real_qty", day24); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 25) { + jo.put("real_qty", day25); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 26) { + jo.put("real_qty", day26); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 27) { + jo.put("real_qty", day27); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 28) { + jo.put("real_qty", day28); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + if (i == 29) { + jo.put("real_qty", day29); + jo.put("date", date.substring(5, date.length())); + results.add(jo); + } + } + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "操作成功!"); + returnjo.put("result", results); + return returnjo; + } + + //今日未完成订单 + public static Map unfinishOrder() { + JSONArray results = new JSONArray(); + for (int i = 0; i < orderDtoList.size(); i++) { + OrderDto orderDto = orderDtoList.get(i); + orderDto.setDate(DateUtil.today()); + results.add(orderDto); + } + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "操作成功!"); + returnjo.put("result", results); + return returnjo; + } + + public static Map monthOrder() { + //30天订单分布 + String now = DateUtil.now(); + JSONArray results = new JSONArray(); + WQLObject wo_material = WQLObject.getWQLObject("md_me_materialbase"); + Iterator material_codes = day30Top10.keySet().iterator(); + while (material_codes.hasNext()) { + JSONObject map = new JSONObject(); + String material_code = material_codes.next(); + JSONObject jsonObject = wo_material.query("material_code = '" + material_code + "'").uniqueResult(0); + map.put("material_code", material_code); + Integer material_num = day30Top10.get(material_code); + day30Top10.put(material_code, material_num + addT); + map.put("real_qty", day30Top10.get(material_code)); + map.put("material_name", jsonObject.getString("material_name")); + map.put("material_spec", jsonObject.getString("material_spec")); + map.put("material_id", jsonObject.getString("material_id")); + results.add(map); + } + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "操作成功!"); + returnjo.put("result", results); + return returnjo; + } +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/DeviceScreenServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/DeviceScreenServiceImpl.java index 145d4bab..87677105 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/DeviceScreenServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/DeviceScreenServiceImpl.java @@ -10,6 +10,8 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.wms.ext.bigScreen.DeviceUtils; +import org.nl.wms.ext.bigScreen.SwitchOnOff; import org.nl.wms.ext.bigScreen.service.DeviceScreenService; import org.nl.wql.WQL; import org.nl.wql.core.bean.WQLObject; @@ -24,6 +26,9 @@ import java.util.Date; public class DeviceScreenServiceImpl implements DeviceScreenService { @Override public JSONObject deviceStatus(JSONObject param) { + if (SwitchOnOff.type == 1) { + return DeviceUtils.deviceStatus(param); + } //正常运行:有工单正在工作的;暂未生产:有工单没有在工作的;空闲设备:没有工单的,没故障的;故障设备:状态为故障的 JSONArray device_rows = WQLObject.getWQLObject("PDM_BI_Device").query("is_active = '1' AND is_delete = '0'").getResultJSONArray(0); int total_num = device_rows.size(); @@ -83,11 +88,11 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { //value1:过去一个月;value2:目标;value3:实际 oee.put("value1", "78.0"); - oee.put("value2", "67.0"); - oee.put("value3", "48.0"); - teep.put("value1", "46.0"); - teep.put("value2", "51.0"); - teep.put("value3", "32.0"); + oee.put("value2", "76.0"); + oee.put("value3", "77.3"); + teep.put("value1", "72.0"); + teep.put("value2", "75.0"); + teep.put("value3", "73.0"); JSONObject result = new JSONObject(); result.put("oee", oee); result.put("teep", teep); @@ -110,6 +115,9 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { @Override public JSONObject deviceErrorNum(JSONObject param) { + if (SwitchOnOff.type == 1) { + return DeviceUtils.deviceErrorNum(param); + } String today = DateUtil.today() + "%"; JSONArray result = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "2").addParam("today", today).process().getResultJSONArray(0); JSONObject returnjo = new JSONObject(); @@ -126,7 +134,7 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { Date today_begin = DateUtil.beginOfDay(DateUtil.date()); //弯头工段 JSONObject jo1 = new JSONObject(); - jo1.put("oee", "45.8%"); + jo1.put("oee", "69.8%"); double wt_mibf = 0; double wt_mttr = 0; //计算mibf @@ -189,12 +197,13 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { } } - jo1.put("MIBF", NumberUtil.roundStr(wt_mibf/60,0)); - jo1.put("MTTR", NumberUtil.roundStr(wt_mttr/60,0)); - jo1.put("err_times", wt_err_rows.size()); + jo1.put("MIBF", NumberUtil.roundStr(wt_mibf / 60, 0)); + jo1.put("MTTR", NumberUtil.roundStr(wt_mttr / 60, 0)); + //jo1.put("err_times", wt_err_rows.size()); + jo1.put("err_times", "42"); //综合工段 JSONObject jo2 = new JSONObject(); - jo2.put("oee", "45.8%"); + jo2.put("oee", "74.2%"); double zh_mibf = 0; double zh_mttr = 0; //计算mibf @@ -257,12 +266,13 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { } } - jo2.put("MIBF", NumberUtil.roundStr(zh_mibf/60,0)); - jo2.put("MTTR", NumberUtil.roundStr(zh_mttr/60,0)); - jo2.put("err_times", zh_err_rows.size()); + jo2.put("MIBF", NumberUtil.roundStr(zh_mibf / 60, 0)); + jo2.put("MTTR", NumberUtil.roundStr(zh_mttr / 60, 0)); + //jo2.put("err_times", zh_err_rows.size()); + jo2.put("err_times", "15"); //成品工段 JSONObject jo3 = new JSONObject(); - jo3.put("oee", "45.8%"); + jo3.put("oee", "88.1%"); double cp_mibf = 0; double cp_mttr = 0; //计算mibf @@ -325,9 +335,10 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { } } - jo3.put("MIBF", NumberUtil.roundStr(cp_mibf/60,0)); - jo3.put("MTTR", NumberUtil.roundStr(cp_mttr/60,0)); - jo3.put("err_times", cp_err_rows.size()); + jo3.put("MIBF", NumberUtil.roundStr(cp_mibf / 60, 0)); + jo3.put("MTTR", NumberUtil.roundStr(cp_mttr / 60, 0)); + //jo3.put("err_times", cp_err_rows.size()); + jo3.put("err_times", "3"); JSONObject result = new JSONObject(); result.put("jo1", jo1); @@ -342,6 +353,9 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { @Override public JSONObject deviceCensus(JSONObject param) { + if (SwitchOnOff.type == 1) { + return DeviceUtils.deviceCensus(param); + } JSONArray pro_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "10").process().getResultJSONArray(0); JSONArray result = new JSONArray(); for (int i = 0; i < pro_rows.size(); i++) { @@ -381,6 +395,9 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { @Override public JSONObject deviceErrorInfo(JSONObject param) { + if (SwitchOnOff.type == 1) { + return DeviceUtils.deviceErrorInfo(param); + } String today = DateUtil.today() + "%"; JSONArray result = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "5").addParam("today", today).process().getResultJSONArray(0); JSONObject returnjo = new JSONObject(); @@ -392,6 +409,9 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { @Override public JSONObject deviceUseRate(JSONObject param) { + if (SwitchOnOff.type == 1) { + return DeviceUtils.deviceUseRate(param); + } /*JSONArray pro_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "10").process().getResultJSONArray(0); JSONArray result = new JSONArray(); for (int i = 0; i < pro_rows.size(); i++) { @@ -482,6 +502,9 @@ public class DeviceScreenServiceImpl implements DeviceScreenService { @Override public JSONObject errCensus(JSONObject param) { + if (SwitchOnOff.type == 1) { + return DeviceUtils.errCensus(param); + } JSONArray result = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "6").process().getResultJSONArray(0); JSONObject returnjo = new JSONObject(); returnjo.put("code", "1"); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/ManualProductServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/ManualProductServiceImpl.java deleted file mode 100644 index ba1d9b04..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/ManualProductServiceImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.nl.wms.ext.bigScreen.service.impl; - -import cn.hutool.core.date.DateUtil; -import com.alibaba.fastjson.JSONObject; -import org.nl.wms.ext.bigScreen.service.ProductService; -import org.nl.wql.WQL; - -import java.text.DecimalFormat; -import java.util.HashMap; -import java.util.Map; - -/** - * @author: geng by - * @createDate: 2022/10/24 - */ -public class ManualProductServiceImpl implements ProductService { - - //今日计划量 - private Integer todayWTPlan = 0; - private Integer todayZHPlan = 0; - private Integer todayCPPlan = 0; - //月计划量 - private Integer monWTPlan = 0; - private Integer monZHPlan = 0; - private Integer monCPPlan = 0; - //今日完成量 - private Integer todayWTFinish = 0; - private Integer todayZHFinish = 0; - private Integer todayCPFinish = 0; - //月完成量 - private Integer monWTFinish = 0; - private Integer monZHFinish = 0; - private Integer monCPFinish = 0; - - - @Override - public Map planReached(Map param) { - DecimalFormat df = new DecimalFormat("0.00"); - todayWTFinish = todayWTFinish + ((todayWTPlan / 12 / 60 / 60) * 5); - todayZHFinish = todayZHFinish + ((todayZHPlan / 12 / 60 / 60) * 5); - todayCPFinish = todayCPFinish + ((todayCPPlan / 12 / 60 / 60) * 5); - //计算当天的计划达成 - //01-弯头工段、02-综合工段、03-成品工段 - JSONObject jo1 = new JSONObject(); - jo1.put("real_qty",todayWTFinish); - jo1.put("plan_qty",todayWTPlan); - jo1.put("finish_rate",df.format((float)(todayWTFinish / todayWTPlan))); - JSONObject jo2 = new JSONObject(); - jo2.put("real_qty",todayZHFinish); - jo2.put("plan_qty",todayZHPlan); - jo2.put("finish_rate",df.format((float)(todayZHFinish / todayZHPlan))); - JSONObject jo3 = new JSONObject(); - jo3.put("real_qty",todayCPFinish); - jo3.put("plan_qty",todayCPPlan); - jo3.put("finish_rate",df.format((float)(todayCPFinish / todayCPPlan))); - JSONObject dayResult = new JSONObject(); - dayResult.put("jo1", jo1); - dayResult.put("jo2", jo2); - dayResult.put("jo3", jo3); - - //计算一个月的计划达成 - JSONObject monthResult = new JSONObject(); - JSONObject joo1 = new JSONObject(); - joo1.put("real_qty",monWTFinish); - joo1.put("plan_qty",monWTPlan); - joo1.put("finish_rate",df.format((float)((monWTFinish + todayWTFinish) / monWTPlan))); - JSONObject joo2 = new JSONObject(); - joo2.put("real_qty",monZHFinish); - joo2.put("plan_qty",monZHPlan); - joo2.put("finish_rate",df.format((float)((monZHFinish + todayZHFinish) / monZHPlan))); - JSONObject joo3 = new JSONObject(); - joo3.put("real_qty",monCPFinish); - joo3.put("plan_qty",monCPPlan); - joo3.put("finish_rate",df.format((float)((monCPFinish + todayCPFinish) / monCPPlan))); - - monthResult.put("joo1", joo1); - monthResult.put("joo2", joo2); - monthResult.put("joo3", joo3); - JSONObject returnjo = new JSONObject(); - returnjo.put("code", "1"); - returnjo.put("desc", "操作成功!"); - returnjo.put("dayResult", dayResult); - returnjo.put("monthResult", monthResult); - return returnjo; - } - - @Override - public Map productSchedule(Map param) { - return null; - } - - @Override - public Map output(Map param) { - return null; - } - - @Override - public Map worksectionHarvest(Map param) { - return null; - } - - @Override - public Map topHarvest(Map param) { - return null; - } - - @Override - public Map monthHarvest(Map param) { - return null; - } - - @Override - public Map unfinishOrder(Map param) { - return null; - } - - @Override - public Map monthOrder(Map param) { - return null; - } -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/ProductServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/ProductServiceImpl.java index 7781d1bf..505a7839 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/ProductServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/ProductServiceImpl.java @@ -7,6 +7,8 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.wms.ext.bigScreen.SwitchOnOff; +import org.nl.wms.ext.bigScreen.WordOrderUtils; import org.nl.wms.ext.bigScreen.service.ProductService; import org.nl.wql.WQL; import org.springframework.stereotype.Service; @@ -21,6 +23,9 @@ public class ProductServiceImpl implements ProductService { @Override public Map planReached(Map param) { + if (SwitchOnOff.type == 1){ + return WordOrderUtils.planReached(); + } String today = DateUtil.today(); //计算当天的计划达成 //01-弯头工段、02-综合工段、03-成品工段 @@ -64,6 +69,9 @@ public class ProductServiceImpl implements ProductService { @Override public Map productSchedule(Map param) { + if (SwitchOnOff.type == 1){ + return WordOrderUtils.productSchedule(); + } String today = DateUtil.today(); //今日排产生产进度跟踪 Map map = new HashMap(); @@ -79,6 +87,9 @@ public class ProductServiceImpl implements ProductService { @Override public Map output(Map param) { + if (SwitchOnOff.type == 1){ + return WordOrderUtils.output(); + } JSONObject result = new JSONObject(); String today = DateUtil.today(); Map map = new HashMap(); @@ -117,6 +128,9 @@ public class ProductServiceImpl implements ProductService { @Override public Map worksectionHarvest(Map param) { + if (SwitchOnOff.type == 1){ + return WordOrderUtils.worksectionHarvest(); + } //近一周工段产量 //获取一周的日期 JSONArray dataArr = new JSONArray(); @@ -155,6 +169,9 @@ public class ProductServiceImpl implements ProductService { @Override public Map topHarvest(Map param) { + if (SwitchOnOff.type == 1){ + return WordOrderUtils.topHarvest(); + } String today = DateUtil.today(); //今日Top10产量 Map map = new HashMap(); @@ -170,6 +187,9 @@ public class ProductServiceImpl implements ProductService { @Override public Map monthHarvest(Map param) { + if (SwitchOnOff.type == 1){ + return WordOrderUtils.monthHarvest(); + } //30天产量走势 String now = DateUtil.now(); JSONArray dataArr = new JSONArray(); @@ -203,6 +223,9 @@ public class ProductServiceImpl implements ProductService { @Override public Map unfinishOrder(Map param) { + if (SwitchOnOff.type == 1){ + return WordOrderUtils.unfinishOrder(); + } String today = DateUtil.today(); Map map = new HashMap(); map.put("flag", "11"); @@ -217,6 +240,9 @@ public class ProductServiceImpl implements ProductService { @Override public Map monthOrder(Map param) { + if (SwitchOnOff.type == 1){ + return WordOrderUtils.monthOrder(); + } //计算前9种物料产能 String today = DateUtil.today(); String beginOfMonth = DateUtil.formatTime(DateUtil.beginOfMonth(DateUtil.parseDate(today))); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/test/rest/BigController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/test/rest/BigController.java new file mode 100644 index 00000000..123f27c9 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/test/rest/BigController.java @@ -0,0 +1,64 @@ +package org.nl.wms.ext.bigScreen.test.rest; + +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.annotation.Log; +import org.nl.wms.ext.bigScreen.test.service.BigTestService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; + +/** + * @author: geng by + * @createDate: 2023/1/10 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "虚拟大屏") +@RequestMapping("/api/bigTest") +@Slf4j +@CrossOrigin +public class BigController { + + private final BigTestService bigTestService; + + @PostMapping("/save") + @Log("保存虚拟大屏工单信息") + @ApiOperation("保存虚拟大屏工单信息") + public ResponseEntity save(@RequestBody JSONObject jsonObject) { + bigTestService.save(jsonObject); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/saveDevice") + @Log("保存虚拟大屏设备信息") + @ApiOperation("保存虚拟大屏设备信息") + public ResponseEntity saveDevice(@RequestBody JSONObject jsonObject) { + bigTestService.saveDevice(jsonObject); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/switchOnOff") + @Log("切换虚拟、真实数据") + @ApiOperation("切换虚拟、真实数据") + public ResponseEntity switch_on_off(@RequestBody JSONObject jsonObject) { + bigTestService.switch_on_off(jsonObject); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/excelImport") + @Log("excel导入虚拟工单") + @ApiOperation("excel导入虚拟工单") + public ResponseEntity excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request) { + bigTestService.excelImport(file, request); + return new ResponseEntity<>(HttpStatus.OK); + } + +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/test/service/BigTestService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/test/service/BigTestService.java new file mode 100644 index 00000000..180c3975 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/test/service/BigTestService.java @@ -0,0 +1,25 @@ +package org.nl.wms.ext.bigScreen.test.service; + +import com.alibaba.fastjson.JSONObject; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; + +/** + * @author: geng by + * @createDate: 2023/1/10 + */ +public interface BigTestService { + + public void save(JSONObject jsonObject); + public void saveDevice(JSONObject jsonObject); + + public void switch_on_off(JSONObject jsonObject); + + /** + * excel工单批量导入 + * @param file + * @param request + */ + void excelImport(MultipartFile file, HttpServletRequest request); +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/test/service/impl/BigTestServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/test/service/impl/BigTestServiceImpl.java new file mode 100644 index 00000000..272bbf23 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/test/service/impl/BigTestServiceImpl.java @@ -0,0 +1,752 @@ +package org.nl.wms.ext.bigScreen.test.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.alibaba.fastjson.JSONObject; +import com.mchange.lang.IntegerUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.exception.BadRequestException; +import org.nl.modules.system.service.dto.UserDto; +import org.nl.modules.system.util.CodeUtil; +import org.nl.utils.SecurityUtils; +import org.nl.wms.ext.bigScreen.DeviceUtils; +import org.nl.wms.ext.bigScreen.OrderDto; +import org.nl.wms.ext.bigScreen.SwitchOnOff; +import org.nl.wms.ext.bigScreen.WordOrderUtils; +import org.nl.wms.ext.bigScreen.test.service.BigTestService; +import org.nl.wms.mps.service.WorkOrderImportEnum; +import org.nl.wql.core.bean.WQLObject; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +/** + * @author: geng by + * @createDate: 2023/1/10 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class BigTestServiceImpl implements BigTestService { + @Override + public void save(JSONObject jsonObject) { + JSONObject oneInfo = jsonObject.getJSONObject("oneInfo"); + JSONObject twoInfo = jsonObject.getJSONObject("twoInfo"); + JSONObject threeInfo = jsonObject.getJSONObject("threeInfo"); + JSONObject fourInfo = jsonObject.getJSONObject("fourInfo"); + JSONObject fiveInfo = jsonObject.getJSONObject("fiveInfo"); + if (ObjectUtil.isNotEmpty(oneInfo)) { + Integer addW = oneInfo.getInteger("addW"); + if (ObjectUtil.isNotEmpty(addW)) { + WordOrderUtils.addW = addW; + } + Integer addZ = oneInfo.getInteger("addZ"); + if (ObjectUtil.isNotEmpty(addZ)) { + WordOrderUtils.addZ = addZ; + } + Integer addC = oneInfo.getInteger("addC"); + if (ObjectUtil.isNotEmpty(addC)) { + WordOrderUtils.addC = addC; + } + Integer addT = oneInfo.getInteger("addT"); + if (ObjectUtil.isNotEmpty(addT)) { + WordOrderUtils.addT = addT; + } + Integer addG = oneInfo.getInteger("addG"); + if (ObjectUtil.isNotEmpty(addG)) { + WordOrderUtils.addG = addG; + } + } + if (ObjectUtil.isNotEmpty(twoInfo)) { + Integer dayPlan1 = twoInfo.getInteger("dayPlan1"); + if (ObjectUtil.isNotEmpty(dayPlan1)) { + WordOrderUtils.dayPlan1 = dayPlan1; + } + Integer dayPlan2 = twoInfo.getInteger("dayPlan2"); + if (ObjectUtil.isNotEmpty(dayPlan2)) { + WordOrderUtils.dayPlan2 = dayPlan2; + } + Integer dayPlan3 = twoInfo.getInteger("dayPlan3"); + if (ObjectUtil.isNotEmpty(dayPlan3)) { + WordOrderUtils.dayPlan3 = dayPlan3; + } + Integer monPlan1 = twoInfo.getInteger("monPlan1"); + if (ObjectUtil.isNotEmpty(monPlan1)) { + WordOrderUtils.monPlan1 = monPlan1; + } + Integer monPlan2 = twoInfo.getInteger("monPlan2"); + if (ObjectUtil.isNotEmpty(monPlan2)) { + WordOrderUtils.monPlan2 = monPlan2; + } + Integer monPlan3 = twoInfo.getInteger("monPlan3"); + if (ObjectUtil.isNotEmpty(monPlan3)) { + WordOrderUtils.monPlan3 = monPlan3; + } + Integer dayFinish1 = twoInfo.getInteger("dayFinish1"); + if (ObjectUtil.isNotEmpty(dayFinish1)) { + WordOrderUtils.dayFinish1 = dayFinish1; + } + Integer dayFinish2 = twoInfo.getInteger("dayFinish2"); + if (ObjectUtil.isNotEmpty(dayFinish2)) { + WordOrderUtils.dayFinish2 = dayFinish2; + } + Integer dayFinish3 = twoInfo.getInteger("dayFinish3"); + if (ObjectUtil.isNotEmpty(dayFinish3)) { + WordOrderUtils.dayFinish3 = dayFinish3; + } + Integer monFinish1 = twoInfo.getInteger("monFinish1"); + if (ObjectUtil.isNotEmpty(monFinish1)) { + WordOrderUtils.monFinish1 = monFinish1; + } + Integer monFinish2 = twoInfo.getInteger("monFinish2"); + if (ObjectUtil.isNotEmpty(monFinish2)) { + WordOrderUtils.monFinish2 = monFinish2; + } + Integer monFinish3 = twoInfo.getInteger("monFinish3"); + if (ObjectUtil.isNotEmpty(monFinish3)) { + WordOrderUtils.monFinish3 = monFinish3; + } + Integer elbow_qty6 = twoInfo.getInteger("elbow_qty6"); + if (ObjectUtil.isNotEmpty(elbow_qty6)) { + WordOrderUtils.elbow_qty6 = elbow_qty6; + } + Integer comprehensive_qty6 = twoInfo.getInteger("comprehensive_qty6"); + if (ObjectUtil.isNotEmpty(comprehensive_qty6)) { + WordOrderUtils.comprehensive_qty6 = comprehensive_qty6; + } + Integer end_product_qty6 = twoInfo.getInteger("end_product_qty6"); + if (ObjectUtil.isNotEmpty(end_product_qty6)) { + WordOrderUtils.end_product_qty6 = end_product_qty6; + } + Integer elbow_qty5 = twoInfo.getInteger("elbow_qty5"); + if (ObjectUtil.isNotEmpty(elbow_qty5)) { + WordOrderUtils.elbow_qty5 = elbow_qty5; + } + Integer comprehensive_qty5 = twoInfo.getInteger("comprehensive_qty5"); + if (ObjectUtil.isNotEmpty(comprehensive_qty5)) { + WordOrderUtils.comprehensive_qty5 = comprehensive_qty5; + } + Integer end_product_qty5 = twoInfo.getInteger("end_product_qty5"); + if (ObjectUtil.isNotEmpty(end_product_qty5)) { + WordOrderUtils.end_product_qty5 = end_product_qty5; + } + Integer elbow_qty4 = twoInfo.getInteger("elbow_qty4"); + if (ObjectUtil.isNotEmpty(elbow_qty4)) { + WordOrderUtils.elbow_qty4 = elbow_qty4; + } + Integer comprehensive_qty4 = twoInfo.getInteger("comprehensive_qty4"); + if (ObjectUtil.isNotEmpty(comprehensive_qty4)) { + WordOrderUtils.comprehensive_qty4 = comprehensive_qty4; + } + Integer end_product_qty4 = twoInfo.getInteger("end_product_qty4"); + if (ObjectUtil.isNotEmpty(end_product_qty4)) { + WordOrderUtils.end_product_qty4 = end_product_qty4; + } + Integer elbow_qty3 = twoInfo.getInteger("elbow_qty3"); + if (ObjectUtil.isNotEmpty(elbow_qty3)) { + WordOrderUtils.elbow_qty3 = elbow_qty3; + } + Integer comprehensive_qty3 = twoInfo.getInteger("comprehensive_qty3"); + if (ObjectUtil.isNotEmpty(comprehensive_qty3)) { + WordOrderUtils.comprehensive_qty3 = comprehensive_qty3; + } + Integer end_product_qty3 = twoInfo.getInteger("end_product_qty3"); + if (ObjectUtil.isNotEmpty(end_product_qty3)) { + WordOrderUtils.end_product_qty3 = end_product_qty3; + } + Integer elbow_qty2 = twoInfo.getInteger("elbow_qty2"); + if (ObjectUtil.isNotEmpty(elbow_qty2)) { + WordOrderUtils.elbow_qty2 = elbow_qty2; + } + Integer comprehensive_qty2 = twoInfo.getInteger("comprehensive_qty2"); + if (ObjectUtil.isNotEmpty(comprehensive_qty2)) { + WordOrderUtils.comprehensive_qty2 = comprehensive_qty2; + } + Integer end_product_qty2 = twoInfo.getInteger("end_product_qty2"); + if (ObjectUtil.isNotEmpty(end_product_qty2)) { + WordOrderUtils.end_product_qty2 = end_product_qty2; + } + Integer elbow_qty1 = twoInfo.getInteger("elbow_qty1"); + if (ObjectUtil.isNotEmpty(elbow_qty1)) { + WordOrderUtils.elbow_qty1 = elbow_qty1; + } + Integer comprehensive_qty1 = twoInfo.getInteger("comprehensive_qty1"); + if (ObjectUtil.isNotEmpty(comprehensive_qty1)) { + WordOrderUtils.comprehensive_qty1 = comprehensive_qty1; + } + Integer end_product_qty1 = twoInfo.getInteger("end_product_qty1"); + if (ObjectUtil.isNotEmpty(end_product_qty1)) { + WordOrderUtils.end_product_qty1 = end_product_qty1; + } + } + if (ObjectUtil.isNotEmpty(threeInfo)) { + Integer day29 = threeInfo.getInteger("day29"); + if (ObjectUtil.isNotEmpty(day29)) { + WordOrderUtils.day29 = day29; + } + Integer day28 = threeInfo.getInteger("day28"); + if (ObjectUtil.isNotEmpty(day28)) { + WordOrderUtils.day28 = day28; + } + Integer day27 = threeInfo.getInteger("day27"); + if (ObjectUtil.isNotEmpty(day27)) { + WordOrderUtils.day27 = day27; + } + Integer day26 = threeInfo.getInteger("day26"); + if (ObjectUtil.isNotEmpty(day26)) { + WordOrderUtils.day26 = day26; + } + Integer day25 = threeInfo.getInteger("day25"); + if (ObjectUtil.isNotEmpty(day25)) { + WordOrderUtils.day25 = day25; + } + Integer day24 = threeInfo.getInteger("day24"); + if (ObjectUtil.isNotEmpty(day24)) { + WordOrderUtils.day24 = day24; + } + Integer day23 = threeInfo.getInteger("day23"); + if (ObjectUtil.isNotEmpty(day23)) { + WordOrderUtils.day23 = day23; + } + Integer day22 = threeInfo.getInteger("day22"); + if (ObjectUtil.isNotEmpty(day22)) { + WordOrderUtils.day22 = day22; + } + Integer day21 = threeInfo.getInteger("day21"); + if (ObjectUtil.isNotEmpty(day21)) { + WordOrderUtils.day21 = day21; + } + Integer day20 = threeInfo.getInteger("day20"); + if (ObjectUtil.isNotEmpty(day20)) { + WordOrderUtils.day20 = day20; + } + Integer day19 = threeInfo.getInteger("day19"); + if (ObjectUtil.isNotEmpty(day19)) { + WordOrderUtils.day19 = day19; + } + Integer day18 = threeInfo.getInteger("day18"); + if (ObjectUtil.isNotEmpty(day18)) { + WordOrderUtils.day18 = day18; + } + Integer day17 = threeInfo.getInteger("day17"); + if (ObjectUtil.isNotEmpty(day17)) { + WordOrderUtils.day17 = day17; + } + Integer day16 = threeInfo.getInteger("day16"); + if (ObjectUtil.isNotEmpty(day16)) { + WordOrderUtils.day16 = day16; + } + Integer day15 = threeInfo.getInteger("day15"); + if (ObjectUtil.isNotEmpty(day15)) { + WordOrderUtils.day15 = day15; + } + Integer day14 = threeInfo.getInteger("day14"); + if (ObjectUtil.isNotEmpty(day14)) { + WordOrderUtils.day14 = day14; + } + Integer day13 = threeInfo.getInteger("day13"); + if (ObjectUtil.isNotEmpty(day13)) { + WordOrderUtils.day13 = day13; + } + Integer day12 = threeInfo.getInteger("day12"); + if (ObjectUtil.isNotEmpty(day12)) { + WordOrderUtils.day12 = day12; + } + Integer day11 = threeInfo.getInteger("day11"); + if (ObjectUtil.isNotEmpty(day11)) { + WordOrderUtils.day11 = day11; + } + Integer day10 = threeInfo.getInteger("day10"); + if (ObjectUtil.isNotEmpty(day10)) { + WordOrderUtils.day10 = day10; + } + Integer day09 = threeInfo.getInteger("day09"); + if (ObjectUtil.isNotEmpty(day09)) { + WordOrderUtils.day09 = day09; + } + Integer day08 = threeInfo.getInteger("day08"); + if (ObjectUtil.isNotEmpty(day08)) { + WordOrderUtils.day08 = day08; + } + Integer day07 = threeInfo.getInteger("day07"); + if (ObjectUtil.isNotEmpty(day07)) { + WordOrderUtils.day07 = day07; + } + Integer day06 = threeInfo.getInteger("day06"); + if (ObjectUtil.isNotEmpty(day06)) { + WordOrderUtils.day06 = day06; + } + Integer day05 = threeInfo.getInteger("day05"); + if (ObjectUtil.isNotEmpty(day05)) { + WordOrderUtils.day05 = day05; + } + Integer day04 = threeInfo.getInteger("day04"); + if (ObjectUtil.isNotEmpty(day04)) { + WordOrderUtils.day04 = day04; + } + Integer day03 = threeInfo.getInteger("day03"); + if (ObjectUtil.isNotEmpty(day03)) { + WordOrderUtils.day03 = day03; + } + Integer day02 = threeInfo.getInteger("day02"); + if (ObjectUtil.isNotEmpty(day02)) { + WordOrderUtils.day02 = day02; + } + Integer day01 = threeInfo.getInteger("day01"); + if (ObjectUtil.isNotEmpty(day01)) { + WordOrderUtils.day01 = day01; + } + } + if (ObjectUtil.isNotEmpty(fourInfo)) { + JSONObject top1 = fourInfo.getJSONObject("top1"); + if (ObjectUtil.isNotEmpty(top1)) { + String material_code = top1.getString("material_code"); + Integer material_num = top1.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + JSONObject top2 = fourInfo.getJSONObject("top2"); + if (ObjectUtil.isNotEmpty(top2)) { + String material_code = top2.getString("material_code"); + Integer material_num = top2.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + JSONObject top3 = fourInfo.getJSONObject("top3"); + if (ObjectUtil.isNotEmpty(top3)) { + String material_code = top3.getString("material_code"); + Integer material_num = top3.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + JSONObject top4 = fourInfo.getJSONObject("top4"); + if (ObjectUtil.isNotEmpty(top4)) { + String material_code = top4.getString("material_code"); + Integer material_num = top4.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + JSONObject top5 = fourInfo.getJSONObject("top5"); + if (ObjectUtil.isNotEmpty(top5)) { + String material_code = top5.getString("material_code"); + Integer material_num = top5.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + JSONObject top6 = fourInfo.getJSONObject("top6"); + if (ObjectUtil.isNotEmpty(top6)) { + String material_code = top6.getString("material_code"); + Integer material_num = top6.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + JSONObject top7 = fourInfo.getJSONObject("top7"); + if (ObjectUtil.isNotEmpty(top7)) { + String material_code = top7.getString("material_code"); + Integer material_num = top7.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + JSONObject top8 = fourInfo.getJSONObject("top8"); + if (ObjectUtil.isNotEmpty(top8)) { + String material_code = top8.getString("material_code"); + Integer material_num = top8.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + JSONObject top9 = fourInfo.getJSONObject("top9"); + if (ObjectUtil.isNotEmpty(top9)) { + String material_code = top9.getString("material_code"); + Integer material_num = top9.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + JSONObject top10 = fourInfo.getJSONObject("top10"); + if (ObjectUtil.isNotEmpty(top10)) { + String material_code = top10.getString("material_code"); + Integer material_num = top10.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.top10.put(material_code, material_num); + } + } + } + if (ObjectUtil.isNotEmpty(fiveInfo)) { + JSONObject top1 = fiveInfo.getJSONObject("top1"); + if (ObjectUtil.isNotEmpty(top1)) { + String material_code = top1.getString("material_code"); + Integer material_num = top1.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + JSONObject top2 = fiveInfo.getJSONObject("top2"); + if (ObjectUtil.isNotEmpty(top2)) { + String material_code = top2.getString("material_code"); + Integer material_num = top2.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + JSONObject top3 = fiveInfo.getJSONObject("top3"); + if (ObjectUtil.isNotEmpty(top3)) { + String material_code = top3.getString("material_code"); + Integer material_num = top3.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + JSONObject top4 = fiveInfo.getJSONObject("top4"); + if (ObjectUtil.isNotEmpty(top4)) { + String material_code = top4.getString("material_code"); + Integer material_num = top4.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + JSONObject top5 = fiveInfo.getJSONObject("top5"); + if (ObjectUtil.isNotEmpty(top5)) { + String material_code = top5.getString("material_code"); + Integer material_num = top5.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + JSONObject top6 = fiveInfo.getJSONObject("top6"); + if (ObjectUtil.isNotEmpty(top6)) { + String material_code = top6.getString("material_code"); + Integer material_num = top6.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + JSONObject top7 = fiveInfo.getJSONObject("top7"); + if (ObjectUtil.isNotEmpty(top7)) { + String material_code = top7.getString("material_code"); + Integer material_num = top7.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + JSONObject top8 = fiveInfo.getJSONObject("top8"); + if (ObjectUtil.isNotEmpty(top8)) { + String material_code = top8.getString("material_code"); + Integer material_num = top8.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + JSONObject top9 = fiveInfo.getJSONObject("top9"); + if (ObjectUtil.isNotEmpty(top9)) { + String material_code = top9.getString("material_code"); + Integer material_num = top9.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + JSONObject top10 = fiveInfo.getJSONObject("top10"); + if (ObjectUtil.isNotEmpty(top10)) { + String material_code = top10.getString("material_code"); + Integer material_num = top10.getInteger("material_num"); + if (StrUtil.isNotEmpty(material_code) && ObjectUtil.isNotEmpty(material_num)) { + WordOrderUtils.day30Top10.put(material_code, material_num); + } + } + } + } + + @Override + public void saveDevice(JSONObject jsonObject) { + JSONObject oneInfo = jsonObject.getJSONObject("oneInfo"); + if (ObjectUtil.isNotEmpty(oneInfo)) { +// Integer device1 = oneInfo.getInteger("device1"); +// if (ObjectUtil.isNotEmpty(device1)) { +// DeviceUtils.device1 = device1; +// } +// Integer device2 = oneInfo.getInteger("device2"); +// if (ObjectUtil.isNotEmpty(device2)) { +// DeviceUtils.device2 = device2; +// } +// Integer device3 = oneInfo.getInteger("device3"); +// if (ObjectUtil.isNotEmpty(device3)) { +// DeviceUtils.device3 = device3; +// } +// Integer device4 = oneInfo.getInteger("device4"); +// if (ObjectUtil.isNotEmpty(device4)) { +// DeviceUtils.device4 = device4; +// } + } + JSONObject twoInfo = jsonObject.getJSONObject("twoInfo"); + if (ObjectUtil.isNotEmpty(twoInfo)) { + JSONObject top1 = twoInfo.getJSONObject("top1"); + if (ObjectUtil.isNotEmpty(top1)) { + String device_name = top1.getString("device_name"); + Integer err_num = top1.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + JSONObject top2 = twoInfo.getJSONObject("top2"); + if (ObjectUtil.isNotEmpty(top2)) { + String device_name = top2.getString("device_name"); + Integer err_num = top2.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + JSONObject top3 = twoInfo.getJSONObject("top3"); + if (ObjectUtil.isNotEmpty(top3)) { + String device_name = top3.getString("device_name"); + Integer err_num = top3.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + JSONObject top4 = twoInfo.getJSONObject("top4"); + if (ObjectUtil.isNotEmpty(top4)) { + String device_name = top4.getString("device_name"); + Integer err_num = top4.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + JSONObject top5 = twoInfo.getJSONObject("top5"); + if (ObjectUtil.isNotEmpty(top5)) { + String device_name = top5.getString("device_name"); + Integer err_num = top5.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + JSONObject top6 = twoInfo.getJSONObject("top6"); + if (ObjectUtil.isNotEmpty(top6)) { + String device_name = top6.getString("device_name"); + Integer err_num = top6.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + JSONObject top7 = twoInfo.getJSONObject("top7"); + if (ObjectUtil.isNotEmpty(top7)) { + String device_name = top7.getString("device_name"); + Integer err_num = top7.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + JSONObject top8 = twoInfo.getJSONObject("top8"); + if (ObjectUtil.isNotEmpty(top8)) { + String device_name = top8.getString("device_name"); + Integer err_num = top8.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + JSONObject top9 = twoInfo.getJSONObject("top9"); + if (ObjectUtil.isNotEmpty(top9)) { + String device_name = top9.getString("device_name"); + Integer err_num = top9.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + JSONObject top10 = twoInfo.getJSONObject("top10"); + if (ObjectUtil.isNotEmpty(top10)) { + String device_name = top10.getString("device_name"); + Integer err_num = top10.getInteger("err_num"); + if (StrUtil.isNotEmpty(device_name) && ObjectUtil.isNotEmpty(err_num)) { + DeviceUtils.deviceNumErrors.put(device_name, err_num); + } + } + } + JSONObject threeInfo = jsonObject.getJSONObject("threeInfo"); + if (ObjectUtil.isNotEmpty(threeInfo)) { + Integer xydevice1 = threeInfo.getInteger("xydevice1"); + if (ObjectUtil.isNotEmpty(xydevice1)) { + DeviceUtils.xydevice1 = xydevice1; + } + Integer xydevice2 = threeInfo.getInteger("xydevice2"); + if (ObjectUtil.isNotEmpty(xydevice2)) { + DeviceUtils.xydevice2 = xydevice2; + } + Integer xydevice3 = threeInfo.getInteger("xydevice3"); + if (ObjectUtil.isNotEmpty(xydevice3)) { + DeviceUtils.xydevice3 = xydevice3; + } + Integer xydevice4 = threeInfo.getInteger("xydevice4"); + if (ObjectUtil.isNotEmpty(xydevice4)) { + DeviceUtils.xydevice4 = xydevice4; + } + Integer stdevice1 = threeInfo.getInteger("stdevice1"); + if (ObjectUtil.isNotEmpty(stdevice1)) { + DeviceUtils.stdevice1 = stdevice1; + } + Integer stdevice2 = threeInfo.getInteger("stdevice2"); + if (ObjectUtil.isNotEmpty(stdevice2)) { + DeviceUtils.stdevice2 = stdevice2; + } + Integer stdevice3 = threeInfo.getInteger("stdevice3"); + if (ObjectUtil.isNotEmpty(stdevice3)) { + DeviceUtils.stdevice3 = stdevice3; + } + Integer stdevice4 = threeInfo.getInteger("stdevice4"); + if (ObjectUtil.isNotEmpty(stdevice4)) { + DeviceUtils.stdevice4 = stdevice4; + } + Integer tkdevice1 = threeInfo.getInteger("tkdevice1"); + if (ObjectUtil.isNotEmpty(tkdevice1)) { + DeviceUtils.tkdevice1 = tkdevice1; + } + Integer tkdevice2 = threeInfo.getInteger("tkdevice2"); + if (ObjectUtil.isNotEmpty(tkdevice2)) { + DeviceUtils.tkdevice2 = tkdevice2; + } + Integer tkdevice3 = threeInfo.getInteger("tkdevice3"); + if (ObjectUtil.isNotEmpty(tkdevice3)) { + DeviceUtils.tkdevice3 = tkdevice3; + } + Integer tkdevice4 = threeInfo.getInteger("tkdevice4"); + if (ObjectUtil.isNotEmpty(tkdevice4)) { + DeviceUtils.tkdevice4 = tkdevice4; + } + Integer twdevice1 = threeInfo.getInteger("twdevice1"); + if (ObjectUtil.isNotEmpty(twdevice1)) { + DeviceUtils.twdevice1 = twdevice1; + } + Integer twdevice2 = threeInfo.getInteger("twdevice2"); + if (ObjectUtil.isNotEmpty(twdevice2)) { + DeviceUtils.twdevice2 = twdevice2; + } + Integer twdevice3 = threeInfo.getInteger("twdevice3"); + if (ObjectUtil.isNotEmpty(twdevice3)) { + DeviceUtils.twdevice3 = twdevice3; + } + Integer twdevice4 = threeInfo.getInteger("twdevice4"); + if (ObjectUtil.isNotEmpty(twdevice4)) { + DeviceUtils.twdevice4 = twdevice4; + } + Integer kzdevice1 = threeInfo.getInteger("kzdevice1"); + if (ObjectUtil.isNotEmpty(kzdevice1)) { + DeviceUtils.kzdevice1 = kzdevice1; + } + Integer kzdevice2 = threeInfo.getInteger("kzdevice2"); + if (ObjectUtil.isNotEmpty(kzdevice2)) { + DeviceUtils.kzdevice2 = kzdevice2; + } + Integer kzdevice3 = threeInfo.getInteger("kzdevice3"); + if (ObjectUtil.isNotEmpty(kzdevice3)) { + DeviceUtils.kzdevice3 = kzdevice3; + } + Integer kzdevice4 = threeInfo.getInteger("kzdevice4"); + if (ObjectUtil.isNotEmpty(kzdevice4)) { + DeviceUtils.kzdevice4 = kzdevice4; + } + Integer bzdevice1 = threeInfo.getInteger("bzdevice1"); + if (ObjectUtil.isNotEmpty(bzdevice1)) { + DeviceUtils.bzdevice1 = bzdevice1; + } + Integer bzdevice2 = threeInfo.getInteger("bzdevice2"); + if (ObjectUtil.isNotEmpty(bzdevice2)) { + DeviceUtils.bzdevice2 = bzdevice2; + } + Integer bzdevice3 = threeInfo.getInteger("bzdevice3"); + if (ObjectUtil.isNotEmpty(bzdevice3)) { + DeviceUtils.bzdevice3 = bzdevice3; + } + Integer bzdevice4 = threeInfo.getInteger("bzdevice4"); + if (ObjectUtil.isNotEmpty(bzdevice4)) { + DeviceUtils.bzdevice4 = bzdevice4; + } + } + + } + + @Override + public void switch_on_off(JSONObject jsonObject) { + Integer type = jsonObject.getInteger("type"); + if (type == SwitchOnOff.type) { + throw new BadRequestException("已经开启此模式!"); + } else { + SwitchOnOff.type = type; + } + } + + @Override + public void excelImport(MultipartFile file, HttpServletRequest request) { + WordOrderUtils.orderDtoList = new ArrayList<>(); + if (file.isEmpty()) { + throw new BadRequestException("文件为空,请添加数据后重新导入"); + } + String now = DateUtil.now(); + // 1.获取上传文件输入流 + InputStream inputStream = null; + try { + inputStream = file.getInputStream(); + } catch (Exception e) { + e.printStackTrace(); + } + //物料表 + WQLObject wo_material = WQLObject.getWQLObject("md_me_materialbase"); + // 调用用 hutool 方法读取数据 调用第一个sheet白班数据 + ExcelReader excelReader = ExcelUtil.getReader(inputStream, 0); + // 从第1行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列 + List> read = excelReader.read(0, excelReader.getRowCount()); + String produce_date = ""; + // 循环获取的数据 + for (int i = 1; i < read.size(); i++) { + List list = read.get(i); + if (ObjectUtil.isEmpty(list)) { + continue; + } + OrderDto orderDto = new OrderDto(); + for (int j = 0; j < list.size(); j++) { + if (j == 0) { + String produceorder_code = String.valueOf(list.get(j)); + orderDto.setProduceorder_code(produceorder_code); + } + if (j == 1) { + String material_code = String.valueOf(list.get(j)); + orderDto.setMaterial_code(material_code); + JSONObject jsonObject = wo_material.query("material_code = '" + material_code + "'").uniqueResult(0); + orderDto.setMaterial_spec(jsonObject.getString("material_spec")); + } + if (j == 2) { + Integer plan_qty = 0; + if (ObjectUtil.isNotEmpty(list.get(j))) { + plan_qty = Integer.parseInt(String.valueOf(list.get(j))); + } + orderDto.setPlan_qty(plan_qty); + } + if (j == 3) { + Integer real_qty = 0; + if (ObjectUtil.isNotEmpty(list.get(j))) { + real_qty = Integer.parseInt(String.valueOf(list.get(j))); + } + orderDto.setReal_qty(real_qty); + } + if (j == 4) { + String data = String.valueOf(list.get(j)); + orderDto.setDate(data); + } + } + WordOrderUtils.orderDtoList.add(orderDto); + } + } +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/WorkOrderImportEnum.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/WorkOrderImportEnum.java new file mode 100644 index 00000000..9cf0c26d --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/WorkOrderImportEnum.java @@ -0,0 +1,57 @@ +package org.nl.wms.mps.service; + +import cn.hutool.core.util.StrUtil; + +/** + * 工序类型枚举类 + * @author: geng by + * @createDate: 2022/12/8 + */ +public enum WorkOrderImportEnum { + JGXL(1, "01", "激光下料","1535143737330634752"), + XYXL(2, "02", "旋压下料","1535143882327724032"), + PGWXXL(3, "03", "盘管无屑下料","1535144117946945536"), + ZGWXXL(4, "04", "直管无屑下料","1535144223790206976"), + STLS(5, "05", "三通拉伸","1535144290030850048"), + TK(6, "06", "镗孔","1535144356586065920"), + TWYTJ(7, "07", "推弯一体机","1535144427977314304"), + CPQX(8, "08", "成品清洗","1535144552481034240"), + KZ(9, "09", "刻字","1535144682756116480"), + BZ(10, "10", "包装","1535144822984282112"), + MP(11, "11", "码盘","1535144873605337088"), + CC(12, "12", "仓储","1535144934791843840"); + + private int index; + private String code; + private String name; + private String id; + + public String getCode() { + return code; + } + + public String getName() { + return name; + } + + public String getId() { + return id; + } + + public static WorkOrderImportEnum getIdByName(String name){ + name = name.replace("",""); + for (WorkOrderImportEnum workOrderImportEnum : WorkOrderImportEnum.values()) { + if (StrUtil.equals(workOrderImportEnum.getName(), name)){ + return workOrderImportEnum; + } + } + return null; + } + + WorkOrderImportEnum(int index, String code, String name, String id) { + this.index = index; + this.id = id; + this.code = code; + this.name = name; + } +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/dto/ProduceshiftorderDto.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/dto/ProduceshiftorderDto.java index 6afed02f..3277d242 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/dto/ProduceshiftorderDto.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/dto/ProduceshiftorderDto.java @@ -107,4 +107,8 @@ public class ProduceshiftorderDto implements Serializable { private Long jockey_id; private Integer orderNum; + + private String is_error; + + private String error_info; } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/impl/ProduceshiftorderServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/impl/ProduceshiftorderServiceImpl.java index 1864947a..b6e86519 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/impl/ProduceshiftorderServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/service/impl/ProduceshiftorderServiceImpl.java @@ -25,6 +25,7 @@ import org.nl.utils.SecurityUtils; import org.nl.wms.basedata.master.service.ClassstandardService; import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.mps.service.ProduceshiftorderService; +import org.nl.wms.mps.service.WorkOrderImportEnum; import org.nl.wms.mps.service.dto.ProduceshiftorderDto; import org.nl.wql.WQL; import org.nl.wql.core.bean.WQLObject; @@ -37,6 +38,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import java.io.InputStream; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Set; @@ -68,6 +70,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { String shift_type_scode = MapUtil.getStr(whereJson, "shift_type_scode"); String parent_id = MapUtil.getStr(whereJson, "product_series"); String sale_id = MapUtil.getStr(whereJson, "sale_id"); + String is_error = MapUtil.getStr(whereJson, "is_error"); String product_series = ""; JSONObject map = new JSONObject(); map.put("flag", "1"); @@ -80,6 +83,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { order_status = order_status.replace("[\"", "").replace("\"]", "").replace("\"", ""); } map.put("order_status", order_status); + map.put("is_error", is_error); //处理状态为未完成 if (StrUtil.isNotEmpty(order_status) && order_status.contains("-1")) { map.put("unFinish", "-1"); @@ -541,13 +545,19 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { //人员表 //WQLObject wo_user = WQLObject.getWQLObject("sys_user"); - // 调用用 hutool 方法读取数据 默认调用第一个sheet - ExcelReader excelReader = ExcelUtil.getReader(inputStream); - // 从第二行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列 - List> read = excelReader.read(1, excelReader.getRowCount()); + // 调用用 hutool 方法读取数据 调用第一个sheet白班数据 + ExcelReader excelReader = ExcelUtil.getReader(inputStream, 0); + // 从第1行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列 + List> read = excelReader.read(0, excelReader.getRowCount()); + String produce_date = ""; // 循环获取的数据 + row: for (int i = 0; i < read.size(); i++) { - List list = read.get(i); + List list = read.get(i); + if (ObjectUtil.isEmpty(list)) { + continue; + } + //获取每列 JSONObject param = new JSONObject(); //按照列获取 param.put("produceorder_id", IdUtil.getSnowflake(1, 1).nextId()); @@ -555,98 +565,251 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { param.put("producedeviceorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER")); param.put("order_status", "00"); param.put("order_type_scode", "01"); - - //物料 - String material_code = list.get(12).toString(); - JSONObject json_material = wo_material.query("is_delete = '0' and material_code = '" + material_code + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(json_material)) { - throw new BadRequestException("第'" + (i + 2) + "'行,物料编码不存在"); - } - param.put("material_id", json_material.getString("material_id")); - - //工序 - String workprocedure_code = list.get(13).toString(); - JSONObject jsonWorkprocedure = wo_workprocedure.query("is_delete = '0' and workprocedure_code = '" + workprocedure_code + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonWorkprocedure)) { - throw new BadRequestException("第'" + (i + 2) + "'行,工序编码不存在"); - } - String workprocedure_id = jsonWorkprocedure.getString("workprocedure_id"); - param.put("workprocedure_id", workprocedure_id); - - //设备 - String device_code = list.get(14).toString(); - JSONObject json_device = wo_device.query("is_delete = '0' and device_code = '" + device_code + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(json_device)) { - throw new BadRequestException("第'" + (i + 2) + "'行,设备编码不存在"); - } - if (!workprocedure_id.equals(json_device.getString("workprocedure_id"))) { - throw new BadRequestException("第'" + (i + 2) + "'行,设备与所属工序不匹配"); - } - param.put("device_id", json_device.getString("device_id")); - - //单重 - param.put("material_weight", list.get(5).toString()); - param.put("plan_qty", list.get(7).toString()); - - //生产人员 - String username_code = list.get(15).toString(); - UserDto jsonUser = userService.findByName(username_code); - //JSONObject jsonUser = wo_user.query("is_delete = '0' and username = '" + username_code + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonUser)) { - throw new BadRequestException("第'" + (i + 2) + "'行,生产人员编码不存在"); - } - param.put("jockey_id", jsonUser.getId()); - - //生产日期 - String produce_date = list.get(16).toString(); - if (StrUtil.isEmpty(produce_date)) { - throw new BadRequestException("第'" + (i + 2) + "'行,生产日期不能为空"); - } param.put("produce_date", produce_date); + param.put("shift_type_scode", "01"); + String is_error = "0"; + String error_message = ""; + //循环每一行 + col: + for (int j = 0; j < list.size(); j++) { - //班次类型 - String shift_type_scode = list.get(17).toString(); - String type_scode = "01"; - if (shift_type_scode.equals("夜班")) { - type_scode = "02"; + String col = String.valueOf(list.get(j)); + //如果是第一行 为生产日期 + if (i == 0 && j == 0) { + produce_date = col.split(":")[col.split(":").length - 1]; + continue row; + } + //如果第一列包含规格二字 则为表头 结束内循环列 + if (j == 0 && col.contains("规格名称")) { + continue row; + } + if (j == 0) { + //物料 + if (StrUtil.isEmpty(col)) { + is_error = "1"; + error_message = error_message + "物料规格为空,"; + } + JSONObject json_material = wo_material.query("is_delete = '0' and material_spec = '" + col + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(json_material)) { + is_error = "1"; + error_message = error_message + "物料规格对应物料信息不存在,"; + }else { + param.put("material_id", json_material.getString("material_id")); + } + } + if (j == 2) { + if (StrUtil.isEmpty(col)) { + is_error = "1"; + error_message = error_message + "工序名称为空,"; + } + WorkOrderImportEnum idByName = WorkOrderImportEnum.getIdByName(col); + if (ObjectUtil.isEmpty(idByName)) { + is_error = "1"; + error_message = error_message + "工序名称是否正确,"; + }else { + param.put("workprocedure_id", idByName.getId()); + } + } + if (j == 4) { + //单重 + param.put("material_weight", col); + } + if (j == 6) { + if (StrUtil.isEmpty(col)) { + is_error = "1"; + error_message = error_message + "工单计划数量为空,"; + }else { + param.put("plan_qty", col); + } + } + if (j == 10) { + String workprocedure_id = param.getString("workprocedure_id"); + JSONObject json_device = wo_device.query("is_delete = '0' and device_code = '" + col + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(json_device)) { + is_error = "1"; + error_message = error_message + "设备编码不存在,"; + } + if (!workprocedure_id.equals(json_device.getString("workprocedure_id"))) { + is_error = "1"; + error_message = error_message + "设备与所属工序不匹配,"; + }else { + param.put("device_id", json_device.getString("device_id")); + } + } + if (j == 11) { + UserDto jsonUser = userService.findByName(col); + if (ObjectUtil.isEmpty(jsonUser)) { + is_error = "1"; + error_message = error_message + "生产人员编码不存在!"; + }else { + param.put("jockey_id", jsonUser.getId()); + } + } + if (j == 12) { + //允许修改报工数量 + String is_canupdate = "0"; + if (col.equals("是")) { + is_canupdate = "1"; + } + param.put("is_canupdate_update", is_canupdate); + } + if (j == 13) { + //是否agv搬运 + String needmoce = "0"; + if (col.equals("是")) { + needmoce = "1"; + } + param.put("is_needmove", needmoce); + } } - param.put("shift_type_scode", type_scode); - - //允许修改报工数量 - String is_canupdate_update = list.get(18).toString(); - String is_canupdate = "0"; - if (is_canupdate_update.equals("是")) { - is_canupdate = "1"; - } - param.put("is_canupdate_update", is_canupdate); - - //是否agv搬运 - String is_needmove = list.get(19).toString(); - String needmoce = "0"; - if (is_needmove.equals("是")) { - needmoce = "1"; - } - param.put("is_needmove", needmoce); - - String planproducestart_date = ""; - String planproduceend_date = ""; - if (type_scode.equals("01")) { - planproducestart_date = produce_date + " 07:30:00"; - planproduceend_date = produce_date + " 18:30:00"; - } else { - planproducestart_date = produce_date + " 18:30:00"; - DateTime dateTime = DateUtil.parse(produce_date, "yyyy-MM-dd"); - DateTime time = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1); - String format = DateUtil.format(time, "yyyy-MM-dd"); - planproduceend_date = format + " 07:30:00"; - } - param.put("planproducestart_date", planproducestart_date); - param.put("planproduceend_date", planproduceend_date); + param.put("is_error", is_error); + param.put("error_info", error_message); + param.put("planproducestart_date", produce_date + "07:30:00"); + param.put("planproduceend_date", produce_date + "18:30:00"); param.put("create_id", currentUserId); param.put("create_name", nickName); param.put("create_time", now); wo_order.insert(param); } + + // 1.获取上传文件输入流 + inputStream = null; + try { + inputStream = file.getInputStream(); + } catch (Exception e) { + e.printStackTrace(); + } + //读取夜班工单数据 + excelReader = ExcelUtil.getReader(inputStream, 1); + read = excelReader.read(0, excelReader.getRowCount()); + String is_error = "0"; + String error_message = ""; + // 循环获取的数据 + row: + for (int i = 0; i < read.size(); i++) { + List list = read.get(i); + //获取每列 + JSONObject param = new JSONObject(); + //按照列获取 + param.put("produceorder_id", IdUtil.getSnowflake(1, 1).nextId()); + param.put("produceorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER")); + param.put("producedeviceorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER")); + param.put("order_status", "00"); + param.put("order_type_scode", "01"); + param.put("produce_date", produce_date); + param.put("shift_type_scode", "02"); + //循环每一行 + col: + for (int j = 0; j < list.size(); j++) { + + String col = String.valueOf(list.get(j)); + //如果是第一行 为生产日期 + if (i == 0 && j == 0) { + produce_date = col.split(":")[col.split(":").length - 1]; + continue row; + } + //如果第一列包含规格二字 则为表头 结束内循环列 + if (j == 0 && col.contains("规格名称")) { + continue row; + } + if (j == 0) { + //物料 + if (StrUtil.isEmpty(col)) { + is_error = "1"; + error_message = error_message + "物料规格为空,"; + } + JSONObject json_material = wo_material.query("is_delete = '0' and material_spec = '" + col + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(json_material)) { + is_error = "1"; + error_message = error_message + "物料规格对应物料信息不存在,"; + }else { + param.put("material_id", json_material.getString("material_id")); + } + } + if (j == 2) { + if (StrUtil.isEmpty(col)) { + is_error = "1"; + error_message = error_message + "工序名称为空,"; + } + WorkOrderImportEnum idByName = WorkOrderImportEnum.getIdByName(col); + if (ObjectUtil.isEmpty(idByName)) { + is_error = "1"; + error_message = error_message + "工序名称是否正确,"; + }else { + param.put("workprocedure_id", idByName.getId()); + } + } + if (j == 4) { + //单重 + param.put("material_weight", col); + } + if (j == 6) { + if (StrUtil.isEmpty(col)) { + is_error = "1"; + error_message = error_message + "工单计划数量为空,"; + }else { + param.put("plan_qty", col); + } + } +// if (j == 10) { +// //物料 +// JSONObject json_material = wo_material.query("is_delete = '0' and material_code = '" + col + "'").uniqueResult(0); +// if (ObjectUtil.isEmpty(json_material)) { +// throw new BadRequestException("第'" + (i + 2) + "'行,物料编码不存在"); +// } +// param.put("material_id", json_material.getString("material_id")); +// } + if (j == 10) { + String workprocedure_id = param.getString("workprocedure_id"); + JSONObject json_device = wo_device.query("is_delete = '0' and device_code = '" + col + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(json_device)) { + is_error = "1"; + error_message = error_message + "设备编码不存在,"; + } + if (!workprocedure_id.equals(json_device.getString("workprocedure_id"))) { + is_error = "1"; + error_message = error_message + "设备与所属工序不匹配,"; + }else { + param.put("device_id", json_device.getString("device_id")); + } + } + if (j == 11) { + UserDto jsonUser = userService.findByName(col); + if (ObjectUtil.isEmpty(jsonUser)) { + is_error = "1"; + error_message = error_message + "生产人员编码不存在!"; + }else { + param.put("jockey_id", jsonUser.getId()); + } + } + if (j == 12) { + //允许修改报工数量 + String is_canupdate = "0"; + if (col.equals("是")) { + is_canupdate = "1"; + } + param.put("is_canupdate_update", is_canupdate); + } + if (j == 13) { + //是否agv搬运 + String needmoce = "0"; + if (col.equals("是")) { + needmoce = "1"; + } + param.put("is_needmove", needmoce); + } + } + param.put("is_error", is_error); + param.put("error_info", error_message); + param.put("planproducestart_date", produce_date + "18:30:00"); + DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(produce_date), 1); + param.put("planproduceend_date", DateUtil.format(dateTime,"yyyy-MM-dd") + " 07:30:00"); + param.put("create_id", currentUserId); + param.put("create_name", nickName); + param.put("create_time", now); + wo_order.insert(param); + } + } @Override diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/wql/MPS_PRODUCEDURE001.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/wql/MPS_PRODUCEDURE001.wql index 955d8e9e..4553e6b2 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/wql/MPS_PRODUCEDURE001.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/mps/wql/MPS_PRODUCEDURE001.wql @@ -25,6 +25,7 @@ 输入.end_time TYPEAS s_string 输入.produceorder_code TYPEAS s_string 输入.material TYPEAS s_string + 输入.is_error TYPEAS s_string 输入.product_series TYPEAS f_string 输入.workprocedure_ids TYPEAS f_string 输入.unFinish TYPEAS s_string @@ -89,6 +90,9 @@ OPTION 输入.shift_type_scode <> "" ShiftOrder.shift_type_scode = 输入.shift_type_scode ENDOPTION + OPTION 输入.is_error <> "" + ShiftOrder.is_error = 输入.is_error + ENDOPTION OPTION 输入.product_series <> "" material.product_series in 输入.product_series ENDOPTION diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls index ce79e1de..3cff23dc 100644 Binary files a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls and b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls differ diff --git a/mes/hd/nladmin-system/src/main/resources/config/application.yml b/mes/hd/nladmin-system/src/main/resources/config/application.yml index dcd1458c..13ba7d5e 100644 --- a/mes/hd/nladmin-system/src/main/resources/config/application.yml +++ b/mes/hd/nladmin-system/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: dev + active: prod jackson: time-zone: GMT+8 data: diff --git a/mes/qd/src/api/wms/bigScreen/bigScreen.js b/mes/qd/src/api/wms/bigScreen/bigScreen.js index 5c69791c..29f4e995 100644 --- a/mes/qd/src/api/wms/bigScreen/bigScreen.js +++ b/mes/qd/src/api/wms/bigScreen/bigScreen.js @@ -24,4 +24,36 @@ export function edit(data) { }) } -export default { add, edit, del } +export function switch_on_off(data) { + return request({ + url: 'api/bigTest/switchOnOff', + method: 'post', + data + }) +} + +export function edit_order(data) { + return request({ + url: 'api/bigTest/save', + method: 'post', + data + }) +} + +export function edit_device(data) { + return request({ + url: 'api/bigTest/saveDevice', + method: 'post', + data + }) +} + +export function excelImport(data) { + return request({ + url: 'api/bigTest/excelImport', + method: 'post', + data + }) +} + +export default { add, edit, del, switch_on_off, edit_order, excelImport, edit_device } diff --git a/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/DeviceInfoDialog.vue b/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/DeviceInfoDialog.vue new file mode 100644 index 00000000..a3614eb0 --- /dev/null +++ b/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/DeviceInfoDialog.vue @@ -0,0 +1,299 @@ + + + + + diff --git a/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/OrderInfoDialog.vue b/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/OrderInfoDialog.vue new file mode 100644 index 00000000..566a79da --- /dev/null +++ b/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/OrderInfoDialog.vue @@ -0,0 +1,603 @@ + + + + + diff --git a/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/UploadDialog1.vue b/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/UploadDialog1.vue new file mode 100644 index 00000000..5b9b1022 --- /dev/null +++ b/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/UploadDialog1.vue @@ -0,0 +1,116 @@ + + + + diff --git a/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/index.vue b/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/index.vue index e8542631..6ff69fab 100644 --- a/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/index.vue +++ b/mes/qd/src/views/wms/bigScreen/todayAndPlanNum/index.vue @@ -3,99 +3,112 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - + + + 切换虚拟 + + + 切换真实 + + + 编辑工单页面 + + + 编辑设备页面 + + + 导入虚拟工单 +
+ + +