| | |
| | | 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.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.common.constant.MesConstant; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.DetlDto; |
| | |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private NodeService nodeService; |
| | | @Autowired |
| | | private ManLocDetlService manLocDetlService; |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | | throw new CoolException(param.getBarcode() + "数据正在进行入库"); |
| | | } |
| | | |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); |
| | | if (countLoc > 0 || countWrk > 0) { |
| | | throw new CoolException("工作档/库存条码数据已存在===>>" + param.getBarcode()); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | |
| | | // 无单组托 |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSale(CombParam param) { |
| | | Date now = new Date(); |
| | | // 获取库位号 |
| | | String locno = param.getLocno(); |
| | | Node node = nodeService.selectByUuid(locno); |
| | | if (Cools.isEmpty(node)) { |
| | | throw new CoolException(param.getLocno() + ":库位不存在"); |
| | | } |
| | | |
| | | // 获取商品列表 |
| | | for(CombParam.CombMat combMat : param.getCombMats()){ |
| | | Mat mat = matService.selectByMatnr(combMat.getMatnr()); |
| | | if (Cools.isEmpty(mat)){ |
| | | throw new CoolException(combMat.getMatnr() + ":商品档案不存在!"); |
| | | } |
| | | if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme()==0){ |
| | | throw new CoolException(combMat.getMatnr() + ":商品数量有误!"); |
| | | } |
| | | if (Cools.isEmpty(combMat.getBatch())){ |
| | | throw new CoolException(combMat.getMatnr() + ":商品批号有误!"); |
| | | } |
| | | ManLocDetl manLocDetl = new ManLocDetl(); |
| | | manLocDetl.setLocNo(locno); |
| | | manLocDetl.setNodeId(node.getId()); |
| | | manLocDetl.setMaktx(mat.getMaktx()); |
| | | manLocDetl.setMatnr(mat.getMatnr()); |
| | | manLocDetl.setBatch(combMat.getBatch()); |
| | | manLocDetl.setAnfme(combMat.getAnfme()); |
| | | manLocDetl.setModiTime(now); |
| | | if (!manLocDetlService.insert(manLocDetl)) { |
| | | throw new CoolException("商品上架失败!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void offSale(OffSaleParam offSaleParam) { |
| | | List<ManLocDetl> manLocDetls = manLocDetlMapper.selectLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); |
| | | if (Cools.isEmpty(manLocDetls)){ |
| | | throw new CoolException("商品下架失败!"); |
| | | } |
| | | int i = manLocDetlMapper.deleteLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); |
| | | System.out.println(i); |
| | | } |
| | | @Override |
| | | @Transactional |
| | | public void adjust(MobileAdjustParam param, Long userId) { |
| | |
| | | BasDevp sta = basDevpService.checkSiteStatus(staNo); |
| | | //根据订单号生成出库任务工作档 |
| | | Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", orderNo)); |
| | | if (order.getSettle() != 1 && order.getSettle() != 2){ |
| | | throw new CoolException("该订单已处理"); |
| | | } |
| | | |
| | | List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", orderNo)); |
| | | Date now = new Date(); |
| | | for(OrderDetl orderDetl : orderDetls){ |
| | | //查询所有库位状态为F的库位信息 |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),null); |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(),orderDetl.getBatch(),null,null); |
| | | if (locDetls.size() == 0) { |
| | | throw new CoolException("库存中没有该物料"); |
| | | } |
| | |
| | | order.setSettle(2L); |
| | | order.setUpdateBy(userId); |
| | | order.setUpdateTime(now); |
| | | if(orderService.update(order, new EntityWrapper<Order>().eq("order_no", orderNo))){ |
| | | if(!orderService.update(order, new EntityWrapper<Order>().eq("order_no", orderNo))){ |
| | | throw new CoolException("更新订单状态失败"); |
| | | } |
| | | orderDetl.setWorkQty(orderDetl.getWorkQty() + curOutQty); |
| | |
| | | if(!Cools.isEmpty(orderDetl.getBatch())){ |
| | | wrapper.eq("batch", orderDetl.getBatch()); |
| | | } |
| | | if(orderDetlService.update(orderDetl, wrapper)){ |
| | | if(!orderDetlService.update(orderDetl, wrapper)){ |
| | | throw new CoolException("更新订单明细失败"); |
| | | } |
| | | } |