导出文件格式问题以及查询出入库问题

This commit is contained in:
2026-02-13 10:32:00 +08:00
parent 219e23c194
commit 56e4514ee8
2 changed files with 136 additions and 13 deletions

View File

@@ -1244,6 +1244,25 @@ public class ExcelUtil<T>
}
else
{
if (value instanceof String)
{
String str = (String) value;
if ("sapNo".equals(field.getName() )
&& str.matches("^\\d{1,15}$"))
{
cell.setCellValue(Double.parseDouble(str));
// 设置为数字格式
CellStyle numStyle = wb.createCellStyle();
numStyle.cloneStyleFrom(cell.getCellStyle());
numStyle.setDataFormat(wb.createDataFormat().getFormat("0"));
cell.setCellStyle(numStyle);
addStatisticsData(column, str, attr);
return cell;
}
}
// 设置列类型
setCellVo(value, attr, cell);
}

View File

@@ -598,36 +598,140 @@
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity
FROM rk_record rr
<where>
rr.is_delete = 0
AND rr.exec_status = 1
<!-- 已修复String 不可用 size() -->
AND rr.exec_status = '1'
<if test="operationType != null and operationType != ''">
AND rr.operation_type = #{operationType}
</if>
<if test="xmNo != null and xmNo != ''">
AND rr.xm_no LIKE CONCAT('%', #{xmNo}, '%')
<!-- 多 bizType -->
<if test="bizTypeList != null and bizTypeList.size > 0">
AND rr.biz_type IN
<foreach collection="bizTypeList"
item="bt"
open="("
separator=","
close=")">
#{bt}
</foreach>
</if>
<if test="wlNo != null and wlNo != ''">
AND rr.wl_no LIKE CONCAT('%', #{wlNo}, '%')
<if test="bizType != null and bizType != ''">
AND rr.biz_type = #{bizType}
</if>
<if test="pcode != null and pcode != ''">
AND rr.pcode LIKE CONCAT('%', #{pcode}, '%')
AND rr.pcode = #{pcode}
</if>
<if test="wlType != null and wlType != ''">
AND rr.wl_type = #{wlType}
</if>
<if test="cangku != null and cangku != ''">
AND rr.cangku LIKE CONCAT('%', #{cangku}, '%')
AND rr.cangku = #{cangku}
</if>
<if test="startDate != null">
AND rr.operation_time &gt;= #{startDate}
<if test="operator != null and operator != ''">
AND rr.operator = #{operator}
</if>
<if test="endDate != null">
AND rr.operation_time &lt;= #{endDate}
<if test="isChuku != null and isChuku != ''">
AND rr.is_chuku = #{isChuku}
</if>
<if test="status != null and status != ''">
AND rr.status = #{status}
</if>
<if test="execStatus != null and execStatus != ''">
AND rr.exec_status = #{execStatus}
</if>
<if test="billNo != null and billNo != ''">
AND rr.bill_no = #{billNo}
</if>
<if test="isDelivery != null and isDelivery != ''">
AND rr.is_delivery = #{isDelivery}
</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="sapNo != null and sapNo != ''">
AND rr.sap_no LIKE concat('%', #{sapNo}, '%')
</if>
<!-- 供应商 -->
<if test="gysMc != null and gysMc != ''">
AND rr.gys_mc LIKE concat('%', #{gysMc}, '%')
</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="isBorrowed != null and isBorrowed != ''">
AND rr.is_borrowed = #{isBorrowed}
</if>
<!-- 删除标识 -->
<if test="isDelete == null">
AND (rr.is_delete = '0' OR rr.is_delete = 0 OR rr.is_delete IS NULL)
</if>
<if test="isDelete != null and isDelete != ''">
AND rr.is_delete = #{isDelete}
</if>
<!-- ================= 时间条件(最终正确版) ================= -->
<if test="startDate != null or endDate != null">
AND (
<!-- 普通入库 / 出库:精确到时分秒 -->
(
rr.biz_type IN ('0','1')
<if test="startDate != null">
AND rr.operation_time &gt;= #{startDate}
</if>
<if test="endDate != null">
AND rr.operation_time &lt;= #{endDate}
</if>
)
OR
<!-- 借料出库:按 borrow_time按天 -->
(
rr.biz_type = '2'
<if test="startDate != null">
AND rr.borrow_time &gt;= DATE(#{startDate})
</if>
<if test="endDate != null">
AND rr.borrow_time &lt; DATE_ADD(DATE(#{endDate}), INTERVAL 1 DAY)
</if>
)
OR
<!-- 还料入库:按 return_time按天 -->
(
rr.biz_type = '3'
<if test="startDate != null">
AND rr.return_time &gt;= DATE(#{startDate})
</if>
<if test="endDate != null">
AND rr.return_time &lt; DATE_ADD(DATE(#{endDate}), INTERVAL 1 DAY)
</if>
)
)
</if>
</where>
</select>