From 57c109f4c962659e7a8f17ef4cd6b00a551e30ad Mon Sep 17 00:00:00 2001 From: zwl <1051256694@qq.com> Date: 星期一, 31 三月 2025 15:07:46 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/lfdasrs-sxkVersion' into lfdasrs-sxkVersion --- src/main/java/com/zy/asrs/domain/dto/WorkChartAxis.java | 31 + src/main/java/com/zy/asrs/domain/enums/SiteStatusType.java | 46 ++ src/main/java/com/zy/asrs/domain/vo/SiteDetailVo.java | 47 ++ src/main/java/com/zy/common/model/annotations/flag.java | 16 src/main/java/com/zy/asrs/domain/param/SystemSwitchParam.java | 30 + src/main/java/com/zy/asrs/mapper/ReportQueryMapper.java | 96 +--- src/main/java/com/zy/asrs/domain/vo/LocChartPie.java | 37 + src/main/java/com/zy/common/model/annotations/bit.java | 16 src/main/java/com/zy/asrs/domain/param/CrnDemoParam.java | 20 src/main/java/com/zy/asrs/controller/TVController.java | 278 +++++++++++++ src/main/java/com/zy/asrs/domain/enums/WorkNoType.java | 48 ++ src/main/java/com/zy/asrs/domain/vo/CrnLatestDataVo.java | 28 + src/main/java/com/zy/asrs/domain/enums/CrnStatusType.java | 53 ++ src/main/java/com/zy/asrs/domain/param/CrnOperatorParam.java | 38 + src/main/java/com/zy/asrs/domain/vo/CommandLogVo.java | 20 src/main/java/com/zy/asrs/domain/vo/PlcErrorTableVo.java | 20 src/main/java/com/zy/asrs/domain/vo/SiteLatestDataVo.java | 29 + src/main/java/com/zy/asrs/domain/vo/CrnDetailVo.java | 42 ++ src/main/java/com/zy/common/model/annotations/little.java | 14 src/main/java/com/zy/common/model/annotations/size.java | 16 src/main/java/com/zy/asrs/domain/vo/CrnStateTableVo.java | 65 +++ src/main/java/com/zy/asrs/domain/dto/AxisBean.java | 24 + src/main/java/com/zy/common/model/annotations/expr.java | 16 src/main/java/com/zy/asrs/domain/vo/ScaleDataVo.java | 18 src/main/java/com/zy/common/model/annotations/RateLimit.java | 15 src/main/java/com/zy/asrs/domain/vo/BarcodeDataVo.java | 18 src/main/java/com/zy/asrs/domain/vo/CrnMsgTableVo.java | 90 ++++ src/main/java/com/zy/asrs/domain/vo/SiteTableVo.java | 40 + 28 files changed, 1,148 insertions(+), 63 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/TVController.java b/src/main/java/com/zy/asrs/controller/TVController.java new file mode 100644 index 0000000..d61429f --- /dev/null +++ b/src/main/java/com/zy/asrs/controller/TVController.java @@ -0,0 +1,278 @@ +package com.zy.asrs.controller; + +import com.core.common.Arith; +import com.core.common.Cools; +import com.core.common.R; +import com.zy.asrs.domain.dto.AxisBean; +import com.zy.asrs.domain.dto.WorkChartAxis; +import com.zy.asrs.domain.vo.LocChartPie; +import com.zy.asrs.mapper.ReportQueryMapper; +import com.zy.common.model.annotations.RateLimit; +import com.zy.common.properties.SlaveProperties; +import com.zy.common.service.CommonService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * Created by vincent on 2020/11/16 + */ +@RestController +@RequestMapping("/monitor") +public class TVController { + + private static final String[] WEEK = {"鏄熸湡鏃�", "鏄熸湡涓�", "鏄熸湡浜�", "鏄熸湡涓�", "鏄熸湡鍥�", "鏄熸湡浜�", "鏄熸湡鍏�"}; + + @Autowired + private ReportQueryMapper reportQueryMapper; + @Autowired + private SlaveProperties slaveProperties; + + /** + * 鑾峰彇褰撳墠鏃堕棿 + */ + @GetMapping("/date") + public R monitorDate() { + Date now = new Date(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(now); + return R.ok( + Cools.add("year", calendar.get(Calendar.YEAR)) + .add("month", CommonService.zerofill(String.valueOf(calendar.get(Calendar.MONTH) + 1), 2)) + .add("day", CommonService.zerofill(String.valueOf(calendar.get(Calendar.DATE)), 2)) + .add("hour", CommonService.zerofill(String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)), 2)) + .add("minute", CommonService.zerofill(String.valueOf(calendar.get(Calendar.MINUTE)), 2)) + .add("second", CommonService.zerofill(String.valueOf(calendar.get(Calendar.SECOND)), 2)) + .add("week", WEEK[calendar.get(Calendar.DAY_OF_WEEK) - 1]) + ); + } + + /** + * 鑾峰彇鍏朵粬淇℃伅 + */ + @GetMapping("/other") + public R monitorOther(@RequestParam("crnId") Integer crnId, @RequestParam("ledId") Integer sta) { + return R.ok( + Cools.add("xSpeed", Arith.multiplys(1, 0, 1)) // 琛岃蛋閫熷害 + .add("ySpeed", Arith.multiplys(1, 60, 1)) // 鍗囬檷閫熷害 + .add("zSpeed", Arith.multiplys(1, 30, 1)) // 鍙夌墮閫熷害 + .add("forkPos", 25) // 鍙夌墮閫熷害 + .add("xDistance", Arith.multiplys(1, 0, 1)) // 绱璧拌璺濈km + .add("yDistance", Arith.multiplys(1, 5, 1)) // 绱鍗囬檷璺濈km + .add("xDuration", Arith.multiplys(1, 0, 1)) // 绱璧拌鏃堕暱h + .add("yDuration", Arith.multiplys(1, 2, 1)) // 绱鍗囬檷鏃堕暱h + .add("isShow", !Cools.isEmpty(1)) // 鏄惁鏄剧ず鍐呭 + .add("content", 1) // 鏄剧ず鍐呭 + ); + } + + /** + * 鍏ュ簱鎶ヨ〃 -- 鎶樼嚎鍥� + */ + @RateLimit(2) + @GetMapping("/pakin/rep") + public R monitorPakinRep() { + // 鍏ュ簱 + List<Map<String, Object>> pakinRep = reportQueryMapper.queryPakinRep(); + for (Map<String, Object> map : pakinRep) { + if (map.get("node") != null) { + map.put("node", String.valueOf(map.get("node")).substring(5, 10)); + } + } + // 鍑哄簱 + List<Map<String, Object>> pakoutRep = reportQueryMapper.queryPakinRep(); + return R.ok(pakinRep); + } + + @GetMapping("/line/charts") + public R locIoLineCharts() { + Map<String, Object> map = new HashMap<String, Object>(); + List<AxisBean> list = new ArrayList<AxisBean>(); + + List<WorkChartAxis> listChart = reportQueryMapper.getChartAxis(); + + if (listChart != null) { + ArrayList<Integer> data1 = new ArrayList<Integer>(); + ArrayList<Integer> data2 = new ArrayList<Integer>(); + + SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -12); + for (int i = 0; i < 12; i++) { + boolean flag = true; + calendar.add(Calendar.DATE, 1); + String str = sf.format(calendar.getTime()); + for (WorkChartAxis workChart : listChart) { + if (str.equals(workChart.getYmd())) { + data1.add(workChart.getInqty()); + data2.add(workChart.getOutqty()); + flag = false; + break; + } + } + if (flag) { + data1.add(0); + data2.add(0); + } + } + AxisBean inqty = new AxisBean(); + inqty.setName("鍏ュ簱鏁伴噺"); + Integer[] array1 = new Integer[data1.size()]; + inqty.setData(data1.toArray(array1)); + list.add(inqty); + AxisBean outqty = new AxisBean(); + outqty.setName("鍑哄簱鏁伴噺"); + Integer[] array2 = new Integer[data2.size()]; + outqty.setData(data2.toArray(array2)); + list.add(outqty); + } + map.put("rows", list); + return R.ok(map); + } + + + /** + * 搴撲綅浣跨敤鎯呭喌缁熻 + */ + @RateLimit(2) + @GetMapping("/loc/rep") + public R monitorLocRep() { + List<Map<String, Object>> pie = new ArrayList<>(); + + LocChartPie locUseRate = reportQueryMapper.getLocUseRate(); + if (locUseRate != null) { + Map<String, Object> map = new HashMap<>(); + map.put("name", "鍦ㄥ簱"); + map.put("value", locUseRate.getFqty()); + pie.add(map); + + Map<String, Object> map1 = new HashMap<>(); + map1.put("name", "绌�"); + map1.put("value", locUseRate.getOqty()); + pie.add(map1); + + Map<String, Object> map2 = new HashMap<>(); + map2.put("name", "浣跨敤"); + map2.put("value", locUseRate.getUqty()); + pie.add(map2); + + Map<String, Object> map3 = new HashMap<>(); + map3.put("name", "绂佺敤"); + map3.put("value", locUseRate.getXqty()); + pie.add(map3); + } + + // 鎬诲簱浣嶆暟 + Integer total = (int) Arith.add(0, locUseRate.getFqty(), locUseRate.getOqty(), locUseRate.getUqty(), locUseRate.getXqty()); + // 浣跨敤涓� + Integer used = locUseRate.getFqty() + locUseRate.getUqty(); + // 搴撲綅浣跨敤鐜� + double usedDivides = Arith.divides(3, used, total); + double usedPr = Arith.multiplys(1, usedDivides, 100); + + return R.ok( + Cools.add("pie", pie) + .add("stockCunt", locUseRate.getFqty()) + .add("emptyCount", locUseRate.getOqty()) + .add("noneCount", locUseRate.getXqty()) + .add("total", total) + .add("used", used) + .add("usedPr", usedPr) + ); + } + + /** + * 鑾峰彇鍏朵粬淇℃伅 + */ + @GetMapping("/led") + public R monitorLed(@RequestParam("ledId") Integer ledId) { + return R.ok(); + } + + /** + * 寮傚父閫氱煡 + */ + @GetMapping("/led/error") + public R monitorLedError(@RequestParam("ledId") Integer ledId) { + return R.ok(); + } + + + /** + * 鑷姩琛ラ浂 + */ + private List<Map<String, Object>> fill(List<Map<String, Object>> list, int start, int end) { + for (int i = start; i <= end; i++) { + boolean exist = false; + for (Map seq : list) { + if (Integer.parseInt(String.valueOf(seq.get("node"))) == i) { + exist = true; + } + } + if (!exist) { + HashMap<String, Object> map = new HashMap<>(); + map.put("node", i); + map.put("val", 0); + list.add(map); + } + } + list.sort(Comparator.comparingInt(o -> (int) o.get("node"))); + return list; + } + + /** + * x杞村崟浣嶈浆鎹� + * + * @param dot y杞存暟鍊间繚鐣欏皬鏁颁綅 + */ + private List<Map<String, Object>> convert(List<Map<String, Object>> list, StatsType statsType, int dot) { + for (Map<String, Object> map : list) { + Object val = map.get("val"); + map.put("val", Arith.multiplys(dot, 1, (Number) val)); + Object node = map.get("node"); + switch (statsType) { + case MONTH: + map.put("node", node + "鍙�"); + break; + case YEAR: + map.put("node", node + "鏈�"); + break; + default: + break; + } + } + return list; + } + + enum StatsType { + + YEAR(1, 1, 12), + MONTH(2, 1, 30), + ; + + int id; + int start; + int end; + + StatsType(int id, int start, int end) { + this.id = id; + this.start = start; + this.end = end; + } + static StatsType get(int id) { + StatsType[] values = StatsType.values(); + for (StatsType statsType : values) { + if (statsType.id == id) { + return statsType; + } + } + throw new RuntimeException("鎵句笉鍒癝tatsType绫诲瀷"); + } + + } +} diff --git a/src/main/java/com/zy/asrs/domain/dto/AxisBean.java b/src/main/java/com/zy/asrs/domain/dto/AxisBean.java new file mode 100644 index 0000000..4b86146 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/dto/AxisBean.java @@ -0,0 +1,24 @@ +package com.zy.asrs.domain.dto; + +/** + * 鏇茬嚎鍥捐〃json閿� + * @author admin + * + */ +public class AxisBean { + private String name; + private Integer[] data; + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer[] getData() { + return data; + } + public void setData(Integer[] data) { + this.data = data; + } + +} diff --git a/src/main/java/com/zy/asrs/domain/dto/WorkChartAxis.java b/src/main/java/com/zy/asrs/domain/dto/WorkChartAxis.java new file mode 100644 index 0000000..cbb46b7 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/dto/WorkChartAxis.java @@ -0,0 +1,31 @@ +package com.zy.asrs.domain.dto; + +/** + * 鍏ュ嚭搴撶粺璁℃洸绾垮浘 + * @author admin + * @date 2018骞�12鏈�12鏃� + */ +public class WorkChartAxis { + private String ymd; + private int inqty; + private int outqty; + + public String getYmd() { + return ymd; + } + public void setYmd(String ymd) { + this.ymd = ymd; + } + public int getInqty() { + return inqty; + } + public void setInqty(int inqty) { + this.inqty = inqty; + } + public int getOutqty() { + return outqty; + } + public void setOutqty(int outqty) { + this.outqty = outqty; + } +} \ No newline at end of file diff --git a/src/main/java/com/zy/asrs/domain/enums/CrnStatusType.java b/src/main/java/com/zy/asrs/domain/enums/CrnStatusType.java new file mode 100644 index 0000000..99b6d01 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/enums/CrnStatusType.java @@ -0,0 +1,53 @@ +package com.zy.asrs.domain.enums; + +/** + * 鍫嗗灈鏈虹姸鎬佹灇涓� + */ +public enum CrnStatusType { + + // 鍏ュ簱 + MACHINE_PAKIN("鍏ュ簱"), + // 鍑哄簱 + MACHINE_PAKOUT("鍑哄簱"), + // 搴撳埌搴� + MACHINE_STOCK_MOVE("搴撳埌搴�"), + // 绔欏埌绔� + MACHINE_SITE_MOVE("绔欏埌绔�"), + // p to p + MACHINE_P_MOVE("PToP"), + // 寮傚父 + MACHINE_ERROR("寮傚父"), + // 鑷姩 + MACHINE_AUTO("鑷姩"), + // 闈炶嚜鍔�/鎵嬪姩 + MACHINE_UN_AUTO("闈炶嚜鍔�"), + ; + + private String desc; + CrnStatusType(String desc){ + this.desc = desc; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static CrnStatusType process(Integer ioType){ + if (ioType>100) { + return MACHINE_PAKOUT; + } else if (ioType < 100 && ioType!=3 && ioType!=6 && ioType!=11) { + return MACHINE_PAKIN; + } else if (ioType == 3) { + return MACHINE_SITE_MOVE; + } else if (ioType == 11) { + return MACHINE_STOCK_MOVE; + } else { + return MACHINE_ERROR; + } + } + +} diff --git a/src/main/java/com/zy/asrs/domain/enums/SiteStatusType.java b/src/main/java/com/zy/asrs/domain/enums/SiteStatusType.java new file mode 100644 index 0000000..b3adb37 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/enums/SiteStatusType.java @@ -0,0 +1,46 @@ +package com.zy.asrs.domain.enums; + + +import com.zy.core.model.protocol.StaProtocol; + +/** + * 绔欑偣鐘舵�佹灇涓� + */ +public enum SiteStatusType { + + // 鑷姩 + SITE_AUTO, + // 闈炶嚜鍔� + SITE_UNAUTO, + // 鑷姩+鏈夌墿+ID + SITE_AUTO_RUN_ID, + // 鑷姩+鏈夌墿 + SITE_AUTO_RUN, + // 鑷姩+ID + SITE_AUTO_ID, + + ; + + public static SiteStatusType process(StaProtocol staProtocol){ + if (staProtocol == null) { + return null; + } + if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0) { + return SITE_AUTO_RUN_ID; + } + if (staProtocol.isAutoing() && staProtocol.isLoading()) { + return SITE_AUTO_RUN; + } + if (staProtocol.isAutoing() && staProtocol.getWorkNo() > 0) { + return SITE_AUTO_ID; + } + if (staProtocol.isAutoing()) { + return SITE_AUTO; + } + if (!staProtocol.isAutoing()) { + return SITE_UNAUTO; + } + return null; + } + +} diff --git a/src/main/java/com/zy/asrs/domain/enums/WorkNoType.java b/src/main/java/com/zy/asrs/domain/enums/WorkNoType.java new file mode 100644 index 0000000..4aa3911 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/enums/WorkNoType.java @@ -0,0 +1,48 @@ +package com.zy.asrs.domain.enums; + +import com.core.exception.CoolException; + +/** + * 宸ヤ綔鍙锋帓搴忚鍒� + */ +public enum WorkNoType { + + PAKIN(0), + PICK(1), + PAKOUT(2), + OTHER(3), + ; + + public Integer type; + + WorkNoType(Integer type) { + this.type = type; + } + + public static Integer getWorkNoType(Integer ioType) { + switch (ioType) { + case 1: + return PAKIN.type; + case 10: + return PAKIN.type; + case 11: + return PICK.type; + case 53: + case 54: + case 57: + return PICK.type; + case 101: + return PAKOUT.type; + case 103: + case 104: + case 107: + return PICK.type; + case 110: + return PAKOUT.type; + default: + break; + } + throw new CoolException(ioType + "鐨勪换鍔$被鍨嬫棤娉曠敓鎴愬伐浣滃彿"); + } + +} diff --git a/src/main/java/com/zy/asrs/domain/param/CrnDemoParam.java b/src/main/java/com/zy/asrs/domain/param/CrnDemoParam.java new file mode 100644 index 0000000..c724435 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/param/CrnDemoParam.java @@ -0,0 +1,20 @@ +package com.zy.asrs.domain.param; + +import lombok.Data; + +/** + * 鍫嗗灈鏈烘紨绀烘搷浣滃叆鍙� + * Created by vincent on 2020-06-03 + */ +@Data +public class CrnDemoParam { + + // 鎿嶄綔绫诲瀷 1: 鎵撳紑; 0: 鍏抽棴 + private Integer crnId; + + // 瀵嗙爜鍙d护 + private String password; + + private Boolean opt; + +} diff --git a/src/main/java/com/zy/asrs/domain/param/CrnOperatorParam.java b/src/main/java/com/zy/asrs/domain/param/CrnOperatorParam.java new file mode 100644 index 0000000..f85698e --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/param/CrnOperatorParam.java @@ -0,0 +1,38 @@ +package com.zy.asrs.domain.param; + +import lombok.Data; + +/** + * Created by vincent on 2020-06-02 + */ +@Data +public class CrnOperatorParam { + + // 鍫嗗灈鏈哄彿 + private Integer crnNo; + + // 婧愮珯 + private Short sourceStaNo; + + // 婧愬簱浣�-鎺� + private Short sourceRow; + + // 婧愬簱浣�-鍒� + private Short sourceBay; + + // 婧愬簱浣�-灞� + private Short sourceLev; + + // 鐩爣绔� + private Short staNo; + + // 鐩爣搴撲綅-鎺� + private Short row; + + // 鐩爣搴撲綅-鍒� + private Short bay; + + // 鐩爣搴撲綅-灞� + private Short lev; + +} diff --git a/src/main/java/com/zy/asrs/domain/param/SystemSwitchParam.java b/src/main/java/com/zy/asrs/domain/param/SystemSwitchParam.java new file mode 100644 index 0000000..02bec5a --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/param/SystemSwitchParam.java @@ -0,0 +1,30 @@ +package com.zy.asrs.domain.param; + +/** + * 绯荤粺杩愯鐘舵�佹搷浣滃叆鍙� + * Created by vincent on 2020-06-03 + */ +public class SystemSwitchParam { + + // 鎿嶄綔绫诲瀷 1: 鎵撳紑; 0: 鍏抽棴 + private Integer operatorType; + + // 瀵嗙爜鍙d护 + private String password; + + public Integer getOperatorType() { + return operatorType; + } + + public void setOperatorType(Integer operatorType) { + this.operatorType = operatorType; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/src/main/java/com/zy/asrs/domain/vo/BarcodeDataVo.java b/src/main/java/com/zy/asrs/domain/vo/BarcodeDataVo.java new file mode 100644 index 0000000..acfc261 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/BarcodeDataVo.java @@ -0,0 +1,18 @@ +package com.zy.asrs.domain.vo; + +import lombok.Data; + +/** + * 鎵爜鍣ㄥ疄鏃舵暟鎹鍥惧璞� + * Created by vincent on 2020-06-03 + */ +@Data +public class BarcodeDataVo { + + // 鎵爜鍣ㄧ紪鍙� + private Integer barcodeId; + + // 鎵爜鍣ㄥ唴瀹� + private String codeValue; + +} diff --git a/src/main/java/com/zy/asrs/domain/vo/CommandLogVo.java b/src/main/java/com/zy/asrs/domain/vo/CommandLogVo.java new file mode 100644 index 0000000..37fa9c0 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/CommandLogVo.java @@ -0,0 +1,20 @@ +package com.zy.asrs.domain.vo; + +import lombok.Data; + +/** + * Created by vincent on 2020-06-02 + */ +@Data +public class CommandLogVo { + + // 鍫嗗灈鏈虹紪鍙� + private Integer crnNo; + + // 鐘舵�� + private Integer status; + + // 鍛戒护鎶ユ枃 + private String command; + +} diff --git a/src/main/java/com/zy/asrs/domain/vo/CrnDetailVo.java b/src/main/java/com/zy/asrs/domain/vo/CrnDetailVo.java new file mode 100644 index 0000000..434cedc --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/CrnDetailVo.java @@ -0,0 +1,42 @@ +package com.zy.asrs.domain.vo; + +import lombok.Data; + +/** + * 鍫嗗灈鏈鸿鎯呰鍥惧璞� + * Created by vincent on 2020-06-03 + */ +@Data +public class CrnDetailVo { + + // 鍫嗗灈鏈哄彿 + private Integer crnNo; + + // 宸ヤ綔鍙� + private Short workNo; + + // 婧愮珯 + private String sourceStaNo = ""; + + // 鐩爣绔� + private String staNo = ""; + + // 宸ヤ綔鐘舵�� + private String wrkSts = ""; + + // 鍑哄叆绫诲瀷 + private String ioType = ""; + + // 婧愬簱浣� + private String sourceLocNo = ""; + + // 鐩爣搴撲綅 + private String locNo = ""; + + // 鍫嗗灈鏈虹姸鎬� + private String crnStatus = ""; + + // 寮傚父 + private String error = ""; + +} diff --git a/src/main/java/com/zy/asrs/domain/vo/CrnLatestDataVo.java b/src/main/java/com/zy/asrs/domain/vo/CrnLatestDataVo.java new file mode 100644 index 0000000..3200202 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/CrnLatestDataVo.java @@ -0,0 +1,28 @@ +package com.zy.asrs.domain.vo; + +import com.zy.asrs.domain.enums.CrnStatusType; +import lombok.Data; + +/** + * 鍫嗗灈鏈烘渶鏂版暟鎹鍥惧璞� + * Created by vincent on 2020-06-01 + */ +@Data +public class CrnLatestDataVo { + + // 鍫嗗灈鏈虹紪鍙� + private Integer crnId; + + // 鍋忕Щ閲� + private Double offset; + + // 褰撳墠鍒� + private Short bay; + + private CrnStatusType crnStatus; + + public String getCrnStatus(){ + return crnStatus.toString().toLowerCase().replaceAll("_", "-"); + } + +} diff --git a/src/main/java/com/zy/asrs/domain/vo/CrnMsgTableVo.java b/src/main/java/com/zy/asrs/domain/vo/CrnMsgTableVo.java new file mode 100644 index 0000000..ef124a3 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/CrnMsgTableVo.java @@ -0,0 +1,90 @@ +package com.zy.asrs.domain.vo; + +import com.zy.asrs.utils.Utils; +import lombok.Data; + +/** + * Created by vincent on 2020-06-02 + */ +@Data +public class CrnMsgTableVo { + + // 鍫嗗灈鏈哄彿 + private Integer crnNo; + + // 宸ヤ綔鍙� + private Short workNo = 0; + + // 鐘舵�� + private String status = "-"; + + // 婧愮珯 + private String sourceStaNo = "-"; + + // 鐩爣绔� + private String staNo = "-"; + + // 婧愬簱浣� + private String sourceLocNo = "-"; + + // 鐩爣搴撲綅 + private String locNo = "-"; + + // 寮傚父 + private String error = ""; + + // 鍘熺偣 + private String origin = ""; + + // 鍛戒护 + private String command = ""; + + // 璧拌閫熷害锛坢/min) + private Float xspeed = 0.0F; + + // 鍗囬檷閫熷害锛坢/min) + private Float yspeed = 0.0F; + + // 鍙夌墮閫熷害锛坢/min) + private Float zspeed = 0.0F; + + // 璧拌璺濈(Km) + private Float xdistance = 0.0F; + + // 鍗囬檷璺濈(Km) + private Float ydistance = 0.0F; + + // 璧拌鏃堕暱(H) + private Float xduration = 0.0F; + + // 鍗囬檷鏃堕暱(H) + private Float yduration = 0.0F; + + public void setXspeed(Float xspeed) { + this.xspeed = Utils.scale(xspeed); + } + + public void setYspeed(Float yspeed) { + this.yspeed = Utils.scale(yspeed); + } + + public void setZspeed(Float zspeed) { + this.zspeed = Utils.scale(zspeed); + } + + public void setXdistance(Float xdistance) { + this.xdistance = Utils.scale(xdistance); + } + + public void setYdistance(Float ydistance) { + this.ydistance = Utils.scale(ydistance); + } + + public void setXduration(Float xduration) { + this.xduration = Utils.scale(xduration); + } + + public void setYduration(Float yduration) { + this.yduration = Utils.scale(yduration); + } +} diff --git a/src/main/java/com/zy/asrs/domain/vo/CrnStateTableVo.java b/src/main/java/com/zy/asrs/domain/vo/CrnStateTableVo.java new file mode 100644 index 0000000..4e9f53a --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/CrnStateTableVo.java @@ -0,0 +1,65 @@ +package com.zy.asrs.domain.vo; + +import lombok.Data; + +/** + * Created by vincent on 2020-06-02 + */ +@Data +public class CrnStateTableVo { + + // 鍫嗗灈鏈哄彿 + private Integer crnNo; + + // 妯″紡 + private String statusType = "-"; + + // 鏈夌墿 + private String loading = "-"; + + // 鍒� + private Short bay; + + // 灞� + private Short lev; + + // 璧拌鍘熺偣 + private String xOrigin = "-"; + + // 鍗囬檷鍘熺偣 + private String yOrigin = "-"; + + // 璐у弶浣嶇疆 + private String forkOffset = "-"; + + // 杞借揣鍙颁綅缃� + private String liftPos = "-"; + + // 璧拌瀹氫綅 + private String walkPos = "-"; + + // 鎬ュ仠 + private String stop = "-"; + + // 鍒楀潗鏍� + private String bayCoor = "-"; + + // 灞傚潗鏍� + private String levCoor = "-"; + + // 瀹屾垚 + private String complete = "-"; + + // 浠诲姟鍙� + private Short workNo = 0; + + // 鐘舵�� + private String status = "-"; + + // 寮傚父鐮� + private String warnCode = "-"; + + // 鍨傜洿鏁呴殰鐮� + private String alarm = "-"; + +} diff --git a/src/main/java/com/zy/asrs/domain/vo/LocChartPie.java b/src/main/java/com/zy/asrs/domain/vo/LocChartPie.java new file mode 100644 index 0000000..1492d1b --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/LocChartPie.java @@ -0,0 +1,37 @@ +package com.zy.asrs.domain.vo; + +/** + * 搴撲綅鍗犵敤鐧惧垎姣� + * @author admin + * @date 2018骞�12鏈�12鏃� + */ +public class LocChartPie { + private int fqty; + private int oqty; + private int uqty; + private int xqty; + public int getFqty() { + return fqty; + } + public void setFqty(int fqty) { + this.fqty = fqty; + } + public int getOqty() { + return oqty; + } + public void setOqty(int oqty) { + this.oqty = oqty; + } + public int getUqty() { + return uqty; + } + public void setUqty(int uqty) { + this.uqty = uqty; + } + public int getXqty() { + return xqty; + } + public void setXqty(int xqty) { + this.xqty = xqty; + } +} \ No newline at end of file diff --git a/src/main/java/com/zy/asrs/domain/vo/PlcErrorTableVo.java b/src/main/java/com/zy/asrs/domain/vo/PlcErrorTableVo.java new file mode 100644 index 0000000..38fed7e --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/PlcErrorTableVo.java @@ -0,0 +1,20 @@ +package com.zy.asrs.domain.vo; + +import lombok.Data; + +/** + * Created by vincent on 2020-06-02 + */ +@Data +public class PlcErrorTableVo { + + // 搴忓彿 + private Integer no; + + // plc寮傚父鎻忚堪 + private String plcDesc; + + // 寮傚父 + private String error; + +} diff --git a/src/main/java/com/zy/asrs/domain/vo/ScaleDataVo.java b/src/main/java/com/zy/asrs/domain/vo/ScaleDataVo.java new file mode 100644 index 0000000..1b1aefb --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/ScaleDataVo.java @@ -0,0 +1,18 @@ +package com.zy.asrs.domain.vo; + +import lombok.Data; + +/** + * 纾呯Г瀹炴椂鏁版嵁瑙嗗浘瀵硅薄 + * Created by vincent on 2020-06-03 + */ +@Data +public class ScaleDataVo { + + // 纾呯Г缂栧彿 + private Integer scaleId; + + // 纾呯Г鍐呭 + private String value; + +} diff --git a/src/main/java/com/zy/asrs/domain/vo/SiteDetailVo.java b/src/main/java/com/zy/asrs/domain/vo/SiteDetailVo.java new file mode 100644 index 0000000..7cdcf91 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/SiteDetailVo.java @@ -0,0 +1,47 @@ +package com.zy.asrs.domain.vo; + +import lombok.Data; + +/** + * 杈撻�佽澶囪鎯呰鍥惧璞� + * Created by vincent on 2020-06-03 + */ +@Data +public class SiteDetailVo { + + // 绔欑偣缂栧彿 + private Integer siteId; + + // 宸ヤ綔鍙� + private Short workNo; + + // 宸ヤ綔鐘舵�� + private String wrkSts = ""; + + // 鑷姩 + private String autoing; + + // 鏈夌墿 + private String loading; + + // 鑳藉叆 + private String canining; + + // 鑳藉嚭 + private String canouting; + + // 鍑哄叆绫诲瀷 + private String ioType = ""; + + // 婧愮珯 + private String sourceStaNo = ""; + + // 鐩爣绔� + private String staNo = ""; + + // 婧愬簱浣� + private String sourceLocNo = ""; + + // 鐩爣搴撲綅 + private String locNo = ""; +} diff --git a/src/main/java/com/zy/asrs/domain/vo/SiteLatestDataVo.java b/src/main/java/com/zy/asrs/domain/vo/SiteLatestDataVo.java new file mode 100644 index 0000000..2677861 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/SiteLatestDataVo.java @@ -0,0 +1,29 @@ +package com.zy.asrs.domain.vo; + +import com.zy.asrs.domain.enums.SiteStatusType; +import lombok.Data; + +/** + * 绔欑偣鏈�鏂版暟鎹鍥惧璞� + * Created by vincent on 2020-06-01 + */ +@Data +public class SiteLatestDataVo { + + // 绔欑偣缂栧彿 + private String siteId; + + // 宸ヤ綔鍙� + private Short workNo; + + // 绔欑偣鐘舵�� + private SiteStatusType siteStatus; + + // 闅斿绔欑偣锛堝彴杞︾壒鎬э級 + private String nearbySta; + + public String getSiteStatus() { + return siteStatus.toString().toLowerCase().replaceAll("_", "-"); + } + +} diff --git a/src/main/java/com/zy/asrs/domain/vo/SiteTableVo.java b/src/main/java/com/zy/asrs/domain/vo/SiteTableVo.java new file mode 100644 index 0000000..42b7bc9 --- /dev/null +++ b/src/main/java/com/zy/asrs/domain/vo/SiteTableVo.java @@ -0,0 +1,40 @@ +package com.zy.asrs.domain.vo; + +import lombok.Data; + +/** + * Created by vincent on 2020-06-02 + */ +@Data +public class SiteTableVo { + + // 绔欏彿 + private Integer devNo; + + // 宸ヤ綔鍙� + private Short workNo = 0; + + // 鑷姩 + private String autoing = "-"; + + // 鏈夌墿 + private String loading = "-"; + + // 鍙叆 + private String inEnable = "-"; + + // 鍙嚭 + private String outEnable = "-"; + + // 闇�姹�1 + private String pakMk = "-"; + + // 绌烘澘淇″彿 + private String emptyMk = "-"; + + // 鐩爣绔� + private Short staNo = 0; + + //楂樹綆搴撲綅 + private String locType1 = "-"; +} diff --git a/src/main/java/com/zy/asrs/mapper/ReportQueryMapper.java b/src/main/java/com/zy/asrs/mapper/ReportQueryMapper.java index 6a804db..bd14d54 100644 --- a/src/main/java/com/zy/asrs/mapper/ReportQueryMapper.java +++ b/src/main/java/com/zy/asrs/mapper/ReportQueryMapper.java @@ -1,83 +1,53 @@ package com.zy.asrs.mapper; -import com.zy.asrs.entity.*; +import com.zy.asrs.domain.dto.WorkChartAxis; +import com.zy.asrs.domain.vo.LocChartPie; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.util.List; +import java.util.Map; @Mapper @Repository public interface ReportQueryMapper { - - //鍒嗛〉鏌ヨ搴撲綅浣跨敤鐜� - List<ViewStockUseBean> queryViewStockUseList(ViewStockUseBean viewStockUse); - int getViewStockUseCount(ViewStockUseBean viewStockUse); - List<ViewStockUseBean> getViewStockUseAll(ViewStockUseBean viewStockUse); - - //鍒嗛〉鏌ヨ搴撳瓨婊炵暀鏃堕棿 - public List<ViewStayTimeBean> queryViewStayTimeList(ViewStayTimeBean viewStayTime); - public int getViewStayTimeCount(ViewStayTimeBean viewStayTime); - //涓嶅垎椤垫煡璇㈡墍鏈変俊鎭紝鐢ㄤ簬excel瀵煎嚭 - public List<ViewStayTimeBean> getViewStayTimeAll(ViewStayTimeBean viewStayTime); - -// // 搴撲綅Map - @Select("select distinct row1 from asr_loc_mast order by row1 asc") - List<Integer> getViewLocRowTotal(); - - @Select("select distinct lev1 from asr_loc_mast where row1=#{row1} order by lev1 desc") - public List<String> getViewLocLevCount(@Param("row1") int row1); -// - @Select("select loc_no as locNo, bay1,loc_sts as locSts from asr_loc_mast where row1=#{row1} and lev1=#{lev1} order by bay1") - public List<ViewLocMapDto> getViewLocBays(@Param("row1") int row1, @Param("lev1") int lev1); - - // 搴撲綅Map - @Select("select distinct bay1 from asr_loc_mast where row1=#{row1} order by bay1") - public List<String> getViewLocBayCount(@Param("row1") int row1); - - @Select("select lev1,loc_sts as locSts from asr_loc_mast where row1=#{row1} and bay1=#{bay1} order by bay1") - public List<ViewLocMapDto> getViewLocLevs(@Param("row1") int row1, @Param("bay1") int bay1); - //鍒嗛〉鏌ヨ绔欑偣鍏ュ嚭搴撴鏁扮粺璁� - public List<ViewInOutBean> queryViewInOutList(ViewInOutBean viewInOut); - public int getViewInOutCount(ViewInOutBean viewInOut); - //涓嶅垎椤垫煡璇㈡墍鏈変俊鎭紝鐢ㄤ簬excel瀵煎嚭 - public List<ViewInOutBean> getViewInOutAll(ViewInOutBean viewInOut); + @Select("select \n" + + "Min(wm.io_time) as node,\n" + + "isnull(count(1), 0) as val\n" + + "from asr_wrk_mast_log wm\n" + + "where wm.wrk_sts = 5 \n" + + "and (wm.io_type = 1 OR wm.io_type = 54)\n" + + "and datediff(d, wm.io_time, getdate())<=7 \n" + + "group by datediff(day,wm.io_time,getdate())\n" + + "order by Min(wm.io_time) asc\n") + List<Map<String, Object>> queryPakinRep(); - //鍒嗛〉鏌ヨ鏃ュ叆搴撹褰� - public List<ViewWorkInBean> queryViewWorkInList(ViewWorkInBean viewWorkIn); - public int getViewWorkInCount(ViewWorkInBean viewWorkIn); - //涓嶅垎椤垫煡璇㈡墍鏈変俊鎭紝鐢ㄤ簬excel瀵煎嚭 - public List<ViewWorkInBean> getViewWorkInAll(ViewWorkInBean viewWorkIn); + @Select("select\n" + + "Min(wm.io_time) as node,\n" + + "isnull(count(1), 0) as val\n" + + "from asr_wrk_mast_log wm\n" + + "where 1=1\n" + + "and ((wm.wrk_sts = 15 AND wm.io_type = 101) OR (wm.wrk_sts = 14 AND wm.io_type = 103))\n" + + "and datediff(d, wm.io_time, getdate())<=7\n" + + "group by datediff(day,wm.io_time,getdate())\n" + + "order by Min(wm.io_time) asc") + List<Map<String, Object>> queryPakOutRep(); - //鍒嗛〉鏌ヨ鏃ュ嚭搴撹褰� - public List<ViewWorkInBean> queryViewWorkOutList(ViewWorkInBean viewWorkOut); - public int getViewWorkOutCount(ViewWorkInBean viewWorkOut); - //涓嶅垎椤垫煡璇㈡墍鏈変俊鎭紝鐢ㄤ簬excel瀵煎嚭 - public List<ViewWorkInBean> getViewWorkOutAll(ViewWorkInBean viewWorkOut); + //鏇茬嚎鍥� + @Select("select ymd,SUM(sto_qty) inqty,SUM(ret_qty) outqty from asr_sta_inout_view " + + "where ymd>CONVERT(char(10), DATEADD(DAY,-12,GETDATE()), 120) group by ymd order by ymd") + public List<WorkChartAxis> getChartAxis(); + @Select("select * from asr_loc_use_view") + LocChartPie getLocUseRate(); - // ------鍥捐〃 - //楗肩姸鍥� - @Select("select * from asr_loc_use_view") - public LocChartPie getLocUseRate(); - //鏇茬嚎鍥� - @Select("select ymd,SUM(sto_qty) inqty,SUM(ret_qty) outqty from asr_sta_inout_view " - + "where ymd>CONVERT(char(10), DATEADD(DAY,-12,GETDATE()), 120) group by ymd order by ymd") - public List<WorkChartAxis> getChartAxis(); + @Select("select count(1) as totalWrk from asr_wrk_mast_log where crn_no = #{crnNo}") + Integer getTotalWrkByCrnId(Integer crnNo); - List<ViewWorkCountInView> selectWorkCountIn(@Param("curr") Integer curr, @Param("limit") Integer limit, @Param("matnr")String matnr, @Param("start") String startTime, @Param("end") String endTime); + @Select("select count(1) as totalLoc from asr_loc_mast") + Integer getTotalLocByCrnId(); - Integer selectWorkCountInTotal(String matnr, @Param("start") String startTime, @Param("end") String endTime); - - List<ViewWorkCountInView> selectWorkCountOut(@Param("curr") Integer pageNumber, @Param("limit") Integer pageSize, String matnr, @Param("start") String startTime, @Param("end") String endTime); - - Integer selectWorkCountOutTotal(String matnr, @Param("start") String startTime, @Param("end") String endTime); - - Integer selectWorkCountInSum(String matnr, @Param("start") String startTime, @Param("end") String endTime); - - Integer selectWorkCountOutSum(String matnr, @Param("start") String startTime, @Param("end") String endTime); } diff --git a/src/main/java/com/zy/common/model/annotations/RateLimit.java b/src/main/java/com/zy/common/model/annotations/RateLimit.java new file mode 100644 index 0000000..c04b5ff --- /dev/null +++ b/src/main/java/com/zy/common/model/annotations/RateLimit.java @@ -0,0 +1,15 @@ +package com.zy.common.model.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +//鎺ュ彛棰戠巼闄愬埗 +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface RateLimit { + + int value();//鎺ュ彛棰戠巼 + +} diff --git a/src/main/java/com/zy/common/model/annotations/bit.java b/src/main/java/com/zy/common/model/annotations/bit.java new file mode 100644 index 0000000..b8452db --- /dev/null +++ b/src/main/java/com/zy/common/model/annotations/bit.java @@ -0,0 +1,16 @@ +package com.zy.common.model.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 鏍囪瘑娉ㄨВ绫� + * @author vincent + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD}) +public @interface bit { + int value(); +} diff --git a/src/main/java/com/zy/common/model/annotations/expr.java b/src/main/java/com/zy/common/model/annotations/expr.java new file mode 100644 index 0000000..06e4da7 --- /dev/null +++ b/src/main/java/com/zy/common/model/annotations/expr.java @@ -0,0 +1,16 @@ +package com.zy.common.model.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 鏍囪瘑娉ㄨВ绫� + * @author vincent + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD}) +public @interface expr { + String value(); +} diff --git a/src/main/java/com/zy/common/model/annotations/flag.java b/src/main/java/com/zy/common/model/annotations/flag.java new file mode 100644 index 0000000..03fc98a --- /dev/null +++ b/src/main/java/com/zy/common/model/annotations/flag.java @@ -0,0 +1,16 @@ +package com.zy.common.model.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 鏍囪瘑娉ㄨВ绫� + * @author vincent + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD}) +public @interface flag { + String value(); +} diff --git a/src/main/java/com/zy/common/model/annotations/little.java b/src/main/java/com/zy/common/model/annotations/little.java new file mode 100644 index 0000000..9bbc47f --- /dev/null +++ b/src/main/java/com/zy/common/model/annotations/little.java @@ -0,0 +1,14 @@ +package com.zy.common.model.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 灏忕妯″紡娉ㄨВ绫� + * @author vincent + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD}) +public @interface little {} \ No newline at end of file diff --git a/src/main/java/com/zy/common/model/annotations/size.java b/src/main/java/com/zy/common/model/annotations/size.java new file mode 100644 index 0000000..1b84242 --- /dev/null +++ b/src/main/java/com/zy/common/model/annotations/size.java @@ -0,0 +1,16 @@ +package com.zy.common.model.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 鏍囪瘑娉ㄨВ绫� + * @author vincent + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD}) +public @interface size { + int value(); +} -- Gitblit v1.9.1