Browse Source

[CODE]: 查询费用明细 金额-结算金额

maxianghua 4 years ago
parent
commit
3e7bb3d8e3

+ 28 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -24,6 +24,7 @@ import com.ruoyi.warehouseBusiness.service.impl.BillnoSerialServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 /**
@@ -256,11 +257,37 @@ public class TFeeServiceImpl implements ITFeeService {
 
     @Override
     public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees) {
+        List<Map<String, Object>> maps =new ArrayList<Map<String, Object>>();
         Map<String, Object> map = new HashMap<>();
         map.put("tWareHouseFees", tWareHouseFees);
-        return tFeeMapper.warehouseBillsFeesList(map);
+        List<Map<String, Object>> mapList = tFeeMapper.warehouseBillsFeesList(map);
+        if (mapList != null && mapList.size() > 0) {
+            String fAmtdr = null; // 金额
+            String fAmt = null; // 结算
+            for (Map<String, Object> m : mapList) {
+                for (String k : m.keySet()) {
+                    if (k.equals("fAmtdr")) {
+                        fAmtdr = m.get(k).toString();
+                    }
+                    if (k.equals("fAmt")) {
+                        fAmt = m.get(k).toString();
+                    }
+                }
+                BigDecimal result = calculation1(fAmtdr, fAmt);
+                m.put("fAmtdr",result);
+                m.put("fAmt",result);
+                maps.add(m);
+            }
+        }
+        return maps;
     }
 
+    public static BigDecimal calculation1(String fTotalgross, String fGrossweightblc) {
+        BigDecimal num1 = new BigDecimal(fTotalgross);
+        BigDecimal num2 = new BigDecimal(fGrossweightblc);
+        BigDecimal result = num1.subtract(num2);
+        return result.setScale(2, BigDecimal.ROUND_HALF_UP);
+    }
 
     @Override
     public AjaxResult confirm(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype) {

+ 1 - 1
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -174,7 +174,7 @@
         w.f_feeid AS fFeeid,
         f.f_name AS fFeeName,
         w.f_dc AS fSrcdc,
-        w.f_amount AS fAmt
+        w.f_stlamount AS fAmt
         FROM
         t_warehousebills t
         LEFT JOIN t_corps c ON c.f_id = t.f_corpid