Bläddra i källkod

安品采购申请按公司分组统计

lazhaoqian 4 år sedan
förälder
incheckning
a088fa0b06

+ 22 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/anpin/StockControl.java

@@ -381,5 +381,27 @@ public class StockControl extends BaseController {
         List<AnPingOrderMessage> list = tWarehousebillsService.selectFeeMessage(tWarehouseBills);
         return getDataTable(list);
     }
+    /**
+     * 采购申请统计列表
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:stockControl:purchaseRequest')")
+    @GetMapping("/purchaseRequest")
+    public TableDataInfo purchaseRequest (TWarehouseBills tWarehouseBills) {
+        startPage();
+        List<PurchaseRequestExcel> list = tWarehousebillsService.purchaseRequest(tWarehouseBills);
+        return getDataTable(list);
+    }
+    /**
+     * 导出采购申请统计列表
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:stockControl:purchaseRequestExPorrt')")
+    @Log(title = "导出采购申请统计表", businessType = BusinessType.EXPORT)
+    @GetMapping("/purchaseRequest/export")
+    public AjaxResult purchaseRequestExPort(TWarehouseBills tWarehouseBills)
+    {
+        List<PurchaseRequestExcel> list = tWarehousebillsService.purchaseRequest(tWarehouseBills);
+        ExcelUtil<PurchaseRequestExcel> util = new ExcelUtil<PurchaseRequestExcel>(PurchaseRequestExcel.class);
+        return util.exportExcel(list, "采购申请统计表");
+    }
 
 }

+ 172 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/anpin/PurchaseRequestExcel.java

@@ -0,0 +1,172 @@
+package com.ruoyi.anpin;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 采购申请统计
+ */
+public class PurchaseRequestExcel {
+    private static final long serialVersionUID = 1L;
+    //供应商id
+    private Long fCorpid;
+    //供应商名称
+    @Excel(name = "供应商")
+    private String fCorpidName;
+    @Excel(name = "出库日期",dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date fBsdate;
+    //物资类别
+    private Long ffeetype;
+    //物资类别中文名
+    @Excel(name = "物资类别")
+    private String ffeetypeName;
+    //物资名
+    @Excel(name = "物资")
+    private String fname;
+    //规格
+    @Excel(name = "规格")
+    private String fcurrency;
+    //数量
+    @Excel(name = "数量")
+    private BigDecimal fqty;
+    //计价单位id
+    private Long ffeeunitid;
+    //计价单位中文名
+    @Excel(name = "计价单位")
+    private String ffeeunitidName;
+    //单价
+    @Excel(name = "单价")
+    private BigDecimal price;
+    //金额
+    @Excel(name = "金额")
+    private BigDecimal famount;
+    @Excel(name = "开票公司")
+    private String fsbuName;
+
+    public Long getfCorpid() {
+        return fCorpid;
+    }
+
+    public void setfCorpid(Long fCorpid) {
+        this.fCorpid = fCorpid;
+    }
+
+    public String getfCorpidName() {
+        return fCorpidName;
+    }
+
+    public void setfCorpidName(String fCorpidName) {
+        this.fCorpidName = fCorpidName;
+    }
+
+    public Date getfBsdate() {
+        return fBsdate;
+    }
+
+    public void setfBsdate(Date fBsdate) {
+        this.fBsdate = fBsdate;
+    }
+
+    public Long getFfeetype() {
+        return ffeetype;
+    }
+
+    public void setFfeetype(Long ffeetype) {
+        this.ffeetype = ffeetype;
+    }
+
+    public String getFfeetypeName() {
+        return ffeetypeName;
+    }
+
+    public void setFfeetypeName(String ffeetypeName) {
+        this.ffeetypeName = ffeetypeName;
+    }
+
+    public String getFname() {
+        return fname;
+    }
+
+    public void setFname(String fname) {
+        this.fname = fname;
+    }
+
+    public String getFcurrency() {
+        return fcurrency;
+    }
+
+    public void setFcurrency(String fcurrency) {
+        this.fcurrency = fcurrency;
+    }
+
+    public BigDecimal getFqty() {
+        return fqty;
+    }
+
+    public void setFqty(BigDecimal fqty) {
+        this.fqty = fqty;
+    }
+
+    public Long getFfeeunitid() {
+        return ffeeunitid;
+    }
+
+    public void setFfeeunitid(Long ffeeunitid) {
+        this.ffeeunitid = ffeeunitid;
+    }
+
+    public String getFfeeunitidName() {
+        return ffeeunitidName;
+    }
+
+    public void setFfeeunitidName(String ffeeunitidName) {
+        this.ffeeunitidName = ffeeunitidName;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    public BigDecimal getFamount() {
+        return famount;
+    }
+
+    public void setFamount(BigDecimal famount) {
+        this.famount = famount;
+    }
+
+    public String getFsbuName() {
+        return fsbuName;
+    }
+
+    public void setFsbuName(String fsbuName) {
+        this.fsbuName = fsbuName;
+    }
+
+    @Override
+    public String toString() {
+        return "PurchaseRequestExcel{" +
+                "fCorpid=" + fCorpid +
+                ", fCorpidName='" + fCorpidName + '\'' +
+                ", fBsdate=" + fBsdate +
+                ", ffeetype=" + ffeetype +
+                ", ffeetypeName='" + ffeetypeName + '\'' +
+                ", fname='" + fname + '\'' +
+                ", fcurrency='" + fcurrency + '\'' +
+                ", fqty=" + fqty +
+                ", ffeeunitid=" + ffeeunitid +
+                ", ffeeunitidName='" + ffeeunitidName + '\'' +
+                ", price=" + price +
+                ", famount=" + famount +
+                ", fsbuName='" + fsbuName + '\'' +
+                '}';
+    }
+}

+ 7 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsfeesMapper.java

@@ -3,7 +3,7 @@ package com.ruoyi.warehouseBusiness.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.anpin.*;
-import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.anpin.PurchaseRequestExcel;
 import com.ruoyi.finance.excel.FleetExcel;
 import com.ruoyi.shipping.domain.TAccount;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
@@ -205,4 +205,10 @@ public interface TWarehousebillsfeesMapper extends BaseMapper<TWarehousebillsfee
                                                      @Param("annum") String annum);
 
     public BigDecimal selectAmount(@Param("fPid") Long fPid);
+    /**
+     * 安品采购申请统计
+     * @param tWarehouseBills
+     * @return
+     */
+    public List<PurchaseRequestExcel> purchaseRequest(TWarehouseBills tWarehouseBills);
 }

