Bladeren bron

Merge remote-tracking branch 'origin/_update/bug' into dev

caifc 3 jaren geleden
bovenliggende
commit
cb51d11386
27 gewijzigde bestanden met toevoegingen van 1293 en 283 verwijderingen
  1. 163 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TInvoiceController.java
  2. 32 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/PayableController.java
  3. 33 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/ReceivableController.java
  4. 16 17
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWhgenlegController.java
  5. 10 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TWareHouseFees.java
  6. 41 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/dto/FeeDTO.java
  7. 43 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/excel/GeneralLedgerDetailExcel.java
  8. 28 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/excel/GeneralLedgerExcel.java
  9. 55 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/vo/FeeVO.java
  10. 23 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeMapper.java
  11. 75 27
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeService.java
  12. 128 62
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java
  13. 22 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/vo/WhgenlegVO.java
  14. 8 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java
  15. 25 7
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java
  16. 46 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java
  17. 1 4
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/component/impl/QueryWhgenlegServiceImpl.java
  18. 9 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/FeesTypeEnum.java
  19. 1 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/WarehouseActIdEnum.java
  20. 56 44
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/WarehouseTypeEnum.java
  21. 6 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java
  22. 11 5
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java
  23. 21 5
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java
  24. 294 26
      ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml
  25. 34 1
      ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml
  26. 102 79
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml
  27. 10 0
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

+ 163 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TInvoiceController.java

@@ -0,0 +1,163 @@
+package com.ruoyi.web.controller.warehouse.finance;
+
+import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.finance.domain.TFee;
+import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.excel.Charge;
+import com.ruoyi.finance.excel.Detailed;
+import com.ruoyi.finance.service.ITFeeService;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.warehouseBusiness.domain.enums.FeesTypeEnum;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 财务发票数据主Controller
+ *
+ * @author ruoyi
+ * @date 2021-01-18
+ */
+@RestController
+@RequestMapping("/finance/invoice")
+public class TInvoiceController extends BaseController {
+    @Autowired
+    private ITFeeService tFeeService;
+
+    /**
+     * 查询财务数据主列表
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:list')")
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/list")
+    public TableDataInfo list(TFee tFee) {
+        if (StringUtils.isEmpty(tFee.getfBilltype())) {
+            tFee.setfBilltype(FeesTypeEnum.INVOICE.getType());
+        }
+        startPage();
+        List<TFee> list = tFeeService.selectTFeeList(tFee);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出财务数据主列表
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:export')")
+    @Log(title = "财务数据主", businessType = BusinessType.EXPORT)
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/export")
+    public AjaxResult export(TFee tFee) throws Exception {
+        if (StringUtils.isEmpty(tFee.getfBilltype())) {
+            tFee.setfBilltype(FeesTypeEnum.INVOICE.getType());
+        }
+        List<Charge> list = tFeeService.chargeExport(tFee);
+        ExcelUtil<Charge> util = new ExcelUtil<Charge>(Charge.class);
+        return util.exportExcel(list, FeesTypeEnum.INVOICE.getName());
+    }
+
+    /**
+     * 获取财务数据主详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:query')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId) {
+        return AjaxResult.success(tFeeService.selectTFeeById(fId));
+    }
+
+    /**
+     * 新增财务数据主  
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/add")
+    @RepeatSubmit
+    public AjaxResult add(@RequestParam("tFee") String tFee,
+                          @RequestParam("tFeeDo") String tFeeDo) {
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.insertTFeeTFeeDo(tFee, tFeeDo, loginUser, FeesTypeEnum.INVOICE.getType());
+    }
+
+    /**
+     * 删除财务数据主
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:remove')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long[] fIds) {
+        return toAjax(tFeeService.deleteTFeeByIds(fIds));
+    }
+
+    @PreAuthorize("@ss.hasPermi('finance:charge:remove')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/queryRemove/{fId}")
+    public AjaxResult queryRemove(@PathVariable("fId") Long fId) {
+        return tFeeService.queryRemove(fId);
+    }
+
+    /**
+     * 发票查询
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:list')")
+    @GetMapping("/invoiceList")
+    public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
+        startPage();
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees, FeesTypeEnum.INVOICE.getType());
+        return getDataTable(list);
+    }
+
+    /**
+     * 确认收费
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/confirm")
+    @RepeatSubmit
+    public AjaxResult confirm(@RequestParam("tFee") String tFee,
+                              @RequestParam("tFeeDo") String tFeeDo) {
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.confirm(tFee, tFeeDo, loginUser, FeesTypeEnum.INVOICE.getType());
+    }
+
+
+    /**
+     * 撤销收费
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/revoke")
+    @RepeatSubmit
+    public AjaxResult revoke(@RequestParam("tFee") String tFee,
+                             @RequestParam("tFeeDo") String tFeeDo) {
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.revoke(tFee, tFeeDo, loginUser, FeesTypeEnum.INVOICE_REVOKE.getType());
+    }
+
+    /**
+     * 导出入库详情主表列表
+     */
+    @GetMapping("/exportItems/{fId}")
+    public AjaxResult exportItems(@PathVariable("fId") Long fId) {
+        List<Detailed> list = tFeeService.selectDetailedList(fId);
+        String exportName = tFeeService.findCtrlcorpid(fId);
+        ExcelUtil<Detailed> util = new ExcelUtil<Detailed>(Detailed.class);
+        return util.exportExcel(list, exportName);
+    }
+
+}

+ 32 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/PayableController.java

@@ -8,8 +8,13 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
+import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.service.ITFeeService;
 import com.ruoyi.reportManagement.excel.Payable;
+import org.aspectj.weaver.loadtime.Aj;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -41,11 +46,21 @@ public class PayableController extends BaseController {
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         startPage();
         tWareHouseFees.setfDc("C");
-        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
+        List<FeeVO> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
         return getDataTable(list);
     }
 
     /**
+     * 根据结算单位、费用状态、审核日期查询应付总帐明细
+     */
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/generalLedgerList")
+    public AjaxResult financialLedgerDetails(FeeDTO feeDTO) {
+        feeDTO.setFDc("C");
+        return tFeeService.financialLedgerDetails(feeDTO);
+    }
+
+    /**
      * 应付总账列表
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:payable:export')")
@@ -54,9 +69,23 @@ public class PayableController extends BaseController {
     @GetMapping("/export")
     public AjaxResult export(TWareHouseFees tWareHouseFees) throws Exception {
         tWareHouseFees.setfDc("C");
-        List<Payable> list = tFeeService.payableExport(tWareHouseFees);
-        ExcelUtil<Payable> util = new ExcelUtil<Payable>(Payable.class);
+        List<GeneralLedgerExcel> list = tFeeService.payableExport(tWareHouseFees);
+        ExcelUtil<GeneralLedgerExcel> util = new ExcelUtil<GeneralLedgerExcel>(GeneralLedgerExcel.class);
         return util.exportExcel(list, "应付总账");
     }
 
+    /**
+     * 应付总账列表
+     */
+    @PreAuthorize("@ss.hasPermi('warehouseBusiness:payable:export')")
+    @Log(title = "库存总账明细", businessType = BusinessType.EXPORT)
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/export/detail")
+    public AjaxResult exportDetail(FeeDTO feeDTO) throws Exception {
+        feeDTO.setFDc("C");
+        List<GeneralLedgerDetailExcel> list = tFeeService.financialLedgerDetailsExport(feeDTO);
+        ExcelUtil<GeneralLedgerDetailExcel> util = new ExcelUtil<GeneralLedgerDetailExcel>(GeneralLedgerDetailExcel.class);
+        return util.exportExcel(list, "应付总账明细");
+    }
+
 }

+ 33 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/ReceivableController.java

@@ -8,6 +8,10 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
+import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.service.ITFeeService;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Receivable;
@@ -42,11 +46,21 @@ public class ReceivableController extends BaseController {
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         startPage();
         tWareHouseFees.setfDc("D");
-        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
+        List<FeeVO> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
         return getDataTable(list);
     }
 
     /**
+     * 根据结算单位、费用状态、审核日期查询应付总帐明细
+     */
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/generalLedgerList")
+    public AjaxResult financialLedgerDetails(FeeDTO feeDTO) {
+        feeDTO.setFDc("D");
+        return tFeeService.financialLedgerDetails(feeDTO);
+    }
+
+    /**
      * 应收总账列表
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:receivable:export')")
@@ -55,12 +69,28 @@ public class ReceivableController extends BaseController {
     @GetMapping("/export")
     public AjaxResult export(TWareHouseFees tWareHouseFees) throws Exception {
         tWareHouseFees.setfDc("D");
-        List<Receivable> list = tFeeService.receivableExport(tWareHouseFees);
-        ExcelUtil<Receivable> util = new ExcelUtil<Receivable>(Receivable.class);
+        List<GeneralLedgerExcel> list = tFeeService.payableExport(tWareHouseFees);
+        ExcelUtil<GeneralLedgerExcel> util = new ExcelUtil<GeneralLedgerExcel>(GeneralLedgerExcel.class);
         return util.exportExcel(list, "应收总账");
     }
 
     /**
+     * 应收总账列表
+     */
+    @PreAuthorize("@ss.hasPermi('warehouseBusiness:payable:export')")
+    @Log(title = "库存总账明细", businessType = BusinessType.EXPORT)
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/export/detail")
+    public AjaxResult exportDetail(FeeDTO feeDTO) throws Exception {
+        feeDTO.setFDc("D");
+        List<GeneralLedgerDetailExcel> list = tFeeService.financialLedgerDetailsExport(feeDTO);
+        ExcelUtil<GeneralLedgerDetailExcel> util = new ExcelUtil<GeneralLedgerDetailExcel>(GeneralLedgerDetailExcel.class);
+        return util.exportExcel(list, "应付总账明细");
+    }
+
+
+
+    /**
      *  明细帐
      */
     @DataScope(deptAlias = "d", userAlias = "u")

+ 16 - 17
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWhgenlegController.java

