| | |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.eam.vo.CalibrationOrderPage; |
| | | import org.jeecg.modules.eam.vo.SysFileNameVo; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.entity.SysDepart; |
| | | import org.jeecg.modules.system.service.ISysDepartService; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | |
| | | @RequestMapping("/eam/calibrationOrder") |
| | | @Slf4j |
| | | public class CalibrationOrderController { |
| | | |
| | | /** |
| | | * 用户类型(1 普通成员 2 工段 3 分厂/中心 4 公司) |
| | | */ |
| | | private static final Integer USER_TYPE_1 = 1; |
| | | private static final Integer USER_TYPE_2 = 2; |
| | | private static final Integer USER_TYPE_3 = 3; |
| | | private static final Integer USER_TYPE_4 = 4; |
| | | |
| | | /** |
| | | * 车间层级类型(1 公司 2 分厂、中心 3 工段) |
| | | */ |
| | | private static final String ORG_TYPE_1 = "1"; |
| | | private static final String ORG_TYPE_2 = "2"; |
| | | private static final String ORG_TYPE_3 = "3"; |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private ICalibrationOrderService calibrationOrderService; |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | *首页(二级页面)技术状态数量统计 |
| | | * qsw 2024-3-13 |
| | | */ |
| | | @GetMapping("getEquipmentTechnologyStatusList") |
| | | public Result<?> getEquipmentTechnologyStatusList(@Param("factoryNum") String factoryNum) { |
| | | List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list(); |
| | | List<Map<String, Object>> list; |
| | | if(areaList.size()>0){ |
| | | list = calibrationOrderService.getEquipmentTechnologyStatusList(areaList.get(0).getId()); |
| | | }else{ |
| | | list = null; |
| | | public Result<?> getEquipmentTechnologyStatusList(String productionCode) { |
| | | |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | List<Map<String, Object>> list = null; |
| | | if(USER_TYPE_4.equals(userType)){ |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | list = calibrationOrderService.getFactoryEquipmentTechnologyStatusList(); |
| | | }else{ |
| | | String orgType = calibrationOrderService.findOrgType(productionCode); |
| | | if(ORG_TYPE_2.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getEquipmentTechnologyStatusList(area.getId(),""); |
| | | }else if(ORG_TYPE_3.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getEquipmentTechnologyStatusList("",area.getId()); |
| | | } |
| | | } |
| | | }else if(USER_TYPE_3.equals(userType)){ |
| | | String code = calibrationOrderService.findProductionCode(user.getId()); |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getEquipmentTechnologyStatusList(area.getId(),""); |
| | | }else{ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getEquipmentTechnologyStatusList("",area.getId()); |
| | | } |
| | | } |
| | | return Result.ok(list); |
| | | } |
| | |
| | | * qsw 2024-3-13 |
| | | */ |
| | | @GetMapping("getReportRepairEquipmentList") |
| | | public Result<?> getReportRepairEquipmentList(@Param("factoryNum") String factoryNum) { |
| | | List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list(); |
| | | List<Map<String, Object>> list; |
| | | if(areaList.size()>0){ |
| | | list = calibrationOrderService.getReportRepairEquipmentList(areaList.get(0).getId()); |
| | | }else{ |
| | | list = null; |
| | | public Result<?> getReportRepairEquipmentList(String productionCode) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | List<Map<String, Object>> list = null; |
| | | if(USER_TYPE_4.equals(userType)){ |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | list = calibrationOrderService.getFactoryReportRepairEquipmentList(); |
| | | }else{ |
| | | String orgType = calibrationOrderService.findOrgType(productionCode); |
| | | if(ORG_TYPE_2.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getReportRepairEquipmentList(area.getId(),""); |
| | | }else if(ORG_TYPE_3.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getReportRepairEquipmentList("",area.getId()); |
| | | } |
| | | } |
| | | }else if(USER_TYPE_3.equals(userType)){ |
| | | String code = calibrationOrderService.findProductionCode(user.getId()); |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getReportRepairEquipmentList(area.getId(),""); |
| | | }else{ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getReportRepairEquipmentList("",area.getId()); |
| | | } |
| | | } |
| | | return Result.ok(list); |
| | | } |
| | |
| | | * qsw 2024-3-14 |
| | | */ |
| | | @GetMapping("getThisMonthMaintenanceList") |
| | | public Result<?> getThisMonthMaintenanceList(@Param("factoryNum") String factoryNum) { |
| | | List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list(); |
| | | List<Map<String, Object>> list; |
| | | if(areaList.size()>0){ |
| | | list = calibrationOrderService.getThisMonthMaintenanceList(areaList.get(0).getId()); |
| | | }else{ |
| | | list = null; |
| | | public Result<?> getThisMonthMaintenanceList(String productionCode) { |
| | | // List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list(); |
| | | // List<Map<String, Object>> list; |
| | | // if(areaList.size()>0){ |
| | | // list = calibrationOrderService.getThisMonthMaintenanceList(areaList.get(0).getId()); |
| | | // }else{ |
| | | // list = null; |
| | | // } |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | List<Map<String, Object>> list = null; |
| | | if(USER_TYPE_4.equals(userType)){ |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | list = calibrationOrderService.getFactoryThisMonthMaintenanceList(); |
| | | }else{ |
| | | String orgType = calibrationOrderService.findOrgType(productionCode); |
| | | if(ORG_TYPE_2.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getReportRepairEquipmentList(area.getId(),""); |
| | | }else if(ORG_TYPE_3.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getReportRepairEquipmentList("",area.getId()); |
| | | } |
| | | } |
| | | }else if(USER_TYPE_3.equals(userType)){ |
| | | String code = calibrationOrderService.findProductionCode(user.getId()); |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getReportRepairEquipmentList(area.getId(),""); |
| | | }else{ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getReportRepairEquipmentList("",area.getId()); |
| | | } |
| | | } |
| | | return Result.ok(list); |
| | | } |
| | |
| | | * qsw 2024-3-14 |
| | | */ |
| | | @GetMapping("getNextMonthMaintenanceList") |
| | | public Result<?> getNextMonthMaintenanceList(@Param("factoryNum") String factoryNum) { |
| | | List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list(); |
| | | List<Map<String, Object>> list; |
| | | if(areaList.size()>0){ |
| | | list = calibrationOrderService.getNextMonthMaintenanceList(areaList.get(0).getId()); |
| | | }else{ |
| | | list = null; |
| | | public Result<?> getNextMonthMaintenanceList(String productionCode) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | List<Map<String, Object>> list = null; |
| | | if(USER_TYPE_4.equals(userType)){ |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | list = calibrationOrderService.getFactoryNextMonthMaintenanceList(); |
| | | }else{ |
| | | String orgType = calibrationOrderService.findOrgType(productionCode); |
| | | if(ORG_TYPE_2.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getNextMonthMaintenanceList(area.getId(),""); |
| | | }else if(ORG_TYPE_3.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getNextMonthMaintenanceList("",area.getId()); |
| | | } |
| | | } |
| | | }else if(USER_TYPE_3.equals(userType)){ |
| | | String code = calibrationOrderService.findProductionCode(user.getId()); |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getNextMonthMaintenanceList(area.getId(),""); |
| | | }else{ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getNextMonthMaintenanceList("",area.getId()); |
| | | } |
| | | } |
| | | return Result.ok(list); |
| | | } |
| | |
| | | * qsw 2024-3-14 |
| | | */ |
| | | @GetMapping("getNextNextMonthMaintenanceList") |
| | | public Result<?> getNextNextMonthMaintenanceList(@Param("factoryNum") String factoryNum) { |
| | | List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list(); |
| | | List<Map<String, Object>> list; |
| | | if(areaList.size()>0){ |
| | | list = calibrationOrderService.getNextNextMonthMaintenanceList(areaList.get(0).getId()); |
| | | }else{ |
| | | list = null; |
| | | public Result<?> getNextNextMonthMaintenanceList(String productionCode) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | List<Map<String, Object>> list = null; |
| | | if(USER_TYPE_4.equals(userType)){ |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | list = calibrationOrderService.getFactoryNextMonthMaintenanceList(); |
| | | }else{ |
| | | String orgType = calibrationOrderService.findOrgType(productionCode); |
| | | if(ORG_TYPE_2.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getNextMonthMaintenanceList(area.getId(),""); |
| | | }else if(ORG_TYPE_3.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getNextMonthMaintenanceList("",area.getId()); |
| | | } |
| | | } |
| | | }else if(USER_TYPE_3.equals(userType)){ |
| | | String code = calibrationOrderService.findProductionCode(user.getId()); |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getNextMonthMaintenanceList(area.getId(),""); |
| | | }else{ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getNextMonthMaintenanceList("",area.getId()); |
| | | } |
| | | } |
| | | return Result.ok(list); |
| | | } |
| | |
| | | * qsw 2024-3-14 |
| | | */ |
| | | @GetMapping("getThisMonthMaintenanceFinishList") |
| | | public Result<?> getThisMonthMaintenanceFinishList(@Param("factoryNum") String factoryNum) { |
| | | List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list(); |
| | | List<Map<String, Object>> list; |
| | | if(areaList.size()>0){ |
| | | list = calibrationOrderService.getThisMonthMaintenanceFinishList(areaList.get(0).getId()); |
| | | }else{ |
| | | list = null; |
| | | public Result<?> getThisMonthMaintenanceFinishList(String productionCode) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | List<Map<String, Object>> list = null; |
| | | if(USER_TYPE_4.equals(userType)){ |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | list = calibrationOrderService.getFactoryThisMonthMaintenanceFinishList(); |
| | | }else{ |
| | | String orgType = calibrationOrderService.findOrgType(productionCode); |
| | | if(ORG_TYPE_2.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getThisMonthMaintenanceFinishList(area.getId(),""); |
| | | }else if(ORG_TYPE_3.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getThisMonthMaintenanceFinishList("",area.getId()); |
| | | } |
| | | } |
| | | }else if(USER_TYPE_3.equals(userType)){ |
| | | String code = calibrationOrderService.findProductionCode(user.getId()); |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getThisMonthMaintenanceFinishList(area.getId(),""); |
| | | }else{ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | list = calibrationOrderService.getThisMonthMaintenanceFinishList("",area.getId()); |
| | | } |
| | | } |
| | | return Result.ok(list); |
| | | } |
| | | |
| | | /** |
| | | *首页二保计划展示 |
| | | * qsw 2024-3-15 |
| | | */ |
| | | @GetMapping("getTwoMaintenancePlanList") |
| | | public Result<?> getTwoMaintenancePlanList() { |
| | | List<Map<String, Object>> twoMaintenancePlanList = calibrationOrderService.getTwoMaintenancePlanList(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | List<Map<String, Object>> getPrecisionParameterList(@Param("equipmentId")String equipmentId); |
| | | |
| | | /** |
| | | * 获取当前登录人是中心及对应的编码 |
| | | * qsw 2024-3-18 |
| | | */ |
| | | String findProductionCode(@Param("userId") String userId); |
| | | |
| | | /** |
| | | * 根据模型传入的编码 判断改编码公司/中心/工段的哪一级 |
| | | * qsw 2024-3-18 |
| | | */ |
| | | String findOrgType(@Param("productionCode") String productionCode); |
| | | |
| | | /** |
| | | *首页公司级 技术状态数量统计 |
| | | * qsw 2024-3-13 |
| | | */ |
| | |
| | | *首页(二级页面)技术状态数量统计 |
| | | * qsw 2024-3-13 |
| | | */ |
| | | List<Map<String, Object>> getEquipmentTechnologyStatusList(@Param("factoryModelId")String factoryModelId); |
| | | List<Map<String, Object>> getEquipmentTechnologyStatusList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)设备报修情况统计 |
| | | * qsw 2024-3-13 |
| | | */ |
| | | List<Map<String, Object>> getReportRepairEquipmentList(@Param("factoryModelId")String factoryModelId); |
| | | List<Map<String, Object>> getReportRepairEquipmentList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)本月三保计划 |
| | | * qsw 2024-3-14 |
| | | */ |
| | | List<Map<String, Object>> getThisMonthMaintenanceList(@Param("factoryModelId")String factoryModelId); |
| | | List<Map<String, Object>> getThisMonthMaintenanceList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)下月三保计划 |
| | | * qsw 2024-3-14 |
| | | */ |
| | | List<Map<String, Object>> getNextMonthMaintenanceList(@Param("factoryModelId")String factoryModelId); |
| | | List<Map<String, Object>> getNextMonthMaintenanceList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)下下月三保计划 |
| | | * qsw 2024-3-14 |
| | | */ |
| | | List<Map<String, Object>> getNextNextMonthMaintenanceList(@Param("factoryModelId")String factoryModelId); |
| | | List<Map<String, Object>> getNextNextMonthMaintenanceList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)本月三保完成数量 |
| | | * qsw 2024-3-14 |
| | | */ |
| | | List<Map<String, Object>> getThisMonthMaintenanceFinishList(@Param("factoryModelId")String factoryModelId); |
| | | List<Map<String, Object>> getThisMonthMaintenanceFinishList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId); |
| | | |
| | | /** |
| | | *首页二级保养展示页面 获取每一个中心下二级保养计划 |
| | | * qsw 2024-3-15 |
| | | */ |
| | | List<Map<String, Object>> getCenterTwoMaintenancePlanList(@Param("workCenterId")String workCenterId); |
| | | |
| | | } |
| | |
| | | WHERE t1.del_flag = 0 and t1.equipment_id = #{equipmentId} |
| | | </select> |
| | | |
| | | <!--根据模型传入的编码 判断改编码公司/中心/工段的哪一级--> |
| | | <select id="findOrgType" resultType="java.lang.String"> |
| | | select TOP 1 org_type as orgType from mdc_production where production_code = #{productionCode} |
| | | </select> |
| | | |
| | | <!--获取当前登录人是中心及对应的编码--> |
| | | <select id="findProductionCode" resultType="java.lang.String"> |
| | | SELECT top 1 t2.production_code as productionCode FROM mdc_user_production t1 LEFT JOIN mdc_production t2 ON t1.pro_id = t2.id where t1.user_id =#{userId} and t2.org_type = '2' |
| | | </select> |
| | | |
| | | <select id="getFactoryEquipmentTechnologyStatusList" parameterType="String" resultType="Map"> |
| | | SELECT |
| | | ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'qualified') as qualifiedCount, |
| | |
| | | </select> |
| | | |
| | | <select id="getFactoryThisMonthMaintenanceFinishList" parameterType="String" resultType="Map"> |
| | | select count(0) as totalConnt from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id |
| | | select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id |
| | | where t1.del_flag = '0' and t1.status = '5' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) |
| | | </select> |
| | | |
| | | <select id="getEquipmentTechnologyStatusList" parameterType="String" resultType="Map"> |
| | | SELECT |
| | | ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'qualified' and work_center_id = #{factoryModelId}) as qualifiedCount, |
| | | ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'limitedUse' and work_center_id = #{factoryModelId}) as limitedUseCount, |
| | | ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'disabled' and work_center_id = #{factoryModelId}) as disabledCount |
| | | ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'qualified' <if test="workCenterId != null and workCenterId != ''"> and work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and area_id = #{areaId} </if> ) as qualifiedCount, |
| | | ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'limitedUse' <if test="workCenterId != null and workCenterId != ''"> and work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and area_id = #{areaId} </if> ) as limitedUseCount, |
| | | ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'disabled' <if test="workCenterId != null and workCenterId != ''"> and work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and area_id = #{areaId} </if> ) as disabledCount |
| | | </select> |
| | | |
| | | <select id="getReportRepairEquipmentList" parameterType="String" resultType="Map"> |
| | | SELECT |
| | | ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id WHERE t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) and t2.work_center_id = #{factoryModelId}) as failurTotalCount, |
| | | ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id where t1.del_flag = '0' and t1.is_stop = '1' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) and t2.work_center_id = #{factoryModelId}) as noStopCount, |
| | | ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id where t1.del_flag = '0' and t1.is_stop = '2' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) and t2.work_center_id = #{factoryModelId}) as stopCount |
| | | ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id WHERE t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> ) as failurTotalCount, |
| | | ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id where t1.del_flag = '0' and t1.is_stop = '1' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> ) as noStopCount, |
| | | ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id where t1.del_flag = '0' and t1.is_stop = '2' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> ) as stopCount |
| | | </select> |
| | | |
| | | <select id="getThisMonthMaintenanceList" parameterType="String" resultType="Map"> |
| | | select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) and t1.work_center_id = #{factoryModelId} |
| | | select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if> |
| | | </select> |
| | | |
| | | <select id="getNextMonthMaintenanceList" parameterType="String" resultType="Map"> |
| | | select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH, 1, GETDATE()), 120), 1, 7) and t1.work_center_id = #{factoryModelId} |
| | | select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH, 1, GETDATE()), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if> |
| | | </select> |
| | | |
| | | <select id="getNextNextMonthMaintenanceList" parameterType="String" resultType="Map"> |
| | | select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH,2 , GETDATE()), 120), 1, 7) and t1.work_center_id = #{factoryModelId} |
| | | select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH,2 , GETDATE()), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if> |
| | | </select> |
| | | |
| | | <select id="getThisMonthMaintenanceFinishList" parameterType="String" resultType="Map"> |
| | | select count(0) as totalConnt from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id |
| | | where t1.del_flag = '0' and t1.status = '5' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) and t2.work_center_id = #{factoryModelId} |
| | | select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id |
| | | where t1.del_flag = '0' and t1.status = '5' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> |
| | | </select> |
| | | |
| | | <select id="getCenterTwoMaintenancePlanList" parameterType="String" resultType="Map"> |
| | | SELECT |
| | | top 1 |
| | | t1.id, |
| | | t5.name centerName, |
| | | SUBSTRING(CONVERT(VARCHAR(10),t1.plan_start_time, 120), 1, 10) maintenanceDate, |
| | | '二级保养' as content |
| | | FROM |
| | | mom_eam_equipment_maintenance_plan_detail t1 |
| | | LEFT JOIN mom_eam_equipment_maintenance_plan t2 ON t1.plan_id= t2.id |
| | | left join mom_eam_maintenance_standard t3 on t1.standard_id = t3.id |
| | | left join mom_eam_equipment t4 on t3.equipment_id = t4.id |
| | | left join mom_base_area t5 on t4.work_center_id = t5.id |
| | | where t5.id = #{workCenterId} ORDER BY t1.plan_start_time desc |
| | | </select> |
| | | |
| | | |
| | |
| | | |
| | | |
| | | //qsw 2023-7-18================================================================================ |
| | | |
| | | /** |
| | | * 根据模型传入的编码 判断改编码公司/中心/工段的哪一级 |
| | | */ |
| | | String findOrgType(String productionCode); |
| | | |
| | | /** |
| | | * 根据模型传入的编码 判断改编码公司/中心/工段的哪一级 |
| | | * qsw 2024-3-18 |
| | | */ |
| | | String findProductionCode(String userId); |
| | | |
| | | /** |
| | | * 设备检定工单 创建时通过设备获取设备精度参数 |
| | | * qsw 2023-7-18 |
| | |
| | | *首页(二级页面)技术状态数量统计 |
| | | * qsw 2024-3-13 |
| | | */ |
| | | List<Map<String, Object>> getEquipmentTechnologyStatusList(String factoryModelId); |
| | | List<Map<String, Object>> getEquipmentTechnologyStatusList(String workCenterId,String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)设备报修情况统计 |
| | | * qsw 2024-3-13 |
| | | */ |
| | | List<Map<String, Object>> getReportRepairEquipmentList(String factoryModelId); |
| | | List<Map<String, Object>> getReportRepairEquipmentList(String workCenterId,String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)本月三保计划 |
| | | * qsw 2024-3-14 |
| | | */ |
| | | List<Map<String, Object>> getThisMonthMaintenanceList(String factoryModelId); |
| | | List<Map<String, Object>> getThisMonthMaintenanceList(String workCenterId,String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)下月三保计划 |
| | | * qsw 2024-3-14 |
| | | */ |
| | | List<Map<String, Object>> getNextMonthMaintenanceList(String factoryModelId); |
| | | List<Map<String, Object>> getNextMonthMaintenanceList(String workCenterId,String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)下下月三保计划 |
| | | * qsw 2024-3-14 |
| | | */ |
| | | List<Map<String, Object>> getNextNextMonthMaintenanceList(String factoryModelId); |
| | | List<Map<String, Object>> getNextNextMonthMaintenanceList(String workCenterId,String areaId); |
| | | |
| | | /** |
| | | *首页(二级页面)本月三保完成数量 |
| | | * qsw 2024-3-14 |
| | | */ |
| | | List<Map<String, Object>> getThisMonthMaintenanceFinishList(String factoryModelId); |
| | | List<Map<String, Object>> getThisMonthMaintenanceFinishList(String workCenterId,String areaId); |
| | | |
| | | /** |
| | | *首页二保计划展示 |
| | | * qsw 2024-3-15 |
| | | */ |
| | | List<Map<String, Object>> getTwoMaintenancePlanList(); |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.eam.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.eam.entity.Area; |
| | | import org.jeecg.modules.eam.entity.CalibrationOrder; |
| | | import org.jeecg.modules.eam.entity.CalibrationOrderDetail; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.mapper.CalibrationOrderDetailMapper; |
| | | import org.jeecg.modules.eam.mapper.CalibrationOrderMapper; |
| | | import org.jeecg.modules.eam.model.MaintenanceCycleVo; |
| | | import org.jeecg.modules.eam.service.IAreaService; |
| | | import org.jeecg.modules.eam.service.ICalibrationOrderService; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | private CalibrationOrderMapper calibrationOrderMapper; |
| | | @Autowired |
| | | private CalibrationOrderDetailMapper calibrationOrderDetailMapper; |
| | | |
| | | @Autowired |
| | | private IAreaService areaService; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | //qsw 2023-7-18================================================================================ |
| | | |
| | | /** |
| | | * 根据模型传入的编码 判断改编码公司/中心/工段的哪一级 |
| | | * qsw 2024-3-18 |
| | | */ |
| | | @Override |
| | | public String findOrgType(String productionCode) { |
| | | return this.baseMapper.findOrgType(productionCode); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前登录人是中心及对应的编码 |
| | | * qsw 2024-3-18 |
| | | */ |
| | | @Override |
| | | public String findProductionCode(String userId) { |
| | | return this.baseMapper.findProductionCode(userId); |
| | | } |
| | | |
| | | /** |
| | | * 设备检定工单 创建时通过设备获取设备精度参数 |
| | | * qsw 2023-7-18 |
| | |
| | | * qsw 2024-3-13 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getEquipmentTechnologyStatusList(String factoryModelId) { |
| | | return this.baseMapper.getEquipmentTechnologyStatusList(factoryModelId); |
| | | public List<Map<String, Object>> getEquipmentTechnologyStatusList(String workCenterId,String areaId) { |
| | | return this.baseMapper.getEquipmentTechnologyStatusList(workCenterId,areaId); |
| | | } |
| | | |
| | | /** |
| | |
| | | * qsw 2024-3-13 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getReportRepairEquipmentList(String factoryModelId) { |
| | | return this.baseMapper.getReportRepairEquipmentList(factoryModelId); |
| | | public List<Map<String, Object>> getReportRepairEquipmentList(String workCenterId,String areaId) { |
| | | return this.baseMapper.getReportRepairEquipmentList(workCenterId,areaId); |
| | | } |
| | | |
| | | /** |
| | |
| | | * qsw 2024-3-14 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getThisMonthMaintenanceList(String factoryModelId) { |
| | | return this.baseMapper.getThisMonthMaintenanceList(factoryModelId); |
| | | public List<Map<String, Object>> getThisMonthMaintenanceList(String workCenterId,String areaId) { |
| | | return this.baseMapper.getThisMonthMaintenanceList(workCenterId,areaId); |
| | | } |
| | | |
| | | /** |
| | |
| | | * qsw 2024-3-14 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getNextMonthMaintenanceList(String factoryModelId) { |
| | | return this.baseMapper.getNextMonthMaintenanceList(factoryModelId); |
| | | public List<Map<String, Object>> getNextMonthMaintenanceList(String workCenterId,String areaId) { |
| | | return this.baseMapper.getNextMonthMaintenanceList(workCenterId,areaId); |
| | | } |
| | | |
| | | /** |
| | |
| | | * qsw 2024-3-14 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getNextNextMonthMaintenanceList(String factoryModelId) { |
| | | return this.baseMapper.getNextNextMonthMaintenanceList(factoryModelId); |
| | | public List<Map<String, Object>> getNextNextMonthMaintenanceList(String workCenterId,String areaId) { |
| | | return this.baseMapper.getNextNextMonthMaintenanceList(workCenterId,areaId); |
| | | } |
| | | |
| | | /** |
| | |
| | | * qsw 2024-3-14 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getThisMonthMaintenanceFinishList(String factoryModelId) { |
| | | return this.baseMapper.getThisMonthMaintenanceFinishList(factoryModelId); |
| | | public List<Map<String, Object>> getThisMonthMaintenanceFinishList(String workCenterId,String areaId) { |
| | | return this.baseMapper.getThisMonthMaintenanceFinishList(workCenterId,areaId); |
| | | } |
| | | |
| | | /** |
| | | *首页二保计划展示 |
| | | * qsw 2024-3-15 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getTwoMaintenancePlanList() { |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | |
| | | List<Area> areaList = areaService.lambdaQuery().eq(Area::getType, "1").eq(Area::getDelFlag, "0").list(); |
| | | List<Map<String, Object>> arrayList = new ArrayList<>(); |
| | | for (Area area : areaList) { |
| | | String id = area.getId(); |
| | | List<Map<String, Object>> centerTwoMaintenancePlanList = this.baseMapper.getCenterTwoMaintenancePlanList(id); |
| | | if(centerTwoMaintenancePlanList.size()>0){ |
| | | arrayList.add(centerTwoMaintenancePlanList.get(0)); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |