新增物资字典删除,禁用校验

master
anthonywj 2 years ago
parent f8437f1c1a
commit fd96be91ed

@ -12,6 +12,7 @@ import com.glxp.api.constant.BusinessType;
import com.glxp.api.constant.ConstantStatus; import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.BaseController; import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.basic.*; import com.glxp.api.entity.basic.*;
import com.glxp.api.entity.inv.InvProductEntity;
import com.glxp.api.entity.system.SystemParamConfigEntity; import com.glxp.api.entity.system.SystemParamConfigEntity;
import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity; import com.glxp.api.entity.thrsys.ThrSystemEntity;
@ -26,6 +27,9 @@ import com.glxp.api.res.basic.BasicProductThirdSysResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.basic.*; import com.glxp.api.service.basic.*;
import com.glxp.api.service.inout.IoCodeService;
import com.glxp.api.service.inv.InvPreProductService;
import com.glxp.api.service.inv.InvProductService;
import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.service.system.SystemParamConfigService;
import com.glxp.api.service.thrsys.ThrDataService; import com.glxp.api.service.thrsys.ThrDataService;
import com.glxp.api.service.thrsys.ThrSystemService; import com.glxp.api.service.thrsys.ThrSystemService;
@ -246,6 +250,11 @@ public class UdiRelevanceController extends BaseController {
return ResultVOUtils.success("删除成功"); return ResultVOUtils.success("删除成功");
} }
@Resource
IoCodeService codeService;
@Resource
CompanyProductRelevanceService companyProductRelevanceService;
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@PostMapping("/udi/udirel/deleteById") @PostMapping("/udi/udirel/deleteById")
@Log(title = "单据管理", businessType = BusinessType.DELETE) @Log(title = "单据管理", businessType = BusinessType.DELETE)
@ -256,37 +265,15 @@ public class UdiRelevanceController extends BaseController {
} }
String ids = deleteRequest.getId(); String ids = deleteRequest.getId();
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(Long.parseLong(ids)); UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(Long.parseLong(ids));
//todo 单据未完成 if (udiRelevanceEntity != null && udiRelevanceEntity.getUuid() != null) {
// if (udiRelevanceEntity != null && udiRelevanceEntity.getUuid() != null) { if (codeService.isExitByRelId(udiRelevanceEntity.getId() + "")) {
// List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid()); return ResultVOUtils.error(500, "该产品已关联单据,无法删除!");
// if (udiRelevanceEntities != null && !udiRelevanceEntities.isEmpty()) { }
// for (UdiRelevanceEntity udiRelevanceEntity1 : udiRelevanceEntities) { if (companyProductRelevanceService.isExitByRelId(udiRelevanceEntity.getId() + "")) {
// List<UdiInfoEntity> udiInfoEntities = udiInfoService.findByUuids(udiRelevanceEntity1.getUuid()); return ResultVOUtils.error(500, "该产品已被已被供应商选入,无法删除!");
// if (udiInfoEntities != null && udiInfoEntities.size() > 0) { }
// for (int i = 0; i < udiInfoEntities.size(); i++) { }
// List<WarehouseEntity> warehouseEntityList = warehouseService.searchCode(udiInfoEntities.get(i).getNameCode());
// if (warehouseEntityList != null && warehouseEntityList.size() > 0) {
// return ResultVOUtils.error(500, "该产品已被" + warehouseEntityList.get(0).getOrderId() + "订单关联不能删除");
// }
// }
// }
// }
// WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
// warehouseQueryRequest.setRelId(ids);
// if (StrUtil.isNotEmpty(ids)) {
// List<WarehouseEntity> warehouseEntityList = warehouseService.findByOrderId(warehouseQueryRequest);
// if (CollUtil.isNotEmpty(warehouseEntityList)) {
// return ResultVOUtils.error(500, "该产品已被" + warehouseEntityList.get(0).getOrderId() + "订单关联不能删除");
// }
// }
// }
// }
//
// CompanyProductRelevanceEntity companyProductRelevanceEntity = companyProductRelevanceService.findByUdiRlIdUnitFk(ids, null);
// if (companyProductRelevanceEntity != null) {
// return ResultVOUtils.error(500, "该产品已被已被供应商选入" + "不能删除!");
// }
//
udiRelevanceService.deleteById(ids); udiRelevanceService.deleteById(ids);
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid()); List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid());
@ -294,9 +281,6 @@ public class UdiRelevanceController extends BaseController {
udiProductService.deleteByUuid(udiRelevanceEntity.getUuid()); udiProductService.deleteByUuid(udiRelevanceEntity.getUuid());
} }
//todo
// companyProductRelevanceService.deleteByRlId(ids);//删除供应商关联表产品信息
return ResultVOUtils.success("删除成功"); return ResultVOUtils.success("删除成功");
} }
@ -421,20 +405,24 @@ public class UdiRelevanceController extends BaseController {
} }
@Resource
InvProductService invProductService;
@Resource
InvPreProductService invPreProductService;
//查询产品是否可以被禁用 todo 库存还未完成 //查询产品是否可以被禁用 todo 库存还未完成
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@PostMapping("/udi/udirel/disable") @PostMapping("/udi/udirel/disable")
public BaseResponse disable(@RequestBody UdiCombineRequest udiCombineRequest) { public BaseResponse disable(@RequestBody UdiCombineRequest udiCombineRequest) {
// InvProductEntity invProductEntity = invProductService.selectExit(combineRequest.getRelId());
// if (invProductEntity != null) { if (invProductService.isExitByRelId(udiCombineRequest.getRelId() + "")) {
// return ResultVOUtils.error(500, "库存已存在,无法禁用"); return ResultVOUtils.error(500, "库存已存在,无法禁用");
// } }
//
// InvProductEntity invPreProductEntity = invPreProductService.selectExit(combineRequest.getRelId()); if (invPreProductService.isExitByRelId(udiCombineRequest.getRelId() + "")) {
// if (invPreProductEntity != null) { return ResultVOUtils.error(500, "寄售库存已存在,无法禁用");
// return ResultVOUtils.error(500, "库存已存在,无法禁用"); }
// }
return ResultVOUtils.success("更新成功"); return ResultVOUtils.success("更新成功");
} }

