首页统计接口修改
配送修改状态修改
This commit is contained in:
@@ -50,6 +50,7 @@ public class RkBillController extends BaseController
|
|||||||
List<RkBill> list = rkBillService.selectRkBillList(rkBill);
|
List<RkBill> list = rkBillService.selectRkBillList(rkBill);
|
||||||
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.zg.project.wisdom.domain.RkInfo;
|
import com.zg.project.wisdom.domain.RkInfo;
|
||||||
|
import com.zg.project.wisdom.domain.dto.RkDeliveryUpdateDTO;
|
||||||
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -173,4 +174,22 @@ public class RkRecordController extends BaseController
|
|||||||
StockStatisticVO stockStatistic = rkRecordService.selectRecordStatisticByCondition(query);
|
StockStatisticVO stockStatistic = rkRecordService.selectRecordStatisticByCondition(query);
|
||||||
return AjaxResult.success(stockStatistic);
|
return AjaxResult.success(stockStatistic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新配送状态
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateDeliveryStatus")
|
||||||
|
@Log(title = "更新配送状态", businessType = BusinessType.UPDATE)
|
||||||
|
public AjaxResult updateDeliveryStatus(@RequestBody RkDeliveryUpdateDTO dto) {
|
||||||
|
|
||||||
|
if (dto.getIds() == null || dto.getIds().isEmpty()) {
|
||||||
|
return AjaxResult.error("rk_record 主键ID集合不能为空");
|
||||||
|
}
|
||||||
|
if (dto.getIsDelivery() == null) {
|
||||||
|
return AjaxResult.error("配送状态不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
int rows = rkRecordService.updateDeliveryStatus(dto.getIds(), dto.getIsDelivery());
|
||||||
|
return AjaxResult.success(rows);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,26 @@ public class RkStatisticsController {
|
|||||||
public AjaxResult home(@RequestBody(required = false) HomeStatQueryDTO query) {
|
public AjaxResult home(@RequestBody(required = false) HomeStatQueryDTO query) {
|
||||||
return AjaxResult.success(rkStatisticsService.getHomeStatistics(query));
|
return AjaxResult.success(rkStatisticsService.getHomeStatistics(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按时间查询【入库类型】统计
|
||||||
|
*/
|
||||||
|
@ApiOperation("按时间查询入库类型统计")
|
||||||
|
@PostMapping("/inTypeByTime")
|
||||||
|
public AjaxResult inTypeByTime(@RequestBody HomeStatQueryDTO query) {
|
||||||
|
return AjaxResult.success(rkStatisticsService.getInTypeByTime(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按时间查询【出库类型】统计
|
||||||
|
*/
|
||||||
|
@ApiOperation("按时间查询出库类型统计")
|
||||||
|
@PostMapping("/outTypeByTime")
|
||||||
|
public AjaxResult outTypeByTime(@RequestBody HomeStatQueryDTO query) {
|
||||||
|
return AjaxResult.success(rkStatisticsService.getOutTypeByTime(query));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页统计,库龄统计
|
* 首页统计,库龄统计
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ public class RkBill extends BaseEntity {
|
|||||||
@Excel(name = "施工队名称")
|
@Excel(name = "施工队名称")
|
||||||
private String teamName;
|
private String teamName;
|
||||||
|
|
||||||
/** 是否需要配送(0否,1是,2配送中,3配送完成) */
|
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||||
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=配送中,3=配送完成")
|
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=已接单,3=配送中,4=配送完成")
|
||||||
private String isDelivery;
|
private String isDelivery;
|
||||||
|
|
||||||
/** 借用时间 */
|
/** 借用时间 */
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ public class RkInfo extends BaseEntity
|
|||||||
/** sid */
|
/** sid */
|
||||||
private Long sid;
|
private Long sid;
|
||||||
|
|
||||||
/** 是否需要配送(0否,1是,2配送中,3配送完成) */
|
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||||
@Excel(name = "是否需要配送", readConverterExp = "0否,1是,2配送中,3配送完成")
|
@Excel(name = "是否需要配送", readConverterExp = "0否,1是,2配送中,3配送完成")
|
||||||
private String isDelivery;
|
private String isDelivery;
|
||||||
|
|
||||||
|
|||||||
@@ -238,8 +238,8 @@ public class RkRecord extends BaseEntity
|
|||||||
// @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
// @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
private Long sid;
|
private Long sid;
|
||||||
|
|
||||||
/** 是否需要配送(0否,1是,2配送中,3配送完成) */
|
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||||
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=配送中,3=配送完成")
|
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=已接单,3=配送中,4=配送完成")
|
||||||
private String isDelivery;
|
private String isDelivery;
|
||||||
/** 封样编号1 */
|
/** 封样编号1 */
|
||||||
// @Excel(name = "封样编号1")
|
// @Excel(name = "封样编号1")
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ public class RkDeliveryUpdateDTO {
|
|||||||
/** rk_info 主键ID集合 */
|
/** rk_info 主键ID集合 */
|
||||||
private List<Long> ids;
|
private List<Long> ids;
|
||||||
|
|
||||||
/** 配送状态:0否 1是 2配送中 3已完成 */
|
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||||
private Integer isDelivery;
|
private Integer isDelivery;
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ public class DeliveryBillVO implements Serializable {
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date operationTime;
|
private Date operationTime;
|
||||||
|
|
||||||
/** 是否需要配送(0否,1是,2配送中,3配送完成) */
|
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||||
private String isDelivery;
|
private String isDelivery;
|
||||||
|
|
||||||
/** 该单据下的货物明细 */
|
/** 该单据下的货物明细 */
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ public class StockStatisticGroupVO {
|
|||||||
/** 分组值(类型编码,如 operation_type / wl_type) */
|
/** 分组值(类型编码,如 operation_type / wl_type) */
|
||||||
private String groupValue;
|
private String groupValue;
|
||||||
|
|
||||||
|
/** 分组名称(类型编码,如 operation_type / wl_type) */
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
/** 总金额 */
|
/** 总金额 */
|
||||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
|
|||||||
@@ -86,4 +86,13 @@ public interface RkBillMapper
|
|||||||
*/
|
*/
|
||||||
int updateExecStatus(@Param("billNo") String billNo,
|
int updateExecStatus(@Param("billNo") String billNo,
|
||||||
@Param("execStatus") String execStatus);
|
@Param("execStatus") String execStatus);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配送状态
|
||||||
|
* @param billNo
|
||||||
|
* @param isDelivery
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateDeliveryStatusByBillNo(@Param("billNo") String billNo,
|
||||||
|
@Param("isDelivery") Integer isDelivery);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,4 +149,22 @@ public interface RkRecordMapper
|
|||||||
* 根据单据号查询出入库记录
|
* 根据单据号查询出入库记录
|
||||||
* */
|
* */
|
||||||
List<RkRecord> selectByBillNo(String billNo);
|
List<RkRecord> selectByBillNo(String billNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改发货状态
|
||||||
|
* */
|
||||||
|
int updateDeliveryStatus(@Param("ids") List<Long> ids,
|
||||||
|
@Param("isDelivery") Integer isDelivery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID列表查询单据号列表
|
||||||
|
* */
|
||||||
|
List<String> selectBillNosByRecordIds(@Param("ids") List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询该 bill 下 与目标状态不同的记录数
|
||||||
|
*/
|
||||||
|
int countDifferentDeliveryStatus(@Param("billNo") String billNo,
|
||||||
|
@Param("isDelivery") Integer isDelivery);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,4 +97,9 @@ public interface IRkRecordService
|
|||||||
* 出入库总数统计
|
* 出入库总数统计
|
||||||
*/
|
*/
|
||||||
StockStatisticVO selectRecordStatisticByCondition(RkRecord query);
|
StockStatisticVO selectRecordStatisticByCondition(RkRecord query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改指定入库记录的配送状态
|
||||||
|
*/
|
||||||
|
int updateDeliveryStatus(List<Long> ids, Integer isDelivery);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,16 @@ public interface RkStatisticsService {
|
|||||||
*/
|
*/
|
||||||
HomeStatVO getHomeStatistics(HomeStatQueryDTO query);
|
HomeStatVO getHomeStatistics(HomeStatQueryDTO query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按时间查询入库类型统计
|
||||||
|
*/
|
||||||
|
List<StockStatisticGroupVO> getInTypeByTime(HomeStatQueryDTO query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按时间查询出库类型统计
|
||||||
|
*/
|
||||||
|
List<StockStatisticGroupVO> getOutTypeByTime(HomeStatQueryDTO query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页库龄统计接口
|
* 首页库龄统计接口
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -801,4 +801,38 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
public StockStatisticVO selectRecordStatisticByCondition(RkRecord query) {
|
public StockStatisticVO selectRecordStatisticByCondition(RkRecord query) {
|
||||||
return rkRecordMapper.selectRecordStatisticByCondition(query);
|
return rkRecordMapper.selectRecordStatisticByCondition(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int updateDeliveryStatus(List<Long> ids, Integer isDelivery) {
|
||||||
|
|
||||||
|
if (ids == null || ids.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 先更新 record
|
||||||
|
int rows = rkRecordMapper.updateDeliveryStatus(ids, isDelivery);
|
||||||
|
|
||||||
|
// 2. 找到受影响的 billNo
|
||||||
|
List<String> billNos = rkRecordMapper.selectBillNosByRecordIds(ids);
|
||||||
|
if (billNos == null || billNos.isEmpty()) {
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 对每个 bill 判断是否可以更新
|
||||||
|
for (String billNo : billNos) {
|
||||||
|
|
||||||
|
// 3.1 查询该 bill 下是否还存在“不同状态”的 record
|
||||||
|
int diffCount = rkRecordMapper.countDifferentDeliveryStatus(billNo, isDelivery);
|
||||||
|
|
||||||
|
// 只有“全部一致”时才改 bill
|
||||||
|
if (diffCount == 0) {
|
||||||
|
rkBillMapper.updateDeliveryStatusByBillNo(billNo, isDelivery);
|
||||||
|
}
|
||||||
|
// 否则:保持原状态(不动)
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,14 +28,26 @@ public class RkStatisticsServiceImpl implements RkStatisticsService {
|
|||||||
vo.setCurrentInType(rkStatisticsMapper.statCurrentInByOperationType());
|
vo.setCurrentInType(rkStatisticsMapper.statCurrentInByOperationType());
|
||||||
vo.setMaterialType(rkStatisticsMapper.statCurrentByMaterialType());
|
vo.setMaterialType(rkStatisticsMapper.statCurrentByMaterialType());
|
||||||
|
|
||||||
// ========== 3. 时间维度统计 ==========
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StockStatisticGroupVO> getInTypeByTime(HomeStatQueryDTO query) {
|
||||||
|
|
||||||
Date start = query == null ? null : query.getStartDate();
|
Date start = query == null ? null : query.getStartDate();
|
||||||
Date end = query == null ? null : query.getEndDate();
|
Date end = query == null ? null : query.getEndDate();
|
||||||
|
|
||||||
vo.setInTypeByTime(rkStatisticsMapper.statInByOperationType(start, end));
|
return rkStatisticsMapper.statInByOperationType(start, end);
|
||||||
vo.setOutTypeByTime(rkStatisticsMapper.statOutByOperationType(start, end));
|
}
|
||||||
|
|
||||||
return vo;
|
@Override
|
||||||
|
public List<StockStatisticGroupVO> getOutTypeByTime(HomeStatQueryDTO query) {
|
||||||
|
|
||||||
|
Date start = query == null ? null : query.getStartDate();
|
||||||
|
Date end = query == null ? null : query.getEndDate();
|
||||||
|
|
||||||
|
return rkStatisticsMapper.statOutByOperationType(start, end);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 首页库龄统计接口
|
* 首页库龄统计接口
|
||||||
|
|||||||
@@ -303,4 +303,11 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<update id="updateDeliveryStatusByBillNo">
|
||||||
|
UPDATE rk_bill
|
||||||
|
SET is_delivery = #{isDelivery},
|
||||||
|
update_time = NOW()
|
||||||
|
WHERE bill_no = #{billNo}
|
||||||
|
AND is_delete = '0'
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -658,6 +658,7 @@
|
|||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
AND is_delete = '0'
|
AND is_delete = '0'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectInOutStatisticByCondition"
|
<select id="selectInOutStatisticByCondition"
|
||||||
parameterType="com.zg.project.wisdom.domain.RkRecord"
|
parameterType="com.zg.project.wisdom.domain.RkRecord"
|
||||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticVO">
|
resultType="com.zg.project.wisdom.domain.vo.StockStatisticVO">
|
||||||
@@ -735,4 +736,37 @@
|
|||||||
AND is_delete = '0'
|
AND is_delete = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 修改 record 状态 -->
|
||||||
|
<update id="updateDeliveryStatus">
|
||||||
|
UPDATE rk_record
|
||||||
|
SET is_delivery = #{isDelivery},
|
||||||
|
update_time = NOW()
|
||||||
|
WHERE is_delete = '0'
|
||||||
|
AND id IN
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 找到受影响的 bill -->
|
||||||
|
<select id="selectBillNosByRecordIds" resultType="string">
|
||||||
|
SELECT DISTINCT bill_no
|
||||||
|
FROM rk_record
|
||||||
|
WHERE id IN
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
AND is_delete = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 统计不同状态数量 -->
|
||||||
|
<select id="countDifferentDeliveryStatus" resultType="int">
|
||||||
|
SELECT COUNT(1)
|
||||||
|
FROM rk_record
|
||||||
|
WHERE bill_no = #{billNo}
|
||||||
|
AND is_delete = '0'
|
||||||
|
AND is_delivery != #{isDelivery}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -5,112 +5,165 @@
|
|||||||
<!-- 当前入库类型统计 -->
|
<!-- 当前入库类型统计 -->
|
||||||
<select id="statCurrentInByOperationType"
|
<select id="statCurrentInByOperationType"
|
||||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
ri.operation_type AS groupValue,
|
ri.operation_type AS groupValue,
|
||||||
|
sit.type_name AS groupName,
|
||||||
|
|
||||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||||
|
|
||||||
FROM rk_info ri
|
FROM rk_info ri
|
||||||
|
LEFT JOIN stock_in_type sit
|
||||||
|
ON sit.type_code = ri.operation_type
|
||||||
|
AND sit.status = 1
|
||||||
|
|
||||||
WHERE ri.exec_status = 1
|
WHERE ri.exec_status = 1
|
||||||
AND ri.is_chuku = 0
|
AND ri.is_chuku = 0
|
||||||
AND ri.is_delete = 0
|
AND ri.is_delete = 0
|
||||||
GROUP BY ri.operation_type
|
|
||||||
|
GROUP BY ri.operation_type, sit.type_name
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 当前物资类型统计 -->
|
<!-- 当前物资类型统计 -->
|
||||||
<select id="statCurrentByMaterialType"
|
<select id="statCurrentByMaterialType"
|
||||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
ri.wl_type AS groupValue,
|
ri.wl_type AS groupValue,
|
||||||
|
mt.type_name AS groupName,
|
||||||
|
|
||||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||||
|
|
||||||
FROM rk_info ri
|
FROM rk_info ri
|
||||||
|
LEFT JOIN material_type mt
|
||||||
|
ON mt.type_code = ri.wl_type
|
||||||
|
AND mt.status = 1
|
||||||
|
|
||||||
WHERE ri.exec_status = 1
|
WHERE ri.exec_status = 1
|
||||||
AND ri.is_chuku = 0
|
AND ri.is_chuku = 0
|
||||||
AND ri.is_delete = 0
|
AND ri.is_delete = 0
|
||||||
GROUP BY ri.wl_type
|
|
||||||
|
GROUP BY ri.wl_type, mt.type_name
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<!-- 入库类型统计(时间) -->
|
<!-- 入库类型统计(时间) -->
|
||||||
<select id="statInByOperationType"
|
<select id="statInByOperationType"
|
||||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
ri.operation_type AS groupValue,
|
ri.operation_type AS groupValue,
|
||||||
|
sit.type_name AS groupName,
|
||||||
|
|
||||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||||
|
|
||||||
FROM rk_info ri
|
FROM rk_info ri
|
||||||
|
LEFT JOIN stock_in_type sit
|
||||||
|
ON sit.type_code = ri.operation_type
|
||||||
|
AND sit.status = 1
|
||||||
|
|
||||||
WHERE ri.exec_status = 1
|
WHERE ri.exec_status = 1
|
||||||
AND ri.is_chuku = 0
|
AND ri.is_chuku = 0
|
||||||
AND ri.is_delete = 0
|
AND ri.is_delete = 0
|
||||||
|
|
||||||
<if test="startDate != null">
|
<if test="startDate != null">
|
||||||
AND ri.operation_time <![CDATA[>=]]> #{startDate}
|
AND ri.operation_time <![CDATA[>=]]> #{startDate}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="endDate != null">
|
<if test="endDate != null">
|
||||||
AND ri.operation_time <![CDATA[<=]]> #{endDate}
|
AND ri.operation_time <![CDATA[<=]]> #{endDate}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY ri.operation_type
|
|
||||||
|
GROUP BY ri.operation_type, sit.type_name
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 出库类型统计(时间) -->
|
<!-- 出库类型统计(时间) -->
|
||||||
<select id="statOutByOperationType"
|
<select id="statOutByOperationType"
|
||||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
ri.operation_type AS groupValue,
|
rr.operation_type AS groupValue,
|
||||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
|
||||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
sot.type_name AS groupName,
|
||||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
|
||||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
IFNULL(SUM(rr.real_qty * rr.ht_dj), 0) AS totalAmount,
|
||||||
FROM rk_info ri
|
|
||||||
WHERE ri.exec_status = 1
|
COUNT(DISTINCT rr.pcode) AS locationCount,
|
||||||
AND ri.is_chuku = 1
|
|
||||||
AND ri.is_delete = 0
|
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity,
|
||||||
|
|
||||||
|
COUNT(DISTINCT rr.xm_no) AS projectCount
|
||||||
|
|
||||||
|
FROM rk_record rr
|
||||||
|
|
||||||
|
LEFT JOIN stock_out_type sot
|
||||||
|
ON sot.type_code = rr.operation_type
|
||||||
|
AND sot.is_delete = '0'
|
||||||
|
|
||||||
|
WHERE rr.exec_status = '1'
|
||||||
|
AND rr.biz_type = '1' <!-- 出库 -->
|
||||||
|
AND rr.is_delete = '0'
|
||||||
|
|
||||||
<if test="startDate != null">
|
<if test="startDate != null">
|
||||||
AND ri.operation_time <![CDATA[>=]]> #{startDate}
|
AND rr.operation_time <![CDATA[>=]]> #{startDate}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="endDate != null">
|
<if test="endDate != null">
|
||||||
AND ri.operation_time <![CDATA[<=]]> #{endDate}
|
AND rr.operation_time <![CDATA[<=]]> #{endDate}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY ri.operation_type
|
|
||||||
|
GROUP BY rr.operation_type, sot.type_name
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="statHomeKpi"
|
<select id="statHomeKpi"
|
||||||
resultType="com.zg.project.wisdom.domain.vo.HomeKpiVO">
|
resultType="com.zg.project.wisdom.domain.vo.HomeKpiVO">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
/* 月入库 */
|
/* ===== 月入库 ===== */
|
||||||
COUNT(CASE WHEN ri.is_chuku = 0
|
COUNT(CASE WHEN rr.biz_type = '0'
|
||||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||||
THEN 1 END) AS monthInCount,
|
THEN 1 END) AS monthInCount,
|
||||||
|
|
||||||
COUNT(DISTINCT CASE WHEN ri.is_chuku = 0
|
COUNT(DISTINCT CASE WHEN rr.biz_type = '0'
|
||||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||||
THEN ri.xm_no END) AS monthInProjectCount,
|
THEN rr.xm_no END) AS monthInProjectCount,
|
||||||
|
|
||||||
IFNULL(SUM(CASE WHEN ri.is_chuku = 0
|
IFNULL(SUM(CASE WHEN rr.biz_type = '0'
|
||||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||||
THEN ri.real_qty * ri.ht_dj END),0) AS monthInAmount,
|
THEN rr.real_qty * rr.ht_dj END),0) AS monthInAmount,
|
||||||
|
|
||||||
/* 月出库 */
|
/* ===== 月出库 ===== */
|
||||||
COUNT(CASE WHEN ri.is_chuku = 1
|
COUNT(CASE WHEN rr.biz_type = '1'
|
||||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||||
THEN 1 END) AS monthOutCount,
|
THEN 1 END) AS monthOutCount,
|
||||||
|
|
||||||
COUNT(DISTINCT CASE WHEN ri.is_chuku = 1
|
COUNT(DISTINCT CASE WHEN rr.biz_type = '1'
|
||||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||||
THEN ri.xm_no END) AS monthOutProjectCount,
|
THEN rr.xm_no END) AS monthOutProjectCount,
|
||||||
|
|
||||||
|
IFNULL(SUM(CASE WHEN rr.biz_type = '1'
|
||||||
|
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||||
|
THEN rr.real_qty * rr.ht_dj END),0) AS monthOutAmount
|
||||||
|
|
||||||
|
FROM rk_record rr
|
||||||
|
WHERE rr.exec_status = '1'
|
||||||
|
AND rr.is_delete = '0'
|
||||||
|
|
||||||
IFNULL(SUM(CASE WHEN ri.is_chuku = 1
|
|
||||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
|
||||||
THEN ri.real_qty * ri.ht_dj END),0) AS monthOutAmount
|
|
||||||
FROM rk_info ri
|
|
||||||
WHERE ri.exec_status = 1
|
|
||||||
AND ri.is_delete = 0
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectStockAgeStat" resultType="com.zg.project.wisdom.domain.vo.StockAgeStatVO">
|
<select id="selectStockAgeStat" resultType="com.zg.project.wisdom.domain.vo.StockAgeStatVO">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
SELECT '10-20天' AS name, COUNT(*) AS value
|
SELECT '10-20天' AS name, COUNT(*) AS value
|
||||||
|
|||||||
Reference in New Issue
Block a user