| | |
| | | locMastService.insertBatch(list); |
| | | return R.ok("初始化成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/convert/size/auth") |
| | | @ManagerAuth(memo = "大小库位转换") |
| | | @Transactional |
| | | public R convertSize(@RequestParam String param) { |
| | | List<LocMast> list = JSONArray.parseArray(param, LocMast.class); |
| | | if (Cools.isEmpty(list)){ |
| | | return R.error(); |
| | | } |
| | | for (LocMast entity : list){ |
| | | if (!entity.getCrnNo().equals(1) && !entity.getCrnNo().equals(4)){ |
| | | return R.error("请选择1号、4号堆垛机的货位!!!不符合条件库位:"+entity.getLocNo()); |
| | | } |
| | | if (!entity.getLocSts().equals("O") && !entity.getLocSts().equals("Y")){ |
| | | return R.error("请选择空闲、被合并的货位!!!不符合条件库位:"+entity.getLocNo()); |
| | | } |
| | | } |
| | | List<String> innermostSideLoc = Utils.getInnermostSideLoc(list); |
| | | StringBuilder msg=new StringBuilder(); |
| | | for (String locNo : innermostSideLoc){ |
| | | String innermostSideLocLBR = Utils.getInnermostSideLocLBR(locNo); |
| | | LocMast locMast1 = locMastService.selectById(innermostSideLocLBR);//浅 |
| | | if (Cools.isEmpty(locMast1)){ |
| | | msg.append("请选择浅库位存在的货位!!!不符合条件库位:").append(innermostSideLocLBR).append("/n"); |
| | | continue; |
| | | } |
| | | if (!locMast1.getLocSts().equals("O")){ |
| | | msg.append("请选择浅库位空闲的货位!!!不符合条件库位:").append(locMast1.getLocNo()).append("/n"); |
| | | continue; |
| | | } |
| | | LocMast locMast = locMastService.selectById(locNo);//深 |
| | | if (Cools.isEmpty(locMast)){ |
| | | msg.append("请选择深库位存在的货位!!!不符合条件库位:").append(locNo).append("/n"); |
| | | continue; |
| | | } |
| | | if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("O")){ |
| | | locMast1.setLocType1((short)2); |
| | | locMast.setLocType1((short)2); |
| | | locMast.setLocSts("Y"); |
| | | }else if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("Y")){ |
| | | locMast1.setLocType1((short)1); |
| | | locMast.setLocType1((short)1); |
| | | locMast.setLocSts("O"); |
| | | }else { |
| | | msg.append("请选择深库位库位空闲、被合并的货位!!!不符合条件库位:").append(locMast.getLocNo()).append("/n"); |
| | | continue; |
| | | } |
| | | locMastService.updateById(locMast1); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | return R.ok(msg); |
| | | } |
| | | } |
| | |
| | | case 0: |
| | | return "未知"; |
| | | case 1: |
| | | return "小库位"; |
| | | return "低库位"; |
| | | case 2: |
| | | return "大库位"; |
| | | return "高库位"; |
| | | default: |
| | | return String.valueOf(this.locType1); |
| | | } |
| | |
| | | case 0: |
| | | return "未知"; |
| | | case 1: |
| | | return "小库位"; |
| | | return "低库位"; |
| | | case 2: |
| | | return "大库位"; |
| | | return "高库位"; |
| | | default: |
| | | return String.valueOf(this.locType1); |
| | | } |
| | |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | List<String> matnrs = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatnr).distinct().collect(Collectors.toList()); |
| | | List<String> batchs = param.getList().stream().map(FullStoreParam.MatCodeStore::getBatch).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs.get(0), batchs.get(0), null,locTypeDto,0); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs.get(0), batchs.get(0), null,0,locTypeDto,0); |
| | | // 生成工作号 |
| | | int workNo = dto.getWorkNo(); |
| | | // 生成工作档 |
| | |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null,null,null, locTypeDto, 0); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null,null,null,0, locTypeDto, 0); |
| | | int workNo = dto.getWorkNo(); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | |
| | | boolean sign = true; |
| | | for (Integer crnNo : crns){ |
| | | sign = true; |
| | | //宜科专用 大小托盘 |
| | | short locType1= staNo==112? (short)1 : (short)2;//1:"小托盘"、2:"大托盘" |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts",locStsTarget).eq("crn_no",crnNo).eq("loc_type1",locType1)); |
| | | |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts",locStsTarget).eq("crn_no",crnNo)); |
| | | |
| | | if (Cools.isEmpty(locMast)) { |
| | | // throw new CoolException("库中无空板!!!"); |
| | |
| | | |
| | | //库位排号分配 |
| | | public static int[] LocNecessaryParameters(Integer whsType, Integer curRow, Integer crnNumber) { |
| | | return LocNecessaryParametersDoubleExtension(whsType, curRow, crnNumber); |
| | | switch (whsType){ |
| | | case 1://经典双伸库位 |
| | | return LocNecessaryParametersDoubleExtension(whsType, curRow, crnNumber); |
| | | default: |
| | | return LocNecessaryParametersMove(whsType, curRow, crnNumber);//moveCrnNo |
| | | } |
| | | } |
| | | |
| | | //经典双伸库位 |
| | |
| | | return necessaryParameters; |
| | | } |
| | | |
| | | //移库 |
| | | public static int[] LocNecessaryParametersMove(Integer whsType, Integer curRow, Integer moveCrnNo) { |
| | | int[] necessaryParameters = new int[]{0, 0, 0, 0}; |
| | | necessaryParameters[0] = 2; // 轮询次数 |
| | | if (curRow.equals(moveCrnNo*4-2)){ |
| | | necessaryParameters[1] = curRow+2; //curRow 最深库位排 |
| | | necessaryParameters[2] = moveCrnNo; //crnNo 堆垛机号 |
| | | necessaryParameters[3] = curRow+1; //nearRow 最浅库位排 |
| | | }else { |
| | | necessaryParameters[1] = curRow-2; //curRow 最深库位排 |
| | | necessaryParameters[2] = moveCrnNo; //crnNo 堆垛机号 |
| | | necessaryParameters[3] = curRow-1; //nearRow 最浅库位排 |
| | | } |
| | | return necessaryParameters; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | List<LocMast> locS = new ArrayList<LocMast>(); |
| | |
| | | throw new CoolException("plc高低检测异常"); |
| | | } |
| | | if (basDevp.getLocType1() == 1) { |
| | | this.locType1 = 1; // 小库位 |
| | | this.locType1 = 1; // 低库位 |
| | | } else { |
| | | this.locType1 = 2; // 大库位 |
| | | this.locType1 = 2; // 高库位 |
| | | } |
| | | log.info(JSON.toJSONString(this)); |
| | | } |
| | |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, LocTypeDto locTypeDto, int times) { |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | if (Cools.isEmpty(matnr)) { //物料号 |
| | | matnr = ""; |
| | | } |
| | |
| | | // ===============>>>> 开始执行 |
| | | curRow = rowLastno.getCurrentRow(); |
| | | |
| | | if (!Cools.isEmpty(moveCrnNo) && moveCrnNo!=0){ |
| | | crnNumber = moveCrnNo; |
| | | if (times==0){ |
| | | curRow = moveCrnNo*4-1; |
| | | }else { |
| | | curRow = moveCrnNo*4-2; |
| | | } |
| | | } |
| | | |
| | | //此程序用于优化堆垛机异常时的运行时间 |
| | | for (int i = times; i < crnNumber; i++) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(whsType, curRow, crnNumber); |
| | |
| | | throw new CoolException("无可用堆垛机"); |
| | | } |
| | | |
| | | boolean signRule1 = false; |
| | | boolean signRule2 = false; |
| | | |
| | | // // 靠近摆放规则 --- 同天同规格物料 //分离版 |
| | | // if (!Cools.isEmpty(matnr) && (staDescId == 1 || staDescId == 11 || staDescId == 111)) { |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | // for (LocMast locMast1:locMasts){ |
| | | // if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | // continue; |
| | | // } |
| | | // String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); |
| | | // LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",shallowLoc)); |
| | | // if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("F")){ |
| | | // LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast2.getLocNo())); |
| | | // if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())) { |
| | | // locMast = locMast1; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // 靠近摆放规则 --- 同天同规格物料 //分离版 |
| | | // if (!Cools.isEmpty(matnr) && (staDescId == 1)){ |
| | | // signRule1 = true; |
| | | // } |
| | | |
| | | // 靠近摆放规则 --- 同天同规格物料 //互通版 |
| | | if (!Cools.isEmpty(matnr) && (staDescId == 1 || staDescId == 11 || staDescId == 111)) { |
| | | if (!Cools.isEmpty(matnr) && staDescId == 1) { |
| | | signRule2 = true; |
| | | } |
| | | |
| | | if (!Cools.isEmpty(matnr) && (staDescId == 11 || staDescId == 111)) { |
| | | signRule1 = true; |
| | | } |
| | | |
| | | if (signRule1){ |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",shallowLoc)); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("F")){ |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast2.getLocNo())); |
| | | if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())) { |
| | | locMast = locMast1; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }else if (signRule2){ |
| | | List<String> locNos = locDetlService.getSameDetlToday(matnr,batch, sRow, eRow); |
| | | for (String locNo : locNos) { |
| | | if (Utils.isShallowLoc(slaveProperties, locNo)) { |
| | |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount) { |
| | | times = times + 1; |
| | | return getLocNo(1, staDescId, sourceStaNo, matnr, batch, grade, locTypeDto, times); |
| | | return getLocNo(1, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times); |
| | | } |
| | | // // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | // if (locTypeDto.getLocType1() < 2) { |
| | |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(12, true); |
| | | |
| | | // 检索库位 |
| | | StartupDto dto = commonService.getLocNo(rowLastnoService.selectNextWhsType(), 10, 12, null,null,null, locTypeDto,0); |
| | | StartupDto dto = commonService.getLocNo(rowLastnoService.selectNextWhsType(), 10, 12, null,null,null,0, locTypeDto,0); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | |
| | | // 检索库位 |
| | | List<String> matnrs = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList()); |
| | | List<String> batchs = waitPakins.stream().map(WaitPakin::getBatch).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(1, 1, devpNo, matnrs.get(0),batchs.get(0),null, locTypeDto,0); |
| | | StartupDto dto = commonService.getLocNo(1, 1, devpNo, matnrs.get(0),batchs.get(0),null,0, locTypeDto,0); |
| | | int workNo = dto.getWorkNo(); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | StartupDto dto = commonService.getLocNo(1, 10, devpNo, null,null,null, locTypeDto,0); |
| | | StartupDto dto = commonService.getLocNo(1, 10, devpNo, null,null,null,0, locTypeDto,0); |
| | | int workNo = dto.getWorkNo(); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | |
| | | }) |
| | | }); |
| | | break; |
| | | case 'convertSize': |
| | | var data = checkStatus.data; |
| | | if (data.length === 0){ |
| | | layer.msg('请选择数据'); |
| | | } else { |
| | | layer.confirm('确定转换'+(data.length===1?'此':data.length)+'条数据吗', function(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/locMast/convert/size/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {param: JSON.stringify(data)}, |
| | | method: 'POST', |
| | | traditional:true, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | layer.closeAll(); |
| | | tableReload(false); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | break; |
| | | } |
| | | }); |
| | | |
| | |
| | | <select name="loc_type1" id="loc_type1" class="layui-input" type="text" placeholder="库位类型" autocomplete="off"> |
| | | <!-- <option style="display: none"></option>--> |
| | | <option value=""></option> |
| | | <option value="1">小库位</option> |
| | | <option value="2">大库位</option> |
| | | <option value="1">低库位</option> |
| | | <option value="2">高库位</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | |
| | | <select name="locType1"> |
| | | <option style="display: none"></option> |
| | | <option value="0">未知</option> |
| | | <option value="1">小库位</option> |
| | | <option value="2">大库位</option> |
| | | <option value="1">低库位</option> |
| | | <option value="2">高库位</option> |
| | | </select> |
| | | </div> |
| | | </div> |