Browse Source

[CODE]: 库存总账 --> 明细账

maxianghua 4 years ago
parent
commit
3b3b9d24ea

+ 13 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWhgenlegController.java

@@ -9,8 +9,10 @@ import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
+import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Whgenleg;
 import com.ruoyi.reportManagement.service.ITWhgenlegService;
+import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -138,6 +140,17 @@ public class TWhgenlegController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     *  明细帐
+     */
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/detailed/list")
+    public TableDataInfo detailedList(TWarehousebill tWarehousebill) {
+        startPage();
+        List<Map<String, Object>> list = tWhgenlegService.selectdetailedList(tWarehousebill);
+        return getDataTable(list);
+    }
+
 
 
 }

+ 107 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/dto/TWarehousebill.java

@@ -0,0 +1,107 @@
+package com.ruoyi.reportManagement.dto;
+
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 库存总账对象 t_whgenleg
+ *
+ * @author ruoyi
+ * @date 2020-12-25
+ */
+public class TWarehousebill extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+
+    /**
+     * 货权方
+     */
+    private Long fCorpIds;
+
+    /**
+     * 提单号
+     */
+    private String fMblno;
+
+    /**
+     * 业务类型(存汉字的,用来选择 产地 规格 品牌)
+     */
+    private Long fBusinessType;
+
+    /**
+     * 品牌
+     */
+    private String fMarks;
+
+    /**
+     * 货物品名,t_goods 中的no或 name,模糊查找选择后,存储f_id,显示name
+     */
+    private Long fGoodsid;
+
+    /**
+     * 库区,显示仓库 库位 库区
+     */
+    private Long fWarehouseLocationid;
+
+    /**
+     * 贸易方式,对应t_trademodels name
+     */
+    private Long fTrademodeids;
+
+    public Long getfCorpIds() {
+        return fCorpIds;
+    }
+
+    public void setfCorpIds(Long fCorpIds) {
+        this.fCorpIds = fCorpIds;
+    }
+
+    public String getfMblno() {
+        return fMblno;
+    }
+
+    public void setfMblno(String fMblno) {
+        this.fMblno = fMblno;
+    }
+
+    public Long getfBusinessType() {
+        return fBusinessType;
+    }
+
+    public void setfBusinessType(Long fBusinessType) {
+        this.fBusinessType = fBusinessType;
+    }
+
+    public String getfMarks() {
+        return fMarks;
+    }
+
+    public void setfMarks(String fMarks) {
+        this.fMarks = fMarks;
+    }
+
+    public Long getfGoodsid() {
+        return fGoodsid;
+    }
+
+    public void setfGoodsid(Long fGoodsid) {
+        this.fGoodsid = fGoodsid;
+    }
+
+    public Long getfWarehouseLocationid() {
+        return fWarehouseLocationid;
+    }
+
+    public void setfWarehouseLocationid(Long fWarehouseLocationid) {
+        this.fWarehouseLocationid = fWarehouseLocationid;
+    }
+
+    public Long getfTrademodeids() {
+        return fTrademodeids;
+    }
+
+    public void setfTrademodeids(Long fTrademodeids) {
+        this.fTrademodeids = fTrademodeids;
+    }
+}
+

+ 3 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java

@@ -2,6 +2,7 @@ package com.ruoyi.reportManagement.service;
 
 
 import com.ruoyi.reportManagement.domain.TWhgenleg;
+import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Whgenleg;
 
 import java.util.List;
@@ -100,4 +101,6 @@ public interface ITWhgenlegService {
 
     public List<Whgenleg> whgenlegExport(TWhgenleg tWhgenleg) throws Exception;
 
+    List<Map<String, Object>> selectdetailedList(TWarehousebill tWarehousebill);
+
 }

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

@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.entity.TWarehouse;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
+import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Whgenleg;
 import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
 import com.ruoyi.reportManagement.service.ITWhgenlegService;
@@ -362,6 +363,11 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         return list1;
     }
 
