New file |
| | |
| | | -- save basLift record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '提升机列表管理', '0', '/core/basLift', '/core/basLift', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询提升机列表', '', '1', 'core:basLift:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加提升机列表', '', '1', 'core:basLift:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改提升机列表', '', '1', 'core:basLift:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除提升机列表', '', '1', 'core:basLift:remove', '3', '1', '1'); |
| | | |
New file |
| | |
| | | package com.zy.asrs.wcs.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wcs.common.annotation.OperationLog; |
| | | 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.entity.BasLift; |
| | | import com.zy.asrs.wcs.core.service.BasLiftService; |
| | | import com.zy.asrs.wcs.utils.ExcelUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class BasLiftController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BasLiftService basLiftService; |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @PostMapping("/basLift/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<BasLift, BaseParam> pageParam = new PageParam<>(baseParam, BasLift.class); |
| | | return R.ok().add(basLiftService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @PostMapping("/basLift/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(basLiftService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @GetMapping("/basLift/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(basLiftService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:save')") |
| | | @OperationLog("添加提升机列表") |
| | | @PostMapping("/basLift/save") |
| | | public R save(@RequestBody BasLift basLift) { |
| | | if (!basLiftService.save(basLift)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:update')") |
| | | @OperationLog("修改提升机列表") |
| | | @PostMapping("/basLift/update") |
| | | public R update(@RequestBody BasLift basLift) { |
| | | if (!basLiftService.updateById(basLift)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:remove')") |
| | | @OperationLog("删除提升机列表") |
| | | @PostMapping("/basLift/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!basLiftService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @PostMapping("/basLift/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<BasLift> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(BasLift::getLiftNo, condition); |
| | | } |
| | | basLiftService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getLiftNo())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @PostMapping("/basLift/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(basLiftService.list(), BasLift.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wcs.common.annotation.OperationLog; |
| | | 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.entity.ShuttleStandby; |
| | | import com.zy.asrs.wcs.core.service.ShuttleStandbyService; |
| | | import com.zy.asrs.wcs.utils.ExcelUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class ShuttleStandbyController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ShuttleStandbyService shuttleStandbyService; |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:list')") |
| | | @PostMapping("/shuttleStandby/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ShuttleStandby, BaseParam> pageParam = new PageParam<>(baseParam, ShuttleStandby.class); |
| | | return R.ok().add(shuttleStandbyService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:list')") |
| | | @PostMapping("/shuttleStandby/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(shuttleStandbyService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:list')") |
| | | @GetMapping("/shuttleStandby/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(shuttleStandbyService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:save')") |
| | | @OperationLog("添加穿梭车待机位") |
| | | @PostMapping("/shuttleStandby/save") |
| | | public R save(@RequestBody ShuttleStandby shuttleStandby) { |
| | | if (!shuttleStandbyService.save(shuttleStandby)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:update')") |
| | | @OperationLog("修改穿梭车待机位") |
| | | @PostMapping("/shuttleStandby/update") |
| | | public R update(@RequestBody ShuttleStandby shuttleStandby) { |
| | | if (!shuttleStandbyService.updateById(shuttleStandby)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:remove')") |
| | | @OperationLog("删除穿梭车待机位") |
| | | @PostMapping("/shuttleStandby/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!shuttleStandbyService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:list')") |
| | | @PostMapping("/shuttleStandby/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<ShuttleStandby> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(ShuttleStandby::getName, condition); |
| | | } |
| | | shuttleStandbyService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getName())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:list')") |
| | | @PostMapping("/shuttleStandby/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(shuttleStandbyService.list(), ShuttleStandby.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.entity; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | import com.zy.asrs.wcs.system.entity.Host; |
| | | import com.zy.asrs.wcs.system.entity.User; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.wcs.system.service.UserService; |
| | | import com.zy.asrs.wcs.system.service.HostService; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("wcs_bas_lift") |
| | | public class BasLift implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | @ApiModelProperty(value= "设备id") |
| | | private Long deviceId; |
| | | |
| | | /** |
| | | * 提升机号 |
| | | */ |
| | | @ApiModelProperty(value= "提升机号") |
| | | private Integer liftNo; |
| | | |
| | | /** |
| | | * 当前任务状态 |
| | | */ |
| | | @ApiModelProperty(value= "当前任务状态") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 任务号 |
| | | */ |
| | | @ApiModelProperty(value= "任务号") |
| | | private Integer taskNo; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 创建人员 |
| | | */ |
| | | @ApiModelProperty(value= "创建人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value= "创建时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 作业标记 |
| | | */ |
| | | @ApiModelProperty(value= "作业标记") |
| | | private Integer pakMk; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 设备状态 |
| | | */ |
| | | @ApiModelProperty(value= "设备状态") |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 小车是否可换层 0: 否 1: 是 |
| | | */ |
| | | @ApiModelProperty(value= "小车是否可换层 0: 否 1: 是 ") |
| | | private Integer transfer; |
| | | |
| | | /** |
| | | * 排 |
| | | */ |
| | | @ApiModelProperty(value= "排") |
| | | private Integer row; |
| | | |
| | | /** |
| | | * 列 |
| | | */ |
| | | @ApiModelProperty(value= "列") |
| | | private Integer bay; |
| | | |
| | | public BasLift() {} |
| | | |
| | | public BasLift(Long deviceId,Integer liftNo,Integer status,Integer taskNo,Long updateBy,Long createBy,Date createTime,Date updateTime,String memo,Integer pakMk,Integer deleted,Long hostId,String protocol,Integer transfer) { |
| | | this.deviceId = deviceId; |
| | | this.liftNo = liftNo; |
| | | this.status = status; |
| | | this.taskNo = taskNo; |
| | | this.updateBy = updateBy; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | this.pakMk = pakMk; |
| | | this.deleted = deleted; |
| | | this.hostId = hostId; |
| | | this.protocol = protocol; |
| | | this.transfer = transfer; |
| | | } |
| | | |
| | | // BasLift basLift = new BasLift( |
| | | // null, // 设备id |
| | | // null, // 提升机号[非空] |
| | | // null, // 当前任务状态 |
| | | // null, // 任务号 |
| | | // null, // 修改人员 |
| | | // null, // 创建人员 |
| | | // null, // 创建时间 |
| | | // null, // 修改时间 |
| | | // null, // 备注 |
| | | // null, // 作业标记 |
| | | // null, // 是否删除 |
| | | // null, // 所属机构 |
| | | // null, // 设备状态 |
| | | // null // 小车是否可换层 |
| | | // ); |
| | | |
| | | public String getDeviceId$(){ |
| | | DeviceService service = SpringUtils.getBean(DeviceService.class); |
| | | Device device = service.getById(this.deviceId); |
| | | if (!Cools.isEmpty(device)){ |
| | | return String.valueOf(device.getDeviceNo()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | public String getDeleted$(){ |
| | | if (null == this.deleted){ return null; } |
| | | switch (this.deleted){ |
| | | case 1: |
| | | return "是"; |
| | | case 0: |
| | | return "否"; |
| | | default: |
| | | return String.valueOf(this.deleted); |
| | | } |
| | | } |
| | | |
| | | public String getHostId$(){ |
| | | HostService service = SpringUtils.getBean(HostService.class); |
| | | Host host = service.getById(this.hostId); |
| | | if (!Cools.isEmpty(host)){ |
| | | return String.valueOf(host.getName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getTransfer$(){ |
| | | if (null == this.transfer){ return null; } |
| | | switch (this.transfer){ |
| | | case 0: |
| | | return "否"; |
| | | case 1: |
| | | return "是"; |
| | | default: |
| | | return String.valueOf(this.transfer); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.wcs.system.service.UserService; |
| | | import com.zy.asrs.wcs.system.service.HostService; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("wcs_shuttle_standby") |
| | | public class ShuttleStandby implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @ApiModelProperty(value= "编号") |
| | | private String uuid; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @ApiModelProperty(value= "名称") |
| | | private String name; |
| | | |
| | | /** |
| | | * 标识 |
| | | */ |
| | | @ApiModelProperty(value= "标识") |
| | | private String flag; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 设备号 |
| | | */ |
| | | @ApiModelProperty(value= "设备号") |
| | | private Long deviceId; |
| | | |
| | | /** |
| | | * 设备楼层楼层 |
| | | */ |
| | | @ApiModelProperty(value= "设备楼层楼层") |
| | | private Integer deviceLev; |
| | | |
| | | /** |
| | | * 设备库位号 |
| | | */ |
| | | @ApiModelProperty(value= "设备库位号") |
| | | private String deviceLoc; |
| | | |
| | | /** |
| | | * 设备待机位库位号 |
| | | */ |
| | | @ApiModelProperty(value= "设备待机位库位号") |
| | | private String deviceStandbyLoc; |
| | | |
| | | /** |
| | | * 待机位库位号 |
| | | */ |
| | | @ApiModelProperty(value= "待机位库位号") |
| | | private String standbyLoc; |
| | | |
| | | public ShuttleStandby() {} |
| | | |
| | | public ShuttleStandby(String uuid,String name,String flag,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo,Long deviceId,Integer deviceLev,String deviceLoc,String deviceStandbyLoc,String standbyLoc) { |
| | | this.uuid = uuid; |
| | | this.name = name; |
| | | this.flag = flag; |
| | | this.hostId = hostId; |
| | | this.status = status; |
| | | this.deleted = deleted; |
| | | this.createTime = createTime; |
| | | this.createBy = createBy; |
| | | this.updateTime = updateTime; |
| | | this.updateBy = updateBy; |
| | | this.memo = memo; |
| | | this.deviceId = deviceId; |
| | | this.deviceLev = deviceLev; |
| | | this.deviceLoc = deviceLoc; |
| | | this.deviceStandbyLoc = deviceStandbyLoc; |
| | | this.standbyLoc = standbyLoc; |
| | | } |
| | | |
| | | // ShuttleStandby shuttleStandby = new ShuttleStandby( |
| | | // null, // 编号 |
| | | // null, // 名称 |
| | | // null, // 标识 |
| | | // null, // 所属机构 |
| | | // null, // 状态 |
| | | // null, // 是否删除 |
| | | // null, // 添加时间 |
| | | // null, // 添加人员 |
| | | // null, // 修改时间 |
| | | // null, // 修改人员 |
| | | // null, // 备注 |
| | | // null, // 设备号 |
| | | // null, // 设备楼层楼层 |
| | | // null, // 设备库位号 |
| | | // null, // 设备待机位库位号 |
| | | // null // 待机位库位号 |
| | | // ); |
| | | |
| | | public String getHostId$(){ |
| | | HostService service = SpringUtils.getBean(HostService.class); |
| | | Host host = service.getById(this.hostId); |
| | | if (!Cools.isEmpty(host)){ |
| | | return String.valueOf(host.getName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "禁用"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getDeleted$(){ |
| | | if (null == this.deleted){ return null; } |
| | | switch (this.deleted){ |
| | | case 1: |
| | | return "是"; |
| | | case 0: |
| | | return "否"; |
| | | default: |
| | | return String.valueOf(this.deleted); |
| | | } |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.wcs.core.domain.dto.MotionDto; |
| | | import com.zy.asrs.wcs.core.entity.ShuttleStandby; |
| | | import com.zy.asrs.wcs.core.entity.Task; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.MotionCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskStsType; |
| | | import com.zy.asrs.wcs.core.model.enums.WorkZoneType; |
| | | import com.zy.asrs.wcs.core.service.ShuttleStandbyService; |
| | | import com.zy.asrs.wcs.core.service.TaskService; |
| | | import com.zy.asrs.wcs.core.utils.LiftDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.ShuttleDispatcher; |
| | |
| | | import com.zy.asrs.wcs.core.entity.Motion; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; |
| | | import com.zy.asrs.wcs.core.service.MotionService; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | import com.zy.asrs.wcs.rcs.thread.LiftThread; |
| | | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | // private ConveyorDispatcher conveyorDispatcher; |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | @Autowired |
| | | private ShuttleStandbyService shuttleStandbyService; |
| | | |
| | | public List<Motion> generateMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | |
| | | */ |
| | | public List<Motion> generateChargeMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | // if (wrkCharge.getWrkSts() != WrkMastStsType.NEW_CHARGE.sts || wrkCharge.getIoType() != WrkIoTypeType.CHARGE.sts) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // // locNo |
| | | // String chargeLocNo = wrkCharge.getLocNo(); |
| | | // |
| | | // // lift |
| | | // Integer transferLiftNo = 2; |
| | | // SiemensLiftThread liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, transferLiftNo); |
| | | // LiftProtocol liftProtocol = liftThread.getLiftProtocol(); |
| | | // if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // // shuttle |
| | | // Integer shuttleNo = wrkCharge.getShuttleNo(); |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | // return motionList; |
| | | // } |
| | | // if (!shuttleProtocol.isIdle()) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // //检测穿梭车是否有任务绑定 |
| | | // boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleProtocol.getShuttleNo().intValue()); |
| | | // if (shuttleResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // //检测提升机是否有任务绑定 |
| | | // boolean liftResult = Utils.checkLiftHasBinding(transferLiftNo); |
| | | // if (liftResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | // |
| | | // //穿梭车到提升机库位号 |
| | | // String liftLocNoTo = LiftCodeType.getLocNo(transferLiftNo, Utils.getLev(shuttleLocNo)); |
| | | // |
| | | // //穿梭车出提升机库位号 |
| | | // String liftLocNoFrom = LiftCodeType.getLocNo(transferLiftNo, Utils.getLev(wrkCharge.getLocNo())); |
| | | // |
| | | // //穿梭车到提升机待机位库位号 |
| | | // String standbyLocNoTo = LiftCodeType.getStandbyLocNo(transferLiftNo, Utils.getLev(shuttleLocNo)); |
| | | // |
| | | // //穿梭车出提升机待机位库位号 |
| | | // String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(transferLiftNo, Utils.getLev(wrkCharge.getLocNo())); |
| | | // |
| | | // // 判断穿梭车是否在充电层 |
| | | // if (Utils.getLev(shuttleLocNo) == Utils.getLev(chargeLocNo)) { |
| | | // |
| | | // // 穿梭车走行至充电桩库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(chargeLocNo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // } else { |
| | | // |
| | | // // 穿梭车走行至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // // 提升机空载移动到穿梭车层 |
| | | // motionList.addAll(kernelService.liftMove( |
| | | // null |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机待机位至提升机库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLocNo(liftLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 提升机搬车 至 输送线层 |
| | | // motionList.addAll(kernelService.liftMoveShuttle( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLev(Utils.getLev(chargeLocNo)); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLocNo(liftLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机待机位至充电位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(chargeLocNo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // wrkCharge.setLiftNo(transferLiftNo); |
| | | // wrkChargeMapper.updateById(wrkCharge); |
| | | // } |
| | | // |
| | | // // 穿梭车开始充电 |
| | | // motionList.addAll(kernelService.shuttleCharge( |
| | | // null, |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // })) |
| | | // )); |
| | | if (task.getTaskSts() != TaskStsType.NEW_CHARGE.sts) { |
| | | return motionList; |
| | | } |
| | | |
| | | // locNo |
| | | String chargeLocNo = task.getDestLoc(); |
| | | |
| | | // shuttle |
| | | Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (shuttleDevice == null) { |
| | | return motionList; |
| | | } |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue()); |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | return motionList; |
| | | } |
| | | if (!shuttleThread.isIdle()) { |
| | | return motionList; |
| | | } |
| | | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // lift |
| | | Device transferLiftDevice = Utils.getRecentTransferLift(shuttleLocNo, shuttleProtocol.getShuttleNo()); |
| | | if (transferLiftDevice == null) { |
| | | return motionList; |
| | | } |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, transferLiftDevice.getId().intValue()); |
| | | LiftProtocol liftProtocol = liftThread.getStatus(); |
| | | if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | | |
| | | //检测提升机是否有任务绑定 |
| | | boolean liftResult = Utils.checkLiftHasBinding(Integer.parseInt(transferLiftDevice.getDeviceNo())); |
| | | if (liftResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | | |
| | | //获取小车待机库位 ==> 进提升机 |
| | | ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() |
| | | .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId()) |
| | | .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo)) |
| | | .eq(ShuttleStandby::getStatus, 1)); |
| | | |
| | | //获取小车待机库位 ==> 出提升机 |
| | | ShuttleStandby shuttleStandbyFrom = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() |
| | | .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId()) |
| | | .eq(ShuttleStandby::getDeviceLev, Utils.getLev(chargeLocNo)) |
| | | .eq(ShuttleStandby::getStatus, 1)); |
| | | if (shuttleStandbyTo == null || shuttleStandbyFrom == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //穿梭车进提升机库位号 |
| | | String liftLocNoTo = shuttleStandbyTo.getDeviceLoc(); |
| | | |
| | | //穿梭车出提升机库位号 |
| | | String liftLocNoFrom = shuttleStandbyFrom.getDeviceLoc(); |
| | | |
| | | //穿梭车进提升机待机位库位号 |
| | | String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc(); |
| | | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); |
| | | |
| | | // 判断穿梭车是否在充电层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(chargeLocNo)) { |
| | | |
| | | // 穿梭车走行至充电桩库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(chargeLocNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | } else { |
| | | |
| | | // 穿梭车走行至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至提升机库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 提升机搬车 至 输送线层 |
| | | motionList.addAll(kernelService.liftMoveShuttle( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(chargeLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至充电位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(chargeLocNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | task.setLiftNo(Integer.parseInt(transferLiftDevice.getDeviceNo())); |
| | | taskService.updateById(task); |
| | | } |
| | | |
| | | // 穿梭车开始充电 |
| | | motionList.addAll(kernelService.shuttleCharge( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | return motionList; |
| | | } |
| | |
| | | */ |
| | | public List<Motion> generateShuttleChargeWrkComplete(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | // if (wrkCharge.getWrkSts() != WrkMastStsType.NEW_MOVE.sts || wrkCharge.getIoType() != WrkIoTypeType.MOVE.sts) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // // locNo |
| | | // String locNo = wrkCharge.getLocNo(); |
| | | // |
| | | // // shuttle |
| | | // Integer shuttleNo = wrkCharge.getShuttleNo(); |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | // |
| | | // // 判断穿梭车是否在目标层 |
| | | // if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { |
| | | // |
| | | // // 穿梭车走行至目标库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(locNo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // } |
| | | if (task.getTaskSts() != TaskStsType.NEW_MOVE.sts) { |
| | | return motionList; |
| | | } |
| | | |
| | | // locNo |
| | | String locNo = task.getDestLoc(); |
| | | |
| | | // shuttle |
| | | Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (shuttleDevice == null) { |
| | | return motionList; |
| | | } |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue()); |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // 判断穿梭车是否在目标层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | } |
| | | return motionList; |
| | | } |
| | | |
| | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
New file |
| | |
| | | package com.zy.asrs.wcs.core.mapper; |
| | | |
| | | import com.zy.asrs.wcs.core.entity.BasLift; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BasLiftMapper extends BaseMapper<BasLift> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.mapper; |
| | | |
| | | import com.zy.asrs.wcs.core.entity.ShuttleStandby; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface ShuttleStandbyMapper extends BaseMapper<ShuttleStandby> { |
| | | |
| | | } |
| | |
| | | |
| | | List<Task> selectWorkingByShuttle(Integer shuttleNo); |
| | | |
| | | List<Task> selectWorkingByLift(Integer liftNo); |
| | | |
| | | Task selectChargeWorking(Integer shuttleNo); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wcs.core.entity.BasLift; |
| | | |
| | | public interface BasLiftService extends IService<BasLift> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wcs.core.entity.ShuttleStandby; |
| | | |
| | | public interface ShuttleStandbyService extends IService<ShuttleStandby> { |
| | | |
| | | } |
| | |
| | | |
| | | List<Task> selectWorkingByShuttle(Integer shuttleNo); |
| | | |
| | | List<Task> selectWorkingByLift(Integer liftNo); |
| | | |
| | | Task selectChargeWorking(Integer shuttleNo); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service.impl; |
| | | |
| | | import com.zy.asrs.wcs.core.mapper.BasLiftMapper; |
| | | import com.zy.asrs.wcs.core.entity.BasLift; |
| | | import com.zy.asrs.wcs.core.service.BasLiftService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("basLiftService") |
| | | public class BasLiftServiceImpl extends ServiceImpl<BasLiftMapper, BasLift> implements BasLiftService { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service.impl; |
| | | |
| | | import com.zy.asrs.wcs.core.mapper.ShuttleStandbyMapper; |
| | | import com.zy.asrs.wcs.core.entity.ShuttleStandby; |
| | | import com.zy.asrs.wcs.core.service.ShuttleStandbyService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("shuttleStandbyService") |
| | | public class ShuttleStandbyServiceImpl extends ServiceImpl<ShuttleStandbyMapper, ShuttleStandby> implements ShuttleStandbyService { |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Task> selectWorkingByLift(Integer liftNo) { |
| | | return this.baseMapper.selectWorkingByLift(liftNo); |
| | | } |
| | | |
| | | @Override |
| | | public Task selectChargeWorking(Integer shuttleNo) { |
| | | return this.baseMapper.selectChargeWorking(shuttleNo); |
| | | } |
| | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wcs.core.entity.BasLift; |
| | | import com.zy.asrs.wcs.core.entity.Task; |
| | | import com.zy.asrs.wcs.core.entity.TaskSerialNo; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.NavigationMapType; |
| | | import com.zy.asrs.wcs.core.service.BasLiftService; |
| | | import com.zy.asrs.wcs.core.service.TaskSerialNoService; |
| | | import com.zy.asrs.wcs.core.service.TaskService; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | |
| | | |
| | | //获取除白名单外的指定楼层全部穿梭车xy坐标点 |
| | | public static List<int[]> getShuttlePoints(Integer whiteShuttle, Integer lev) { |
| | | // SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class); |
| | | DeviceService deviceService = SpringUtils.getBean(DeviceService.class); |
| | | ArrayList<int[]> list = new ArrayList<>(); |
| | | // for (ShuttleSlave slave : slaveProperties.getShuttle()) { |
| | | // if (slave.getId().intValue() == whiteShuttle) { |
| | | // continue;//跳过白名单 |
| | | // } |
| | | // |
| | | // //获取穿梭车所在节点位置 |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId()); |
| | | // if (shuttleThread == null) { |
| | | // continue; |
| | | // } |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // if (shuttleProtocol.getCurrentLocNo() == null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // if (lev != Utils.getLev(shuttleProtocol.getCurrentLocNo())) { |
| | | // continue;//楼层不同 |
| | | // } |
| | | // |
| | | // int[] xyPosition = NavigatePositionConvert.positionToXY(shuttleProtocol.getCurrentLocNo());//通过库位号获取xy坐标 |
| | | // list.add(xyPosition); |
| | | // } |
| | | |
| | | List<Device> devices = deviceService.list(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getStatus, 1)); |
| | | for (Device device : devices) { |
| | | if (Integer.parseInt(device.getDeviceNo()) == whiteShuttle) { |
| | | continue;//跳过白名单 |
| | | } |
| | | |
| | | //获取穿梭车所在节点位置 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); |
| | | if (shuttleThread == null) { |
| | | continue; |
| | | } |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (shuttleProtocol.getCurrentLocNo() == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (lev != Utils.getLev(shuttleProtocol.getCurrentLocNo())) { |
| | | continue;//楼层不同 |
| | | } |
| | | |
| | | int[] xyPosition = NavigatePositionConvert.positionToXY(shuttleProtocol.getCurrentLocNo());//通过库位号获取xy坐标 |
| | | list.add(xyPosition); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | |
| | | throw new CoolException("工作号生成失败"); |
| | | } |
| | | |
| | | /** |
| | | * 检测穿梭车是否有任务绑定 |
| | | */ |
| | | public static boolean checkShuttleHasBinding(Device device) { |
| | | TaskService taskService = SpringUtils.getBean(TaskService.class); |
| | | List<Task> tasks = taskService.selectWorkingByShuttle(Integer.parseInt(device.getDeviceNo())); |
| | | if (tasks.isEmpty()) { |
| | | return false;//无任务绑定 |
| | | } |
| | | return true;//有任务绑定 |
| | | } |
| | | |
| | | /** |
| | | * 检测提升机是否有任务绑定 |
| | | */ |
| | | public static boolean checkLiftHasBinding(Integer liftNo) { |
| | | TaskService taskService = SpringUtils.getBean(TaskService.class); |
| | | List<Task> tasks = taskService.selectWorkingByLift(liftNo); |
| | | if (tasks.isEmpty()) { |
| | | return false;//无任务绑定 |
| | | } |
| | | return true;//有任务绑定 |
| | | } |
| | | |
| | | /** |
| | | * 获取距离目标库位最近的提升机 |
| | | */ |
| | | public static Device getRecentTransferLift(String locNo, Integer shuttleNo) { |
| | | BasLiftService basLiftService = SpringUtils.getBean(BasLiftService.class); |
| | | DeviceService deviceService = SpringUtils.getBean(DeviceService.class); |
| | | if (basLiftService == null) { |
| | | return null; |
| | | } |
| | | |
| | | Integer distance = Integer.MAX_VALUE; |
| | | Long liftDeviceId = null; |
| | | for (BasLift basLift : basLiftService.list(new LambdaQueryWrapper<BasLift>() |
| | | .eq(BasLift::getStatus, 1) |
| | | .eq(BasLift::getTransfer, 1))) { |
| | | int lev = Utils.getLev(locNo); |
| | | String liftLocNo = Utils.getLocNo(basLift.getRow(), basLift.getBay(), lev); |
| | | List<NavigateNode> nodeList = NavigateUtils.calc(locNo, liftLocNo, NavigationMapType.NONE.id, Utils.getShuttlePoints(shuttleNo, Utils.getLev(locNo))); |
| | | Integer originPathAllDistance = NavigateUtils.getOriginPathAllDistance(nodeList);//总距离 |
| | | if (originPathAllDistance < distance) { |
| | | distance = originPathAllDistance; |
| | | liftDeviceId = basLift.getDeviceId(); |
| | | } |
| | | } |
| | | |
| | | if (liftDeviceId == null) { |
| | | return null; |
| | | } |
| | | |
| | | Device device = deviceService.getById(liftDeviceId); |
| | | if (device == null) { |
| | | return null; |
| | | } |
| | | return device; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | -- save shuttleStandby record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '穿梭车待机位管理', '0', '/core/shuttleStandby', '/core/shuttleStandby', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询穿梭车待机位', '', '1', 'core:shuttleStandby:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加穿梭车待机位', '', '1', 'core:shuttleStandby:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改穿梭车待机位', '', '1', 'core:shuttleStandby:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除穿梭车待机位', '', '1', 'core:shuttleStandby:remove', '3', '1', '1'); |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.wcs.core.mapper.BasLiftMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.wcs.core.mapper.ShuttleStandbyMapper"> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="selectWorkingByShuttle" resultType="com.zy.asrs.wcs.core.entity.Task"> |
| | | select * from wcs_task |
| | | where task_sts in (1,2,3,101,102,103,201,202,203,204,301,302,303,401,402,403) |
| | | where task_sts in (1,2,3,101,102,103,301,302,303,401,402,403) |
| | | and shuttle_no = #{shuttleNo} |
| | | order by priority desc,start_time,task_no asc |
| | | </select> |
| | | |
| | | <select id="selectWorkingByLift" resultType="com.zy.asrs.wcs.core.entity.Task"> |
| | | select * from wcs_task |
| | | where task_sts in (1,2,3,101,102,103,301,302,303,401,402,403) |
| | | and lift_no = #{liftNo} |
| | | order by priority desc,start_time,task_no asc |
| | | </select> |
| | | |
| | | <select id="selectChargeWorking" resultType="com.zy.asrs.wcs.core.entity.Task"> |
| | | select * from wcs_task |
| | | where task_sts in (201,202,203,204) |