| | |
| | | import com.zy.asrs.wms.asrs.service.*;
|
| | | import com.zy.asrs.wms.system.entity.Host;
|
| | | import com.zy.asrs.wms.system.service.HostService;
|
| | | import org.springframework.beans.BeanUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Objects;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | @Service
|
| | | public class MobileServiceImpl implements MobileService {
|
| | |
| | | @Autowired
|
| | | private WaitPakinService waitPakinService;
|
| | | @Autowired
|
| | | private WaitPakinLogService waitPakinLogService;
|
| | | @Autowired
|
| | | private WorkService workService;
|
| | | @Autowired
|
| | | private HostService hostService;
|
| | | @Autowired
|
| | | private OrderService orderService;
|
| | | @Autowired
|
| | | private OrderLogService orderLogService;
|
| | | @Autowired
|
| | | private LocService locService;
|
| | | @Autowired
|
| | |
| | |
|
| | | //判断当前仓库是否为平库位
|
| | | List<LocArea> locAreas = locAreaService.list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getLocId, loc.getId()));
|
| | | if (locAreas.isEmpty()) {
|
| | | throw new CoolException("库位没有分配所属仓库区域!!");
|
| | | }
|
| | | locAreas.forEach(locArea -> {
|
| | | LocAreaType typeServiceOne = locAreaTypeService.getOne(new LambdaQueryWrapper<LocAreaType>().eq(LocAreaType::getId, locArea.getTypeId()), false);
|
| | | if (typeServiceOne.getParentId() != LocAreaTypeSts.LOC_AREA_TYPE_FLAT.id && typeServiceOne.getId() != LocAreaTypeSts.LOC_AREA_TYPE_FLAT.id) {
|
| | |
| | | loc.setUpdateTime(new Date());
|
| | | //库存状态修改为在库状态
|
| | | loc.setLocStsId(LocStsType.F.val());
|
| | | if (!locService.save(loc)) {
|
| | | if (!locService.updateById(loc)) {
|
| | | throw new CoolException("库位更新失败!!");
|
| | | }
|
| | |
|
| | |
| | | LocDetl locDetl = new LocDetl();
|
| | | locDetl.setAnfme(pakin.getAnfme());
|
| | | locDetl.setBatch(pakin.getBatch());
|
| | | locDetl.setMatnr(pakin.getMatnr());
|
| | | locDetl.setMatId(pakin.getMatnrId$());;
|
| | | locDetl.setCreateTime(new Date());
|
| | | locDetl.setOrderNo(pakin.getOrderNo());
|
| | | locDetl.setLocNo(loc.getLocNo());
|
| | | locDetl.setLocId(loc.getLocStsId());
|
| | | locDetl.setLocId(loc.getId());
|
| | | locDetl.setMatnr(pakin.getMatnr());
|
| | | locDetl.setMemo(pakin.getMemo());
|
| | | locDetl.setUpdateTime(new Date());
|
| | | if (!locDetlService.save(locDetl)) {
|
| | | if (!locDetlService.saveOrUpdate(locDetl)) {
|
| | | throw new CoolException("库存明细更新失败!!");
|
| | | }
|
| | | //修改状态为入库中
|
| | | pakin.setIoStatus(1);
|
| | | });
|
| | |
|
| | | //删除组拖档,加入历史组拖档
|
| | | waitPakins.forEach(waitPakin -> {
|
| | | WaitPakinLog pakinLog = new WaitPakinLog();
|
| | | BeanUtils.copyProperties(waitPakin, pakinLog);
|
| | | if (!waitPakinLogService.saveOrUpdate(pakinLog)) {
|
| | | throw new CoolException("组拖历史档更新失败");
|
| | | }
|
| | | });
|
| | |
|
| | | if (!waitPakinService.removeBatchByIds(waitPakins)) {
|
| | | throw new CoolException("组拖档删除失败!!");
|
| | | }
|
| | | //通过组拖订单ID获取订单,并删除原单据,加入单据历史档
|
| | | List<Long> list = waitPakins.stream().map(WaitPakin::getOrderId).collect(Collectors.toList());
|
| | | List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getId, list));
|
| | | orders.forEach(order -> {
|
| | | OrderLog orderLog = new OrderLog();
|
| | | BeanUtils.copyProperties(order, orderLog);
|
| | | if (!orderLogService.save(orderLog)) {
|
| | | throw new CoolException("历史单据更新失败!!");
|
| | | }
|
| | | });
|
| | |
|
| | | if (!orderService.removeBatchByIds(orders)) {
|
| | | throw new CoolException("订单删除失败!!");
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|