From d498cfd64f2dcc3117802eea755b57f87289ad22 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 06 一月 2025 15:05:11 +0800 Subject: [PATCH] #平库入库单功能完成 --- zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 41 insertions(+), 2 deletions(-) diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java index 31cee62..9641bd7 100644 --- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java +++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java @@ -11,6 +11,7 @@ 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; @@ -19,6 +20,7 @@ import java.util.Date; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; @Service public class MobileServiceImpl implements MobileService { @@ -26,11 +28,15 @@ @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 @@ -104,6 +110,9 @@ //鍒ゆ柇褰撳墠浠撳簱鏄惁涓哄钩搴撲綅 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) { @@ -115,7 +124,7 @@ loc.setUpdateTime(new Date()); //搴撳瓨鐘舵�佷慨鏀逛负鍦ㄥ簱鐘舵�� loc.setLocStsId(LocStsType.F.val()); - if (!locService.save(loc)) { + if (!locService.updateById(loc)) { throw new CoolException("搴撲綅鏇存柊澶辫触锛侊紒"); } @@ -132,11 +141,41 @@ 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); }); + //鍒犻櫎缁勬嫋妗o紝鍔犲叆鍘嗗彶缁勬嫋妗� + List<WaitPakinLog> waitPakinLogs = new ArrayList<>(); + waitPakins.forEach(waitPakin -> { + WaitPakinLog pakinLog = new WaitPakinLog(); + BeanUtils.copyProperties(waitPakin, pakinLog); + if (!waitPakinLogService.saveOrUpdate(pakinLog)) { + throw new CoolException("缁勬嫋鍘嗗彶妗f洿鏂板け璐�"); + } + }); + + if (!waitPakinService.removeBatchByIds(waitPakins)) { + throw new CoolException("缁勬嫋妗e垹闄ゅけ璐ワ紒锛�"); + } + //閫氳繃缁勬嫋璁㈠崟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; } -- Gitblit v1.9.1