| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | |
| | | import com.zy.asrs.entity.param.MobileAdjustParam; |
| | | import com.zy.asrs.entity.result.MobileAdjustResult; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.WrkDto; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private PackService packService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | |
| | | // 拣料检索托盘信息 |
| | | @RequestMapping("/piking/auth") |
| | | @ManagerAuth |
| | | public R pikingAuth(String barcode) { |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(barcode); |
| | | if (Cools.isEmpty(wrkMast)) { |
| | | throw new CoolException(barcode + "暂无工作档"); |
| | | } |
| | | if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 107){ |
| | | throw new CoolException(barcode + "不为拣料/盘点出库"); |
| | | } |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | return R.ok().add(wrkDetls); |
| | | } |
| | | |
| | | // 组托前查询托盘码是否已经组托 |
| | | @RequestMapping("/barcode/auth") |
| | | @ManagerAuth |
| | | public R pakinAuth(@RequestParam("barcode") String barcode) { |
| | | WaitPakin waitPakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("zpallet", barcode)); |
| | | if (!Cools.isEmpty(waitPakin)) { |
| | | return R.error("入库通知档已存在!"); |
| | | } |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("barcode",barcode)); |
| | | if (!Cools.isEmpty(locMast)) { |
| | | return R.error("库存主档中已存在当前条码!"); |
| | | } |
| | | LocDetl locdetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("barcode", barcode)); |
| | | if (!Cools.isEmpty(locdetl)){ |
| | | return R.error("库存明细中已存在当前条码,请检查库存"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 拣料转全板 |
| | |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setWrkNo(wrkMast.getWrkNo()); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setMatType(locDetl.getMatType()); |
| | | wrkDetl.setOwner(locDetl.getOwner()); |
| | | |
| | | wrkDetl.sync(locDetl); |
| | | wrkDetlService.insert(wrkDetl); |
| | |
| | | public R comb(@RequestBody CombParam combParam){ |
| | | mobileService.comb(combParam, getUserId()); |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | @RequestMapping("/comb/2auth") |
| | | @ManagerAuth(memo = "组托") |
| | | public R comb2(@RequestBody CombParam combParam){ |
| | | mobileService.pikingToFull2(1); |
| | | return R.ok(mobileService.pikingToFull2(3732)); |
| | | } |
| | | |
| | | @RequestMapping("/pack/get/auth") |
| | |
| | | wrkDetl.setOrderNo(orderNo); |
| | | wrkDetl.setIoTime(wrkMast.getIoTime()); |
| | | wrkDetl.setWrkNo(wrkNo); |
| | | wrkDetl.setMatType(locDetl.getMatType()); |
| | | return R.ok().add(wrkDetl); |
| | | } |
| | | } |
| | |
| | | @ManagerAuth |
| | | public R getCheckDetl2(String barcode) { |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(barcode); |
| | | if(Cools.isEmpty()){ |
| | | if(Cools.isEmpty(wrkMast)){ |
| | | throw new CoolException("此托盘码没有盘点任务"); |
| | | } |
| | | if (wrkMast.getIoType() != 107){ |
| | |
| | | mobileService.adjustNew(combParam, Boolean.TRUE, getUserId()); |
| | | return R.ok("补货成功"); |
| | | } |
| | | |
| | | @RequestMapping("/pick/auth") |
| | | @ManagerAuth(memo = "拣料") |
| | | public synchronized R pickAuth(@RequestBody String barcode){ |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(barcode); |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | | ArrayList<WrkDetl> resultwrkDetls = new ArrayList<>(); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (isJSON(wrkDetl.getOrderNo())) { |
| | | JSON.parseArray(wrkDetl.getOrderNo(), DetlDto.class).forEach(detlDto -> { |
| | | WrkDetl clone = wrkDetl.clone(); |
| | | clone.setOrderNo(detlDto.getOrderNo()); |
| | | clone.setAnfme(detlDto.getAnfme()); |
| | | resultwrkDetls.add(clone); |
| | | }); |
| | | } else { |
| | | resultwrkDetls.add(wrkDetl); |
| | | } |
| | | } |
| | | return R.ok().add(resultwrkDetls); |
| | | } |
| | | |
| | | @RequestMapping("/order/search/orderNo/auth/v2") |
| | | @ManagerAuth |
| | | public R orderSearchByBarcodeV2(@RequestParam String orderNo){ |
| | | if (Cools.isEmpty(orderNo)){ |
| | | orderNo=null; |
| | | } |
| | | List<Order> orders = orderService.selectOrderNoL(orderNo); |
| | | if (Cools.isEmpty(orders)){ |
| | | return R.ok(); |
| | | } |
| | | LinkedList<CombParam> combParams = new LinkedList<>(); |
| | | if (!Cools.isEmpty(orders)){ |
| | | for (Order order:orders){ |
| | | CombParam combParam=new CombParam(); |
| | | if (order == null) { |
| | | continue; |
| | | } |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (docType.getPakin() == null || docType.getPakin() != 1) { |
| | | continue; |
| | | } |
| | | if (order.getSettle() > 2) { |
| | | continue; |
| | | } |
| | | List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId()); |
| | | if (!Cools.isEmpty(orderDetls)) { |
| | | LinkedList<CombParam.CombMat> combMats = new LinkedList<>(); |
| | | for (OrderDetl orderDetl:orderDetls){ |
| | | CombParam.CombMat combMat = new CombParam.CombMat(); |
| | | combMat.setMatnr(orderDetl.getMatnr()); |
| | | combMat.setBatch(orderDetl.getBatch()); |
| | | combMat.setAnfme(orderDetl.getAnfme()); |
| | | combMats.add(combMat); |
| | | } |
| | | combParam.setCombMats(combMats); |
| | | } |
| | | combParam.setOrderNo(order.getOrderNo()); |
| | | combParams.add(combParam); |
| | | } |
| | | } |
| | | return R.ok().add(combParams); |
| | | } |
| | | } |