| | |
| | |
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
| | | import com.baomidou.mybatisplus.extension.service.IService;
|
| | | import com.zy.asrs.framework.common.R;
|
| | | import com.zy.asrs.framework.exception.CoolException;
|
| | | import com.zy.asrs.wms.asrs.entity.*;
|
| | |
| | | import com.zy.asrs.wms.system.entity.Host;
|
| | | import com.zy.asrs.wms.system.service.HostService;
|
| | | import io.netty.util.internal.StringUtil;
|
| | | import org.aspectj.weaver.ast.Or;
|
| | | import org.springframework.beans.BeanUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | |
| | | private WaveSeedLogService waveSeedLogService;
|
| | | @Autowired
|
| | | private OrderDetlLogService orderDetlLogService;
|
| | |
|
| | | @Autowired
|
| | | private PlatformDetlService platformDetlService;
|
| | | @Autowired
|
| | | private PlatformDetlLogService platformDetlLogService;
|
| | |
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | .eq(PickSheet::getDeleted, 0)
|
| | | .eq(PickSheet::getStatus, 1)
|
| | | );
|
| | | BeanUtils.copyProperties(pickSheet, pickDetlDto);
|
| | | if (Objects.isNull(pickDetlDto)) {
|
| | | throw new CoolException("对象复制失败!!");
|
| | | if (Objects.isNull(pickSheet)) {
|
| | | throw new CoolException("拣货单不存在!!");
|
| | | }
|
| | | BeanUtils.copyProperties(pickSheet, pickDetlDto);
|
| | |
|
| | | List<PickSheetDetl> sheetDetls = pickSheetDetlService.list(new LambdaQueryWrapper<PickSheetDetl>()
|
| | | .eq(PickSheetDetl::getPickId, pickSheet.getId())
|
| | | .eq(PickSheetDetl::getStatus, 1)
|
| | |
| | | throw new CoolException("数据错误!!");
|
| | | }
|
| | | //更新锁定库存
|
| | | BigDecimal workQty = BigDecimal.valueOf(detl.getAnfme()).subtract(pickDetl.getAnfme());
|
| | | detl.setWorkQty(workQty.doubleValue());
|
| | | // BigDecimal workQty = BigDecimal.valueOf(detl.getAnfme()).subtract(pickDetl.getAnfme());
|
| | | detl.setWorkQty(0.0);
|
| | | //计算结果小于等于零,移出库存明细
|
| | | BigDecimal qty = BigDecimal.valueOf(detl.getAnfme()).subtract(pickDetl.getAnfme());
|
| | | detl.setAnfme(qty.doubleValue());
|
| | |
| | | .set(Loc::getBarcode, null)
|
| | | .set(Loc::getUpdateTime, new Date())
|
| | | .set(Loc::getLocStsId, LocStsType.O.val()));
|
| | | if (update) {
|
| | | if (!update) {
|
| | | throw new CoolException("库存更新失败!! ");
|
| | | }
|
| | | }
|
| | |
| | | if (params.isEmpty()) {
|
| | | throw new CoolException("发货单据明细为空,不可执行发货操作!!");
|
| | | }
|
| | |
|
| | | //获取当前上传所有订单号
|
| | | Set<String> orderNoSet = params.stream().map(ShippingOrderDetlDto::getOrderNo).collect(Collectors.toSet());
|
| | | if (orderNoSet.isEmpty()) {
|
| | | throw new CoolException("主单信息不存在,请核对出库订单!!");
|
| | | }
|
| | |
|
| | | List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getOrderNo, orderNoSet));
|
| | | if (orderList.isEmpty()) {
|
| | | throw new CoolException("订单不存在!!");
|
| | | }
|
| | |
|
| | | params.forEach(order -> {
|
| | | OrderDetl byId = orderDetlService.getById(order.getId());
|
| | | if (Objects.isNull(byId)) {
|
| | |
| | | }
|
| | | });
|
| | |
|
| | | //获取当前上传所有订单号
|
| | | Set<String> orderNoSet = params.stream().map(ShippingOrderDetlDto::getOrderNo).collect(Collectors.toSet());
|
| | | if (orderNoSet.isEmpty()) {
|
| | | throw new CoolException("主单信息不存在,请核对出库订单!!");
|
| | | }
|
| | |
|
| | | List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getOrderNo, orderNoSet));
|
| | | if (orderList.isEmpty()) {
|
| | | throw new CoolException("订单不存在!!");
|
| | | }
|
| | | orderList.forEach(one -> {
|
| | | OrderLog orderLog = new OrderLog();
|
| | | BeanUtils.copyProperties(one, orderLog);
|
| | |
| | | if (waveIds.isEmpty()) {
|
| | | throw new CoolException("波次信息为空!!");
|
| | | }
|
| | | List<Wave> waves = waveService.list(new LambdaQueryWrapper<Wave>().eq(Wave::getId, waveIds));
|
| | | List<Wave> waves = waveService.list(new LambdaQueryWrapper<Wave>().in(Wave::getId, waveIds));
|
| | | for (Wave wave : waves) {
|
| | | WaveLog waveLog = new WaveLog();
|
| | | waveLog.sync(wave);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | Set<Long> ordersSet = orderList.stream().map(Order::getId).collect(Collectors.toSet());
|
| | | List<PlatformDetl> platDetls = platformDetlService.list(new LambdaQueryWrapper<PlatformDetl>().in(PlatformDetl::getOrderId, ordersSet));
|
| | | if (platDetls.isEmpty()) {
|
| | | throw new CoolException("订单信息未进集货区!!");
|
| | | }
|
| | | ArrayList<PlatformDetlLog> platformDetls = new ArrayList<>();
|
| | | platDetls.forEach(plat -> {
|
| | | PlatformDetlLog detl = new PlatformDetlLog();
|
| | | BeanUtils.copyProperties(plat, detl);
|
| | | detl.setId(null);
|
| | | platformDetls.add(detl);
|
| | | });
|
| | | //集货区转历史档
|
| | | if (!platformDetlLogService.saveBatch(platformDetls)) {
|
| | | throw new CoolException("集货区订单转历史档失败!!");
|
| | | }
|
| | |
|
| | | return R.ok("发货完成!!");
|
| | | }
|
| | |
|