修改uv冷转印

This commit is contained in:
2025-06-13 10:22:19 +08:00
vanhempi fd1ac7132b
commit 844f622d3e
2 muutettua tiedostoa jossa 22 lisäystä ja 15 poistoa
@@ -2392,29 +2392,30 @@ public class ProductService {
} }
if (length == paperLength || length == paperWidth) { if (length == paperLength || length == paperWidth) {
}else{ } else {
length = BigDecimal.valueOf(length).add(BigDecimal.valueOf(0.6)).doubleValue(); length = BigDecimal.valueOf(length).add(BigDecimal.valueOf(0.6)).doubleValue();
} }
if (width == paperLength || width == paperWidth) { if (width == paperLength || width == paperWidth) {
}else{ } else {
width = BigDecimal.valueOf(width).add(BigDecimal.valueOf(0.6)).doubleValue(); width = BigDecimal.valueOf(width).add(BigDecimal.valueOf(0.6)).doubleValue();
} }
//一张大纸能放几个 //一张大纸能放几个
double num = Math.min(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length)); double num = Math.max(Math.min(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length)), 1);
if (craft_list.contains("烫画")) { if (craft_list.contains("烫画")) {
num = Math.max(Math.ceil(paperLength / length) * Math.ceil(paperWidth / width), Math.ceil(paperLength / width) * Math.ceil(paperWidth / length)); num = Math.max(Math.ceil(paperLength / length) * Math.ceil(paperWidth / width), Math.ceil(paperLength / width) * Math.ceil(paperWidth / length));
} }
double baseCount = Math.max(Math.ceil(dto.getCount() * dto.getNumber() / num), 1); double baseCount = Math.max(Math.ceil(dto.getCount() * dto.getNumber() / num), 1);
double countNum = Math.max(Math.ceil(dto.getCount() / num), 1);
int coNumber = dto.getCo_number(); int coNumber = dto.getCo_number();
if (coNumber <= 0) { if (coNumber <= 0) {
coNumber = 1; coNumber = 1;
} }
double price = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber); double price = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber, countNum);
Product pro = new Product(); Product pro = new Product();
pro.setCount(dto.getCount()); pro.setCount(dto.getCount());
@@ -2428,7 +2429,8 @@ public class ProductService {
break; break;
} }
baseCount = Math.max(Math.ceil(quantitySteps[i] * dto.getNumber() / num), 1); baseCount = Math.max(Math.ceil(quantitySteps[i] * dto.getNumber() / num), 1);
double currentPrice = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber); countNum = Math.max(Math.ceil(dto.getCount() / num), 1);
double currentPrice = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber, countNum);
pro = new Product(); pro = new Product();
@@ -2437,9 +2439,9 @@ public class ProductService {
priceList.add(pro); priceList.add(pro);
} }
for (Product product : priceList) { // for (Product product : priceList) {
product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5)); // product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5));
} // }
return priceList; return priceList;
} }
@@ -3440,20 +3440,25 @@ public class PriceUtils {
return price; return price;
} }
public double CalculatePrice(List<String> craft_list, double count, int coNumber) { public double CalculatePrice(List<String> craft_list, double count, int coNumber, double countNum) {
if (craft_list.contains("烫画")) { if (craft_list.contains("烫画")) {
return (int) count * 120; return (int) count * 120;
} }
double price = 0; double price = 0;
if (craft_list.contains("冷转印")) { if (craft_list.contains("冷转印")) {
if (count <= 5) { if (countNum == 1) {
price = 260; price = 260 * Math.ceil(count / countNum) + (coNumber - 1) * 100;
} else if (count < 100) {
price = 14 * count + 200;
} else { } else {
price = 12 * count; if (count <= 5) {
price = 260;
} else if (count < 100) {
price = 14 * count + 200;
} else {
price = 12 * count;
}
price = price + (coNumber - 1) * 100;
} }
price = price + (coNumber - 1) * 100;
} }
return price; return price;