解决依赖冲突

This commit is contained in:
2025-08-07 13:09:48 +08:00
parent 86f0f21f86
commit 71f18458d6
13 changed files with 228 additions and 55 deletions

View File

@ -67,6 +67,7 @@ public class BusCailiaoshebeiController extends BaseController {
@GetMapping("/pcList") @GetMapping("/pcList")
public TableDataInfo<BusCailiaoshebeiPiciVo> pcList(BusCailiaoshebeiPiciPcListReq bo, PageQuery pageQuery) { public TableDataInfo<BusCailiaoshebeiPiciVo> pcList(BusCailiaoshebeiPiciPcListReq bo, PageQuery pageQuery) {
BusCailiaoshebeiPiciBo busCailiaoshebeiPiciBo = BeanUtil.copyProperties(bo, BusCailiaoshebeiPiciBo.class); BusCailiaoshebeiPiciBo busCailiaoshebeiPiciBo = BeanUtil.copyProperties(bo, BusCailiaoshebeiPiciBo.class);
// busCailiaoshebeiPiciBo.setCxsj("1"); //作为查询数据-设计
busCailiaoshebeiPiciBo.setBatchType("1"); busCailiaoshebeiPiciBo.setBatchType("1");
return busCailiaoshebeiPiciService.queryPageList(busCailiaoshebeiPiciBo, pageQuery); return busCailiaoshebeiPiciService.queryPageList(busCailiaoshebeiPiciBo, pageQuery);
} }
@ -79,7 +80,7 @@ public class BusCailiaoshebeiController extends BaseController {
@DeleteMapping("/pcDelete/{ids}") @DeleteMapping("/pcDelete/{ids}")
public R<Void> pcDelete(@NotEmpty(message = "主键不能为空") public R<Void> pcDelete(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) { @PathVariable Long[] ids) {
return toAjax(busCailiaoshebeiPiciService.deleteWithValidByIds(List.of(ids), true)); return toAjax(busCailiaoshebeiPiciService.deleteWithValidByIds(List.of(ids), true, "1"));
} }
/** /**
@ -139,17 +140,7 @@ public class BusCailiaoshebeiController extends BaseController {
return toAjax(busCailiaoshebeiService.deleteWithValidByIds(List.of(ids), true)); return toAjax(busCailiaoshebeiService.deleteWithValidByIds(List.of(ids), true));
} }
/**
* 设计-提交审批按钮
*
*/
@SaCheckPermission("cailiaoshebei:cailiaoshebei:SubmitForApprovalButton")
@Log(title = "设计-提交审批按钮", businessType = BusinessType.DELETE)
@PostMapping("/SubmitForApprovalButton")
public R<Void> submitForApprovalButton() {
return null;
}
// /** // /**
@ -172,6 +163,7 @@ public class BusCailiaoshebeiController extends BaseController {
@GetMapping("/pcPlanList") @GetMapping("/pcPlanList")
public TableDataInfo<BusCailiaoshebeiPiciVo> pcPlanList(BusCailiaoshebeiPiciPcListReq bo, PageQuery pageQuery) { public TableDataInfo<BusCailiaoshebeiPiciVo> pcPlanList(BusCailiaoshebeiPiciPcListReq bo, PageQuery pageQuery) {
BusCailiaoshebeiPiciBo busCailiaoshebeiPiciBo = BeanUtil.copyProperties(bo, BusCailiaoshebeiPiciBo.class); BusCailiaoshebeiPiciBo busCailiaoshebeiPiciBo = BeanUtil.copyProperties(bo, BusCailiaoshebeiPiciBo.class);
busCailiaoshebeiPiciBo.setCxsj("1"); //设计完成,才能展示计划
busCailiaoshebeiPiciBo.setBatchType("1"); busCailiaoshebeiPiciBo.setBatchType("1");
return busCailiaoshebeiPiciService.queryPageList(busCailiaoshebeiPiciBo, pageQuery); return busCailiaoshebeiPiciService.queryPageList(busCailiaoshebeiPiciBo, pageQuery);
} }
@ -185,37 +177,17 @@ public class BusCailiaoshebeiController extends BaseController {
return busCailiaoshebeiService.queryPageListPlan(bo, pageQuery); return busCailiaoshebeiService.queryPageListPlan(bo, pageQuery);
} }
/**
* 计划-删除批次号
*/
@SaCheckPermission("cailiaoshebei:cailiaoshebei:deletePlan")
@Log(title = "计划-删除批次号", businessType = BusinessType.DELETE)
@DeleteMapping("/deletePlan/{ids}")
public R<Void> deletePlan(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(busCailiaoshebeiPiciService.deleteWithValidByIds(List.of(ids), true));
}
// /** // /**
// * 计划-材料设备清单子列表 // * 计划-删除批次号
// */ // */
// @SaCheckPermission("cailiaoshebei:cailiaoshebei:listPlanSon") // @SaCheckPermission("cailiaoshebei:cailiaoshebei:deletePlan")
// @GetMapping("/listPlanSon") // @Log(title = "计划-删除批次号", businessType = BusinessType.DELETE)
// public TableDataInfo<BusSuppliespriceVo> listPlanSon(BusSuppliespriceBo bo, PageQuery pageQuery) { // @DeleteMapping("/deletePlan/{ids}")
// return busSuppliespriceService.queryPageList(bo, pageQuery); // public R<Void> deletePlan(@NotEmpty(message = "主键不能为空")
// @PathVariable Long[] ids) {
// return toAjax(busCailiaoshebeiPiciService.deleteWithValidByIds(List.of(ids), true, "2"));
// } // }
// /**
// * 计划-新增材料设备清单子数据
// */
// @SaCheckPermission("cailiaoshebei:cailiaoshebei:addPlanSon")
// @Log(title = "物资-物资清单", businessType = BusinessType.INSERT)
// @RepeatSubmit()
// @PostMapping("/addPlanSon")
// public R<Void> addPlanSon(@Validated(AddGroup.class) @RequestBody BusSuppliespriceBo bo) {
// return toAjax(busSuppliespriceService.insertByBo(bo));
// }
/** /**
* 计划-获取物资清单详细信息 * 计划-获取物资清单详细信息

View File

@ -100,6 +100,6 @@ public class BusCailiaoshebeiPiciController extends BaseController {
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) { @PathVariable Long[] ids) {
return toAjax(busCailiaoshebeiPiciService.deleteWithValidByIds(List.of(ids), true)); return toAjax(busCailiaoshebeiPiciService.deleteWithValidByIds(List.of(ids), true, "0"));
} }
} }

View File

@ -46,10 +46,10 @@ public class BusMaterialbatchdemandplanController extends BaseController {
private final IBusCailiaoshebeiService busCailiaoshebeiService; private final IBusCailiaoshebeiService busCailiaoshebeiService;
/** /**
* 设计-新增批次号 * 需求-新增批次号
*/ */
@SaCheckPermission("cailiaoshebei:materialbatchdemandplan:pcAdd") @SaCheckPermission("cailiaoshebei:materialbatchdemandplan:pcAdd")
@Log(title = "物资-批次号", businessType = BusinessType.INSERT) @Log(title = "需求-新增批次号", businessType = BusinessType.INSERT)
@RepeatSubmit() @RepeatSubmit()
@PostMapping("/pcAdd") @PostMapping("/pcAdd")
public R<Void> pcAdd(@Validated(AddGroup.class) @RequestBody BusCailiaoshebeiPiciAddReq bo) { public R<Void> pcAdd(@Validated(AddGroup.class) @RequestBody BusCailiaoshebeiPiciAddReq bo) {
@ -61,25 +61,26 @@ public class BusMaterialbatchdemandplanController extends BaseController {
} }
/** /**
* 设计-批次号列表 * 批次号列表
*/ */
@SaCheckPermission("cailiaoshebei:materialbatchdemandplan:pcList") @SaCheckPermission("cailiaoshebei:materialbatchdemandplan:pcList")
@GetMapping("/pcList") @GetMapping("/pcList")
public TableDataInfo<BusCailiaoshebeiPiciVo> pcList(BusCailiaoshebeiPiciPcListReq bo, PageQuery pageQuery) { public TableDataInfo<BusCailiaoshebeiPiciVo> pcList(BusCailiaoshebeiPiciPcListReq bo, PageQuery pageQuery) {
BusCailiaoshebeiPiciBo busCailiaoshebeiPiciBo = BeanUtil.copyProperties(bo, BusCailiaoshebeiPiciBo.class); BusCailiaoshebeiPiciBo busCailiaoshebeiPiciBo = BeanUtil.copyProperties(bo, BusCailiaoshebeiPiciBo.class);
busCailiaoshebeiPiciBo.setCxsj("2"); //计划完成,才能展示需求
busCailiaoshebeiPiciBo.setBatchType("2"); busCailiaoshebeiPiciBo.setBatchType("2");
return busCailiaoshebeiPiciService.queryPageList(busCailiaoshebeiPiciBo, pageQuery); return busCailiaoshebeiPiciService.queryPageList(busCailiaoshebeiPiciBo, pageQuery);
} }
/** /**
* 设计-删除物资批次号 * 需求-删除物资批次号
*/ */
@SaCheckPermission("cailiaoshebei:materialbatchdemandplan:pcDelete") @SaCheckPermission("cailiaoshebei:materialbatchdemandplan:pcDelete")
@Log(title = "设计-删除批次号", businessType = BusinessType.DELETE) @Log(title = "需求-删除批次号", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) { @PathVariable Long[] ids) {
return toAjax(busCailiaoshebeiPiciService.deleteWithValidByIds(List.of(ids), true)); return toAjax(busCailiaoshebeiPiciService.deleteWithValidByIds(List.of(ids), true, "3"));
} }
/** /**

View File

@ -8,10 +8,13 @@ import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.cailiaoshebei.domain.BusCailiaoshebeiPici; import org.dromara.cailiaoshebei.domain.BusCailiaoshebeiPici;
import org.dromara.cailiaoshebei.domain.BusMaterialbatchdemandplan;
import org.dromara.cailiaoshebei.domain.BusMaterialsorder; import org.dromara.cailiaoshebei.domain.BusMaterialsorder;
import org.dromara.cailiaoshebei.domain.bo.*; import org.dromara.cailiaoshebei.domain.bo.*;
import org.dromara.cailiaoshebei.domain.dto.ModifyTheOrderFormGYSTwoDto;
import org.dromara.cailiaoshebei.domain.vo.BusCailiaoshebeiPiciVo; import org.dromara.cailiaoshebei.domain.vo.BusCailiaoshebeiPiciVo;
import org.dromara.cailiaoshebei.service.IBusCailiaoshebeiPiciService; import org.dromara.cailiaoshebei.service.IBusCailiaoshebeiPiciService;
import org.dromara.common.core.exception.ServiceException;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit; import org.dromara.common.idempotent.annotation.RepeatSubmit;
@ -90,6 +93,32 @@ public class BusMaterialsorderController extends BaseController {
return busMaterialsorderService.queryPageList(bo, pageQuery); return busMaterialsorderService.queryPageList(bo, pageQuery);
} }
/**
* 订货-修改订货信息(供货商修改版)
*/
@SaCheckPermission("cailiaoshebei:materialsorder:modifyTheOrderFormGYS")
@Log(title = "订货-修改订货信息(供货商修改版)", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping("/modifyTheOrderFormGYS")
public R<Void> modifyTheOrderFormGYS(@Validated(EditGroup.class) @RequestBody ModifyTheOrderFormGYSReq req) {
List<BusMaterialsorder> upEntity = BeanUtil.copyToList(req.getList(), BusMaterialsorder.class);
if (upEntity.isEmpty()){
throw new ServiceException("请选择要修改的行");
}
return toAjax(busMaterialsorderService.updateBatchById(upEntity));
}
/**
* 订货-查询物资设备订货列表(供货商修改版)
*/
@SaCheckPermission("cailiaoshebei:materialsorder:listGYS")
@GetMapping("/listGYS")
public TableDataInfo<BusMaterialsorderVo> listGYS(BusMaterialsorderListReq req, PageQuery pageQuery) {
BusMaterialsorderBo bo = BeanUtil.copyProperties(req, BusMaterialsorderBo.class);
return busMaterialsorderService.queryPageList(bo, pageQuery);
}
//================================物资设备批次需求计划执行跟踪================================ //================================物资设备批次需求计划执行跟踪================================

View File

@ -64,4 +64,9 @@ public class BusCailiaoshebeiPiciBo extends BaseEntity {
private String remark; private String remark;
/**
* 查询数据判断
*/
private String cxsj;
} }

View File

@ -0,0 +1,21 @@
package org.dromara.cailiaoshebei.domain.bo;
import lombok.Data;
import org.dromara.cailiaoshebei.domain.dto.ModifyTheOrderFormGYSTwoDto;
import java.io.Serializable;
import java.util.List;
/**
* @Author 铁憨憨
* @Date 2025/8/7 11:10
* @Version 1.0
*/
@Data
public class ModifyTheOrderFormGYSReq implements Serializable {
/**
* 订货-主体数据
*/
private List<ModifyTheOrderFormGYSTwoDto> list;
}

View File

@ -0,0 +1,37 @@
package org.dromara.cailiaoshebei.domain.dto;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @Author 铁憨憨
* @Date 2025/8/7 11:11
* @Version 1.0
*/
@Data
public class ModifyTheOrderFormGYSTwoDto implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@TableId(value = "id")
private Long id;
/**
* 预计到货时间
*/
private LocalDate expectedArrival;
/**
* 预计生产完成时间
*/
private LocalDate productionTime;
}

View File

@ -37,10 +37,10 @@ public class BusCailiaoshebeiVo implements Serializable {
private Long id; private Long id;
/** /**
* 批次ID * 批次
*/ */
@ExcelProperty(value = "批次ID") @ExcelProperty(value = "批次ID")
private String batchId; private String batchNumber;
/** /**
* 供货商ID * 供货商ID

View File

@ -64,7 +64,8 @@ public interface IBusCailiaoshebeiPiciService extends IService<BusCailiaoshebeiP
* *
* @param ids 待删除的主键集合 * @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验 * @param isValid 是否进行有效性校验
* @param isValid 删除什么类型
* @return 是否删除成功 * @return 是否删除成功
*/ */
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid ,String type);
} }

