|
|
@@ -477,42 +477,42 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
|
|
|
}
|
|
|
|
|
|
//如果没有面损表信息,查询所有采购发票
|
|
|
- if (syLossReport1 == null){
|
|
|
- //根据计划号查找该计划号下所有采购发票含税金额和不含税金额(不含税金额 = 含税金额/1.13)
|
|
|
- List<SyCostAllocation> fabriccostIncludestax = syCostAllocationMapper.queryPurBillVouchByFabric(plannum);
|
|
|
- //合计面料含税成本人名币
|
|
|
- BigDecimal usageQuantityTotal = BigDecimal.ZERO;
|
|
|
- //合计面料不含税成本人名币
|
|
|
- BigDecimal notincludestaxTotal = BigDecimal.ZERO;
|
|
|
- //合计面料成本美元
|
|
|
- BigDecimal includestaxTotal = BigDecimal.ZERO;
|
|
|
- if(fabriccostIncludestax.size()!=0){
|
|
|
- for(SyCostAllocation str : fabriccostIncludestax){
|
|
|
- for(SyCostAllocationFabric li:list3){
|
|
|
- String goodsName=li.getGoodsName();
|
|
|
- if (goodsName.indexOf("--")!=-1){
|
|
|
- goodsName=goodsName.substring(0,goodsName.indexOf("--"));
|
|
|
+// if (syLossReport1 == null){
|
|
|
+ //根据计划号查找该计划号下所有采购发票含税金额和不含税金额(不含税金额 = 含税金额/1.13)
|
|
|
+ List<SyCostAllocation> fabriccostIncludestax = syCostAllocationMapper.queryPurBillVouchByFabric(plannum);
|
|
|
+ //合计面料含税成本人名币
|
|
|
+ BigDecimal usageQuantityTotal = BigDecimal.ZERO;
|
|
|
+ //合计面料不含税成本人名币
|
|
|
+ BigDecimal notincludestaxTotal = BigDecimal.ZERO;
|
|
|
+ //合计面料成本美元
|
|
|
+ BigDecimal includestaxTotal = BigDecimal.ZERO;
|
|
|
+ if(fabriccostIncludestax.size()!=0){
|
|
|
+ for(SyCostAllocation str : fabriccostIncludestax){
|
|
|
+ for(SyCostAllocationFabric li:list3){
|
|
|
+ String goodsName=li.getGoodsName();
|
|
|
+ if (goodsName.indexOf("--")!=-1){
|
|
|
+ goodsName=goodsName.substring(0,goodsName.indexOf("--"));
|
|
|
+ }
|
|
|
+ if(str.getCInvName().equals(goodsName)){
|
|
|
+ BigDecimal quantity=li.getUsageQuantity();
|
|
|
+ if (li.getFabrictransferQuantity()!=null){
|
|
|
+ quantity=li.getUsageQuantity().subtract(li.getFabrictransferQuantity());
|
|
|
+ }
|
|
|
+ if (str.getInvoiceQuantity().compareTo(quantity)!=0){
|
|
|
+ BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal num = money.multiply(quantity);
|
|
|
+ usageQuantityTotal = usageQuantityTotal.add(num);
|
|
|
+ BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal num1 = money1.multiply(quantity);
|
|
|
+ notincludestaxTotal = notincludestaxTotal.add(num1);
|
|
|
+ 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());
|
|
|
+ notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostNotincludestax());
|
|
|
+ includestaxTotal = includestaxTotal.add(str.getFabriccostIncludestaxUsd());
|
|
|
}
|
|
|
- if(str.getCInvName().equals(goodsName)){
|
|
|
- BigDecimal quantity=li.getUsageQuantity();
|
|
|
- if (li.getFabrictransferQuantity()!=null){
|
|
|
- quantity=li.getUsageQuantity().subtract(li.getFabrictransferQuantity());
|
|
|
- }
|
|
|
- if (str.getInvoiceQuantity().compareTo(quantity)!=0){
|
|
|
- BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
- BigDecimal num = money.multiply(quantity);
|
|
|
- usageQuantityTotal = usageQuantityTotal.add(num);
|
|
|
- BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
- BigDecimal num1 = money1.multiply(quantity);
|
|
|
- notincludestaxTotal = notincludestaxTotal.add(num1);
|
|
|
- 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());
|
|
|
- notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostNotincludestax());
|
|
|
- includestaxTotal = includestaxTotal.add(str.getFabriccostIncludestaxUsd());
|
|
|
- }
|
|
|
// BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
// BigDecimal num = money.multiply(li.getUsageQuantity());
|
|
|
// usageQuantityTotal = usageQuantityTotal.add(num);
|
|
|
@@ -523,24 +523,43 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
|
|
|
// BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
// BigDecimal num2 = money2.multiply(li.getUsageQuantity());
|
|
|
// includestaxTotal = includestaxTotal.add(num2);
|
|
|
- //(发票金额/发票数量)*使用数量
|
|
|
+ //(发票金额/发票数量)*使用数量
|
|
|
// System.out.println("面料含税成本\t"+usageQuantityTotal+"\t面料不含税成本\t"+notincludestaxTotal+"\t发票数量\t"+str.getInvoiceQuantity()+"\t使用数量\t"+li.getUsageQuantity());
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
- System.out.println("面料含税人民币2\t"+usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
- syCostAllocation.setFabriccostIncludestax(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
+ }
|
|
|
+// System.out.println("面料含税人民币2\t"+usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
// System.out.println("实际总金额2\t"+usageQuantityTotal);
|
|
|
+
|
|
|
+ if (syCostAllocation.getFabriccostIncludestax()!=null){
|
|
|
+ syCostAllocation.setFabriccostIncludestax(syCostAllocation.getFabriccostIncludestax().add(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP)));
|
|
|
+ }else{
|
|
|
+ syCostAllocation.setFabriccostIncludestax(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
+ }
|
|
|
+ if (syCostAllocation.getFabriccostNotincludestax()!=null){
|
|
|
+ syCostAllocation.setFabriccostNotincludestax(syCostAllocation.getFabriccostNotincludestax().add(notincludestaxTotal));
|
|
|
+ }else{
|
|
|
syCostAllocation.setFabriccostNotincludestax(notincludestaxTotal);
|
|
|
- syCostAllocation.setFabriccostIncludestaxUsd(includestaxTotal);
|
|
|
+ }
|
|
|
+ if (syCostAllocation.getFabriccostIncludestaxUsd()!=null){
|
|
|
+ syCostAllocation.setFabriccostIncludestaxUsd(syCostAllocation.getFabriccostIncludestaxUsd().add(includestaxTotal));
|
|
|
}else{
|
|
|
+ syCostAllocation.setFabriccostIncludestaxUsd(includestaxTotal);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (syCostAllocation.getFabriccostIncludestax()==null){
|
|
|
syCostAllocation.setFabriccostIncludestax(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if (syCostAllocation.getFabriccostNotincludestax()==null){
|
|
|
syCostAllocation.setFabriccostNotincludestax(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if (syCostAllocation.getFabriccostIncludestaxUsd()==null){
|
|
|
syCostAllocation.setFabriccostIncludestaxUsd(BigDecimal.ZERO);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+// }
|
|
|
+
|
|
|
long startTime3 = System.currentTimeMillis();
|
|
|
//查询U8数据 辅料数据关联临时表 syTransfers ingredientsTransferQuantity
|
|
|
List<SyCostAllocationIngredient> list4 = syCostAllocationIngredientMapper.queryByCostIngredient4(plannum,syCostAllocation.getExchangeRate());
|