package com.mes.md.service.impl; import com.github.yulichang.base.MPJBaseServiceImpl; import com.mes.md.entity.Machine; import com.mes.md.mapper.MachineMapper; import com.mes.md.service.MachineService; import org.springframework.stereotype.Service; import java.util.Objects; /** *

* 服务实现类 *

* * @author wu * @since 2024-08-28 */ @Service public class MachineServiceImpl extends MPJBaseServiceImpl implements MachineService { /** * @param machine 修改当前设备状态:【开工/暂停】 * @return */ @Override public int openOrCloseMachine(Machine machine){ Machine oldmachine=baseMapper.selectById(machine); if(!Objects.isNull(oldmachine)){ oldmachine.setState(machine.getState()); return baseMapper.updateById(oldmachine); } return 0; } /** * @param machine 添加手动上片任务 * @return */ @Override public int manualOperationTask(Machine machine){ Machine oldmachine=baseMapper.selectById(machine); if(!Objects.isNull(oldmachine)){ oldmachine.setTaskCount(machine.getTaskCount()); oldmachine.setFinshCount(machine.getFinshCount()); return baseMapper.updateById(oldmachine); } return 0; } /** * @param machine 切换设备模式:(上片:【1定制/2标准/3手动】,翻片:【1定制/2标准】 旋转:【1定制/2标准】),其他设备暂时没有模式 * @return */ @Override public int toggleModeMachine(Machine machine){ Machine oldmachine=baseMapper.selectById(machine); if(!Objects.isNull(oldmachine)){ oldmachine.setMode(machine.getMode()); return baseMapper.updateById(oldmachine); } return 0; } /** * @param machine 切换旋转模式:(旋转:【1旋转/2不旋转】) * @return */ @Override public int toggleModeRotate(Machine machine){ Machine oldmachine=baseMapper.selectById(machine); if(!Objects.isNull(oldmachine)){ oldmachine.setRotateMode(machine.getRotateMode()); return baseMapper.updateById(oldmachine); } return 0; } }