View File

@ -1,6 +1,7 @@
package org.dromara.cailiaoshebei.service.impl; package org.dromara.cailiaoshebei.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -53,6 +54,17 @@ public class BusCailiaoshebeiPiciServiceImpl extends ServiceImpl<BusCailiaoshebe
@Override @Override
public TableDataInfo<BusCailiaoshebeiPiciVo> queryPageList(BusCailiaoshebeiPiciBo bo, PageQuery pageQuery) { public TableDataInfo<BusCailiaoshebeiPiciVo> queryPageList(BusCailiaoshebeiPiciBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<BusCailiaoshebeiPici> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<BusCailiaoshebeiPici> lqw = buildQueryWrapper(bo);
//查询设计为已经完成的数据
if (StringUtils.isNotBlank(bo.getCxsj())) {
if ("1".equals(bo.getCxsj())){ //设计
lqw.eq(BusCailiaoshebeiPici::getApprovalDesign, "finish");
}else if ("2".equals(bo.getCxsj())){ //计划
lqw.eq(BusCailiaoshebeiPici::getApprovalPlan, "finish");
}else if ("3".equals(bo.getCxsj())){ //需求
lqw.eq(BusCailiaoshebeiPici::getApprovalPlan, "finish");
}
}
Page<BusCailiaoshebeiPiciVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<BusCailiaoshebeiPiciVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
@ -127,9 +139,35 @@ public class BusCailiaoshebeiPiciServiceImpl extends ServiceImpl<BusCailiaoshebe
* @return 是否删除成功 * @return 是否删除成功
*/ */
@Override @Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid, String type) {
if(isValid){ if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验 //TODO 做一些业务上的校验,判断是否需要校验
//如果不为草稿状态,不允许删除
List<BusCailiaoshebeiPici> list = baseMapper.selectBatchIds(ids);
for (BusCailiaoshebeiPici busCailiaoshebeiPici : list) {
switch (type){
case "1": //设计
if (!"draft".equals(busCailiaoshebeiPici.getApprovalDesign())){
throw new ServiceException("非草稿状态不允许删除");
}
break;
case "2": //计划
if (!"finish".equals(busCailiaoshebeiPici.getApprovalPlan())){
throw new ServiceException("非草稿状态不允许删除");
}
break;
case "3": //需求
if (!"sc".equals(busCailiaoshebeiPici.getApprovalProject())){
throw new ServiceException("非草稿状态不允许删除");
}
break;
case "4": //订货
if (!"sc".equals(busCailiaoshebeiPici.getApprovalOrder())){
throw new ServiceException("非草稿状态不允许删除");
}
break;
}
}
} }
return baseMapper.deleteByIds(ids) > 0; return baseMapper.deleteByIds(ids) > 0;
} }

