package com.shkj.wms.controller.business;

import com.shkj.common.annotation.Log;
import com.shkj.common.core.controller.BaseController;
import com.shkj.common.core.domain.Result;
import com.shkj.common.enums.BusinessType;
import com.shkj.wms.domain.BasePlcDps;
import com.shkj.wms.service.IBasePlcDpsService;
import com.shkj.wms.vo.BasePlcDpsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 输送线空闲点位Controller
 *
 * @author zjx
 * @date 2024-05-06
 */
@RestController
@RequestMapping("/wms/plcdps")
public class BasePlcDpsController extends BaseController
{
    @Autowired
    private IBasePlcDpsService basePlcDpsService;

    /**
     * 查询输送线空闲点位列表
     */
    @GetMapping("/list")
    public List<BasePlcDpsVo> list(BasePlcDps basePlcDps)
    {
        List<BasePlcDpsVo> list = basePlcDpsService.selectBasePlcDpsList(basePlcDps);
        return  list;
    }



    /**
     * 获取输送线空闲点位详细信息
     */
    @PreAuthorize("@ss.hasPermi('wms:plcdps:query')")
    @GetMapping(value = "/{id}")
    public BasePlcDps getInfo(@PathVariable("id") Long id)
    {
        return basePlcDpsService.selectBasePlcDpsById(id);
    }

    /**
     * 释放wcsplc的输送线状态
     */
    @Log(title = "释放wcsplc的输送线状态", businessType = BusinessType.INSERT)
    @PostMapping("/releaseWcsDpsPoint")
    public Result<Boolean> releaseWcsDpsPoint(@RequestBody BasePlcDps basePlcDps)
    {
        return basePlcDpsService.updateBasePlcDps(basePlcDps)?Result.ok():Result.err();
    }
}
