| 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.PatchLogMapper"> |
| | | |
| | | |
| | | |
| | | <!--获取补片数据--> |
| | | <select id="SelectReplenish" > |
| | | select |
| | | r.id, |
| | | r.review_status, |
| | | r.reporting_work_id, |
| | | r.patch_id, |
| | | r.process_id, |
| | | r.order_id, |
| | | r.order_sort, |
| | | o.project, |
| | | o.batch, |
| | | od.building_number, |
| | | od.product_name, |
| | | ogd.technology_number, |
| | | ogd.glass_address, |
| | | r.patch_num, |
| | | od.width, |
| | | od.height, |
| | | od.shape, |
| | | r.patch_type, |
| | | r.patch_reason, |
| | | r.responsible_team, |
| | | r.responsible_personnel, |
| | | r.responsible_equipment, |
| | | r.patch_area, |
| | | r.quality_inspector, |
| | | r.patch_processes, |
| | | r.reviewer, |
| | | date(r.create_time) as create_time, |
| | | date(r.update_time) as update_time |
| | | from pp.patch_log 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} |
| | | </where> |
| | | order by r.review_status |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="SelectReplenishPageTotal" > |
| | | select CEILING(count(zu.id)/#{pageSize}) as 'pageTotal', |
| | | count(zu.id) as 'total' |
| | | from (select r.id as id |
| | | from pp.patch_log 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} |
| | | </where> |
| | | ) as zu |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getMaximum" > |
| | | select count(*) from pp.patch_log where date(create_time)=CURDATE() |
| | | </select> |
| | | |
| | | |
| | | <insert id="insertReplenish" useGeneratedKeys="true" > |
| | | insert into pp.patch_log(patch_id,reporting_work_id,process_id,order_id, order_sort, technology_number, responsible_team, |
| | | responsible_personnel, patch_type, patch_reason, patch_processes, patch_num, |
| | | patch_area,responsible_equipment,quality_inspector, reviewer, review_status, create_time) |
| | | values ( |
| | | #{oddNumber}, #{patchLog.reportingWorkId},#{patchLog.processId},#{patchLog.orderId},#{patchLog.orderSort},#{patchLog.technologyNumber}, |
| | | #{patchLog.responsibleTeam},#{patchLog.responsiblePersonnel},#{patchLog.patchType},#{patchLog.patchReason}, |
| | | #{patchLog.patchProcesses},#{patchLog.patchNum},#{patchLog.patchArea},#{patchLog.responsibleEquipment},#{patchLog.qualityInspector},"",0,now() |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="updateReplenish" > |
| | | update pp.patch_log set reviewer=#{userName},review_status=1,update_time=now() where id=#{patchLog.id} |
| | | </update> |
| | | |
| | | <update id="updateDamageDetails" > |
| | | update pp.damage_details set quantity=quantity+#{patchLog.patchNum},patch_status=1 where id=#{patchLog.reviewer} |
| | | </update> |
| | | |
| | | |
| | | <select id="getSelectReplenish"> |
| | | select date(rw.reporting_work_time) as reportingWorkTime, |
| | | o.order_id as orderId, |
| | | dd.reporting_work_id as reportingWorkId, |
| | | rw.production_id as productionId, |
| | | rw.process_id as processId, |
| | | o.project, |
| | | o.batch, |
| | | dd.id as reviewer, |
| | | od.building_number as buildingNumber, |
| | | 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 patchNum, |
| | | od.width, |
| | | od.height, |
| | | od.shape, |
| | | dd.breakage_quantity-dd.quantity as breakageQuantity, |
| | | dd.return_process as patchProcesses, |
| | | dd.breakage_reason as patchReason, |
| | | dd.breakage_type as patchType, |
| | | 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 patchArea, |
| | | rw.qualityIns_pector 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 |
| | | 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=0 and (dd.responsible_process=rw.this_process or (dd.responsible_process!=rw.this_process and dd.qualityIns_status=1)) |
| | | |
| | | </select> |
| | | |
| | | |
| | | </mapper> |