| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.utils.RedisUtil; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.mapper.DownGlassInfoMapper; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | import com.mes.downworkstation.entity.DownWorkstionAndDownGlassinfo; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | @Autowired(required = false) |
| | | private DownWorkstationTaskMapper downWorkstationTaskMapper; |
| | | @Autowired |
| | | private DownGlassInfoService downGlassInfoService; |
| | | @Autowired |
| | | private DownGlassInfoMapper downGlassInfoMapper; |
| | | @Autowired |
| | | private DownGlassTaskService downGlassTaskService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private DownWorkstationTaskService downWorkstationTaskService; |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | // @Override |
| | | // public List<DownWorkstation> gettwoDownWorkstations() { |
| | |
| | | @Override |
| | | public List<Map<String, Object>> getTotalGlassDimensionsByWorkstation(int start, int end) { |
| | | MPJQueryWrapper<DownWorkstation> queryWrapper = new MPJQueryWrapper<>(); |
| | | queryWrapper.select("t.workstation_id", "t.flow_card_id", "COALESCE(SUM(b.width), 0) AS totalwidth", "COALESCE(SUM(b.height), 0) AS totalheight") |
| | | queryWrapper.select("t.workstation_id", "t.flow_card_id", "COALESCE(SUM(b.width), 0) AS totalwidth", "COALESCE(SUM(b.height), 0) AS totalheight,total_quantity,racks_number,other_number") |
| | | .leftJoin("down_glass_info b on t.flow_card_id = b.flow_card_id") |
| | | .groupBy("t.workstation_id", "t.flow_card_id") |
| | | .orderByAsc("t.workstation_id").between("t.workstation_id", start, end) |
| | |
| | | item.put("width", downWorkstionAndDownGlassinfo.getTotalwidth()); |
| | | item.put("fillColor", "yellow"); |
| | | item.put("content", downWorkstionAndDownGlassinfo.getFlowCardId()); |
| | | if (downWorkstionAndDownGlassinfo.getFlowCardId()!=""&&downWorkstionAndDownGlassinfo.getFlowCardId()!=null&&downWorkstionAndDownGlassinfo.getTotalQuantity() == downWorkstionAndDownGlassinfo.getRacksNumber() + downWorkstionAndDownGlassinfo.getRacksNumber()) { |
| | | item.put("fullCardColor", "red"); |
| | | } else { |
| | | item.put("fullCardColor", "blue"); |
| | | } |
| | | |
| | | // 查询 DownGlassInfo 并添加到 item 中 |
| | | MPJQueryWrapper<DownGlassInfo> glassInfoQueryWrapper = new MPJQueryWrapper<>(); |
| | |
| | | |
| | | |
| | | @Override |
| | | public int updateFlowCardIdAndCount(String flowCardId, int workstationId, int layer) { |
| | | public void updateFlowCardIdAndCount(String flowCardId, int workstationId, int layer) { |
| | | int glassInfoCount = glassInfoService.getGlassInfoCountByFlowCardId(flowCardId, layer); |
| | | QueryWrapper<Damage> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("process_id", flowCardId); |
| | |
| | | .set("layer", layer) |
| | | .set("other_number", otherNumber) |
| | | .eq("workstation_id", workstationId); |
| | | |
| | | this.update(updateWrapper); |
| | | return 1; |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean updateDownWorkstationstate(DownWorkstation downWorkstation) { |
| | | |
| | | DownWorkstation downWork = baseMapper.selectById(downWorkstation.getId()); |
| | | |
| | | if (downWork != null) { |
| | | |
| | | downWork.setEnableState(downWorkstation.getEnableState()); |
| | | |
| | | baseMapper.updateById(downWork); |
| | | |
| | | return true; |
| | | } else { |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String closeAlarmSignal() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("alarm_signal").getAddress(), 0); |
| | | return "success"; |
| | | } |
| | | |
| | | @Override |
| | | public void autoPrint(Boolean flag) { |
| | | redisUtil.setCacheObject("autoPrint", flag); |
| | | } |
| | | |
| | | } |