|
|
@ -146,6 +146,45 @@ public class TestSoBomServiceImpl extends ServiceImpl<TestSoBomMapper, TestSoBom |
|
|
return wrapper; |
|
|
return wrapper; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 批量导入BOM子物料到测试产品结构 |
|
|
|
|
|
* @param testSoBomList 待保存的TestSoBom列表 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public void saveBatchTestSoBom(List<TestSoBom> testSoBomList) { |
|
|
|
|
|
if (testSoBomList == null || testSoBomList.isEmpty()) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
String site = testSoBomList.get(0).getSite(); |
|
|
|
|
|
String testNo = testSoBomList.get(0).getTestNo(); |
|
|
|
|
|
checkoutTestSoBomKey(testSoBomList.get(0)); |
|
|
|
|
|
|
|
|
|
|
|
TestInformationEntity testInfo = testInformationService.lambdaQuery() |
|
|
|
|
|
.eq(TestInformationEntity::getTestNo, testNo) |
|
|
|
|
|
.eq(TestInformationEntity::getSite, site) |
|
|
|
|
|
.one(); |
|
|
|
|
|
if (Objects.isNull(testInfo)) { |
|
|
|
|
|
throw new RuntimeException("测试单号" + testNo + "不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BigDecimal nextItemNo = baseMapper.selectTestSoBomItemNo(site, testNo); |
|
|
|
|
|
if (nextItemNo == null) { |
|
|
|
|
|
nextItemNo = BigDecimal.ONE; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (TestSoBom testSoBom : testSoBomList) { |
|
|
|
|
|
if (testInfo.getTestPartNo().equals(testSoBom.getComponentPartNo())) { |
|
|
|
|
|
throw new RuntimeException("不可将自身物料[" + testSoBom.getComponentPartNo() + "]作为产品结构"); |
|
|
|
|
|
} |
|
|
|
|
|
testSoBom.setSite(site); |
|
|
|
|
|
testSoBom.setTestNo(testNo); |
|
|
|
|
|
testSoBom.setItemNo(nextItemNo); |
|
|
|
|
|
nextItemNo = nextItemNo.add(BigDecimal.ONE); |
|
|
|
|
|
baseMapper.insert(testSoBom); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 检查测试产品结构Key |
|
|
* 检查测试产品结构Key |
|
|
* @param testSoBom |
|
|
* @param testSoBom |
|
|
|