/*
|
* Copyright (c) 2018-2025, ztt All rights reserved.
|
*
|
* Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
*
|
* Redistributions of source code must retain the above copyright notice,
|
* this list of conditions and the following disclaimer.
|
* Redistributions in binary form must reproduce the above copyright
|
* notice, this list of conditions and the following disclaimer in the
|
* documentation and/or other materials provided with the distribution.
|
* Neither the name of the pig4cloud.com developer nor the names of its
|
* contributors may be used to endorse or promote products derived from
|
* this software without specific prior written permission.
|
* Author: ztt
|
*/
|
|
package com.chinaztt.mes.warehouse.controller;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.chinaztt.mes.common.wrapper.QueryWrapperUtil;
|
import com.chinaztt.mes.warehouse.dto.CheckDetailDTO;
|
import com.chinaztt.mes.warehouse.dto.CheckMainDTO;
|
import com.chinaztt.mes.warehouse.entity.CheckDetail;
|
import com.chinaztt.mes.warehouse.entity.CheckDiffAdjDetail;
|
import com.chinaztt.mes.warehouse.service.CheckDetailService;
|
import com.chinaztt.ztt.common.core.util.R;
|
import com.chinaztt.ztt.common.log.annotation.SysLog;
|
import com.chinaztt.mes.warehouse.service.CheckMainService;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.AllArgsConstructor;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
|
|
/**
|
* 盘点主表
|
*
|
* @author sunxl
|
* @date 2020-12-01 11:06:00
|
*/
|
@RestController
|
@AllArgsConstructor
|
@RequestMapping("/checkMain" )
|
@Api(value = "checkMain", tags = "盘点主表管理")
|
public class CheckMainController {
|
|
private final CheckMainService checkMainService;
|
private final CheckDetailService checkDetailService;
|
/**
|
* 分页查询
|
* @param page 分页对象
|
* @param checkMainDTO 盘点主表
|
* @return
|
*/
|
@ApiOperation(value = "分页查询", notes = "分页查询")
|
@GetMapping("/page" )
|
@PreAuthorize("@pms.hasPermission('warehouse_checkmain_view')" )
|
public R getCheckMainPage(Page page, CheckMainDTO checkMainDTO) {
|
return R.ok(checkMainService.getCheckMainPage(page,QueryWrapperUtil.gen(checkMainDTO)));
|
}
|
/**
|
* 分页查询
|
* @param page 分页对象
|
* @param checkMainDTO 盘点主表
|
* @return
|
*/
|
@ApiOperation(value = "分页查询过滤盘点主表", notes = "分页查询过滤盘点主表")
|
@GetMapping("/page/check" )
|
public R getCheckPage(Page page, CheckMainDTO checkMainDTO) {
|
return R.ok(checkMainService.getCheckPage(page,QueryWrapperUtil.gen(checkMainDTO)));
|
}
|
/**
|
* 分页查询
|
* @param page 分页对象
|
* @param checkDetailDTO 盘点明细表
|
* @return
|
*/
|
@ApiOperation(value = "分页查询", notes = "分页查询")
|
@GetMapping("/check/page" )
|
public R getCheckDetailPage(Page page, CheckDetailDTO checkDetailDTO) {
|
return R.ok(checkDetailService.getCheckDetailPage(page,QueryWrapperUtil.gen(checkDetailDTO)));
|
}
|
/**
|
* 分页查询
|
* @param page 分页对象
|
* @param checkDetailDTO 盘点差异报告
|
* @return
|
*/
|
@ApiOperation(value = "盘点差异报告", notes = "盘点差异报告")
|
@GetMapping("/check/detail/page" )
|
public R getCheckDetailByPage(Page page, CheckDetailDTO checkDetailDTO) {
|
return R.ok(checkDetailService.getCheckDetailByPage(page,QueryWrapperUtil.gen(checkDetailDTO)));
|
}
|
/**
|
* 通过id查询盘点主表
|
* @param id id
|
* @return R
|
*/
|
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
@GetMapping("/{id}" )
|
@PreAuthorize("@pms.hasPermission('warehouse_checkmain_view')" )
|
public R getByCheckMainId(@PathVariable("id" ) Long id) {
|
return R.ok(checkMainService.getCheckMainPageById(id));
|
}
|
/**
|
* 通过id查询盘点明细表
|
* @param id id
|
* @return R
|
*/
|
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
@GetMapping("/check/{id}" )
|
public R getById(@PathVariable("id" ) Long id) {
|
return R.ok(checkDetailService.getCheckDetailById(id));
|
}
|
/**
|
* 新增盘点主表
|
* @param checkMain 盘点主表
|
* @return R
|
*/
|
@ApiOperation(value = "新增盘点主表", notes = "新增盘点主表")
|
@SysLog("新增盘点主表" )
|
@PostMapping
|
@PreAuthorize("@pms.hasPermission('warehouse_checkmain_add')" )
|
public R saveCheckMain(@RequestBody CheckMainDTO checkMainDTO) {
|
return R.ok(checkMainService.fullSave(checkMainDTO));
|
}
|
/**
|
* 新增盘点明细表
|
* @param checkDetail 盘点明细表
|
* @return R
|
*/
|
@ApiOperation(value = "新增盘点明细表", notes = "新增盘点明细表")
|
@SysLog("新增盘点明细表" )
|
@PostMapping("/check")
|
public R save(@RequestBody CheckDetail checkDetail) {
|
return R.ok(checkDetailService.save(checkDetail));
|
}
|
/**
|
* 修改盘点主表
|
* @param checkMain 盘点主表
|
* @return R
|
*/
|
@ApiOperation(value = "修改盘点主表", notes = "修改盘点主表")
|
@SysLog("修改盘点主表" )
|
@PutMapping
|
@PreAuthorize("@pms.hasPermission('warehouse_checkmain_edit')" )
|
public R updateByCheckMainId(@RequestBody CheckMainDTO checkMainDTO) {
|
return R.ok(checkMainService.updateByCheckMainId(checkMainDTO));
|
}
|
/**
|
* 修改盘点明细表
|
* @param checkDetail 盘点明细表
|
* @return R
|
*/
|
@ApiOperation(value = "修改盘点明细表", notes = "修改盘点明细表")
|
@SysLog("修改盘点明细表" )
|
@PutMapping("/check")
|
public R updateById(@RequestBody CheckDetail checkDetail) {
|
return R.ok(checkDetailService.updateById(checkDetail));
|
}
|
/**
|
* 通过id删除盘点主表
|
* @param id id
|
* @return R
|
*/
|
@ApiOperation(value = "通过id删除盘点主表", notes = "通过id删除盘点主表")
|
@SysLog("通过id删除盘点主表" )
|
@DeleteMapping("/{id}" )
|
@PreAuthorize("@pms.hasPermission('warehouse_checkmain_del')" )
|
public void removeByCheckMainId(@PathVariable Long id) {
|
checkMainService.fullDelete(id);
|
}
|
/**
|
* 通过id删除盘点明细表
|
* @param id id
|
* @return R
|
*/
|
@ApiOperation(value = "通过id删除盘点明细表", notes = "通过id删除盘点明细表")
|
@SysLog("通过id删除盘点明细表" )
|
@DeleteMapping("/check/{id}" )
|
public R removeById(@PathVariable Long id) {
|
return R.ok(checkDetailService.removeById(id));
|
}
|
/**
|
* 执行
|
* @param ids
|
* @return R
|
*/
|
@ApiOperation(value = "执行", notes = "执行")
|
@SysLog("执行" )
|
@PostMapping("/perform")
|
public R issue(@RequestBody List<Long> ids) {
|
return R.ok(checkMainService.updateWarehouseCheck(ids));
|
}
|
|
/**
|
* 新增盘点差异调整明细表
|
* @param checkDiffAdjDetail 盘点差异调整明细表
|
* @return R
|
*/
|
@ApiOperation(value = "新增盘点差异调整明细表", notes = "新增盘点差异调整明细表")
|
@SysLog("新增盘点差异调整明细表" )
|
@PostMapping("/diffAdjDetail" )
|
public R save(@RequestBody CheckDiffAdjDetail checkDiffAdjDetail) {
|
return R.ok(checkDetailService.fullSave(checkDiffAdjDetail));
|
}
|
/**
|
* 分页查询
|
* @param page 分页对象
|
* @param checkDiffAdjDetail 盘点差异调整明细表
|
* @param id
|
* @return
|
*/
|
@ApiOperation(value = "分页查询", notes = "分页查询")
|
@GetMapping("/diffAdjDetail/page/{id}" )
|
public R getCheckDiffAdjDetailPage(Page page, CheckDiffAdjDetail checkDiffAdjDetail,@PathVariable("id" ) Long id) {
|
checkDiffAdjDetail.setId(null);
|
return R.ok(checkDetailService.getCheckDiffAdjDetailPage(page, QueryWrapperUtil.gen(checkDiffAdjDetail),id));
|
}
|
/**
|
* 执行
|
* @param ids
|
* @return R
|
*/
|
@ApiOperation(value = "执行", notes = "执行")
|
@SysLog("提交" )
|
@GetMapping("/submit/{id}")
|
public R submit(@PathVariable("id" ) Long id) {
|
return R.ok(checkMainService.submitWarehouseCheck(id));
|
}
|
}
|