Prechádzať zdrojové kódy

成本分配表调整

fenghaifu 1 deň pred
rodič
commit
3487247b8c

+ 55 - 44
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -537,32 +537,37 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                                 //-- fabriccostincludestax=面料含税成本 fabriccostNotincludestax=面料不含税成本
 //                        System.out.println("getFabriccostIncludestax "+str.getFabriccostIncludestax()+" getFabriccostNotincludestax "+str.getFabriccostNotincludestax()
 //                                +"getFabriccostIncludestaxUsd"+str.getFabriccostIncludestaxUsd()+" getInvoiceQuantity "+str.getInvoiceQuantity()+" quantity "+quantity);
-                                if (str.getInvoiceQuantity().compareTo(quantity)!=0){
-                                    exchangeRate=str.getExchangeRate();//汇率
-                                    BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-                                    BigDecimal num = money.multiply(str.getInvoiceQuantity());
-                                    usageQuantityTotal = usageQuantityTotal.add(num);
-                                    System.out.println("str\t"+str);
-                                    System.out.println("str.getFabriccostIncludestax()\t"+str.getFabriccostIncludestax());
-                                    System.out.println("str.getFabriccostNotincludestax()\t"+str.getFabriccostNotincludestax());
-                                    System.out.println("money\t"+money);
-                                    System.out.println("getInvoiceQuantity\t"+str.getInvoiceQuantity());
-                                    System.out.println("quantity\t"+quantity);
-                                    System.out.println("num\t"+num);
-                                    BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-                                    BigDecimal num1 = money1.multiply(quantity);
-                                    notincludestaxTotal = notincludestaxTotal.add(num1);
-//                                notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostIncludestax());
-                                    System.out.println("notincludestaxTotal1\t"+notincludestaxTotal);
-                                    BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-                                    BigDecimal num2 = money2.multiply(quantity);
-                                    includestaxTotal = includestaxTotal.add(num2);
-                                }else{
-                                    usageQuantityTotal = usageQuantityTotal.add(str.getFabriccostIncludestax());
+//                                if (str.getInvoiceQuantity().compareTo(quantity)!=0){
+//                                    exchangeRate=str.getExchangeRate();//汇率
+//                                    BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+//                                    BigDecimal num = money.multiply(str.getInvoiceQuantity());
+//                                    usageQuantityTotal = usageQuantityTotal.add(num);
+//                                    System.out.println("str\t"+str);
+//                                    System.out.println("str.getFabriccostIncludestax()\t"+str.getFabriccostIncludestax());
+//                                    System.out.println("str.getFabriccostNotincludestax()\t"+str.getFabriccostNotincludestax());
+//                                    System.out.println("money\t"+money);
+//                                    System.out.println("getInvoiceQuantity\t"+str.getInvoiceQuantity());
+//                                    System.out.println("quantity\t"+quantity);
+//                                    System.out.println("num\t"+num);
+//                                    BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+//                                    BigDecimal num1 = money1.multiply(quantity);
+//                                    notincludestaxTotal = notincludestaxTotal.add(num1);
+////                                notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostIncludestax());
+//                                    System.out.println("notincludestaxTotal1\t"+notincludestaxTotal);
+//                                    BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+//                                    BigDecimal num2 = money2.multiply(quantity);
+//                                    includestaxTotal = includestaxTotal.add(num2);
+//                                }else{
+                                    if (oConvertUtils.isNotEmpty(str.getFabriccostIncludestaxUsd()) && str.getFabriccostIncludestaxUsd().compareTo(BigDecimal.ZERO)>0){
+                                        BigDecimal num = str.getFabriccostIncludestax().multiply(new BigDecimal(1.13));
+                                        usageQuantityTotal = usageQuantityTotal.add(num);
+                                    }else {
+                                        usageQuantityTotal = usageQuantityTotal.add(str.getFabriccostIncludestax());
+                                    }
                                     notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostNotincludestax());
                                     System.out.println("notincludestaxTotal2\t"+notincludestaxTotal);
                                     includestaxTotal = includestaxTotal.add(str.getFabriccostIncludestaxUsd());
-                                }
+//                                }
                                 System.out.println(" getInvoiceQuantity "+str.getInvoiceQuantity()+" quantity "+quantity);
 //                            BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
 //                            BigDecimal num = money.multiply(li.getUsageQuantity());
