Browse Source

月末结账

lazhaoqian 4 years ago
parent
commit
0096e12447

+ 0 - 11
ruoyi-warehouse/src/main/java/com/ruoyi/anpin/ProfitExcel.java

@@ -19,8 +19,6 @@ public class ProfitExcel {
     //月
     @Excel(name = "月")
     private String abbreviated;
-    //客户
-    private Long fCorpid;
     //客户中文名
     @Excel(name = "客户名称")
     private String fCorpName;
@@ -50,14 +48,6 @@ public class ProfitExcel {
         this.abbreviated = abbreviated;
     }
 
-    public Long getfCorpid() {
-        return fCorpid;
-    }
-
-    public void setfCorpid(Long fCorpid) {
-        this.fCorpid = fCorpid;
-    }
-
     public String getfCorpName() {
         return fCorpName;
     }
@@ -95,7 +85,6 @@ public class ProfitExcel {
         return "ProfitExcel{" +
                 "years='" + annual + '\'' +
                 ", months='" + abbreviated + '\'' +
-                ", fCorpid=" + fCorpid +
                 ", fCorpName='" + fCorpName + '\'' +
                 ", market=" + market +
                 ", purchase=" + purchase +

+ 99 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/anpin/TMonthEndingClosingExcel.java

@@ -0,0 +1,99 @@
+package com.ruoyi.anpin;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * @Author ZhaoQian La
+ * @Date 2021/6/7 14:46
+ * @Version 1.0
+ */
+public class TMonthEndingClosingExcel {
+    private static final long serialVersionUID = 1L;
+    /** $column.columnComment */
+    private Long fId;
+
+    /** 年 */
+    @Excel(name = "年")
+    private int fYear;
+
+    /** 月 */
+    @Excel(name = "月")
+    private int fMonth;
+
+    /** 开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date fStart;
+
+    /** 结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date fEnf;
+
+    /** 是否结账 T 是 F 否 */
+    @Excel(name = "是否结账 T 是 F 否")
+    private String fStatus;
+    //是否结账
+    public Long getfId() {
+        return fId;
+    }
+
+    public void setfId(Long fId) {
+        this.fId = fId;
+    }
+
+    public int getfYear() {
+        return fYear;
+    }
+
+    public void setfYear(int fYear) {
+        this.fYear = fYear;
+    }
+
+    public int getfMonth() {
+        return fMonth;
+    }
+
+    public void setfMonth(int fMonth) {
+        this.fMonth = fMonth;
+    }
+
+    public Date getfStart() {
+        return fStart;
+    }
+
+    public void setfStart(Date fStart) {
+        this.fStart = fStart;
+    }
+
+    public Date getfEnf() {
+        return fEnf;
+    }
+
+    public void setfEnf(Date fEnf) {
+        this.fEnf = fEnf;
+    }
+
+    public String getfStatus() {
+        return fStatus;
+    }
+
+    public void setfStatus(String fStatus) {
+        this.fStatus = fStatus;
+    }
+
+    @Override
+    public String toString() {
+        return "TMonthEndingClosingExcel{" +
+                "fId=" + fId +
+                ", fYear=" + fYear +
+                ", fMonth=" + fMonth +
+                ", fStart=" + fStart +
+                ", fEnf=" + fEnf +
+                ", fStatus='" + fStatus + '\'' +
+                '}';
+    }
+}

+ 42 - 32
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java

@@ -485,24 +485,36 @@ public class TWarehouseBills extends BaseEntity {
      */
     @Excel(name = "箱量")
     private String fCntval;
-    /** 修改时间 */
+    /**
+     * 修改时间
+     */
     private String fDateChanged;
-    /** 学生重量 */
+    /**
+     * 学生重量
+     */
     @Excel(name = "学生重量")
     private BigDecimal fStudentsWeight;
 
-    /** 教师重量 */
+    /**
+     * 教师重量
+     */
     @Excel(name = "教师重量")
     private BigDecimal fTeachersWeight;
 
-    /** 销售出库类别(数据字典 教师,学生) */
+    /**
+     * 销售出库类别(数据字典 教师,学生)
+     */
     @Excel(name = "销售出库类别(数据字典 教师,学生)")
     private Long fMarketTypid;
 
-    /** 销售出库人数 */
+    /**
+     * 销售出库人数
+     */
     @Excel(name = "销售出库人数")
     private Long fMarketNumber;
-    /** 金额合计 */
+    /**
+     * 金额合计
+     */
     @Excel(name = "金额合计")
     private BigDecimal fMoney;
 
@@ -556,7 +568,9 @@ public class TWarehouseBills extends BaseEntity {
     private String corpsName;
     //项目主管
     private String personNaem;
-    /** 采购人 */
+    /**
+     * 采购人
+     */
     @Excel(name = "采购人")
     private Integer fPurchase;
     //采购人
@@ -585,16 +599,16 @@ public class TWarehouseBills extends BaseEntity {
     //物资类别
     private Long fFeeType;
     //年
-    private String years;
+    private String annual;
     //开始结束月
     private List<Long> monthList;
 
-    public String getYears() {
-        return years;
+    public String getAnnual() {
+        return annual;
     }
 
-    public void setYears(String years) {
-        this.years = years;
+    public void setAnnual(String annual) {
+        this.annual = annual;
     }
 
     public List<Long> getMonthList() {
@@ -1570,40 +1584,36 @@ public class TWarehouseBills extends BaseEntity {
     public void setfDateChanged(String fDateChanged) {
         this.fDateChanged = fDateChanged;
     }
-    public void setfStudentsWeight(BigDecimal fStudentsWeight)
-    {
+
+    public void setfStudentsWeight(BigDecimal fStudentsWeight) {
         this.fStudentsWeight = fStudentsWeight;
     }
 
-    public BigDecimal getfStudentsWeight()
-    {
+    public BigDecimal getfStudentsWeight() {
         return fStudentsWeight;
     }
-    public void setfTeachersWeight(BigDecimal fTeachersWeight)
-    {
+
+    public void setfTeachersWeight(BigDecimal fTeachersWeight) {
         this.fTeachersWeight = fTeachersWeight;
     }
 
-    public BigDecimal getfTeachersWeight()
-    {
+    public BigDecimal getfTeachersWeight() {
         return fTeachersWeight;
     }
-    public void setfMarketTypid(Long fMarketTypid)
-    {
+
+    public void setfMarketTypid(Long fMarketTypid) {
         this.fMarketTypid = fMarketTypid;
     }
 
-    public Long getfMarketTypid()
-    {
+    public Long getfMarketTypid() {
         return fMarketTypid;
     }
-    public void setfMarketNumber(Long fMarketNumber)
-    {
+
+    public void setfMarketNumber(Long fMarketNumber) {
         this.fMarketNumber = fMarketNumber;
     }
 
-    public Long getfMarketNumber()
-    {
+    public Long getfMarketNumber() {
         return fMarketNumber;
     }
 
@@ -1638,15 +1648,15 @@ public class TWarehouseBills extends BaseEntity {
     public void setfBillstatusName(String fBillstatusName) {
         this.fBillstatusName = fBillstatusName;
     }
-    public void setfPurchase(Integer fPurchase)
-    {
+
+    public void setfPurchase(Integer fPurchase) {
         this.fPurchase = fPurchase;
     }
 
-    public Integer getfPurchase()
-    {
+    public Integer getfPurchase() {
         return fPurchase;
     }
+
     @Override
     public String toString() {
         return "TWarehouseBills{" +

+ 10 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsfeesMapper.java

@@ -4,6 +4,7 @@ package com.ruoyi.warehouseBusiness.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.anpin.ProfitExcel;
 import com.ruoyi.anpin.SalesOfOutbound;
+import com.ruoyi.anpin.TMonthEndingClosingExcel;
 import com.ruoyi.anpin.WarhousrExcel;
 import com.ruoyi.finance.excel.FleetExcel;
 import com.ruoyi.shipping.domain.TAccount;
@@ -179,4 +180,13 @@ public interface TWarehousebillsfeesMapper extends BaseMapper<TWarehousebillsfee
      * @return
      */
     public List<ProfitExcel> salectAnpinProfit(TWarehouseBills tWarehouseBills);
+
+    /**
+     * 查询入库日期当月是否结账
+     * @param fYear 年
+     * @param fMonth 月
+     * @param fStatus 是否结账 T 是 F否
+     * @return
+     */
+    public List<TMonthEndingClosingExcel> selectTMonthEndingClosingList(@Param("fYear") int fYear,@Param("fMonth") int fMonth,@Param("fStatus") String fStatus);
 }

+ 23 - 3
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -2,11 +2,13 @@ package com.ruoyi.warehouseBusiness.service.impl;
 
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.ruoyi.anpin.ProfitExcel;
 import com.ruoyi.anpin.SalesOfOutbound;
+import com.ruoyi.anpin.TMonthEndingClosingExcel;
 import com.ruoyi.anpin.WarhousrExcel;
 import com.ruoyi.approvalFlow.domain.AuditItems;
 import com.ruoyi.approvalFlow.mapper.AuditItemsMapper;
@@ -58,7 +60,8 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
-import static java.util.stream.Collectors.toList;
+import static java.util.Comparator.comparingLong;
+import static java.util.stream.Collectors.*;
 
 /**
  * 详情主表Service业务层处理
@@ -1606,6 +1609,9 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             receipt = "D";
         }
         TWarehouseBills warehouseBills = JSONArray.parseObject(tWarehousebills, TWarehouseBills.class);
+        if (warehouseBills.getfBsdate() == null){
+            return AjaxResult.error("入库日期不能为空");
+        }
         JSONArray jsonCrArray = JSONArray.parseArray(tWarehousebillsfees);
         List<TWarehousebillsfees> warehousebillsfeesList = JSONObject.parseArray(jsonCrArray.toJSONString(), TWarehousebillsfees.class);
         Integer i = null;
@@ -1736,8 +1742,21 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         }
         Integer i = null;
         TWarehouseBills warehouseBills = JSONArray.parseObject(tWarehousebills, TWarehouseBills.class);
+        if (warehouseBills.getfBsdate() == null){
+            return AjaxResult.error("入库日期不能为空");
+        }
         JSONArray jsonCrArray = JSONArray.parseArray(tWarehousebillsfees);
         List<TWarehousebillsfees> warehousebillsfeesList = JSONObject.parseArray(jsonCrArray.toJSONString(), TWarehousebillsfees.class);
+        //出入库时判断是否结账
+        if ("RK".equals(billsType) || "CK".equals(billsType)){
+            int year = DateUtil.year(warehouseBills.getfBsdate());
+            int month = DateUtil.month(warehouseBills.getfBsdate());
+            List<TMonthEndingClosingExcel> tMonthEndingClosingExcel = tWarehousebillsfeesMapper.selectTMonthEndingClosingList(year, month+1, "T");
+            if (CollectionUtils.isNotEmpty(tMonthEndingClosingExcel)){
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("当前入库日期所在的年月已结账不能入账");
+            }
+        }
         if (warehouseBills.getfId() == null) {
             String billNo = billnoSerialServiceImpl.getBillNo(billsType, warehouseBills.getfBsdate());
             warehouseBills.setfBillno(billNo);
@@ -1836,7 +1855,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                             return AjaxResult.error("出库数量大于库存数,库存不足");
                         }
                         this.anPinUpdateTWhgenlegData(warehousebillsfees,tWhgenleg.getfId(),billsType);
-
                     }
                 }
             }
@@ -2011,7 +2029,9 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     public List<ProfitExcel> salectAnpinProfit(TWarehouseBills tWarehouseBills) {
         List<ProfitExcel> profitExcels = tWarehousebillsfeesMapper.salectAnpinProfit(tWarehouseBills);
         //去重
-        List<ProfitExcel> collect = profitExcels.stream().distinct().collect(toList());
+        List<ProfitExcel> collect = profitExcels.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ProfitExcel -> ProfitExcel.getAbbreviated()
+                + ";"+ ProfitExcel.getAnnual()+ ";"+ ProfitExcel.getfCorpName()+ ";"+ ProfitExcel.getMarket()+ ";"+ ProfitExcel.getProfit()+ ";"+ ProfitExcel.getPurchase()
+        ))), ArrayList::new));
         return collect;
     }
 

+ 14 - 4
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -1183,7 +1183,7 @@
         AND tf.f_billstatus = 6
         <if test="fGoodsid != null  and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
-        <if test="years != null  and years != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{years}</if>
+        <if test="annual != null  and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
         <if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
             and DATE_FORMAT(tf.f_bsdate,'%m') &gt;= #{monthList[0]}
         </if>
@@ -1215,7 +1215,7 @@
         AND tf.f_billstatus = 6
         <if test="fGoodsid != null  and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
-        <if test="years != null  and years != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{years}</if>
+        <if test="annual != null  and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
         <if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
             and DATE_FORMAT(tf.f_bsdate,'%m') &gt;= #{monthList[0]}
         </if>
@@ -1270,7 +1270,7 @@
         AND tf.f_billstatus = 6
         <if test="fGoodsid != null  and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
-        <if test="years != null  and years != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{years}</if>
+        <if test="annual != null  and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
         <if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
             and DATE_FORMAT(tf.f_bsdate,'%m') &gt;= #{monthList[0]}
         </if>
@@ -1302,7 +1302,7 @@
         AND tf.f_billstatus = 6
         <if test="fGoodsid != null  and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
-        <if test="years != null  and years != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{years}</if>
+        <if test="annual != null  and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
         <if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
             and DATE_FORMAT(tf.f_bsdate,'%m') &gt;= #{monthList[0]}
         </if>
@@ -1324,4 +1324,14 @@
         ) AS temp
         ORDER BY temp.years,temp.months,CONVERT(temp.fCorpName USING GBK)
     </select>
+    <!--查询入库日期所在年月是否结账-->
+    <select id="selectTMonthEndingClosingList" parameterType="object" resultType="com.ruoyi.anpin.TMonthEndingClosingExcel">
+        select f_id, f_year, f_month, f_start, f_enf, f_status from t_month_ending_closing
+        <where>
+            <if test="fYear != null  and fYear != ''">and f_year = #{fYear}</if>
+            <if test="fMonth != null  and fMonth != ''">and f_month = #{fMonth}</if>
+            <if test="fStatus != null  and fStatus != ''">and f_status = #{fStatus}</if>
+        </where>
+        ORDER BY f_year,f_month
+    </select>
 </mapper>

BIN
ruoyi-warehouse/target/classes/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.class


BIN
ruoyi-warehouse/target/classes/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsfeesMapper.class


BIN
ruoyi-warehouse/target/classes/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.class


+ 13 - 4
ruoyi-warehouse/target/classes/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -1183,7 +1183,7 @@
         AND tf.f_billstatus = 6
         <if test="fGoodsid != null  and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
-        <if test="years != null  and years != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{years}</if>
+        <if test="annual != null  and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
         <if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
             and DATE_FORMAT(tf.f_bsdate,'%m') &gt;= #{monthList[0]}
         </if>
@@ -1215,7 +1215,7 @@
         AND tf.f_billstatus = 6
         <if test="fGoodsid != null  and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
-        <if test="years != null  and years != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{years}</if>
+        <if test="annual != null  and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
         <if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
             and DATE_FORMAT(tf.f_bsdate,'%m') &gt;= #{monthList[0]}
         </if>
@@ -1270,7 +1270,7 @@
         AND tf.f_billstatus = 6
         <if test="fGoodsid != null  and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
-        <if test="years != null  and years != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{years}</if>
+        <if test="annual != null  and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
         <if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
             and DATE_FORMAT(tf.f_bsdate,'%m') &gt;= #{monthList[0]}
         </if>
@@ -1302,7 +1302,7 @@
         AND tf.f_billstatus = 6
         <if test="fGoodsid != null  and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
-        <if test="years != null  and years != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{years}</if>
+        <if test="annual != null  and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
         <if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
             and DATE_FORMAT(tf.f_bsdate,'%m') &gt;= #{monthList[0]}
         </if>
@@ -1324,4 +1324,13 @@
         ) AS temp
         ORDER BY temp.years,temp.months,CONVERT(temp.fCorpName USING GBK)
     </select>
+    <select id="selectTMonthEndingClosingList" parameterType="object" resultType="com.ruoyi.anpin.TMonthEndingClosingExcel">
+        select f_id, f_year, f_month, f_start, f_enf, f_status from t_month_ending_closing
+        <where>
+            <if test="fYear != null  and fYear != ''">and f_year = #{fYear}</if>
+            <if test="fMonth != null  and fMonth != ''">and f_month = #{fMonth}</if>
+            <if test="fStatus != null  and fStatus != ''">and f_status = #{fStatus}</if>
+        </where>
+        ORDER BY f_year,f_month
+    </select>
 </mapper>