|
@@ -136,9 +136,20 @@
|
|
|
<where>
|
|
<where>
|
|
|
<if test="param != null and param.spotId != null">
|
|
<if test="param != null and param.spotId != null">
|
|
|
and tbl.spot_id = #{param.spotId}
|
|
and tbl.spot_id = #{param.spotId}
|
|
|
- ORDER BY tbl.queueNo is null, tbl.queueNo asc
|
|
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
|
|
+ ORDER BY
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="param != null and param.spotId != null">
|
|
|
|
|
+ tbl.queueNo is null, tbl.queueNo asc
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="param != null and param.sortBy != null">
|
|
|
|
|
+ #{sortBy} #{sortType}
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ tbl.createDate desc
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 查询未派单车辆 -->
|
|
<!-- 查询未派单车辆 -->
|
|
@@ -150,42 +161,122 @@
|
|
|
WHERE truck.org_id = #{orgId} and wo.id is null
|
|
WHERE truck.org_id = #{orgId} and wo.id is null
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+ <!-- 条件查询车辆数量 -->
|
|
|
|
|
+ <select id="getOrgOrderCount" parameterType="com.aoyang.tms.controller.param.WorkManagePageParam" resultType="java.lang.Integer">
|
|
|
|
|
+ SELECT count(1)
|
|
|
|
|
+ FROM (
|
|
|
|
|
+ select truck.truck_id from
|
|
|
|
|
+ truck
|
|
|
|
|
+ left join (
|
|
|
|
|
+ select * from tms_work_order wo where 40 > wo.order_status
|
|
|
|
|
+ order by order_status desc, plan_reach_time asc
|
|
|
|
|
+ ) two on truck.truck_id = two.truck_id
|
|
|
|
|
+ WHERE truck.org_id = #{param.orgId} and wo.id is null
|
|
|
|
|
+ <if test="param!=null and param.deptId!=null">
|
|
|
|
|
+ and truck.dept_id = #{param.deptId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.carNumber!=null and param.carNumber!='' ">
|
|
|
|
|
+ and truck.car_number = #{param.carNumber}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.shipperId!=null">
|
|
|
|
|
+ and two.shipper_id = #{param.shipperId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.orderStatus!=null">
|
|
|
|
|
+ and two.order_status = #{param.orderStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.type!=null">
|
|
|
|
|
+ and two.type = #{param.type}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ group by truck.truck_id
|
|
|
|
|
+ ) tbl
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 查询总运力 -->
|
|
|
|
|
+ <select id="getTotalCount" parameterType="com.aoyang.tms.controller.param.WorkManagePageParam" resultType="java.lang.Integer">
|
|
|
|
|
+ SELECT count(1)
|
|
|
|
|
+ FROM (
|
|
|
|
|
+ select truck_id FROM truck
|
|
|
|
|
+ left join (
|
|
|
|
|
+ select * from tms_work_order wo where 40 > wo.order_status
|
|
|
|
|
+ order by order_status desc, plan_reach_time asc
|
|
|
|
|
+ ) two on truck.truck_id = two.truck_id
|
|
|
|
|
+ WHERE truck.org_id = #{param.orgId}
|
|
|
|
|
+ <if test="param!=null and param.deptId!=null">
|
|
|
|
|
+ and truck.dept_id = #{param.deptId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.carNumber!=null and param.carNumber!='' ">
|
|
|
|
|
+ and truck.car_number = #{param.carNumber}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.shipperId!=null">
|
|
|
|
|
+ and two.shipper_id = #{param.shipperId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ group by truck.truck_id
|
|
|
|
|
+ ) tbl
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
<!-- 查询未执行派单车辆 -->
|
|
<!-- 查询未执行派单车辆 -->
|
|
|
- <select id="getUnExecutedOrderTruckCount" resultType="java.lang.Integer">
|
|
|
|
|
|
|
+ <select id="getUnExecutedOrderTruckCount" parameterType="com.aoyang.tms.controller.param.WorkManagePageParam" resultType="java.lang.Integer">
|
|
|
SELECT count(1)
|
|
SELECT count(1)
|
|
|
FROM ( select id from truck left join tms_work_order wo on truck.truck_id = wo.truck_id and wo.order_status = 0
|
|
FROM ( select id from truck left join tms_work_order wo on truck.truck_id = wo.truck_id and wo.order_status = 0
|
|
|
- WHERE truck.org_id = #{orgId} and wo.id is not null
|
|
|
|
|
|
|
+ WHERE truck.org_id = #{param.orgId} and wo.id is not null
|
|
|
|
|
+ <if test="param!=null and param.deptId!=null">
|
|
|
|
|
+ and truck.dept_id = #{param.deptId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.carNumber!=null and param.carNumber!='' ">
|
|
|
|
|
+ and truck.car_number = #{param.carNumber}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.shipperId!=null">
|
|
|
|
|
+ and wo.shipper_id = #{param.shipperId}
|
|
|
|
|
+ </if>
|
|
|
group by truck.truck_id ) tbl
|
|
group by truck.truck_id ) tbl
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 查询未派单车辆 -->
|
|
<!-- 查询未派单车辆 -->
|
|
|
- <select id="getUnAllocatedTruckCount" resultType="java.lang.Integer">
|
|
|
|
|
|
|
+ <select id="getUnAllocatedTruckCount" parameterType="com.aoyang.tms.controller.param.WorkManagePageParam" resultType="java.lang.Integer">
|
|
|
SELECT count(1)
|
|
SELECT count(1)
|
|
|
FROM
|
|
FROM
|
|
|
truck left join tms_work_order wo on truck.truck_id = wo.truck_id and 40 > wo.order_status
|
|
truck left join tms_work_order wo on truck.truck_id = wo.truck_id and 40 > wo.order_status
|
|
|
- WHERE truck.org_id = #{orgId} and wo.id is null
|
|
|
|
|
|
|
+ WHERE truck.org_id = #{param.orgId} and wo.id is null
|
|
|
|
|
+ <if test="param!=null and param.deptId!=null">
|
|
|
|
|
+ and truck.dept_id = #{param.deptId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.carNumber!=null and param.carNumber!='' ">
|
|
|
|
|
+ and truck.car_number = #{param.carNumber}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.shipperId!=null">
|
|
|
|
|
+ and wo.shipper_id = #{param.shipperId}
|
|
|
|
|
+ </if>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 查询未派指定类型运单车车辆 -->
|
|
<!-- 查询未派指定类型运单车车辆 -->
|
|
|
- <select id="getUnAllocatedOrderCount" resultType="java.lang.Integer">
|
|
|
|
|
|
|
+ <select id="getUnAllocatedOrderCount" parameterType="com.aoyang.tms.controller.param.WorkManagePageParam" resultType="java.lang.Integer">
|
|
|
SELECT count(1)
|
|
SELECT count(1)
|
|
|
FROM
|
|
FROM
|
|
|
truck
|
|
truck
|
|
|
left join tms_work_order wo on truck.truck_id = wo.truck_id and 40 > wo.order_status
|
|
left join tms_work_order wo on truck.truck_id = wo.truck_id and 40 > wo.order_status
|
|
|
- <if test="orderType != null and orderType == 1">
|
|
|
|
|
- and wo.type = #{orderType}
|
|
|
|
|
|
|
+ <if test="param.orderType == 1">
|
|
|
|
|
+ and wo.type = #{param.orderType}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderType != null and orderType == 2">
|
|
|
|
|
- and wo.type = #{orderType}
|
|
|
|
|
|
|
+ <if test="param.orderType == 2">
|
|
|
|
|
+ and wo.type = #{param.orderType}
|
|
|
</if>
|
|
</if>
|
|
|
left join tms_work_cycle wc on truck.truck_id = wc.truck_id and wc.status = 1
|
|
left join tms_work_cycle wc on truck.truck_id = wc.truck_id and wc.status = 1
|
|
|
- WHERE truck.org_id = #{orgId} and wo.id is null
|
|
|
|
|
- <if test="orderType != null and orderType == 1">
|
|
|
|
|
|
|
+ WHERE truck.org_id = #{param.orgId} and wo.id is null
|
|
|
|
|
+ <if test="param.orderType == 1">
|
|
|
and ( wc.jing_weight = 0 or wc.jing_weight is null )
|
|
and ( wc.jing_weight = 0 or wc.jing_weight is null )
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderType != null and orderType == 2">
|
|
|
|
|
|
|
+ <if test="param.orderType == 2">
|
|
|
and wc.jing_weight > 0
|
|
and wc.jing_weight > 0
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="param!=null and param.deptId!=null">
|
|
|
|
|
+ and truck.dept_id = #{param.deptId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.shipperId!=null">
|
|
|
|
|
+ and wo.shipper_id = #{param.shipperId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="param!=null and param.carNumber!=null and param.carNumber!='' ">
|
|
|
|
|
+ and truck.car_number = #{param.carNumber}
|
|
|
|
|
+ </if>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|