|
@@ -0,0 +1,54 @@
|
|
|
+package com.fjhx.wms.service.warehouse.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.item.entity.product.po.ProductInfo;
|
|
|
+import com.fjhx.item.service.product.ProductInfoService;
|
|
|
+import com.fjhx.wms.entity.warehouse.dto.WarehouseLocationInfoDto;
|
|
|
+import com.fjhx.wms.entity.warehouse.po.WarehouseLocationInfo;
|
|
|
+import com.fjhx.wms.entity.warehouse.vo.WarehouseLocationInfoVo;
|
|
|
+import com.fjhx.wms.mapper.warehouse.WarehouseLocationInfoMapper;
|
|
|
+import com.fjhx.wms.service.warehouse.WarehouseLocationInfoService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 仓库库位信息 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2023-05-18
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class WarehouseLocationInfoServiceImpl extends ServiceImpl<WarehouseLocationInfoMapper, WarehouseLocationInfo> implements WarehouseLocationInfoService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProductInfoService productInfoService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<WarehouseLocationInfoVo> getList(WarehouseLocationInfoDto dto) {
|
|
|
+ List<WarehouseLocationInfo> list = list(q -> q.eq(WarehouseLocationInfo::getWarehouseId, dto.getWarehouseId()));
|
|
|
+ List<WarehouseLocationInfoVo> warehouseLocationInfoVos = BeanUtil.copyToList(list, WarehouseLocationInfoVo.class);
|
|
|
+ for (WarehouseLocationInfoVo warehouseLocationInfoVo : warehouseLocationInfoVos) {
|
|
|
+ String productIds = warehouseLocationInfoVo.getProductIds();
|
|
|
+ if (ObjectUtil.isNotEmpty(productIds)) {
|
|
|
+ String[] split = productIds.split(",");
|
|
|
+ List<ProductInfo> productInfoList = productInfoService.list(q -> q.in(ProductInfo::getId, split));
|
|
|
+ warehouseLocationInfoVo.setProductInfoList(productInfoList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return warehouseLocationInfoVos;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void edit(WarehouseLocationInfoDto warehouseLocationInfoDto) {
|
|
|
+ List<WarehouseLocationInfo> warehouseLocationInfoList = warehouseLocationInfoDto.getWarehouseLocationInfoList();
|
|
|
+ warehouseLocationInfoList.forEach(item -> item.setWarehouseId(warehouseLocationInfoDto.getWarehouseId()));
|
|
|
+ this.editLinked(warehouseLocationInfoList, WarehouseLocationInfo::getWarehouseId, warehouseLocationInfoDto.getWarehouseId());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|