src/main/java/com/zy/asrs/controller/TestController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/domain/enums/WorkNoType.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/common/model/StartupDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/common/service/CommonService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/controller/TestController.java
File was deleted src/main/java/com/zy/asrs/domain/enums/WorkNoType.java
New file @@ -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 + "的任务类型无法生成工作号"); } } src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.mapper.Wrapper; import com.core.common.Cools; import com.core.exception.CoolException; import com.zy.asrs.domain.enums.WorkNoType; import com.zy.asrs.entity.*; import com.zy.asrs.mapper.BasCrnErrorMapper; import com.zy.asrs.mapper.WaitPakinMapper; @@ -16,6 +17,7 @@ import com.zy.common.service.CommonService; import com.zy.common.utils.CollectionUtils; import com.zy.core.CrnThread; import com.zy.core.DevpThread; import com.zy.core.cache.MessageQueue; import com.zy.core.cache.SlaveConnection; import com.zy.core.enums.*; @@ -29,7 +31,6 @@ import com.zy.core.model.protocol.StaProtocol; import com.zy.core.properties.SlaveProperties; import com.zy.core.thread.BarcodeThread; import com.zy.core.DevpThread; import com.zy.core.thread.LedThread; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -56,24 +57,6 @@ @Autowired private RowLastnoService rowLastnoService; public void test(){ try { // 工作号 int workNo = commonService.getWorkNo(0); System.out.println(workNo); if (workNo > 0) { throw new CoolException("21321"); } RowLastno rowLastno = rowLastnoService.selectById(1); rowLastno.setCurrentRow(rowLastno.getCurrentRow() + 1); rowLastnoService.updateById(rowLastno); System.out.println(rowLastno.getCurrentRow()); } catch (Exception e) { e.printStackTrace(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } } @Autowired private CommonService commonService; @@ -145,11 +128,11 @@ } try { // 工作号 int workNo = commonService.getWorkNo(0); // 检索库位 List<String> matNos = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList()); StartupDto startupDto = commonService.getLocNo(1, 1, inSta.getStaNo(), matNos); // 工作号 int workNo = startupDto.getWorkNo(); // 插入工作明细档 wrkDetlService.createWorkDetail(workNo, waitPakins, barcode); @@ -859,10 +842,10 @@ // 站点条件判断 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 0 && staProtocol.isPakMk()) { // 工作号 int workNo = commonService.getWorkNo(0); // 检索库位 StartupDto startupDto = commonService.getLocNo(1, 10, emptyInSta.getStaNo(), null); // 工作号 int workNo = startupDto.getWorkNo(); try { // 插入工作主档 @@ -1061,7 +1044,7 @@ String locNo = loc.getLocNo(); // 获取工作号 int workNo = commonService.getWorkNo(0); int workNo = commonService.getWorkNo(WorkNoType.PICK.type); // 保存工作档 WrkMast wrkMast = new WrkMast(); wrkMast.setWrkNo(workNo); src/main/java/com/zy/common/model/StartupDto.java
@@ -1,8 +1,11 @@ package com.zy.common.model; import lombok.Data; /** * Created by vincent on 2020/6/11 */ @Data public class StartupDto { private Integer sourceStaNo; @@ -13,35 +16,6 @@ private String locNo; public Integer getSourceStaNo() { return sourceStaNo; } private Integer workNo; public void setSourceStaNo(Integer sourceStaNo) { this.sourceStaNo = sourceStaNo; } public Integer getStaNo() { return staNo; } public void setStaNo(Integer staNo) { this.staNo = staNo; } public Integer getCrnNo() { return crnNo; } public void setCrnNo(Integer crnNo) { this.crnNo = crnNo; } public String getLocNo() { return locNo; } public void setLocNo(String locNo) { this.locNo = locNo; } } src/main/java/com/zy/common/service/CommonService.java
@@ -5,6 +5,7 @@ import com.core.common.Arith; import com.core.common.Cools; import com.core.exception.CoolException; import com.zy.asrs.domain.enums.WorkNoType; import com.zy.asrs.entity.*; import com.zy.asrs.service.*; import com.zy.common.model.StartupDto; @@ -89,6 +90,13 @@ */ public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos) { StartupDto startupDto = new StartupDto(); int workNo = getWorkNo(WorkNoType.getWorkNoType(staDescId)); startupDto.setWorkNo(workNo); if (sourceStaNo < 100) { whsType = 1; } else { whsType = 2; } RowLastno rowLastno = rowLastnoService.selectById(whsType); if (Cools.isEmpty(rowLastno)) { throw new CoolException("数据异常,请联系管理员"); @@ -97,62 +105,20 @@ int curRow = rowLastno.getCurrentRow(); int sRow = rowLastno.getsRow(); int eRow = rowLastno.geteRow(); int crn_qty = rowLastno.getCrnQty(); int rowCount = eRow - sRow + 1; // 获取目标站所在货架排号 curRow = curRow == sRow ? eRow : sRow; // 目标堆垛机号 int crnNo = 0; // 目标库位 LocMast locMast = null; // 同一天同规格货物靠近摆法规则 // if (!Cools.isEmpty(matNos)) { // List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0)); // for (String locNo : locNos) { // // 获取排 // int row = Integer.parseInt(locNo.substring(0, 2)); // // 判断是否为深库位 // double remainder = Arith.remainder(row, rowCount / crn_qty); // int targetRow; // if (remainder == 1) { // // 得到当前库位的外围库位 // targetRow = row + 1; // } else if (remainder == 0) { // // 得到当前库位的内围库位 // targetRow = row - 1; // } else { // continue; // } // String targetLocNo = zerofill(String.valueOf(targetRow), 2)+locNo.substring(2); // // 检测目标库位是否为空库位 // LocMast targetLocMast = locMastService.selectById(targetLocNo); // if (targetLocMast != null && targetLocMast.getLocSts().equals("O")) { // locMast = targetLocMast; // crnNo = locMast.getCrnNo(); // break; // } // } // } // 如果没有相近物料,则按规则轮询货架 if (null == locMast) { // 获取目标站所在货架排号 todo:luxiaotao if (curRow == sRow) { curRow = eRow; } else { curRow = sRow; } crnNo = whsType; // Shelves shelves = new Shelves(rowCount, crn_qty); // curRow = shelves.start(curRow); // if (curRow < 0) { // throw new CoolException("检索库位失败,请联系管理员"); // } // for (List<Integer> node : shelves.nodes){ // if (node.contains(curRow)) { // crnNo = shelves.nodes.indexOf(node) + 1; // break; // } // } int crnNo; switch (whsType) { case 1: crnNo = 1; break; case 2: crnNo = 2; break; default: throw new CoolException("检索库位 -- 检索堆垛机号失败"); } basCrnpService.checkSiteStatus(crnNo); @@ -169,9 +135,7 @@ int inQty = staNo.getInQty()==null?0:staNo.getInQty(); if (staNo.getAutoing().equals("Y") && inQty<2) { // 查找库位 if (locMast == null) { locMast = locMastService.queryFreeLocMast(curRow); } LocMast locMast = locMastService.queryFreeLocMast(curRow); if (Cools.isEmpty(locMast)) { throw new CoolException("没有空库位"); }