bug-1509 发货管理-发货单

This commit is contained in:
曹鹏飞 2026-05-25 11:13:50 +08:00
parent c842372069
commit b15b3cb55b
4 changed files with 44 additions and 1 deletions

View File

@ -87,7 +87,7 @@ public class WmsShipmentDelivery implements Serializable {
private Integer boxStatus;
/**
* 发车状态0未发车1已发车
* 发车状态0未发车1已发车4已收货
*/
private Integer carStatus;

View File

@ -22,4 +22,9 @@ public interface IWmsShipmentDeliveryService extends IService<WmsShipmentDeliver
List<ShipmentPackagingCodeVO> getBoxByPlateNumber(String plateNumber);
List<ShipmentPackagingCodeVO> getBoxByDeliveryId(Long deliveryId);
/**
* 判断发货单下所有包装箱是否都已卸货
*/
boolean allPackagingCodeUnloaded(Long deliveryId);
}

View File

@ -2,12 +2,18 @@ package com.nflg.wms.repository.service.impl;
import com.nflg.wms.common.pojo.vo.ShipmentPackagingCodeVO;
import com.nflg.wms.repository.entity.WmsShipmentDelivery;
import com.nflg.wms.repository.entity.WmsShipmentDeliveryItem;
import com.nflg.wms.repository.entity.WmsShipmentPackagingCode;
import com.nflg.wms.repository.mapper.WmsShipmentDeliveryMapper;
import com.nflg.wms.repository.service.IWmsShipmentDeliveryItemService;
import com.nflg.wms.repository.service.IWmsShipmentDeliveryService;
import com.nflg.wms.repository.service.IWmsShipmentPackagingCodeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
@ -20,6 +26,12 @@ import java.util.List;
@Service
public class WmsShipmentDeliveryServiceImpl extends ServiceImpl<WmsShipmentDeliveryMapper, WmsShipmentDelivery> implements IWmsShipmentDeliveryService {
@Resource
private IWmsShipmentDeliveryItemService deliveryItemService;
@Resource
private IWmsShipmentPackagingCodeService packagingCodeService;
@Override
public WmsShipmentDelivery getByPackagingCodeId(Long id) {
return baseMapper.getByPackagingCodeId(id);
@ -34,4 +46,23 @@ public class WmsShipmentDeliveryServiceImpl extends ServiceImpl<WmsShipmentDeliv
public List<ShipmentPackagingCodeVO> getBoxByDeliveryId(Long deliveryId) {
return baseMapper.getBoxByDeliveryId(deliveryId);
}
@Override
public boolean allPackagingCodeUnloaded(Long deliveryId) {
List<Long> packagingCodeIds = deliveryItemService.lambdaQuery()
.eq(WmsShipmentDeliveryItem::getDeliveryId, deliveryId)
.list()
.stream()
.map(WmsShipmentDeliveryItem::getPackagingCodeId)
.collect(Collectors.toList());
if (packagingCodeIds.isEmpty()) {
return false;
}
// 查询是否存在未卸货的包装箱status != 4
long notUnloadedCount = packagingCodeService.lambdaQuery()
.in(WmsShipmentPackagingCode::getId, packagingCodeIds)
.ne(WmsShipmentPackagingCode::getStatus, 4)
.count();
return notUnloadedCount == 0;
}
}

View File

@ -52,6 +52,9 @@ public class H5Controller extends BaseController {
@Resource
private IWmsShipmentSiteStockMaterialItemRecordService siteStockMaterialItemRecordService;
@Resource
private IWmsShipmentDeliveryItemService deliveryItemService;
/**
* 查询
*/
@ -145,6 +148,10 @@ public class H5Controller extends BaseController {
.setCreateTime(LocalDateTime.now())
);
});
if(deliveryService.allPackagingCodeUnloaded(delivery.getId())) {
delivery.setCarStatus(4);
deliveryService.updateById(delivery);
}
});
return ApiResult.success();
}