+    @Override
+    public List<Map<String, Object>> selectdetailedList(TWarehousebill tWarehousebill) {
+        return tWarehouseBillsMapper.selectDetailedList(tWarehousebill);
+    }
+
     /**
      *
      * @param fOriginalbilldate 根据该字段进行合并

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

@@ -3,6 +3,7 @@ package com.ruoyi.warehouseBusiness.mapper;
 
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
+import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import org.apache.ibatis.annotations.Param;
@@ -97,4 +98,6 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
     List<Map<String, Object>> selectInventorySJCKList(TWarehouseBills tWarehousebills);
 
     public List<TWareHouseItemsExcel> selectTWarehousebillsItemList(TWarehouseBills tWarehouseBills);
+
+    public List<Map<String, Object>> selectDetailedList(TWarehousebill tWarehousebill);
 }

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

@@ -559,17 +559,12 @@
 
     <select id="warehouseBillsFeesList1" resultType="java.util.Map">
         SELECT
-        a.*,
-        ifnull( a.fAmount, 0 ) - ifnull( a.fStlamount, 0 ) AS nnfinished
-        FROM
-        (
-        SELECT
             w.f_id AS fSrcid,
             t.f_id AS fSrcpid,
             t.f_corpid AS fCorpid,
             c.f_name AS fName,
-            w.fId AS fId,
-            w.fName AS fFeesName,
+            c1.f_id AS fId,
+            c1.f_name AS fFeesName,
             w.f_mblno AS fMblno,
             w.f_product_name AS fProductName,
             w.f_marks AS fMarks,
@@ -577,48 +572,15 @@
             t.f_review_date AS fReviewDate,
             w.f_dc AS fSrcdc,
             SUM(w.f_amount) AS fAmount,
-            SUM(w.f_stlamount) AS fStlamount
+            SUM(w.f_stlamount) AS fStlamount,
+            ifnull(SUM( w.f_amount ) , 0 ) - ifnull( SUM( w.f_stlamount ) , 0 ) AS nnfinished
         FROM
             t_warehousebills t
                 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 = t.f_corpid
-                LEFT JOIN (
-                SELECT
-                    f.f_id AS f_id,
-                    f.f_pid AS f_pid,
-                    f.f_lineno AS f_lineno,
-                    f.f_corpid,
-                    f.f_feeid,
-                    f.f_feeUnitid,
-                    f.f_qty,
-                    f.f_unitprice,
-                    f.f_amount,
-                    f.f_currency,
-                    f.f_exrate,
-                    f.f_taxrate,
-                    f.f_dc,
-                    f.f_billstatus,
-                    f.f_statement_no,
-                    f.f_accamount,
-                    f.f_accamount_date,
-                    f.f_stlamount_no,
-                    f.f_stlamount,
-                    f.f_stlamount_date,
-                    f.f_invnos,
-                    f.f_invamount,
-                    f.f_askamount,
-                    f.f_status,
-                    f.remark,
-                    f.f_mblno,
-                    f.f_product_name,
-                    f.f_marks,
-                    c.f_id AS fId,
-                    c.f_name AS fName
-                FROM
-                    t_warehousebillsfees AS f
-                        LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
-            ) w ON w.f_pid = t.f_id
+                LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
+                LEFT JOIN t_corps  c1 ON w.f_corpid = c1.f_id
                 LEFT JOIN t_fees f ON w.f_feeid = f.f_id
         <where>
             <if test="fCorpid != null  and fCorpid != ''">and t.f_corpid = #{fCorpid} </if>
@@ -654,7 +616,6 @@
             w.f_dc,
             w.f_corpid
         </where>
-        ) a
     </select>
 
     <select id="selectTWarehousebillsItemsList"

+ 2 - 0
ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml

@@ -87,6 +87,7 @@
         select
         DISTINCT
             leg.f_id AS fId,
+            leg.f_corpid AS fCorpIds,
             corp.f_name AS fCorpid,
             ware.f_warehouse_information AS fWarehouseids,
             area.f_name AS fWarehouseLocationids,
@@ -94,6 +95,7 @@
             leg.f_warehouse_locationid AS fWarehouseLocationid,
             dict1.dict_label AS fTrademodeid,
             goods.f_name AS fGoodsids,
+            leg.f_trademodeid AS fTrademodeids,
             goods.f_packagespecs AS fPackagespecs,
             leg.f_goodsid AS fGoodsid,
             leg.f_volumnD AS fVolumnD,

+ 121 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -918,5 +918,126 @@
         </trim>
         where f_id = #{fPid}
     </update>
+    <select id="selectDetailedList" resultType="java.util.Map">
+        SELECT
+            t.f_id AS fId,
+            item.f_id AS  fItemsId,
+            C.f_name AS fcorpid,
+            t.f_mblno AS fMblno,
+            g.f_name AS fGoodsid,
+            dict.dict_label AS fBusinessType,
+            t.f_marks AS fMarks,
+            CASE
+                WHEN t.f_billtype = 'SJRK' THEN
+                    '入库'
+                WHEN t.f_billtype = 'SJCK' THEN
+                    '出库'
+                WHEN t.f_billtype = 'CKDB' THEN
+                    '调拨'
+                WHEN t.f_billtype = 'HQZY' THEN
+                    '货权转移'
+                WHEN t.f_billtype = 'HWTG' THEN
+                    '货物通关'
+                END AS fBilltype,
+            item.f_bsdate AS fBsdate,
+            item.f_warehouse_information AS fWarehouseInformation,
+            dictTra.dict_label AS fTrademodeid,
+            CASE
+                WHEN t.f_billtype = 'SJRK' THEN
+                    item.f_qty
+                else '0'
+                END AS fQtyRK,
+            CASE
+                WHEN t.f_billtype = 'SJRK' THEN
+                    item.f_grossweight
+                else '0'
+                END AS fGrossweightRK,
+            CASE
+                WHEN t.f_billtype = 'SJRK' THEN
+                    item.f_netweight
+                else '0'
+                END AS fNetweightRK,
+            CASE
+                WHEN t.f_billtype = 'SJCK' THEN
+                    item.f_qty
+                else '0'
+                END AS fQtyCK,
+            CASE
+                WHEN t.f_billtype = 'SJCK' THEN
+                    item.f_grossweight
+                else '0'
+                END AS fGrossweightCK,
+            CASE
+                WHEN t.f_billtype = 'SJCK' THEN
+                    item.f_netweight
+                else '0'
+                END AS fNetweightCK,
+            CASE
+                WHEN t.f_billtype = 'CKDB' THEN
+                    item.f_qty
+                else '0'
+                END AS fQtyDB,
+            CASE
+                WHEN t.f_billtype = 'CKDB' THEN
+                    item.f_grossweight
+                else '0'
+                END AS fGrossweightDB,
+            CASE
+                WHEN t.f_billtype = 'CKDB' THEN
+                    item.f_netweight
+                else '0'
+                END AS fNetweightDB,
+            CASE
+                WHEN t.f_billtype = 'HQZY' THEN
+                    item.f_qty
+                else '0'
+                END AS fQtyHZ,
+            CASE
+                WHEN t.f_billtype = 'HQZY' THEN
+                    item.f_grossweight
+                else '0'
+                END AS fGrossweightHZ,
+            CASE
+                WHEN t.f_billtype = 'HQZY' THEN
+                    item.f_netweight
+                else '0'
+                END AS fNetweightHZ,
+            CASE
+                WHEN t.f_billtype = 'HWTG' THEN
+                    item.f_qty
+                else '0'
+                END AS fQtyTG,
+            CASE
+                WHEN t.f_billtype = 'HWTG' THEN
+                    item.f_grossweight
+                else '0'
+                END AS fGrossweightTG,
+            CASE
+                WHEN t.f_billtype = 'HWTG' THEN
+                    item.f_netweight
+                else '0'
+                END AS fNetweightTG
+        FROM
+            t_warehousebills  t
+                LEFT JOIN t_warehousebillsitems item ON item.f_pid = t.f_id
+                LEFT JOIN t_goods g ON item.f_goodsid = g.f_id
+                LEFT JOIN t_corps C ON t.f_corpid = C.f_id
+                LEFT JOIN sys_dict_data dict ON dict.dict_value = item.f_business_type
+                LEFT JOIN sys_dict_data dictTra ON dictTra.dict_value = t.f_trademodeid
+        WHERE
+            dict.STATUS = '0'
+          AND dict.dict_type = 'storage_type'
+          AND dictTra.STATUS = '0'
+          AND dictTra.dict_type = 'data_trademodes'
+          AND item.f_billstatus = 40
+          AND item.f_mblno = #{fMblno}
+          AND  ( item.f_warehouselocid = #{fWarehouseLocationid} or
+                 item.f_transfer_warehouselocid = #{fWarehouseLocationid}  )
+          AND t.f_trademodeid =  #{fTrademodeids}
+          AND item.f_business_type =  #{fBusinessType}
+          AND item.f_goodsid =  #{fGoodsid}
+          AND item.f_marks =  #{fMarks}
+          AND t.f_corpid =  #{fCorpIds}
 
+    </select>
 </mapper>