+ 6 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -498,6 +498,12 @@ public interface ITWarehouseBillsService {
      */
     public List<SalesOfOutbound> salesOfOutbound(TWarehouseBills tWarehouseBills);
     /**
+     * 安品采购申请统计
+     * @param tWarehouseBills
+     * @return
+     */
+    public List<PurchaseRequestExcel> purchaseRequest(TWarehouseBills tWarehouseBills);
+    /**
      * 安品利润统计
      * @param tWarehouseBills
      * @return

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

@@ -2125,6 +2125,11 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     }
 
     @Override
+    public List<PurchaseRequestExcel> purchaseRequest(TWarehouseBills tWarehouseBills) {
+        return tWarehousebillsfeesMapper.purchaseRequest(tWarehouseBills);
+    }
+
+    @Override
     public List<ProfitExcel> salectAnpinProfit(TWarehouseBills tWarehouseBills) {
         List<ProfitExcel> profitExcels = tWarehousebillsfeesMapper.salectAnpinProfit(tWarehouseBills);
         //去重

+ 34 - 6
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -99,6 +99,8 @@
         <result property="fCreateLog"    column="f_create_log"    />
         <result property="fPrintLog"    column="f_print_log"    />
         <result property="fPrint"    column="f_print"    />
+        <result property="fTakeOrders"    column="f_take_orders"    />
+        <result property="fReason"    column="f_reason"    />
     </resultMap>
     <sql id="selectTWarehousebillsVo">
         select f_id,
@@ -194,7 +196,9 @@
                f_purchase,
                f_create_log,
                f_print_log,
-               f_print
+               f_print,
+               f_take_orders,
+               f_reason
         from t_warehousebills
     </sql>
 
@@ -1030,6 +1034,8 @@
             <if test="fCreateLog != null">f_create_log,</if>
             <if test="fPrintLog != null">f_print_log,</if>
             <if test="fPrint != null">f_print,</if>
+            <if test="fTakeOrders != null">f_take_orders,</if>
+            <if test="fReason != null">f_reason,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="fBillno != null">#{fBillno},</if>
@@ -1126,6 +1132,8 @@
             <if test="fCreateLog != null">#{fCreateLog},</if>
             <if test="fPrintLog != null">#{fPrintLog},</if>
             <if test="fPrint != null">#{fPrint},</if>
+            <if test="fTakeOrders != null">#{fTakeOrders},</if>
+            <if test="fReason != null">#{fReason},</if>
         </trim>
     </insert>
 
@@ -1225,6 +1233,8 @@
             <if test="fCreateLog != null">f_create_log = #{fCreateLog},</if>
             <if test="fPrintLog != null">f_print_log = #{fPrintLog},</if>
             <if test="fPrint != null">f_print = #{fPrint},</if>
+            <if test="fTakeOrders != null">f_take_orders = #{fTakeOrders},</if>
+            <if test="fReason != null">f_reason = #{fReason},</if>
         </trim>
         where f_id = #{fId}
     </update>
@@ -1316,6 +1326,12 @@
             <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
             <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
             <if test="fMoney != null">f_money = #{fMoney},</if>
+            <if test="fPurchase != null">f_purchase = #{fPurchase},</if>
+            <if test="fCreateLog != null">f_create_log = #{fCreateLog},</if>
+            <if test="fPrintLog != null">f_print_log = #{fPrintLog},</if>
+            <if test="fPrint != null">f_print = #{fPrint},</if>
+            <if test="fTakeOrders != null">f_take_orders = #{fTakeOrders},</if>
+            <if test="fReason != null">f_reason = #{fReason},</if>
         </trim>
         where f_id = #{fId}
     </update>
@@ -1587,7 +1603,9 @@
         tw.f_paymode,
         sda.dict_label paymodeName,
         tw.f_laneid,
-        tr.f_name laneidName
+        tr.f_name laneidName,
+        tw.f_take_orders,
+        tw.f_reason
         FROM t_warehousebills tw
         LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
         LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
@@ -1769,7 +1787,9 @@
         '审批中'
         WHEN tf.f_billstatus = '6' THEN
         '审批通过'
-        END AS moneyStatus
+        END AS moneyStatus,
+        tw.f_take_orders,
+        tw.f_reason
         FROM
         t_warehousebills tw
         LEFT JOIN t_address ta ON ta.f_id = tw.f_laneid
@@ -2007,7 +2027,9 @@
                tw.f_paymode,
                sda.dict_label paymodeName,
                tw.f_laneid,
-               tr.f_name      laneidName
+               tr.f_name      laneidName,
+               tw.f_take_orders,
+               tw.f_reason
         FROM t_warehousebills tw
                  LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
                  LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
@@ -2307,7 +2329,9 @@
                tw.f_cntval,
                tw.f_date_changed,
                tw.f_market_number,
-               tw.f_money
+               tw.f_money,
+               tw.f_take_orders,
+               tw.f_reason
         FROM t_warehousebills tw
                  LEFT JOIN t_project tp
                            ON tw.f_goodsid = tp.f_id
@@ -2431,7 +2455,9 @@
         tr.f_name    AS fsbuName,
         tw.f_create_log,
         tw.f_print_log,
-        tw.f_print
+        tw.f_print,
+        tw.f_take_orders,
+        tw.f_reason
         FROM
         t_warehousebills tw
         LEFT JOIN t_project tp
@@ -2556,6 +2582,8 @@
             <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
                 and tw.f_bsdate &lt;= #{timeInterval[1]}
             </if>
+            <if test="fTakeOrders != null "> and tw.f_take_orders = #{fTakeOrders}</if>
+            <if test="fReason != null  and fReason != ''"> and tw.f_reason = #{fReason}</if>
         </where>
         ORDER BY tw.f_bsdate DESC,tw.f_id DESC
     </select>

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

@@ -1573,5 +1573,100 @@
         WHERE f_pid = #{fPid}
           AND tw.del_flag = '0'
     </select>
+    <!--安品采购申请统计-->
+    <select id="purchaseRequest" parameterType="TWarehousebills"
+            resultType="com.ruoyi.anpin.PurchaseRequestExcel">
+        SELECT
+        td.fCorpid AS fCorpid,/*供应商id*/
+        tp.f_name AS fCorpidName,/*供应商中文名*/
+        td.ffeetype AS ffeetype,/*物资类别*/
+        si.dict_label AS ffeetypeName /*物资类别中文名*/,
+        td.fname AS fname,/*物资名*/
+        td.fcurrency AS fcurrency,/*规格*/
+        td.ffeeunitid AS ffeeunitid,/*计价单位id*/
+        sc.dict_label AS ffeeunitidName,/*计价单位中文名*/
+        td.fqty AS fqty,/*数量*/
+        td.famount AS famount,/*金额*/
+        tr.f_name AS fsbuName,/*开票公司*/
+        round(td.price,2) AS price/*单价*/
+        <if test="groupDate != null  and groupDate == 0">
+            ,td.fBsdate AS fBsdate/*入库日期*/
+        </if>
+        FROM
+        (
+        SELECT
+        tc.fCorpid,
+        tc.ffeetype,
+        tc.fname,
+        tc.fcurrency,
+        tc.ffeeunitid,
+        tc.fBsdate,
+        tc.fSbu,
+        IFNULL( SUM( tc.fqty ), 0 ) fqty,
+        IFNULL( SUM( tc.famount ), 0 ) famount,
+        IFNULL( SUM( tc.famount )/ SUM( tc.fqty ), 0 ) price
+        FROM
+        (
+        SELECT
+        tb.f_corpid fCorpid,
+        /*供应商*/
+        tf.f_feetype ffeetype,
+        /*物资类别*/
+        tf.f_name fname,
+        /*物资名*/
+        tf.f_currency fcurrency,
+        /*规格*/
+        tw.f_feeunitid ffeeunitid,
+        /*计价单位*/
+        tw.f_qty fqty,
+        /*实际数量*/
+        tw.f_amount famount, /*金额*/
+        tb.f_sbu fSbu,/*开票公司*/
+        tw.f_bsdate fBsdate/*出库日期*/
+        FROM
+        t_warehousebillsfees tw
+        LEFT JOIN t_warehousebills tb ON tw.f_pid = tb.f_id
+        LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
+        WHERE
+        tw.del_flag = '0'
+        AND tb.del_flag = '0'
+        AND tw.f_billtype = 'SQ'
+        <if test="fCorpid != null ">and tb.f_corpid = #{fCorpid}</if>
+        <if test="fBillstatus != null">and tw.f_billstatus = #{fBillstatus}</if>
+        <if test="fGoodsid != null  and fGoodsid != ''">and tb.f_goodsid = #{fGoodsid}</if>
+        <if test="fFeeTypeList != null and fFeeTypeList != '[]'">and tf.f_feetype in
+            <foreach item="fId" collection="fFeeTypeList" open="(" separator="," close=")">
+                #{fId}
+            </foreach>
+        </if>
+        <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
+            and tb.f_bsdate &gt;= #{cLoadDate[0]}
+        </if>
+        <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
+            and tb.f_bsdate &lt;= #{cLoadDate[1]}
+        </if>
+        <if test="fSbu != null ">and tb.f_sbu = #{fSbu}</if>
+        ) tc
+        GROUP BY
+        tc.fCorpid,
+        tc.ffeetype,
+        tc.fname,
+        tc.fcurrency,
+        tc.ffeeunitid,
+        tc.fSbu
+        <if test="groupDate != null  and groupDate == 0">
+            ,tc.fBsdate
+        </if>
+        ) td
+        LEFT JOIN t_corps tp ON td.fCorpid = tp.f_id
+        LEFT JOIN t_corps tr ON tr.f_id = td.fSbu
+        LEFT JOIN sys_dict_data sc ON sc.dict_value = td.ffeeunitid AND sc.dict_type = 'data_unitfees'
+        LEFT JOIN sys_dict_data si ON si.dict_value = td.ffeetype AND si.dict_type = 'data_cost_attribute'
+        ORDER BY
+        <if test="groupDate != null  and groupDate == 0">
+            td.fBsdate DESC,/*入库日期*/
+        </if>
+        td.fCorpid DESC
+    </select>
 
 </mapper>