100 lines
3.0 KiB
Java
100 lines
3.0 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 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.WmsStockLogVo;
|
||
|
|
import com.klp.domain.bo.WmsStockLogBo;
|
||
|
|
import com.klp.service.IWmsStockLogService;
|
||
|
|
import com.klp.common.core.page.TableDataInfo;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 库存流水
|
||
|
|
*
|
||
|
|
* @author JR
|
||
|
|
* @date 2025-08-11
|
||
|
|
*/
|
||
|
|
@Validated
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/klp/stockLog")
|
||
|
|
public class WmsStockLogController extends BaseController {
|
||
|
|
|
||
|
|
private final IWmsStockLogService iWmsStockLogService;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询库存流水列表
|
||
|
|
*/
|
||
|
|
@GetMapping("/list")
|
||
|
|
public TableDataInfo<WmsStockLogVo> list(WmsStockLogBo bo, PageQuery pageQuery) {
|
||
|
|
return iWmsStockLogService.queryPageList(bo, pageQuery);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 导出库存流水列表
|
||
|
|
*/
|
||
|
|
@Log(title = "库存流水", businessType = BusinessType.EXPORT)
|
||
|
|
@PostMapping("/export")
|
||
|
|
public void export(WmsStockLogBo bo, HttpServletResponse response) {
|
||
|
|
List<WmsStockLogVo> list = iWmsStockLogService.queryList(bo);
|
||
|
|
ExcelUtil.exportExcel(list, "库存流水", WmsStockLogVo.class, response);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取库存流水详细信息
|
||
|
|
*
|
||
|
|
* @param id 主键
|
||
|
|
*/
|
||
|
|
@GetMapping("/{id}")
|
||
|
|
public R<WmsStockLogVo> getInfo(@NotNull(message = "主键不能为空")
|
||
|
|
@PathVariable Long id) {
|
||
|
|
return R.ok(iWmsStockLogService.queryById(id));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 新增库存流水
|
||
|
|
*/
|
||
|
|
@Log(title = "库存流水", businessType = BusinessType.INSERT)
|
||
|
|
@RepeatSubmit()
|
||
|
|
@PostMapping()
|
||
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsStockLogBo bo) {
|
||
|
|
return toAjax(iWmsStockLogService.insertByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 修改库存流水
|
||
|
|
*/
|
||
|
|
@Log(title = "库存流水", businessType = BusinessType.UPDATE)
|
||
|
|
@RepeatSubmit()
|
||
|
|
@PutMapping()
|
||
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsStockLogBo bo) {
|
||
|
|
return toAjax(iWmsStockLogService.updateByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除库存流水
|
||
|
|
*
|
||
|
|
* @param ids 主键串
|
||
|
|
*/
|
||
|
|
@Log(title = "库存流水", businessType = BusinessType.DELETE)
|
||
|
|
@DeleteMapping("/{ids}")
|
||
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||
|
|
@PathVariable Long[] ids) {
|
||
|
|
return toAjax(iWmsStockLogService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||
|
|
}
|
||
|
|
}
|