| | |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | // if(param.getCombMats().size()>1){ |
| | | // throw new CoolException("请提取一个商品,或者刷新重新组托!"); |
| | | // } |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | | throw new CoolException(param.getBarcode() + "数据正在进行入库"); |
| | | } |
| | | |
| | | if(param.getBarcode().length()!=8){ |
| | | if (param.getBarcode().length() != 8) { |
| | | throw new CoolException("条码长度不是8位===>>" + param.getBarcode()); |
| | | } |
| | | if (param.getCombMats().size()>1){ |
| | | throw new CoolException("不允许混料===>>" + param.getBarcode()); |
| | | } |
| | | // if (param.getCombMats().size()>1){ |
| | | // 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())); |
| | | int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode())); |
| | | 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("组托档/工作档/库存条码数据已存在===>>" + param.getBarcode()); |
| | | } |
| | |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | // 关联组托 |
| | | // 关联组托 |
| | | } else { |
| | | Order order = orderService.selectByNo(param.getOrderNo()); |
| | | if (order.getSettle() > 2) { |
| | | |
| | | Order order = orderService.selectOne(new EntityWrapper<Order>().eq("temp1", param.getOrderNo())); |
| | | if (Cools.isEmpty(order) || order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | // 生成入库通知档 |
| | |
| | | param.getCombMats().forEach(elem -> { |
| | | |
| | | // 订单明细数量校验 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch(),elem.getAnfme() ); |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getOrderNo(), waitPakin.getMatnr(), waitPakin.getBatch(),detlDto.getAnfme()); |
| | | if (orderDetl == null) { |
| | | orderDetl = orderDetlService.selectItem(order.getOrderNo(), waitPakin.getMatnr(), null,detlDto.getAnfme()); |
| | | } |
| | | if (orderDetl!=null){ |
| | | waitPakin.setSPgNO(orderDetl.getSPgNO()); |
| | | waitPakin.setOutOrderNo(orderDetl.getOutOrderNo()); |
| | | } |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | |
| | | } |
| | | |
| | | // 获取商品列表 |
| | | for(CombParam.CombMat combMat : param.getCombMats()){ |
| | | for (CombParam.CombMat combMat : param.getCombMats()) { |
| | | Mat mat = matService.selectByMatnr(combMat.getMatnr()); |
| | | if (Cools.isEmpty(mat)){ |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(combMat.getMatnr() + ":商品档案不存在!"); |
| | | } |
| | | if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme()==0){ |
| | | if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme() == 0) { |
| | | throw new CoolException(combMat.getMatnr() + ":商品数量有误!"); |
| | | } |
| | | if (Cools.isEmpty(combMat.getBatch())){ |
| | | if (Cools.isEmpty(combMat.getBatch())) { |
| | | // throw new CoolException(combMat.getMatnr() + ":商品批号有误!"); |
| | | } |
| | | ManLocDetl manLocDetl = new ManLocDetl(); |
| | |
| | | @Override |
| | | public void offSale(OffSaleParam offSaleParam) { |
| | | ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); |
| | | if (Cools.isEmpty(manLocDetl)){ |
| | | if (Cools.isEmpty(manLocDetl)) { |
| | | throw new CoolException("无此商品!"); |
| | | } |
| | | double anfme = manLocDetl.getAnfme() - offSaleParam.getAnfme(); |
| | | if (anfme < 0) { |
| | | throw new CoolException("商品库存不足!"); |
| | | } else if (anfme == 0){ |
| | | } else if (anfme == 0) { |
| | | manLocDetlMapper.deleteLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); |
| | | } |
| | | manLocDetlMapper.updateAnfme0(anfme,manLocDetl.getNodeId()); |
| | | manLocDetlMapper.updateAnfme0(anfme, manLocDetl.getNodeId()); |
| | | } |
| | | |
| | | // 查找商品 |
| | |
| | | |
| | | // 添加明细 |
| | | for (WrkDetl wrkDetl : list) { |
| | | if (wrkDetl.getAnfme() == 0.0D) { continue; } |
| | | if (wrkDetl.getAnfme() == 0.0D) { |
| | | continue; |
| | | } |
| | | // todo 盘点记录、保存调整记录 |
| | | String orderNo = wrkDetl.getOrderNo(); |
| | | Mat mat = matService.selectByMatnr(wrkDetl.getMatnr()); |
| | |
| | | } |
| | | |
| | | // 修改盘点任务主档状态 |
| | | wrkMast.setFullPlt(wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()).size() != 0?"Y":"N"); |
| | | wrkMast.setFullPlt(wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()).size() != 0 ? "Y" : "N"); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | success = true; |
| | | } else if (jsonObject.getInteger("code").equals(500)) { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response); |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response); |
| | | throw new CoolException(jsonObject.getString("msg")); |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response); |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response); |
| | | throw new CoolException("上报mes系统失败"); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | } catch (Exception e) { |
| | | log.error("", e); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | // 修改作业数量 ---------------------------------------- |
| | | // 订单明细数量校验 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), detlDto.getMatnr(), detlDto.getBatch()); |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), detlDto.getMatnr(), detlDto.getBatch(),detlDto.getAnfme()); |
| | | if (detlDto.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | |
| | | |
| | | BasDevp sta = basDevpService.checkSiteStatus(staNo); |
| | | //根据订单号生成出库任务工作档 |
| | | Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", orderNo)); |
| | | if (order.getSettle() != 1 && order.getSettle() != 2){ |
| | | List<OrderDetl> pg_no = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("pg_no",orderNo)); |
| | | Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", pg_no.get(0).getOrderNo())); |
| | | 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){ |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | //查询所有库位状态为F的库位信息 |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(),orderDetl.getBatch(),null,null); |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, null); |
| | | if (locDetls.size() == 0) { |
| | | throw new CoolException("库存中没有该物料"); |
| | | } |
| | | for(LocDetl locDetl : locDetls){ |
| | | for (LocDetl locDetl : locDetls) { |
| | | //如果该库位出库路线所用的堆垛机out_enable不为Y,跳过该循环 |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", locDetl.getLocNo())); |
| | |
| | | } |
| | | BasCrnp crn_no = basCrnpService.selectOne(new EntityWrapper<BasCrnp>() |
| | | .eq("crn_no", locMast.getCrnNo())); |
| | | if (Cools.isEmpty(crn_no) || !crn_no.getOutEnable().equals("Y")){ |
| | | if (Cools.isEmpty(crn_no) || !crn_no.getOutEnable().equals("Y")) { |
| | | continue; |
| | | } |
| | | |
| | | //可出库数量 = 订单数量 - 作业中数量 |
| | | Double outQty = orderDetl.getAnfme() - orderDetl.getWorkQty(); |
| | | if(outQty <= 0){ |
| | | if (outQty <= 0) { |
| | | break; |
| | | } |
| | | // 判断入出库类型:101.全板出库 or 103.拣料出库 |
| | |
| | | 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); |
| | | orderDetl.setUpdateBy(userId); |
| | | orderDetl.setUpdateTime(now); |
| | | Wrapper wrapper = new EntityWrapper<OrderDetl>().eq("order_no", orderNo) |
| | | .eq("matnr",orderDetl.getMatnr()); |
| | | if(!Cools.isEmpty(orderDetl.getBatch())){ |
| | | .eq("matnr", orderDetl.getMatnr()); |
| | | if (!Cools.isEmpty(orderDetl.getBatch())) { |
| | | wrapper.eq("batch", orderDetl.getBatch()); |
| | | } |
| | | if(!orderDetlService.update(orderDetl, wrapper)){ |
| | | if (!orderDetlService.update(orderDetl, wrapper)) { |
| | | throw new CoolException("更新订单明细失败"); |
| | | } |
| | | } |