| | |
| | | </where> |
| | | </select> |
| | | <select id="selectProcedureProcessList" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultType="doumeemes.dao.business.dto.statistics.ProcedureProcessModel"> |
| | | select a.PROCEDURE_ID as procedureId, |
| | | <!-- select a.PROCEDURE_ID as procedureId, |
| | | b.name as procedureName, |
| | | sum(a.num) as num, |
| | | count(DISTINCT(a.id)) as planCount, |
| | |
| | | and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} |
| | | and b.DELETED=0 |
| | | GROUP BY a.PROCEDURE_ID |
| | | order by b.SORTNUM |
| | | order by b.SORTNUM--> |
| | | |
| | | select t.PROCEDURE_ID as procedureId,count(t.id) as planCount, t.SORTNUM,t.procedureName,sum(t.num) as num ,sum(t.qualifiedNum) as qualifiedNum,sum(t.unqualifiedNum) as unqualifiedNum |
| | | from (select a.id,a.PROCEDURE_ID , |
| | | b.name as procedureName, |
| | | a.num as num, |
| | | b.SORTNUM, |
| | | (select sum(d.QUALIFIED_NUM) from workorder_record d where d.DELETED=0 and d.PLAN_ID=a.id and d.TYPE=1 ) as qualifiedNum , |
| | | (select sum(d.UNQUALIFIED_NUM) from workorder_record d where d.DELETED=0 and d.PLAN_ID=a.id and d.TYPE=1 ) as unqualifiedNum |
| | | from plans a |
| | | left join procedures b on a.PROCEDURE_ID =b.ID |
| | | where ( a.`STATUS` in (1,4) or (a.`STATUS`=6 and EXISTS(select e.id from workorder_record e where e.PLAN_ID = a.id and TO_DAYS(now())=TO_DAYS(e.CREATE_TIME)))) and b.DELETED=0 |
| | | and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} |
| | | ) t |
| | | GROUP BY t.PROCEDURE_ID |
| | | order by t.SORTNUM |
| | | </select> |
| | | <select id="selectStatisticsList" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultType="doumeemes.dao.business.dto.statistics.ProcedurePlansPageModel"> |
| | | select a.status,a.NUM,m.name as categoryName,m.code as materialCode,m.name as materialName |
| | |
| | | FROM `plans` `a` |
| | | LEFT JOIN `material_distribute` c ON a.MATERIAL_ID=c.ID |
| | | LEFT JOIN `material` m ON c.MATERIAL_ID=m.ID |
| | | where (a.status in (1,4) or (a.status=6 and EXISTS(select b.id from workorder_record b where b.type=1 and b.DELETED=0 and b.PLAN_ID=a.id) )) |
| | | where (a.status in (1,4) or (a.status=6 and EXISTS(select b.id from workorder_record b where b.type=1 and b.DELETED=0 and b.PLAN_ID=a.id and to_days(b.create_time)=to_days(now())) )) |
| | | and a.deleted=0 and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and a.PROCEDURE_ID=#{procedureId} |
| | | order by a.CREATE_TIME |
| | | </select> |
| | |
| | | <if test="usermodelInvalidTime != null"> |
| | | AND `usermodel`.`INVALID_TIME` = #{usermodelInvalidTime} |
| | | </if> |
| | | <if test="startDate != null"> |
| | | <!--<if test="startDate != null"> |
| | | AND `a`.`PLAN_DATE` >= #{startDate} |
| | | </if> |
| | | <if test="endDate != null"> |
| | | AND #{endDate} >= `a`.`PLAN_DATE` |
| | | </if> |
| | | </if>--> |
| | | <if test="mixParam != null and mixParam!=''"> |
| | | AND (mmodel.name like concat('%',#{mixParam},'%') or mmodel.code like concat('%',#{mixParam},'%') or pmodel.name like concat('%',#{mixParam},'%')) |
| | | </if> |
| | |
| | | </insert> |
| | | <select id="getPlansStaticticsData" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultType="doumeemes.dao.business.dto.statistics.StatisticsPlanDataModel"> |
| | | SELECT count(a.id) as ingNum, |
| | | (select count(b.id) FROM `plans` b where b.DELETED = 0 and b.PROCEDURE_ID=#{procedureId} AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND (b.`STATUS` in (1,4) and now() > b.plan_Date )) as delayNum, |
| | | (select count(b.id) FROM `plans` b where b.DELETED = 0 and b.PROCEDURE_ID=#{procedureId} AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND (b.`STATUS` in (1,4) and to_days(now()) > to_days(b.plan_Date) )) as delayNum, |
| | | (select count(distinct(b.CREATE_USER)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status in (0,1,2,3,4,7) AND to_days(b.create_time)=to_days(now())) as prouserNum, |
| | | (select count(distinct(b.PRO_GROUP_ID)) FROM workorder b where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND b.status in (0,1,2,3,4,7) AND to_days(b.create_time)=to_days(now())) as deviceNum, |
| | | (select sum(ifnull(b.UNQUALIFIED_NUM,0)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status=4) as unqualifiedNum, |
| | | (select sum(ifnull(b.NUM,0)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status=4) as doneNum |
| | | (select count(distinct(b.PRO_GROUP_ID)) FROM workorder b where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND b.status in (0,1,2,3,4,7) AND to_days(b.create_time)=to_days(now())) as deviceNum, |
| | | (select sum(ifnull(b.UNQUALIFIED_NUM,0)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status=4 AND to_days(b.create_time)=to_days(now())) as unqualifiedNum, |
| | | (select sum(ifnull(b.NUM,0)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status=4 AND to_days(b.create_time)=to_days(now())) as doneNum |
| | | FROM `plans` `a` |
| | | where |
| | | a.DELETED = 0 AND a.ROOT_DEPART_ID = #{rootDepartId} AND a.DEPART_ID = #{departId} and a.PROCEDURE_ID=#{procedureId} AND a.`STATUS` in (1,4) |