库存现有量

This commit is contained in:
JinLu.Yin 2022-05-30 23:42:34 +08:00
parent 83bc0e7954
commit b5fe585553

View File

@ -0,0 +1,104 @@
package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.wm.domain.WmMaterialStock;
import com.ktg.mes.wm.service.IWmMaterialStockService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 库存记录Controller
*
* @author yinjinlu
* @date 2022-05-30
*/
@RestController
@RequestMapping("/mes/wm/wmstock")
public class WmMaterialStockController extends BaseController
{
@Autowired
private IWmMaterialStockService wmMaterialStockService;
/**
* 查询库存记录列表
*/
@PreAuthorize("@ss.hasPermi('mes:wm:wmstock:list')")
@GetMapping("/list")
public TableDataInfo list(WmMaterialStock wmMaterialStock)
{
startPage();
List<WmMaterialStock> list = wmMaterialStockService.selectWmMaterialStockList(wmMaterialStock);
return getDataTable(list);
}
/**
* 导出库存记录列表
*/
@PreAuthorize("@ss.hasPermi('mes:wm:wmstock:export')")
@Log(title = "库存记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WmMaterialStock wmMaterialStock)
{
List<WmMaterialStock> list = wmMaterialStockService.selectWmMaterialStockList(wmMaterialStock);
ExcelUtil<WmMaterialStock> util = new ExcelUtil<WmMaterialStock>(WmMaterialStock.class);
util.exportExcel(response, list, "库存记录数据");
}
/**
* 获取库存记录详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:wm:wmstock:query')")
@GetMapping(value = "/{materialStockId}")
public AjaxResult getInfo(@PathVariable("materialStockId") Long materialStockId)
{
return AjaxResult.success(wmMaterialStockService.selectWmMaterialStockByMaterialStockId(materialStockId));
}
/**
* 新增库存记录
*/
@PreAuthorize("@ss.hasPermi('mes:wm:wmstock:add')")
@Log(title = "库存记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmMaterialStock wmMaterialStock)
{
return toAjax(wmMaterialStockService.insertWmMaterialStock(wmMaterialStock));
}
/**
* 修改库存记录
*/
@PreAuthorize("@ss.hasPermi('mes:wm:wmstock:edit')")
@Log(title = "库存记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmMaterialStock wmMaterialStock)
{
return toAjax(wmMaterialStockService.updateWmMaterialStock(wmMaterialStock));
}
/**
* 删除库存记录
*/
@PreAuthorize("@ss.hasPermi('mes:wm:wmstock:remove')")
@Log(title = "库存记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{materialStockIds}")
public AjaxResult remove(@PathVariable Long[] materialStockIds)
{
return toAjax(wmMaterialStockService.deleteWmMaterialStockByMaterialStockIds(materialStockIds));
}
}