| | |
| | | package com.zy.common.web; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.web.param.SearchLocParam; |
| | | import lombok.Synchronized; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private PltBarcodeService pltBarcodeService; |
| | | |
| | | @PostMapping("/pakin/loc/v1") |
| | | @ResponseBody |
| | |
| | | if (Cools.isEmpty(param.getSourceStaNo())) { |
| | | return R.error("源站编号不能为空"); |
| | | } |
| | | List<WaitPakin> waitPakins = null; |
| | | List<PltBarcode> pltBarcodes = null; |
| | | if (param.getIoType() == 1) { |
| | | if (Cools.isEmpty(param.getBarcode())) { |
| | | return R.error("条码不能为空"); |
| | | } |
| | | waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())); |
| | | if (Cools.isEmpty(waitPakins)) { |
| | | pltBarcodes = pltBarcodeService.selectList(new EntityWrapper<PltBarcode>().eq("barcode", param.getBarcode())); |
| | | if (Cools.isEmpty(pltBarcodes)) { |
| | | return R.error("条码数据错误"); |
| | | } |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | |
| | | return R.error("高低检测信号不能为空"); |
| | | } |
| | | |
| | | LocTypeDto locTypeDto = new LocTypeDto(); |
| | | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), true); |
| | | if (Cools.isEmpty(sourceStaNo)){ |
| | | return R.error("入库站点不存在"); |
| | | } |
| | | sourceStaNo.setLocType1(param.getLocType1()); |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | locTypeDto.setLocType1(param.getLocType1()); |
| | | |
| | | // 限制只能有一个在设备上走状态 |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("wrk_sts", 2).eq("source_sta_no", param.getSourceStaNo())); |
| | | if (count > 0) { |
| | | return R.error("已有在设备上走工作档"); |
| | | } |
| | | |
| | | StartupDto dto = null; |
| | | switch (param.getIoType()) { |
| | | case 1: |
| | | dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, waitPakins); |
| | | dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, pltBarcodes); |
| | | break; |
| | | case 10: |
| | | dto = emptyPlateIn(param.getSourceStaNo(), locTypeDto); |
| | |
| | | * 全板入库 todo:luxiaotao 1.留出中转库位 |
| | | */ |
| | | @Transactional |
| | | public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<WaitPakin> waitPakins) { |
| | | public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<PltBarcode> pltBarcodes) { |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | List<String> matNos = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(null, 1, devpNo, matNos, locTypeDto); |
| | | List<String> matNos = pltBarcodes.stream().map(PltBarcode::getMatNo).distinct().collect(Collectors.toList()); |
| | | StartupDto dto; |
| | | if (devpNo == 304) { |
| | | dto = commonService.getLocNoBy304(barcode); |
| | | } else { |
| | | dto = commonService.getLocNo(1, 1, devpNo, false, matNos, locTypeDto,0); |
| | | } |
| | | int workNo = dto.getWorkNo(); |
| | | |
| | | // 生成工作档 |
| | |
| | | } |
| | | // 生成工作档明细 |
| | | List<MatCodeCountDto> matDtos = new ArrayList<>(); |
| | | waitPakins.forEach(elem -> { |
| | | matDtos.add(new MatCodeCountDto(elem.getMatnr(), elem.getAnfme(),elem.getColor())); |
| | | pltBarcodes.forEach(elem -> { |
| | | matDtos.add(new MatCodeCountDto(elem.getBillNo(), elem.getSeqNo(), elem.getMatNo(), elem.getSupplier(), elem.getQty(),elem.getSource(),elem.getVendor(),elem.getMemo())); |
| | | |
| | | //更新组托数据状态为入库中 |
| | | Wrapper<PltBarcode> wrapper = new EntityWrapper<PltBarcode>().eq("barcode", elem.getBarcode()) |
| | | .eq("bill_no", elem.getBillNo()).eq("seq_no", elem.getSeqNo()).eq("mat_no", elem.getMatNo()); |
| | | PltBarcode pltBarcode = pltBarcodeService.selectOne(wrapper); |
| | | pltBarcode.setLocNo(dto.getLocNo()); |
| | | pltBarcode.setIoStatus(1);//入库中 |
| | | pltBarcodeService.update(pltBarcode,wrapper); |
| | | }); |
| | | wrkDetlService.createWorkDetail(workNo, matDtos, barcode, null); |
| | | // 更新源站点信息 |
| | |
| | | return dto; |
| | | } |
| | | |
| | | @Synchronized |
| | | @Transactional |
| | | public StartupDto emptyPlateIn(Integer devpNo, LocTypeDto locTypeDto) { |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | StartupDto dto = commonService.getLocNo(null, 10, devpNo, null, locTypeDto); |
| | | StartupDto dto; |
| | | if (devpNo >= 300) { |
| | | dto = commonService.emptyIngetLocNo(devpNo); |
| | | } else { |
| | | dto = commonService.getLocNo(1, 10, devpNo, true, null, locTypeDto, 0); |
| | | } |
| | | int workNo = dto.getWorkNo(); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |