feat(wms): 增加版本管理功能和操作按钮
在规程主表的操作列中新增“版本与方案”按钮,点击后可跳转至版本管理页面。更新了操作列的宽度以适应新按钮。同时,在后端服务中添加了对规程版本存在性的校验,确保在删除规程时不会影响相关版本数据。
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
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.page.TableDataInfo;
|
||||
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.bo.WmsProcessPlanBo;
|
||||
import com.klp.domain.vo.WmsProcessPlanVo;
|
||||
import com.klp.service.IWmsProcessPlanService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 方案点位
|
||||
*
|
||||
* @author klp
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/processPlan")
|
||||
public class WmsProcessPlanController extends BaseController {
|
||||
|
||||
private final IWmsProcessPlanService wmsProcessPlanService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsProcessPlanVo> list(WmsProcessPlanBo bo, PageQuery pageQuery) {
|
||||
return wmsProcessPlanService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "方案点位", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsProcessPlanBo bo, HttpServletResponse response) {
|
||||
List<WmsProcessPlanVo> list = wmsProcessPlanService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "方案点位", WmsProcessPlanVo.class, response);
|
||||
}
|
||||
|
||||
@GetMapping("/{planId}")
|
||||
public R<WmsProcessPlanVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long planId) {
|
||||
return R.ok(wmsProcessPlanService.queryById(planId));
|
||||
}
|
||||
|
||||
@Log(title = "方案点位", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsProcessPlanBo bo) {
|
||||
return toAjax(wmsProcessPlanService.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "方案点位", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsProcessPlanBo bo) {
|
||||
return toAjax(wmsProcessPlanService.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "方案点位", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{planIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] planIds) {
|
||||
return toAjax(wmsProcessPlanService.deleteWithValidByIds(Arrays.asList(planIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
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.page.TableDataInfo;
|
||||
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.bo.WmsProcessSpecVersionBo;
|
||||
import com.klp.domain.vo.WmsProcessSpecVersionVo;
|
||||
import com.klp.service.IWmsProcessSpecVersionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 规程版本
|
||||
*
|
||||
* @author klp
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/processSpecVersion")
|
||||
public class WmsProcessSpecVersionController extends BaseController {
|
||||
|
||||
private final IWmsProcessSpecVersionService wmsProcessSpecVersionService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsProcessSpecVersionVo> list(WmsProcessSpecVersionBo bo, PageQuery pageQuery) {
|
||||
return wmsProcessSpecVersionService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "规程版本", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsProcessSpecVersionBo bo, HttpServletResponse response) {
|
||||
List<WmsProcessSpecVersionVo> list = wmsProcessSpecVersionService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "规程版本", WmsProcessSpecVersionVo.class, response);
|
||||
}
|
||||
|
||||
@GetMapping("/{versionId}")
|
||||
public R<WmsProcessSpecVersionVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long versionId) {
|
||||
return R.ok(wmsProcessSpecVersionService.queryById(versionId));
|
||||
}
|
||||
|
||||
@Log(title = "规程版本", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsProcessSpecVersionBo bo) {
|
||||
return toAjax(wmsProcessSpecVersionService.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "规程版本", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsProcessSpecVersionBo bo) {
|
||||
return toAjax(wmsProcessSpecVersionService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设为当前生效版本(同规程下仅一条生效)
|
||||
*/
|
||||
@Log(title = "规程版本生效", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/activate/{versionId}")
|
||||
public R<Void> activate(@NotNull(message = "主键不能为空") @PathVariable Long versionId) {
|
||||
return toAjax(wmsProcessSpecVersionService.activateVersion(versionId));
|
||||
}
|
||||
|
||||
@Log(title = "规程版本", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{versionIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] versionIds) {
|
||||
return toAjax(wmsProcessSpecVersionService.deleteWithValidByIds(Arrays.asList(versionIds), true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user