@ -1,7 +1,9 @@
package com.glxp.api.dao.basic; package com.glxp.api.dao.basic;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.basic.CompanyProductRelevanceEntity; import com.glxp.api.entity.basic.CompanyProductRelevanceEntity;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.req.basic.CompanyProductRelevanceRequest; import com.glxp.api.req.basic.CompanyProductRelevanceRequest;
import com.glxp.api.res.basic.CompanyProductRelevanceResponse; import com.glxp.api.res.basic.CompanyProductRelevanceResponse;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -9,7 +11,7 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
@Mapper @Mapper
public interface CompanyProductRelevanceDao { public interface CompanyProductRelevanceDao extends BaseMapperPlus<CompanyProductRelevanceDao, CompanyProductRelevanceEntity, CompanyProductRelevanceEntity> {
List<CompanyProductRelevanceResponse> filterUdiGp(CompanyProductRelevanceRequest basicInstrumentMaintainRequest); List<CompanyProductRelevanceResponse> filterUdiGp(CompanyProductRelevanceRequest basicInstrumentMaintainRequest);

@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import lombok.Data; import lombok.Data;
@Data @Data
@ -110,4 +112,4 @@ public class CompanyProductRelevanceEntity {
public static final String COL_UPDATEUSER = "updateUser"; public static final String COL_UPDATEUSER = "updateUser";
public static final String COL_UPDATETIME = "updateTime"; public static final String COL_UPDATETIME = "updateTime";
} }

@ -1,8 +1,6 @@
package com.glxp.api.service.basic; package com.glxp.api.service.basic;
import com.glxp.api.entity.basic.CompanyProductRelevanceEntity; import com.glxp.api.entity.basic.CompanyProductRelevanceEntity;
import com.glxp.api.req.basic.CompanyProductRelevanceRequest; import com.glxp.api.req.basic.CompanyProductRelevanceRequest;
import com.glxp.api.res.basic.CompanyProductRelevanceResponse; import com.glxp.api.res.basic.CompanyProductRelevanceResponse;
@ -18,4 +16,6 @@ public interface CompanyProductRelevanceService {
boolean deleteById(String id); boolean deleteById(String id);
boolean deleteByRlId(String id); boolean deleteByRlId(String id);
boolean isExitByRelId(String relId);
} }

