|
|
|
@ -632,29 +632,24 @@ public class InspectionRequestServiceImpl extends ServiceImpl<InspectionRequestH |
|
|
|
throw new RuntimeException("检验申请明细不存在: site=" + site + ", requestNo=" + requestNo + ", itemNo=" + itemNo); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("开始验货: requestNo={}, itemNo={}, site={}", requestNo, itemNo, site); |
|
|
|
|
|
|
|
// 3. 生成验货单号 |
|
|
|
srmSupplierMapper.updateTransNo(site, "IN"); |
|
|
|
String inspectNo = srmSupplierMapper.getTransNo(site, "IN"); |
|
|
|
log.info("生成验货单号: inspectNo={}", inspectNo); |
|
|
|
|
|
|
|
// 4. 更新指定明细表状态和验货单号(只更新指定的 itemNo) |
|
|
|
log.info("准备更新明细状态: site={}, requestNo={}, itemNo={}, inspectNo={}", site, requestNo, itemNo, inspectNo); |
|
|
|
int detailUpdateCount = inspectionRequestDetailMapper.startInspection(site, requestNo, itemNo, inspectNo); |
|
|
|
log.info("明细更新结果: detailUpdateCount={}", detailUpdateCount); |
|
|
|
// 3. 更新指定明细表状态为验货中(inspect_no 由 QcServiceImpl 生成并回传) |
|
|
|
int detailUpdateCount = inspectionRequestDetailMapper.update(null, |
|
|
|
new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<InspectionRequestDetail>() |
|
|
|
.eq(InspectionRequestDetail::getSite, site) |
|
|
|
.eq(InspectionRequestDetail::getRequestNo, requestNo) |
|
|
|
.eq(InspectionRequestDetail::getItemNo, itemNo) |
|
|
|
.set(InspectionRequestDetail::getStatus, "验货中") |
|
|
|
.set(InspectionRequestDetail::getStatusDb, "Inspecting") |
|
|
|
); |
|
|
|
if (detailUpdateCount == 0) { |
|
|
|
throw new RuntimeException("更新明细表状态失败,可能原因:1.记录不存在 2.记录已被其他事务修改 3.site/requestNo/itemNo不匹配"); |
|
|
|
} |
|
|
|
|
|
|
|
// 5. 更新头表状态为验货中(只要有明细开始验货,头表就立即更新) |
|
|
|
// 4. 更新头表状态为验货中(只要有明细开始验货,头表就立即更新) |
|
|
|
int headerUpdateCount = baseMapper.startInspection(site, requestNo); |
|
|
|
if (headerUpdateCount == 0) { |
|
|
|
throw new RuntimeException("更新头表状态失败"); |
|
|
|
} |
|
|
|
log.info("头表状态已更新为验货中: requestNo={}", requestNo); |
|
|
|
|
|
|
|
log.info("开始验货成功: requestNo={}, itemNo={}, inspectNo={}", requestNo, itemNo, inspectNo); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|