| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <!--返工数据--> |
| | | |
| | | <mapper namespace="com.example.erp.mapper.pp.ReworkMapper"> |
| | | |
| | | |
| | | |
| | | <!--获取返工数据--> |
| | | <select id="SelectRework" > |
| | | select |
| | | r.id, |
| | | r.review_status, |
| | | r.rework_team, |
| | | r.rework_id, |
| | | r.process_id, |
| | | r.order_id, |
| | | r.order_sort, |
| | | o.project, |
| | | o.batch, |
| | | od.product_name, |
| | | r.technology_number, |
| | | ogd.glass_address, |
| | | r.rework_num, |
| | | od.width, |
| | | od.height, |
| | | od.shape, |
| | | r.rework_type, |
| | | r.rework_reason, |
| | | r.responsible_team, |
| | | r.responsible_personnel, |
| | | r.responsible_equipment, |
| | | r.rework_area, |
| | | r.quality_inspector, |
| | | r.rework_processes, |
| | | r.reviewer, |
| | | date(r.create_time) as create_time, |
| | | date(r.update_time) as update_time, |
| | | JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS glassNumber, |
| | | r.reporting_work_id |
| | | from pp.rework r left join sd.order_detail od on r.order_id=od.order_id and r.order_sort=od.order_number |
| | | left join sd.`order` o on r.order_id = o.order_id |
| | | left join (select * from sd.order_glass_detail group by order_id,order_number) as ogd |
| | | on r.order_id = ogd.order_id and r.order_sort = ogd.order_number |
| | | <where> |
| | | date(r.create_time)>=#{startDate} and date(r.create_time) <= #{endDate} |
| | | and o.create_order>0 |
| | | <if test="rework.reworkId != null and rework.reworkId != ''"> |
| | | and r.rework_id regexp #{rework.reworkId} |
| | | </if> |
| | | <if test="rework.reworkTeam != null and rework.reworkTeam != ''"> |
| | | and r.rework_team like concat('%', #{rework.reworkTeam}, '%') |
| | | </if> |
| | | <if test="rework.orderId != null and rework.orderId != ''"> |
| | | and r.order_id regexp #{rework.orderId} |
| | | </if> |
| | | <if test="rework.reportingWorkId != null and rework.reportingWorkId != ''"> |
| | | and r.reporting_work_id regexp #{rework.reportingWorkId} |
| | | </if> |
| | | <if test="rework.processId != null and rework.processId != ''"> |
| | | and r.process_id regexp #{rework.processId} |
| | | </if> |
| | | <if test="rework.project != null and rework.project != ''"> |
| | | and o.project regexp #{rework.project} |
| | | </if> |
| | | <if test="rework.batch != null and rework.batch != ''"> |
| | | and o.batch regexp #{rework.batch} |
| | | </if> |
| | | <if test="rework.orderSort != null and rework.orderSort != ''"> |
| | | and r.order_sort regexp #{rework.orderSort} |
| | | </if> |
| | | <if test="rework.buildingNumber != null and rework.buildingNumber != ''"> |
| | | and od.building_number regexp #{rework.buildingNumber} |
| | | </if> |
| | | <if test="rework.productName != null and rework.productName != ''"> |
| | | and od.product_name regexp #{rework.productName} |
| | | </if> |
| | | <if test="rework.technologyNumber != null and rework.technologyNumber != ''"> |
| | | and r.technology_number regexp #{rework.technologyNumber} |
| | | </if> |
| | | <if test="rework.qualityInspector != null and rework.qualityInspector != ''"> |
| | | and r.quality_inspector regexp #{rework.qualityInspector} |
| | | </if> |
| | | <if test="rework.width != null and rework.width != ''"> |
| | | and od.width regexp #{rework.width} |
| | | </if> |
| | | <if test="rework.height != null and rework.height != ''"> |
| | | and od.height regexp #{rework.height} |
| | | </if> |
| | | <if test="rework.shape != null and rework.shape != ''"> |
| | | and od.shape regexp #{rework.shape} |
| | | </if> |
| | | <if test="rework.reworkNum != null and rework.reworkNum != ''"> |
| | | and r.rework_num regexp #{rework.reworkNum} |
| | | </if> |
| | | <if test="rework.glassAddress != null and rework.glassAddress != ''"> |
| | | and ogd.glass_address regexp #{rework.glassAddress} |
| | | </if> |
| | | <if test="rework.responsibleTeam != null and rework.responsibleTeam != ''"> |
| | | and r.responsible_team like concat('%', #{rework.responsibleTeam}, '%') |
| | | </if> |
| | | <if test="rework.responsibleEquipment != null and rework.responsibleEquipment != ''"> |
| | | and r.responsible_equipment regexp #{rework.responsibleEquipment} |
| | | </if> |
| | | <if test="rework.responsiblePersonnel != null and rework.responsiblePersonnel != ''"> |
| | | and r.responsible_personnel regexp #{rework.responsiblePersonnel} |
| | | </if> |
| | | <if test="rework.reworkType != null and rework.reworkType != ''"> |
| | | and r.rework_type regexp #{rework.reworkType} |
| | | </if> |
| | | <if test="rework.reworkReason != null and rework.reworkReason != ''"> |
| | | and r.rework_reason regexp #{rework.reworkReason} |
| | | </if> |
| | | <if test="rework.reworkArea != null and rework.reworkArea != ''"> |
| | | and r.rework_area regexp #{rework.reworkArea} |
| | | </if> |
| | | <if test="rework.qualityInspector != null and rework.qualityInspector != ''"> |
| | | and r.quality_inspector regexp #{rework.qualityInspector} |
| | | </if> |
| | | <if test="rework.reworkProcesses != null and rework.reworkProcesses != ''"> |
| | | and r.rework_processes regexp #{rework.reworkProcesses} |
| | | </if> |
| | | <if test="rework.reviewer != null and rework.reviewer != ''"> |
| | | and r.reviewer like concat('%', #{rework.reviewer}, '%') |
| | | </if> |
| | | </where> |
| | | order by r.review_status,r.id desc limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="SelectReworkPageTotal" > |
| | | select CEILING(count(zu.id)/#{pageSize}) as 'pageTotal', |
| | | count(zu.id) as 'total' |
| | | from (select r.id as id |
| | | from pp.rework r |
| | | left join sd.order_detail od on r.order_id = od.order_id and r.order_sort = od.order_number |
| | | left join sd.`order` o on r.order_id = o.order_id |
| | | left join (select * from sd.order_glass_detail group by order_id,order_number) as ogd |
| | | on r.order_id = ogd.order_id and r.order_sort = ogd.order_number |
| | | <where> |
| | | date(r.create_time)>=#{startDate} and date(r.create_time) <= #{endDate} |
| | | and o.create_order>0 |
| | | <if test="rework.reworkId != null and rework.reworkId != ''"> |
| | | and r.rework_id regexp #{rework.reworkId} |
| | | </if> |
| | | <if test="rework.reworkTeam != null and rework.reworkTeam != ''"> |
| | | and r.rework_team like concat('%', #{rework.reworkTeam}, '%') |
| | | </if> |
| | | <if test="rework.orderId != null and rework.orderId != ''"> |
| | | and r.order_id regexp #{rework.orderId} |
| | | </if> |
| | | <if test="rework.reportingWorkId != null and rework.reportingWorkId != ''"> |
| | | and r.reporting_work_id regexp #{rework.reportingWorkId} |
| | | </if> |
| | | <if test="rework.processId != null and rework.processId != ''"> |
| | | and r.process_id regexp #{rework.processId} |
| | | </if> |
| | | <if test="rework.project != null and rework.project != ''"> |
| | | and o.project regexp #{rework.project} |
| | | </if> |
| | | <if test="rework.batch != null and rework.batch != ''"> |
| | | and o.batch regexp #{rework.batch} |
| | | </if> |
| | | <if test="rework.orderSort != null and rework.orderSort != ''"> |
| | | and r.order_sort regexp #{rework.orderSort} |
| | | </if> |
| | | <if test="rework.buildingNumber != null and rework.buildingNumber != ''"> |
| | | and od.building_number regexp #{rework.buildingNumber} |
| | | </if> |
| | | <if test="rework.productName != null and rework.productName != ''"> |
| | | and od.product_name regexp #{rework.productName} |
| | | </if> |
| | | <if test="rework.technologyNumber != null and rework.technologyNumber != ''"> |
| | | and r.technology_number regexp #{rework.technologyNumber} |
| | | </if> |
| | | <if test="rework.qualityInspector != null and rework.qualityInspector != ''"> |
| | | and r.quality_inspector regexp #{rework.qualityInspector} |
| | | </if> |
| | | <if test="rework.width != null and rework.width != ''"> |
| | | and od.width regexp #{rework.width} |
| | | </if> |
| | | <if test="rework.height != null and rework.height != ''"> |
| | | and od.height regexp #{rework.height} |
| | | </if> |
| | | <if test="rework.shape != null and rework.shape != ''"> |
| | | and od.shape regexp #{rework.shape} |
| | | </if> |
| | | <if test="rework.reworkNum != null and rework.reworkNum != ''"> |
| | | and r.rework_num regexp #{rework.reworkNum} |
| | | </if> |
| | | <if test="rework.glassAddress != null and rework.glassAddress != ''"> |
| | | and ogd.glass_address regexp #{rework.glassAddress} |
| | | </if> |
| | | <if test="rework.responsibleTeam != null and rework.responsibleTeam != ''"> |
| | | and r.responsible_team like concat('%', #{rework.responsibleTeam}, '%') |
| | | </if> |
| | | <if test="rework.responsibleEquipment != null and rework.responsibleEquipment != ''"> |
| | | and r.responsible_equipment regexp #{rework.responsibleEquipment} |
| | | </if> |
| | | <if test="rework.responsiblePersonnel != null and rework.responsiblePersonnel != ''"> |
| | | and r.responsible_personnel regexp #{rework.responsiblePersonnel} |
| | | </if> |
| | | <if test="rework.reworkType != null and rework.reworkType != ''"> |
| | | and r.rework_type regexp #{rework.reworkType} |
| | | </if> |
| | | <if test="rework.reworkReason != null and rework.reworkReason != ''"> |
| | | and r.rework_reason regexp #{rework.reworkReason} |
| | | </if> |
| | | <if test="rework.reworkArea != null and rework.reworkArea != ''"> |
| | | and r.rework_area regexp #{rework.reworkArea} |
| | | </if> |
| | | <if test="rework.qualityInspector != null and rework.qualityInspector != ''"> |
| | | and r.quality_inspector regexp #{rework.qualityInspector} |
| | | </if> |
| | | <if test="rework.reworkProcesses != null and rework.reworkProcesses != ''"> |
| | | and r.rework_processes regexp #{rework.reworkProcesses} |
| | | </if> |
| | | <if test="rework.reviewer != null and rework.reviewer != ''"> |
| | | and r.reviewer like concat('%', #{rework.reviewer}, '%') |
| | | </if> |
| | | </where> |
| | | ) as zu; |
| | | </select> |
| | | |
| | | <select id="getSelectRework"> |
| | | select o.order_id as orderId, |
| | | dd.reporting_work_id as reportingWorkId, |
| | | rw.process_id as processId, |
| | | o.project, |
| | | o.batch, |
| | | dd.id as reviewer, |
| | | dd.order_number as orderSort, |
| | | od.product_name as productName, |
| | | dd.technology_number as technologyNumber, |
| | | ogd.glass_address as glassAddress, |
| | | dd.breakage_quantity-dd.quantity as reworkNum, |
| | | od.width, |
| | | od.height, |
| | | od.shape, |
| | | dd.breakage_quantity-dd.quantity as breakageQuantity, |
| | | dd.return_process as reworkProcesses, |
| | | dd.breakage_reason as reworkReason, |
| | | dd.breakage_type as reworkType, |
| | | dd.responsible_personnel as responsiblePersonnel, |
| | | dd.responsible_equipment as responsibleEquipment, |
| | | dd.responsible_team as responsibleTeam, |
| | | ROUND((dd.breakage_quantity-dd.quantity) * od.width * od.height / 1000000, 2) as reworkArea, |
| | | rw.quality_inspector as qualityInspector |
| | | from pp.damage_details dd |
| | | left join pp.reporting_work_detail rwd on dd.reporting_work_id = rwd.reporting_work_id and dd.order_number=rwd.order_number |
| | | and dd.technology_number=rwd.technology_number and rwd.review_status>0 |
| | | left join pp.reporting_work rw on dd.reporting_work_id = rw.reporting_work_id |
| | | |
| | | left join sd.`order` o on rw.order_id = o.order_id |
| | | left join sd.order_detail od on rw.order_id = od.order_id and dd.order_number = od.order_number |
| | | left join (select * from sd.order_glass_detail group by order_id,order_number) as ogd |
| | | on rw.order_id = ogd.order_id and dd.order_number = ogd.order_number |
| | | |
| | | where dd.breakage_quantity-dd.quantity>0 and dd.available=1 and o.create_order>0 and rw.reviewed_state>=0 |
| | | order by dd.id desc |
| | | </select> |
| | | |
| | | |
| | | <select id="getMaximum" > |
| | | select count(*) from pp.rework where date(create_time)=CURDATE() |
| | | </select> |
| | | |
| | | <select id="getMaxFlowCard" > |
| | | select count(*) from pp.flow_card where project_no=#{processId} |
| | | </select> |
| | | |
| | | <insert id="insertRework" useGeneratedKeys="true" > |
| | | insert into pp.rework(rework_id,reporting_work_id,process_id,order_id, order_sort, technology_number, responsible_team, |
| | | responsible_personnel, rework_type, rework_reason, rework_processes, rework_num, |
| | | rework_area, rework_team,responsible_equipment,quality_inspector, reviewer, review_status, create_time) |
| | | values ( |
| | | #{oddNumber}, #{rework.reportingWorkId},#{rework.processId},#{rework.orderId},#{rework.orderSort},#{rework.technologyNumber},#{rework.responsibleTeam}, |
| | | #{rework.responsiblePersonnel},#{rework.reworkType},#{rework.reworkReason},#{rework.reworkProcesses},#{rework.reworkNum}, |
| | | #{rework.reworkArea},#{rework.reworkTeam},#{rework.responsibleEquipment},#{rework.qualityInspector},'',0,now() |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="updateRework" > |
| | | update pp.rework set reviewer=#{userName},review_status=1,update_time=now() where id=#{rework.id} |
| | | </update> |
| | | |
| | | <update id="updateDamageDetails" > |
| | | update pp.damage_details set quantity=quantity+#{rework.reworkNum} where id=#{rework.reviewer} |
| | | </update> |
| | | |
| | | <delete id="deleteReworkMp"> |
| | | delete from pp.rework where rework_id=#{patchId} |
| | | </delete> |
| | | |
| | | <update id="updateReworkDdMp"> |
| | | update pp.damage_details set patch_status=0,quantity=quantity-#{reworkNum} |
| | | where reporting_work_id=#{reportingWorkId} and order_number=#{orderSort} and technology_number=#{technologyNumber} |
| | | and breakage_type=#{reworkType} and breakage_reason=#{reworkReason} |
| | | </update> |
| | | |
| | | <update id="updateReworkBgMp"> |
| | | update pp.reporting_work_detail set patch_status=0 |
| | | where reporting_work_id=#{reportingWorkId} and order_number=#{orderSort} and technology_number=#{technologyNumber} |
| | | </update> |
| | | |
| | | |
| | | |
| | | </mapper> |