@@ -50,11 +50,9 @@ public class TWhgenlegController extends BaseController {
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:whgenleg:list')")
     @DataScope(deptAlias = "d", userAlias = "u")
-    @GetMapping("/whgenlegList")
-    public TableDataInfo whgenlegList(TWhgenleg tWhgenleg) {
-        startPage();
-        List<Map<String, Object>> list = tWhgenlegService.selectInventoryMapList(tWhgenleg);
-        return getDataTable(list);
+    @GetMapping("/detailsList")
+    public AjaxResult detailsList(TWhgenleg tWhgenleg) {
+        return tWhgenlegService.selectWhgenlegDetailsList(tWhgenleg);
     }
 
     /**
@@ -172,7 +170,7 @@ public class TWhgenlegController extends BaseController {
     }
 
     /**
-     *  统计图  商品 库存 结余 毛重 / 总库容
+     * 统计图  商品 库存 结余 毛重 / 总库容
      */
     // @PreAuthorize("@ss.hasPermi('warehouseBusiness:whgenleg:list')")
     @GetMapping("/goodsList/{fId}")
@@ -181,19 +179,19 @@ public class TWhgenlegController extends BaseController {
     }
 
     /**
-     *  统计图  仓库 毛重 / 库容
+     * 统计图  仓库 毛重 / 库容
      */
     // @PreAuthorize("@ss.hasPermi('warehouseBusiness:whgenleg:list')")
     @GetMapping("/wareHouseList")
     public TableDataInfo wareHouseList() {
         startPage();
-       // List<Map<String, Object>> list = tWhgenlegService.selectWareHouseList();
+        // List<Map<String, Object>> list = tWhgenlegService.selectWareHouseList();
         List<Map<String, Object>> list = tWhgenlegService.selectWareHouseLists();
         return getDataTable(list);
     }
 
     /**
-     *  统计图  客户   毛重 / 库容
+     * 统计图  客户   毛重 / 库容
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:whgenleg:list')")
     @GetMapping("/corpsList/{fId}")
@@ -202,7 +200,7 @@ public class TWhgenlegController extends BaseController {
     }
 
     /**
-     *  当天 往前推一周  每日入库数量
+     * 当天 往前推一周  每日入库数量
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:whgenleg:list')")
     @GetMapping("/dateFQtyblcList")
@@ -213,7 +211,7 @@ public class TWhgenlegController extends BaseController {
     }
 
     /**
-     *  明细帐
+     * 明细帐
      */
     @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/detailed/list")
@@ -222,31 +220,34 @@ public class TWhgenlegController extends BaseController {
         List<Map<String, Object>> list = tWhgenlegService.selectdetailedList(tWarehousebill);
         return getDataTable(list);
     }
+
     /**
-     *  根据客户id或者提单号查询库存不为0的仓库
+     * 根据客户id或者提单号查询库存不为0的仓库
      */
     //@PreAuthorize("@ss.hasPermi('warehouseBusiness:whgenleg:list')")
     @GetMapping("/getWarehouse")
     public AjaxResult getWarehouse(TWhgenleg tWhgenleg) {
-        if (tWhgenleg.getfCorpid() == null){
+        if (tWhgenleg.getfCorpid() == null) {
             return AjaxResult.error("请选择客户后再选择仓库");
         }
-        if (StringUtils.isNull(tWhgenleg.getfMblno())){
+        if (StringUtils.isNull(tWhgenleg.getfMblno())) {
             return AjaxResult.error("请输入提单号后再选择仓库");
         }
         List<Map<String, Object>> list = tWhgenlegService.getWarehouse(tWhgenleg);
         return AjaxResult.success(list);
     }
+
     /**
      * 网站查询库存总账列表
      */
     @DataScope(deptAlias = "d", userAlias = "u")
-    @GetMapping("/websiteWhGenLegList")
+    @GetMapping("/whgenlegList")
     public TableDataInfo websiteWhGenLegList(TWhgenleg tWhgenleg) {
         startPage();
         List<Map<String, Object>> list = tWhgenlegService.selectInventoryMapList(tWhgenleg);
         return getDataTable(list);
     }
+
     /**
      * app查询库存总账列表
      */
@@ -258,6 +259,4 @@ public class TWhgenlegController extends BaseController {
         return getDataTable(list);
     }
 
-
-
 }

+ 10 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TWareHouseFees.java

@@ -133,6 +133,16 @@ public class TWareHouseFees extends BaseEntity {
     @TableField(exist = false)
     private Long stlTypeid;
 
+    /**
+     *  是否已审核
+     */
+    @TableField(exist = false)
+    private Long isReviewed;
+
+    public void setIsReviewed(Long isReviewed) {
+        this.isReviewed = isReviewed;
+    }
+
     public Long getfSalesmanId() {
         return fSalesmanId;
     }

+ 41 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/dto/FeeDTO.java

@@ -0,0 +1,41 @@
+package com.ruoyi.finance.domain.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author caifc
+ * @date 2021-11-23 14:19
+ */
+@Data
+public class FeeDTO {
+    private static final long serialVersionUID = 1L;
+
+    // 费用id
+    private Long feesId;
+
+    // 收费、付费
+    private String fDc;
+
+    // 提单号
+    private String fMblNo;
+
+    // 业务类型
+    private String fBillType;
+
+    // 结算单位
+    private Long fCorpId;
+
+    // 费用状态
+    private Long fBillstatus;
+
+    /**
+     * 是否已审核
+     */
+    private Long isReviewed;
+
+    // 审核时间集合
+    private List<String> fAuditList;
+
+}

+ 43 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/excel/GeneralLedgerDetailExcel.java

@@ -0,0 +1,43 @@
+package com.ruoyi.finance.domain.excel;
+
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class GeneralLedgerDetailExcel implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Excel(name = "结算单位")
+    private String fFeesName;
+
+    @Excel(name = "提单号")
+    private String fMblno;
+
+    @Excel(name = "货物名称")
+    private String fProductName;
+
+    @Excel(name = "品牌")
+    private String fMarks;
+
+    @Excel(name = "业务类型")
+    private String fBilltype;
+
+    @Excel(name = "仓储费")
+    private BigDecimal storageFee;
+
+    @Excel(name = "其他费用")
+    private BigDecimal otherFee;
+
+    @Excel(name = "应付金额")
+    private BigDecimal fAmount;
+
+    @Excel(name = "实付金额")
+    private BigDecimal fStlamount;
+
+    @Excel(name = "未付金额")
+    private BigDecimal nnfinished;
+
+}

+ 28 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/excel/GeneralLedgerExcel.java

@@ -0,0 +1,28 @@
+package com.ruoyi.finance.domain.excel;
+
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class GeneralLedgerExcel implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Excel(name = "结算单位")
+    private String fFeesName;
+
+    @Excel(name = "提单号")
+    private String fMblno;
+
+    @Excel(name = "应付金额")
+    private BigDecimal fAmount;
+
+    @Excel(name = "实付金额")
+    private BigDecimal fStlamount;
+
+    @Excel(name = "未付金额")
+    private BigDecimal nnfinished;
+
+}

+ 55 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/vo/FeeVO.java

@@ -0,0 +1,55 @@
+package com.ruoyi.finance.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.finance.domain.TFee;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author caifc
+ * @date 2021-11-23 13:48
+ */
+@Data
+public class FeeVO extends TFee {
+    private static final long serialVersionUID = 1L;
+
+
+    // 唛头
+    private String fMarks;
+
+    // 提单号
+    private String fMblno;
+
+    // 来源id
+    private Long fSrcpid;
+
+    // 审核时间
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date fReviewDate;
+
+    // 总金额
+    private BigDecimal fAmount;
+
+    // 结算单位名称
+    private String fFeesName;
+
+    // 费用名称
+    private String fProductName;
+
+    // 仓储费金额
+    private BigDecimal storageFee;
+
+    // 其他金额
+    private BigDecimal otherFee;
+
+    // 总结算金额
+    private BigDecimal fStlamount;
+
+    // 应结总金额
+    private BigDecimal nnfinished;
+
+}

+ 23 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeMapper.java

@@ -2,6 +2,8 @@ package com.ruoyi.finance.mapper;
 
 import com.ruoyi.finance.domain.TFee;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.excel.Detailed;
 import com.ruoyi.finance.shipping.FinancialTFee;
 import com.ruoyi.finance.shipping.HandleExcel;
@@ -109,6 +111,13 @@ public interface TFeeMapper {
 
     public List<Map<String, Object>> warehouseBillsFeesList1(TWareHouseFees tWareHouseFees);
 
+    /**
+     *  查询应收、应付总帐
+     * @param tWareHouseFees
+     * @return
+     */
+    List<FeeVO> selectFinancialLedgerList(TWareHouseFees tWareHouseFees);
+
     public List<Map<String, Object>> warehouseBillsFeesProfitList(TWareHouseFees tWareHouseFees);
 
     /**
@@ -151,6 +160,20 @@ public interface TFeeMapper {
     List<ExportFinancial> exportFinancial(@Param("id") Long id);
 
     /**
+     * 查询发票数据
+     * @param map
+     * @return
+     */
+    List<Map<String, Object>> queryApplyInvoiceFeesList(@Param("map") Map<String, Object> map);
+
+    /**
+     *  根据结算单位、费用状态、审核日期查询应付总帐明细
+     * @param feeDTO
+     * @return
+     */
+    List<FeeVO> selectFinancialLedgerDetails(FeeDTO feeDTO);
+
+    /**
      * 凯和查询应收应付总账
      * @param tWareHouseFees
      * @return

+ 75 - 27
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeService.java

@@ -4,13 +4,16 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.finance.domain.TFee;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
+import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.excel.Charge;
 import com.ruoyi.finance.excel.Contrast;
 import com.ruoyi.finance.excel.Detailed;
 import com.ruoyi.finance.excel.Payment;
 import com.ruoyi.finance.shipping.*;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
-import com.ruoyi.reportManagement.excel.Payable;
 import com.ruoyi.reportManagement.excel.Profit;
 import com.ruoyi.reportManagement.excel.Receivable;
 import com.ruoyi.shipping.domain.TAccount;
@@ -35,6 +38,7 @@ public interface ITFeeService {
      * @return 财务数据主
      */
     public Map<String, Object> selectTFeeById(Long fId);
+
     /**
      * 查询财务数据主
      *
@@ -52,26 +56,34 @@ public interface ITFeeService {
     public List<TFee> selectTFeeList(TFee tFee);
 
     public List<Map<String, Object>> selectTFeeList1(TFee tFee);
+
     /**
      * 凯和确认账单查询
+     *
      * @param tFee
      * @return
      */
     public List<Map<String, Object>> webVersionTFee(TFee tFee);
+
     /**
      * 网页版对账查询明细
+     *
      * @param tAccount
      * @return
      */
-    public List<Map<String,Object>> webVersionDetail(TAccount tAccount);
+    public List<Map<String, Object>> webVersionDetail(TAccount tAccount);
+
     /**
      * 网页版发票查询
+     *
      * @param tFee
      * @return
      */
     public List<Map<String, Object>> webVersionInvoice(TFee tFee);
+
     /**
      * 网页版发票查询明细
+     *
      * @param tFee
      * @return
      */
@@ -79,6 +91,7 @@ public interface ITFeeService {
 
     /**
      * 网页版查询数据
+     *
      * @param tAccount
      * @return
      */
@@ -94,31 +107,36 @@ public interface ITFeeService {
 
 
     /**
-     *  保存对账、收款
+     * 保存对账、收款
+     *
      * @param tfee
      * @param tfeeDo
      * @param loginUser
      * @param fBilltype
      * @return
      */
-    public AjaxResult insertTFeeTFeeDo(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
+    public AjaxResult insertTFeeTFeeDo(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype);
+
     /**
-     *  保存对账、收款
+     * 保存对账、收款
+     *
      * @param tfee
      * @param loginUser
      * @param fBilltype
      * @return
      */
-    public AjaxResult insertWebVersion(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
+    public AjaxResult insertWebVersion(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype);
+
     /**
-     *  保存对账、收款
+     * 保存对账、收款
+     *
      * @param tfee
      * @param tfeeDo
      * @param loginUser
      * @param fBilltype
      * @return
      */
-    public AjaxResult insertKHTFeeTFeeDo(String tfee, String tfeeDo,String tFeeInvoice,LoginUser loginUser,String fBilltype);
+    public AjaxResult insertKHTFeeTFeeDo(String tfee, String tfeeDo, String tFeeInvoice, LoginUser loginUser, String fBilltype);
 
     /**
      * 修改财务数据主
@@ -135,6 +153,7 @@ public interface ITFeeService {
      * @return 结果
      */
     public int deleteTFeeByIds(Long[] fIds);
+
     /**
      * 批量删除财务数据主
      *
@@ -152,35 +171,37 @@ public interface ITFeeService {
     public int deleteTFeeById(Long fId);
 
     /**
-     *   对账、收费、付费
+     * 对账、收费、付费
+     *
      * @param tWareHouseFees
      * @return
      */
-    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees,String billsType);
+    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees, String billsType);
 
-    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees);
+    public List<FeeVO> warehouseBillsFeesList(TWareHouseFees tWareHouseFees);
 
     public List<Map<String, Object>> warehouseBillsFeesProfitList(TWareHouseFees tWareHouseFees);
 
     /**
-     *  财务: 对账、收费、付费   流程确认
+     * 财务: 对账、收费、付费   流程确认
+     *
      * @param tfee
      * @param tfeeDo
      * @param loginUser
      * @param fBilltype
      * @return
      */
-    public AjaxResult confirm(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
+    public AjaxResult confirm(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype);
 
     /**
-     *
      * @param fIds
      * @return
      */
-    public AjaxResult webVersionConfirm(Long[] fIds,String billsType,LoginUser loginUser);
+    public AjaxResult webVersionConfirm(Long[] fIds, String billsType, LoginUser loginUser);
 
     /**
      * 凯和
+     *
      * @param tfee
      * @param tfeeDo
      * @param tFeeInvoice
@@ -188,26 +209,27 @@ public interface ITFeeService {
      * @param fBilltype
      * @return
      */
-    public AjaxResult confirmKaiHe(String tfee, String tfeeDo,String tFeeInvoice,LoginUser loginUser,String fBilltype);
+    public AjaxResult confirmKaiHe(String tfee, String tfeeDo, String tFeeInvoice, LoginUser loginUser, String fBilltype);
 
-    public AjaxResult revoke(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
+    public AjaxResult revoke(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype);
 
     public AjaxResult queryRemove(Long fId);
 
     public AjaxResult remove(Long fId);
 
     /**
-     *  导出计算明细
+     * 导出计算明细
+     *
      * @param fId
      * @return
      */
-    public List<TWareHouseExcelItem> selectTWarehousebillsItemsList(Long  fId);
+    public List<TWareHouseExcelItem> selectTWarehousebillsItemsList(Long fId);
 
-    public  String  findCtrlcorpid (Long  fId);
+    public String findCtrlcorpid(Long fId);
 
     public List<Receivable> receivableExport(TWareHouseFees tWareHouseFees) throws Exception;
 
-    public List<Payable> payableExport(TWareHouseFees tWareHouseFees) throws Exception;
+    public List<GeneralLedgerExcel> payableExport(TWareHouseFees tWareHouseFees) throws Exception;
 
     public List<Profit> profitExport(TWareHouseFees tWareHouseFees) throws Exception;
 
@@ -219,43 +241,52 @@ public interface ITFeeService {
 
     /**
      * 凯和网页版对账下载
+     *
      * @param tFee
      * @return
      * @throws Exception
      */
     public List<Account> accountExport(TFee tFee) throws Exception;
 
-    public List<Detailed> selectDetailedList(Long  fId);
+    public List<Detailed> selectDetailedList(Long fId);
 
     List<Map<String, Object>> selectdetailedList(TWarehousebill tWarehousebill);
 
     /**
      * 网页版申请发票审核
+     *
      * @param tFee
      * @return
      */
     public AjaxResult webVersionApplyFP(TFee tFee, LoginUser loginUser, String billType, TFeeInvoice tFeeInvoice);
+
     /**
      * 网页版申请发票提交
+     *
      * @param tFee
      * @return
      */
-    public AjaxResult webVersionSubmitApplyFP(TFee tFee,LoginUser loginUser,String billType);
+    public AjaxResult webVersionSubmitApplyFP(TFee tFee, LoginUser loginUser, String billType);
+
     /**
      * 网页版申请发票提交
+     *
      * @param tFee
      * @return
      */
-    public AjaxResult webVersionUpdateApplyFP(TFee tFee,LoginUser loginUser,String billType);
+    public AjaxResult webVersionUpdateApplyFP(TFee tFee, LoginUser loginUser, String billType);
 
     /**
      * 凯和查询财务信息列表
+     *
      * @param tFee
      * @return
      */
     public List<FinancialTFee> selectFinancialTFeeList(TFee tFee);
+
     /**
-     *   对账、收费、付费
+     * 对账、收费、付费
+     *
      * @param tWareHouseFees
      * @return
      */
@@ -263,17 +294,20 @@ public interface ITFeeService {
 
     /**
      * 凯和获取财务数据详情
+     *
      * @param fId
      * @return
      */
-    public Map<String, Object>  selectFinancialTFeeId(Long fId);
+    public Map<String, Object> selectFinancialTFeeId(Long fId);
+
     /**
      * 导出费用明细
      */
-    public List<FinancialTFeeDoExcel>  FinancialTFeeDoExcel(Long fId);
+    public List<FinancialTFeeDoExcel> FinancialTFeeDoExcel(Long fId);
 
     /**
      * 导出财务对账数据
+     *
      * @param fId
      * @return
      */
@@ -300,5 +334,19 @@ public interface ITFeeService {
      */
     public List<HandleExcel> handle(TWareHouseFees tWareHouseFees);
 
+    /**
+     * 根据结算单位、费用状态、审核日期查询应付总帐明细
+     *
+     * @param feeDTO
+     * @return
+     */
+    AjaxResult financialLedgerDetails(FeeDTO feeDTO);
 
+    /**
+     * 查询应付总帐明细
+     *
+     * @param feeDTO
+     * @return
+     */
+    List<GeneralLedgerDetailExcel> financialLedgerDetailsExport(FeeDTO feeDTO);
 }

+ 128 - 62
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -21,6 +21,10 @@ import com.ruoyi.common.utils.poi.ExcelUtils;
 import com.ruoyi.finance.domain.TFee;
 import com.ruoyi.finance.domain.TFeeDo;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
+import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.excel.Charge;
 import com.ruoyi.finance.excel.Contrast;
 import com.ruoyi.finance.excel.Detailed;
@@ -28,9 +32,9 @@ import com.ruoyi.finance.excel.Payment;
 import com.ruoyi.finance.mapper.TFeeDoMapper;
 import com.ruoyi.finance.mapper.TFeeMapper;
 import com.ruoyi.finance.service.ITFeeService;
-import com.ruoyi.finance.shipping.*;
+import com.ruoyi.finance.shipping.FinancialTFee;
+import com.ruoyi.finance.shipping.FinancialTFeeDoExcel;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
-import com.ruoyi.reportManagement.excel.Payable;
 import com.ruoyi.reportManagement.excel.Profit;
 import com.ruoyi.reportManagement.excel.Receivable;
 import com.ruoyi.shipping.domain.TAccount;
@@ -595,7 +599,7 @@ public class TFeeServiceImpl implements ITFeeService {
             if (tFee.getfAccountId() != null) {
                 TFee fee = tFeeMapper.selectTFeeById(tFee.getfAccountId());
                 fee.setfMake(0);
-                int updateTFee = tFeeMapper.updateTFee(fee);
+                tFeeMapper.updateTFee(fee);
             }
         }
         return tFeeMapper.deleteTFeeByIds(fIds);
@@ -616,7 +620,7 @@ public class TFeeServiceImpl implements ITFeeService {
     public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees, String billsType) {
         Map<String, Object> map = new HashMap<>();
         map.put("tWareHouseFees", tWareHouseFees);
-        List<Map<String, Object>> mapList = new ArrayList<>();
+        List<Map<String, Object>> mapList;
         if (billsType.equals("DZ") || billsType.equals("KHDZ")) {
             mapList = tFeeMapper.warehouseBillsFeesListAccamount(map);
             updateBillTypeName(mapList, tWareHouseFees.getfBilltype());
@@ -627,6 +631,10 @@ public class TFeeServiceImpl implements ITFeeService {
         } else if (billsType.equals("ApplyFP")) {
             mapList = tFeeMapper.warehouseApplyFPFeesList(map);
             return mapList;
+        } else if (FeesTypeEnum.INVOICE.getType().equals(billsType)) {
+            // 查询发票
+            mapList = tFeeMapper.queryApplyInvoiceFeesList(map);
+            return mapList;
         } else {
             mapList = tFeeMapper.warehouseBillsFeesList(map);
             updateBillTypeName(mapList, tWareHouseFees.getfBilltype());
@@ -676,10 +684,9 @@ public class TFeeServiceImpl implements ITFeeService {
         }
     }
 
-
     @Override
-    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees) {
-        return tFeeMapper.warehouseBillsFeesList1(tWareHouseFees);
+    public List<FeeVO> warehouseBillsFeesList(TWareHouseFees tWareHouseFees) {
+        return tFeeMapper.selectFinancialLedgerList(tWareHouseFees);
     }
 
     @Override
@@ -701,32 +708,34 @@ public class TFeeServiceImpl implements ITFeeService {
         boolean isApprove = false;
         Map<String, Object> messageMap = new HashMap<>();
         long actId = 0L;
-        if ("DZ".equals(fBilltype)) {
-            actId = 210L;
-            key = "warehouse.contrast.ApprovalFlow";
-        } else if ("SF".equals(fBilltype)) {
-            actId = 220L;
-            key = "warehouse.charge.ApprovalFlow";
-        } else if ("FF".equals(fBilltype)) {
-            actId = 230L;
-            key = "warehouse.payment.ApprovalFlow";
-        } else if ("KHDZ".equals(fBilltype)) {
-            actId = 430L;
-            key = "warehouse.kaiHeContrast.ApprovalFlow";
-        } else if ("KHSF".equals(fBilltype)) {
-            actId = 440L;
-            key = "warehouse.kaiHeCharge.ApprovalFlow";
-        } else if ("KHFF".equals(fBilltype)) {
-            actId = 450L;
-            key = "warehouse.kaiHePayment.ApprovalFlow";
-        }
-        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
-        if (StringUtils.isNull(sysConfig)) {
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            return AjaxResult.error("系统参数异常,未找到开启审批流参数");
-        }
-        if ("0".equals(sysConfig.getConfigValue())) {
-            isApprove = true;
+        if (!fBilltype.equals(FeesTypeEnum.INVOICE.getType())) {
+            if ("DZ".equals(fBilltype)) {
+                actId = 210L;
+                key = "warehouse.contrast.ApprovalFlow";
+            } else if ("SF".equals(fBilltype)) {
+                actId = 220L;
+                key = "warehouse.charge.ApprovalFlow";
+            } else if ("FF".equals(fBilltype)) {
+                actId = 230L;
+                key = "warehouse.payment.ApprovalFlow";
+            } else if ("KHDZ".equals(fBilltype)) {
+                actId = 430L;
+                key = "warehouse.kaiHeContrast.ApprovalFlow";
+            } else if ("KHSF".equals(fBilltype)) {
+                actId = 440L;
+                key = "warehouse.kaiHeCharge.ApprovalFlow";
+            } else if ("KHFF".equals(fBilltype)) {
+                actId = 450L;
+                key = "warehouse.kaiHePayment.ApprovalFlow";
+            }
+            SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
+            if (StringUtils.isNull(sysConfig)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("系统参数异常,未找到开启审批流参数");
+            }
+            if ("0".equals(sysConfig.getConfigValue())) {
+                isApprove = true;
+            }
         }
         TFee tFee = JSONArray.parseObject(tfee, TFee.class);
         String billstatus = "";
@@ -761,8 +770,7 @@ public class TFeeServiceImpl implements ITFeeService {
             List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
             for (TFeeDo tFeeDo : tFeeDoList) {
                 Map<String, Object> map = this.judgeMoney(tFeeDo.getfSrcid(), tFeeDo.getfAmt(), fBilltype, tFeeDo.getfFeeid());
-                boolean b = (Boolean) map.get("flag");
-                if (b == false) {
+                if (!(Boolean) map.get("flag")) {
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     return AjaxResult.error(map.get("message").toString());
                 }
@@ -1267,10 +1275,19 @@ public class TFeeServiceImpl implements ITFeeService {
     }
 
     @Override
-    public List<Payable> payableExport(TWareHouseFees tWareHouseFees) throws Exception {
-        List<Map<String, Object>> list = tFeeMapper.warehouseBillsFeesList1(tWareHouseFees);
-        List<Payable> list1 = ListMapToBeanUtils.castMapToBean(list, Payable.class);
-        return list1;
+    public List<GeneralLedgerExcel> payableExport(TWareHouseFees tWareHouseFees) throws Exception {
+        List<GeneralLedgerExcel> ledgerExcelList = new ArrayList<>();
+        List<FeeVO> feeVOList = tFeeMapper.selectFinancialLedgerList(tWareHouseFees);
+        feeVOList.forEach(vo -> {
+            GeneralLedgerExcel ledgerExcel = new GeneralLedgerExcel();
+            ledgerExcel.setFMblno(vo.getFMblno());
+            ledgerExcel.setFAmount(vo.getFAmount());
+            ledgerExcel.setFFeesName(vo.getFFeesName());
+            ledgerExcel.setNnfinished(vo.getNnfinished());
+            ledgerExcel.setFStlamount(vo.getFStlamount());
+            ledgerExcelList.add(ledgerExcel);
+        });
+        return ledgerExcelList;
     }
 
     @Override
@@ -1290,22 +1307,19 @@ public class TFeeServiceImpl implements ITFeeService {
     @Override
     public List<Payment> paymentExport(TFee tFee) throws Exception {
         List<Map<String, Object>> list = tFeeMapper.selectFeeList(tFee);
-        List<Payment> list1 = ListMapToBeanUtils.castMapToBean(list, Payment.class);
-        return list1;
+        return ListMapToBeanUtils.castMapToBean(list, Payment.class);
     }
 
     @Override
     public List<Charge> chargeExport(TFee tFee) throws Exception {
         List<Map<String, Object>> list = tFeeMapper.selectFeeList(tFee);
-        List<Charge> list1 = ListMapToBeanUtils.castMapToBean(list, Charge.class);
-        return list1;
+        return ListMapToBeanUtils.castMapToBean(list, Charge.class);
     }
 
     @Override
     public List<Account> accountExport(TFee tFee) throws Exception {
         List<Map<String, Object>> list = tFeeMapper.webVersionTFee(tFee);
-        List<Account> accountList = ListMapToBeanUtils.castMapToBean(list, Account.class);
-        return accountList;
+        return ListMapToBeanUtils.castMapToBean(list, Account.class);
     }
 
     @Override
@@ -1332,7 +1346,7 @@ public class TFeeServiceImpl implements ITFeeService {
                     sysDictData.setStatus("0");
                     sysDictDataListIn = iSysDictDataService.selectDictDataList(sysDictData);
                 }
-                if (null != sysDictDataListIn && sysDictDataListIn.size() > 0) {
+                if (CollectionUtils.isNotEmpty(sysDictDataListIn)) {
                     tWareHouseExcelItem.setfBusinessType(sysDictDataListIn.get(0).getDictLabel());
                 }
             }
@@ -1721,6 +1735,7 @@ public class TFeeServiceImpl implements ITFeeService {
 
     /**
      * 导出财务对账数据
+     *
      * @param fId
      * @return
      */
@@ -1736,23 +1751,23 @@ public class TFeeServiceImpl implements ITFeeService {
         //查询财务主数据
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
         TFee fee = tFeeMapper.selectTFeeById(fId);
-        if (fee != null){
+        if (fee != null) {
             corpName = fee.getfCtrlcorpid();
-            if (fee.getfFromDate() != null){
+            if (fee.getfFromDate() != null) {
                 fFromDate = simpleDateFormat.format(fee.getfFromDate());
             }
-            if (fee.getfToDate() != null){
+            if (fee.getfToDate() != null) {
                 fToDate = simpleDateFormat.format(fee.getfToDate());
             }
-            if (fee.getfVslid() != null){
+            if (fee.getfVslid() != null) {
                 TVessel vessel = tVesselMapper.selectTVesselById(fee.getfVslid());
-                if (vessel != null && StringUtils.isNotEmpty(vessel.getfName())){
+                if (vessel != null && StringUtils.isNotEmpty(vessel.getfName())) {
                     shipsName = vessel.getfName();
                 }
             }
-            if (fee.getfVoyid() != null){
+            if (fee.getfVoyid() != null) {
                 TVoyage tVoyage = tVoyageMapper.selectTVoyageById(fee.getfVoyid());
-                if (tVoyage != null && StringUtils.isNotEmpty(tVoyage.getfNo())){
+                if (tVoyage != null && StringUtils.isNotEmpty(tVoyage.getfNo())) {
                     voyage = tVoyage.getfNo();
                 }
             }
@@ -1850,20 +1865,20 @@ public class TFeeServiceImpl implements ITFeeService {
         c05.setCellValue("船名航次:");
         c05.setCellStyle(contentStyle);
         HSSFCell c051 = row3.createCell(1);
-        c051.setCellValue(shipsName+voyage);
+        c051.setCellValue(shipsName + voyage);
         c051.setCellStyle(contentStyle);
         HSSFCell c052 = row3.createCell(3);
         c052.setCellValue("离港日期:");
         c052.setCellStyle(contentStyle);
         String message = "";
         HSSFCell c053 = row3.createCell(5);
-        if (StringUtils.isNotEmpty(fFromDate)){
-            if (StringUtils.isNotEmpty(fFromDate)){
-                message = fFromDate+"-"+fToDate;
-            }else {
+        if (StringUtils.isNotEmpty(fFromDate)) {
+            if (StringUtils.isNotEmpty(fFromDate)) {
+                message = fFromDate + "-" + fToDate;
+            } else {
                 message = fFromDate;
             }
-        }else if (StringUtils.isNotEmpty(fToDate)){
+        } else if (StringUtils.isNotEmpty(fToDate)) {
             message = fToDate;
         }
         c053.setCellValue(message);
@@ -1883,7 +1898,7 @@ public class TFeeServiceImpl implements ITFeeService {
         //第四行
         HSSFRow row5 = sheet.createRow(rowNum++);
         row5.setHeight((short) 500);
-        String[] row_third = {"序号", "提单号", "始发港", "目的港","运输条款", "货名", "箱量", "规格", "单价", "合计"};
+        String[] row_third = {"序号", "提单号", "始发港", "目的港", "运输条款", "货名", "箱量", "规格", "单价", "合计"};
         for (int i = 0; i < row_third.length; i++) {
             HSSFCell tempCell = row5.createCell(i);
             tempCell.setCellValue(row_third[i]);
@@ -1891,7 +1906,7 @@ public class TFeeServiceImpl implements ITFeeService {
         }
         //查询费用明细数据
         List<ExportFinancial> list = tFeeMapper.exportFinancial(fId);
-        if (CollectionUtils.isNotEmpty(list)){
+        if (CollectionUtils.isNotEmpty(list)) {
             for (int i = 0; i < list.size(); i++) {
                 HSSFRow tempRow = sheet.createRow(rowNum++);
                 tempRow.setHeight((short) 500);
@@ -1963,7 +1978,7 @@ public class TFeeServiceImpl implements ITFeeService {
         HSSFCell c07 = row7.createCell(0);
         c07.setCellValue(message7);
         c07.setCellStyle(endStyle);
-        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 9));//标题合并单元格操作,总列数为9
+        sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, 9));//标题合并单元格操作,总列数为9
         //导出excel
 
         String fileName = "客户对账单.xls";
@@ -1983,6 +1998,57 @@ public class TFeeServiceImpl implements ITFeeService {
         }
     }
 
+    /**
+     * 根据结算单位、费用状态、审核日期查询应付总帐明细
+     *
+     * @param feeDTO
+     * @return
+     */
+    @Override
+    public AjaxResult financialLedgerDetails(FeeDTO feeDTO) {
+        TFees ccf = tFeesMapper.seletFeesByCCF();
+        if (Objects.isNull(ccf)) {
+            throw new WarehouseException("未找到仓储费费用信息");
+        }
+        feeDTO.setFeesId(ccf.getfId());
+        List<FeeVO> feeVOList = tFeeMapper.selectFinancialLedgerDetails(feeDTO);
+        feeVOList.forEach(vo -> {
+            WarehouseTypeEnum storageType = WarehouseTypeEnum.fromTypeAndBusinessType(vo.getfBilltype(), "storageType");
+            vo.setfBilltype(storageType.getName());
+        });
+        return AjaxResult.success(feeVOList);
+    }
+
+    /**
+     * 查询应付总帐明细
+     *
+     * @param feeDTO
+     * @return
+     */
+    @Override
+    public List<GeneralLedgerDetailExcel> financialLedgerDetailsExport(FeeDTO feeDTO) {
+        List<GeneralLedgerDetailExcel> detailExcelList = new ArrayList<>();
+        List<FeeVO> feeVOList = tFeeMapper.selectFinancialLedgerDetails(feeDTO);
+        feeVOList.forEach(vo -> {
+            GeneralLedgerDetailExcel detailExcel = new GeneralLedgerDetailExcel();
+            WarehouseTypeEnum storageType = WarehouseTypeEnum.fromTypeAndBusinessType(vo.getfBilltype(), "storageType");
+            detailExcel.setFMblno(vo.getFMblno());
+            detailExcel.setFMarks(vo.getFMarks());
+            detailExcel.setFAmount(vo.getFAmount());
+            detailExcel.setOtherFee(vo.getOtherFee());
+            detailExcel.setFFeesName(vo.getFFeesName());
+            detailExcel.setNnfinished(vo.getNnfinished());
+            detailExcel.setFStlamount(vo.getFStlamount());
+            detailExcel.setStorageFee(vo.getStorageFee());
+            detailExcel.setFBilltype(storageType.getName());
+            detailExcel.setFProductName(vo.getFProductName());
+            detailExcel.setFProductName(vo.getFProductName());
+            detailExcelList.add(detailExcel);
+        });
+        return detailExcelList;
+    }
+
+
     @Override
     public List<ReceivableExcel> receivable(TWareHouseFees tWareHouseFees) {
         return tFeeMapper.receivable(tWareHouseFees);

+ 22 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/vo/WhgenlegVO.java

@@ -3,6 +3,8 @@ package com.ruoyi.reportManagement.domain.vo;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 /**
  * @author caifc
  * @date 2021-11-15 11:20
@@ -11,5 +13,25 @@ import lombok.Data;
 public class WhgenlegVO extends TWhgenleg {
     private static final long serialVersionUID = 1L;
 
+    // 客户名称
+    private String corpName;
+
+    // 货物属性
+    private String businessTypeName;
+
+    // 业务类型
+    private String billType;
+
+    // 贸易方式
+    private String trademodeName;
+
+    // 数量
+    private BigDecimal qty;
+
+    // 数量
+    private BigDecimal grossweight;
+
+    // 净重
+    private BigDecimal netweight;
 
 }

+ 8 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.reportManagement.mapper;
 
 
 import com.ruoyi.reportManagement.domain.TWhgenleg;
+import com.ruoyi.reportManagement.domain.vo.WhgenlegVO;
 import com.ruoyi.reportManagement.excel.Whgenleg;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.vo.CalculateStorageFeesInfoVO;
@@ -142,4 +143,11 @@ public interface TWhgenlegMapper {
      * @return
      */
     int queryChangedByFchargedate(@Param("ids") List<Long> ids, @Param("time")Date chargedate);
+
+    /**
+     *  库存总帐查询来源明细
+     * @param tWhgenleg
+     * @return
+     */
+    List<WhgenlegVO> selectWhgenlegDetailsList(TWhgenleg tWhgenleg);
 }

+ 25 - 7
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.reportManagement.service;
 
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.reportManagement.domain.SingleAnalysisExcel;
 import com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
@@ -82,13 +83,15 @@ public interface ITWhgenlegService {
     public int deleteTWhgenlegById(Long fAccyear);
 
     /**
-     *   商品 库存总量
+     * 商品 库存总量
+     *
      * @return
      */
     Map<String, Object> selectGoodsList(Long fId);
 
     /**
-     *  仓库 库存总量
+     * 仓库 库存总量
+     *
      * @return
      */
     List<Map<String, Object>> selectWareHouseList();
@@ -96,13 +99,15 @@ public interface ITWhgenlegService {
     List<Map<String, Object>> selectWareHouseLists();
 
     /**
-     *  客户 库存总量
+     * 客户 库存总量
+     *
      * @return
      */
     Map<String, Object> selectCorpsList(Long fId);
 
     /**
-     *  一周库存总量
+     * 一周库存总量
+     *
      * @return
      */
     List<Map<String, Object>> selectDateFQtyblcListList();
@@ -114,20 +119,24 @@ public interface ITWhgenlegService {
     List<Map<String, Object>> selectdetailedList(TWarehousebill tWarehousebill);
 
     /**
-     *  查询单票分析信息
+     * 查询单票分析信息
+     *
      * @param singleAnalysisExcel
      * @return
      */
     public List<SingleAnalysisExcel> selectSingleAnalysis(SingleAnalysisExcel singleAnalysisExcel);
 
     /**
-     *  查询单票分析费用信息
+     * 查询单票分析费用信息
+     *
      * @param singleAnalysisExcel
      * @return
      */
     public List<SingleAnalysisFeesExcel> selectSingleAnalysisFees(SingleAnalysisExcel singleAnalysisExcel);
+
     /**
      * 根据客户id或者提单号查询库存不为0的仓库
+     *
      * @param tWhgenleg
      * @return
      */
@@ -135,8 +144,17 @@ public interface ITWhgenlegService {
 
     /**
      * app查询库存总账
+     *
+     * @param tWhgenleg
+     * @return
+     */
+    public List<Map<String, Object>> appWhGenLegList(TWhgenleg tWhgenleg);
+
+    /**
+     * 查询库存总帐详细信息
+     *
      * @param tWhgenleg
      * @return
      */
-    public  List<Map<String, Object>> appWhGenLegList(TWhgenleg tWhgenleg);
+    AjaxResult selectWhgenlegDetailsList(TWhgenleg tWhgenleg);
 }

+ 46 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -5,26 +5,32 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.ruoyi.basicData.domain.TCustomerContact;
 import com.ruoyi.basicData.mapper.TCustomerContactMapper;
 import com.ruoyi.basicData.mapper.TWarehouseMapper;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.entity.TWarehouse;
+import com.ruoyi.common.exception.WarehouseException;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.DictUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.reportManagement.domain.SingleAnalysisExcel;
 import com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
+import com.ruoyi.reportManagement.domain.vo.WhgenlegVO;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Whgenleg;
 import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
 import com.ruoyi.reportManagement.service.ITWhgenlegService;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 库存总账Service业务层处理
@@ -102,6 +108,46 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
      * @return 库存总账集合
      */
     @Override
+    public AjaxResult selectWhgenlegDetailsList(TWhgenleg tWhgenleg) {
+        if (StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())) {
+            // 获取仓库信息
+            TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
+            if (tWarehouse.getfLocation() == 1) {
+                tWhgenleg.setfLocation(1L);
+            } else {
+                tWhgenleg.setfLocation(0L);
+            }
+        }
+        List<WhgenlegVO> whgenlegVOList = tWhgenlegMapper.selectWhgenlegDetailsList(tWhgenleg);
+        if (CollectionUtils.isNotEmpty(whgenlegVOList)) {
+            List<WhgenlegVO> legVoList = new ArrayList<>();
+            Map<Long, List<WhgenlegVO>> mapById = whgenlegVOList.stream().collect(Collectors.groupingBy(WhgenlegVO::getfId));
+            mapById.forEach((key, value) -> {
+                WhgenlegVO whgenlegVO = new WhgenlegVO();
+                WhgenlegVO vo = value.stream().findFirst().orElseThrow(() -> new WarehouseException("缺少明细信息"));
+                BeanUtils.copyProperties(vo, whgenlegVO);
+                // 赋值字典表
+                whgenlegVO.setTrademodeName(DictUtils.getDictLabel("data_trademodes", whgenlegVO.getfTrademodeid().toString()));
+                // 数量
+                whgenlegVO.setQty(value.stream().map(WhgenlegVO::getQty).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
+                // 净重
+                whgenlegVO.setNetweight(value.stream().map(WhgenlegVO::getNetweight).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
+                // 毛重
+                whgenlegVO.setGrossweight(value.stream().map(WhgenlegVO::getGrossweight).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
+                legVoList.add(whgenlegVO);
+            });
+            return AjaxResult.success(legVoList);
+        }
+        return AjaxResult.success(whgenlegVOList);
+    }
+
+    /**
+     * app查询列表
+     *
+     * @param tWhgenleg 库存总账
+     * @return 库存总账集合
+     */
+    @Override
     public List<Map<String, Object>> selectInventoryMapList(TWhgenleg tWhgenleg) {
         if (StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())) {
             // 获取仓库信息

+ 1 - 4
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/component/impl/QueryWhgenlegServiceImpl.java

@@ -65,10 +65,7 @@ public class QueryWhgenlegServiceImpl implements QueryWhgenlegService {
         if (WarehouseTypeEnum.HWTG.getType().equals(warehouseBills.getfBilltype())) {
             cargoClearance(whgenleg, warehouseBills, item, operate, FIRST);
         }
-
-        TWhgenleg tWhgenleg = tWhgenlegMapper.selectTWhgenleg(whgenleg);
-
-        return tWhgenleg;
+        return tWhgenlegMapper.selectTWhgenleg(whgenleg);
     }
 
     /**

+ 9 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/FeesTypeEnum.java

@@ -33,6 +33,15 @@ public enum FeesTypeEnum {
     BOOKING("2", "凯和订舱"),
     FEE_CHANGES("10", "费用变更"),
 
+    // 类型
+    CHARGE("SF", "收费"),
+    CHARGE_REVOKE("SFRevoke", "撤销收费"),
+    CONTRAST("DZ", "对账"),
+    CONTRAST_REVOKE("DZRevoke", "撤销对账"),
+    PAYMENT("FF", "付费"),
+    PAYMENT_REVOKE("FFRevoke", "撤销付费"),
+    INVOICE("FP", "发票"),
+    INVOICE_REVOKE("FPRevoke", "撤销发票"),
 
     ;
 

+ 1 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/WarehouseActIdEnum.java

@@ -34,6 +34,7 @@ public enum WarehouseActIdEnum {
     RECONCILIATION(210, "", "对账"),
     TOLL(220, "", "收费"),
     PAID(230, "", "付费"),
+    INVOICE(260, "", "发票"),
 
     //仓储计划活动号
     STORAGE_FEE(310, "", "仓储费"),

+ 56 - 44
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/WarehouseTypeEnum.java

@@ -18,98 +18,101 @@ public enum WarehouseTypeEnum {
     // 仓储业务类型
 
 
-    KCZZ("KCZZ", "库存总帐"),
+    KCZZ("KCZZ", "库存总帐", "storageType"),
 
-    SJRK("SJRK", "入库"),
+    SJRK("SJRK", "入库", "storageType"),
 
-    SJCK("SJCK", "出库"),
+    SJCK("SJCK", "出库", "storageType"),
 
-    HQZY("HQZY", "货转"),
+    HQZY("HQZY", "货转", "storageType"),
 
-    CKDB("CKDB", "调拨"),
+    CKDB("CKDB", "调拨", "storageType"),
 
-    HWTG("HWTG", "货物通关"),
+    HWTG("HWTG", "货物通关", "storageType"),
 
-    SJRK_REVOKE("SJRKRevoke", "撤销入库"),
+    JSCCF("JSCCF", "计算仓储费", "storageType"),
 
-    SJCK_REVOKE("SJCKRevoke", "撤销出库"),
+    SJRK_REVOKE("SJRKRevoke", "撤销入库", "storageType"),
 
-    CKDB_REVOKE("CKDBRevoke", "撤销调拨"),
+    SJCK_REVOKE("SJCKRevoke", "撤销出库", "storageType"),
 
-    HWTG_REVOKE("HWTGRevoke", "撤销通关"),
+    CKDB_REVOKE("CKDBRevoke", "撤销调拨", "storageType"),
 
-    HQZY_REVOKE("HQZYRevoke", "撤销货权转移"),
+    HWTG_REVOKE("HWTGRevoke", "撤销通关", "storageType"),
 
+    HQZY_REVOKE("HQZYRevoke", "撤销货权转移", "storageType"),
 
     //是否已计算仓储费
 
-    CALCULATE("T", "已计算"),
+    CALCULATE("T", "已计算", "storageFee"),
 
-    NOT_CALCULATE("F", "未计算"),
+    NOT_CALCULATE("F", "未计算", "storageFee"),
 
-    JSCCF("JSCCF", "计算仓储费"),
 
 
     // 状态
-    INIT("1", "新建"),
-    SAVE("2", "保存"),
-    DISMISS("3", "请核驳回"),
-    SUBMIT("4", "请核"),
-    UNDER_REVIEW("5", "请核中"),
-    APPROVE("6", "请核完成"),
+    INIT("1", "新建", "storageStatus"),
+    SAVE("2", "保存", "storageStatus"),
+    DISMISS("3", "请核驳回", "storageStatus"),
+    SUBMIT("4", "请核", "storageStatus"),
+    UNDER_REVIEW("5", "请核中", "storageStatus"),
+    APPROVE("6", "请核完成", "storageStatus"),
 
 
     // 仓库主表明细状态
-    DETAILED_STATUS_PLAN("1", "计划"),
-    DETAILED_STATUS_WAITING("2", "待xx"),
-    DETAILED_STATUS_PROCESSING("3", "xx中"),
-    DETAILED_STATUS_PROCESSED("4", "已xx"),
+    DETAILED_STATUS_PLAN("1", "计划", "itemStatus"),
+    DETAILED_STATUS_WAITING("2", "待xx", "itemStatus"),
+    DETAILED_STATUS_PROCESSING("3", "xx中", "itemStatus"),
+    DETAILED_STATUS_PROCESSED("4", "已xx", "itemStatus"),
 
 
     // 编号生成简写
 
-    SJRK_NO("RK", "入库"),
-    SJCK_NO("CK", "出库"),
-    CKDB_NO("DB", "调拨"),
-    HQZY_NO("HZ", "货转"),
+    SJRK_NO("RK", "入库", "warehouseAbbreviation"),
+    SJCK_NO("CK", "出库", "warehouseAbbreviation"),
+    CKDB_NO("DB", "调拨", "warehouseAbbreviation"),
+    HQZY_NO("HZ", "货转", "warehouseAbbreviation"),
 
-    FYBG_NO("FYBG", "费用变更"),
+    FYBG_NO("FYBG", "费用变更", "warehouseAbbreviation"),
 
 
     // 件数
-    BOX_NUM("1", "件"),
+    BOX_NUM("1", "件", "warehouseUnit"),
     // 毛重
-    GROSS_WEIGHT("2", "吨"),
+    GROSS_WEIGHT("2", "吨", "warehouseUnit"),
     // 净重
-    NET_WEIGHT("3", "吨"),
+    NET_WEIGHT("3", "吨", "warehouseUnit"),
     // 尺码
-    MEASURE("4", "吨"),
+    MEASURE("4", "吨", "warehouseUnit"),
     // 统一
-    FIXED("5", "吨"),
+    FIXED("5", "吨", "warehouseUnit"),
 
     // 是否计入库存总帐
-    INVENTORY("0", "计入库存总帐"),
-    NOT_INVENTORY("1", "计入库存总帐"),
+    INVENTORY("0", "计入库存总帐", "generalLedger"),
+    NOT_INVENTORY("1", "计入库存总帐", "generalLedger"),
 
     // 根据提单号、客户、仓库查询商品信息类型
-    BY_MBLNO("mblno", "根据提单号查询"),
-    BY_CPRP("corp", "根据客户查询"),
-    BY_WAREHOUSE("warehouse", "根据仓库查询"),
+    BY_MBLNO("mblno", "根据提单号查询", "queryType"),
+    BY_CPRP("corp", "根据客户查询", "queryType"),
+    BY_WAREHOUSE("warehouse", "根据仓库查询", "queryType"),
 
 
     // 查询库存帐操作
-    CONFIRM_OPERATION("0", "确认入库、出库、货转、调拨"),
-    UNDO_OPERATION("1", "撤回入库、出库、货转、调拨"),
+    CONFIRM_OPERATION("0", "确认入库、出库、货转、调拨", "queryType"),
+    UNDO_OPERATION("1", "撤回入库、出库、货转、调拨", "queryType"),
 
     // 是否判断箱型
-    JUDGE_BOX("1", "判断箱型"),
-    NOT_JUDGE_BOX("0", "非判断箱型"),
+    JUDGE_BOX("1", "判断箱型", "judge"),
+    NOT_JUDGE_BOX("0", "非判断箱型", "judge"),
 
 
     ;
-
+    // 值
     private final String type;
+    // 名称
     private final String name;
+    // 业务
+    private final String businessType;
 
     public static WarehouseTypeEnum fromType(String tp) {
         for (WarehouseTypeEnum type : WarehouseTypeEnum.values()) {
@@ -120,6 +123,15 @@ public enum WarehouseTypeEnum {
         throw new IllegalArgumentException("warehouse type not exist");
     }
 
+    public static WarehouseTypeEnum fromTypeAndBusinessType(String tp, String businessTyoe) {
+        for (WarehouseTypeEnum type : WarehouseTypeEnum.values()) {
+            if (Objects.equals(type.getType(), tp) && businessTyoe.equals(type.getBusinessType())) {
+                return type;
+            }
+        }
+        throw new IllegalArgumentException("warehouse type not exist");
+    }
+
     // 获取业务类型集合
     public static List<String> getWarehousingType() {
         List<String> typList = new ArrayList<>();

+ 6 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java

@@ -279,4 +279,10 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
      */
     List<WarehouseBillsVO> selectWhgenlegDetailById(Long id);
 
+    /**
+     *  计算仓储费列表
+     * @param tWarehousebills
+     * @return
+     */
+    List<Map<String, Object>> selecStorageFeeList(TWarehouseBills tWarehousebills);
 }

+ 11 - 5
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java

@@ -515,10 +515,12 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
                 null == storageFeesDto.getCangKey()) {
             throw new WarehouseException("缺少查询计费规则条件");
         }
+        // 查询计费规则
         List<TWarehouseAgreementitems> itemList =
                 this.tWarehouseAgreementitemsMapper.getItemsBytWarehouseAgreementMsg(storageFeesDto.getfCorpid(),
                         storageFeesDto.getfGoodsid(),
                         String.valueOf(storageFeesDto.getWarehouseId()), storageFeesDto.getCangKey());
+        // 如果未找到计费规则 则抛出异常
         if (CollUtil.isEmpty(itemList)) {
             throw new WarehouseException("编号" + storageFeesDto.getfMblno() + "未找到计费规则");
         }
@@ -527,7 +529,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
         if (count > 1) {
             throw new WarehouseException("计费规则存在多条,请确认");
         }
-        // 获取要计算的数量
+        // 根据规则的计费单位去获取要计算的数量
         TWarehouseAgreementitems agreementitems = itemList.stream().findFirst()
                 .orElseThrow(() -> new WarehouseException("计费规则不存在"));
         BigDecimal qty = acquiredQuantity(storageFeesDto, agreementitems.getfFeeunitid());
@@ -542,25 +544,28 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
         // 计费区间  月日-月日X钱
         String billingInterval = "";
         for (TWarehouseAgreementitems tWarehouseAgreementitems : itemList) {
+            // 如果要计费天数不足一天,不予计算
             if (storageFeesDto.getDays() < 1) {
                 break;
             }
-            // 计算仓储日期
-            dayLength = tWarehouseAgreementitems.getfEndays() - tWarehouseAgreementitems.getfFromdays() + 1L; //阶梯中的结束-开始日期
+            dayLength = tWarehouseAgreementitems.getfEndays() - tWarehouseAgreementitems.getfFromdays() + 1L;
+            // 如果已计费天数超出本阶层,则进入下一层规则,并剪掉当前层天数
             if (storageFeesDto.getEarlySumDays() >= dayLength) {
                 storageFeesDto.setEarlySumDays(storageFeesDto.getEarlySumDays() - dayLength);
                 continue; //将已算账的天数 与 计费规则的 最后一天作比较如果 已算10天 > 规则结束  不算帐
             }
-
+            // 如果计费日期超过本层天数
             if (storageFeesDto.getDays() >= dayLength) {
+                // 天数剪掉 剩余已计费库存天数
                 dayLength -= storageFeesDto.getEarlySumDays();
                 storageFeesDto.setEarlySumDays(0L);
                 feeId = tWarehouseAgreementitems.getfFeeid();
+                // 获取最终金额:数量 * 单价 * 天数
                 BigDecimal calculate = this.getCalculate(qty, tWarehouseAgreementitems.getfPrice(), dayLength);
                 money = money.add(calculate);
 
                 storageFeesDto.setDays(storageFeesDto.getDays() - dayLength);
-                // 计算费用明细
+                // 组装运费明细记录
                 String details = assemblyBillingDetails(StorageFeeRangeDTO.builder()
                         .dayNum(dayLength).price(tWarehouseAgreementitems.getfPrice()).qty(qty).amt(calculate)
                         .build());
@@ -574,6 +579,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 
                 storageFeesDto.setStartTime(DateUtils.dateAdd(storageFeesDto.getStartTime(), dayLength.intValue()));
             } else {
+                // 最后一次计算天数
                 feeId = tWarehouseAgreementitems.getfFeeid();
                 BigDecimal calculate = this.getCalculate(qty, tWarehouseAgreementitems.getfPrice(), storageFeesDto.getDays());
                 money = money.add(calculate);

+ 21 - 5
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -417,7 +417,15 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      */
     @Override
     public List<Map<String, Object>> selectWarehouseBusinessList(TWarehouseBills tWarehousebills) {
-        if (tWarehousebills.getfBilltype().equals(WarehouseTypeEnum.JSCCF.getType()) || tWarehousebills.getfBilltype().equals(WarehouseTypeEnum.HQZY.getType())) {
+        if (tWarehousebills.getfBilltype().equals(WarehouseTypeEnum.JSCCF.getType())) {
+            List<Map<String, Object>> mapList = tWarehouseBillsMapper.selecStorageFeeList(tWarehousebills);
+            if (CollectionUtils.isNotEmpty(mapList)) {
+                mapList.forEach(li -> {
+                    li.put("fBillstatus", WarehouseTypeEnum.fromTypeAndBusinessType(li.get("fBillstatus").toString(), "storageStatus").getName());
+                });
+            }
+            return mapList;
+        } else if (tWarehousebills.getfBilltype().equals(WarehouseTypeEnum.HQZY.getType())) {
             return tWarehouseBillsMapper.selectWarehouseBusinessList1(tWarehousebills);
         } else {
             return tWarehouseBillsMapper.selectWarehouseBusinessList(tWarehousebills);
@@ -3958,9 +3966,11 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 
         BigDecimal sumAmt = BigDecimal.ZERO;
         List<TWarehousebillsfees> itemsList = new ArrayList<>();
+        // 获取税率
         List<SysDictData> taxRate = sysDictDataMapper.selectDictDataByType("tax_rate");
 
         for (CalculateStorageFeesInfoVO item : feesInfoVOList) {
+            // 交以计算明细计费方式必填
             if (StringUtils.isNull(item.getFBillingway())) {
                 throw new WarehouseException("单号:" + item.getFBillno() + ",业务日期:" + item.getFBsdate() + "未找到库存总账的计费单位,请确认");
             }
@@ -3968,7 +3978,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             storageFeesDto.setfCorpid(warehouseBills.getfCorpid());
             storageFeesDto.setCangKey(cangKey);
             storageFeesDto.setWarehouseId(Long.parseLong(String.valueOf(item.getWarehouse())));
-
+            // 把商品类型添加“”方便后续查询
             String goodsTypeids = item.getFTypeid();
             if (StringUtils.isNotEmpty(goodsTypeids)) {
                 goodsTypeids = "\"" + goodsTypeids + "\"";
@@ -3976,7 +3986,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             storageFeesDto.setfGoodsid(goodsTypeids);
 
             long fId = item.getFId();
-            // 累计计费天数
+            // 累计计费天数 如果计费日期与原始入库日期一直代表没有计算过
             if (Objects.equals(item.getFChargedate().getTime(), item.getFOriginalbilldate().getTime())) {
                 storageFeesDto.setEarlySumDays(0L);
             } else {
@@ -3987,20 +3997,26 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             // 要计费天数
             long fBillingDays;
             if (WarehouseTypeEnum.SJCK.getType().equals(item.getFBilltype())) {
+                // 出库在库天数:业务日期-计费日期
+                // 出库计费天数:出库在库天数
                 fInventoryDays = DateUtils.getDateDay(item.getFBsdate(), item.getFChargedate());
                 fBillingDays = fInventoryDays;
                 storageFeesDto.setStartTime(item.getFOriginalbilldate());
                 storageFeesDto.setEndTime(item.getFBsdate());
             } else if (WarehouseTypeEnum.HQZY.getType().equals(item.getFBilltype())) {
+                // 货转在库天数:业务日期-计费日期
+                // 货转计费天数:出库在库天数
                 fInventoryDays = DateUtils.getDateDay(item.getFBsdate(), item.getFChargedate());
                 fBillingDays = fInventoryDays;
                 storageFeesDto.setStartTime(item.getFBsdate());
                 storageFeesDto.setEndTime(item.getFOriginalbilldate());
             } else {
-                storageFeesDto.setStartTime(item.getFChargedate());
-                storageFeesDto.setEndTime(warehouseBills.getfBillingDeadline());
+                // 库存总帐在库天数:计费截止日期-原始入库日期
+                // 库存总帐计费天数:计费截止日期-计费日期
                 fInventoryDays = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), item.getFOriginalbilldate());
                 fBillingDays = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), item.getFChargedate());
+                storageFeesDto.setStartTime(item.getFChargedate());
+                storageFeesDto.setEndTime(warehouseBills.getfBillingDeadline());
             }
             if (fBillingDays <= 0) {
                 continue;

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

@@ -49,6 +49,62 @@
         <result property="invoiceRemarks" column="invoice_remarks"/>
     </resultMap>
 
+    <resultMap type="FeeVO" id="feeVOResult">
+        <result property="fId" column="f_id"/>
+        <result property="fBillno" column="f_billno"/>
+        <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
+        <result property="fActId" column="f_act_id"/>
+        <result property="fCorpid" column="f_corpid"/>
+        <result property="tMblno" column="t_mblno"/>
+        <result property="fTransActId" column="f_trans_act_id"/>
+        <result property="fAmtdr" column="f_amtdr"/>
+        <result property="fAmtcr" column="f_amtcr"/>
+        <result property="fBilltype" column="f_billtype"/>
+        <result property="fBillstatus" column="f_billstatus"/>
+        <result property="fRemarks" column="f_remarks"/>
+        <result property="fFromDate" column="f_from_date"/>
+        <result property="fToDate" column="f_to_date"/>
+        <result property="fAccbilldate" column="f_accbilldate"/>
+        <result property="fRefNo" column="f_ref_no"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="fDeptid" column="f_deptid"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="chargingMethod" column="charging_method"/>
+        <result property="invoiceNo" column="invoice_no"/>
+        <result property="bank" column="bank"/>
+        <result property="waterBillNo" column="water_bill_no"/>
+        <result property="fSystemType" column="f_system_type"/>
+        <result property="fTrackingNumber" column="f_tracking_number"/>
+        <result property="fInvoiceRise" column="f_invoice_rise"/>
+        <result property="fSign" column="f_sign"/>
+        <result property="fSendTime" column="f_send_Time"/>
+        <result property="fApplyMoney" column="f_apply_money"/>
+        <result property="fAccountId" column="f_account_id"/>
+        <result property="fMake" column="f_make"/>
+        <result property="fVslid" column="f_vslid"/>
+        <result property="fVoyid" column="f_voyid"/>
+        <result property="fLoadportid" column="f_loadportid"/>
+        <result property="fDestportid" column="f_destportid"/>
+        <result property="fDc" column="f_dc"/>
+        <result property="fBankNumber" column="f_bank_number"/>
+        <result property="fReconciliation" column="f_reconciliation"/>
+        <result property="invoiceRemarks" column="invoice_remarks"/>
+        <result property="invoiceRemarks" column="invoice_remarks"/>
+        <result property="fFeesName" column="f_fees_name"/>
+        <result property="fAmount" column="f_amount"/>
+        <result property="fStlamount" column="f_stlamount"/>
+        <result property="storageFee" column="storage_fee"/>
+        <result property="otherFee" column="other_fee"/>
+        <result property="fSrcpid" column="f_srcpid"/>
+        <result property="fMblno" column="f_mblno"/>
+        <result property="fMarks" column="f_marks"/>
+        <result property="fProductName" column="f_product_name"/>
+        <result property="fReviewDate" column="f_review_date"/>
+    </resultMap>
+
     <sql id="selectTFeeVo">
         select f_id,
                f_billno,
@@ -1862,33 +1918,33 @@
     </select>
     <select id="selectFeeList" resultType="java.util.Map">
         select
-        ware.create_by AS createBy,
-        ware.f_billno AS fBillno,
-        ware.f_ctrlcorpid AS fCtrlcorpid,
-        ware.create_time AS createTime,
-        ware.f_accbilldate AS fAccbilldate,
-        ware.t_mblno AS tMblno,
-        dict.dict_label AS chargingMethod,
-        ware.invoice_no AS invoiceNo,
-        ware.bank AS bank,
-        ware.water_bill_no AS waterBillNo,
-        ware.f_amtdr AS fAmtdr,
-        ware.f_amtcr AS fAmtcr,
-        ware.f_remarks AS fRemarks,
-        CASE
-        WHEN ware.f_billstatus = '1' THEN '新建'
-        WHEN ware.f_billstatus = '2' THEN '暂存'
-        WHEN ware.f_billstatus = '3' THEN '审批驳回'
-        WHEN ware.f_billstatus = '4' THEN '提交审核'
-        WHEN ware.f_billstatus = '5' THEN '审核中'
-        WHEN ware.f_billstatus = '6' THEN '审核完成'
-        END
-        AS fBillstatus
+            ware.create_by AS createBy,
+            ware.f_billno AS fBillno,
+            ware.f_ctrlcorpid AS fCtrlcorpid,
+            ware.create_time AS createTime,
+            ware.f_accbilldate AS fAccbilldate,
+            ware.t_mblno AS tMblno,
+            dict.dict_label AS chargingMethod,
+            ware.invoice_no AS invoiceNo,
+            ware.bank AS bank,
+            ware.water_bill_no AS waterBillNo,
+            ware.f_amtdr AS fAmtdr,
+            ware.f_amtcr AS fAmtcr,
+            ware.f_remarks AS fRemarks,
+            CASE
+            WHEN ware.f_billstatus = '1' THEN '新建'
+            WHEN ware.f_billstatus = '2' THEN '暂存'
+            WHEN ware.f_billstatus = '3' THEN '审批驳回'
+            WHEN ware.f_billstatus = '4' THEN '提交审核'
+            WHEN ware.f_billstatus = '5' THEN '审核中'
+            WHEN ware.f_billstatus = '6' THEN '审核完成'
+            END
+            AS fBillstatus
         from
-        t_fee ware
-        left join sys_user u on ware.create_by = u.user_name
-        left join sys_dept d on ware.f_deptid = d.dept_id
-        LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
+            t_fee ware
+            left join sys_user u on ware.create_by = u.user_name
+            left join sys_dept d on ware.f_deptid = d.dept_id
+            LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
         <where>
             dict.status = '0'
             AND dict.dict_type = 'data_settlement_type'
@@ -2487,4 +2543,216 @@
         </where>
     </select>
 
+    <select id="queryApplyInvoiceFeesList" resultType="java.util.Map">
+        SELECT
+            w.f_id AS fSrcid,
+            t.f_id AS fSrcpid,
+            t.f_corpid AS fCorpid,
+            c.f_name AS fName,
+            c.f_name AS fFeesName,
+            t.f_bscorpno AS fBscorpno,
+            w.f_mblno AS fMblno,
+            w.f_product_name AS fProductName,
+            w.f_bsdate AS fBsdate,
+            t.f_billtype AS fBilltype,
+            t.f_review_date AS fReviewDate,
+            w.f_marks AS fMarks,
+            w.f_feeid AS fFeeid,
+            w.f_billtype AS fBilltype,
+            w.f_chargedate AS fChargedate,
+            w.f_originalbilldate AS fOriginalbilldate,
+            w.f_billing_deadline AS fBillingDeadline,
+            w.f_billing_days AS fBillingDays,
+            w.f_inventory_days AS fInventoryDays,
+            f.f_name AS fFeeName,
+            w.f_dc AS fSrcdc,
+            CASE
+            WHEN w.f_dc = 'D' THEN
+            '收'
+            WHEN w.f_dc = 'C' THEN
+            '付'
+            END AS fSrcdcName,
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
+            dict.dict_label AS fFeeunitid,
+            w.f_qty AS fQty,
+            w.f_unitprice AS fUnitprice,
+            w.f_business_type AS fBusinessType
+        FROM
+            t_warehousebillsfees w
+            LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
+            LEFT JOIN t_corps c ON c.f_id = w.f_corpid
+            LEFT JOIN t_fees f ON w.f_feeid = f.f_id
+            LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
+        <where>
+            dict.status = '0'
+            AND dict.dict_type = 'data_unitfees'
+            <if test="map.tWareHouseFees.stlTypeid != null">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
+            <if test="map.tWareHouseFees.fCorpid != null  and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
+                #{map.tWareHouseFees.fCorpid}
+            </if>
+            <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
+            <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
+            <if test="map.tWareHouseFees.fToCorpid != null  and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
+                #{map.tWareHouseFees.fToCorpid}
+            </if>
+            <if test="map.tWareHouseFees.fMblno != null  and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
+                concat('%', #{map.tWareHouseFees.fMblno}, '%')
+            </if>
+            <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
+                w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
+            </if>
+
+            <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
+                and w.f_accamount_date IS NOT NULL
+            </if>
+            <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
+                and w.f_accamount_date IS NULL
+            </if>
+
+            <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
+                and w.f_dc = #{map.tWareHouseFees.fDc}
+            </if>
+            <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
+                and w.f_dc = #{map.tWareHouseFees.fDc}
+            </if>
+            <if test="map.tWareHouseFees.fFeeid != null  and  map.tWareHouseFees.fFeeid != '' ">
+                and w.f_feeid in
+                <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
+                         separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
+                and w.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
+            </if>
+            <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
+                and w.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
+            </if>
+            <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
+                and w.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
+            </if>
+            <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
+                and w.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
+            </if>
+            <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
+                and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
+            </if>
+            <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
+                and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
+            </if>
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype == 'SJRK'">
+                and w.f_billtype = #{map.tWareHouseFees.fBilltype}
+            </if>
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype == 'SJCK'">
+                and w.f_billtype = #{map.tWareHouseFees.fBilltype}
+            </if>
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype == 'HQZY'">
+                and w.f_billtype = #{map.tWareHouseFees.fBilltype}
+            </if>
+
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype == 'KHDD'">
+                and w.f_billtype = #{map.tWareHouseFees.fBilltype}
+            </if>
+            <if test="map.tWareHouseFees.fBusinessType != null  and map.tWareHouseFees.fBusinessType != '' ">
+                and w.f_business_type in
+                <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="map.tWareHouseFees.fSrcidList != null  and  map.tWareHouseFees.fSrcidList != '' ">
+                and w.f_id in
+                <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
+                         separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="map.tWareHouseFees.fSrcpidList != null  and  map.tWareHouseFees.fSrcpidList != '' ">
+                and t.f_id in
+                <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
+                         separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
+            </if>
+            <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
+                and w.create_by = #{map.tWareHouseFees.createBy}
+            </if>
+            and w.f_review_date IS NOT NULL
+            and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_invamount, 0)) &gt; 0
+            GROUP BY w.f_id
+        </where>
+    </select>
+
+    <select id="selectFinancialLedgerList" resultMap="feeVOResult">
+        SELECT
+            c.f_name AS f_fees_name, w.f_corpid, w.f_mblno, w.f_billstatus, w.f_review_date,
+            SUM( w.f_amount ) AS f_amount, SUM( w.f_stlamount ) AS f_stlamount,
+            ifnull( SUM( w.f_amount ), 0 ) - ifnull( SUM( w.f_stlamount ), 0 ) AS nnfinished
+        FROM
+            t_warehousebills t
+            LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
+            LEFT JOIN sys_user u ON t.create_by = u.user_name
+            LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
+            LEFT JOIN t_corps c ON c.f_id = w.f_corpid
+            LEFT JOIN t_fees f ON w.f_feeid = f.f_id
+        <where>
+            w.f_dc = #{fDc}
+            <if test="fCorpid != null  and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
+            <if test="fToCorpid != null  and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
+            <if test="fMblno != null  and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
+            <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
+            <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
+                #{fProductName}, '%')
+            </if>
+            <if test="isReviewed != null and isReviewed == 0">
+                and w.f_billstatus != 6
+            </if>
+            <if test="isReviewed != null and isReviewed == 1">
+                and w.f_billstatus = 6
+            </if>
+            <if test="fReconciliation!= null and fReconciliation != '' and fReconciliation == '0'">
+                and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
+            </if>
+            <if test="timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ''">
+                and w.f_review_date between #{timeExamine[0]} and #{timeExamine[1]}
+            </if>
+            ${params.dataScope}
+        </where>
+        GROUP BY
+            w.f_corpid,
+            w.f_dc
+    </select>
+
+    <select id="selectFinancialLedgerDetails" resultMap="feeVOResult">
+        SELECT t.f_id AS f_srcpid, c.f_name AS f_fees_name, w.f_mblno AS f_mblno,
+            w.f_product_name, w.f_marks, t.f_billtype,
+            w.f_review_date,
+            IF ( w.f_feeid = #{feesId}, w.f_amount, 0.00 ) storage_fee,
+            IF ( w.f_feeid != #{feesId}, w.f_amount, 0.00 ) other_fee,
+            w.f_amount, w.f_stlamount AS fStlamount,
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS nnfinished
+        FROM t_warehousebills t
+            LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
+            LEFT JOIN sys_user u ON t.create_by = u.user_name
+            LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
+            LEFT JOIN t_corps c ON c.f_id = w.f_corpid
+            LEFT JOIN t_fees f ON w.f_feeid = f.f_id
+        where
+            w.f_dc = #{fDc}
+            <if test="fCorpId != null and fCorpId != ''">and w.f_corpid = #{fCorpId}</if>
+            <if test='isReviewed != null and isReviewed == 0 '>
+                and w.f_billstatus != 6
+            </if>
+            <if test='isReviewed != null and isReviewed == 1 '>
+                and w.f_billstatus = 6
+            </if>
+            <if test='fAuditList != null and fAuditList[0] != null'>
+                and w.f_review_date BETWEEN #{fAuditList[0]} and #{fAuditList[1]}
+            </if>
+        GROUP BY
+        w.f_id
+    </select>
+
 </mapper>

+ 34 - 1
ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml

@@ -46,7 +46,7 @@
         <result property="fCustomno" column="f_customno"/>
     </resultMap>
 
-    <resultMap type="com.ruoyi.warehouseBusiness.domain.vo.CalculateStorageFeesInfoVO" id="StorageFeesInfoResult">
+    <resultMap type="CalculateStorageFeesInfoVO" id="StorageFeesInfoResult">
         <result property="fId" column="f_id"/>
         <result property="warehouse" column="f_warehouseid"/>
         <result property="fBillno" column="f_billno"/>
@@ -73,6 +73,19 @@
         <result property="goodsName" column="goods_name"/>
     </resultMap>
 
+    <resultMap type="whgenlegVO" id="WhgenlegInfoResult">
+        <result property="fId" column="f_id"/>
+        <result property="corpName" column="corp_name"/>
+        <result property="fMblno" column="f_mblno"/>
+        <result property="fBusinessType" column="f_business_type"/>
+        <result property="fMarks" column="f_marks"/>
+        <result property="fBsdate" column="f_bsdate"/>
+        <result property="fTrademodeid" column="f_trademodeid"/>
+        <result property="qty" column="f_qty"/>
+        <result property="grossweight" column="f_netweight"/>
+        <result property="netweight" column="f_grossweight"/>
+    </resultMap>
+
     <sql id="selectTWhgenlegVo">
         select f_id, f_accyear, f_accmonth, f_corpid, f_mblno, f_originalbillno, f_warehouse_locationid, f_goodsid, f_trademodeid, f_preqty,
          f_pregrossweight, f_warehouseid, f_prenetweight, f_bsdate, f_chargedate, f_volumnD, f_qtyD, f_billingway, f_grossweightD, f_netweightD, f_volumnC,
@@ -1003,5 +1016,25 @@
         </foreach>
     </select>
 
+    <select id="selectWhgenlegDetailsList" resultMap="WhgenlegInfoResult">
+        SELECT
+            w.f_id,
+            c.f_name corp_name,
+            item.f_mblno,
+            item.f_business_type,
+            item.f_marks,
+            item.f_bsdate,
+            w.f_trademodeid,
+            item.f_qty,
+            item.f_grossweight,
+            item.f_netweight
+        FROM
+            t_warehousebills w
+                LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
+                LEFT JOIN t_corps c ON c.f_id = w.f_corpid
+        WHERE
+            item.f_srcid = #{fId}
+    </select>
+
 
 </mapper>

+ 102 - 79
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -405,89 +405,89 @@
             <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
         </where>
         ${params.dataScope}
-        ORDER BY bill.f_id DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
+        ORDER BY bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
     </select>
 
     <select id="selectWarehouseBusinessList1" parameterType="TWarehousebills" resultType="Map">
         SELECT
-        DISTINCT
-        bill.f_id AS fId,
-        corp.f_name AS fCorpid,
-        corpTo.f_name AS fTocorpid,
-        bill.f_mblno AS fMblno,
-        corpSub.f_name AS fSbu,
-        bill.f_marks AS fMarks,
-        bill.remark AS remark,
-        bill.f_planqty AS fPlanqty,
-        bill.f_plangrossweight AS fPlangrossweight,
-        bill.f_plannetweight AS fPlannetweight,
-        bill.f_planvolumn AS fPlanvolumn,
-        bill.f_bsdate AS fBsdate,
-        dict.dict_label AS fTrademodeid,
-        bill.f_truckno AS fTruckno,
-        bill.f_driver_name AS fDriverName,
-        bill.f_driver_tel AS fDriverTel,
-        bill.f_driver_id_car AS fDriverIdCar,
-        ware.f_name AS fWarehouseid,
-        bill.f_qty AS fQty,
-        bill.f_cntval AS fCntval,
-        bill.f_chargetype AS fChargetype,
-        bill.f_netweight AS fNetweight,
-        bill.create_time AS createTime,
-        ware1.f_name AS fInwarehouseid,
-        bill.create_by AS createBy,
-        bill.f_grossweight AS fGrossweight,
-        bill.f_product_name AS fProductName,
-        bill.f_billing_deadline AS fBillingDeadline,
-        bill.free_container_date AS freeContainerDate,
-        CASE
-        WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '1' THEN '录入'
-        WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '2' THEN '暂存'
-        WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '3' THEN '驳回'
-        WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '4' THEN '请核'
-        WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '5' THEN '审核中'
-        WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '6' THEN '全部入账'
-        WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '1' THEN '新建'
-        WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '2' THEN '暂存'
-        WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '3' THEN '审核驳回'
-        WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '4' THEN '提交审核'
-        WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '5' THEN '审核中'
-        WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '6' THEN '审核通过'
-        END
-        AS fBillstatus,
-        CASE
-        WHEN bill.f_billtype = 'HQZY'
-        AND bill.f_items_status = '1' THEN
-        '计划'
-        WHEN bill.f_billtype = 'HQZY'
-        AND bill.f_items_status = '2' THEN
-        '待货转'
-        WHEN bill.f_billtype = 'HQZY'
-        AND bill.f_items_status = '3' THEN
-        '货转中'
-        WHEN bill.f_billtype = 'HQZY'
-        AND bill.f_items_status = '4' THEN
-        '已货转'
-        END
-        AS fItemsStatus,
-        bill.f_billno AS fBillno,
-        g.f_name AS fGoodsid,
-        bill.f_storekeeper AS fStorekeeper,
-        bill.f_remarks_fees AS fRemarksFees
+            DISTINCT
+            bill.f_id AS fId,
+            corp.f_name AS fCorpid,
+            corpTo.f_name AS fTocorpid,
+            bill.f_mblno AS fMblno,
+            corpSub.f_name AS fSbu,
+            bill.f_marks AS fMarks,
+            bill.remark AS remark,
+            bill.f_planqty AS fPlanqty,
+            bill.f_plangrossweight AS fPlangrossweight,
+            bill.f_plannetweight AS fPlannetweight,
+            bill.f_planvolumn AS fPlanvolumn,
+            bill.f_bsdate AS fBsdate,
+            dict.dict_label AS fTrademodeid,
+            bill.f_truckno AS fTruckno,
+            bill.f_driver_name AS fDriverName,
+            bill.f_driver_tel AS fDriverTel,
+            bill.f_driver_id_car AS fDriverIdCar,
+            ware.f_name AS fWarehouseid,
+            bill.f_qty AS fQty,
+            bill.f_cntval AS fCntval,
+            bill.f_chargetype AS fChargetype,
+            bill.f_netweight AS fNetweight,
+            bill.create_time AS createTime,
+            ware1.f_name AS fInwarehouseid,
+            bill.create_by AS createBy,
+            bill.f_grossweight AS fGrossweight,
+            bill.f_product_name AS fProductName,
+            bill.f_billing_deadline AS fBillingDeadline,
+            bill.free_container_date AS freeContainerDate,
+            CASE
+            WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '1' THEN '录入'
+            WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '2' THEN '暂存'
+            WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '3' THEN '驳回'
+            WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '4' THEN '请核'
+            WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '5' THEN '审核中'
+            WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '6' THEN '全部入账'
+            WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '1' THEN '新建'
+            WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '2' THEN '暂存'
+            WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '3' THEN '审核驳回'
+            WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '4' THEN '提交审核'
+            WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '5' THEN '审核中'
+            WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '6' THEN '审核通过'
+            END
+            AS fBillstatus,
+            CASE
+            WHEN bill.f_billtype = 'HQZY'
+            AND bill.f_items_status = '1' THEN
+            '计划'
+            WHEN bill.f_billtype = 'HQZY'
+            AND bill.f_items_status = '2' THEN
+            '待货转'
+            WHEN bill.f_billtype = 'HQZY'
+            AND bill.f_items_status = '3' THEN
+            '货转中'
+            WHEN bill.f_billtype = 'HQZY'
+            AND bill.f_items_status = '4' THEN
+            '已货转'
+            END
+            AS fItemsStatus,
+            bill.f_billno AS fBillno,
+            g.f_name AS fGoodsid,
+            bill.f_storekeeper AS fStorekeeper,
+            bill.f_remarks_fees AS fRemarksFees
         FROM
-        t_warehousebills bill
-        LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
-        left join sys_user u on bill.create_by = u.user_name
-        left join sys_user u1 on bill.f_storekeeper = u1.user_name
-        left join sys_dept d on bill.f_bsdeptid = d.dept_id
-        LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
-        LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
-        LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
-        LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
-        LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
-        LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
-        LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
-        LEFT JOIN sys_dict_data dict ON dict.dict_value = bill.f_trademodeid
+            t_warehousebills bill
+            LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
+            left join sys_user u on bill.create_by = u.user_name
+            left join sys_user u1 on bill.f_storekeeper = u1.user_name
+            left join sys_dept d on bill.f_bsdeptid = d.dept_id
+            LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
+            LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
+            LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
+            LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
+            LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
+            LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
+            LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
+            LEFT JOIN sys_dict_data dict ON dict.dict_value = bill.f_trademodeid
         <where>
             dict.status = '0'
             AND dict.dict_type = 'data_trademodes'
@@ -564,7 +564,7 @@
             <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
         </where>
         ${params.dataScope}
-        ORDER BY bill.f_id DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
+        ORDER BY bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
     </select>
 
     <select id="selectTWarehousebillsById" parameterType="Long" resultMap="TWarehousebillsResult">
@@ -2735,4 +2735,27 @@
             w.f_id
     </select>
 
+    <select id="selecStorageFeeList" resultType="Map">
+        SELECT DISTINCT w.f_id AS fId, w.f_billno AS fBillno, corp.f_name AS fCorpid, w.f_billing_deadline AS fBillingDeadline, w.remark,
+                        w.f_billstatus AS fBillstatus, w.create_by AS createBy, w.create_time AS createTime
+        FROM t_warehousebills w LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
+            LEFT JOIN t_corps corp ON corp.f_id = w.f_corpid
+            left join sys_user u on w.create_by = u.user_name
+            left join sys_user u1 on w.f_storekeeper = u1.user_name
+            left join sys_dept d on w.f_bsdeptid = d.dept_id
+        <where>
+            w.f_billtype = 'JSCCF'
+            <if test="fBillstatus != null and fBillstatus != ''">and w.f_billstatus = #{fBillstatus}</if>
+            <if test="fMarks != null and fMarks != ''">and w.f_marks = #{fMarks}</if>
+            <if test="createBy != null and createBy != ''">and w.create_by = #{createBy}</if>
+            <if test='timeInterval2 != null and timeInterval2[0] != null and timeInterval2[1]!= ""'>
+                and w.f_billing_deadline BETWEEN #{timeInterval2[0]} AND #{timeInterval2[1]}
+            </if>
+            <if test="fBillno != null and fBillno != ''">and w.f_billno like concat('%', #{fBillno}, '%')</if>
+            <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
+        </where>
+            ${params.dataScope}
+            ORDER BY w.f_bsdate DESC, w.f_bstime DESC,w.f_id DESC,w.f_billstatus
+    </select>
+
 </mapper>

+ 10 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -530,6 +530,16 @@
                 f_accamount = f_accamount - #{map.tFeeDo.fAmt},
                 f_accamount_date = #{map.tFee.fAccbilldate}
             </if>
+            /*判断确认仓库发票*/
+            <if test="map.billType == 'FP'">
+                f_invnos = #{map.tFee.fBillno},
+                f_invamount = f_invamount + #{map.tFeeDo.fAmt}
+            </if>
+            /*判断撤销仓库发票*/
+            <if test="map.billType == 'FPRevoke'">
+                f_invnos = #{map.tFee.fBillno},
+                f_invamount = f_invamount - #{map.tFeeDo.fAmt}
+            </if>
         </trim>
         where f_id = #{map.tFeeDo.fSrcid}
     </update>