| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.entity.MaintenanceOrderActualWorkingHour; |
| | | import org.jeecg.modules.eam.entity.PredictiveWorkOrder; |
| | | import org.jeecg.modules.eam.entity.SpecialtyMaintenanceOrder; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.service.IMaintenanceOrderActualMaterialService; |
| | | import org.jeecg.modules.eam.service.IMaintenanceOrderActualWorkingHourService; |
| | | import org.jeecg.modules.eam.service.IPredictiveWorkOrderService; |
| | | import org.jeecg.modules.eam.service.ISpecialtyMaintenanceOrderService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | |
| | | |
| | | @Autowired |
| | | private IMaintenanceOrderActualWorkingHourService maintenanceOrderActualWorkingHourService; |
| | | |
| | | @Autowired |
| | | private IMaintenanceOrderActualMaterialService maintenanceOrderActualMaterialService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | return Result.ok(specialtyMaintenanceOrderList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param specialtyMaintenanceOrder |
| | | * @return |
| | | */ |
| | | // /** |
| | | // * 添加 |
| | | // * |
| | | // * @param specialtyMaintenanceOrder |
| | | // * @return |
| | | // */ |
| | | // @AutoLog(value = "mom_eam_specialty_maintenance_order-添加") |
| | | // @ApiOperation(value = "mom_eam_specialty_maintenance_order-添加", notes = "mom_eam_specialty_maintenance_order-添加") |
| | | // //@RequiresPermissions("org.jeecg.modules:mom_eam_specialty_maintenance_order:add") |
| | |
| | | // } |
| | | // |
| | | // |
| | | // @RequestMapping(value = "/editStatus", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | // public Result<String> editStatus(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) { |
| | | // specialtyMaintenanceOrder.setActualStartTime(new Date()); |
| | | // boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder); |
| | | // if (b) { |
| | | // return Result.OK("下发成功!"); |
| | | // } else { |
| | | // return Result.error("下发失败!"); |
| | | // } |
| | | // } |
| | | // |
| | | // @RequestMapping(value = "/report", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | // public Result<String> report(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) { |
| | | // specialtyMaintenanceOrder.setActualEndTime(new Date()); |
| | | // boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder); |
| | | // if (!b) { |
| | | // return Result.error("报工失败!"); |
| | | // } else { |
| | | // return Result.ok("报工成功!"); |
| | | // } |
| | | // } |
| | | // |
| | | // @RequestMapping(value = "/revocation", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | // public Result<String> revocation(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) { |
| | | // String id = specialtyMaintenanceOrder.getId(); |
| | | // SpecialtyMaintenanceOrder maintenanceOrder = specialtyMaintenanceOrderService.getById(id); |
| | | // String status = maintenanceOrder.getStatus(); |
| | | // if ("5".equals(status)) { |
| | | // maintenanceOrder.setActualEndTime(null); |
| | | // boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder); |
| | | // if (b) { |
| | | // return Result.OK("撤销成功!"); |
| | | // } else { |
| | | // return Result.error("撤销失败!"); |
| | | // } |
| | | // } else { |
| | | // return Result.error("仅限已完工状态撤销完成操作!"); |
| | | // } |
| | | // } |
| | | // |
| | | // @RequestMapping(value = "/orderGet", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | // public Result<String> orderGet(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) { |
| | | // LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | // String userId = sysUser.getId(); |
| | | // specialtyMaintenanceOrder.setRecipientUserId(userId); |
| | | // specialtyMaintenanceOrder.setMaintenanceUserId(userId); |
| | | // specialtyMaintenanceOrder.setStatus("3"); |
| | | // boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder); |
| | | // if (b) { |
| | | // return Result.OK("领取成功!"); |
| | | // } else { |
| | | // return Result.error("领取失败!"); |
| | | // } |
| | | // } |
| | | @RequestMapping(value = "/editStatus", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> editStatus(@RequestBody PredictiveWorkOrder predictiveWorkOrder) { |
| | | predictiveWorkOrder.setActualStartTime(new Date()); |
| | | boolean b = predictiveWorkOrderService.updateById(predictiveWorkOrder); |
| | | if (b) { |
| | | return Result.OK("操作成功!"); |
| | | } else { |
| | | return Result.error("操作失败!"); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/report", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<String> report(@RequestBody PredictiveWorkOrder predictiveWorkOrder) { |
| | | List<MaintenanceOrderActualMaterial> actualMaterialList = maintenanceOrderActualMaterialService |
| | | .list(new QueryWrapper<MaintenanceOrderActualMaterial>() |
| | | .eq("maintenance_order_id",predictiveWorkOrder.getId()) |
| | | .eq("del_flag",0)); |
| | | for(MaintenanceOrderActualMaterial maintenanceOrderActualMaterial:actualMaterialList){ |
| | | if(maintenanceOrderActualMaterial.getIsLock().equals("no")){ |
| | | throw new RuntimeException(" 【实际物料】尚未锁料,请先锁料"); |
| | | } |
| | | } |
| | | List<MaintenanceOrderActualWorkingHour> actualWorkingHours = maintenanceOrderActualWorkingHourService |
| | | .list(new QueryWrapper<MaintenanceOrderActualWorkingHour>() |
| | | .eq("maintenance_order_id",predictiveWorkOrder.getId()) |
| | | .eq("del_flag",0)); |
| | | for(MaintenanceOrderActualWorkingHour actualWorkingHour:actualWorkingHours){ |
| | | if(ObjectUtils.isNull(actualWorkingHour.getActualWorkingHourQuota())){ |
| | | throw new RuntimeException("【实际工时】存在未填写的工时,请先填写"); |
| | | } |
| | | if(StringUtils.isBlank(actualWorkingHour.getUserId())){ |
| | | throw new RuntimeException("【实际工时】存在未填写的人员,请先填写"); |
| | | } |
| | | } |
| | | predictiveWorkOrder.setActualEndTime(new Date()); |
| | | boolean b = predictiveWorkOrderService.updateById(predictiveWorkOrder); |
| | | if (!b) { |
| | | return Result.error("报工失败!"); |
| | | } else { |
| | | return Result.ok("报工成功!"); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/revocation", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> revocation(@RequestBody PredictiveWorkOrder predictiveWorkOrder) { |
| | | String id = predictiveWorkOrder.getId(); |
| | | PredictiveWorkOrder predictiveWorkOrder1 = predictiveWorkOrderService.getById(id); |
| | | String status = predictiveWorkOrder1.getStatus(); |
| | | if ("5".equals(status)) { |
| | | predictiveWorkOrder1.setActualEndTime(null); |
| | | boolean b = predictiveWorkOrderService.updateById(predictiveWorkOrder); |
| | | if (b) { |
| | | return Result.OK("撤销成功!"); |
| | | } else { |
| | | return Result.error("撤销失败!"); |
| | | } |
| | | } else { |
| | | return Result.error("仅限已完工状态进行撤销操作!"); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/orderGet", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> orderGet(@RequestBody PredictiveWorkOrder predictiveWorkOrder) { |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = sysUser.getId(); |
| | | predictiveWorkOrder.setRecipientUserId(userId); |
| | | predictiveWorkOrder.setMaintenanceUserId(userId); |
| | | predictiveWorkOrder.setStatus("3"); |
| | | boolean b = predictiveWorkOrderService.updateById(predictiveWorkOrder); |
| | | if (b) { |
| | | return Result.OK("领取成功!"); |
| | | } else { |
| | | return Result.error("领取失败!"); |
| | | } |
| | | } |
| | | // |
| | | // /** |
| | | // * 通过id删除 |
| | |
| | | // return super.importExcel(request, response, SpecialtyMaintenanceOrder.class); |
| | | // } |
| | | // |
| | | // @RequestMapping(value = "/assign", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | // public Result<String> assign(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) { |
| | | // boolean b = specialtyMaintenanceOrderService.assign(specialtyMaintenanceOrder); |
| | | // if (b) { |
| | | // return Result.OK("改派成功!"); |
| | | // } else { |
| | | // return Result.error("改派失败!"); |
| | | // } |
| | | // } |
| | | @RequestMapping(value = "/assign", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> assign(@RequestBody PredictiveWorkOrder predictiveWorkOrder) { |
| | | boolean b = predictiveWorkOrderService.assign(predictiveWorkOrder); |
| | | if (b) { |
| | | return Result.OK("改派成功!"); |
| | | } else { |
| | | return Result.error("改派失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |