update 生产订单、生产计划代码生成
parent
dfe9aa755c
commit
2dafc80207
@ -0,0 +1,117 @@
|
||||
package org.dromara.mes.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.mes.domain.vo.ProdOrderInfoVo;
|
||||
import org.dromara.mes.domain.bo.ProdOrderInfoBo;
|
||||
import org.dromara.mes.service.IProdOrderInfoService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生产订单信息
|
||||
* 前端访问路由地址为:/mes/orderInfo
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/orderInfo")
|
||||
public class ProdOrderInfoController extends BaseController {
|
||||
|
||||
private final IProdOrderInfoService prodOrderInfoService;
|
||||
|
||||
/**
|
||||
* 查询生产订单信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:orderInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ProdOrderInfoVo> list(ProdOrderInfoBo bo, PageQuery pageQuery) {
|
||||
return prodOrderInfoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出生产订单信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:orderInfo:export")
|
||||
@Log(title = "生产订单信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(ProdOrderInfoBo bo, HttpServletResponse response) {
|
||||
List<ProdOrderInfoVo> list = prodOrderInfoService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "生产订单信息", ProdOrderInfoVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生产订单信息详细信息
|
||||
*
|
||||
* @param productOrderId 主键
|
||||
*/
|
||||
@SaCheckPermission("mes:orderInfo:query")
|
||||
@GetMapping("/{productOrderId}")
|
||||
public R<ProdOrderInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long productOrderId) {
|
||||
return R.ok(prodOrderInfoService.queryById(productOrderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产订单信息
|
||||
*/
|
||||
@SaCheckPermission("mes:orderInfo:add")
|
||||
@Log(title = "生产订单信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ProdOrderInfoBo bo) {
|
||||
return toAjax(prodOrderInfoService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产订单信息
|
||||
*/
|
||||
@SaCheckPermission("mes:orderInfo:edit")
|
||||
@Log(title = "生产订单信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProdOrderInfoBo bo) {
|
||||
return toAjax(prodOrderInfoService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产订单信息
|
||||
*
|
||||
* @param productOrderIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("mes:orderInfo:remove")
|
||||
@Log(title = "生产订单信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{productOrderIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] productOrderIds) {
|
||||
return toAjax(prodOrderInfoService.deleteWithValidByIds(List.of(productOrderIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询生产订单信息列表
|
||||
*/
|
||||
|
||||
@GetMapping("getProdOrderInfoList")
|
||||
public R<List<ProdOrderInfoVo>> getProdOrderInfolist(ProdOrderInfoBo bo) {
|
||||
List<ProdOrderInfoVo> list = prodOrderInfoService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package org.dromara.mes.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.mes.domain.vo.ProdPlanInfoVo;
|
||||
import org.dromara.mes.domain.bo.ProdPlanInfoBo;
|
||||
import org.dromara.mes.service.IProdPlanInfoService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生产工单信息
|
||||
* 前端访问路由地址为:/mes/planInfo
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/planInfo")
|
||||
public class ProdPlanInfoController extends BaseController {
|
||||
|
||||
private final IProdPlanInfoService prodPlanInfoService;
|
||||
|
||||
/**
|
||||
* 查询生产工单信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:planInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ProdPlanInfoVo> list(ProdPlanInfoBo bo, PageQuery pageQuery) {
|
||||
return prodPlanInfoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出生产工单信息列表
|
||||
*/
|
||||
@SaCheckPermission("mes:planInfo:export")
|
||||
@Log(title = "生产工单信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(ProdPlanInfoBo bo, HttpServletResponse response) {
|
||||
List<ProdPlanInfoVo> list = prodPlanInfoService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "生产工单信息", ProdPlanInfoVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生产工单信息详细信息
|
||||
*
|
||||
* @param planId 主键
|
||||
*/
|
||||
@SaCheckPermission("mes:planInfo:query")
|
||||
@GetMapping("/{planId}")
|
||||
public R<ProdPlanInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long planId) {
|
||||
return R.ok(prodPlanInfoService.queryById(planId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产工单信息
|
||||
*/
|
||||
@SaCheckPermission("mes:planInfo:add")
|
||||
@Log(title = "生产工单信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ProdPlanInfoBo bo) {
|
||||
return toAjax(prodPlanInfoService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产工单信息
|
||||
*/
|
||||
@SaCheckPermission("mes:planInfo:edit")
|
||||
@Log(title = "生产工单信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProdPlanInfoBo bo) {
|
||||
return toAjax(prodPlanInfoService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产工单信息
|
||||
*
|
||||
* @param planIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("mes:planInfo:remove")
|
||||
@Log(title = "生产工单信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{planIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] planIds) {
|
||||
return toAjax(prodPlanInfoService.deleteWithValidByIds(List.of(planIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询生产工单信息列表
|
||||
*/
|
||||
|
||||
@GetMapping("getProdPlanInfoList")
|
||||
public R<List<ProdPlanInfoVo>> getProdPlanInfolist(ProdPlanInfoBo bo) {
|
||||
List<ProdPlanInfoVo> list = prodPlanInfoService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mes.mapper;
|
||||
|
||||
import org.dromara.mes.domain.ProdOrderInfo;
|
||||
import org.dromara.mes.domain.vo.ProdOrderInfoVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 生产订单信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public interface ProdOrderInfoMapper extends BaseMapperPlus<ProdOrderInfo, ProdOrderInfoVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mes.mapper;
|
||||
|
||||
import org.dromara.mes.domain.ProdPlanInfo;
|
||||
import org.dromara.mes.domain.vo.ProdPlanInfoVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 生产工单信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public interface ProdPlanInfoMapper extends BaseMapperPlus<ProdPlanInfo, ProdPlanInfoVo> {
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.dromara.mes.service;
|
||||
|
||||
import org.dromara.mes.domain.ProdOrderInfo;
|
||||
import org.dromara.mes.domain.vo.ProdOrderInfoVo;
|
||||
import org.dromara.mes.domain.bo.ProdOrderInfoBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产订单信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public interface IProdOrderInfoService {
|
||||
|
||||
/**
|
||||
* 查询生产订单信息
|
||||
*
|
||||
* @param productOrderId 主键
|
||||
* @return 生产订单信息
|
||||
*/
|
||||
ProdOrderInfoVo queryById(Long productOrderId);
|
||||
|
||||
/**
|
||||
* 分页查询生产订单信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 生产订单信息分页列表
|
||||
*/
|
||||
TableDataInfo<ProdOrderInfoVo> queryPageList(ProdOrderInfoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的生产订单信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 生产订单信息列表
|
||||
*/
|
||||
List<ProdOrderInfoVo> queryList(ProdOrderInfoBo bo);
|
||||
|
||||
/**
|
||||
* 新增生产订单信息
|
||||
*
|
||||
* @param bo 生产订单信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(ProdOrderInfoBo bo);
|
||||
|
||||
/**
|
||||
* 修改生产订单信息
|
||||
*
|
||||
* @param bo 生产订单信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(ProdOrderInfoBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除生产订单信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.dromara.mes.service;
|
||||
|
||||
import org.dromara.mes.domain.ProdPlanInfo;
|
||||
import org.dromara.mes.domain.vo.ProdPlanInfoVo;
|
||||
import org.dromara.mes.domain.bo.ProdPlanInfoBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产工单信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public interface IProdPlanInfoService {
|
||||
|
||||
/**
|
||||
* 查询生产工单信息
|
||||
*
|
||||
* @param planId 主键
|
||||
* @return 生产工单信息
|
||||
*/
|
||||
ProdPlanInfoVo queryById(Long planId);
|
||||
|
||||
/**
|
||||
* 分页查询生产工单信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 生产工单信息分页列表
|
||||
*/
|
||||
TableDataInfo<ProdPlanInfoVo> queryPageList(ProdPlanInfoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的生产工单信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 生产工单信息列表
|
||||
*/
|
||||
List<ProdPlanInfoVo> queryList(ProdPlanInfoBo bo);
|
||||
|
||||
/**
|
||||
* 新增生产工单信息
|
||||
*
|
||||
* @param bo 生产工单信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(ProdPlanInfoBo bo);
|
||||
|
||||
/**
|
||||
* 修改生产工单信息
|
||||
*
|
||||
* @param bo 生产工单信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(ProdPlanInfoBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除生产工单信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
package org.dromara.mes.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.mes.domain.bo.ProdOrderInfoBo;
|
||||
import org.dromara.mes.domain.vo.ProdOrderInfoVo;
|
||||
import org.dromara.mes.domain.ProdOrderInfo;
|
||||
import org.dromara.mes.mapper.ProdOrderInfoMapper;
|
||||
import org.dromara.mes.service.IProdOrderInfoService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 生产订单信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class ProdOrderInfoServiceImpl implements IProdOrderInfoService {
|
||||
|
||||
private final ProdOrderInfoMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询生产订单信息
|
||||
*
|
||||
* @param productOrderId 主键
|
||||
* @return 生产订单信息
|
||||
*/
|
||||
@Override
|
||||
public ProdOrderInfoVo queryById(Long productOrderId){
|
||||
return baseMapper.selectVoById(productOrderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询生产订单信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 生产订单信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<ProdOrderInfoVo> queryPageList(ProdOrderInfoBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<ProdOrderInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<ProdOrderInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的生产订单信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 生产订单信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProdOrderInfoVo> queryList(ProdOrderInfoBo bo) {
|
||||
MPJLambdaWrapper<ProdOrderInfo> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<ProdOrderInfo> buildQueryWrapper(ProdOrderInfoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<ProdOrderInfo> lqw = JoinWrappers.lambda(ProdOrderInfo.class)
|
||||
.selectAll(ProdOrderInfo.class)
|
||||
.eq(bo.getProductOrderId() != null, ProdOrderInfo::getProductOrderId, bo.getProductOrderId())
|
||||
.eq(StringUtils.isNotBlank(bo.getOrderCode()), ProdOrderInfo::getOrderCode, bo.getOrderCode())
|
||||
.eq(bo.getSaleOrderId() != null, ProdOrderInfo::getSaleOrderId, bo.getSaleOrderId())
|
||||
.eq(StringUtils.isNotBlank(bo.getProjectNo()), ProdOrderInfo::getProjectNo, bo.getProjectNo())
|
||||
.eq(StringUtils.isNotBlank(bo.getOrderType()), ProdOrderInfo::getOrderType, bo.getOrderType())
|
||||
.eq(bo.getMaterialId() != null, ProdOrderInfo::getMaterialId, bo.getMaterialId())
|
||||
.eq(bo.getMaterialBomId() != null, ProdOrderInfo::getMaterialBomId, bo.getMaterialBomId())
|
||||
.eq(StringUtils.isNotBlank(bo.getDispatchType()), ProdOrderInfo::getDispatchType, bo.getDispatchType())
|
||||
.eq(bo.getDispatchId() != null, ProdOrderInfo::getDispatchId, bo.getDispatchId())
|
||||
.eq(bo.getSaleAmount() != null, ProdOrderInfo::getSaleAmount, bo.getSaleAmount())
|
||||
.eq(bo.getPlanDeliveryDate() != null, ProdOrderInfo::getPlanDeliveryDate, bo.getPlanDeliveryDate())
|
||||
.eq(bo.getPlanAmount() != null, ProdOrderInfo::getPlanAmount, bo.getPlanAmount())
|
||||
.eq(bo.getDispatchAmount() != null, ProdOrderInfo::getDispatchAmount, bo.getDispatchAmount())
|
||||
.eq(bo.getCompleteAmount() != null, ProdOrderInfo::getCompleteAmount, bo.getCompleteAmount())
|
||||
.eq(bo.getReleaseTime() != null, ProdOrderInfo::getReleaseTime, bo.getReleaseTime())
|
||||
.eq(bo.getPlanBeginTime() != null, ProdOrderInfo::getPlanBeginTime, bo.getPlanBeginTime())
|
||||
.eq(bo.getPlanEndTime() != null, ProdOrderInfo::getPlanEndTime, bo.getPlanEndTime())
|
||||
.eq(bo.getRealBeginTime() != null, ProdOrderInfo::getRealBeginTime, bo.getRealBeginTime())
|
||||
.eq(bo.getRealEndTime() != null, ProdOrderInfo::getRealEndTime, bo.getRealEndTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getOrderStatus()), ProdOrderInfo::getOrderStatus, bo.getOrderStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getStockLockFlag()), ProdOrderInfo::getStockLockFlag, bo.getStockLockFlag())
|
||||
.eq(bo.getPreOrderId() != null, ProdOrderInfo::getPreOrderId, bo.getPreOrderId())
|
||||
.eq(StringUtils.isNotBlank(bo.getPreOrderCode()), ProdOrderInfo::getPreOrderCode, bo.getPreOrderCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getFinishFlag()), ProdOrderInfo::getFinishFlag, bo.getFinishFlag())
|
||||
.eq(StringUtils.isNotBlank(bo.getReleaseFlag()), ProdOrderInfo::getReleaseFlag, bo.getReleaseFlag())
|
||||
.eq(StringUtils.isNotBlank(bo.getOrderVersion()), ProdOrderInfo::getOrderVersion, bo.getOrderVersion())
|
||||
.eq(bo.getFactoryId() != null, ProdOrderInfo::getFactoryId, bo.getFactoryId())
|
||||
.orderByDesc(ProdOrderInfo::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产订单信息
|
||||
*
|
||||
* @param bo 生产订单信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(ProdOrderInfoBo bo) {
|
||||
ProdOrderInfo add = MapstructUtils.convert(bo, ProdOrderInfo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setProductOrderId(add.getProductOrderId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产订单信息
|
||||
*
|
||||
* @param bo 生产订单信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(ProdOrderInfoBo bo) {
|
||||
ProdOrderInfo update = MapstructUtils.convert(bo, ProdOrderInfo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ProdOrderInfo entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除生产订单信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
package org.dromara.mes.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.mes.domain.bo.ProdPlanInfoBo;
|
||||
import org.dromara.mes.domain.vo.ProdPlanInfoVo;
|
||||
import org.dromara.mes.domain.ProdPlanInfo;
|
||||
import org.dromara.mes.mapper.ProdPlanInfoMapper;
|
||||
import org.dromara.mes.service.IProdPlanInfoService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 生产工单信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
||||
|
||||
private final ProdPlanInfoMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询生产工单信息
|
||||
*
|
||||
* @param planId 主键
|
||||
* @return 生产工单信息
|
||||
*/
|
||||
@Override
|
||||
public ProdPlanInfoVo queryById(Long planId){
|
||||
return baseMapper.selectVoById(planId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询生产工单信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 生产工单信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<ProdPlanInfoVo> queryPageList(ProdPlanInfoBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<ProdPlanInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<ProdPlanInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的生产工单信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 生产工单信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProdPlanInfoVo> queryList(ProdPlanInfoBo bo) {
|
||||
MPJLambdaWrapper<ProdPlanInfo> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<ProdPlanInfo> buildQueryWrapper(ProdPlanInfoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<ProdPlanInfo> lqw = JoinWrappers.lambda(ProdPlanInfo.class)
|
||||
.selectAll(ProdPlanInfo.class)
|
||||
.eq(bo.getPlanId() != null, ProdPlanInfo::getPlanId, bo.getPlanId())
|
||||
.eq(bo.getProductOrderId() != null, ProdPlanInfo::getProductOrderId, bo.getProductOrderId())
|
||||
.eq(bo.getSaleOrderId() != null, ProdPlanInfo::getSaleOrderId, bo.getSaleOrderId())
|
||||
.eq(StringUtils.isNotBlank(bo.getSaleorderCode()), ProdPlanInfo::getSaleorderCode, bo.getSaleorderCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getPlanCode()), ProdPlanInfo::getPlanCode, bo.getPlanCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getDispatchCode()), ProdPlanInfo::getDispatchCode, bo.getDispatchCode())
|
||||
.eq(bo.getMaterialId() != null, ProdPlanInfo::getMaterialId, bo.getMaterialId())
|
||||
.eq(bo.getMaterialBomId() != null, ProdPlanInfo::getMaterialBomId, bo.getMaterialBomId())
|
||||
.eq(bo.getProcessId() != null, ProdPlanInfo::getProcessId, bo.getProcessId())
|
||||
.eq(bo.getProcessOrder() != null, ProdPlanInfo::getProcessOrder, bo.getProcessOrder())
|
||||
.eq(bo.getLastProcessId() != null, ProdPlanInfo::getLastProcessId, bo.getLastProcessId())
|
||||
.eq(StringUtils.isNotBlank(bo.getFinalProcessFlag()), ProdPlanInfo::getFinalProcessFlag, bo.getFinalProcessFlag())
|
||||
.eq(StringUtils.isNotBlank(bo.getReleaseType()), ProdPlanInfo::getReleaseType, bo.getReleaseType())
|
||||
.eq(bo.getReleaseId() != null, ProdPlanInfo::getReleaseId, bo.getReleaseId())
|
||||
.eq(bo.getProductionTime() != null, ProdPlanInfo::getProductionTime, bo.getProductionTime())
|
||||
.eq(bo.getPlanAmount() != null, ProdPlanInfo::getPlanAmount, bo.getPlanAmount())
|
||||
.eq(bo.getDispatchAmount() != null, ProdPlanInfo::getDispatchAmount, bo.getDispatchAmount())
|
||||
.eq(bo.getCompleteAmount() != null, ProdPlanInfo::getCompleteAmount, bo.getCompleteAmount())
|
||||
.eq(bo.getPlanBeginTime() != null, ProdPlanInfo::getPlanBeginTime, bo.getPlanBeginTime())
|
||||
.eq(bo.getPlanEndTime() != null, ProdPlanInfo::getPlanEndTime, bo.getPlanEndTime())
|
||||
.eq(bo.getRealBeginTime() != null, ProdPlanInfo::getRealBeginTime, bo.getRealBeginTime())
|
||||
.eq(bo.getRealEndTime() != null, ProdPlanInfo::getRealEndTime, bo.getRealEndTime())
|
||||
.eq(StringUtils.isNotBlank(bo.getAttachId()), ProdPlanInfo::getAttachId, bo.getAttachId())
|
||||
.eq(StringUtils.isNotBlank(bo.getPlanStatus()), ProdPlanInfo::getPlanStatus, bo.getPlanStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getImportFlag()), ProdPlanInfo::getImportFlag, bo.getImportFlag())
|
||||
.eq(StringUtils.isNotBlank(bo.getFinishFlag()), ProdPlanInfo::getFinishFlag, bo.getFinishFlag())
|
||||
.eq(bo.getPriority() != null, ProdPlanInfo::getPriority, bo.getPriority())
|
||||
.eq(bo.getShiftId() != null, ProdPlanInfo::getShiftId, bo.getShiftId())
|
||||
.eq(bo.getClassTeamId() != null, ProdPlanInfo::getClassTeamId, bo.getClassTeamId())
|
||||
.eq(StringUtils.isNotBlank(bo.getModelCode()), ProdPlanInfo::getModelCode, bo.getModelCode())
|
||||
.orderByDesc(ProdPlanInfo::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产工单信息
|
||||
*
|
||||
* @param bo 生产工单信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(ProdPlanInfoBo bo) {
|
||||
ProdPlanInfo add = MapstructUtils.convert(bo, ProdPlanInfo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setPlanId(add.getPlanId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产工单信息
|
||||
*
|
||||
* @param bo 生产工单信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(ProdPlanInfoBo bo) {
|
||||
ProdPlanInfo update = MapstructUtils.convert(bo, ProdPlanInfo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ProdPlanInfo entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除生产工单信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.mes.mapper.ProdOrderInfoMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.mes.mapper.ProdPlanInfoMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue