parent
2587ce307b
commit
1fd3d86e83
@ -0,0 +1,95 @@
|
||||
package com.chanko.yunxi.mes.module.biz.controller.admin.tplusstorageout;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
|
||||
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.chanko.yunxi.mes.module.biz.controller.admin.tplusstorageout.vo.*;
|
||||
import com.chanko.yunxi.mes.module.biz.dal.dataobject.tplusstorageout.TplusStorageOutDO;
|
||||
import com.chanko.yunxi.mes.module.biz.service.tplusstorageout.TplusStorageOutService;
|
||||
|
||||
@Tag(name = "管理后台 - 用友生产领料")
|
||||
@RestController
|
||||
@RequestMapping("/biz/tplus-storage-out")
|
||||
@Validated
|
||||
public class TplusStorageOutController {
|
||||
|
||||
@Resource
|
||||
private TplusStorageOutService tplusStorageOutService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用友生产领料")
|
||||
@PreAuthorize("@ss.hasPermission('biz:tplus-storage-out:create')")
|
||||
public CommonResult<Long> createTplusStorageOut(@Valid @RequestBody TplusStorageOutSaveReqVO createReqVO) {
|
||||
return success(tplusStorageOutService.createTplusStorageOut(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用友生产领料")
|
||||
@PreAuthorize("@ss.hasPermission('biz:tplus-storage-out:update')")
|
||||
public CommonResult<Boolean> updateTplusStorageOut(@Valid @RequestBody TplusStorageOutSaveReqVO updateReqVO) {
|
||||
tplusStorageOutService.updateTplusStorageOut(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用友生产领料")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:tplus-storage-out:delete')")
|
||||
public CommonResult<Boolean> deleteTplusStorageOut(@RequestParam("id") Long id) {
|
||||
tplusStorageOutService.deleteTplusStorageOut(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用友生产领料")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:tplus-storage-out:query')")
|
||||
public CommonResult<TplusStorageOutRespVO> getTplusStorageOut(@RequestParam("id") Long id) {
|
||||
TplusStorageOutDO tplusStorageOut = tplusStorageOutService.getTplusStorageOut(id);
|
||||
return success(BeanUtils.toBean(tplusStorageOut, TplusStorageOutRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用友生产领料分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:tplus-storage-out:query')")
|
||||
public CommonResult<PageResult<TplusStorageOutRespVO>> getTplusStorageOutPage(@Valid TplusStorageOutPageReqVO pageReqVO) {
|
||||
PageResult<TplusStorageOutDO> pageResult = tplusStorageOutService.getTplusStorageOutPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TplusStorageOutRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出用友生产领料 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('biz:tplus-storage-out:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportTplusStorageOutExcel(@Valid TplusStorageOutPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<TplusStorageOutDO> list = tplusStorageOutService.getTplusStorageOutPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "用友生产领料.xls", "数据", TplusStorageOutRespVO.class,
|
||||
BeanUtils.toBean(list, TplusStorageOutRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.chanko.yunxi.mes.module.biz.controller.admin.tplusstorageout.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用友生产领料分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TplusStorageOutPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "自增字段,唯一")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "出库id")
|
||||
private Long stockId;
|
||||
|
||||
@Schema(description = "领料数量")
|
||||
private BigDecimal storageOkQty;
|
||||
|
||||
@Schema(description = "产品编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
private String projectSubCode;
|
||||
|
||||
@Schema(description = "工序id")
|
||||
private Long procedureId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "是否推送")
|
||||
private Integer isSend;
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.chanko.yunxi.mes.module.biz.controller.admin.tplusstorageout.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用友生产领料 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TplusStorageOutRespVO {
|
||||
|
||||
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("自增字段,唯一")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "出库id")
|
||||
@ExcelProperty("出库id")
|
||||
private Long stockId;
|
||||
|
||||
@Schema(description = "领料数量")
|
||||
@ExcelProperty("领料数量")
|
||||
private BigDecimal storageOkQty;
|
||||
|
||||
@Schema(description = "产品编码")
|
||||
@ExcelProperty("产品编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
@ExcelProperty("物料编码")
|
||||
private String projectSubCode;
|
||||
|
||||
@Schema(description = "工序id")
|
||||
@ExcelProperty("工序id")
|
||||
private Long procedureId;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "是否推送")
|
||||
@ExcelProperty("是否推送")
|
||||
private Integer isSend;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.chanko.yunxi.mes.module.biz.controller.admin.tplusstorageout.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 用友生产领料新增/修改 Request VO")
|
||||
@Data
|
||||
public class TplusStorageOutSaveReqVO {
|
||||
|
||||
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "出库id")
|
||||
private Long stockId;
|
||||
|
||||
@Schema(description = "领料数量")
|
||||
private BigDecimal storageOkQty;
|
||||
|
||||
@Schema(description = "产品编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
private String projectSubCode;
|
||||
|
||||
@Schema(description = "工序id")
|
||||
private Long procedureId;
|
||||
|
||||
@Schema(description = "是否推送")
|
||||
private Integer isSend;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.chanko.yunxi.mes.module.biz.dal.mysql.tplusstorageout;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.chanko.yunxi.mes.module.biz.dal.dataobject.tplusstorageout.TplusStorageOutDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.chanko.yunxi.mes.module.biz.controller.admin.tplusstorageout.vo.*;
|
||||
|
||||
/**
|
||||
* 用友生产领料 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface TplusStorageOutMapper extends BaseMapperX<TplusStorageOutDO> {
|
||||
|
||||
default PageResult<TplusStorageOutDO> selectPage(TplusStorageOutPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TplusStorageOutDO>()
|
||||
.eqIfPresent(TplusStorageOutDO::getId, reqVO.getId())
|
||||
.eqIfPresent(TplusStorageOutDO::getStockId, reqVO.getStockId())
|
||||
.eqIfPresent(TplusStorageOutDO::getStorageOkQty, reqVO.getStorageOkQty())
|
||||
.eqIfPresent(TplusStorageOutDO::getProductCode, reqVO.getProductCode())
|
||||
.eqIfPresent(TplusStorageOutDO::getProjectSubCode, reqVO.getProjectSubCode())
|
||||
.eqIfPresent(TplusStorageOutDO::getProcedureId, reqVO.getProcedureId())
|
||||
.betweenIfPresent(TplusStorageOutDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(TplusStorageOutDO::getIsSend, reqVO.getIsSend())
|
||||
.orderByDesc(TplusStorageOutDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.chanko.yunxi.mes.module.biz.service.tplusstorageout;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.chanko.yunxi.mes.module.biz.controller.admin.tplusstorageout.vo.*;
|
||||
import com.chanko.yunxi.mes.module.biz.dal.dataobject.tplusstorageout.TplusStorageOutDO;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 用友生产领料 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface TplusStorageOutService {
|
||||
|
||||
/**
|
||||
* 创建用友生产领料
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createTplusStorageOut(@Valid TplusStorageOutSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用友生产领料
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateTplusStorageOut(@Valid TplusStorageOutSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用友生产领料
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteTplusStorageOut(Long id);
|
||||
|
||||
/**
|
||||
* 获得用友生产领料
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用友生产领料
|
||||
*/
|
||||
TplusStorageOutDO getTplusStorageOut(Long id);
|
||||
|
||||
/**
|
||||
* 获得用友生产领料分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用友生产领料分页
|
||||
*/
|
||||
PageResult<TplusStorageOutDO> getTplusStorageOutPage(TplusStorageOutPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.chanko.yunxi.mes.module.biz.service.tplusstorageout;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import com.chanko.yunxi.mes.module.biz.controller.admin.tplusstorageout.vo.*;
|
||||
import com.chanko.yunxi.mes.module.biz.dal.dataobject.tplusstorageout.TplusStorageOutDO;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.chanko.yunxi.mes.module.biz.dal.mysql.tplusstorageout.TplusStorageOutMapper;
|
||||
|
||||
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.chanko.yunxi.mes.module.biz.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用友生产领料 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TplusStorageOutServiceImpl implements TplusStorageOutService {
|
||||
|
||||
@Resource
|
||||
private TplusStorageOutMapper tplusStorageOutMapper;
|
||||
|
||||
@Override
|
||||
public Long createTplusStorageOut(TplusStorageOutSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
TplusStorageOutDO tplusStorageOut = BeanUtils.toBean(createReqVO, TplusStorageOutDO.class);
|
||||
tplusStorageOutMapper.insert(tplusStorageOut);
|
||||
// 返回
|
||||
return tplusStorageOut.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTplusStorageOut(TplusStorageOutSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateTplusStorageOutExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TplusStorageOutDO updateObj = BeanUtils.toBean(updateReqVO, TplusStorageOutDO.class);
|
||||
tplusStorageOutMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTplusStorageOut(Long id) {
|
||||
// 校验存在
|
||||
validateTplusStorageOutExists(id);
|
||||
// 删除
|
||||
tplusStorageOutMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateTplusStorageOutExists(Long id) {
|
||||
if (tplusStorageOutMapper.selectById(id) == null) {
|
||||
throw exception(TPLUS_STORAGE_OUT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TplusStorageOutDO getTplusStorageOut(Long id) {
|
||||
return tplusStorageOutMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TplusStorageOutDO> getTplusStorageOutPage(TplusStorageOutPageReqVO pageReqVO) {
|
||||
return tplusStorageOutMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue