| | |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | private ManLocDetlService manLocDetlService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | |
| | | // 生成工作档明细 |
| | | for (LocDetlDto detlDto : dto.getLocDetlDtos()) { |
| | | if (detlDto.getCount()==null || detlDto.getCount() <= 0.0D) {continue;} |
| | | String uuid = String.valueOf(System.currentTimeMillis()); |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(detlDto.getLocDetl()); |
| | | wrkDetl.setOrderNo(""); // 手动出库不需要带出库存中的单据编号 |
| | |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setUuid(uuid); |
| | | wrkDetl.setOwner(detlDto.getLocDetl().getOwner()); |
| | | wrkDetl.setPayment(detlDto.getLocDetl().getPayment()); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | |
| | | // if (orderDetl == null) { |
| | | // orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null); |
| | | // } |
| | | String uuid = String.valueOf(System.currentTimeMillis()); |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(orderDetl); |
| | | wrkDetl.setZpallet(wrkMast.getBarcode()); |
| | |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setUuid(uuid); |
| | | wrkDetl.setOwner(orderDetl.getOwner()); |
| | | wrkDetl.setPayment(orderDetl.getPayment()); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | |
| | | throw new CoolException("请提取明细"); |
| | | } |
| | | ArrayList<String> locNos = new ArrayList<>(); |
| | | String[][] locNos2 =new String[param.getLocDetls().size()][2]; |
| | | int i=0; |
| | | for (EmptyPlateOutParam.LocDetl locDetl : param.getLocDetls()){ |
| | | if (!locNos.contains(locDetl.getLocNo())){ |
| | | locNos.add(locDetl.getLocNo()); |
| | | locNos2[i][0]=locDetl.getLocNo(); |
| | | locNos2[i][1]=locDetl.getManu(); |
| | | i++; |
| | | } |
| | | } |
| | | LocOwner locOwner = locOwnerService.selectById(param.getOwnerId()); |
| | |
| | | String lgort = ""; |
| | | String owner=""; |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | for (String locNo : locNos) { |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locNo)); |
| | | for (LocDetl locDetl:locDetls){ |
| | | if (Cools.isEmpty(lgort)) { |
| | | lgort = locDetl.getOrigin(); |
| | | for (String[] locNo1 : locNos2) { |
| | | String locNo = locNo1[0]; |
| | | if (locNo1[1].equals("平库")){ |
| | | List<ManLocDetl> manLocDetls = manLocDetlService.selectList(new EntityWrapper<ManLocDetl>().eq("loc_no", locNo)); |
| | | for (ManLocDetl manLocDetl:manLocDetls){ |
| | | if (Cools.isEmpty(owner)) { |
| | | owner = manLocDetl.getOwner$(); |
| | | } |
| | | detlDtos.add(new DetlDto(manLocDetl.getMatnr(), manLocDetl.getBatch(), manLocDetl.getAnfme())); |
| | | manLocDetl.setOwner(param.getOwnerId()); |
| | | try{ |
| | | manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>().eq("loc_no", locNo).eq("uuid",manLocDetl.getUuid())); |
| | | }catch (Exception e){ |
| | | throw new Exception("更新库存明细拥有者字段信息出错了"); |
| | | } |
| | | } |
| | | if (Cools.isEmpty(owner)) { |
| | | owner = locDetl.getOwner$(); |
| | | }else if (locNo1[1].equals("立库")){ |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locNo)); |
| | | for (LocDetl locDetl:locDetls){ |
| | | if (Cools.isEmpty(lgort)) { |
| | | lgort = locDetl.getOrigin(); |
| | | } |
| | | if (Cools.isEmpty(owner)) { |
| | | owner = locDetl.getOwner$(); |
| | | } |
| | | detlDtos.add(new DetlDto(locDetl.getMatnr(), locDetl.getBatch(), locDetl.getAnfme())); |
| | | locDetl.setOwner(param.getOwnerId()); |
| | | try{ |
| | | locDetlService.update(locDetl,new EntityWrapper<LocDetl>().eq("loc_no", locNo).eq("uuid",locDetl.getUuid())); |
| | | }catch (Exception e){ |
| | | throw new Exception("更新库存明细拥有者字段信息出错了"); |
| | | } |
| | | } |
| | | detlDtos.add(new DetlDto(locDetl.getMatnr(), locDetl.getBatch(), locDetl.getAnfme())); |
| | | locDetl.setOwner(param.getOwnerId()); |
| | | try{ |
| | | locDetlService.update(locDetl,new EntityWrapper<LocDetl>().eq("loc_no", locNo).eq("matnr",locDetl.getMatnr()).eq("batch",locDetl.getBatch()).eq("anfme",locDetl.getAnfme())); |
| | | }catch (Exception e){ |
| | | throw new Exception("更新库存明细拥有者字段信息出错了"); |
| | | } |
| | | } |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locNo)); |
| | | try { |
| | | locMastService.update(locMast,new EntityWrapper<LocMast>().eq("loc_no",locMast.getLocNo())); |
| | | }catch (Exception e){ |
| | | }else { |
| | | throw new Exception("更新库位拥有者字段信息出错了"); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void turnOverOutPayment(EmptyPlateOutParam param, Long userId) { |
| | | try { |
| | | if (param.getLocDetls().size()<=0){ |
| | | throw new CoolException("请提取明细"); |
| | | } |
| | | ArrayList<String> locNos = new ArrayList<>(); |
| | | String[][] locNos2 =new String[param.getLocDetls().size()][2]; |
| | | int i=0; |
| | | for (EmptyPlateOutParam.LocDetl locDetl : param.getLocDetls()){ |
| | | if (!locNos.contains(locDetl.getLocNo())){ |
| | | locNos.add(locDetl.getLocNo()); |
| | | locNos2[i][0]=locDetl.getLocNo(); |
| | | locNos2[i][1]=locDetl.getManu(); |
| | | i++; |
| | | } |
| | | } |
| | | for (String[] locNo1 : locNos2) { |
| | | String locNo = locNo1[0]; |
| | | if (locNo1[1].equals("平库")){ |
| | | List<ManLocDetl> manLocDetls = manLocDetlService.selectList(new EntityWrapper<ManLocDetl>().eq("loc_no", locNo)); |
| | | for (ManLocDetl manLocDetl:manLocDetls){ |
| | | manLocDetl.setPayment(1); |
| | | try{ |
| | | manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>().eq("loc_no", locNo).eq("uuid",manLocDetl.getUuid())); |
| | | }catch (Exception e){ |
| | | throw new Exception("更新库存明细货物形态字段信息出错了"); |
| | | } |
| | | } |
| | | }else if (locNo1[1].equals("立库")){ |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locNo)); |
| | | for (LocDetl locDetl:locDetls){ |
| | | locDetl.setPayment(1); |
| | | try{ |
| | | locDetlService.update(locDetl,new EntityWrapper<LocDetl>().eq("loc_no", locNo).eq("uuid",locDetl.getUuid())); |
| | | }catch (Exception e){ |
| | | throw new Exception("更新库存明细货物形态字段信息出错了"); |
| | | } |
| | | } |
| | | }else { |
| | | throw new Exception("更新库位货物形态字段信息出错了"); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | throw new CoolException("货物形态转换出错了:"+e); |
| | | } |
| | | } |
| | | |
| | | } |