futian.liu
2023-11-17 209d9c6f60d96fc29fad0bd2f9dad8fe8424f91f
consum-base/src/main/java/com/consum/base/controller/BaseWarehouseController.java
@@ -2,15 +2,26 @@
import com.consum.base.BaseController;
import com.consum.base.pojo.BaseWarehouseParam;
import com.consum.base.pojo.query.WarehouseQry;
import com.consum.base.service.BaseWarehouseServiceImpl;
import com.consum.base.service.LWhGoodsService;
import com.consum.model.po.BaseWarehouse;
import com.consum.model.po.FinSysTenantUser;
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.web.ResponseValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @Description 仓库管理
@@ -23,6 +34,9 @@
    @Autowired
    private BaseWarehouseServiceImpl baseWarehouseService;
    @Autowired
    private LWhGoodsService lWhGoodsService;
    /**
     * @Description 新增
@@ -50,10 +64,11 @@
     */
    @GetMapping("/list")
    public ResponseValue queryList(BaseWarehouseParam param) {
//        FinSysTenantUser sysInfo = this.getSysInfo();
//        if (sysInfo == null) {
//            return ResponseValue.error("登录用户信息不存在");
//        }
        FinSysTenantUser sysInfo = this.getSysInfo();
        if (sysInfo == null) {
            return ResponseValue.error("登录用户信息不存在");
        }
        param.setAgencyId(Long.valueOf(sysInfo.getTenantId()));
        GenericPager<BaseWarehouse> pager = this.baseWarehouseService.queryList(param);
        return ResponseValue.success(pager);
    }
@@ -135,13 +150,34 @@
//        if (agencyId == null) {
//            return ResponseValue.error("机构id为空");
//        }
        List<BaseWarehouse> list = this.baseWarehouseService.getByAgencyId(agencyId,null,null);
        List<BaseWarehouse> list = this.baseWarehouseService.getByAgencyId(agencyId, null, null);
        if (list == null) {
            return ResponseValue.error("查询失败!");
        }
        return ResponseValue.success("查询成功!", list);
    }
    @ApiOperation(value = "根据仓库id和型号id 查询库存", notes = "根据仓库id和型号id 查询库存")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "warehouseQry", value = "仓库id和型号id", required = true, dataType = "WarehouseQry", paramType = "query")
    })
    @GetMapping("/select/number")
    public ResponseValue selectNumber(@Validated WarehouseQry warehouseQry) {
        Long warehouseId = warehouseQry.getWarehouseId();
        if (warehouseId == null) {
            Long agencyId = warehouseQry.getAgencyId();
            BaseWarehouse defaultWarehouseByAgencyId = this.baseWarehouseService.getDefaultWarehouseByAgencyId(agencyId);
            warehouseId = defaultWarehouseByAgencyId.getId();
        }
        Long baseGoodsModelsId = warehouseQry.getBaseGoodsModelsId();
        Integer warehouseType = warehouseQry.getWarehouseType();
        Integer states = warehouseQry.getStates();
        Integer buyType = warehouseQry.getBuyType();
        int num = this.lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 1, buyType);
        return ResponseValue.success(num);
    }
}