仓库信息字段更新1212
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zg.project.Inventory.AutoInventory.mapper.InventoryMatchScanMapper">
|
||||
<mapper namespace="com.zg.project.inventory.AutoInventory.mapper.InventoryMatchScanMapper">
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO inventory_match_scan (task_id, device_id, pcode, tme, scan_type, status)
|
||||
@@ -12,17 +12,17 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getAll" resultType="com.zg.project.Inventory.domain.entity.InventoryMatchScan">
|
||||
<select id="getAll" resultType="com.zg.project.inventory.domain.entity.InventoryMatchScan">
|
||||
SELECT * FROM inventory_match_scan
|
||||
</select>
|
||||
|
||||
<select id="getAllSod" resultType="com.zg.project.Inventory.domain.entity.Sod">
|
||||
<select id="getAllSod" resultType="com.zg.project.inventory.domain.entity.Sod">
|
||||
SELECT * FROM inventory_match_scan i
|
||||
LEFT JOIN sod s ON i.pcde = s.fycde_1
|
||||
WHERE s.rmn > 0
|
||||
</select>
|
||||
|
||||
<select id="getPcdeCountByTask" resultType="com.zg.project.Inventory.domain.vo.PcdeCountVO">
|
||||
<select id="getPcdeCountByTask" resultType="com.zg.project.inventory.domain.vo.PcdeCountVO">
|
||||
SELECT
|
||||
s.pcde,
|
||||
COUNT(*) AS count
|
||||
@@ -43,7 +43,7 @@
|
||||
GROUP BY s.pcde
|
||||
</select>
|
||||
|
||||
<select id="getGroupedHistoryList" resultType="com.zg.project.Inventory.domain.vo.InventoryMatchScanSimpleVO">
|
||||
<select id="getGroupedHistoryList" resultType="com.zg.project.inventory.domain.vo.InventoryMatchScanSimpleVO">
|
||||
SELECT
|
||||
task_name AS taskName,
|
||||
MAX(tme) AS tme,
|
||||
@@ -101,7 +101,7 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getByTaskName" resultType="com.zg.project.Inventory.domain.vo.InventoryMatchScanVO">
|
||||
<select id="getByTaskName" resultType="com.zg.project.inventory.domain.vo.InventoryMatchScanVO">
|
||||
SELECT
|
||||
i.id,
|
||||
i.device_id AS deviceId,
|
||||
@@ -133,8 +133,8 @@
|
||||
</select>
|
||||
|
||||
<select id="selectInventoryMatchScanList"
|
||||
resultType="com.zg.project.Inventory.domain.entity.InventoryMatchScan"
|
||||
parameterType="com.zg.project.Inventory.domain.entity.InventoryMatchScan">
|
||||
resultType="com.zg.project.inventory.domain.entity.InventoryMatchScan"
|
||||
parameterType="com.zg.project.inventory.domain.entity.InventoryMatchScan">
|
||||
SELECT
|
||||
i.id AS id,
|
||||
i.task_id AS taskId,
|
||||
@@ -173,7 +173,7 @@
|
||||
|
||||
<select id="selectOnlyFromMatchScan"
|
||||
parameterType="InventoryMatchScan"
|
||||
resultType="com.zg.project.Inventory.domain.vo.RkInfoMatchVO">
|
||||
resultType="com.zg.project.inventory.domain.vo.RkInfoMatchVO">
|
||||
SELECT
|
||||
i.pcode AS rkPcode,
|
||||
NULL AS realQty
|
||||
@@ -194,7 +194,7 @@
|
||||
|
||||
<select id="selectJoinRkInfo"
|
||||
parameterType="InventoryMatchScan"
|
||||
resultType="com.zg.project.Inventory.domain.vo.RkInfoMatchVO">
|
||||
resultType="com.zg.project.inventory.domain.vo.RkInfoMatchVO">
|
||||
SELECT
|
||||
r.pcode AS rkPcode,
|
||||
COALESCE(SUM(r.real_qty), 0) AS realQty
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zg.project.Inventory.AutoInventory.mapper.PrintRfidMapper">
|
||||
<mapper namespace="com.zg.project.inventory.AutoInventory.mapper.PrintRfidMapper">
|
||||
|
||||
<resultMap type="PrintRfid" id="PrintRfidResult">
|
||||
<resultMap type="com.zg.project.inventory.AutoInventory.domain.entity.PrintRfid" id="PrintRfidResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="pcde" column="pcde" />
|
||||
<result property="rfid" column="rfid" />
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zg.project.Inventory.AutoInventory.mapper.SodMapper">
|
||||
<mapper namespace="com.zg.project.inventory.AutoInventory.mapper.SodMapper">
|
||||
|
||||
<resultMap id="SodResultMap" type="com.zg.project.Inventory.domain.entity.Sod">
|
||||
<resultMap id="SodResultMap" type="com.zg.project.inventory.domain.entity.Sod">
|
||||
<id column="Id" property="Id" />
|
||||
<result column="mid" property="mid"/>
|
||||
<result column="des_mat" property="desMat"/>
|
||||
@@ -43,7 +43,7 @@
|
||||
<result column="uptim" property="uptim"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByPcdeList" resultType="com.zg.project.Inventory.domain.vo.SodVO">
|
||||
<select id="selectByPcdeList" resultType="com.zg.project.inventory.domain.vo.SodVO">
|
||||
SELECT
|
||||
pcde,
|
||||
des_mat AS desMat,
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zg.project.Inventory.Task.mapper.InventoryTaskMapper">
|
||||
<mapper namespace="com.zg.project.inventory.Task.mapper.InventoryTaskMapper">
|
||||
|
||||
<!-- ========== 映射对象 ========== -->
|
||||
<resultMap type="InventoryTask" id="InventoryTaskResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="taskName" column="task_name"/>
|
||||
<result property="warehouseId" column="warehouse_id"/>
|
||||
<result property="warehouseCode" column="warehouse_code"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="sceneId" column="scene_id"/>
|
||||
<result property="sceneName" column="scene_name"/>
|
||||
@@ -24,11 +25,12 @@
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- ========== 公共 SELECT 语句 ========== -->
|
||||
<sql id="selectInventoryTaskVo">
|
||||
SELECT
|
||||
t.id,
|
||||
t.task_name,
|
||||
t.warehouse_id,
|
||||
t.warehouse_code,
|
||||
w.warehouse_name AS warehouse_name,
|
||||
t.scene_id,
|
||||
s.scene_name AS scene_name,
|
||||
@@ -44,49 +46,79 @@
|
||||
t.updated_at,
|
||||
t.is_delete
|
||||
FROM inventory_task t
|
||||
LEFT JOIN warehouse_info w ON t.warehouse_id = w.warehouse_code
|
||||
LEFT JOIN warehouse_info w ON t.warehouse_code = w.warehouse_code
|
||||
LEFT JOIN scene_mapping s ON t.scene_id = s.scene_code
|
||||
LEFT JOIN sys_user u ON t.user_id = u.user_id
|
||||
</sql>
|
||||
|
||||
<!-- ========== 列表查询 ========== -->
|
||||
<select id="selectInventoryTaskList" parameterType="InventoryTask" resultMap="InventoryTaskResult">
|
||||
<include refid="selectInventoryTaskVo"/>
|
||||
<where>
|
||||
<if test="taskName != null and taskName != ''"> AND t.task_name LIKE concat('%', #{taskName}, '%')</if>
|
||||
<if test="warehouseId != null"> AND t.warehouse_id = #{warehouseId}</if>
|
||||
<if test="sceneId != null"> AND t.scene_id = #{sceneId}</if>
|
||||
<if test="userId != null"> AND t.user_id = #{userId}</if>
|
||||
<if test="requireTime != null and requireTime != ''"> AND t.require_time = #{requireTime}</if>
|
||||
<if test="status != null and status != ''"> AND t.status = #{status}</if>
|
||||
<if test="taskType != null and taskType != ''"> AND t.task_type = #{taskType}</if>
|
||||
<if test="createdBy != null and createdBy != ''"> AND t.created_by = #{createdBy}</if>
|
||||
<if test="createdAt != null and createdAt != ''"> AND t.created_at = #{createdAt}</if>
|
||||
<if test="updatedBy != null and updatedBy != ''"> AND t.updated_by = #{updatedBy}</if>
|
||||
<if test="updatedAt != null and updatedAt != ''"> AND t.updated_at = #{updatedAt}</if>
|
||||
<if test="isDelete != null and isDelete != ''"> AND t.is_delete = #{isDelete}</if>
|
||||
<if test="taskName != null and taskName != ''">
|
||||
AND t.task_name LIKE concat('%', #{taskName}, '%')
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
AND t.warehouse_code = #{warehouseCode}
|
||||
</if>
|
||||
<if test="sceneId != null and sceneId != ''">
|
||||
AND t.scene_id = #{sceneId}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
AND t.user_id = #{userId}
|
||||
</if>
|
||||
<if test="requireTime != null and requireTime != ''">
|
||||
AND t.require_time = #{requireTime}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND t.status = #{status}
|
||||
</if>
|
||||
<if test="taskType != null and taskType != ''">
|
||||
AND t.task_type = #{taskType}
|
||||
</if>
|
||||
<if test="createdBy != null and createdBy != ''">
|
||||
AND t.created_by = #{createdBy}
|
||||
</if>
|
||||
<if test="createdAt != null and createdAt != ''">
|
||||
AND t.created_at = #{createdAt}
|
||||
</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">
|
||||
AND t.updated_by = #{updatedBy}
|
||||
</if>
|
||||
<if test="updatedAt != null and updatedAt != ''">
|
||||
AND t.updated_at = #{updatedAt}
|
||||
</if>
|
||||
<if test="isDelete != null and isDelete != ''">
|
||||
AND t.is_delete = #{isDelete}
|
||||
</if>
|
||||
</where>
|
||||
order by t.created_at desc
|
||||
ORDER BY t.created_at DESC
|
||||
</select>
|
||||
|
||||
<!-- ========== 根据 ID 查询 ========== -->
|
||||
<select id="selectInventoryTaskById" parameterType="Long" resultMap="InventoryTaskResult">
|
||||
<include refid="selectInventoryTaskVo"/>
|
||||
WHERE t.id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- ========== 查询用户未完成任务数量 ========== -->
|
||||
<select id="countPendingTaskByUserId" resultType="java.lang.Integer" parameterType="java.lang.Long">
|
||||
select count(*) from inventory_task
|
||||
where user_id = #{userId}
|
||||
and status = '0'
|
||||
and is_delete = '0'
|
||||
SELECT COUNT(*)
|
||||
FROM inventory_task
|
||||
WHERE user_id = #{userId}
|
||||
AND status = '0'
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
<!-- ========== 根据任务 ID 获取仓库(小仓编码) ========== -->
|
||||
<select id="getWhByTaskId" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
select warehouse_id from inventory_task
|
||||
where id = #{taskId}
|
||||
SELECT warehouse_code
|
||||
FROM inventory_task
|
||||
WHERE id = #{taskId}
|
||||
</select>
|
||||
|
||||
<select id="getSceneByTaskId"
|
||||
resultType="java.lang.String" parameterType="java.lang.String">
|
||||
<!-- ========== 根据任务 ID 获取场景编码 ========== -->
|
||||
<select id="getSceneByTaskId" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
SELECT scene_id
|
||||
FROM inventory_task
|
||||
WHERE id = #{taskId}
|
||||
@@ -100,60 +132,63 @@
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- ========== 新增 ========== -->
|
||||
<insert id="insertInventoryTask" parameterType="InventoryTask" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into inventory_task
|
||||
INSERT INTO inventory_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="taskName != null and taskName != ''">task_name,</if>
|
||||
<if test="warehouseId != null">warehouse_id,</if>
|
||||
<if test="sceneId != null">scene_id,</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code,</if>
|
||||
<if test="sceneId != null and sceneId != ''">scene_id,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="requireTime != null and requireTime != ''">require_time,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="taskType != null and taskType != ''">task_type,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createdBy != null">created_by,</if>
|
||||
<if test="createdAt != null">created_at,</if>
|
||||
<if test="updatedBy != null">updated_by,</if>
|
||||
<if test="updatedAt != null">updated_at,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
<if test="createdBy != null and createdBy != ''">created_by,</if>
|
||||
<if test="createdAt != null and createdAt != ''">created_at,</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">updated_by,</if>
|
||||
<if test="updatedAt != null and updatedAt != ''">updated_at,</if>
|
||||
<if test="isDelete != null and isDelete != ''">is_delete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="taskName != null and taskName != ''">#{taskName},</if>
|
||||
<if test="warehouseId != null">#{warehouseId},</if>
|
||||
<if test="sceneId != null">#{sceneId},</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">#{warehouseCode},</if>
|
||||
<if test="sceneId != null and sceneId != ''">#{sceneId},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="requireTime != null and requireTime != ''">#{requireTime},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="taskType != null and taskType != ''">#{taskType},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createdBy != null">#{createdBy},</if>
|
||||
<if test="createdAt != null">#{createdAt},</if>
|
||||
<if test="updatedBy != null">#{updatedBy},</if>
|
||||
<if test="updatedAt != null">#{updatedAt},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
|
||||
<if test="createdAt != null and createdAt != ''">#{createdAt},</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">#{updatedBy},</if>
|
||||
<if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
|
||||
<if test="isDelete != null and isDelete != ''">#{isDelete},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- ========== 修改 ========== -->
|
||||
<update id="updateInventoryTask" parameterType="InventoryTask">
|
||||
update inventory_task
|
||||
UPDATE inventory_task
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
|
||||
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
||||
<if test="sceneId != null">scene_id = #{sceneId},</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code = #{warehouseCode},</if>
|
||||
<if test="sceneId != null and sceneId != ''">scene_id = #{sceneId},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="requireTime != null and requireTime != ''">require_time = #{requireTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="taskType != null and taskType != ''">task_type = #{taskType},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createdBy != null">created_by = #{createdBy},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
||||
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="createdBy != null and createdBy != ''">created_by = #{createdBy},</if>
|
||||
<if test="createdAt != null and createdAt != ''">created_at = #{createdAt},</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">updated_by = #{updatedBy},</if>
|
||||
<if test="updatedAt != null and updatedAt != ''">updated_at = #{updatedAt},</if>
|
||||
<if test="isDelete != null and isDelete != ''">is_delete = #{isDelete},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- ========== 更新状态 ========== -->
|
||||
<update id="updateStatus" parameterType="map">
|
||||
UPDATE inventory_task
|
||||
SET status = #{status},
|
||||
@@ -161,14 +196,16 @@
|
||||
WHERE id = #{taskId}
|
||||
</update>
|
||||
|
||||
<!-- ========== 删除 ========== -->
|
||||
<delete id="deleteInventoryTaskById" parameterType="Long">
|
||||
delete from inventory_task where id = #{id}
|
||||
DELETE FROM inventory_task WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteInventoryTaskByIds" parameterType="String">
|
||||
delete from inventory_task where id in
|
||||
DELETE FROM inventory_task WHERE id IN
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -4,53 +4,96 @@
|
||||
"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"/>
|
||||
<result property="scene" column="scene"/>
|
||||
<result property="sceneName" column="scene_name"/>
|
||||
<result property="warehouse" column="warehouse"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="encodedId" column="encoded_id"/>
|
||||
<result property="tag" column="tag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="updatedAt" column="updated_at"/>
|
||||
<result property="id" column="id"/>
|
||||
<result property="pcode" column="pcode"/>
|
||||
<result property="scene" column="scene"/>
|
||||
<result property="sceneName" column="scene_name"/>
|
||||
|
||||
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
|
||||
<result property="parentWarehouseName" column="parent_warehouse_name"/>
|
||||
<result property="warehouseCode" column="warehouse_code"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
|
||||
<result property="encodedId" column="encoded_id"/>
|
||||
<result property="tag" column="tag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="updatedAt" column="updated_at"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 公共 SELECT 片段:带场景名称 -->
|
||||
<sql id="selectPcdeDetailVo">
|
||||
select d.id, d.pcode, d.scene, m.scene_name, d.warehouse, w.warehouse_name,
|
||||
d.encoded_id, d.tag, d.remark, d.is_delete,
|
||||
d.created_by, d.created_at, d.updated_by, d.updated_at
|
||||
from pcde_detail d
|
||||
left join scene_mapping m on d.scene = m.scene_code
|
||||
left join warehouse_info w on d.warehouse = w.warehouse_code
|
||||
SELECT
|
||||
d.id,
|
||||
d.pcode,
|
||||
d.scene,
|
||||
m.scene_name,
|
||||
d.parent_warehouse_code,
|
||||
d.parent_warehouse_name,
|
||||
d.warehouse_code,
|
||||
d.warehouse_name,
|
||||
d.encoded_id,
|
||||
d.tag,
|
||||
d.remark,
|
||||
d.is_delete,
|
||||
d.created_by,
|
||||
d.created_at,
|
||||
d.updated_by,
|
||||
d.updated_at
|
||||
FROM pcde_detail d
|
||||
LEFT JOIN scene_mapping m ON d.scene = m.scene_code
|
||||
</sql>
|
||||
|
||||
<select id="selectPcdeDetailList" parameterType="PcdeDetail" resultMap="PcdeDetailResult">
|
||||
<!-- 列表查询 -->
|
||||
<select id="selectPcdeDetailList"
|
||||
parameterType="PcdeDetail"
|
||||
resultMap="PcdeDetailResult">
|
||||
<include refid="selectPcdeDetailVo"/>
|
||||
<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="pcode != null and pcode != ''">
|
||||
AND d.pcode = #{pcode}
|
||||
</if>
|
||||
<if test="scene != null and scene != ''">
|
||||
AND d.scene = #{scene}
|
||||
</if>
|
||||
|
||||
<!-- 按大仓 / 小仓过滤(可选) -->
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
AND d.parent_warehouse_code = #{parentWarehouseCode}
|
||||
</if>
|
||||
<if test="parentWarehouseName != null and parentWarehouseName != ''">
|
||||
AND d.parent_warehouse_name LIKE concat('%', #{parentWarehouseName}, '%')
|
||||
</if>
|
||||
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
AND d.warehouse_code = #{warehouseCode}
|
||||
</if>
|
||||
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and w.warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
AND d.warehouse_name LIKE concat('%', #{warehouseName}, '%')
|
||||
</if>
|
||||
|
||||
<if test="warehouse != null and warehouse != ''">
|
||||
and d.warehouse = #{warehouse}
|
||||
<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="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>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPcdeDetailListIds" parameterType="PcdeDetail" resultMap="PcdeDetailResult">
|
||||
<!-- 根据 ID 列表查询 -->
|
||||
<select id="selectPcdeDetailListIds"
|
||||
parameterType="PcdeDetail"
|
||||
resultMap="PcdeDetailResult">
|
||||
<include refid="selectPcdeDetailVo"/>
|
||||
<where>
|
||||
<choose>
|
||||
@@ -60,39 +103,108 @@
|
||||
#{val}
|
||||
</foreach>
|
||||
</when>
|
||||
|
||||
</choose>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPcdeDetailById" parameterType="Long" resultMap="PcdeDetailResult">
|
||||
<!-- 根据主键查询 -->
|
||||
<select id="selectPcdeDetailById"
|
||||
parameterType="Long"
|
||||
resultMap="PcdeDetailResult">
|
||||
<include refid="selectPcdeDetailVo"/>
|
||||
where d.id = #{id}
|
||||
WHERE d.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByPcode" resultType="com.zg.project.information.domain.PcdeDetail"
|
||||
<!-- 根据库位编码查询(不联表,直接取表字段) -->
|
||||
<select id="selectByPcode"
|
||||
resultType="com.zg.project.information.domain.PcdeDetail"
|
||||
parameterType="java.lang.String">
|
||||
select id, pcode, scene, warehouse, encoded_id, tag, is_delete,
|
||||
created_by, created_at, updated_by, updated_at, remark
|
||||
from pcde_detail
|
||||
where pcode = #{pcode}
|
||||
SELECT
|
||||
id,
|
||||
pcode,
|
||||
scene,
|
||||
parent_warehouse_code AS parentWarehouseCode,
|
||||
parent_warehouse_name AS parentWarehouseName,
|
||||
warehouse_code AS warehouseCode,
|
||||
warehouse_name AS warehouseName,
|
||||
encoded_id AS encodedId,
|
||||
tag,
|
||||
is_delete AS isDelete,
|
||||
created_by AS createdBy,
|
||||
created_at AS createdAt,
|
||||
updated_by AS UpdatedBy,
|
||||
updated_at AS updatedAt,
|
||||
remark
|
||||
FROM pcde_detail
|
||||
WHERE pcode = #{pcode}
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectEncodedIdByPcode" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
select encoded_id
|
||||
from pcde_detail
|
||||
where pcode = #{pcode}
|
||||
<!-- 根据库位编码查编码后ID -->
|
||||
<select id="selectEncodedIdByPcode"
|
||||
resultType="java.lang.String"
|
||||
parameterType="java.lang.String">
|
||||
SELECT encoded_id
|
||||
FROM pcde_detail
|
||||
WHERE pcode = #{pcode}
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertPcdeDetail" parameterType="PcdeDetail" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pcde_detail
|
||||
<select id="selectByWarehouseCode" parameterType="String" resultMap="PcdeDetailResult">
|
||||
SELECT
|
||||
id,
|
||||
pcode,
|
||||
scene,
|
||||
parent_warehouse_code,
|
||||
parent_warehouse_name,
|
||||
warehouse_code,
|
||||
warehouse_name,
|
||||
encoded_id,
|
||||
tag,
|
||||
remark,
|
||||
is_delete,
|
||||
created_by,
|
||||
created_at,
|
||||
updated_by,
|
||||
updated_at
|
||||
FROM pcde_detail
|
||||
WHERE warehouse_code = #{warehouseCode}
|
||||
AND is_delete = '0'
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据库位编码查所属小仓编码(小仓 warehouse_code) -->
|
||||
<select id="selectWarehouseCodeByPcode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT warehouse_code
|
||||
FROM pcde_detail
|
||||
WHERE pcode = #{pcode}
|
||||
AND is_delete = '0'
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 单条插入 -->
|
||||
<insert id="insertPcdeDetail"
|
||||
parameterType="PcdeDetail"
|
||||
useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
INSERT INTO pcde_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="pcode != null and pcode != ''">pcode,</if>
|
||||
<if test="scene != null and scene != ''">scene,</if>
|
||||
<if test="warehouse != null and warehouse != ''">warehouse,</if>
|
||||
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
parent_warehouse_code,
|
||||
</if>
|
||||
<if test="parentWarehouseName != null and parentWarehouseName != ''">
|
||||
parent_warehouse_name,
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
warehouse_code,
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
warehouse_name,
|
||||
</if>
|
||||
|
||||
<if test="encodedId != null">encoded_id,</if>
|
||||
<if test="tag != null">tag,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
@@ -102,10 +214,23 @@
|
||||
<if test="updatedBy != null">updated_by,</if>
|
||||
<if test="updatedAt != null">updated_at,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="pcode != null and pcode != ''">#{pcode},</if>
|
||||
<if test="scene != null and scene != ''">#{scene},</if>
|
||||
<if test="warehouse != null and warehouse != ''">#{warehouse},</if>
|
||||
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
#{parentWarehouseCode},
|
||||
</if>
|
||||
<if test="parentWarehouseName != null and parentWarehouseName != ''">
|
||||
#{parentWarehouseName},
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
#{warehouseCode},
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
#{warehouseName},
|
||||
</if>
|
||||
|
||||
<if test="encodedId != null">#{encodedId},</if>
|
||||
<if test="tag != null">#{tag},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
@@ -117,36 +242,85 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 更新 -->
|
||||
<update id="updatePcdeDetail" parameterType="PcdeDetail">
|
||||
update pcde_detail
|
||||
UPDATE pcde_detail
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="pcode != null and pcode != ''">pcode = #{pcode},</if>
|
||||
<if test="scene != null and scene != ''">scene = #{scene},</if>
|
||||
<if test="warehouse != null and warehouse != ''">warehouse = #{warehouse},</if>
|
||||
<if test="encodedId != null">encoded_id = #{encodedId},</if>
|
||||
<if test="tag != null">tag = #{tag},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="createdBy != null">created_by = #{createdBy},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
||||
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||
<if test="pcode != null and pcode != ''">
|
||||
pcode = #{pcode},
|
||||
</if>
|
||||
<if test="scene != null and scene != ''">
|
||||
scene = #{scene},
|
||||
</if>
|
||||
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
parent_warehouse_code = #{parentWarehouseCode},
|
||||
</if>
|
||||
<if test="parentWarehouseName != null and parentWarehouseName != ''">
|
||||
parent_warehouse_name = #{parentWarehouseName},
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
warehouse_code = #{warehouseCode},
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
warehouse_name = #{warehouseName},
|
||||
</if>
|
||||
|
||||
<if test="encodedId != null">
|
||||
encoded_id = #{encodedId},
|
||||
</if>
|
||||
<if test="tag != null">
|
||||
tag = #{tag},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
is_delete = #{isDelete},
|
||||
</if>
|
||||
<if test="createdBy != null">
|
||||
created_by = #{createdBy},
|
||||
</if>
|
||||
<if test="createdAt != null">
|
||||
created_at = #{createdAt},
|
||||
</if>
|
||||
<if test="updatedBy != null">
|
||||
updated_by = #{updatedBy},
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
updated_at = #{updatedAt},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 批量插入(存在则忽略),用于导入 -->
|
||||
<insert id="batchInsertIgnore">
|
||||
INSERT IGNORE INTO pcde_detail
|
||||
(pcode, scene, scene_name, warehouse, warehouse_name,
|
||||
encoded_id, tag, remark, is_delete,
|
||||
created_by, created_at, updated_by, updated_at)
|
||||
(pcode,
|
||||
scene,
|
||||
scene_name,
|
||||
parent_warehouse_code,
|
||||
parent_warehouse_name,
|
||||
warehouse_code,
|
||||
warehouse_name,
|
||||
encoded_id,
|
||||
tag,
|
||||
remark,
|
||||
is_delete,
|
||||
created_by,
|
||||
created_at,
|
||||
updated_by,
|
||||
updated_at)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.pcode},
|
||||
#{item.scene},
|
||||
#{item.sceneName},
|
||||
#{item.warehouse},
|
||||
#{item.parentWarehouseCode},
|
||||
#{item.parentWarehouseName},
|
||||
#{item.warehouseCode},
|
||||
#{item.warehouseName},
|
||||
#{item.encodedId},
|
||||
#{item.tag},
|
||||
@@ -160,12 +334,16 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 单条删除 -->
|
||||
<delete id="deletePcdeDetailById" parameterType="Long">
|
||||
delete from pcde_detail where id = #{id}
|
||||
DELETE FROM pcde_detail
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<delete id="deletePcdeDetailByIds" parameterType="String">
|
||||
delete from pcde_detail where id in
|
||||
DELETE FROM pcde_detail
|
||||
WHERE id IN
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
<result property="rkTypeName" column="rk_type_name"/>
|
||||
<result property="wlTypeName" column="wl_type_name"/>
|
||||
<result property="cangkuName" column="cangku_name"/>
|
||||
|
||||
<!-- 新增:大仓/小仓编码和名称 -->
|
||||
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
|
||||
<result property="parentWarehouseName" column="parent_warehouse_name"/>
|
||||
<result property="warehouseCode" column="warehouse_code"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
|
||||
<result property="remark" column="remark" />
|
||||
<result property="xj" column="xj" />
|
||||
<result property="xmNo" column="xm_no" />
|
||||
@@ -62,7 +69,7 @@
|
||||
<result property="isDelivery" column="is_delivery"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 明细查询SQL(包含多表JOIN,用于普通明<EFBFBD>?分页等) -->
|
||||
<!-- 明细查询SQL(包含多表JOIN,用于普通明细分页等) -->
|
||||
<sql id="selectRkInfoVo">
|
||||
SELECT
|
||||
ri.id,
|
||||
@@ -70,7 +77,16 @@
|
||||
ri.bill_no_ck,
|
||||
ri.rk_type, st.type_name AS rk_type_name,
|
||||
ri.wl_type, mt.type_name AS wl_type_name,
|
||||
ri.cangku, wh.warehouse_name AS cangku_name,
|
||||
|
||||
ri.cangku,
|
||||
wh.warehouse_name AS cangku_name,
|
||||
|
||||
-- 新增:大仓/小仓编码和名称
|
||||
wh.parent_warehouse_code AS parent_warehouse_code,
|
||||
wh.parent_warehouse_name AS parent_warehouse_name,
|
||||
wh.warehouse_code AS warehouse_code,
|
||||
wh.warehouse_name AS warehouse_name,
|
||||
|
||||
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.is_borrowed, ri.is_delivery,ri.remark,
|
||||
ri.ck_lihuo_y, ri.ck_type, sot.type_name AS ck_type_name,
|
||||
ri.team_code, ct.team_name,
|
||||
@@ -148,7 +164,8 @@
|
||||
#{item.xmNoCk}, #{item.xmMsCk}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
|
||||
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
|
||||
#{item.borrowTime}, #{item.returnTime}, #{item.status},
|
||||
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId}, #{item.fycde1}, #{item.fycde2},
|
||||
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId},
|
||||
#{item.fycde1}, #{item.fycde2},
|
||||
#{item.remark}, #{item.isChuku}, #{item.isBorrowed}, #{item.gysJhId},
|
||||
#{item.isDelete}, #{item.createBy}, #{item.createTime}
|
||||
)
|
||||
@@ -219,36 +236,36 @@
|
||||
<!-- 关键字搜索 -->
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
ri.xm_no like concat('%', #{keyword}, '%')
|
||||
or ri.xm_ms like concat('%', #{keyword}, '%')
|
||||
or ri.fycde_1 like concat('%', #{keyword}, '%')
|
||||
or ri.fycde_2 like concat('%', #{keyword}, '%')
|
||||
or ri.wl_no like concat('%', #{keyword}, '%')
|
||||
or ri.wl_ms like concat('%', #{keyword}, '%')
|
||||
or ri.gys_no like concat('%', #{keyword}, '%')
|
||||
or ri.gys_mc like concat('%', #{keyword}, '%')
|
||||
or ri.sap_no like concat('%', #{keyword}, '%')
|
||||
or ri.bill_no like concat('%', #{keyword}, '%')
|
||||
or ri.bill_no_ck like concat('%', #{keyword}, '%')
|
||||
or ri.ck_type like concat('%', #{keyword}, '%')
|
||||
or ri.pcode like concat('%', #{keyword}, '%')
|
||||
ri.xm_no LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.xm_ms LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.fycde_1 LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.fycde_2 LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.wl_no LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.wl_ms LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.gys_no LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.gys_mc LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.sap_no LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.bill_no LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.bill_no_ck LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.ck_type LIKE concat('%', #{keyword}, '%')
|
||||
OR ri.pcode LIKE concat('%', #{keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="rkType != null and rkType != ''">
|
||||
AND ri.rk_type like concat('%', #{rkType}, '%')
|
||||
AND ri.rk_type LIKE concat('%', #{rkType}, '%')
|
||||
</if>
|
||||
<if test="wlType != null and wlType != ''">
|
||||
AND ri.wl_type like concat('%', #{wlType}, '%')
|
||||
AND ri.wl_type LIKE concat('%', #{wlType}, '%')
|
||||
</if>
|
||||
<if test="cangku != null and cangku != ''">
|
||||
AND ri.cangku like concat('%', #{cangku}, '%')
|
||||
AND ri.cangku LIKE concat('%', #{cangku}, '%')
|
||||
</if>
|
||||
<if test="fycde1 != null and fycde1 != ''">
|
||||
AND ri.fycde_1 like concat('%', #{fycde1}, '%')
|
||||
AND ri.fycde_1 LIKE concat('%', #{fycde1}, '%')
|
||||
</if>
|
||||
<if test="fycde2 != null and fycde2 != ''">
|
||||
AND ri.fycde_2 like concat('%', #{fycde2}, '%')
|
||||
AND ri.fycde_2 LIKE concat('%', #{fycde2}, '%')
|
||||
</if>
|
||||
|
||||
<if test="ids != null and ids.size > 0">
|
||||
@@ -258,55 +275,17 @@
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<!-- ★★ 先按是否借料过滤行:0 否,1 借料中,2 已归还 ★★ -->
|
||||
<if test="isBorrowed != null and isBorrowed != ''">
|
||||
AND ri.is_borrowed = #{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>
|
||||
|
||||
<!-- ★★ 时间范围逻辑 ★★ -->
|
||||
<!-- 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>
|
||||
@@ -315,34 +294,34 @@
|
||||
</if>
|
||||
|
||||
<if test="lihuoY != null and lihuoY != ''">
|
||||
AND ri.lihuo_y like concat('%', #{lihuoY}, '%')
|
||||
AND ri.lihuo_y LIKE concat('%', #{lihuoY}, '%')
|
||||
</if>
|
||||
<if test="xj != null and xj != ''">
|
||||
AND ri.xj like concat('%', #{xj}, '%')
|
||||
AND ri.xj LIKE concat('%', #{xj}, '%')
|
||||
</if>
|
||||
<if test="billNo != null and billNo != ''">
|
||||
AND ri.bill_no like concat('%', #{billNo}, '%')
|
||||
AND ri.bill_no LIKE concat('%', #{billNo}, '%')
|
||||
</if>
|
||||
<if test="billNoCk != null and billNoCk != ''">
|
||||
AND ri.bill_no_ck like concat('%', #{billNoCk}, '%')
|
||||
AND ri.bill_no_ck LIKE concat('%', #{billNoCk}, '%')
|
||||
</if>
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND ri.xm_no like concat('%', #{xmNo}, '%')
|
||||
AND ri.xm_no LIKE concat('%', #{xmNo}, '%')
|
||||
</if>
|
||||
<if test="xmMs != null and xmMs != ''">
|
||||
AND ri.xm_ms like concat('%', #{xmMs}, '%')
|
||||
AND ri.xm_ms LIKE concat('%', #{xmMs}, '%')
|
||||
</if>
|
||||
<if test="wlNo != null and wlNo != ''">
|
||||
AND ri.wl_no like concat('%', #{wlNo}, '%')
|
||||
AND ri.wl_no LIKE concat('%', #{wlNo}, '%')
|
||||
</if>
|
||||
<if test="wlMs != null and wlMs != ''">
|
||||
AND ri.wl_ms like concat('%', #{wlMs}, '%')
|
||||
AND ri.wl_ms LIKE concat('%', #{wlMs}, '%')
|
||||
</if>
|
||||
<if test="gysNo != null and gysNo != ''">
|
||||
AND ri.gys_no like concat('%', #{gysNo}, '%')
|
||||
AND ri.gys_no LIKE concat('%', #{gysNo}, '%')
|
||||
</if>
|
||||
<if test="gysMc != null and gysMc != ''">
|
||||
AND ri.gys_mc like concat('%', #{gysMc}, '%')
|
||||
AND ri.gys_mc LIKE concat('%', #{gysMc}, '%')
|
||||
</if>
|
||||
|
||||
<if test="jhAmt != null">
|
||||
@@ -353,10 +332,10 @@
|
||||
</if>
|
||||
|
||||
<if test="sapNo != null and sapNo != ''">
|
||||
AND ri.sap_no like concat('%', #{sapNo}, '%')
|
||||
AND ri.sap_no LIKE concat('%', #{sapNo}, '%')
|
||||
</if>
|
||||
<if test="xh != null and xh != ''">
|
||||
AND ri.xh like concat('%', #{xh}, '%')
|
||||
AND ri.xh LIKE concat('%', #{xh}, '%')
|
||||
</if>
|
||||
<if test="jhQty != null">
|
||||
AND ri.jh_qty = #{jhQty}
|
||||
@@ -365,14 +344,14 @@
|
||||
AND ri.ht_qty = #{htQty}
|
||||
</if>
|
||||
<if test="dw != null and dw != ''">
|
||||
AND ri.dw like concat('%', #{dw}, '%')
|
||||
AND ri.dw LIKE concat('%', #{dw}, '%')
|
||||
</if>
|
||||
<if test="realQty != null">
|
||||
AND ri.real_qty = #{realQty}
|
||||
</if>
|
||||
|
||||
<if test="pcode != null and pcode != ''">
|
||||
AND ri.pcode like concat('%', #{pcode}, '%')
|
||||
AND ri.pcode LIKE concat('%', #{pcode}, '%')
|
||||
</if>
|
||||
<if test="lyTime != null">
|
||||
AND ri.ly_time = #{lyTime}
|
||||
@@ -381,13 +360,13 @@
|
||||
AND ri.return_time = #{returnTime}
|
||||
</if>
|
||||
<if test="trayCode != null and trayCode != ''">
|
||||
AND ri.tray_code like concat('%', #{trayCode}, '%')
|
||||
AND ri.tray_code LIKE concat('%', #{trayCode}, '%')
|
||||
</if>
|
||||
<if test="entityId != null and entityId != ''">
|
||||
AND ri.entity_id like concat('%', #{entityId}, '%')
|
||||
AND ri.entity_id LIKE concat('%', #{entityId}, '%')
|
||||
</if>
|
||||
<if test="ckType != null and ckType != ''">
|
||||
AND ri.ck_type like concat('%', #{ckType}, '%')
|
||||
AND ri.ck_type LIKE concat('%', #{ckType}, '%')
|
||||
</if>
|
||||
|
||||
<choose>
|
||||
@@ -402,8 +381,88 @@
|
||||
ORDER BY ri.rk_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectBorrowAndReturnList"
|
||||
parameterType="RkInfo"
|
||||
resultMap="RkInfoResult">
|
||||
|
||||
<include refid="selectRkInfoVo"/>
|
||||
|
||||
<where>
|
||||
<!-- 只查未删除 -->
|
||||
<choose>
|
||||
<when test="isDelete != null and isDelete != ''">
|
||||
AND ri.is_delete = #{isDelete}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND ri.is_delete = 0
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<!-- 借料/还料状态:0 否,1 借料中,2 已归还 -->
|
||||
<choose>
|
||||
<when test="isBorrowed != null and isBorrowed != ''">
|
||||
AND ri.is_borrowed = #{isBorrowed}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND ri.is_borrowed IN ('1','2')
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<!-- 时间范围:根据 isBorrowed 选择 borrow_time / return_time -->
|
||||
<!-- 先添加通用时间条件,如果isBorrowed为1或2时使用对应的时间字段 -->
|
||||
<if test="startTime != null">
|
||||
<choose>
|
||||
<when test="isBorrowed != null and (isBorrowed == '1' or isBorrowed == 1)">
|
||||
<![CDATA[
|
||||
AND ri.borrow_time >= #{startTime}
|
||||
]]>
|
||||
</when>
|
||||
<when test="isBorrowed != null and (isBorrowed == '2' or isBorrowed == 2)">
|
||||
<![CDATA[
|
||||
AND ri.return_time >= #{startTime}
|
||||
]]>
|
||||
</when>
|
||||
<otherwise>
|
||||
<![CDATA[
|
||||
AND ri.rk_time >= #{startTime}
|
||||
]]>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
<choose>
|
||||
<when test="isBorrowed != null and (isBorrowed == '1' or isBorrowed == 1)">
|
||||
<![CDATA[
|
||||
AND ri.borrow_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
|
||||
]]>
|
||||
</when>
|
||||
<when test="isBorrowed != null and (isBorrowed == '2' or isBorrowed == 2)">
|
||||
<![CDATA[
|
||||
AND ri.return_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
|
||||
]]>
|
||||
</when>
|
||||
<otherwise>
|
||||
<![CDATA[
|
||||
AND ri.rk_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
|
||||
]]>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND ri.xm_no LIKE concat('%', #{xmNo}, '%')
|
||||
</if>
|
||||
<if test="sapNo != null and sapNo != ''">
|
||||
AND ri.sap_no LIKE concat('%', #{sapNo}, '%')
|
||||
</if>
|
||||
<if test="billNo != null and billNo != ''">
|
||||
AND ri.bill_no LIKE concat('%', #{billNo}, '%')
|
||||
</if>
|
||||
</where>
|
||||
|
||||
ORDER BY ri.borrow_time DESC, ri.return_time DESC, ri.id DESC
|
||||
</select>
|
||||
|
||||
<!-- ================== 这里是已优化的按单据分组查询(替换旧版本<E78988>?================== -->
|
||||
<select id="selectGroupedByBill" resultMap="RkInfoResult" parameterType="map">
|
||||
SELECT
|
||||
a.id,
|
||||
@@ -559,7 +618,7 @@
|
||||
AND t.is_delivery = #{q.isDelivery}
|
||||
</if>
|
||||
|
||||
<!-- 出库才要<EFBFBD>?bill_no_ck 非空 -->
|
||||
<!-- 出库才要 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
|
||||
@@ -589,7 +648,7 @@
|
||||
ORDER BY a.rk_time DESC
|
||||
</select>
|
||||
|
||||
<!-- ================== /按单据分组查<EFBFBD>?================== -->
|
||||
<!-- ================== /按单据分组查询 ================== -->
|
||||
|
||||
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
|
||||
<include refid="selectRkInfoVo"/>
|
||||
@@ -636,7 +695,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,
|
||||
@@ -659,7 +718,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,
|
||||
@@ -704,7 +763,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getUnscannedPcodeByScene"
|
||||
resultType="com.zg.project.Inventory.domain.vo.RkInfoMatchVO">
|
||||
resultType="com.zg.project.inventory.domain.vo.RkInfoMatchVO">
|
||||
SELECT
|
||||
r.pcode AS rkPcode,
|
||||
COALESCE(SUM(r.real_qty), 0) AS realQty
|
||||
@@ -724,7 +783,7 @@
|
||||
ORDER BY MAX(r.create_time) DESC
|
||||
</select>
|
||||
|
||||
<select id="selectPcdeCntFromRkInfo" resultType="com.zg.project.Inventory.domain.vo.PcdeCntVO">
|
||||
<select id="selectPcdeCntFromRkInfo" resultType="com.zg.project.inventory.domain.vo.PcdeCntVO">
|
||||
SELECT pcode AS pcde,
|
||||
COUNT(*) AS cnt
|
||||
FROM rk_info
|
||||
@@ -738,18 +797,25 @@
|
||||
<select id="selectOneForEachBillNo" parameterType="java.util.List" resultType="com.zg.project.wisdom.domain.RkInfo">
|
||||
SELECT
|
||||
COALESCE(r.bill_no_ck, r.bill_no) AS billNo,
|
||||
MAX(r.lihuo_y) AS lihuoY,
|
||||
MAX(u.user_name) AS lihuoYName,
|
||||
MAX(rkType.type_name) AS rkTypeName,
|
||||
MAX(cangku.warehouse_name) AS cangkuName,
|
||||
MAX(wlType.type_name) AS wlTypeName,
|
||||
MAX(ckType.type_name) AS ckTypeName,
|
||||
MAX(team.team_name) AS teamName
|
||||
MAX(r.lihuo_y) AS lihuoY,
|
||||
MAX(u.user_name) AS lihuoYName,
|
||||
MAX(rkType.type_name) AS rkTypeName,
|
||||
MAX(cangku.warehouse_name) AS cangkuName,
|
||||
|
||||
-- 新增:大仓/小仓编码和名称
|
||||
MAX(cangku.parent_warehouse_code) AS parentWarehouseCode,
|
||||
MAX(cangku.parent_warehouse_name) AS parentWarehouseName,
|
||||
MAX(cangku.warehouse_code) AS warehouseCode,
|
||||
MAX(cangku.warehouse_name) AS warehouseName,
|
||||
|
||||
MAX(wlType.type_name) AS wlTypeName,
|
||||
MAX(ckType.type_name) AS ckTypeName,
|
||||
MAX(team.team_name) AS teamName
|
||||
FROM rk_info r
|
||||
LEFT JOIN stock_in_type rkType ON r.rk_type = rkType.type_code
|
||||
LEFT JOIN stock_in_type rkType ON r.rk_type = rkType.type_code
|
||||
LEFT JOIN stock_out_type ckType ON r.ck_type = ckType.type_code
|
||||
LEFT JOIN warehouse_info cangku ON r.cangku = cangku.warehouse_code
|
||||
LEFT JOIN material_type wlType ON r.wl_type = wlType.type_code
|
||||
LEFT JOIN warehouse_info cangku ON r.cangku = cangku.warehouse_code
|
||||
LEFT JOIN material_type wlType ON r.wl_type = wlType.type_code
|
||||
LEFT JOIN construction_team team ON r.team_code = team.team_code
|
||||
LEFT JOIN sys_user u ON r.lihuo_y = u.user_id
|
||||
WHERE r.is_delete = '0'
|
||||
@@ -797,7 +863,9 @@
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="rkType != null">rk_type = #{rkType},</if>
|
||||
<if test="wlType != null">wl_type = #{wlType},</if>
|
||||
<if test="cangku != null">cangku = #{cangku},</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
cangku = #{warehouseCode},
|
||||
</if>
|
||||
<if test="rkTime != null">rk_time = #{rkTime},</if>
|
||||
<if test="lihuoY != null">lihuo_y = #{lihuoY},</if>
|
||||
<if test="isChuku != null">is_chuku = #{isChuku},</if>
|
||||
@@ -954,7 +1022,13 @@
|
||||
resultMap="RkInfoResult">
|
||||
SELECT
|
||||
t.*,
|
||||
wh.warehouse_name AS cangku_name
|
||||
wh.warehouse_name AS cangku_name,
|
||||
|
||||
-- 新增:大仓/小仓编码和名称
|
||||
wh.parent_warehouse_code AS parent_warehouse_code,
|
||||
wh.parent_warehouse_name AS parent_warehouse_name,
|
||||
wh.warehouse_code AS warehouse_code,
|
||||
wh.warehouse_name AS warehouse_name
|
||||
FROM rk_info t
|
||||
LEFT JOIN warehouse_info wh
|
||||
ON wh.warehouse_code = t.cangku
|
||||
@@ -975,20 +1049,20 @@
|
||||
AND ri.is_chuku = #{isChuku}
|
||||
</if>
|
||||
|
||||
<if test="cangku != null and cangku != ''">
|
||||
AND ri.cangku = #{cangku}
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
AND ri.cangku = #{warehouseCode}
|
||||
</if>
|
||||
|
||||
<if test="startTime != null">
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
<if test="statDate != null">
|
||||
<if test="statDate != null and statDate != ''">
|
||||
AND ri.return_time <![CDATA[ >= ]]> #{statDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
<if test="endDate != null and endDate != ''">
|
||||
AND ri.return_time <![CDATA[ <= ]]> #{endDate}
|
||||
</if>
|
||||
<if test="rkType != null and rkType != ''">
|
||||
@@ -997,10 +1071,10 @@
|
||||
<if test="wlType != null and wlType != ''">
|
||||
AND ri.wl_type = #{wlType}
|
||||
</if>
|
||||
<if test="lyStartTime != null">
|
||||
<if test="lyStartTime != null and lyStartTime != ''">
|
||||
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
|
||||
</if>
|
||||
<if test="lyEndTime != null">
|
||||
<if test="lyEndTime != null and lyEndTime != ''">
|
||||
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
|
||||
</if>
|
||||
|
||||
@@ -1070,10 +1144,10 @@
|
||||
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
|
||||
<if test="lyStartTime != null">
|
||||
<if test="lyStartTime != null and lyStartTime != ''">
|
||||
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
|
||||
</if>
|
||||
<if test="lyEndTime != null">
|
||||
<if test="lyEndTime != null and lyEndTime != ''">
|
||||
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
|
||||
</if>
|
||||
|
||||
@@ -1140,10 +1214,10 @@
|
||||
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
|
||||
<if test="lyStartTime != null">
|
||||
<if test="lyStartTime != null and lyStartTime != ''">
|
||||
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
|
||||
</if>
|
||||
<if test="lyEndTime != null">
|
||||
<if test="lyEndTime != null and lyEndTime != ''">
|
||||
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
|
||||
</if>
|
||||
|
||||
@@ -1247,7 +1321,6 @@
|
||||
AND is_chuku = '1'
|
||||
AND is_delivery = '1'
|
||||
|
||||
<!-- 可选过滤:比如你以后想限定县局、项目等 -->
|
||||
<if test="q.xj != null and q.xj != ''">
|
||||
AND xj = #{q.xj}
|
||||
</if>
|
||||
@@ -1267,13 +1340,59 @@
|
||||
ORDER BY bill_no_ck, ly_time, id
|
||||
</select>
|
||||
|
||||
<!-- 根据入库单号查询单据头公共信息 -->
|
||||
<select id="selectHeaderByBillNo"
|
||||
parameterType="java.lang.String"
|
||||
resultMap="RkInfoResult">
|
||||
SELECT
|
||||
ri.id,
|
||||
ri.bill_no,
|
||||
ri.bill_no_ck,
|
||||
ri.is_chuku,
|
||||
ri.rk_type,
|
||||
st.type_name AS rk_type_name,
|
||||
ri.wl_type,
|
||||
mt.type_name AS wl_type_name,
|
||||
ri.rk_time,
|
||||
ri.ly_time,
|
||||
ri.lihuo_y,
|
||||
u.user_name AS lihuo_y_name,
|
||||
|
||||
ri.cangku,
|
||||
wh.warehouse_name AS cangku_name,
|
||||
wh.parent_warehouse_code AS parent_warehouse_code,
|
||||
wh.parent_warehouse_name AS parent_warehouse_name,
|
||||
wh.warehouse_code AS warehouse_code,
|
||||
wh.warehouse_name AS warehouse_name
|
||||
|
||||
FROM rk_info ri
|
||||
LEFT JOIN stock_in_type st ON ri.rk_type = st.type_code
|
||||
LEFT JOIN material_type mt ON ri.wl_type = mt.type_code
|
||||
LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code
|
||||
LEFT JOIN sys_user u ON ri.lihuo_y = u.user_id
|
||||
WHERE ri.is_delete = '0'
|
||||
AND ri.bill_no = #{billNo}
|
||||
ORDER BY ri.rk_time ASC, ri.id ASC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<update id="updateBillInfo" parameterType="com.zg.project.wisdom.domain.RkInfo">
|
||||
UPDATE rk_info
|
||||
<set>
|
||||
<if test="rkType != null">rk_type = #{rkType},</if>
|
||||
<if test="wlType != null">wl_type = #{wlType},</if>
|
||||
<if test="cangku != null">cangku = #{cangku},</if>
|
||||
<if test="rkTime != null">rk_time = #{rkTime},</if>
|
||||
<if test="rkType != null">
|
||||
rk_type = #{rkType},
|
||||
</if>
|
||||
<if test="wlType != null">
|
||||
wl_type = #{wlType},
|
||||
</if>
|
||||
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
cangku = #{warehouseCode},
|
||||
</if>
|
||||
|
||||
<if test="rkTime != null">
|
||||
rk_time = #{rkTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE bill_no = #{billNo}
|
||||
</update>
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="selectEnabledWarehouses" resultMap="WarehouseLiteMap">
|
||||
SELECT wi.warehouse_code, wi.warehouse_name
|
||||
SELECT wi.warehouse_code,
|
||||
wi.warehouse_name
|
||||
FROM warehouse_info wi
|
||||
WHERE wi.status = 1
|
||||
ORDER BY wi.warehouse_code
|
||||
@@ -36,15 +37,17 @@
|
||||
ON pd.scene = sm.scene_code
|
||||
LEFT JOIN rk_info ri
|
||||
ON pd.pcode = ri.pcode
|
||||
WHERE pd.warehouse = #{warehouseCode}
|
||||
AND (pd.is_delete IS NULL OR pd.is_delete = 0)
|
||||
WHERE pd.warehouse_code = #{warehouseCode}
|
||||
AND (pd.is_delete IS NULL OR pd.is_delete = '0')
|
||||
GROUP BY sm.scene_code, sm.scene_name
|
||||
ORDER BY sm.scene_code
|
||||
</select>
|
||||
|
||||
<!-- 3) 启用仓库总数 -->
|
||||
<select id="countEnabledWarehouses" resultType="int">
|
||||
SELECT COUNT(*) FROM warehouse_info wi WHERE wi.status = 1
|
||||
SELECT COUNT(*)
|
||||
FROM warehouse_info wi
|
||||
WHERE wi.status = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user