@ -1,6 +1,7 @@
package com.glxp.api.service.basic.impl; package com.glxp.api.service.basic.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.basic.CompanyProductRelevanceDao; import com.glxp.api.dao.basic.CompanyProductRelevanceDao;
import com.glxp.api.entity.basic.CompanyProductRelevanceEntity; import com.glxp.api.entity.basic.CompanyProductRelevanceEntity;
@ -48,4 +49,9 @@ public class CompanyProductRelevanceServiceImpl implements CompanyProductRelevan
public boolean deleteByRlId(String id) { public boolean deleteByRlId(String id) {
return companyProductRelevanceDao.deleteByRlId(id); return companyProductRelevanceDao.deleteByRlId(id);
} }
@Override
public boolean isExitByRelId(String relId) {
return companyProductRelevanceDao.exists(new QueryWrapper<CompanyProductRelevanceEntity>().eq("udiRlIdFk", relId));
}
} }

@ -21,6 +21,9 @@ public interface IoCodeService {
public IoCodeEntity findByUnique(String orderId, String code); public IoCodeEntity findByUnique(String orderId, String code);
boolean isExitByRelId(String relId);
/** /**
* *
* *

@ -66,6 +66,12 @@ public class IoCodeServiceImpl implements IoCodeService {
return ioCodeDao.selectOne(new QueryWrapper<IoCodeEntity>().eq("orderId", orderId).eq("code", code)); return ioCodeDao.selectOne(new QueryWrapper<IoCodeEntity>().eq("orderId", orderId).eq("code", code));
} }
@Override
public boolean isExitByRelId(String relId) {
// return ioCodeDao.selectList(new QueryWrapper<IoCodeEntity>().eq("relId", relId).last("limit 1"));
return ioCodeDao.exists(new QueryWrapper<IoCodeEntity>().eq("relId", relId));
}
@Override @Override
public List<IoCodeEntity> filterCodeList(FilterCodeRequest filterCodeRequest) { public List<IoCodeEntity> filterCodeList(FilterCodeRequest filterCodeRequest) {
if (null == filterCodeRequest) { if (null == filterCodeRequest) {

@ -45,4 +45,6 @@ public interface InvPreProductService {
* @return * @return
*/ */
InvPreProductEntity findById(String id); InvPreProductEntity findById(String id);
boolean isExitByRelId(String relId);
} }

@ -81,4 +81,6 @@ public interface InvProductService {
*/ */
List<InvProductResponse> filterProductNames(FilterInvProductRequest filterInvProductRequest); List<InvProductResponse> filterProductNames(FilterInvProductRequest filterInvProductRequest);
boolean isExitByRelId(String relId);
} }

@ -74,4 +74,11 @@ public class InvPreProductServiceImpl implements InvPreProductService {
return invPreProductDao.selectById(id); return invPreProductDao.selectById(id);
} }
@Override
public boolean isExitByRelId(String relId) {
return invPreProductDao.exists(new QueryWrapper<InvPreProductEntity>().eq("relIdFk", relId));
}
} }

@ -121,4 +121,10 @@ public class InvProductServiceImpl implements InvProductService {
return invProductDao.filterProductNames(filterInvProductRequest); return invProductDao.filterProductNames(filterInvProductRequest);
} }
@Override
public boolean isExitByRelId(String relId) {
return invProductDao.exists(new QueryWrapper<InvProductEntity>().eq("relIdFk", relId));
}
} }

Loading…
Cancel
Save