From 0823adb64bcb21d38ba022888ea8f2a0dc1a8541 Mon Sep 17 00:00:00 2001 From: 野心家 <1051256694@qq.com> Date: 星期一, 31 三月 2025 14:31:45 +0800 Subject: [PATCH] wcs电视机代码移植 --- src/main/java/com/zy/common/model/enums/model/MobileLocDetlVo.java | 47 + src/main/java/com/zy/common/model/enums/model/MesPakoutParam.java | 71 ++ src/main/java/com/zy/common/model/enums/model/MesPakinParam.java | 43 + src/main/java/com/zy/common/model/enums/model/LocDetlDto.java | 37 + src/main/java/com/zy/common/model/enums/model/DetlDto.java | 88 +++ src/main/java/com/zy/common/model/enums/model/UploadBill.java | 32 + src/main/java/com/zy/common/model/enums/model/enums/HtmlNavIconType.java | 51 + src/main/java/com/zy/common/model/enums/model/enums/IoWorkType.java | 12 src/main/java/com/zy/common/model/enums/model/LocDto.java | 72 ++ src/main/java/com/zy/common/model/enums/model/OutLocDto.java | 65 ++ src/main/java/com/zy/common/model/enums/model/LocTypeDto.java | 40 + src/main/java/com/zy/common/model/enums/model/StartupDto.java | 21 src/main/java/com/zy/common/model/enums/model/enums/WorkNoType.java | 48 + src/main/java/com/zy/common/model/enums/model/WrkDto.java | 26 + src/main/java/com/zy/common/model/enums/model/BillDto.java | 15 src/main/java/com/zy/common/model/enums/model/enums/SysOsType.java | 49 + src/main/java/com/zy/common/model/enums/model/MesCombParam.java | 50 + src/main/java/com/zy/asrs/controller/TVController.java | 361 +++++++++++++ src/main/java/com/zy/common/model/enums/model/PageParam.java | 33 + src/main/java/com/zy/common/model/enums/model/PowerDto.java | 29 + src/main/java/com/zy/common/model/enums/model/ErpUpload.java | 19 src/main/java/com/zy/common/model/enums/model/Shelves.java | 129 ++++ src/main/java/com/zy/common/model/enums/model/MatnrDto.java | 15 src/main/java/com/zy/common/model/enums/model/KeyValueVo.java | 16 src/main/java/com/zy/common/model/enums/model/TaskDto.java | 124 ++++ src/main/java/com/zy/common/model/enums/model/UploadBillDetail.java | 24 26 files changed, 1,517 insertions(+), 0 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..d2f89b4 --- /dev/null +++ b/src/main/java/com/zy/asrs/controller/TVController.java @@ -0,0 +1,361 @@ +package com.zy.asrs.controller; + +import com.core.common.Arith; +import com.core.common.Cools; +import com.core.common.R; +import com.zy.asrs.mapper.ReportQueryMapper; +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.*; + +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.service.CommonService; +import com.zy.core.CrnThread; +import com.zy.core.cache.SlaveConnection; +import com.zy.core.enums.SlaveType; +import com.zy.core.model.LedSlave; +import com.zy.core.model.command.LedCommand; +import com.zy.core.model.protocol.CrnProtocol; +import com.zy.core.properties.SlaveProperties; +import com.zy.core.thread.LedThread; +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; + + /** + * 鑾峰彇褰撳墠鏃堕棿 + */ + @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", 30) // 鍙夌墮閫熷害 + .add("xDistance", Arith.multiplys(1, 0, 1)) // 绱璧拌璺濈km + .add("yDistance", Arith.multiplys(1, 3, 1)) // 绱鍗囬檷璺濈km + .add("xDuration", Arith.multiplys(1, 0, 1)) // 绱璧拌鏃堕暱h + .add("yDuration", Arith.multiplys(1, 1, 1)) // 绱鍗囬檷鏃堕暱h + .add("isShow", !Cools.isEmpty(200)) // 鏄惁鏄剧ず鍐呭 + .add("content", 200) // 鏄剧ず鍐呭 + ); + } + + /** + * 鍏ュ簱鎶ヨ〃 -- 鎶樼嚎鍥� + */ + @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) { + String ledContent = ""; + List<LedCommand> commandList = null; + for (LedSlave slave : slaveProperties.getLed()) { + if (slave.getStaArr().contains(ledId)) { + LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId()); + if (null != ledThread) { + ledContent = ledThread.getStringBuffer().toString(); + commandList = ledThread.getCommandList(); + } + } + } + return R.ok().add(commandList); + } + + /** + * 寮傚父閫氱煡 + */ + @GetMapping("/led/error") + public R monitorLedError(@RequestParam("ledId") Integer ledId) { + String errorMsg = ""; + for (LedSlave slave : slaveProperties.getLed()) { + if (slave.getStaArr().contains(ledId)) { + LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId()); + if (null != ledThread) { + errorMsg = ledThread.getErrorMsg().toString(); + } + } + } + return R.ok().add(errorMsg); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /** + * 鑷姩琛ラ浂 + */ + 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/common/model/enums/model/BillDto.java b/src/main/java/com/zy/common/model/enums/model/BillDto.java new file mode 100644 index 0000000..1faeb8b --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/BillDto.java @@ -0,0 +1,15 @@ +package com.zy.common.model.enums.model; + +import lombok.Data; + +/** + * Created by vincent on 2021/3/23 + */ +@Data +public class BillDto { + + private String matnr; + + private Double qty; + +} diff --git a/src/main/java/com/zy/common/model/enums/model/DetlDto.java b/src/main/java/com/zy/common/model/enums/model/DetlDto.java new file mode 100644 index 0000000..c902ba4 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/DetlDto.java @@ -0,0 +1,88 @@ +package com.zy.common.model.enums.model; + +import com.core.common.Cools; +import com.zy.asrs.entity.OrderDetl; +import lombok.Data; + +import java.util.List; +import java.util.Set; + +/** + * Created by vincent on 2022/3/25 + */ +@Data +public class DetlDto { + + private String orderNo; + + private String matnr; + + private String batch; + + private Double anfme; + + public DetlDto() { + } + + public DetlDto(String matnr, Double anfme) { + this.matnr = matnr; + this.anfme = anfme; + } + + public DetlDto(String matnr, String batch) { + this.matnr = matnr; + this.batch = batch; + } + + public DetlDto(String matnr, String batch, Double anfme) { + this.matnr = matnr; + this.batch = batch; + this.anfme = anfme; + } + + public DetlDto(String orderNo, String matnr, String batch, Double anfme) { + this.orderNo = orderNo; + this.matnr = matnr; + this.batch = batch; + this.anfme = anfme; + } + + public static boolean hasList(Set<DetlDto> detlDtos, OrderDetl orderDetl) { + for (DetlDto dto : detlDtos) { + if (Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(orderDetl.getBatch())) { + if (dto.getMatnr().equals(orderDetl.getMatnr())) { + return true; + } + } else { + if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(orderDetl.getBatch())) { + if (dto.getMatnr().equals(orderDetl.getMatnr()) && dto.getBatch().equals(orderDetl.getBatch())) { + return true; + } + } + } + } + return false; + } + + public static boolean has(List<DetlDto> detlDtos, DetlDto detlDto) { + for (DetlDto dto : detlDtos) { + if (dto.getMatnr().equals(detlDto.getMatnr()) && Cools.eq(dto.getBatch(), detlDto.getBatch())) { + return true; + } + } + return false; + } + + public static DetlDto find(List<DetlDto> detlDtos, String matnr, String batch) { + if (Cools.isEmpty(matnr)) { + return null; + } + for (DetlDto detlDto : detlDtos) { + if (matnr.equals(detlDto.getMatnr()) && Cools.eq(batch, detlDto.getBatch())) { + return detlDto; + } + } + return null; + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/ErpUpload.java b/src/main/java/com/zy/common/model/enums/model/ErpUpload.java new file mode 100644 index 0000000..a2fbaff --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/ErpUpload.java @@ -0,0 +1,19 @@ +package com.zy.common.model.enums.model; + +import lombok.Data; + +import java.util.List; + +/** + * Created by vincent on 2021/6/18 + */ +@Data +public class ErpUpload { + + private List<BillDto> dtos; + + private Integer docId; + + private String docNumber; + +} diff --git a/src/main/java/com/zy/common/model/enums/model/KeyValueVo.java b/src/main/java/com/zy/common/model/enums/model/KeyValueVo.java new file mode 100644 index 0000000..6d9a106 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/KeyValueVo.java @@ -0,0 +1,16 @@ +package com.zy.common.model.enums.model; + +import lombok.Data; + +/** + * Created by vincent on 2022/3/23 + */ +@Data +public class KeyValueVo { + + private String name; + + private String value; + + +} diff --git a/src/main/java/com/zy/common/model/enums/model/LocDetlDto.java b/src/main/java/com/zy/common/model/enums/model/LocDetlDto.java new file mode 100644 index 0000000..9e37e0b --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/LocDetlDto.java @@ -0,0 +1,37 @@ +package com.zy.common.model.enums.model; + +import com.zy.asrs.entity.LocDetl; + +/** + * Created by vincent on 2020/6/17 + */ +public class LocDetlDto { + + private LocDetl locDetl; + + private Double count; + + public LocDetlDto() { + } + + public LocDetlDto(LocDetl locDetl, Double count) { + this.locDetl = locDetl; + this.count = count; + } + + public LocDetl getLocDetl() { + return locDetl; + } + + public void setLocDetl(LocDetl locDetl) { + this.locDetl = locDetl; + } + + public Double getCount() { + return count; + } + + public void setCount(Double count) { + this.count = count; + } +} diff --git a/src/main/java/com/zy/common/model/enums/model/LocDto.java b/src/main/java/com/zy/common/model/enums/model/LocDto.java new file mode 100644 index 0000000..3bcd30a --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/LocDto.java @@ -0,0 +1,72 @@ +package com.zy.common.model.enums.model; + +import com.core.common.Cools; +import lombok.Data; + +import java.util.List; + +/** + * Created by vincent on 2022/3/28 + */ +@Data +public class LocDto { + + private String locNo; + + private String matnr; + + private String maktx; + + private String batch; + + private String orderNo; + + private Double anfme; + + private boolean lack = false; + + //鐩爣绔欑偣 + private List<Integer> staNos; + + private Integer staNo; + + + public LocDto() { + } + + public LocDto(String locNo, String matnr, String batch, Double anfme) { + this.locNo = locNo; + this.matnr = matnr; + this.batch = batch; + this.anfme = anfme; + } + + public LocDto(String locNo, String matnr, String batch, String orderNo, Double anfme) { + this.locNo = locNo; + this.matnr = matnr; + this.batch = batch; + this.orderNo = orderNo; + this.anfme = anfme; + } + + public LocDto(String locNo, String matnr, String maktx, String batch, String orderNo, Double anfme) { + this.locNo = locNo; + this.matnr = matnr; + this.maktx = maktx; + this.batch = batch; + this.orderNo = orderNo; + this.anfme = anfme; + } + + public String getTitle() { + return this.matnr + "锛�" + this.maktx + "锛�"; + } + + public void setStaNos(List<Integer> staNos) { + this.staNos = staNos; + if (!Cools.isEmpty(staNos)) { + this.staNo = staNos.get(0); + } + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/LocTypeDto.java b/src/main/java/com/zy/common/model/enums/model/LocTypeDto.java new file mode 100644 index 0000000..5f44b09 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/LocTypeDto.java @@ -0,0 +1,40 @@ +package com.zy.common.model.enums.model; + +import com.alibaba.fastjson.JSON; +import com.core.exception.CoolException; +import com.zy.asrs.entity.BasDevp; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; + +/** + * Created by vincent on 2020/10/19 + */ +@Slf4j +@Data +public class LocTypeDto { + + // 楂樹綆绫诲瀷{0:鏈煡,1:浣庡簱浣�,2:楂樺簱浣峿 + private Short locType1; + + // 瀹界獎绫诲瀷{0:鏈煡,1:绐勫簱浣�,2:瀹藉簱浣峿 + private Short locType2; + + // 杞婚噸绫诲瀷{0:鏈煡,1:杞诲簱浣�,2:閲嶅簱浣峿 + private Short locType3; + + public LocTypeDto() { + } + + public LocTypeDto(BasDevp basDevp) { + if (basDevp.getLocType1() == null || basDevp.getLocType1() == 0) { + throw new CoolException("plc楂樹綆妫�娴嬪紓甯�"); + } + if (basDevp.getLocType1() == 1) { + this.locType1 = 1; // 浣庡簱浣� + } else { + this.locType1 = 2; // 楂樺簱浣� + } + log.info(JSON.toJSONString(this)); + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/MatnrDto.java b/src/main/java/com/zy/common/model/enums/model/MatnrDto.java new file mode 100644 index 0000000..481fb72 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/MatnrDto.java @@ -0,0 +1,15 @@ +package com.zy.common.model.enums.model; + +import lombok.Data; + +/** + * Created by vincent on 2021/3/31 + */ +@Data +public class MatnrDto { + + private String matnr; + + private Double count; + +} diff --git a/src/main/java/com/zy/common/model/enums/model/MesCombParam.java b/src/main/java/com/zy/common/model/enums/model/MesCombParam.java new file mode 100644 index 0000000..849a5c1 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/MesCombParam.java @@ -0,0 +1,50 @@ +package com.zy.common.model.enums.model; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by vincent on 2022/4/21 + */ +@Data +public class MesCombParam { + + // 鎵樼洏鏉$爜 + private String zpallet; + + // 甯墭鏃堕棿 + private String pakinTime; + + // 浠撳簱缂栧彿 - 鍐欐 + private String lgort; + + // 鏂板 + private String plantCode; + + private String fromCode; + + private String stationCode; + + private List<Detl> list = new ArrayList<>(); + + @Data + public static class Detl { + + // 鐗╂枡鏉$爜 + private String barcode; + + // 鏁伴噺 + private Double anfme; + + public Detl() { + } + + public Detl(String barcode, Double anfme) { + this.barcode = barcode; + this.anfme = anfme; + } + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/MesPakinParam.java b/src/main/java/com/zy/common/model/enums/model/MesPakinParam.java new file mode 100644 index 0000000..b694710 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/MesPakinParam.java @@ -0,0 +1,43 @@ +package com.zy.common.model.enums.model; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by vincent on 2022/4/21 + */ +@Data +public class MesPakinParam { + + // 鍏ュ簱鏃堕棿 + private String pakinTime; + + // 鏉ユ簮鍦� - 鍐欐 + private String lgortFrom; + + // 鐩殑鍦� - 鍐欐 + private String lgortTo; + + private List<Detl> list = new ArrayList<>(); + + @Data + public static class Detl { + + // 鐗╂枡鏉$爜 + private String barcode; + + // 鏁伴噺 + private Double anfme; + + public Detl() { + } + + public Detl(String barcode, Double anfme) { + this.barcode = barcode; + this.anfme = anfme; + } + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/MesPakoutParam.java b/src/main/java/com/zy/common/model/enums/model/MesPakoutParam.java new file mode 100644 index 0000000..1bdff7d --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/MesPakoutParam.java @@ -0,0 +1,71 @@ +package com.zy.common.model.enums.model; + +import com.alibaba.fastjson.JSON; +import com.core.common.DateUtils; +import lombok.Data; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * Created by vincent on 2022/4/21 + */ +@Data +public class MesPakoutParam { + + // true: 璁㈠崟鍑�; false: 鎵嬪姩鍑� + private boolean tag; + + // 鍗曟嵁缂栧彿 + private String orderNo; + + // 鍑哄簱鏃堕棿 + private String pakoutTime; + + // 鏉ユ簮鍦� - 鍐欐 + private String lgortFrom; + + // 鐩殑鍦� - 鍐欐 + private String lgortTo; + + // 瀹㈡埛鍙� + private String kunnr; + + private List<Detl> list = new ArrayList<>(); + + @Data + public static class Detl { + + // 鐗╂枡鏉$爜 + private String barcode; + + // 鏁伴噺 + private Double anfme; + + public Detl() { + } + + public Detl(String barcode, Double anfme) { + this.barcode = barcode; + this.anfme = anfme; + } + } + + public static void main(String[] args) { + MesPakoutParam param = new MesPakoutParam(); + param.setTag(true); + param.setOrderNo("8135998"); + param.setPakoutTime(DateUtils.convert(new Date())); + param.setLgortFrom("5006"); + param.setLgortTo("1111"); + + + Detl detl = new Detl(); param.getList().add(detl); + detl.setBarcode("1100146-10000-23132132"); + detl.setAnfme(1.0D); + + System.out.println(JSON.toJSONString(param)); + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/MobileLocDetlVo.java b/src/main/java/com/zy/common/model/enums/model/MobileLocDetlVo.java new file mode 100644 index 0000000..5aa407c --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/MobileLocDetlVo.java @@ -0,0 +1,47 @@ +package com.zy.common.model.enums.model; + +/** + * Created by vincent on 2020/6/29 + */ +public class MobileLocDetlVo { + + private String locNo; + + private String matnr; + + private String maktx; + + private Double count; + + public String getLocNo() { + return locNo; + } + + public void setLocNo(String locNo) { + this.locNo = locNo; + } + + public String getMatnr() { + return matnr; + } + + public void setMatnr(String matnr) { + this.matnr = matnr; + } + + public String getMaktx() { + return maktx; + } + + public void setMaktx(String maktx) { + this.maktx = maktx; + } + + public Double getCount() { + return count; + } + + public void setCount(Double count) { + this.count = count; + } +} diff --git a/src/main/java/com/zy/common/model/enums/model/OutLocDto.java b/src/main/java/com/zy/common/model/enums/model/OutLocDto.java new file mode 100644 index 0000000..1dfa2be --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/OutLocDto.java @@ -0,0 +1,65 @@ +package com.zy.common.model.enums.model; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.core.common.Cools; +import com.core.common.SpringUtils; +import com.core.exception.CoolException; +import com.zy.asrs.entity.LocDetl; +import com.zy.asrs.service.LocDetlService; +import lombok.Data; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** + * Created by vincent on 2020/6/17 + */ +@Data +public class OutLocDto { + + private String locNo; + + private List<LocDetlDto> locDetlDtos = new ArrayList<>(); + + public OutLocDto() { + } + + public OutLocDto(String locNo, LocDetlDto locDetlDto) { + this.locNo = locNo; + this.locDetlDtos.add(locDetlDto); + } + + public boolean isAll(){ + List<LocDetlDto> locDetlDtosCp = new ArrayList<>(this.locDetlDtos); + // 鏌ヨ褰撳墠搴撲綅鍙锋墍鏈夌殑搴撳瓨鏄庣粏 + LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class); + List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", this.locNo)); + if (locDetls == null || locDetls.isEmpty()){ + throw new CoolException("妫�绱㈠簱瀛樻槑缁嗗け璐ワ紝搴撲綅鍙�=" + this.locNo); + } + int sameNumber = 0; + for (LocDetl locDetl : locDetls) { + Iterator<LocDetlDto> iterator = locDetlDtosCp.iterator(); + while (iterator.hasNext()) { + LocDetlDto next = iterator.next(); + if (!next.getLocDetl().getMatnr().equals(locDetl.getMatnr())) { + continue; + } + if (!Cools.eq(next.getLocDetl().getBatch(), locDetl.getBatch())) { + continue; + } + if (next.getCount() > locDetl.getAnfme()) { + throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�"); + } + if (next.getCount().equals(locDetl.getAnfme())) { + sameNumber++; + iterator.remove(); + break; + } + } + } + return sameNumber == locDetls.size(); + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/PageParam.java b/src/main/java/com/zy/common/model/enums/model/PageParam.java new file mode 100644 index 0000000..2151880 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/PageParam.java @@ -0,0 +1,33 @@ +package com.zy.common.model.enums.model; + +import io.swagger.annotations.ApiModelProperty; + +/** + * 鍒嗛〉鍙傛暟 + * Created by vincent on 2020-04-10 + */ +public class PageParam { + + @ApiModelProperty(value="鍒嗛〉绱㈠紩",required=true) + private int page = 1; + + @ApiModelProperty(value="鍗曢〉鏁伴噺",required=true) + private int size = 10; + + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Integer getSize() { + return size; + } + + public void setSize(Integer size) { + this.size = size; + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/PowerDto.java b/src/main/java/com/zy/common/model/enums/model/PowerDto.java new file mode 100644 index 0000000..3e54783 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/PowerDto.java @@ -0,0 +1,29 @@ +package com.zy.common.model.enums.model; + +import java.util.List; + +/** + * Created by vincent on 2020-05-12 + */ +public class PowerDto { + + private String two; + + private List<String> three; + + public String getTwo() { + return two; + } + + public void setTwo(String two) { + this.two = two; + } + + public List<String> getThree() { + return three; + } + + public void setThree(List<String> three) { + this.three = three; + } +} diff --git a/src/main/java/com/zy/common/model/enums/model/Shelves.java b/src/main/java/com/zy/common/model/enums/model/Shelves.java new file mode 100644 index 0000000..13483c9 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/Shelves.java @@ -0,0 +1,129 @@ +package com.zy.common.model.enums.model; + +import com.alibaba.fastjson.JSON; +import com.core.common.Arith; +import com.core.exception.CoolException; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** + * <strong>绔嬪簱璐ф灦瀹炰綋绫�</strong> + * Created by vincent on 2020/6/11 + */ +public class Shelves { + + // 璐ф灦鎺掓暟閲� + public final int size; + + // 璐ф灦缁勬暟閲� + public final int group; + + // 鍋忕Щ閲廩default:0] + public final int offset; + + // 璐ф灦瀹炰緥鑺傜偣闆嗗悎 + public List<List<Integer>> nodes; + + public Shelves(int size, int group) { + this(size, group, 0); + } + + /** + * @param size 璐ф灦鍗曟帓鎬绘暟 + * @param group 璐ф灦缁勬暟閲� + * @param offset 搴忓垪鍙峰亸绉婚噺 + */ + public Shelves(int size, int group, int offset) { + this.size = size; + this.group = group; + this.offset = offset; + init(); + } + + /** + * 鍒濆鍖栨柟娉曘�愮鏈夈�� + */ + private void init(){ + if (group == 0 || size%group != 0) { + throw new RuntimeException("shelves init fail!"); + } + nodes = new ArrayList<>(); + for (int g = 1; g <= this.group; g++){ + int unit = size/group; + List<Integer> node = new ArrayList<>(); + for (int i = (g-1)*unit+1+offset ; i <= g*unit+offset; i++){ + node.add(i); + } + nodes.add(node); + } + } + + /** + * 寮�濮嬭绠� =======>>> + * + * 璐ф灦鍛戒腑瑙勫垯濡備笅锛� + * 瀹夎浣嶇疆锛� [1] [2] | [3] [4] -------- [5] [6] | [7] [8] + * 鍛戒腑椤哄簭锛� 1 -> 5 -> 4 -> 8 -> 2 -> 6 -> 3 -> 7 -> 1 ... + * + * 1.璇ヨ鍒欓�備笉闄愬埗璐ф灦鏁伴噺锛屾�绘暟涓庣粍鍒湪鏋勯�犲櫒涓缃� + * 2.濡傛湁搴忓垪鍙疯捣濮嬮棶棰橈紝鐢ㄥ亸绉婚噺瑙勯伩鍗冲彲 + * + * @param curSeq 褰撳墠璐ф灦鍙� + * @return 瑙勫垯鍛戒腑璐ф灦鍙� + */ + public int start(int curSeq){ + Iterator<List<Integer>> iterator = nodes.iterator(); + while (iterator.hasNext()){ + List<Integer> node = iterator.next(); + if (node.contains(curSeq)) { + int idx = node.indexOf(curSeq); + // 鏄惁涓烘湯灏捐揣鏋� + if (iterator.hasNext()) { + return iterator.next().get(idx); + } else { + List<Integer> first = nodes.get(0); + int val = first.get(idx); + int res = size / group + 1 + offset - val; + // 鍙嶅悜鍛戒腑璐ф灦鏃朵笉鍐嶆槸瀵圭珛涓嬫爣锛堢浉瀵逛簬宸烽亾锛� + if (res < val) { + // 杞鎵�鏈夎揣鏋跺悗閲嶆柊寮�濮嬪畾浣� + if (val - res - offset == 1) { + return first.get(0); + } + res = res + 1; + } + return res + offset; + } + } + } + return -1; + } + + public Integer get(Integer curRow) { + for (List<Integer> node : nodes){ + if (node.contains(curRow)) { + return nodes.indexOf(node) + 1; + } + } + throw new CoolException("璐ф帓妫�绱㈢郴缁熸姤閿欙紝 node:" + JSON.toJSONString(nodes) + ", curRow:" + curRow); + } + + public static void main(String[] args) throws InterruptedException { + + double remainder = Arith.divides(1,16 - 1, 16); + System.out.println(remainder); + System.out.println((int) remainder); +// Shelves shelves = new Shelves(8,2); +// System.out.println(shelves.nodes.toString()); +// int start = 1; +// while (true) { +// System.out.println(start); +// start = shelves.start(start); +// Thread.sleep(500L); +// } + } + +} + diff --git a/src/main/java/com/zy/common/model/enums/model/StartupDto.java b/src/main/java/com/zy/common/model/enums/model/StartupDto.java new file mode 100644 index 0000000..06195c4 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/StartupDto.java @@ -0,0 +1,21 @@ +package com.zy.common.model.enums.model; + +import lombok.Data; + +/** + * Created by vincent on 2020/6/11 + */ +@Data +public class StartupDto { + + private Integer sourceStaNo; + + private Integer staNo; + + private Integer crnNo; + + private String locNo; + + private Integer workNo; + +} diff --git a/src/main/java/com/zy/common/model/enums/model/TaskDto.java b/src/main/java/com/zy/common/model/enums/model/TaskDto.java new file mode 100644 index 0000000..f13a0a1 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/TaskDto.java @@ -0,0 +1,124 @@ +package com.zy.common.model.enums.model; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.core.common.Cools; +import com.core.common.SpringUtils; +import com.core.exception.CoolException; +import com.zy.asrs.entity.LocDetl; +import com.zy.asrs.service.LocDetlService; +import lombok.Data; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** + * Created by vincent on 2022/3/28 + */ +@Data +public class TaskDto { + + private String locNo; + + private Integer staNo; + + private List<LocDto> locDtos; + + { + locDtos = new ArrayList<>(); + } + + public TaskDto(String locNo, Integer staNo) { + this.locNo = locNo; + this.staNo = staNo; + } + + public TaskDto(String locNo, Integer staNo, LocDto locDto) { + this.locNo = locNo; + this.staNo = staNo; + this.locDtos.add(locDto); + } + + public TaskDto(String locNo, Integer staNo, List<LocDto> locDtos) { + this.locNo = locNo; + this.staNo = staNo; + this.locDtos = locDtos; + } + + public static boolean has(List<TaskDto> list, TaskDto dto) { + if (Cools.isEmpty(list)) { + return false; + } + for (TaskDto taskDto : list) { + if (dto.getLocNo().equals(taskDto.getLocNo()) && taskDto.getStaNo().equals(dto.getStaNo())) { + return true; + } + } + return false; + } + + public static TaskDto find(List<TaskDto> list, TaskDto dto) { + if (Cools.isEmpty(list)) { + return null; + } + for (TaskDto taskDto : list) { + if (dto.getLocNo().equals(taskDto.getLocNo()) && taskDto.getStaNo().equals(dto.getStaNo())) { + return taskDto; + } + } + return null; + } + + public boolean isAll(){ + // 姹囨�讳笉鑰冭檻搴忓垪鐮� + List<DetlDto> detlDtos = new ArrayList<>(); + for (LocDto locDto : this.getLocDtos()) { + DetlDto dto = new DetlDto(locDto.getMatnr(), locDto.getBatch(), locDto.getAnfme()); + if (DetlDto.has(detlDtos, dto)) { + DetlDto detlDto = DetlDto.find(detlDtos, locDto.getMatnr(), dto.getBatch()); + assert detlDto != null; + detlDto.setAnfme(detlDto.getAnfme() + locDto.getAnfme()); + } else { + detlDtos.add(new DetlDto(locDto.getMatnr(), locDto.getBatch(), locDto.getAnfme())); + } + } + + // 鏌ヨ褰撳墠搴撲綅鍙锋墍鏈夌殑搴撳瓨鏄庣粏 + LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class); + List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", this.locNo)); + if (locDetls == null || locDetls.isEmpty()){ + throw new CoolException("妫�绱㈠簱瀛樻槑缁嗗け璐ワ紝搴撲綅鍙�=" + this.locNo); + } + int sameNumber = 0; + for (LocDetl locDetl : locDetls) { + Iterator<DetlDto> iterator = detlDtos.iterator(); + while (iterator.hasNext()) { + DetlDto dto = iterator.next(); + if (!dto.getMatnr().equals(locDetl.getMatnr())) { + continue; + } + if (Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) { + continue; + } + if (!Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(locDetl.getBatch())) { + continue; + } + if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) { + if (!dto.getBatch().equals(locDetl.getBatch())) { + continue; + } + } + if (dto.getAnfme() > locDetl.getAnfme()) { + throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�"); + } + if (dto.getAnfme().equals(locDetl.getAnfme())) { + sameNumber++; + iterator.remove(); + break; + } + } + } + return sameNumber == locDetls.size(); + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/UploadBill.java b/src/main/java/com/zy/common/model/enums/model/UploadBill.java new file mode 100644 index 0000000..49e358c --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/UploadBill.java @@ -0,0 +1,32 @@ +package com.zy.common.model.enums.model; + +import lombok.Data; + +import java.util.List; + +/** + * Created by vincent on 2021/3/23 + */ +@Data +public class UploadBill { + + private String number; + + private Integer vchType; + + private String billDate; + + private String bTypeID; + + private String kTypeID; + + private String summary; + + // 鑷 + private Double Vchcode; + + private Integer difAtype; + + private List<UploadBillDetail> detail; + +} diff --git a/src/main/java/com/zy/common/model/enums/model/UploadBillDetail.java b/src/main/java/com/zy/common/model/enums/model/UploadBillDetail.java new file mode 100644 index 0000000..13f64b0 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/UploadBillDetail.java @@ -0,0 +1,24 @@ +package com.zy.common.model.enums.model; + +import lombok.Data; + +/** + * Created by vincent on 2021/3/23 + */ +@Data +public class UploadBillDetail { + + private String userCode; + + private Double qty; + + private Integer Price; + + private String comment; + + private String unit; + + // 鍟嗗搧鏄庣粏琛屽彿 + private Double RowNo; + +} diff --git a/src/main/java/com/zy/common/model/enums/model/WrkDto.java b/src/main/java/com/zy/common/model/enums/model/WrkDto.java new file mode 100644 index 0000000..b382cb6 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/WrkDto.java @@ -0,0 +1,26 @@ +package com.zy.common.model.enums.model; + +import com.zy.asrs.entity.WrkDetl; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by vincent on 2022/5/13 + */ +@Data +public class WrkDto { + + private Integer wrkNo; + + private List<WrkDetl> wrkDetls = new ArrayList<>(); + + public WrkDto() { + } + + public WrkDto(Integer wrkNo, WrkDetl wrkDetl) { + this.wrkNo = wrkNo; + this.wrkDetls .add(wrkDetl); + } +} diff --git a/src/main/java/com/zy/common/model/enums/model/enums/HtmlNavIconType.java b/src/main/java/com/zy/common/model/enums/model/enums/HtmlNavIconType.java new file mode 100644 index 0000000..0dbc32d --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/enums/HtmlNavIconType.java @@ -0,0 +1,51 @@ +package com.zy.common.model.enums.model.enums; + +public enum HtmlNavIconType { + + INDEX("index", "layui-icon-home"), + SYSTEM("system", "layui-icon-component"), + SET("set", "layui-icon-set"), + MERCHANT("merchant", "layui-icon-user"), + DEVELOP("develop", "layui-icon-util"), + STOCK("stock", "layui-icon-templeate-1"), + LOG_REPORT("logReport", "layui-icon-read"), + IO_WORK("ioWork", "layui-icon-flag"), + WORK_FLOW("workFlow", "layui-icon-form"), + BASE("base", "layui-icon-file"), + ORDER("erp", "layui-icon-senior"), + SENSOR("sensor", "layui-icon-engine"), + ; + + + private String code; + private String icon; + HtmlNavIconType(String code, String icon){ + this.code = code; + this.icon = icon; + } + + public static String get(String code) { + for (HtmlNavIconType type : HtmlNavIconType.values()){ + if (type.code.equals(code)){ + return type.icon; + } + } + return "layui-icon-file-b"; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } +} diff --git a/src/main/java/com/zy/common/model/enums/model/enums/IoWorkType.java b/src/main/java/com/zy/common/model/enums/model/enums/IoWorkType.java new file mode 100644 index 0000000..73f357c --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/enums/IoWorkType.java @@ -0,0 +1,12 @@ +package com.zy.common.model.enums.model.enums; + +public enum IoWorkType { + + ALL_IN, + PICK_IN, + ALL_OUT, + PICK_OUT, + CHECK_OUT, + ; + +} diff --git a/src/main/java/com/zy/common/model/enums/model/enums/SysOsType.java b/src/main/java/com/zy/common/model/enums/model/enums/SysOsType.java new file mode 100644 index 0000000..2afe727 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/enums/SysOsType.java @@ -0,0 +1,49 @@ +package com.zy.common.model.enums.model.enums; + +public enum SysOsType { + + Any("any", null), + Linux("Linux", null), + Mac_OS("Mac OS", null), + Mac_OS_X("Mac OS X", null), + Windows("Windows", "D:\\licensed.txt"), + OS2("OS/2", null), + Solaris("Solaris", null), + SunOS("SunOS", null), + MPEiX("MPE/iX", null), + HP_UX("HP-UX", null), + AIX("AIX", null), + OS390("OS/390", null), + FreeBSD("FreeBSD", null), + Irix("Irix", null), + Digital_Unix("Digital Unix", null), + NetWare_411("NetWare", null), + OSF1("OSF1", null), + OpenVMS("OpenVMS", null), + Others("Others", null); + + private String description; + private String activationCodePath; + + SysOsType(String desc, String activationCodePath) { + this.description = desc; + this.activationCodePath = activationCodePath; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getActivationCodePath() { + return activationCodePath; + } + + public void setActivationCodePath(String activationCodePath) { + this.activationCodePath = activationCodePath; + } + +} diff --git a/src/main/java/com/zy/common/model/enums/model/enums/WorkNoType.java b/src/main/java/com/zy/common/model/enums/model/enums/WorkNoType.java new file mode 100644 index 0000000..2499428 --- /dev/null +++ b/src/main/java/com/zy/common/model/enums/model/enums/WorkNoType.java @@ -0,0 +1,48 @@ +package com.zy.common.model.enums.model.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 + "鐨勪换鍔$被鍨嬫棤娉曠敓鎴愬伐浣滃彿"); + } + +} -- Gitblit v1.9.1