feat(back-end): pla tought
Some checks failed
Build, Test, Deploy and Analysis / qodana (push) Failing after 8s
Build, Test, Deploy and Analysis / test-backend (push) Successful in 37s
Build, Test, Deploy and Analysis / build-and-push (push) Successful in 41s
Build, Test, Deploy and Analysis / deploy (push) Successful in 9s
Some checks failed
Build, Test, Deploy and Analysis / qodana (push) Failing after 8s
Build, Test, Deploy and Analysis / test-backend (push) Successful in 37s
Build, Test, Deploy and Analysis / build-and-push (push) Successful in 41s
Build, Test, Deploy and Analysis / deploy (push) Successful in 9s
This commit is contained in:
@@ -296,9 +296,7 @@ public class QuoteSessionController {
|
||||
return variant;
|
||||
}
|
||||
|
||||
String requestedMaterialCode = settings.getMaterial() != null
|
||||
? settings.getMaterial().trim().toUpperCase()
|
||||
: "PLA";
|
||||
String requestedMaterialCode = normalizeRequestedMaterialCode(settings.getMaterial());
|
||||
|
||||
FilamentMaterialType materialType = materialRepo.findByMaterialCode(requestedMaterialCode)
|
||||
.orElseGet(() -> materialRepo.findByMaterialCode("PLA")
|
||||
@@ -316,6 +314,18 @@ public class QuoteSessionController {
|
||||
.orElseThrow(() -> new RuntimeException("No active variant for material: " + requestedMaterialCode));
|
||||
}
|
||||
|
||||
private String normalizeRequestedMaterialCode(String value) {
|
||||
if (value == null || value.isBlank()) {
|
||||
return "PLA";
|
||||
}
|
||||
|
||||
return value.trim()
|
||||
.toUpperCase(Locale.ROOT)
|
||||
.replace('_', ' ')
|
||||
.replace('-', ' ')
|
||||
.replaceAll("\\s+", " ");
|
||||
}
|
||||
|
||||
// 3. Update Line Item
|
||||
@PatchMapping("/line-items/{lineItemId}")
|
||||
@Transactional
|
||||
|
||||
@@ -8,7 +8,7 @@ public class PrintSettingsDto {
|
||||
private String complexityMode;
|
||||
|
||||
// Common
|
||||
private String material; // e.g. "PLA", "PETG"
|
||||
private String material; // e.g. "PLA", "PLA TOUGH", "PETG"
|
||||
private String color; // e.g. "White", "#FFFFFF"
|
||||
private Long filamentVariantId;
|
||||
private Long printerMachineId;
|
||||
|
||||
@@ -116,6 +116,7 @@ public class OrcaProfileResolver {
|
||||
: "PLA";
|
||||
|
||||
return switch (materialCode) {
|
||||
case "PLA TOUGH" -> "Bambu PLA Tough @BBL A1";
|
||||
case "PETG" -> "Generic PETG";
|
||||
case "TPU" -> "Generic TPU";
|
||||
case "PC" -> "Generic PC";
|
||||
|
||||
@@ -46,6 +46,7 @@ public class ProfileManager {
|
||||
|
||||
// Material Aliases
|
||||
profileAliases.put("pla_basic", "Bambu PLA Basic @BBL A1");
|
||||
profileAliases.put("pla_tough", "Bambu PLA Tough @BBL A1");
|
||||
profileAliases.put("petg_basic", "Bambu PETG Basic @BBL A1");
|
||||
profileAliases.put("tpu_95a", "Bambu TPU 95A @BBL A1");
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ public class QuoteCalculator {
|
||||
|
||||
private String detectMaterialCode(String profileName) {
|
||||
String lower = profileName.toLowerCase();
|
||||
if (lower.contains("pla tough") || lower.contains("pla_tough")) return "PLA TOUGH";
|
||||
if (lower.contains("petg")) return "PETG";
|
||||
if (lower.contains("tpu")) return "TPU";
|
||||
if (lower.contains("abs")) return "ABS";
|
||||
|
||||
Reference in New Issue
Block a user