| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.vo.EamEquipmentTree; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 设备台账 |
| | |
| | | public class EamEquipmentController extends JeecgController<EamEquipment, IEamEquipmentService> { |
| | | @Autowired |
| | | private IEamEquipmentService eamEquipmentService; |
| | | |
| | | @Autowired |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | @ApiOperation(value = "设备台账-添加", notes = "设备台账-添加") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamEquipment eamEquipment) { |
| | | boolean b = eamEquipmentService.saveEquipment(eamEquipment); |
| | | if (!b) { |
| | | Result.OK("添加失败!"); |
| | | EamEquipment entity = eamEquipmentService.saveEquipment(eamEquipment); |
| | | if (entity == null) { |
| | | return Result.OK("添加失败!"); |
| | | } |
| | | //调用mdcEquipment插入MDC设备 |
| | | if(CommonConstant.DEFAULT_1.equals(eamEquipment.getMdcFlag())) { |
| | | //插入MDC设备 |
| | | MdcEquipment mdcEquipment = new MdcEquipment(); |
| | | mdcEquipment.setEquipmentId(entity.getEquipmentCode()); |
| | | mdcEquipment.setEquipmentType(entity.getDeviceType()); |
| | | mdcEquipment.setEquipmentName(entity.getEquipmentName()); |
| | | mdcEquipmentService.addNewEquipmentFromEam(mdcEquipment, eamEquipment.getOrgId()); |
| | | } |
| | | return Result.OK("添加成功!"); |
| | | } |
| | |
| | | return super.importExcel(request, response, EamEquipment.class); |
| | | } |
| | | |
| | | @AutoLog(value = "设备表-通过车间ids获取设备树") |
| | | @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树") |
| | | @GetMapping(value = "/loadTreeListByProductionIds") |
| | | public Result<List<EamEquipmentTree>> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) { |
| | | Result<List<EamEquipmentTree>> result = new Result<>(); |
| | | try { |
| | | List<EamEquipmentTree> mdcEquipmentTreeList = eamEquipmentService.loadTreeListByProductionIds(ids); |
| | | result.setSuccess(true); |
| | | result.setResult(mdcEquipmentTreeList); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |