bug优化1209

This commit is contained in:
2025-12-09 15:54:39 +08:00
parent 2c21c1560e
commit b7434d71df
11 changed files with 117 additions and 38 deletions

View File

@@ -57,6 +57,7 @@ public class PhotoController {
* 与多图参数一致,只是文件字段为 file
* 返回:单张图片的可访问 URL
*/
// @PostMapping(value = "/upload", consumes = "multipart/form-data")
// public AjaxResult upload(@RequestPart("file") MultipartFile file,
// @RequestParam("photoType") String photoType,

View File

@@ -58,8 +58,6 @@ public class RkInfoController extends BaseController
return AjaxResult.success(rows);
}
@ApiOperation("按单据分组bill_no列表若存在出库则同时返回 bill_no_ck")
// @PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
@PostMapping("/bill/groups")
public TableDataInfo billGroups(@RequestBody RkInfoQueryDTO query) {
@@ -263,10 +261,6 @@ public class RkInfoController extends BaseController
@PostMapping("/pageStatistics")
public Map<String, Object> pageStatistics(@RequestBody(required = false) RkInfoQueryDTO dto) {
if (dto == null) {
dto = new RkInfoQueryDTO();
}
// 使用 PageHelper 分页
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
List<RkInfo> list = rkInfoService.selectAllRkInfo(dto);

View File

@@ -79,8 +79,8 @@ public class GysJh extends BaseEntity
@Excel(name = "计量单位")
private String dw;
/** 0未到货1已入库 */
@Excel(name = "0未到货1已入库")
/** 0未到货1已入库2部分入库 */
@Excel(name = "0未到货1已入库2部分入库")
private String status;
/** 身份码 */

View File

@@ -233,12 +233,12 @@ public class RkInfo extends BaseEntity
@TableField(exist = false)
private String auditResult;
/** 入库开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startTime;
/** 入库结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endTime;
/** 领用开始时间 */

View File

@@ -1,8 +1,11 @@
package com.zg.project.wisdom.domain.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zg.project.wisdom.domain.RkInfo;
import lombok.Data;
import java.util.Date;
/**
* 库存单据分页查询 DTO
* 继承 RkInfo额外加分页参数
@@ -15,4 +18,12 @@ public class RkInfoQueryDTO extends RkInfo {
/** 每页条数 */
private Integer pageSize;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date statDate;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endDate;
}

View File

@@ -226,6 +226,7 @@ public interface RkInfoMapper
* 查询 rk_info 全量明细(仅未删除)
*/
List<RkInfo> selectAllRkInfo(RkInfo query);
Long selectStatistics(RkInfo query);
Long selectPcde(RkInfo query);

View File

@@ -7,9 +7,9 @@ spring:
# 主库数据源
master:
# url: jdbc:mysql://101.132.133.142:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.28:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.1.28:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.192:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: shzg

View File

@@ -4,7 +4,6 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.information.mapper.PcdeDetailMapper">
<resultMap type="PcdeDetail" id="PcdeDetailResult">
<result property="id" column="id"/>
<result property="pcode" column="pcode"/>
@@ -36,16 +35,21 @@
<where>
<if test="pcode != null and pcode != ''">and d.pcode = #{pcode}</if>
<if test="scene != null and scene != ''">and d.scene = #{scene}</if>
<if test="warehouse != null and warehouse != ''">and d.warehouse = #{warehouse}</if>
<if test="warehouseName != null and warehouseName != ''">
and w.warehouse_name like concat('%', #{warehouseName}, '%')
</if>
<if test="warehouse != null and warehouse != ''">
and d.warehouse = #{warehouse}
</if>
<if test="encodedId != null and encodedId != ''">and d.encoded_id = #{encodedId}</if>
<if test="tag != null and tag != ''">and d.tag = #{tag}</if>
<if test="isDelete != null">and d.is_delete = #{isDelete}</if>
<if test="createdBy != null and createdBy != ''">and d.created_by = #{createdBy}</if>
<if test="createdAt != null">and d.created_at = #{createdAt}</if>
<if test="updatedBy != null and updatedBy != ''">and d.updated_by = #{updatedBy}</if>
<if test="updatedAt != null">and d.updated_at = #{updatedAt}</if>
</where>
</select>
<select id="selectPcdeDetailListIds" parameterType="PcdeDetail" resultMap="PcdeDetailResult">
<include refid="selectPcdeDetailVo"/>
<where>
@@ -156,7 +160,6 @@
</foreach>
</insert>
<delete id="deletePcdeDetailById" parameterType="Long">
delete from pcde_detail where id = #{id}
</delete>

View File

@@ -56,7 +56,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sapNo != null and sapNo != ''">
and sap_no like concat('%', #{sapNo}, '%')
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
and (status is null or trim(status) != '1')
<if test="isDelete != null and isDelete != ''">

View File

@@ -99,6 +99,15 @@
<if test="entityId != null and entityId != ''">
AND mr.entity_id = #{entityId}
</if>
<if test="toCangku != null and toCangku != ''">
AND mr.to_cangku = #{toCangku}
</if>
<if test="fromCangku != null and fromCangku != ''">
AND mr.from_cangku = #{fromCangku}
</if>
<if test="xmNo != null and xmNo != ''">
AND rk.xm_no = #{xmNo}
</if>
<if test="moveReason != null and moveReason != ''">
AND mr.move_reason LIKE concat('%', #{moveReason}, '%')
</if>

View File

@@ -62,7 +62,7 @@
<result property="isDelivery" column="is_delivery"/>
</resultMap>
<!-- 明细查询SQL包含多表JOIN用于普通明细/分页等) -->
<!-- 明细查询SQL包含多表JOIN用于普通明<EFBFBD>?分页等) -->
<sql id="selectRkInfoVo">
SELECT
ri.id,
@@ -203,6 +203,7 @@
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
<where>
<!-- is_chuku 多状态 / 单状态 -->
<choose>
<when test="isChukuList != null and isChukuList.size > 0">
AND ri.is_chuku IN
@@ -215,6 +216,7 @@
</when>
</choose>
<!-- 关键字搜索 -->
<if test="keyword != null and keyword != ''">
AND (
ri.xm_no like concat('%', #{keyword}, '%')
@@ -248,6 +250,7 @@
<if test="fycde2 != null and fycde2 != ''">
AND ri.fycde_2 like concat('%', #{fycde2}, '%')
</if>
<if test="ids != null and ids.size > 0">
AND ri.id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -255,13 +258,55 @@
</foreach>
</if>
<if test="startTime != null">
<![CDATA[ AND ri.rk_time >= #{startTime} ]]>
</if>
<if test="endTime != null">
<![CDATA[ AND ri.rk_time <= #{endTime} ]]>
<!-- ★★ 先按是否借料过滤行0 否1 借料中2 已归还 ★★ -->
<if test="isBorrowed != null and isBorrowed != ''">
AND ri.is_borrowed = #{isBorrowed}
</if>
<!-- ★★ 时间范围逻辑 ★★ -->
<!-- 1普通库存isBorrowed 为空):按入库时间 rk_time -->
<if test="(isBorrowed == null or isBorrowed == '')">
<if test="startTime != null">
<![CDATA[
AND ri.rk_time >= #{startTime}
]]>
</if>
<if test="endTime != null">
<![CDATA[
AND ri.rk_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
]]>
</if>
</if>
<!-- 2借料中按借用时间 borrow_time -->
<if test="isBorrowed == '1'">
<if test="startTime != null">
<![CDATA[
AND ri.borrow_time >= #{startTime}
]]>
</if>
<if test="endTime != null">
<![CDATA[
AND ri.borrow_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
]]>
</if>
</if>
<!-- 3已归还按归还时间 return_time -->
<if test="isBorrowed == '2'">
<if test="startTime != null">
<![CDATA[
AND ri.return_time >= #{startTime}
]]>
</if>
<if test="endTime != null">
<![CDATA[
AND ri.return_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
]]>
</if>
</if>
<!-- 领用时间范围(原有逻辑,保留) -->
<if test="lyStartTime != null">
<![CDATA[ AND ri.ly_time >= #{lyStartTime} ]]>
</if>
@@ -354,11 +399,11 @@
</otherwise>
</choose>
</where>
ORDER BY ri.rk_time DESC
</select>
<!-- ================== 这里是已优化的按单据分组查询(替换旧版本) ================== -->
<!-- ================== 这里是已优化的按单据分组查询替换旧版本<E78988>?================== -->
<select id="selectGroupedByBill" resultMap="RkInfoResult" parameterType="map">
SELECT
a.id,
@@ -508,12 +553,13 @@
<if test="q.gysMc != null and q.gysMc != ''"> AND t.gys_mc LIKE concat('%', #{q.gysMc}, '%') </if>
<if test="q.sapNo != null and q.sapNo != ''"> AND t.sap_no LIKE concat('%', #{q.sapNo}, '%') </if>
<if test="q.pcode != null and q.pcode != ''"> AND t.pcode LIKE concat('%', #{q.pcode}, '%') </if>
<if test="q.ckType != null and q.ckType != ''"> AND t.ck_type LIKE concat('%', #{q.ckType}, '%') </if>
<if test="q.isDelivery != null and q.isDelivery != ''">
AND t.is_delivery = #{q.isDelivery}
</if>
<!-- 出库才要bill_no_ck 非空 -->
<!-- 出库才要<EFBFBD>?bill_no_ck 非空 -->
<if test="(q.isChuku != null and q.isChuku == '1')
or (q.isChukuList != null and q.isChukuList.size > 0 and q.isChukuList.contains('1'))">
AND t.bill_no_ck IS NOT NULL
@@ -543,7 +589,7 @@
ORDER BY a.rk_time DESC
</select>
<!-- ================== /按单据分组查================== -->
<!-- ================== /按单据分组查<EFBFBD>?================== -->
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
@@ -590,7 +636,7 @@
WHERE bill_no = #{billNo} AND sap_no IS NOT NULL
</select>
<!-- 正常数据:扫描到的库位(限定场景 -->
<!-- 正常数据:扫描到的库位(限定场景<EFBFBD>?-->
<select id="getByPcodeIdList" parameterType="map" resultMap="RkInfoResult">
SELECT
ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y,
@@ -613,7 +659,7 @@
</foreach>
</select>
<!-- 未扫描到的数据(限定场景 -->
<!-- 未扫描到的数据(限定场景<EFBFBD>?-->
<select id="getMissedPcodeIds" parameterType="map" resultMap="RkInfoResult">
SELECT
ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y,
@@ -918,7 +964,6 @@
ORDER BY t.rk_time DESC, t.id DESC
</select>
<!-- 分页查询 rk_info 全量明细(支持 keyword 模糊过滤) -->
<select id="selectAllRkInfo"
parameterType="com.zg.project.wisdom.domain.RkInfo"
resultMap="RkInfoResult">
@@ -940,7 +985,18 @@
<if test="endTime != null">
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test="statDate != null">
AND ri.return_time <![CDATA[ >= ]]> #{statDate}
</if>
<if test="endDate != null">
AND ri.return_time <![CDATA[ <= ]]> #{endDate}
</if>
<if test="rkType != null and rkType != ''">
AND ri.rk_type = #{rkType}
</if>
<if test="wlType != null and wlType != ''">
AND ri.wl_type = #{wlType}
</if>
<if test="lyStartTime != null">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if>
@@ -992,7 +1048,7 @@
</select>
<select id="selectStatistics" resultType="java.lang.Long" parameterType="java.lang.Object" >
SELECT sum(ri.ht_dj*ri.real_qty)
SELECT sum(ri.ht_dj * ri.real_qty)
FROM rk_info ri
<where>
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
@@ -1004,7 +1060,9 @@
<if test="cangku != null and cangku != ''">
AND ri.cangku = #{cangku}
</if>
<if test="rkType != null and rkType != ''">
AND ri.rk_type = #{rkType}
</if>
<if test="startTime != null">
AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
</if>