| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.*; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.MesCombParam; |
| | | import com.zy.common.model.enums.WorkNoType; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.nc.entity.NccJcQilibcBarcodeflowWms; |
| | | import com.zy.nc.service.NccJcQilibcBarcodeflowWmsService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | public R WarehouseOutPickMergeV1(WarehouseOutPickMergeParam param, Long hostId, Long userId) { |
| | | //判断库位状态 |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getLocNo())); |
| | | if (Cools.isEmpty(locMast)){ |
| | | if (Cools.isEmpty(locMast)) { |
| | | return R.error("该库位不存在"); |
| | | } |
| | | if (!locMast.getLocSts().equals("P")){ |
| | | return R.error("该库位状态为:"+locMast.getLocSts()+",不满足拣料途中并板条件!!!"); |
| | | if (!locMast.getLocSts().equals("P")) { |
| | | return R.error("该库位状态为:" + locMast.getLocSts() + ",不满足拣料途中并板条件!!!"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | |
| | | wrkMastService.insert(wrkMast); |
| | | |
| | | for (OrderDetl orderDetl : param.getCombMats()) { |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr",orderDetl.getMatnr())); |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", orderDetl.getMatnr())); |
| | | if (mat == null) { |
| | | throw new CoolException("保存工作档失败,物料信息不存在:" + orderDetl.getMatnr()); |
| | | } |
| | |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setZpallet(wrkMast.getBarcode()); |
| | | wrkDetl.setBatch(orderDetl.getBatch()); |
| | | if(Cools.isEmpty(orderDetl.getBatch())){ |
| | | if (Cools.isEmpty(orderDetl.getBatch())) { |
| | | wrkDetl.setBatch(""); |
| | | } |
| | | wrkDetl.setBoxType1(orderDetl.getBoxType1()); |
| | |
| | | |
| | | if (!Cools.isEmpty(orderDetl.getOrderNo())) { |
| | | OrderPakin order = orderPakinService.selectByNo(orderDetl.getOrderNo()); |
| | | if (Cools.isEmpty(order)){ |
| | | if (Cools.isEmpty(order)) { |
| | | continue; |
| | | } |
| | | OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch(),orderDetl.getBrand(),orderDetl.getStandby1(),orderDetl.getStandby2(),orderDetl.getStandby3(),orderDetl.getBoxType1(),orderDetl.getBoxType2(),orderDetl.getBoxType3()); |
| | | if (Cools.isEmpty(orderDetlPakin)){ |
| | | OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getBrand(), orderDetl.getStandby1(), orderDetl.getStandby2(), orderDetl.getStandby3(), orderDetl.getBoxType1(), orderDetl.getBoxType2(), orderDetl.getBoxType3()); |
| | | if (Cools.isEmpty(orderDetlPakin)) { |
| | | continue; |
| | | } |
| | | if (orderDetlPakin.getAnfme() < (orderDetlPakin.getWorkQty() + orderDetl.getAnfme())) { |
| | |
| | | } |
| | | // 修改订单明细作业数量 |
| | | if (!orderDetlPakinService.increaseWorkQty(orderDetlPakin.getOrderId(), orderDetlPakin.getMatnr(), orderDetlPakin.getBatch(), orderDetlPakin.getBrand(), |
| | | orderDetlPakin.getStandby1(), orderDetlPakin.getStandby2(), orderDetlPakin.getStandby3(), orderDetlPakin.getBoxType1(), orderDetlPakin.getBoxType2(), orderDetlPakin.getBoxType3(),orderDetl.getAnfme())) { |
| | | orderDetlPakin.getStandby1(), orderDetlPakin.getStandby2(), orderDetlPakin.getStandby3(), orderDetlPakin.getBoxType1(), orderDetlPakin.getBoxType2(), orderDetlPakin.getBoxType3(), orderDetl.getAnfme())) { |
| | | throw new CoolException("修改单据明细工作数量失败"); |
| | | } |
| | | |
| | | if (order.getSettle() == 1){ |
| | | if (order.getSettle() == 1) { |
| | | orderPakinService.updateSettle(order.getId(), 2L, userId); |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R pickConfirm(PickConfirmParam param,Long userId) { |
| | | public R pickConfirm(PickConfirmParam param, Long userId) { |
| | | |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", param.getLocNo())); |
| | |
| | | //检验传参是否和订单明细匹配 |
| | | for (PickMatParam matParam : param.getList()) { |
| | | orderDetlPakin = orderDetlPakinService.selectItem |
| | | (matParam.getOrderNo(), matParam.getMatnr(),matParam.getBatch(),matParam.getBrand(), |
| | | matParam.getStandby1(),matParam.getStandby2(),matParam.getStandby3(), |
| | | matParam.getBoxType1(),matParam.getBoxType2(),matParam.getBoxType3()); |
| | | (matParam.getOrderNo(), matParam.getMatnr(), matParam.getBatch(), matParam.getBrand(), |
| | | matParam.getStandby1(), matParam.getStandby2(), matParam.getStandby3(), |
| | | matParam.getBoxType1(), matParam.getBoxType2(), matParam.getBoxType3()); |
| | | if (orderDetlPakin == null) { |
| | | return R.error("物料数据不存在"); |
| | | } |
| | |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setZpallet(wrkMast.getBarcode()); |
| | | if(Cools.isEmpty(matParam.getBatch())){ |
| | | if (Cools.isEmpty(matParam.getBatch())) { |
| | | wrkDetl.setBatch(""); |
| | | } |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | |
| | | |
| | | //更新订单工作数量 |
| | | orderDetlPakinService.increaseWorkQty(orderDetlPakin.getOrderId(), matParam.getMatnr(), |
| | | matParam.getBatch(),matParam.getBrand(),matParam.getStandby1(),matParam.getStandby2(),matParam.getStandby3(), |
| | | matParam.getBoxType1(),matParam.getBoxType2(),matParam.getBoxType3(),matParam.getUseCount()); |
| | | matParam.getBatch(), matParam.getBrand(), matParam.getStandby1(), matParam.getStandby2(), matParam.getStandby3(), |
| | | matParam.getBoxType1(), matParam.getBoxType2(), matParam.getBoxType3(), matParam.getUseCount()); |
| | | // 更新工作档状态 |
| | | orderPakinService.updateSettle(orderDetlPakin.getOrderId(),2L,userId); |
| | | orderPakinService.updateSettle(orderDetlPakin.getOrderId(), 2L, userId); |
| | | } |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getLocNo())); |
| | |
| | | public R WarehouseOutV1(CombParam combParam, Long hostId, Long userId) { |
| | | //判断库位状态 |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", combParam.getLocNo())); |
| | | if (Cools.isEmpty(locMast)){ |
| | | if (Cools.isEmpty(locMast)) { |
| | | return R.error("该库位不存在"); |
| | | } |
| | | if (!locMast.getLocSts().equals("P")){ |
| | | return R.error("该库位状态为:"+locMast.getLocSts()+",不满足并板途中拣选条件!!!"); |
| | | if (!locMast.getLocSts().equals("P")) { |
| | | return R.error("该库位状态为:" + locMast.getLocSts() + ",不满足并板途中拣选条件!!!"); |
| | | } |
| | | //查询库存数据 |
| | | for (CombParam.CombMat combMat :combParam.getCombMats()){ |
| | | for (CombParam.CombMat combMat : combParam.getCombMats()) { |
| | | List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>() |
| | | .eq("loc_no", combParam.getLocNo()) |
| | | .eq("matnr", combMat.getMatnr()) |
| | | .eq("loc_no", combParam.getLocNo()) |
| | | .eq("matnr", combMat.getMatnr()) |
| | | ); |
| | | if (locDetlList.isEmpty()){ |
| | | if (locDetlList.isEmpty()) { |
| | | return R.error("未查询到库存数据"); |
| | | } |
| | | if (locDetlList.size()>1){ |
| | | if (locDetlList.size() > 1) { |
| | | return R.error("库存数据大于1条,为保证数据准确性,请用正常流程出库!!!"); |
| | | } |
| | | LocDetl locDetl = locDetlList.get(0); |
| | | if (combMat.getAnfme() > locDetl.getAnfme()){ |
| | | if (combMat.getAnfme() > locDetl.getAnfme()) { |
| | | return R.error("拣选数量错误,超出库存数量"); |
| | | } |
| | | if (!Cools.isEmpty(combMat.getOrderNo())){ |
| | | if (!Cools.isEmpty(combMat.getOrderNo())) { |
| | | OrderPakout orderPakout = orderPakoutService.selectByNo(combMat.getOrderNo()); |
| | | if (Cools.isEmpty(orderPakout)){ |
| | | if (Cools.isEmpty(orderPakout)) { |
| | | continue; |
| | | } |
| | | if (orderPakout.getSettle() == 1){ |
| | | OrderInAndOutUtil.updateOrder(false,orderPakout.getId(), 2L, 9527L); |
| | | if (orderPakout.getSettle() == 1) { |
| | | OrderInAndOutUtil.updateOrder(false, orderPakout.getId(), 2L, 9527L); |
| | | } |
| | | OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(orderPakout.getId(), combMat.getMatnr(), combMat.getBatch(), |
| | | combMat.getBrand(), combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3()); |
| | | if (Cools.isEmpty(orderDetlPakout)){ |
| | | if (Cools.isEmpty(orderDetlPakout)) { |
| | | continue; |
| | | } |
| | | if (orderDetlPakout.getAnfme() < (orderDetlPakout.getWorkQty()+combMat.getAnfme())){ |
| | | if (orderDetlPakout.getAnfme() < (orderDetlPakout.getWorkQty() + combMat.getAnfme())) { |
| | | throw new CoolException("拣选数量出错,订单剩余出库数量小于已出库数量与将拣选数量之和!!!"); |
| | | } |
| | | // 修改订单明细作业数量 |
| | | if (!orderDetlPakoutService.increaseWorkQty(orderDetlPakout.getOrderId(), combMat.getMatnr(), combMat.getBatch(), combMat.getBrand(), |
| | | combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3(),combMat.getAnfme())) { |
| | | combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3(), combMat.getAnfme())) { |
| | | throw new CoolException("修改单据明细工作数量失败"); |
| | | } |
| | | // // 修改订单明细完成数量 |
| | |
| | | wrkMast.setModiUser(userId); |
| | | wrkMastService.insert(wrkMast); |
| | | |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr",combMat.getMatnr())); |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", combMat.getMatnr())); |
| | | if (mat == null) { |
| | | throw new CoolException("保存工作档失败,物料信息不存在:" + combMat.getMatnr()); |
| | | } |
| | |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setZpallet(wrkMast.getBarcode()); |
| | | wrkDetl.setBatch(combMat.getBatch()); |
| | | if(Cools.isEmpty(combMat.getBatch())){ |
| | | if (Cools.isEmpty(combMat.getBatch())) { |
| | | wrkDetl.setBatch(""); |
| | | } |
| | | wrkDetl.setBoxType1(combMat.getBoxType1()); |
| | |
| | | wrkDetlService.insert(wrkDetl); |
| | | System.out.println("正常"); |
| | | |
| | | }catch (Exception e) { |
| | | throw new CoolException("操作数据异常:"+e.getMessage()); |
| | | } catch (Exception e) { |
| | | throw new CoolException("操作数据异常:" + e.getMessage()); |
| | | } |
| | | } |
| | | return R.ok("操作成功!"); |
| | |
| | | Wrapper<OrderDetl> wrapper1 = new EntityWrapper<>(); |
| | | wrapper1.eq("status", 1); |
| | | wrapper1.in("order_id", orderIds); |
| | | wrapper1.orderBy("create_time",false); |
| | | wrapper1.orderBy("create_time", false); |
| | | if (!Cools.isEmpty(matnr)) { |
| | | wrapper1.like("matnr", matnr); |
| | | } |
| | |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | if(param.getCombMats().size()>1){ |
| | | if (param.getCombMats().size() > 1) { |
| | | throw new CoolException("请提取一个商品,或者刷新重新组托!"); |
| | | } |
| | | // 判断是否有相同条码的数据 |
| | |
| | | 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){ |
| | | 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()); |
| | | } |
| | |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), |
| | | elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), |
| | | elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.findDto(detlDtos, detlDto); |
| | | assert one != null; |
| | |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | // 关联组托 |
| | | // 关联组托 |
| | | } else { |
| | | // Order order = orderService.selectByNo(param.getOrderNo()); |
| | | Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, param.getOrderNo()); |
| | |
| | | |
| | | param.getCombMats().forEach(elem -> { |
| | | // TODO 不考虑代码效率,因为旧代码bug少 |
| | | if (!Cools.isEmpty(elem.getVbarcode())){ |
| | | if (!Cools.isEmpty(elem.getVbarcode())) { |
| | | NccJcQilibcBarcodeflowWms vbarcode1 = barcodeflowWmsService.selectOne(new EntityWrapper<NccJcQilibcBarcodeflowWms>().eq("vbarcode", elem.getVbarcode())); |
| | | |
| | | elem.setBatch(vbarcode1.getVbatchcode()); |
| | | elem.setMatnr(vbarcode1.getWlbm()); |
| | | elem.setAnfme(vbarcode1.getNastnum().doubleValue()); |
| | | } |
| | | |
| | | // 订单明细数量校验 |
| | | // OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); |
| | | OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), |
| | | elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3()); |
| | | OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), |
| | | elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3()); |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | |
| | | // if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) { |
| | | // throw new CoolException("修改单据作业数量失败"); |
| | | // } |
| | | OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE,order.getId(), elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), |
| | | elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), |
| | | elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); |
| | | OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), |
| | | elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), |
| | | elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.findDto(detlDtos, detlDto); |
| | | assert one != null; |
| | |
| | | } |
| | | } |
| | | // orderService.updateSettle(order.getId(), 2L, userId); |
| | | OrderInAndOutUtil.updateOrder(Boolean.TRUE,order.getId(), 2L, userId); |
| | | OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | // 获取商品列表 |
| | | 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)) { |
| | |
| | | //根据订单号生成出库任务工作档 |
| | | Order order = OrderInAndOutUtil.selectByNo(Boolean.FALSE, orderNo); |
| | | // Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", orderNo)); |
| | | if (order.getSettle() != 1 && order.getSettle() != 2){ |
| | | if (order.getSettle() != 1 && order.getSettle() != 2) { |
| | | throw new CoolException("该订单已处理"); |
| | | } |
| | | |
| | |
| | | List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(Boolean.FALSE, order.getId()); |
| | | |
| | | 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.拣料出库 |
| | |
| | | // if(!orderService.update(order, new EntityWrapper<Order>().eq("order_no", orderNo))){ |
| | | // throw new CoolException("更新订单状态失败"); |
| | | // } |
| | | OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(),order.getId(),2L,userId); |
| | | OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(), order.getId(), 2L, userId); |
| | | 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)){ |
| | | // throw new CoolException("更新订单明细失败"); |
| | | // } |
| | | OrderInAndOutUtil.updateOrderDetl(order.getPakinPakoutStatus$(),order,orderDetl); |
| | | OrderInAndOutUtil.updateOrderDetl(order.getPakinPakoutStatus$(), order, orderDetl); |
| | | |
| | | } |
| | | |