109 lines
3.5 KiB
Java
109 lines
3.5 KiB
Java
package com.klp.controller;
|
|
|
|
import java.util.List;
|
|
import java.util.Arrays;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.constraints.*;
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import com.klp.common.annotation.RepeatSubmit;
|
|
import com.klp.common.annotation.Log;
|
|
import com.klp.common.core.controller.BaseController;
|
|
import com.klp.common.core.domain.PageQuery;
|
|
import com.klp.common.core.domain.R;
|
|
import com.klp.common.core.validate.AddGroup;
|
|
import com.klp.common.core.validate.EditGroup;
|
|
import com.klp.common.enums.BusinessType;
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
|
import com.klp.domain.vo.WmsRawMaterialVo;
|
|
import com.klp.domain.bo.WmsRawMaterialBo;
|
|
import com.klp.service.IWmsRawMaterialService;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
|
|
/**
|
|
* 原材料
|
|
*
|
|
* @author Joshi
|
|
* @date 2025-07-18
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/wms/rawMaterial")
|
|
public class WmsRawMaterialController extends BaseController {
|
|
|
|
private final IWmsRawMaterialService iWmsRawMaterialService;
|
|
|
|
/**
|
|
* 查询原材料列表
|
|
*/
|
|
@GetMapping("/list")
|
|
public TableDataInfo<WmsRawMaterialVo> list(WmsRawMaterialBo bo, PageQuery pageQuery) {
|
|
return iWmsRawMaterialService.queryPageList(bo, pageQuery);
|
|
}
|
|
|
|
/**
|
|
* 导出原材料列表
|
|
*/
|
|
@Log(title = "原材料", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(WmsRawMaterialBo bo, HttpServletResponse response) {
|
|
List<WmsRawMaterialVo> list = iWmsRawMaterialService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "原材料", WmsRawMaterialVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取原材料详细信息
|
|
*
|
|
* @param rawMaterialId 主键
|
|
*/
|
|
@GetMapping("/{rawMaterialId}")
|
|
public R<WmsRawMaterialVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long rawMaterialId) {
|
|
return R.ok(iWmsRawMaterialService.queryById(rawMaterialId));
|
|
}
|
|
|
|
/**
|
|
* 新增原材料
|
|
*/
|
|
@Log(title = "原材料", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<WmsRawMaterialBo> add(@Validated(AddGroup.class) @RequestBody WmsRawMaterialBo bo) {
|
|
return R.ok(iWmsRawMaterialService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 修改原材料
|
|
*/
|
|
@Log(title = "原材料", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsRawMaterialBo bo) {
|
|
return toAjax(iWmsRawMaterialService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除原材料
|
|
*
|
|
* @param rawMaterialIds 主键串
|
|
*/
|
|
@Log(title = "原材料", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{rawMaterialIds}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] rawMaterialIds) {
|
|
return toAjax(iWmsRawMaterialService.deleteWithValidByIds(Arrays.asList(rawMaterialIds), true));
|
|
}
|
|
|
|
/**
|
|
* 查询原材料列表(含需求、库存、在途信息)
|
|
*/
|
|
@GetMapping("/listWithDemand")
|
|
public TableDataInfo<WmsRawMaterialVo> listWithDemand(WmsRawMaterialBo bo, PageQuery pageQuery) {
|
|
return iWmsRawMaterialService.queryPageListWithDemand(bo, pageQuery);
|
|
}
|
|
}
|