This commit is contained in:
2025-06-06 15:01:08 +08:00
parent b2ebe096aa
commit 2aa81bb41a
4 changed files with 136 additions and 12 deletions
@@ -2375,6 +2375,59 @@ public class ProductService {
}
}
} else if ("UV转印贴".equals(dto.getKind())) {
List<String> craft_list = dto.getCraft() == null ? null : Arrays.asList(dto.getCraft());
if (dto.getCraft() != null && craft_list.size() > 0 && (craft_list.contains("冷转印") || craft_list.contains("烫画"))) {
int[] quantitySteps = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
double paperLength = 0, paperWidth = 0;
length += 0.6;
width += 0.6;
if (craft_list.contains("冷转印")) {
paperLength = 20;
paperWidth = 27;
}
if (craft_list.contains("烫画")) {
paperLength = 100;
paperWidth = 57;
}
//一张大纸能放几个
double 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);
int coNumber = dto.getCo_number();
if (coNumber <= 0) {
coNumber = 1;
}
double price = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber);
Product pro = new Product();
pro.setCount(dto.getCount());
pro.setPrice(price);
priceList.add(pro);
for (int i = 0; i < quantitySteps.length; i++) {
if (dto.getCount() >= quantitySteps[i]) {
continue;
}
if (priceList.size() >= 4) {
break;
}
baseCount = Math.max(Math.ceil(quantitySteps[i] * dto.getNumber() / num), 1);
double currentPrice = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber);
pro = new Product();
pro.setCount(quantitySteps[i]);
pro.setPrice(currentPrice);
priceList.add(pro);
}
for (Product product : priceList) {
product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5));
}
return priceList;
}
if (length <= 2) {
length = 2.0;
}
@@ -5349,11 +5402,11 @@ public class ProductService {
}
if (craftList.contains("打码")) {
double danjia = 0.0;
// 5000张以上一张5
// 5000张以上一张10
if (dto.getCount() > 5000) {
danjia = 0.04;
danjia = 0.1;
} else {
danjia = 0.04;
danjia = 0.1;
}
if ("上下编码".equals(dto.getBianma())) {
for (Product product : priceList) {
@@ -3439,4 +3439,23 @@ public class PriceUtils {
}
return price;
}
public double CalculatePrice(List<String> craft_list, double count, int coNumber) {
if (craft_list.contains("烫画")) {
return (int) count * 120;
}
double price = 0;
if (craft_list.contains("冷转印")) {
if (count <= 5) {
price = 260;
} else if (count < 100) {
price = 12 * count + 200;
} else {
price = 14 * count;
}
price = price + (coNumber - 1) * 100;
}
return price;
}
}