| | |
| | | List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | double issued = Optional.ofNullable(orderDetl.getAnfme()).orElse(0.0D) ; |
| | | double issued = Optional.ofNullable(orderDetl.getAnfme()).orElse(0.0D); |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | |
| | | |
| | | OrderDetl selectItem(@Param("orderId") Long orderId, @Param("matnr") String matnr, @Param("batch") String batch); |
| | | |
| | | OrderDetl selectItemByOrderNo(@Param("orderNo") String orderNo, @Param("matnr") String matnr, @Param("batch") String batch); |
| | | |
| | | List<OrderDetl> selectWorkingDetls(Long orderId); |
| | | |
| | | int increase(@Param("orderId")Long orderId, @Param("matnr")String matnr, @Param("batch")String batch, @Param("qty")Double qty); |
| | |
| | | |
| | | OrderDetl selectItem(Long orderId, String matnr, String batch); |
| | | |
| | | OrderDetl selectItem(String orderNo, String matnr, String batch); |
| | | |
| | | OrderDetl findByLook(List<OrderDetl> orderDetls, Long orderId, String matnr, String batch); |
| | | |
| | | boolean increase(Long orderId, String matnr, String batch, Double qty); |
| | |
| | | |
| | | List<Integer> queryOutStaNosByLocNo(String locNo, Integer typeNo); |
| | | |
| | | StaDesc queryCrnStn(Integer typeNo, Integer crnNo, Integer stnNo); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetl selectItem(String orderNo, String matnr, String batch) { |
| | | return this.baseMapper.selectItemByOrderNo(orderNo, matnr, batch); |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetl findByLook(List<OrderDetl> orderDetls, Long orderId, String matnr, String batch) { |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | if (orderDetl.getOrderId().equals(orderId) && orderDetl.getMatnr().equals(matnr)) { |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.StaDesc; |
| | | import com.zy.asrs.mapper.StaDescMapper; |
| | | import com.zy.asrs.service.StaDescService; |
| | |
| | | public List<Integer> queryOutStaNosByLocNo(String locNo, Integer typeNo) { |
| | | return this.baseMapper.queryOutStaNosByLocNo(locNo, typeNo); |
| | | } |
| | | |
| | | @Override |
| | | public StaDesc queryCrnStn(Integer typeNo, Integer crnNo, Integer stnNo) { |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", typeNo) |
| | | .eq("stn_no", stnNo) |
| | | .eq("crn_no", crnNo); |
| | | StaDesc staDesc = this.selectOne(wrapper); |
| | | if (staDesc == null) { |
| | | wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", typeNo) |
| | | .eq("crn_no", crnNo); |
| | | List<StaDesc> staDescs = this.selectList(wrapper); |
| | | if (Cools.isEmpty(staDescs)) { |
| | | throw new CoolException("出库路径不存在"); |
| | | } |
| | | // todo:luxiaotao |
| | | return staDescs.get(0); |
| | | } |
| | | return staDesc; |
| | | } |
| | | |
| | | } |
| | |
| | | private WmsService wmsService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(taskDto.getLocNo()); |
| | | // 获取路径 |
| | | Integer ioType = taskDto.isAll() ? 101 : 103; |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", ioType) |
| | | .eq("stn_no", staNo.getDevNo()) |
| | | .eq("crn_no", locMast.getCrnNo()); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | throw new CoolException("出库路径不存在"); |
| | | } |
| | | int ioType = taskDto.isAll() ? 101 : 103; |
| | | StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), staNo.getDevNo()); |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType)); |
| | | // 生成工作档 |
| | |
| | | } |
| | | // 生成工作档明细 |
| | | for (LocDto locDto : taskDto.getLocDtos()) { |
| | | // 出库时,数量为0的直接忽略 |
| | | if (detlDto.getCount()==null || detlDto.getCount() <= 0.0D) {continue;} |
| | | if (locDto.getAnfme()==null || locDto.getAnfme() <= 0.0D) { continue; } |
| | | |
| | | OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); |
| | | |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setIoTime(now); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(new Date()); |
| | | Double anfme = ioType==101?detlDto.getLocDetl().getAnfme():detlDto.getCount(); |
| | | wrkDetl.setAnfme(anfme); // 数量 |
| | | VersionUtils.setWrkDetl(wrkDetl, detlDto.getLocDetl()); // 版本控制 |
| | | wrkDetl.setBatch(locDto.getBatch()); |
| | | wrkDetl.setOrderNo(locDto.getOrderNo()); |
| | | wrkDetl.setAnfme(locDto.getAnfme()); // 数量 |
| | | VersionUtils.setWrkDetl(wrkDetl, orderDetl); // 版本控制 |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(now); |
| | |
| | | waitPakIn.setAltme(orderDetl.getUnit()); // 单位 |
| | | } |
| | | |
| | | public static void setWrkDetl(WrkDetl wrkDetl, OrderDetl orderDetl) { |
| | | wrkDetl.setMatnr(orderDetl.getMatnr()); // 物料编号 |
| | | wrkDetl.setMaktx(orderDetl.getMaktx()); // 物料描述 |
| | | wrkDetl.setBatch(orderDetl.getBatch()); |
| | | wrkDetl.setOrderNo(orderDetl.getOrderNo()); |
| | | wrkDetl.setLgnum(orderDetl.getSpecs()); // 规格 |
| | | wrkDetl.setType(orderDetl.getModel()); // 型号 |
| | | wrkDetl.setSupplier(orderDetl.getSupplier()); // 批号 |
| | | wrkDetl.setAltme(orderDetl.getUnit()); // 单位 |
| | | } |
| | | |
| | | |
| | | // excel ---------------------------------------------------------------------- |
| | | |
| | |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/3/28 |
| | |
| | | // 汇总不考虑批号 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | for (LocDto locDto : this.getLocDtos()) { |
| | | DetlDto dto = new DetlDto(locDto.getMatnr(), null, locDto.getAnfme()); |
| | | DetlDto dto = new DetlDto(locDto.getMatnr(), locDto.getBatch(), locDto.getAnfme()); |
| | | if (DetlDto.has(detlDtos, dto)) { |
| | | DetlDto detlDto = DetlDto.find(detlDtos, locDto.getMatnr(), null); |
| | | DetlDto detlDto = DetlDto.find(detlDtos, locDto.getMatnr(), dto.getBatch()); |
| | | assert detlDto != null; |
| | | detlDto.setAnfme(detlDto.getAnfme() + locDto.getAnfme()); |
| | | } else { |
| | | detlDtos.add(new DetlDto(locDto.getMatnr(), null, locDto.getAnfme())); |
| | | detlDtos.add(new DetlDto(locDto.getMatnr(), locDto.getBatch(), locDto.getAnfme())); |
| | | } |
| | | } |
| | | |
| | | // 查询当前库位号所有的库存明细 |
| | | LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class); |
| | | // todo |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", this.locNo)); |
| | | if (locDetls == null || locDetls.isEmpty()){ |
| | | throw new CoolException("计算满板失败,库位号=" + this.locNo); |
| | | throw new CoolException("检索库存明细失败,库位号=" + this.locNo); |
| | | } |
| | | int sameNumber = 0; |
| | | for (LocDetl locDetl : locDetls) { |
| | | for (DetlDto detlDto : detlDtos) { |
| | | if (detlDto.getLocDetl().getMatnr().equals(locDetl.getMatnr()) && dto.getCount().equals(locDetl.getAnfme())) { |
| | | Iterator<DetlDto> iterator = detlDtos.iterator(); |
| | | while (iterator.hasNext()) { |
| | | DetlDto dto = iterator.next(); |
| | | if (!dto.getMatnr().equals(locDetl.getMatnr())) { |
| | | continue; |
| | | } |
| | | if (Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) { |
| | | continue; |
| | | } |
| | | if (!Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(locDetl.getBatch())) { |
| | | continue; |
| | | } |
| | | if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) { |
| | | if (!dto.getBatch().equals(locDetl.getBatch())) { |
| | | continue; |
| | | } |
| | | } |
| | | if (dto.getAnfme() > locDetl.getAnfme()) { |
| | | throw new CoolException("服务器内部错误"); |
| | | } |
| | | if (dto.getAnfme().equals(locDetl.getAnfme())) { |
| | | sameNumber++; |
| | | iterator.remove(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | order by |
| | | DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time) |
| | | desc, |
| | | NEWID(), |
| | | case |
| | | when (left(a.loc_no, 2) = '01') then 0 |
| | | when (left(a.loc_no, 2) = '02') then 1 |
| | |
| | | </choose> |
| | | </select> |
| | | |
| | | <select id="selectItemByOrderNo" resultMap="BaseResultMap"> |
| | | select * from man_order_detl |
| | | where 1=1 |
| | | and order_no = #{orderNo} |
| | | and matnr = #{matnr} |
| | | <choose> |
| | | <when test="batch != null and batch != ''"> |
| | | and batch = #{batch} |
| | | </when> |
| | | <otherwise> |
| | | and (batch IS NULL OR batch = '') |
| | | </otherwise> |
| | | </choose> |
| | | </select> |
| | | |
| | | <select id="selectWorkingDetls" resultMap="BaseResultMap"> |
| | | select * from man_order_detl |
| | | where 1=1 |