2023-02-22 15:59:13 +08:00
|
|
|
|
package com.cnbm.packing.controller;
|
|
|
|
|
|
|
|
|
|
import com.cnbm.admin.annotation.LogOperation;
|
|
|
|
|
import com.cnbm.common.constant.Constant;
|
|
|
|
|
import com.cnbm.common.page.PageData;
|
|
|
|
|
import com.cnbm.common.utils.ExcelUtils;
|
|
|
|
|
import com.cnbm.common.utils.Result;
|
|
|
|
|
import com.cnbm.common.validator.AssertUtils;
|
|
|
|
|
import com.cnbm.common.validator.ValidatorUtils;
|
|
|
|
|
import com.cnbm.common.validator.group.AddGroup;
|
|
|
|
|
import com.cnbm.common.validator.group.DefaultGroup;
|
|
|
|
|
import com.cnbm.common.validator.group.UpdateGroup;
|
2023-02-28 09:26:43 +08:00
|
|
|
|
import com.cnbm.packing.dto.IdVo;
|
2023-02-22 15:59:13 +08:00
|
|
|
|
import com.cnbm.packing.dto.WoPackagingBoxDTO;
|
2023-03-06 17:03:01 +08:00
|
|
|
|
import com.cnbm.packing.entity.WoPackagingBox;
|
2023-03-06 11:50:59 +08:00
|
|
|
|
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
2023-02-22 15:59:13 +08:00
|
|
|
|
import com.cnbm.packing.excel.WoPackagingBoxExcel;
|
2023-03-06 11:50:59 +08:00
|
|
|
|
import com.cnbm.packing.excel.WoPackagingBoxSubstrateExcel;
|
2023-02-22 15:59:13 +08:00
|
|
|
|
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 包装箱表 前端控制器
|
|
|
|
|
*
|
|
|
|
|
* @author packingGenerator
|
|
|
|
|
* @since 2023-02-15
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/packing/woPackagingBox")
|
|
|
|
|
@Api(tags="包装箱表")
|
|
|
|
|
public class WoPackagingBoxController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private WoPackagingBoxServiceBiz woPackagingBoxService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("page")
|
|
|
|
|
@ApiOperation("分页")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
|
|
|
|
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
|
|
|
|
|
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
|
|
|
|
|
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class),
|
|
|
|
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
|
|
|
|
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
|
|
|
|
|
@ApiImplicitParam(name = "boxNo", value = "boxid", paramType = "query", dataTypeClass = String.class),
|
|
|
|
|
@ApiImplicitParam(name = "lineBody", value = "线体", paramType = "query", dataTypeClass = Integer.class),
|
|
|
|
|
@ApiImplicitParam(name = "printStatus", value = "打印状态:0、未打印,1、已打印", paramType = "query", dataTypeClass = Integer.class),
|
|
|
|
|
@ApiImplicitParam(name = "model", value = "模式,1-手动模式;2-自动模式", paramType = "query", dataTypeClass = Integer.class)
|
|
|
|
|
})
|
2023-02-27 10:57:48 +08:00
|
|
|
|
@PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:page')")
|
2023-02-22 15:59:13 +08:00
|
|
|
|
public Result<PageData<WoPackagingBoxDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
|
|
|
|
PageData<WoPackagingBoxDTO> page = woPackagingBoxService.page(params);
|
|
|
|
|
|
|
|
|
|
return new Result<PageData<WoPackagingBoxDTO>>().ok(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("{id}")
|
|
|
|
|
@ApiOperation("信息")
|
2023-02-27 10:57:48 +08:00
|
|
|
|
@PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:info')")
|
2023-02-22 15:59:13 +08:00
|
|
|
|
public Result<WoPackagingBoxDTO> get(@PathVariable("id") Long id){
|
|
|
|
|
WoPackagingBoxDTO data = woPackagingBoxService.get(id);
|
|
|
|
|
|
|
|
|
|
return new Result<WoPackagingBoxDTO>().ok(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping
|
|
|
|
|
@ApiOperation("保存")
|
2023-02-27 10:57:48 +08:00
|
|
|
|
@LogOperation("保存")
|
|
|
|
|
@PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:save')")
|
2023-02-28 09:26:43 +08:00
|
|
|
|
public IdVo save(@RequestBody WoPackagingBoxDTO dto){
|
2023-02-22 15:59:13 +08:00
|
|
|
|
//效验数据
|
|
|
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
|
|
|
|
2023-02-28 09:26:43 +08:00
|
|
|
|
return woPackagingBoxService.add(dto);
|
2023-02-22 15:59:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping
|
|
|
|
|
@ApiOperation("修改")
|
2023-02-27 10:57:48 +08:00
|
|
|
|
@LogOperation("修改")
|
|
|
|
|
@PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:update')")
|
2023-02-22 15:59:13 +08:00
|
|
|
|
public Result<Long> update(@RequestBody WoPackagingBoxDTO dto){
|
|
|
|
|
//效验数据
|
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
|
|
|
|
|
|
|
|
woPackagingBoxService.update(dto);
|
|
|
|
|
|
|
|
|
|
return new Result<Long>().ok(dto.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@DeleteMapping
|
|
|
|
|
@ApiOperation("删除")
|
2023-02-27 10:57:48 +08:00
|
|
|
|
@LogOperation("删除")
|
|
|
|
|
@PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:delete')")
|
2023-02-22 15:59:13 +08:00
|
|
|
|
public Result delete(@RequestBody Long[] ids){
|
|
|
|
|
//效验数据
|
|
|
|
|
AssertUtils.isArrayEmpty(ids, "id");
|
|
|
|
|
|
|
|
|
|
woPackagingBoxService.delete(ids);
|
|
|
|
|
|
|
|
|
|
return new Result();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("export")
|
|
|
|
|
@ApiOperation("导出")
|
2023-02-27 10:57:48 +08:00
|
|
|
|
@LogOperation("导出")
|
|
|
|
|
@PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:export')")
|
2023-02-22 15:59:13 +08:00
|
|
|
|
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
|
|
|
|
List<WoPackagingBoxDTO> list = woPackagingBoxService.list(params);
|
|
|
|
|
|
|
|
|
|
ExcelUtils.exportExcelToTarget(response, null, list, WoPackagingBoxExcel.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "list")
|
|
|
|
|
@ApiOperation(value = "获取列表")
|
|
|
|
|
public List<WoPackagingBoxDTO> list() { return woPackagingBoxService.list(); }
|
|
|
|
|
|
2023-02-23 18:51:03 +08:00
|
|
|
|
@PostMapping(value = "printList/{id}")
|
|
|
|
|
@ApiOperation(value = "包装箱打印列表")
|
|
|
|
|
public Result<WoPackagingBoxDTO> printList(@PathVariable("id") Long id) {
|
|
|
|
|
|
|
|
|
|
WoPackagingBoxDTO data = woPackagingBoxService.printList(id);
|
|
|
|
|
|
|
|
|
|
return new Result<WoPackagingBoxDTO>().ok(data);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-06 11:50:59 +08:00
|
|
|
|
@GetMapping("exportSubstrateList")
|
|
|
|
|
@ApiOperation("箱单明细导出")
|
|
|
|
|
@LogOperation("箱单明细导出")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
|
|
|
|
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
|
|
|
|
|
@ApiImplicitParam(name = "boxNo", value = "boxid", paramType = "query", dataTypeClass = String.class),
|
|
|
|
|
@ApiImplicitParam(name = "lineBody", value = "线体", paramType = "query", dataTypeClass = Integer.class),
|
|
|
|
|
@ApiImplicitParam(name = "printStatus", value = "打印状态:0、未打印,1、已打印", paramType = "query", dataTypeClass = Integer.class),
|
|
|
|
|
@ApiImplicitParam(name = "model", value = "模式,1-手动模式;2-自动模式", paramType = "query", dataTypeClass = Integer.class)
|
|
|
|
|
})
|
|
|
|
|
public void exportSubstrateList(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
|
|
|
|
List<WoPackagingBoxSubstrate> list = woPackagingBoxService.substrateList(params);
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
ExcelUtils.exportExcelToTarget(response, "箱单明细", list, WoPackagingBoxSubstrateExcel.class);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-06 17:03:01 +08:00
|
|
|
|
@GetMapping("boxList/{woSubstrateId}")
|
|
|
|
|
@ApiOperation("查询模组id所在包装箱")
|
|
|
|
|
public List<WoPackagingBox> get(@PathVariable("woSubstrateId") String woSubstrateId){
|
|
|
|
|
return woPackagingBoxService.boxList(woSubstrateId);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-22 15:59:13 +08:00
|
|
|
|
}
|