|
|
@@ -387,43 +387,39 @@ public class PriceUtils {
|
|
|
|
|
|
// 不干胶常规数量美纹纸价格计算
|
|
|
public List<Product> getMeiWenZhiPrice(Double length, Double width, int count, Integer number, String craftMo) {
|
|
|
- double l = 420;
|
|
|
- double w = 285;
|
|
|
- Product pro = new Product();
|
|
|
- List<Product> list = new ArrayList<Product>();
|
|
|
- // 成本价 元/张
|
|
|
- double danjia = 1.8;
|
|
|
- if ("模切".equals(craftMo)) {
|
|
|
- danjia = 2.2;
|
|
|
- }
|
|
|
- // 换成毫米每边+2
|
|
|
- length = length * 10 + 4;
|
|
|
- width = width * 10 + 4;
|
|
|
- if ((length > l || width > w) && (length > w || width > l))
|
|
|
- return null;
|
|
|
- // 一张大纸能做多少个此类尺寸的不干胶
|
|
|
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
|
|
|
- Math.floor(l / width) * Math.floor(w / length));
|
|
|
-
|
|
|
- for (int i = 0; i < countArr.length; i++) {
|
|
|
- if (countArr[i] < count || list.size() > 3) {
|
|
|
+ List<Product> priceList = new ArrayList<>();
|
|
|
+ int[][] prices = new int[][]{
|
|
|
+ {79, 107, 134, 272, 343, 685, 1030, 1374, 1787, 2322, 2748, 3302, 4351},
|
|
|
+ {84, 112, 139, 277, 348, 690, 1035, 1379, 1792, 2327, 2753, 3307, 4356},
|
|
|
+ {161, 222, 278, 553, 690, 1377, 2065, 2748, 3584, 4653, 5505, 6614, 8712},
|
|
|
+ {318, 443, 552, 1101, 1377, 2753, 4119, 5475, 7128, 9108, 10613, 12435, 13068},
|
|
|
+ {475, 661, 828, 1652, 2066, 4129, 6178, 8213, 10692, 13662, 15920, 18652, 19602},
|
|
|
+ {788, 1099, 1380, 2743, 3430, 6856, 10272, 13613, 17721, 22275, 25542, 29700, 32670},
|
|
|
+ {1575, 2188, 2747, 5485, 6859, 13712, 20543, 27225, 35442, 44550, 51084, 59400, 65340},
|
|
|
+ {3150, 4355, 5494, 10930, 13662, 27324, 40887, 54054, 69894, 87120, 99000, 114444, 121968},
|
|
|
+ };
|
|
|
+ int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000, 20000};
|
|
|
+ double[] areas = new double[]{26, 37, 49.6, 82, 127, 171, 231, 295, 361, 451, 600.5, 902, 1199};
|
|
|
+ double area = length * width;
|
|
|
+ for (int i = 0; i < count_list.length; i++) {
|
|
|
+ int count_item = count_list[i];
|
|
|
+ if (priceList.size() > 2) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (count > count_item) {
|
|
|
continue;
|
|
|
}
|
|
|
- pro = new Product();
|
|
|
- // 报的数量需要多少张大纸
|
|
|
- int num = (int) Math.ceil(countArr[i] / max);
|
|
|
- pro.setCount(countArr[i]);
|
|
|
- pro.setPrice(Math.ceil(num * danjia * 2.5 > 83 ? num * danjia * 2.5 : 83));
|
|
|
- list.add(pro);
|
|
|
+ int count_index = Arrays.binarySearch(count_list, count_item);
|
|
|
+ double price = 0;
|
|
|
+ if (count_index >= 0) {
|
|
|
+ price = new PriceUtils().TablePrice(area, prices[count_index], areas);
|
|
|
+ }
|
|
|
+ Product product = new Product();
|
|
|
+ product.setCount(count_item);
|
|
|
+ product.setPrice(Math.ceil(price * number));
|
|
|
+ priceList.add(product);
|
|
|
}
|
|
|
-
|
|
|
- /*if(number > 1) {
|
|
|
- for (Product product : list) {
|
|
|
- product.setPrice(Math.ceil(product.getPrice() * number));
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
- return list;
|
|
|
+ return priceList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -3433,7 +3429,7 @@ public class PriceUtils {
|
|
|
}
|
|
|
}
|
|
|
if (startIndex == endIndex) {
|
|
|
- price = (price_list[endIndex] / areas[endIndex]) * area;
|
|
|
+ price = price_list[endIndex];
|
|
|
} else {
|
|
|
price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
|
|
|
}
|