出入库统计接口
This commit is contained in:
@@ -2,6 +2,9 @@ package com.zg.project.wisdom.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zg.project.wisdom.domain.RkInfo;
|
||||
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -169,5 +172,12 @@ public class RkRecordController extends BaseController
|
||||
public AjaxResult statistic(@RequestBody RkRecord query) {
|
||||
return AjaxResult.success(rkRecordService.getRecordStatistic(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 出入库统计,返回总数
|
||||
*/
|
||||
@PostMapping("/statistics")
|
||||
public AjaxResult statistics(@RequestBody RkRecord query) {
|
||||
StockStatisticVO stockStatistic = rkRecordService.selectRecordStatisticByCondition(query);
|
||||
return AjaxResult.success(stockStatistic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ public class RkRecord extends BaseEntity
|
||||
/** 出入库类型 */
|
||||
// @Excel(name = "出入库类型")
|
||||
private String operationType;
|
||||
|
||||
// ====== 查询字段(新增)======
|
||||
private List<String> operationTypes;
|
||||
/** 出入库类型名称(联表) */
|
||||
@Excel(name = "出入库类型名称")
|
||||
private String operationTypeName;
|
||||
|
||||
@@ -149,4 +149,10 @@ public interface RkRecordMapper
|
||||
|
||||
int countPreOutRecordByBillNo(@Param("billNo") String billNo);
|
||||
|
||||
/**
|
||||
* 查询出入库
|
||||
* */
|
||||
StockStatisticVO selectRecordStatisticByCondition(RkRecord query);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zg.project.wisdom.service;
|
||||
import java.util.List;
|
||||
import com.zg.project.wisdom.domain.RkRecord;
|
||||
import com.zg.project.wisdom.domain.vo.RecordStatisticVO;
|
||||
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
||||
|
||||
/**
|
||||
* 出入库记录Service接口
|
||||
@@ -94,4 +95,8 @@ public interface IRkRecordService
|
||||
|
||||
|
||||
RecordStatisticVO getRecordStatistic(RkRecord query);
|
||||
/**
|
||||
* 出入库总数统计
|
||||
*/
|
||||
StockStatisticVO selectRecordStatisticByCondition(RkRecord query);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.zg.common.utils.StringUtils;
|
||||
import com.zg.project.wisdom.domain.GysJh;
|
||||
import com.zg.project.wisdom.domain.RkInfo;
|
||||
import com.zg.project.wisdom.domain.vo.RecordStatisticVO;
|
||||
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
||||
import com.zg.project.wisdom.mapper.GysJhMapper;
|
||||
import com.zg.project.wisdom.mapper.RkBillMapper;
|
||||
import com.zg.project.wisdom.mapper.RkInfoMapper;
|
||||
@@ -802,4 +803,10 @@ public class RkRecordServiceImpl implements IRkRecordService
|
||||
vo.setOutStatistic(rkRecordMapper.selectOutRecordStatistic(query));
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public StockStatisticVO selectRecordStatisticByCondition(RkRecord query) {
|
||||
return rkRecordMapper.selectRecordStatisticByCondition(query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,22 +581,25 @@
|
||||
|
||||
|
||||
<!-- 入库统计 -->
|
||||
<select id="selectInRecordStatistic"
|
||||
<select id="selectRecordStatisticByCondition"
|
||||
parameterType="com.zg.project.wisdom.domain.RkRecord"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticVO">
|
||||
|
||||
SELECT
|
||||
IFNULL(SUM(rr.real_qty * rr.ht_dj), 0) AS total_amount,
|
||||
COUNT(DISTINCT rr.pcode) AS location_count,
|
||||
IFNULL(SUM(rr.real_qty), 0) AS total_quantity
|
||||
IFNULL(SUM(rr.real_qty * rr.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT rr.pcode) AS locationCount,
|
||||
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity
|
||||
FROM rk_record rr
|
||||
<where>
|
||||
rr.is_delete = 0
|
||||
AND rr.exec_status = 1
|
||||
AND rr.biz_type = 0 <!-- 入库 -->
|
||||
|
||||
<if test="operationType != null and operationType != ''">
|
||||
AND rr.operation_type LIKE CONCAT('%', #{operationType}, '%')
|
||||
<if test="operationType != null and operationType.size() > 0">
|
||||
AND rr.operation_type IN
|
||||
<foreach collection="operationType" item="it" open="(" separator="," close=")">
|
||||
#{it}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND rr.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
||||
@@ -688,5 +691,72 @@
|
||||
WHERE id = #{id}
|
||||
AND is_delete = '0'
|
||||
</update>
|
||||
<select id="selectInOutStatisticByCondition"
|
||||
parameterType="com.zg.project.wisdom.domain.RkRecord"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticVO">
|
||||
|
||||
SELECT
|
||||
IFNULL(SUM(rr.real_qty * rr.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT rr.pcode) AS locationCount,
|
||||
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity
|
||||
FROM rk_record rr
|
||||
|
||||
<where>
|
||||
rr.exec_status = '1'
|
||||
AND rr.is_delete = '0'
|
||||
|
||||
<if test="operationType != null and operationType != ''">
|
||||
AND rr.operation_type LIKE CONCAT('%', #{operationType}, '%')
|
||||
</if>
|
||||
|
||||
<if test="wlType != null and wlType != ''">
|
||||
AND rr.wl_type LIKE CONCAT('%', #{wlType}, '%')
|
||||
</if>
|
||||
|
||||
<if test="cangku != null and cangku != ''">
|
||||
AND rr.cangku LIKE CONCAT('%', #{cangku}, '%')
|
||||
</if>
|
||||
|
||||
<if test="billNo != null and billNo != ''">
|
||||
AND rr.bill_no LIKE CONCAT('%', #{billNo}, '%')
|
||||
</if>
|
||||
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND rr.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
||||
</if>
|
||||
|
||||
<if test="xmMs != null and xmMs != ''">
|
||||
AND rr.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
|
||||
</if>
|
||||
|
||||
<if test="wlNo != null and wlNo != ''">
|
||||
AND rr.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
||||
</if>
|
||||
|
||||
<if test="wlMs != null and wlMs != ''">
|
||||
AND rr.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
|
||||
</if>
|
||||
|
||||
<if test="gysMc != null and gysMc != ''">
|
||||
AND rr.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
|
||||
</if>
|
||||
|
||||
<if test="sapNo != null and sapNo != ''">
|
||||
AND rr.sap_no LIKE CONCAT('%', #{sapNo}, '%')
|
||||
</if>
|
||||
|
||||
<if test="pcode != null and pcode != ''">
|
||||
AND rr.pcode LIKE CONCAT('%', #{pcode}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 时间:建议用 “< endDate+1天” 防止漏当天 -->
|
||||
<if test="startDate != null">
|
||||
AND rr.operation_time >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND rr.operation_time < DATE_ADD(#{endDate}, INTERVAL 1 DAY)
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user