|
|
|
@ -35,6 +35,7 @@ import com.spring.modules.change.entity.TechnicalSpecificationData; |
|
|
|
import com.spring.modules.change.mapper.ChangeManagementMapper; |
|
|
|
import com.spring.modules.change.vo.ChangeRequestDetailVo; |
|
|
|
import com.spring.modules.change.vo.ChangeRequestVo; |
|
|
|
import com.spring.modules.code.mapper.CodeDrawingMapper; |
|
|
|
import com.spring.modules.customer.entity.CustomerGroupInformationEntity; |
|
|
|
import com.spring.modules.oss.dao.SysOssDao; |
|
|
|
import com.spring.modules.oss.entity.SysOssEntity; |
|
|
|
@ -117,6 +118,9 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
@Autowired |
|
|
|
private PartInformationMapper partInformationMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private CodeDrawingMapper codeDrawingMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private UmInformationMapper umInformationMapper; |
|
|
|
|
|
|
|
@ -1281,6 +1285,7 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
if (!StringUtils.hasText(drawingNo) || "NA".equalsIgnoreCase(drawingNo)) { |
|
|
|
throw new RuntimeException("编码为空,无法自动保存!"); |
|
|
|
} |
|
|
|
assertDrawingNoGenerated(site, drawingNo); |
|
|
|
PartInformationEntity partData = partInformationMapper.selectOne( |
|
|
|
new QueryWrapper<PartInformationEntity>() |
|
|
|
.eq("site", site) |
|
|
|
@ -1356,6 +1361,28 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void assertDrawingNoGenerated(String site, String drawingNo) { |
|
|
|
String normalizedDrawingNo = stripLeadingFrPrefix(drawingNo); |
|
|
|
if (!StringUtils.hasText(normalizedDrawingNo)) { |
|
|
|
throw new RuntimeException("该编码尚未生成,不能保存"); |
|
|
|
} |
|
|
|
Integer count = codeDrawingMapper.countGeneratedDrawingNo(site, normalizedDrawingNo); |
|
|
|
if (count == null || count <= 0) { |
|
|
|
throw new RuntimeException("该编码尚未生成,不能保存"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private String stripLeadingFrPrefix(String drawingNo) { |
|
|
|
String text = normalizePartAndDrawingText(drawingNo); |
|
|
|
if (text.length() > 1) { |
|
|
|
char first = Character.toUpperCase(text.charAt(0)); |
|
|
|
if (first == 'F' || first == 'R') { |
|
|
|
return text.substring(1); |
|
|
|
} |
|
|
|
} |
|
|
|
return text; |
|
|
|
} |
|
|
|
|
|
|
|
private String normalizePartAndDrawingText(String text) { |
|
|
|
if (text == null) { |
|
|
|
return ""; |
|
|
|
|