View File

@ -19,6 +19,7 @@ import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent; import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent; import org.dromara.common.core.domain.event.ProcessTaskEvent;
import org.dromara.common.core.enums.BusinessStatusEnum; import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -163,9 +164,26 @@ public class BusCailiaoshebeiServiceImpl extends ServiceImpl<BusCailiaoshebeiMap
@Override @Override
@Transactional @Transactional
public Boolean updateByPlanBo(BusCailiaoshebeiEditPlanReq bo) { public Boolean updateByPlanBo(BusCailiaoshebeiEditPlanReq bo) {
//获取到批次号
BusCailiaoshebeiVo busCailiaoshebeiVo = baseMapper.selectVoById(bo.getId());
if (busCailiaoshebeiVo == null){
throw new ServiceException("主键ID不存在");
}
//0、判断批次号的状态是否为草稿
BusCailiaoshebeiPici one = busCailiaoshebeiPiciService.getOne(
new LambdaQueryWrapper<BusCailiaoshebeiPici>()
.eq(BusCailiaoshebeiPici::getBatchNumber, busCailiaoshebeiVo.getBatchNumber())
);
if (one == null){
throw new ServiceException("批次号不存在");
}
if (!"draft".equals(one.getApprovalPlan())){
throw new ServiceException("非草稿状态不允许新增或修改");
}
//1、计划部更新主体数据的计划时间和完成时间 //1、计划部更新主体数据的计划时间和完成时间
BusCailiaoshebei entity = MapstructUtils.convert(bo, BusCailiaoshebei.class); BusCailiaoshebei entity = MapstructUtils.convert(bo, BusCailiaoshebei.class);
validEntityBeforeSave(entity);
if (baseMapper.updateById(entity)==0){ if (baseMapper.updateById(entity)==0){
return false; return false;
} }
@ -221,6 +239,17 @@ public class BusCailiaoshebeiServiceImpl extends ServiceImpl<BusCailiaoshebeiMap
*/ */
private void validEntityBeforeSave(BusCailiaoshebei entity){ private void validEntityBeforeSave(BusCailiaoshebei entity){
//TODO 做一些数据校验,如唯一约束 //TODO 做一些数据校验,如唯一约束
//判断批次号的状态是否为草稿
BusCailiaoshebeiPici one = busCailiaoshebeiPiciService.getOne(
new LambdaQueryWrapper<BusCailiaoshebeiPici>()
.eq(BusCailiaoshebeiPici::getBatchNumber, entity.getBatchNumber())
);
if (one == null){
throw new ServiceException("批次号不存在");
}
if (!"draft".equals(one.getApprovalDesign())){
throw new ServiceException("非草稿状态不允许新增或修改");
}
} }
/** /**
@ -233,7 +262,20 @@ public class BusCailiaoshebeiServiceImpl extends ServiceImpl<BusCailiaoshebeiMap
@Override @Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){ if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验 //判断当前批次号是否是草稿状态,如果不是不允许删除
List<BusCailiaoshebei> list = baseMapper.selectBatchIds(ids);
for (BusCailiaoshebei busCailiaoshebei : list) {
BusCailiaoshebeiPici one = busCailiaoshebeiPiciService.getOne(
new LambdaQueryWrapper<BusCailiaoshebeiPici>()
.eq(BusCailiaoshebeiPici::getBatchNumber, busCailiaoshebei.getBatchNumber())
);
if (one == null){
throw new ServiceException("批次号不存在");
}
if (!"draft".equals(one.getApprovalDesign())){
throw new ServiceException("非草稿状态不允许删除");
}
}
} }
return baseMapper.deleteByIds(ids) > 0; return baseMapper.deleteByIds(ids) > 0;
} }

View File

@ -10,6 +10,7 @@ import org.dromara.cailiaoshebei.service.IBusMaterialsorderService;
import org.dromara.common.core.domain.event.ProcessDeleteEvent; import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent; import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent; import org.dromara.common.core.domain.event.ProcessTaskEvent;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -18,6 +19,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.dromara.cailiaoshebei.domain.bo.BusMaterialbatchdemandplanBo; import org.dromara.cailiaoshebei.domain.bo.BusMaterialbatchdemandplanBo;
@ -42,11 +45,16 @@ import java.util.Collection;
@Slf4j @Slf4j
public class BusMaterialbatchdemandplanServiceImpl extends ServiceImpl<BusMaterialbatchdemandplanMapper, BusMaterialbatchdemandplan> implements IBusMaterialbatchdemandplanService { public class BusMaterialbatchdemandplanServiceImpl extends ServiceImpl<BusMaterialbatchdemandplanMapper, BusMaterialbatchdemandplan> implements IBusMaterialbatchdemandplanService {
private final BusMaterialbatchdemandplanMapper baseMapper; private final BusMaterialbatchdemandplanMapper baseMapper;
private final IBusCailiaoshebeiPiciService busCailiaoshebeiPiciService; @Lazy
@Autowired
private IBusCailiaoshebeiPiciService busCailiaoshebeiPiciService;
private final IBusMaterialsorderService busMaterialsorderService; @Lazy
@Autowired
private IBusMaterialsorderService busMaterialsorderService;
/** /**
* 查询物资-批次需求计划 * 查询物资-批次需求计划
@ -159,6 +167,17 @@ public class BusMaterialbatchdemandplanServiceImpl extends ServiceImpl<BusMateri
@Override @Override
@Transactional @Transactional
public Boolean add(BusMaterialbatchdemandplanAddReq bo) { public Boolean add(BusMaterialbatchdemandplanAddReq bo) {
//获取到批次数据,然后判断批次数据是否是草稿,不是就不允许操作
BusCailiaoshebeiPici one = busCailiaoshebeiPiciService.getOne(
new LambdaQueryWrapper<BusCailiaoshebeiPici>()
.eq(BusCailiaoshebeiPici::getBatchNumber, bo.getBatchNumber())
);
if (one == null){
throw new ServiceException("批次号不存在");
}
if (!"draft".equals(one.getApprovalProject())){
throw new ServiceException("非草稿状态不允许新增或修改");
}
//1、删除数据 //1、删除数据
LambdaQueryWrapper<BusMaterialbatchdemandplan> eq = new LambdaQueryWrapper<BusMaterialbatchdemandplan>() LambdaQueryWrapper<BusMaterialbatchdemandplan> eq = new LambdaQueryWrapper<BusMaterialbatchdemandplan>()
.eq(BusMaterialbatchdemandplan::getBatchNumber, bo.getBatchNumber()); .eq(BusMaterialbatchdemandplan::getBatchNumber, bo.getBatchNumber());

View File

@ -26,6 +26,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.utils.BatchNumberGenerator; import org.dromara.common.utils.BatchNumberGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.dromara.cailiaoshebei.domain.bo.BusMaterialsorderBo; import org.dromara.cailiaoshebei.domain.bo.BusMaterialsorderBo;
@ -50,8 +52,14 @@ import java.util.*;
public class BusMaterialsorderServiceImpl extends ServiceImpl<BusMaterialsorderMapper, BusMaterialsorder> implements IBusMaterialsorderService { public class BusMaterialsorderServiceImpl extends ServiceImpl<BusMaterialsorderMapper, BusMaterialsorder> implements IBusMaterialsorderService {
private final BusMaterialsorderMapper baseMapper; private final BusMaterialsorderMapper baseMapper;
private final IBusCailiaoshebeiPiciService busCailiaoshebeiPiciService;
private final IBusMaterialbatchdemandplanService busMaterialbatchdemandplanService; @Lazy
@Autowired
private IBusCailiaoshebeiPiciService busCailiaoshebeiPiciService;
@Lazy
@Autowired
private IBusMaterialbatchdemandplanService busMaterialbatchdemandplanService;
/** /**