新火炬后端单体项目初始化代码
zhangherong
17 小时以前 399e7d565f19f59a8da82277da8f3eab527c2c56
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInventoryServiceImpl.java
@@ -2,17 +2,26 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.Factory;
import org.jeecg.modules.base.entity.LineSideWarehouse;
import org.jeecg.modules.base.enums.ProductionTypeEnum;
import org.jeecg.modules.base.service.IFactoryService;
import org.jeecg.modules.base.service.ILineSideWarehouseService;
import org.jeecg.modules.lsw.entity.LswMaterial;
import org.jeecg.modules.lsw.entity.LswMaterialInventory;
import org.jeecg.modules.lsw.enums.MaterialCategoryEnum;
import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum;
import org.jeecg.modules.lsw.mapper.LswMaterialInventoryMapper;
import org.jeecg.modules.lsw.service.ILswMaterialInventoryService;
import org.jeecg.modules.lsw.service.ILswMaterialService;
import org.jeecg.modules.lsw.vo.LswMaterialInventoryVo;
import org.jeecg.modules.lsw.vo.MaterialInventoryStatisticsVO;
import org.jeecg.modules.lsw.vo.MaterialInventoryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@@ -28,6 +37,10 @@
    private LswMaterialInventoryMapper lswMaterialInventoryMapper;
    @Autowired
    private ILswMaterialService materialService;
    @Autowired
    private ILineSideWarehouseService lineSideWarehouseService;
    @Autowired
    private IFactoryService factoryService;
    @Override
    public List<LswMaterialInventoryVo> selectLineSideMaterialInventoryByMaterialNumber(List<String> bomMaterialNumberList, String factoryId) {
@@ -52,4 +65,31 @@
        queryWrapper.eq(LswMaterialInventory::getInventoryStatus, MaterialInventoryStatusEnum.NORMAL.name());
        return lswMaterialInventoryMapper.selectOne(queryWrapper);
    }
    @Override
    public List<MaterialInventoryVO> queryMaterialInventory(String factoryId) {
        Factory factory = factoryService.getById(factoryId);
        if (factory == null) {
            return Collections.emptyList();
        }
        LineSideWarehouse warehouse = lineSideWarehouseService.queryByFactoryId(factoryId);
        if (warehouse == null) {
            return Collections.emptyList();
        }
        List<String> materialCategory = new ArrayList<>();
        if (ProductionTypeEnum.ASSEMBLE.name().equals(factory.getProductionType())) {
            materialCategory.add(MaterialCategoryEnum.OUTER_FLANGE.name());
            materialCategory.add(MaterialCategoryEnum.INNER_FLANGE.name());
            materialCategory.add(MaterialCategoryEnum.SMALL_INNER_RING.name());
            materialCategory.add(MaterialCategoryEnum.STEEL_BALL.name());
            materialCategory.add(MaterialCategoryEnum.COMPONENTS.name());
        } else if (ProductionTypeEnum.INNERFLANGE.name().equals(factory.getProductionType())) {
            materialCategory.add(MaterialCategoryEnum.BLANK.name());
        } else if (ProductionTypeEnum.OUTERFLANGE.name().equals(factory.getProductionType())) {
            materialCategory.add(MaterialCategoryEnum.BLANK.name());
        } else if (ProductionTypeEnum.HEATTREATMENT.name().equals(factory.getProductionType())) {
            materialCategory.add(MaterialCategoryEnum.BLANK.name());
        }
        return lswMaterialInventoryMapper.queryMaterialInventory(warehouse.getId(), materialCategory);
    }
}