Browse Source

成本分配表调整

zengtx 2 years ago
parent
commit
74f4ebf239

+ 25 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocation.java

@@ -13,6 +13,7 @@ import org.jeecgframework.poi.excel.annotation.ExcelCollection;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
@@ -123,9 +124,17 @@ public class SyCostAllocation implements Serializable {
     /**面料含税成本*/
     /**面料含税成本*/
     @ApiModelProperty(value = "面料含税成本")
     @ApiModelProperty(value = "面料含税成本")
     private java.math.BigDecimal fabriccostIncludestax;
     private java.math.BigDecimal fabriccostIncludestax;
+    /**面料含税成本美元*/
+    @ApiModelProperty(value = "面料含税成本美元")
+    @TableField(exist = false)
+    private java.math.BigDecimal fabriccostIncludestaxUsd;
     /**辅料含税成本*/
     /**辅料含税成本*/
     @ApiModelProperty(value = "辅料含税成本")
     @ApiModelProperty(value = "辅料含税成本")
     private java.math.BigDecimal excipiencostIncludestax;
     private java.math.BigDecimal excipiencostIncludestax;
+    /**美元辅料含税成本*/
+    @ApiModelProperty(value = "美元辅料含税成本")
+    @TableField(exist = false)
+    private java.math.BigDecimal excipiencostIncludestaxUsd;
     /**销售订单本币总额*/
     /**销售订单本币总额*/
     @ApiModelProperty(value = "销售订单本币总额")
     @ApiModelProperty(value = "销售订单本币总额")
     private java.math.BigDecimal salesordersLocaltotal;
     private java.math.BigDecimal salesordersLocaltotal;
@@ -135,9 +144,17 @@ public class SyCostAllocation implements Serializable {
     /**面料不含税成本*/
     /**面料不含税成本*/
     @ApiModelProperty(value = "面料不含税成本")
     @ApiModelProperty(value = "面料不含税成本")
     private java.math.BigDecimal fabriccostNotincludestax;
     private java.math.BigDecimal fabriccostNotincludestax;
+    /**面料不含税成本美元*/
+    @TableField(exist = false)
+    @ApiModelProperty(value = "面料不含税成本美元")
+    private java.math.BigDecimal fabriccostNotincludestaxUsd;
     /**辅料不含税成本*/
     /**辅料不含税成本*/
     @ApiModelProperty(value = "辅料不含税成本")
     @ApiModelProperty(value = "辅料不含税成本")
     private java.math.BigDecimal excipiencostNotincludestax;
     private java.math.BigDecimal excipiencostNotincludestax;
+    /**美元辅料不含税成本*/
+    @ApiModelProperty(value = "美元辅料不含税成本")
+    @TableField(exist = false)
+    private java.math.BigDecimal excipiencostNotincludestaxUsd;
     /**销售订单原币总额*/
     /**销售订单原币总额*/
     @ApiModelProperty(value = "销售订单原币总额")
     @ApiModelProperty(value = "销售订单原币总额")
     private java.math.BigDecimal salesrrdersOriginaltotal;
     private java.math.BigDecimal salesrrdersOriginaltotal;
@@ -169,6 +186,13 @@ public class SyCostAllocation implements Serializable {
     @ApiModelProperty(value = "子表_加工单位")
     @ApiModelProperty(value = "子表_加工单位")
     private List<JSONObject> processUnitList=new ArrayList<>();
     private List<JSONObject> processUnitList=new ArrayList<>();
 
 
-
+    @TableField(exist = false)
+    @ExcelCollection(name="汇率")
+    @ApiModelProperty(value = "汇率")
+    private BigDecimal exchangeRate;
+    @TableField(exist = false)
+    @ExcelCollection(name="税率")
+    @ApiModelProperty(value = "税率")
+    private BigDecimal iTaxRate;
 
 
 }
 }

+ 7 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationShipdetail.java

@@ -107,10 +107,14 @@ public class SyCostAllocationShipdetail implements Serializable {
     @Excel(name = "加工单价(美元)", width = 15)
     @Excel(name = "加工单价(美元)", width = 15)
     @ApiModelProperty(value = "加工单价(美元)")
     @ApiModelProperty(value = "加工单价(美元)")
     private java.math.BigDecimal procesUnitPriceusd;
     private java.math.BigDecimal procesUnitPriceusd;
-    /**加工费*/
-    @Excel(name = "加工费", width = 15)
-    @ApiModelProperty(value = "加工费")
+    /**人民币加工费*/
+    @Excel(name = "人民币加工费", width = 15)
+    @ApiModelProperty(value = "人民币加工费")
     private java.math.BigDecimal processCost;
     private java.math.BigDecimal processCost;
+    /**美元加工费*/
+    @Excel(name = "美元加工费", width = 15)
+    @ApiModelProperty(value = "美元加工费")
+    private java.math.BigDecimal processCostUsd;
     /**加工单位*/
     /**加工单位*/
     @Excel(name = "加工单位", width = 15)
     @Excel(name = "加工单位", width = 15)
     @ApiModelProperty(value = "加工单位")
     @ApiModelProperty(value = "加工单位")

+ 3 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationMapper.xml

@@ -18,7 +18,7 @@
     </select>
     </select>
 
 
     <select id="queryByCostHead" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
     <select id="queryByCostHead" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
-        SELECT      
+        SELECT max(ss.iExchRate) as exchangeRate,
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
             max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department, 
             max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department, 
             max(cc.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,min(rd.dDate) as outdata,
             max(cc.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,min(rd.dDate) as outdata,
@@ -48,7 +48,7 @@
         
         
         union all  
         union all  
         
         
-        SELECT      
+        SELECT max(ss.iExchRate) as exchangeRate,
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales, 
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales, 
             max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department, 
             max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department, 
             max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,min(rd.dDate) as outdata,
             max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,min(rd.dDate) as outdata,
@@ -85,7 +85,7 @@
         
         
         union all  
         union all  
         
         
-        SELECT      
+        SELECT max(ss.iExchRate) as exchangeRate,
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales, 
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales, 
             max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department, 
             max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department, 
             max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,min(rd.dDate) as outdata,
             max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,min(rd.dDate) as outdata,

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationShipdetailMapper.xml

@@ -31,6 +31,7 @@
 			avg(so.procesUnitPriceusd) as procesUnitPriceusd,
 			avg(so.procesUnitPriceusd) as procesUnitPriceusd,
 			avg(so.procesUnitPriceusd)*sh.iExchRate as procesUnitPricermb,
 			avg(so.procesUnitPriceusd)*sh.iExchRate as procesUnitPricermb,
 			avg(so.procesUnitPricermb) * sum(shs.iQuantity) as processCost,
 			avg(so.procesUnitPricermb) * sum(shs.iQuantity) as processCost,
+			(avg(so.procesUnitPricermb) * sum(shs.iQuantity)/avg(so.procesUnitPricermb)) as processCostUsd,
 			v.cVenName AS processUnit
 			v.cVenName AS processUnit
 		 FROM
 		 FROM
 			UFDATA_101_2021.dbo.SaleBillVouch sh
 			UFDATA_101_2021.dbo.SaleBillVouch sh
@@ -71,6 +72,7 @@
 			avg(so.iOriTaxCost) as procesUnitPriceusd,
 			avg(so.iOriTaxCost) as procesUnitPriceusd,
 			avg(so.iOriTaxCost)*sh.iExchRate as procesUnitPricermb,
 			avg(so.iOriTaxCost)*sh.iExchRate as procesUnitPricermb,
 			avg(so.iNatUnitPrice) * sum(shs.iQuantity) as processCost,
 			avg(so.iNatUnitPrice) * sum(shs.iQuantity) as processCost,
+			(avg(so.iNatUnitPrice) * sum(shs.iQuantity)/avg(so.iNatUnitPrice)) as processCostUsd,
 			v.cVenName AS processUnit
 			v.cVenName AS processUnit
 		FROM
 		FROM
 			UFDATA_102_2021.dbo.SaleBillVouch sh
 			UFDATA_102_2021.dbo.SaleBillVouch sh
@@ -124,6 +126,7 @@
 		avg(so.iOriTaxCost) as procesUnitPriceusd,
 		avg(so.iOriTaxCost) as procesUnitPriceusd,
 		avg(so.iOriTaxCost)*sh.iExchRate as procesUnitPricermb,
 		avg(so.iOriTaxCost)*sh.iExchRate as procesUnitPricermb,
 		avg(so.iNatUnitPrice) * sum(shs.iQuantity) as processCost,
 		avg(so.iNatUnitPrice) * sum(shs.iQuantity) as processCost,
+		(avg(so.iNatUnitPrice) * sum(shs.iQuantity)/avg(so.iNatUnitPrice)) as processCostUsd,
 		v.cVenName AS processUnit
 		v.cVenName AS processUnit
 		 FROM
 		 FROM
 			UFDATA_101_2021.dbo.SaleBillVouch sh
 			UFDATA_101_2021.dbo.SaleBillVouch sh

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

@@ -185,10 +185,14 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 
 
         FabricLoss fabricLoss1 = null;
         FabricLoss fabricLoss1 = null;
         if (syLossReport1 != null){
         if (syLossReport1 != null){
+            //人民币面料含税成本和不含税成本
             fabricLoss1 = JSON.parseObject(JSON.toJSONString(syLossReport1.getContent()), FabricLoss.class);
             fabricLoss1 = JSON.parseObject(JSON.toJSONString(syLossReport1.getContent()), FabricLoss.class);
             syCostAllocation.setFabriccostIncludestax(new BigDecimal(fabricLoss1.getActualMoney()));
             syCostAllocation.setFabriccostIncludestax(new BigDecimal(fabricLoss1.getActualMoney()));
             syCostAllocation.setFabriccostNotincludestax(new BigDecimal(fabricLoss1.getFabricCostInvoiceList().stream().
             syCostAllocation.setFabriccostNotincludestax(new BigDecimal(fabricLoss1.getFabricCostInvoiceList().stream().
                     filter(item->item.getINoTaxMoney()!=null).mapToDouble(FabricCostInvoice::getINoTaxMoney).sum()));
                     filter(item->item.getINoTaxMoney()!=null).mapToDouble(FabricCostInvoice::getINoTaxMoney).sum()));
+            //美元面料含税成本和不含税成本
+            syCostAllocation.setFabriccostIncludestaxUsd(syCostAllocation.getFabriccostNotincludestax().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
+            syCostAllocation.setFabriccostNotincludestaxUsd(syCostAllocation.getFabriccostNotincludestax().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
         }
         }
 
 
         /*如果出现多供应商的情况拼接 供应商*/
         /*如果出现多供应商的情况拼接 供应商*/
@@ -291,23 +295,31 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                     Ingredient.setSyRemaining(remaininglist);
                     Ingredient.setSyRemaining(remaininglist);
                 }
                 }
             }
             }
-            //辅料含税成本 美元
+            //辅料含税成本 美元和人民币
             if(Ingredient.getUsdAmount()!=null){
             if(Ingredient.getUsdAmount()!=null){
                 if(syCostAllocation.getExcipiencostIncludestax()==null){
                 if(syCostAllocation.getExcipiencostIncludestax()==null){
                     syCostAllocation.setExcipiencostIncludestax(BigDecimal.ZERO);
                     syCostAllocation.setExcipiencostIncludestax(BigDecimal.ZERO);
+                    syCostAllocation.setExcipiencostIncludestaxUsd(BigDecimal.ZERO);
                 }
                 }
                 syCostAllocation.setExcipiencostIncludestax(Ingredient.getUsdAmount().add(syCostAllocation.getExcipiencostIncludestax()));
                 syCostAllocation.setExcipiencostIncludestax(Ingredient.getUsdAmount().add(syCostAllocation.getExcipiencostIncludestax()));
+                syCostAllocation.setExcipiencostIncludestaxUsd(syCostAllocation.getExcipiencostIncludestax().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
+
             }else {
             }else {
                 syCostAllocation.setExcipiencostIncludestax(BigDecimal.ZERO);
                 syCostAllocation.setExcipiencostIncludestax(BigDecimal.ZERO);
+                syCostAllocation.setExcipiencostIncludestaxUsd(BigDecimal.ZERO);
             }
             }
-            //辅料不含税成本
+            //辅料不含税成本 美元和人民币
             if(Ingredient.getPriceExcludingtax()!=null){
             if(Ingredient.getPriceExcludingtax()!=null){
                 if(syCostAllocation.getExcipiencostNotincludestax()==null){
                 if(syCostAllocation.getExcipiencostNotincludestax()==null){
                     syCostAllocation.setExcipiencostNotincludestax(BigDecimal.ZERO);
                     syCostAllocation.setExcipiencostNotincludestax(BigDecimal.ZERO);
+                    syCostAllocation.setExcipiencostNotincludestaxUsd(BigDecimal.ZERO);
                 }
                 }
                 syCostAllocation.setExcipiencostNotincludestax(Ingredient.getPriceExcludingtax().add(syCostAllocation.getExcipiencostNotincludestax()));
                 syCostAllocation.setExcipiencostNotincludestax(Ingredient.getPriceExcludingtax().add(syCostAllocation.getExcipiencostNotincludestax()));
+                syCostAllocation.setExcipiencostNotincludestaxUsd(syCostAllocation.getExcipiencostNotincludestax().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
+
             }else {
             }else {
                 syCostAllocation.setExcipiencostNotincludestax(BigDecimal.ZERO);
                 syCostAllocation.setExcipiencostNotincludestax(BigDecimal.ZERO);
+                syCostAllocation.setExcipiencostNotincludestaxUsd(BigDecimal.ZERO);
             }
             }
         }
         }
 
 
@@ -343,14 +355,17 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
             }else {
             }else {
                 syCostAllocation.setUsdTotalexportprice(BigDecimal.ZERO);
                 syCostAllocation.setUsdTotalexportprice(BigDecimal.ZERO);
             }
             }
-            //加工费
+            //人民币加工费和美元加工费
             if(ship.getProcessCost()!=null){
             if(ship.getProcessCost()!=null){
                 if(syCostAllocation.getRmbProcesscost()==null){
                 if(syCostAllocation.getRmbProcesscost()==null){
                     syCostAllocation.setRmbProcesscost(BigDecimal.ZERO);
                     syCostAllocation.setRmbProcesscost(BigDecimal.ZERO);
+                    syCostAllocation.setUsdProcesscost(BigDecimal.ZERO);
                 }
                 }
                 syCostAllocation.setRmbProcesscost(ship.getProcessCost().add(syCostAllocation.getRmbProcesscost()));
                 syCostAllocation.setRmbProcesscost(ship.getProcessCost().add(syCostAllocation.getRmbProcesscost()));
+                syCostAllocation.setUsdProcesscost(ship.getProcessCostUsd().add(syCostAllocation.getUsdProcesscost()));
             }else {
             }else {
                 ship.setProcessCost(BigDecimal.ZERO);
                 ship.setProcessCost(BigDecimal.ZERO);
+                ship.setProcessCostUsd(BigDecimal.ZERO);
             }
             }
         }
         }
         //短出数
         //短出数