|
@@ -112,9 +112,17 @@ public class BomServiceImpl extends CommonBaseServiceImpl<BomMapper, Bom> implem
|
|
|
if(id == null || id <= 0){
|
|
if(id == null || id <= 0){
|
|
|
throw new BizException(BizExceptionCode.ILLEGAL_ID);
|
|
throw new BizException(BizExceptionCode.ILLEGAL_ID);
|
|
|
}
|
|
}
|
|
|
|
|
+ //校验BOM资料是否已被使用
|
|
|
|
|
+ Long prodId = getMapper().selectByPrimaryKey(id).getBo_motherid();
|
|
|
|
|
+ int count = getMapper().getCountFromMake(prodId);
|
|
|
|
|
+ if (count > 0){
|
|
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_RELDELETE);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
String code = getMapper().selectByPrimaryKey(id).getBo_mothercode();
|
|
String code = getMapper().selectByPrimaryKey(id).getBo_mothercode();
|
|
|
- getMapper().deleteByPrimaryKey(id);
|
|
|
|
|
bomDetailMapper.deleteByFK(id);
|
|
bomDetailMapper.deleteByFK(id);
|
|
|
|
|
+ getMapper().deleteByPrimaryKey(id);
|
|
|
|
|
+
|
|
|
//记录LOG
|
|
//记录LOG
|
|
|
messageLogService.delete(generateMsgObj(id, code));
|
|
messageLogService.delete(generateMsgObj(id, code));
|
|
|
}
|
|
}
|
|
@@ -174,6 +182,13 @@ public class BomServiceImpl extends CommonBaseServiceImpl<BomMapper, Bom> implem
|
|
|
@Override
|
|
@Override
|
|
|
public DocBaseDTO close(Long id) {
|
|
public DocBaseDTO close(Long id) {
|
|
|
if(id != null && id > 0){
|
|
if(id != null && id > 0){
|
|
|
|
|
+ //校验BOM资料是否已被使用
|
|
|
|
|
+ Long prodId = getMapper().selectByPrimaryKey(id).getBo_motherid();
|
|
|
|
|
+ int count = getMapper().getCountFromMake(prodId);
|
|
|
|
|
+ if (count > 0){
|
|
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_RELDELETE);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Bom bom = new Bom();
|
|
Bom bom = new Bom();
|
|
|
bom.setId(id);
|
|
bom.setId(id);
|
|
|
bom.setBo_status(Status.CLOSE.getDisplay());
|
|
bom.setBo_status(Status.CLOSE.getDisplay());
|