| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.util.StringUtil; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcTorqueConfig; |
| | | import org.jeecg.modules.mdc.mapper.MdcTorqueConfigMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcTorqueConfigService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.vo.MdcTorqueConfigVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.lang.reflect.Array; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: 扭矩配置管理 |
| | |
| | | * @Date: 2023-06-29 |
| | | */ |
| | | @Service |
| | | public class MdcTorqueConfigServiceImpl extends ServiceImpl<MdcTorqueConfigMapper, MdcTorqueConfig> implements IMdcTorqueConfigService{ |
| | | public class MdcTorqueConfigServiceImpl extends ServiceImpl<MdcTorqueConfigMapper, MdcTorqueConfig> implements IMdcTorqueConfigService { |
| | | |
| | | @Autowired |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Override |
| | | public MdcTorqueConfig queryById(String id) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addTorque(MdcTorqueConfig mdcTorqueConfig) { |
| | | return this.save(mdcTorqueConfig); |
| | | public Boolean addTorque(MdcTorqueConfigVo torqueVo) { |
| | | boolean result = false; |
| | | String[] equipmentIds = torqueVo.getEquipmentIds().split(","); |
| | | for (String equipmentId : equipmentIds) { |
| | | MdcEquipment mdcEquipment = mdcEquipmentService.findEquipmentNameByEquipmentId(equipmentId); |
| | | MdcTorqueConfig mdcTorqueConfig = new MdcTorqueConfig(); |
| | | mdcTorqueConfig.setEquipmentId(equipmentId); |
| | | mdcTorqueConfig.setEquipmentName(mdcEquipment.getEquipmentName()); |
| | | mdcTorqueConfig.setTorqueDate(torqueVo.getTorqueDate()); |
| | | mdcTorqueConfig.setTorqueValue(torqueVo.getTorqueValue()); |
| | | mdcTorqueConfig.setNotes(torqueVo.getNotes()); |
| | | boolean b = super.save(mdcTorqueConfig); |
| | | if (b) { |
| | | result = true; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public List<MdcTorqueConfig> findSpindleRunningCurve(float torqueValue, String equipmentId) { |
| | | return this.baseMapper.findSpindleRunningCurve(torqueValue,equipmentId); |
| | | return this.baseMapper.findSpindleRunningCurve(torqueValue, equipmentId); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public IPage<MdcTorqueConfig> pageList(String userId, Page page, HttpServletRequest req, MdcTorqueConfig mdcTorqueConfig) { |
| | | List<String> equipmentIds = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(mdcTorqueConfig.getParentId()) && StringUtils.isEmpty(mdcTorqueConfig.getEquipmentId())) { |
| | | if ("2".equals(mdcTorqueConfig.getTypeTree())) { |
| | | //部门层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcTorqueConfig.getParentId()); |
| | | } else { |
| | | //产线层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcTorqueConfig.getParentId()); |
| | | } |
| | | } else if (StringUtils.isNotEmpty(mdcTorqueConfig.getEquipmentId())) { |
| | | //单台设备信息 |
| | | mdcTorqueConfig.setMdcSectionIds(Collections.singletonList(mdcTorqueConfig.getEquipmentId())); |
| | | } else { |
| | | //查询用户所拥有的所有设备信息 |
| | | if ("2".equals(mdcTorqueConfig.getTypeTree())) { |
| | | //部门层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); |
| | | } else { |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); |
| | | } |
| | | } |
| | | if (mdcTorqueConfig.getMdcSectionIds() == null || mdcTorqueConfig.getMdcSectionIds().isEmpty()) { |
| | | mdcTorqueConfig.setMdcSectionIds(equipmentIds); |
| | | } |
| | | if (mdcTorqueConfig.getMdcSectionIds() == null || mdcTorqueConfig.getMdcSectionIds().isEmpty()) { |
| | | return null; |
| | | } |
| | | return this.baseMapper.pageList(page, mdcTorqueConfig); |
| | | } |
| | | } |