| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.EmptyPlateOutParam; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Autowired |
| | | private OrderDetlPakoutService orderDetlPakoutService; |
| | | |
| | | @Autowired |
| | | private InventoryReserveService inventoryReserveService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | List<LocDetlDto> locDetlDtos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { |
| | | if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) { |
| | | |
| | | List<InventoryReserve> inventoryReserves = inventoryReserveService.selectList(new EntityWrapper<InventoryReserve>() |
| | | .eq("matnr", paramLocDetl.getMatnr()) |
| | | .eq("batch", paramLocDetl.getBatch()) |
| | | .eq(!Cools.isEmpty(paramLocDetl.getBrand()), "brand", paramLocDetl.getBrand()) |
| | | .eq(!Cools.isEmpty(paramLocDetl.getStandby1()), "standby1", paramLocDetl.getStandby1()) |
| | | .eq(!Cools.isEmpty(paramLocDetl.getStandby2()), "standby2", paramLocDetl.getStandby2()) |
| | | .eq(!Cools.isEmpty(paramLocDetl.getStandby3()), "standby3", paramLocDetl.getStandby3()) |
| | | .eq(!Cools.isEmpty(paramLocDetl.getBoxType1()), "box_type1", paramLocDetl.getBoxType1()) |
| | | .eq(!Cools.isEmpty(paramLocDetl.getBoxType2()), "box_type2", paramLocDetl.getBoxType2()) |
| | | .eq(!Cools.isEmpty(paramLocDetl.getBoxType3()), "box_type3", paramLocDetl.getBoxType3()) |
| | | |
| | | ); |
| | | |
| | | List<LocDetl> locDetls = locDetlService.queryStockAll(null, null, paramLocDetl.getMatnr(), paramLocDetl.getBatch(), |
| | | paramLocDetl.getBrand(), paramLocDetl.getStandby1(), paramLocDetl.getStandby2(), paramLocDetl.getStandby3(), paramLocDetl.getBoxType1(), paramLocDetl.getBoxType2(), paramLocDetl.getBoxType3()); |
| | | |
| | | if (!Cools.isEmpty(inventoryReserves)) { |
| | | BigDecimal inventoryReserveQuantity = inventoryReserves.stream().map(InventoryReserve::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal locDetlQuantity = locDetls.stream().map(LocDetl::getAnfme).map(BigDecimal::valueOf).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | if (locDetlQuantity.subtract(new BigDecimal(paramLocDetl.getCount().toString())).compareTo(inventoryReserveQuantity) < 0) { |
| | | throw new CoolException("库存预留数量大于库存数量"); |
| | | } |
| | | } |
| | | |
| | | LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch(), paramLocDetl.getBrand() |
| | | , paramLocDetl.getStandby1(), paramLocDetl.getStandby2(), paramLocDetl.getStandby3(), paramLocDetl.getBoxType1(), paramLocDetl.getBoxType2(), paramLocDetl.getBoxType3()); |
| | | if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount())); |
| | |
| | | @Transactional |
| | | public void cancelWrkMast(String workNo, Long userId) { |
| | | Date now = new Date(); |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", workNo)); |
| | | if (Cools.isEmpty(wrkMast)) { |
| | | throw new CoolException(workNo + "工作档不存在"); |
| | | } |
| | |
| | | @Override |
| | | @Transactional |
| | | public void pickWrkMast(String workNo, Long userId) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", workNo)); |
| | | if (Cools.isEmpty(wrkMast)) { |
| | | throw new CoolException(workNo + "工作档不存在"); |
| | | } |