|
|
|
|
@@ -31,7 +31,8 @@
|
|
|
|
|
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}
|
|
|
|
|
@@ -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,
|
|
|
|
|
@@ -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,
|
|
|
|
|
@@ -221,10 +222,29 @@
|
|
|
|
|
</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>
|
|
|
|
|
|
|
|
|
|
@@ -237,9 +257,12 @@
|
|
|
|
|
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,
|
|
|
|
|
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
|
|
|
|
|
@@ -247,7 +270,8 @@
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
@@ -270,5 +294,31 @@
|
|
|
|
|
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>
|
|
|
|
|
|
|
|
|
|
|