|
|
|
|
@@ -21,7 +21,7 @@
|
|
|
|
|
LEFT JOIN md_me_materialbase material ON material.material_id = ShiftOrder.material_id
|
|
|
|
|
LEFT JOIN PDM_BI_WorkProcedure pro ON pro.workprocedure_id = ShiftOrder.workprocedure_id
|
|
|
|
|
LEFT JOIN sys_user users ON users.user_id = ShiftOrder.current_produce_person_id
|
|
|
|
|
LEFT JOIN pdm_bi_device device ON ShiftOrder.device_code = device.device_code
|
|
|
|
|
LEFT JOIN pdm_bi_device device ON ShiftOrder.device_code = device.device_code
|
|
|
|
|
WHERE
|
|
|
|
|
ShiftOrder.is_delete = '0'
|
|
|
|
|
<if test="query.workorder_code != null and query.workorder_code != ''">
|
|
|
|
|
@@ -31,40 +31,41 @@
|
|
|
|
|
and find_in_set(ShiftOrder.workorder_status, #{query.order_status})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.device_code != null and query.device_code != ''">
|
|
|
|
|
and (ShiftOrder.device_code like concat('%',${query.device_code},'%') or ShiftOrder.device_name like concat('%',${query.device_code},'%'))
|
|
|
|
|
and (ShiftOrder.device_code like concat('%',${query.device_code},'%') or ShiftOrder.device_name like
|
|
|
|
|
concat('%',${query.device_code},'%'))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.shift_type_scode != null and query.shift_type_scode != ''">
|
|
|
|
|
and ShiftOrder.shift_type_scode = #{query.shift_type_scode}
|
|
|
|
|
and ShiftOrder.shift_type_scode = #{query.shift_type_scode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.workprocedure_id != null and query.workprocedure_id != ''">
|
|
|
|
|
and pro.workprocedure_id = #{query.workprocedure_id}
|
|
|
|
|
and pro.workprocedure_id = #{query.workprocedure_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.workprocedure_codes != null and query.workprocedure_codes != ''">
|
|
|
|
|
and pro.workprocedure_code IN #{query.workprocedure_codes}
|
|
|
|
|
and pro.workprocedure_code IN #{query.workprocedure_codes}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.product_area != null and query.product_area != ''">
|
|
|
|
|
and ShiftOrder.product_area = #{query.product_area}
|
|
|
|
|
and ShiftOrder.product_area = #{query.product_area}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.is_error != null and query.is_error != ''">
|
|
|
|
|
and ShiftOrder.is_error = #{query.is_error}
|
|
|
|
|
and ShiftOrder.is_error = #{query.is_error}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.product_series != null and query.product_series != ''">
|
|
|
|
|
and ShiftOrder.materialprocess_series in ${query.product_series}
|
|
|
|
|
and ShiftOrder.materialprocess_series in ${query.product_series}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.start_time != null and query.start_time != ''">
|
|
|
|
|
and ShiftOrder.realproducestart_date >= #{query.start_time}
|
|
|
|
|
and ShiftOrder.realproducestart_date >= #{query.start_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.end_time != null and query.end_time != ''">
|
|
|
|
|
and ShiftOrder.realproduceend_date <= #{query.end_time}
|
|
|
|
|
and ShiftOrder.realproduceend_date <= #{query.end_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.plan_start_time != null and query.plan_start_time != ''">
|
|
|
|
|
and STR_TO_DATE(ShiftOrder.planproducestart_date, '%Y/%m/%d %H:%i:%s') >= #{query.plan_start_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.plan_end_time != null and query.plan_end_time != ''">
|
|
|
|
|
and STR_TO_DATE(ShiftOrder.planproduceend_date, '%Y/%m/%d %H:%i:%s') <= #{query.plan_end_time}
|
|
|
|
|
and STR_TO_DATE(ShiftOrder.planproduceend_date, '%Y/%m/%d %H:%i:%s') <= #{query.plan_end_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.sale_id != null and query.sale_id != ''">
|
|
|
|
|
and ShiftOrder.sale_id like '%${query.sale_id}%'
|
|
|
|
|
and ShiftOrder.sale_id like '%${query.sale_id}%'
|
|
|
|
|
</if>
|
|
|
|
|
<if test="query.material != null and query.material != ''">
|
|
|
|
|
and (
|
|
|
|
|
@@ -140,7 +141,6 @@
|
|
|
|
|
workorder.aps_update_time,
|
|
|
|
|
workorder.package_ext,
|
|
|
|
|
workorder.is_used_fxx,
|
|
|
|
|
workorder.aps_workprocedure_no,
|
|
|
|
|
workorder.aps_update_inner_flag,
|
|
|
|
|
workorder.update_id,
|
|
|
|
|
workorder.update_name,
|
|
|
|
|
@@ -163,8 +163,8 @@
|
|
|
|
|
</if>
|
|
|
|
|
<if test="key_value != null and key_value != ''">
|
|
|
|
|
and (
|
|
|
|
|
workorder.workorder_code like %${key_value}% or
|
|
|
|
|
mater.material_name like%${key_value}% or
|
|
|
|
|
workorder.workorder_code like %${key_value}% or
|
|
|
|
|
mater.material_name like%${key_value}% or
|
|
|
|
|
mater.material_code like %${key_value}%
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
@@ -180,7 +180,8 @@
|
|
|
|
|
</if>
|
|
|
|
|
order by workorder_code desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="orderListByDevLimit" resultType="org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto">
|
|
|
|
|
<select id="orderListByDevLimit"
|
|
|
|
|
resultType="org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto">
|
|
|
|
|
select pdm_bi_device.deviceinstor_qty,
|
|
|
|
|
(pdm_produce_workorder.plan_qty- pdm_produce_workorder.dq_real_qty) as needQty,
|
|
|
|
|
(pdm_bi_device.inupperlimit_qty - pdm_bi_device.deviceinstor_qty ) as limitQty,
|
|
|
|
|
@@ -188,19 +189,19 @@
|
|
|
|
|
from pdm_produce_workorder
|
|
|
|
|
LEFT JOIN pdm_bi_device on pdm_produce_workorder.device_code = pdm_bi_device.device_code
|
|
|
|
|
where pdm_bi_device.inlowerlimit_qty > pdm_bi_device.deviceinstor_qty
|
|
|
|
|
and pdm_produce_workorder.is_needmove = true and pdm_produce_workorder.workorder_status = '3'
|
|
|
|
|
and pdm_produce_workorder.is_needmove = true and pdm_produce_workorder.workorder_status = '3'
|
|
|
|
|
<if test="workprocedure_id != null and workprocedure_id != ''">
|
|
|
|
|
and pdm_produce_workorder.workprocedure_id = #{workprocedure_id}
|
|
|
|
|
and pdm_produce_workorder.workprocedure_id = #{workprocedure_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="material_id != null and material_id != ''">
|
|
|
|
|
and pdm_produce_workorder.material_id = #{material_id}
|
|
|
|
|
and pdm_produce_workorder.material_id = #{material_id}
|
|
|
|
|
</if>
|
|
|
|
|
HAVING needQty > pdm_bi_device.deviceinstor_qty order by limitQty desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<update id="batchUpdateByParam">
|
|
|
|
|
update PDM_produce_workOrder set
|
|
|
|
|
<foreach collection="event" item="item" separator=",">
|
|
|
|
|
<foreach collection="event" item="item" separator=",">
|
|
|
|
|
${item.field} = ${item.field}
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="item.add == true">
|
|
|
|
|
@@ -217,57 +218,106 @@
|
|
|
|
|
<select id="queryExistWorkOrder" resultType="java.lang.String">
|
|
|
|
|
SELECT WORKORDER_ID
|
|
|
|
|
FROM PDM_PRODUCE_WORKORDER
|
|
|
|
|
WHERE WORKORDER_STATUS <'5'
|
|
|
|
|
WHERE WORKORDER_STATUS < '5'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertBatch" keyProperty="workorder_id" useGeneratedKeys="false">
|
|
|
|
|
insert into pdm_produce_workorder(workorder_id,workorder_code, shift_type_scode, workprocedure_id, product_area, plan_qty, person_real_qty, dq_real_qty, material_id, material_weight, planproducestart_date, planproduceend_date, realproducestart_date, realproduceend_date, device_code, current_produce_person_id, is_canupdate_update, materialprocess_series, workorder_status, is_needmove, sale_id, create_type, is_error, error_info, remark, create_id, create_name, create_time, is_delete, report_qty, order_type_scode, nok_qty, repare_qty, down_id, down_name, down_time, confirm_id, confirm_name, confirm_time, aps_workorder_status, aps_update_flag, aps_update_time, package_ext, is_used_fxx, aps_workprocedure_no, aps_update_inner_flag, update_id, update_name, update_time, device_name)
|
|
|
|
|
insert into pdm_produce_workorder(workorder_id,workorder_code, shift_type_scode, workprocedure_id, product_area,
|
|
|
|
|
plan_qty, person_real_qty, dq_real_qty, material_id, material_weight, planproducestart_date,
|
|
|
|
|
planproduceend_date, realproducestart_date, realproduceend_date, device_code, current_produce_person_id,
|
|
|
|
|
is_canupdate_update, materialprocess_series, workorder_status, is_needmove, sale_id, create_type, is_error,
|
|
|
|
|
error_info, remark, create_id, create_name, create_time, is_delete, report_qty, order_type_scode, nok_qty,
|
|
|
|
|
repare_qty, down_id, down_name, down_time, confirm_id, confirm_name, confirm_time, aps_workorder_status,
|
|
|
|
|
aps_update_flag, aps_update_time, package_ext, is_used_fxx, aps_update_inner_flag,
|
|
|
|
|
update_id, update_name, update_time, device_name)
|
|
|
|
|
values
|
|
|
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
|
|
|
(#{entity.workorder_id},#{entity.workorder_code}, #{entity.shift_type_scode}, #{entity.workprocedure_id}, #{entity.product_area}, #{entity.plan_qty}, #{entity.person_real_qty}, #{entity.dq_real_qty}, #{entity.material_id}, #{entity.material_weight}, #{entity.planproducestart_date}, #{entity.planproduceend_date}, #{entity.realproducestart_date}, #{entity.realproduceend_date}, #{entity.device_code}, #{entity.current_produce_person_id}, #{entity.is_canupdate_update}, #{entity.materialprocess_series}, #{entity.workorder_status}, #{entity.is_needmove}, #{entity.sale_id}, #{entity.create_type}, #{entity.is_error}, #{entity.error_info}, #{entity.remark}, #{entity.create_id}, #{entity.create_name}, #{entity.create_time}, #{entity.is_delete}, #{entity.report_qty}, #{entity.order_type_scode}, #{entity.nok_qty}, #{entity.repare_qty}, #{entity.down_id}, #{entity.down_name}, #{entity.down_time}, #{entity.confirm_id}, #{entity.confirm_name}, #{entity.confirm_time}, #{entity.aps_workorder_status}, #{entity.aps_update_flag}, #{entity.aps_update_time}, #{entity.package_ext}, #{entity.is_used_fxx}, #{entity.aps_workprocedure_no}, #{entity.aps_update_inner_flag}, #{entity.update_id}, #{entity.update_name}, #{entity.update_time}, #{entity.device_name})
|
|
|
|
|
(#{entity.workorder_id},#{entity.workorder_code}, #{entity.shift_type_scode}, #{entity.workprocedure_id},
|
|
|
|
|
#{entity.product_area}, #{entity.plan_qty}, #{entity.person_real_qty}, #{entity.dq_real_qty},
|
|
|
|
|
#{entity.material_id}, #{entity.material_weight}, #{entity.planproducestart_date},
|
|
|
|
|
#{entity.planproduceend_date}, #{entity.realproducestart_date}, #{entity.realproduceend_date},
|
|
|
|
|
#{entity.device_code}, #{entity.current_produce_person_id}, #{entity.is_canupdate_update},
|
|
|
|
|
#{entity.materialprocess_series}, #{entity.workorder_status}, #{entity.is_needmove}, #{entity.sale_id},
|
|
|
|
|
#{entity.create_type}, #{entity.is_error}, #{entity.error_info}, #{entity.remark}, #{entity.create_id},
|
|
|
|
|
#{entity.create_name}, #{entity.create_time}, #{entity.is_delete}, #{entity.report_qty},
|
|
|
|
|
#{entity.order_type_scode}, #{entity.nok_qty}, #{entity.repare_qty}, #{entity.down_id}, #{entity.down_name},
|
|
|
|
|
#{entity.down_time}, #{entity.confirm_id}, #{entity.confirm_name}, #{entity.confirm_time},
|
|
|
|
|
#{entity.aps_workorder_status}, #{entity.aps_update_flag}, #{entity.aps_update_time}, #{entity.package_ext},
|
|
|
|
|
#{entity.is_used_fxx}, #{entity.aps_update_inner_flag}, #{entity.update_id},
|
|
|
|
|
#{entity.update_name}, #{entity.update_time}, #{entity.device_name})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="goodAnalysis" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
sum( pdm_produce_workorder.real_qty ) real_qty,
|
|
|
|
|
sum( pdm_produce_workorder.dq_real_qty ) dq_real_qty,
|
|
|
|
|
sum( pdm_produce_workorder.nok_qty ) nok_qty,
|
|
|
|
|
md_me_materialbase.material_name,
|
|
|
|
|
md_me_materialbase.material_spec,
|
|
|
|
|
sum( pdm_produce_workorder.dq_real_qty ) dq_real_qty,
|
|
|
|
|
sum( pdm_produce_workorder.nok_qty ) nok_qty,
|
|
|
|
|
md_me_materialbase.material_name,
|
|
|
|
|
md_me_materialbase.material_spec,
|
|
|
|
|
sum( pdm_produce_workorder.real_qty )*rate_qty*1000 as rate_weight,
|
|
|
|
|
sum( pdm_produce_workorder.real_qty )*md_me_materialbase.net_weight as product_weight,
|
|
|
|
|
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.real_qty )*md_me_materialbase.net_weight/(sum( pdm_produce_workorder.real_qty )*rate_qty*1000),1) as yield_rate,
|
|
|
|
|
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.nok_qty )/sum(pdm_produce_workorder.real_qty ),0) as nok_rate,
|
|
|
|
|
if(sum(pdm_produce_workorder.real_qty )>0,1-sum( pdm_produce_workorder.nok_qty )/sum(pdm_produce_workorder.real_qty ),1) as endproduct_rate,
|
|
|
|
|
MD_ME_SemiRealRawMaterial.raw_material_code,
|
|
|
|
|
pdm_bi_workprocedure.workprocedure_name,
|
|
|
|
|
md_me_materialbase.material_code
|
|
|
|
|
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.real_qty
|
|
|
|
|
)*md_me_materialbase.net_weight/(sum( pdm_produce_workorder.real_qty )*rate_qty*1000),1) as yield_rate,
|
|
|
|
|
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.nok_qty
|
|
|
|
|
)/sum(pdm_produce_workorder.real_qty ),0) as nok_rate,
|
|
|
|
|
if(sum(pdm_produce_workorder.real_qty )>0,1-sum( pdm_produce_workorder.nok_qty
|
|
|
|
|
)/sum(pdm_produce_workorder.real_qty ),1) as endproduct_rate,
|
|
|
|
|
MD_ME_SemiRealRawMaterial.raw_material_code,
|
|
|
|
|
pdm_bi_workprocedure.workprocedure_name,
|
|
|
|
|
md_me_materialbase.material_code
|
|
|
|
|
FROM
|
|
|
|
|
pdm_produce_workorder
|
|
|
|
|
LEFT JOIN pdm_bi_workprocedure ON pdm_produce_workorder.workprocedure_id = pdm_bi_workprocedure.workprocedure_id
|
|
|
|
|
LEFT JOIN md_me_materialbase ON pdm_produce_workorder.material_id = md_me_materialbase.material_id
|
|
|
|
|
LEFT JOIN MD_ME_SemiRealRawMaterial ON pdm_produce_workorder.material_id = MD_ME_SemiRealRawMaterial.semi_material_id
|
|
|
|
|
pdm_produce_workorder
|
|
|
|
|
LEFT JOIN pdm_bi_workprocedure ON pdm_produce_workorder.workprocedure_id = pdm_bi_workprocedure.workprocedure_id
|
|
|
|
|
LEFT JOIN md_me_materialbase ON pdm_produce_workorder.material_id = md_me_materialbase.material_id
|
|
|
|
|
LEFT JOIN MD_ME_SemiRealRawMaterial ON pdm_produce_workorder.material_id =
|
|
|
|
|
MD_ME_SemiRealRawMaterial.semi_material_id
|
|
|
|
|
WHERE
|
|
|
|
|
pdm_bi_workprocedure.is_first = '1'
|
|
|
|
|
AND md_me_materialbase.material_code IS NOT NULL
|
|
|
|
|
pdm_bi_workprocedure.is_first = '1'
|
|
|
|
|
AND md_me_materialbase.material_code IS NOT NULL
|
|
|
|
|
<if test="start_time != null and start_time != ''">
|
|
|
|
|
and pdm_produce_workorder.create_time >= #{start_time}
|
|
|
|
|
and pdm_produce_workorder.create_time >= #{start_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="product_area != null and product_area != ''">
|
|
|
|
|
and pdm_produce_workorder.product_area >= #{product_area}
|
|
|
|
|
and pdm_produce_workorder.product_area >= #{product_area}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="start_time != null and start_time != ''">
|
|
|
|
|
and #{end_time} >= pdm_produce_workorder.create_time
|
|
|
|
|
and #{end_time} >= pdm_produce_workorder.create_time
|
|
|
|
|
</if>
|
|
|
|
|
<if test="blurry != null and blurry != ''">
|
|
|
|
|
and (
|
|
|
|
|
md_me_materialbase.material_code like '%${blurry}%' or
|
|
|
|
|
md_me_materialbase.material_spec like '%${blurry}%' )
|
|
|
|
|
md_me_materialbase.material_spec like '%${blurry}%' )
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY
|
|
|
|
|
md_me_materialbase.material_code,
|
|
|
|
|
pdm_bi_workprocedure.workprocedure_name
|
|
|
|
|
md_me_materialbase.material_code,
|
|
|
|
|
pdm_bi_workprocedure.workprocedure_name
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="queryAdjustWorkOrder" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
w.workprocedure_name,
|
|
|
|
|
DATE_FORMAT( orders.plandeliver_date, '%Y-%m-%d' ) AS plandeliver_date,
|
|
|
|
|
mater.material_spec,
|
|
|
|
|
SUBSTRING_INDEX( workorder.workorder_id, ':', 2 ) AS workorder_no,
|
|
|
|
|
COUNT( DISTINCT workorder.device_code ) AS device_count,
|
|
|
|
|
COUNT( workorder.workorder_code ) AS workorder_count,
|
|
|
|
|
MIN(DATE_FORMAT(workorder.planproducestart_date, '%Y-%m-%d %H:%i:%s')) AS start_time
|
|
|
|
|
FROM
|
|
|
|
|
pdm_produce_workorder workorder
|
|
|
|
|
LEFT JOIN mps_sale_order orders ON workorder.sale_id = orders.sale_code
|
|
|
|
|
LEFT JOIN md_me_materialbase mater ON workorder.material_id = mater.material_id
|
|
|
|
|
LEFT JOIN pdm_bi_workprocedure w ON workorder.workprocedure_id = w.workprocedure_id
|
|
|
|
|
WHERE
|
|
|
|
|
workorder.is_delete = '0' and workorder.workorder_status = '1'
|
|
|
|
|
<if test="device_code != null and device_code != ''">
|
|
|
|
|
and workorder.device_code =#{device_code}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY
|
|
|
|
|
workorder.sale_id
|
|
|
|
|
ORDER BY
|
|
|
|
|
start_time
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|
|
|
|
|
|