@@ -616,32 +621,37 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                                 if (li.getFabrictransferQuantity()!=null){
                                     quantity=li.getUsageQuantity().subtract(li.getFabrictransferQuantity());
                                 }
-                                if (str.getInvoiceQuantity().compareTo(quantity)!=0){
-                                    exchangeRate=str.getExchangeRate();//汇率
-                                    BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-                                    BigDecimal num = money.multiply(str.getInvoiceQuantity());
+//                                if (str.getInvoiceQuantity().compareTo(quantity)!=0){
+//                                    exchangeRate=str.getExchangeRate();//汇率
+//                                    BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+//                                    BigDecimal num = money.multiply(str.getInvoiceQuantity());
+//                                    usageQuantityTotal = usageQuantityTotal.add(num);
+//                                    System.out.println("str\t"+str);
+//                                    System.out.println("str.getFabriccostIncludestax()\t"+str.getFabriccostIncludestax());
+//                                    System.out.println("str.getFabriccostNotincludestax()\t"+str.getFabriccostNotincludestax());
+//                                    System.out.println("money\t"+money);
+//                                    System.out.println("getInvoiceQuantity\t"+str.getInvoiceQuantity());
+//                                    System.out.println("quantity\t"+quantity);
+//                                    System.out.println("num\t"+num);
+//                                    BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+//                                    BigDecimal num1 = money1.multiply(quantity);
+//                                    notincludestaxTotal = notincludestaxTotal.add(num1);
+////                                notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostIncludestax());
+//                                    System.out.println("notincludestaxTotal1\t"+notincludestaxTotal);
+//                                    BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+//                                    BigDecimal num2 = money2.multiply(quantity);
+//                                    includestaxTotal = includestaxTotal.add(num2);
+//                                }else{
+                                if (oConvertUtils.isNotEmpty(str.getFabriccostIncludestaxUsd()) && str.getFabriccostIncludestaxUsd().compareTo(BigDecimal.ZERO)>0){
+                                    BigDecimal num = str.getFabriccostIncludestax().multiply(new BigDecimal(1.13));
                                     usageQuantityTotal = usageQuantityTotal.add(num);
-                                    System.out.println("str\t"+str);
-                                    System.out.println("str.getFabriccostIncludestax()\t"+str.getFabriccostIncludestax());
-                                    System.out.println("str.getFabriccostNotincludestax()\t"+str.getFabriccostNotincludestax());
-                                    System.out.println("money\t"+money);
-                                    System.out.println("getInvoiceQuantity\t"+str.getInvoiceQuantity());
-                                    System.out.println("quantity\t"+quantity);
-                                    System.out.println("num\t"+num);
-                                    BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-                                    BigDecimal num1 = money1.multiply(quantity);
-                                    notincludestaxTotal = notincludestaxTotal.add(num1);
-//                                notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostIncludestax());
-                                    System.out.println("notincludestaxTotal1\t"+notincludestaxTotal);
-                                    BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-                                    BigDecimal num2 = money2.multiply(quantity);
-                                    includestaxTotal = includestaxTotal.add(num2);
-                                }else{
+                                }else {
                                     usageQuantityTotal = usageQuantityTotal.add(str.getFabriccostIncludestax());
+                                }
                                     notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostNotincludestax());
                                     System.out.println("notincludestaxTotal2\t"+notincludestaxTotal);
                                     includestaxTotal = includestaxTotal.add(str.getFabriccostIncludestaxUsd());
-                                }
+//                                }
                                 System.out.println(" getInvoiceQuantity "+str.getInvoiceQuantity()+" quantity "+quantity);
 //                            BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
 //                            BigDecimal num = money.multiply(li.getUsageQuantity());
@@ -661,6 +671,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 //                System.out.println("面料含税人民币2\t"+usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
 //                System.out.println("实际总金额2\t"+usageQuantityTotal);
                     System.out.println("人民币面料成本notincludestaxTotal\t"+notincludestaxTotal);
+                    usageQuantityTotal = usageQuantityTotal.setScale(2, BigDecimal.ROUND_HALF_UP);
                     if (syCostAllocation.getFabriccostIncludestax()!=null){
                         syCostAllocation.setFabriccostIncludestax(syCostAllocation.getFabriccostIncludestax().add(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP)));
                     }else{