|
|
@ -22,9 +22,9 @@ |
|
|
t.proofing_number AS sampleQty, |
|
|
t.proofing_number AS sampleQty, |
|
|
t.pm_inquery_time, |
|
|
t.pm_inquery_time, |
|
|
t.importance, |
|
|
t.importance, |
|
|
-- 打样完成日期口径:actuality_delivery_date(DeliveryPackage 完成时回写),未完成则为空。 |
|
|
|
|
|
CASE WHEN t.required_delivery_date IS NULL THEN NULL ELSE YEAR(t.required_delivery_date) END AS sampleMakingYear, |
|
|
|
|
|
CASE WHEN t.required_delivery_date IS NULL THEN NULL ELSE MONTH(t.required_delivery_date) END AS sampleMakingMonth, |
|
|
|
|
|
|
|
|
-- 实际完成日期优先;为空时使用预计完成日期,与 Sample making Date 筛选保持一致。 |
|
|
|
|
|
YEAR(COALESCE(t.actuality_delivery_date, t.required_delivery_date)) AS sampleMakingYear, |
|
|
|
|
|
MONTH(COALESCE(t.actuality_delivery_date, t.required_delivery_date)) AS sampleMakingMonth, |
|
|
CASE |
|
|
CASE |
|
|
WHEN t.actuality_delivery_date IS NULL OR t.plan_start_date IS NULL THEN NULL |
|
|
WHEN t.actuality_delivery_date IS NULL OR t.plan_start_date IS NULL THEN NULL |
|
|
ELSE DATEDIFF(DAY, t.plan_start_date, t.actuality_delivery_date) |
|
|
ELSE DATEDIFF(DAY, t.plan_start_date, t.actuality_delivery_date) |
|
|
@ -187,14 +187,12 @@ |
|
|
<if test="query.endDate != null"> |
|
|
<if test="query.endDate != null"> |
|
|
and #{query.endDate,jdbcType=DATE} >= t.plan_start_date |
|
|
and #{query.endDate,jdbcType=DATE} >= t.plan_start_date |
|
|
</if> |
|
|
</if> |
|
|
<if test="query.sampleMakingYear != null"> |
|
|
|
|
|
<!-- 无打样完成日期的记录不能按年/月命中,避免把未完成单据算进完成年/月。 --> |
|
|
|
|
|
and t.actuality_delivery_date is not null |
|
|
|
|
|
and YEAR(t.actuality_delivery_date) = #{query.sampleMakingYear} |
|
|
|
|
|
|
|
|
<if test="query.sampleMakingDateStart != null"> |
|
|
|
|
|
and COALESCE(t.actuality_delivery_date, t.required_delivery_date) >= #{query.sampleMakingDateStart,jdbcType=DATE} |
|
|
</if> |
|
|
</if> |
|
|
<if test="query.sampleMakingMonth != null"> |
|
|
|
|
|
and t.actuality_delivery_date is not null |
|
|
|
|
|
and MONTH(t.actuality_delivery_date) = #{query.sampleMakingMonth} |
|
|
|
|
|
|
|
|
<if test="query.sampleMakingDateEnd != null"> |
|
|
|
|
|
<!-- 包含结束日期当天的所有时间,不遗漏带时分秒的实际完成记录。 --> |
|
|
|
|
|
and COALESCE(t.actuality_delivery_date, t.required_delivery_date) < DATEADD(DAY, 1, #{query.sampleMakingDateEnd,jdbcType=DATE}) |
|
|
</if> |
|
|
</if> |
|
|
<if test="query.pmInqueryTimeStart != null"> |
|
|
<if test="query.pmInqueryTimeStart != null"> |
|
|
and t.pm_inquery_time >= #{query.pmInqueryTimeStart,jdbcType=DATE} |
|
|
and t.pm_inquery_time >= #{query.pmInqueryTimeStart,jdbcType=DATE} |
|
|
|