WarehouseU8Controller.java 2.31 KB
package com.huaheng.pc.config.warehouse.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.common.redis.service.IRedisService;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.warehouse.domain.WarehouseU8;
import com.huaheng.pc.config.warehouse.service.WarehouseU8Service;
import com.huaheng.pc.config.warehouse.domain.WorkOrderComponent;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/config/warehouseWu")
public class WarehouseU8Controller extends BaseController {

    @Resource
    private WarehouseU8Service warehouseWuService;
    @Resource
    private IRedisService iRedisService;

    @ApiOperation("获取U8工单子件")
    @Log(title = "获取U8工单子件", action = BusinessType.OTHER)
    @GetMapping("/queryWorkOrders")
    @ResponseBody
    @ApiLogger(apiName = "获取U8工单子件", from = "U8")
    public AjaxResult queryWorkOrders(WorkOrderComponent data,String type){
        AjaxResult ajax;
        try {
            ajax = warehouseWuService.GetCurrentStock(data, type);
        }catch (Exception e){
            if (iRedisService.isKeyExists("CS_work_order_list")){
                iRedisService.remove("CS_work_order_list");
            }
            return AjaxResult.error(e.getMessage());
        }
        return ajax;
    }

    @GetMapping("/getCompanyCodeList")
    @ResponseBody
    public AjaxResult getCompanyCodeList(String companyCode){
        try {
            List<WarehouseU8> list = warehouseWuService.list(new LambdaQueryWrapper<WarehouseU8>()
                    .eq(WarehouseU8::getCompanyCode, companyCode));
            return AjaxResult.success(list);
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }


}