|
|
|
@ -3,11 +3,14 @@ package com.spring.modules.test.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.spring.modules.test.entity.TestInformationEntity; |
|
|
|
import com.spring.modules.test.entity.TestSoBom; |
|
|
|
import com.spring.modules.test.mapper.TestSoBomMapper; |
|
|
|
import com.spring.modules.test.service.TestInformationService; |
|
|
|
import com.spring.modules.test.service.TestSoBomService; |
|
|
|
import com.spring.modules.test.vo.TestSoBomVo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
@ -20,6 +23,8 @@ import java.util.Objects; |
|
|
|
@Slf4j |
|
|
|
public class TestSoBomServiceImpl extends ServiceImpl<TestSoBomMapper, TestSoBom> implements TestSoBomService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private TestInformationService testInformationService; |
|
|
|
/** |
|
|
|
* 测试产品结构 |
|
|
|
* @param testSoBomVo |
|
|
|
@ -79,6 +84,17 @@ public class TestSoBomServiceImpl extends ServiceImpl<TestSoBomMapper, TestSoBom |
|
|
|
throw new RuntimeException("该产品结构已存在主材料"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取主表 TEST表信息 |
|
|
|
TestInformationEntity one = testInformationService.lambdaQuery() |
|
|
|
.eq(TestInformationEntity::getTestNo, testSoBom.getTestNo()) |
|
|
|
.eq(TestInformationEntity::getSite, testSoBom.getSite()) |
|
|
|
.one(); |
|
|
|
if (Objects.isNull(one)){ |
|
|
|
throw new RuntimeException("测试单号"+testSoBom.getTestNo()+"不存在"); |
|
|
|
} |
|
|
|
if (one.getTestPartNo().equals(testSoBom.getComponentPartNo())){ |
|
|
|
throw new RuntimeException("不可将自身物料作为产品结构"); |
|
|
|
} |
|
|
|
testSoBom.setItemNo(baseMapper.selectTestSoBomItemNo(testSoBom.getSite(), testSoBom.getTestNo())); |
|
|
|
baseMapper.insert(testSoBom); |
|
|
|
} |
|
|
|
@ -96,6 +112,17 @@ public class TestSoBomServiceImpl extends ServiceImpl<TestSoBomMapper, TestSoBom |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取主表 TEST表信息 |
|
|
|
TestInformationEntity one = testInformationService.lambdaQuery() |
|
|
|
.eq(TestInformationEntity::getTestNo, testSoBom.getTestNo()) |
|
|
|
.eq(TestInformationEntity::getSite, testSoBom.getSite()) |
|
|
|
.one(); |
|
|
|
if (Objects.isNull(one)){ |
|
|
|
throw new RuntimeException("测试单号"+testSoBom.getTestNo()+"不存在"); |
|
|
|
} |
|
|
|
if (one.getTestPartNo().equals(testSoBom.getComponentPartNo())){ |
|
|
|
throw new RuntimeException("不可将自身物料作为产品结构"); |
|
|
|
} |
|
|
|
baseMapper.update(testSoBom,getUpdateWrapper(testSoBom)); |
|
|
|
} |
|
|
|
|
|
|
|
|