| | |
| | | import com.zy.asrs.wcs.common.domain.BaseParam; |
| | | import com.zy.asrs.wcs.common.domain.KeyValVo; |
| | | import com.zy.asrs.wcs.common.domain.PageParam; |
| | | import com.zy.asrs.wcs.core.domain.param.ConveyorOperatorParam; |
| | | import com.zy.asrs.wcs.core.domain.param.ShuttleOperatorParam; |
| | | import com.zy.asrs.wcs.core.entity.BasConveyor; |
| | | import com.zy.asrs.wcs.core.entity.Motion; |
| | | import com.zy.asrs.wcs.core.entity.Task; |
| | | import com.zy.asrs.wcs.core.entity.TaskCtg; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskStsType; |
| | | import com.zy.asrs.wcs.core.service.BasConveyorService; |
| | | import com.zy.asrs.wcs.core.utils.Utils; |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.model.enums.LiftProtocolStatusType; |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | import com.zy.asrs.wcs.rcs.thread.DevpThread; |
| | | import com.zy.asrs.wcs.rcs.thread.LiftThread; |
| | | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; |
| | | import com.zy.asrs.wcs.system.controller.BaseController; |
| | | import com.zy.asrs.wcs.utils.ExcelUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | |
| | | |
| | | @Autowired |
| | | private BasConveyorService basConveyorService; |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyor:list')") |
| | | @PostMapping("/basConveyor/page") |
| | |
| | | ExcelUtil.build(ExcelUtil.create(basConveyorService.list(), BasConveyor.class), response); |
| | | } |
| | | |
| | | //手动操作 |
| | | @PreAuthorize("hasAuthority('core:basConveyor:operator')") |
| | | @PostMapping("/basConveyor/operator/sta") |
| | | @Transactional |
| | | public synchronized R conveyorOperator(@RequestBody ConveyorOperatorParam param) { |
| | | if (Cools.isEmpty(param.getConveyorNo(), param.getTaskMode())) { |
| | | return R.error("参数为空"); |
| | | } |
| | | |
| | | Integer conveyorNo = param.getConveyorNo(); |
| | | |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, DeviceCtgType.CONVEYOR.val()) |
| | | .eq(Device::getStatus, 1) |
| | | .eq(Device::getDeviceNo, conveyorNo)); |
| | | if (device == null) { |
| | | return R.error("设备不存在"); |
| | | } |
| | | |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, device.getId().intValue()); |
| | | if (devpThread == null) { |
| | | return R.error("设备离线"); |
| | | } |
| | | |
| | | if (param.getTaskMode().equals("taskNoAndStaNo")) { |
| | | //写入工作号和目标站 |
| | | if (Cools.isEmpty(param.getSiteNo())) { |
| | | return R.error("站点不存在"); |
| | | } |
| | | |
| | | boolean result = devpThread.writeWorkSta(param.getSiteNo(), Short.parseShort(param.getTaskNo()), param.getStaNo().shortValue()); |
| | | if (!result) { |
| | | return R.error("保存失败"); |
| | | } |
| | | return R.ok("保存成功"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |