@@ -25,13 +25,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "theFloor" column= "the_floor" />
<result property= "productId" column= "product_id" />
<result property= "productName" column= "product_name" />
<result property= "trayCode" column= "tray_code" />
</resultMap>
<sql id= "selectMydoJobVo" >
select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,the_floor,product_id,product_name from mydo_job_wcs
select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,the_floor,product_id,product_name,tray_code from mydo_job_wcs
</sql>
<sql id= "selectMydoJobFinishVo" >
select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,the_floor from mydo_job_wcs_finish
select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,the_floor,product_id,product_name,tray_code from mydo_job_wcs_finish
</sql>
<select id= "selectMydoJobList" parameterType= "MydoJob" resultMap= "MydoJobResult" >
@@ -55,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "theFloor != null and theFloor != ''" > and the_floor = #{theFloor}</if>
<if test= "productId != null and productId != ''" > and product_id = #{productId}</if>
<if test= "productName != null and productName != ''" > and product_name = #{productName}</if>
<if test= "trayCode != null and trayCode != ''" > and tray_code = #{trayCode}</if>
</where>
</select>
@@ -118,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "warehouseId != null" > warehouse_id,</if>
<if test= "faultFlag != null" > fault_flag,</if>
<if test= "theFloor != null" > the_floor,</if>
<if test= "trayCode != null" > tray_code,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "jobId != null" > #{jobId},</if>
@@ -138,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "warehouseId != null" > #{warehouseId},</if>
<if test= "faultFlag != null" > #{faultFlag},</if>
<if test= "theFloor != null" > #{theFloor},</if>
<if test= "trayCode != null" > #{trayCode},</if>
</trim>
</insert>
<insert id= "insertHistory" >
@@ -244,4 +248,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and status = 3
order by priority desc,create_time
</select>
<select id= "selectMydoJobOut" resultMap= "MydoJobResult" >
WITH floor_group AS (
SELECT
b.cargo_space_id,
b.group_coding_no,
b.the_floor,
b.group_coding,
a.task_no AS task_no,
a.job_id AS job_id,
a.in_or_out, -- 之前新增的字段
a.target_cargo_space_id, -- 新增字段: 加入target_cargo_space_id
ROW_NUMBER() OVER (PARTITION BY b.the_floor ORDER BY b.group_coding DESC) AS rn
FROM
mydo_job_wcs a
INNER JOIN bas_cargo_space b
ON a.cargo_space_id = b.cargo_space_id
AND a.the_floor = b.the_floor
WHERE
a.in_or_out >= 20
AND a.status = '1'
GROUP BY
b.group_coding_no,
b.cargo_space_id,
b.the_floor,
b.group_coding,
a.task_no,
a.job_id,
a.create_time,
a.in_or_out, -- 之前新增的分组字段
a.target_cargo_space_id -- 分组字段中新增: 必须加入GROUP BY
)
SELECT
cargo_space_id,
group_coding_no,
the_floor,
task_no,
job_id,
in_or_out, -- 之前新增的展示字段
target_cargo_space_id -- 最终查询结果中显示该字段
FROM
floor_group
WHERE
rn < = 2
ORDER BY
group_coding DESC;
</select>
<select id= "selectMydoJobByTrayCode" resultMap= "MydoJobResult" >
<include refid= "selectMydoJobVo" />
where tray_code =#{trayCode}
</select>
<select id= "selectExit" parameterType= "string" resultType= "java.lang.Integer" >
select count(1) from mydo_job_wcs where in_or_out>=20 and exit_id = #{exitId}
</select>
<select id= "selectMydoJobCount" resultType= "java.lang.Integer" >
select count(1) from mydo_job_wcs
</select>
</mapper>