| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.zy.asrs.entity.Tag; |
| | | import com.zy.asrs.entity.Task; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.MesService; |
| | | import com.zy.asrs.service.TaskService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.WorkMastHandler; |
| | | import com.zy.common.utils.NodeUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private TaskService taskService; |
| | | @Resource |
| | | private MesService mesService; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private TagService tagService; |
| | | // TODO:reporterTask() |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void autoSyncMatGroup(){ |
| | | Page<Mat> page = new Page<>(1, 20); |
| | | //建立成品和备件tag后把14,15替换为实际id |
| | | page = matService.selectPage(page, new EntityWrapper<Mat>().notIn("tag_id", 14,15)); |
| | | List<Mat> matList = page.getRecords(); |
| | | for (Mat mat : matList) { |
| | | String groupName = null; |
| | | if (mat.getMatnr().startsWith("T_") || mat.getMatnr().startsWith("X_")) { |
| | | groupName = "成品"; |
| | | }else { |
| | | groupName = "配件"; |
| | | } |
| | | Tag secTag = tagService.selectByName(groupName, 3); |
| | | if (Cools.isEmpty(secTag)) { |
| | | continue; |
| | | } |
| | | mat.setTagId(secTag.getId()); |
| | | matService.updateById(mat); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |