| | |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.entity.param.MobileAdjustParam; |
| | | import com.zy.asrs.entity.param.OffSaleParam; |
| | | import com.zy.asrs.entity.param.OpenOrderPakinParam; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | if(param.getCombMats().size()>1){ |
| | | throw new CoolException("response.extract_one_product_or_refresh"); |
| | | } |
| | | // if(param.getCombMats().size()>1){ |
| | | // throw new CoolException("response.extract_one_product_or_refresh"); |
| | | // } |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void cartonComb(List<CombCartonParam> params, Long userId) { |
| | | for (CombCartonParam param : params) { |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCartons())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | | throw new CoolException("response.data_processing_inbound"); |
| | | } |
| | | |
| | | if(param.getBarcode().length()!=8){ |
| | | throw new CoolException("response.barcode_length_invalid"); |
| | | } |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); |
| | | int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode())); |
| | | if (countLoc > 0 || countWrk > 0 || countwait > 0) { |
| | | throw new CoolException("response.pallet_data_exists"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | |
| | | Order order = orderService.selectByNo(param.getOrderNo()); |
| | | if (Cools.isEmpty(order) || order.getSettle() > 2) { |
| | | throw new CoolException("response.order_expired"); |
| | | } |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCartons().forEach(elem -> { |
| | | |
| | | // 订单明细数量校验 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch(),elem.getCartonLabel()); |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException("response.inbound_qty_invalid"); |
| | | } |
| | | // 修改订单作业数量 |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme(),elem.getCartonLabel())) { |
| | | throw new CoolException("response.update_doc_qty_failed"); |
| | | } |
| | | |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),elem.getCartonLabel()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(), detlDto.getCartonLabel()); |
| | | assert one != null; |
| | | one.setAreaId(param.getZoneId()); |
| | | one.setAnfme(one.getAnfme() + detlDto.getAnfme()); |
| | | } else { |
| | | detlDtos.add(detlDto); |
| | | } |
| | | }); |
| | | for (DetlDto detlDto : detlDtos) { |
| | | Mat mat = matService.selectByMatnr(detlDto.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException("response.material_not_exist"); |
| | | } |
| | | OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>() |
| | | .eq("order_no",order.getOrderNo()) |
| | | .eq("matnr",mat.getMatnr()) |
| | | .eq("barcode",detlDto.getCartonLabel())); |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.sync(orderDetl); |
| | | waitPakin.setOrderNo(order.getOrderNo()); // 单据编号 |
| | | waitPakin.setBatch(detlDto.getBatch()); // 序列码 |
| | | waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | | waitPakin.setAreaId(param.getZoneId()); //区域 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(detlDto.getAnfme()); // 数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("response.save_wait_pakin_failed"); |
| | | } |
| | | } |
| | | orderService.updateSettle(order.getId(), 2L, userId); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetl cartonScan(ScanParam scanParam , Long userId) { |
| | | String cartonLabel = scanParam.getCartonLabel(); |
| | | if(cartonLabel == null){ |
| | | throw new CoolException("Label can not be null"); |
| | | } |
| | | List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("barcode",cartonLabel)); |
| | | if(waitPakins.size() > 0){ |
| | | throw new CoolException("Label has already been in system"); |
| | | } |
| | | OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("barcode",cartonLabel)); |
| | | if(orderDetl == null){ |
| | | throw new CoolException("OrderDetl can not be found"); |
| | | } |
| | | return orderDetl; |
| | | } |
| | | |
| | | // 商品上架 |
| | | @Override |
| | | public void onSale(CombParam param) { |