新火炬后端单体项目初始化代码
lixiangyu
2 天以前 666af2a41be37f09cd6d99c8e2e338c5225f511c
src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java
@@ -1,5 +1,7 @@
package org.jeecg.modules.lsw.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -15,10 +17,14 @@
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
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.service.ILswMaterialInventoryService;
import org.jeecg.modules.lsw.service.ILswMaterialService;
import org.jeecg.modules.lsw.vo.LswMaterialPage;
@@ -53,6 +59,8 @@
    private ILswMaterialInventoryService lswMaterialInventoryService;
    @Autowired
    private ILineSideWarehouseService lineSideWarehouseService;
    @Autowired
    private IFactoryService factoryService;
    /**
     * 分页列表查询
@@ -160,6 +168,45 @@
        return Result.OK(lswMaterialInventoryList);
    }
    @AutoLog(value = "线边库物料信息-通过产线类型查询线边库物料")
    @ApiOperation(value = "线边库物料信息-通过产线类型查询线边库物料", notes = "线边库物料信息-通过产线类型查询线边库物料")
    @GetMapping(value = "/queryLswMaterialByProductionType")
    public Result<List<LswMaterial>> queryLswMaterialByProductionType(@RequestParam("factoryId") String factoryId) {
        Factory factory = factoryService.getById(factoryId);
        ProductionTypeEnum productionType = ProductionTypeEnum.fromName(factory.getProductionType());
        List<LswMaterial> lswMaterialList = CollectionUtil.newArrayList();
        if (productionType == null) {
            throw new JeecgBootException("产线类型未设置,无法查询相应物料信息!");
        }
        switch (productionType) {
            case ASSEMBLE:
                //装配线,查询成品物料
                lswMaterialList = lswMaterialService.list(new LambdaQueryWrapper<LswMaterial>()
                        .eq(LswMaterial::getMaterialCategory, MaterialCategoryEnum.FINISHED_PRODUCT.name())
                        .eq(LswMaterial::getDelFlag, CommonConstant.DEL_FLAG_0)
                        .eq(LswMaterial::getMaterialStatus, CommonConstant.STATUS_1)
                        .orderByAsc(LswMaterial::getMaterialNumber));
                break;
            case INNERFLANGE:
                //内法兰机加线,查询内法兰物料
                lswMaterialList = lswMaterialService.list(new LambdaQueryWrapper<LswMaterial>()
                        .eq(LswMaterial::getMaterialCategory, MaterialCategoryEnum.INNER_FLANGE.name())
                        .eq(LswMaterial::getDelFlag, CommonConstant.DEL_FLAG_0)
                        .eq(LswMaterial::getMaterialStatus, CommonConstant.STATUS_1)
                        .orderByAsc(LswMaterial::getMaterialNumber));
                break;
            case OUTERFLANGE:
                //外法兰机加线,查询外法兰物料
                lswMaterialList = lswMaterialService.list(new LambdaQueryWrapper<LswMaterial>()
                        .eq(LswMaterial::getMaterialCategory, MaterialCategoryEnum.OUTER_FLANGE.name())
                        .eq(LswMaterial::getDelFlag, CommonConstant.DEL_FLAG_0)
                        .eq(LswMaterial::getMaterialStatus, CommonConstant.STATUS_1)
                        .orderByAsc(LswMaterial::getMaterialNumber));
                break;
        }
        return Result.OK(lswMaterialList);
    }
    /**
     * 导出excel
     *