| | |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.MotionStsType; |
| | | import com.zy.asrs.wcs.core.service.DeviceCtgService; |
| | | import com.zy.asrs.wcs.core.mapper.MotionMapper; |
| | | import com.zy.asrs.wcs.core.entity.Motion; |
| | | import com.zy.asrs.wcs.core.service.MotionService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.wcs.core.service.MotionStsService; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceTypeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | public class MotionServiceImpl extends ServiceImpl<MotionMapper, Motion> implements MotionService { |
| | | |
| | | @Autowired |
| | | private DeviceCtgService deviceCtgService; |
| | | private DeviceTypeService deviceTypeService; |
| | | @Autowired |
| | | private MotionStsService motionStsService; |
| | | |
| | |
| | | public List<Motion> selectUnCompleteByUuidAndDeviceCtg(String uuid, DeviceCtgType deviceCtgType) { |
| | | return this.list(new LambdaQueryWrapper<Motion>() |
| | | .eq(Motion::getUuid, uuid) |
| | | .eq(Motion::getDeviceCtg, deviceCtgService.selectByFlag(deviceCtgType.toString()).getId()) |
| | | .eq(Motion::getDeviceCtg, deviceTypeService.selectByFlag(deviceCtgType.toString()).getId()) |
| | | .lt(Motion::getMotionSts, motionStsService.selectByFlag(MotionStsType.COMPLETE.toString()).getId()) |
| | | .orderByDesc(Motion::getPriority) |
| | | ); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo) { |
| | | public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo, Long hostId) { |
| | | int i = motionList.size(); |
| | | for (Motion motion : motionList) { |
| | | motion.setPriority(i); |
| | | motion.setWrkNo(taskNo); |
| | | motion.setTaskNo(taskNo); |
| | | motion.setUuid(uuid); |
| | | if (hostId != null) { |
| | | motion.setHostId(hostId); |
| | | } |
| | | if (!this.save(motion)) { |
| | | throw new CoolException(JSON.toJSONString(motion) + "动作保存失败"); |
| | | } |
| | |
| | | } |
| | | return motionList.size(); |
| | | } |
| | | |
| | | @Override |
| | | public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo) { |
| | | return batchInsert(motionList, uuid, taskNo, null); |
| | | } |
| | | } |