From e7ec0b5327724e06668160e00270edb75d59ef4b Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期二, 16 四月 2024 15:23:08 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/BasLiftMapper.java | 12
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/ShuttleStandbyServiceImpl.java | 12
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/BasLift.java | 250 ++++++++++
zy-asrs-wcs/src/main/resources/mapper/core/BasLiftMapper.xml | 5
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java | 426 ++++++++++--------
zy-asrs-wcs/src/main/java/basLift.sql | 9
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java | 2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java | 5
zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml | 9
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/BasLiftService.java | 8
zy-asrs-wcs/src/main/java/shuttleStandby.sql | 9
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/ShuttleStandbyService.java | 8
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/ShuttleStandby.java | 243 ++++++++++
zy-asrs-wcs/src/main/resources/mapper/core/ShuttleStandbyMapper.xml | 5
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasLiftController.java | 101 ++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java | 2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/BasLiftServiceImpl.java | 12
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java | 122 ++++-
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/ShuttleStandbyMapper.java | 12
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleStandbyController.java | 101 ++++
20 files changed, 1,131 insertions(+), 222 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/basLift.sql b/zy-asrs-wcs/src/main/java/basLift.sql
new file mode 100644
index 0000000..884b978
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/basLift.sql
@@ -0,0 +1,9 @@
+-- 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');
+
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasLiftController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasLiftController.java
new file mode 100644
index 0000000..64a5424
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasLiftController.java
@@ -0,0 +1,101 @@
+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);
+ }
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleStandbyController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleStandbyController.java
new file mode 100644
index 0000000..bb7e8da
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleStandbyController.java
@@ -0,0 +1,101 @@
+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);
+ }
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/BasLift.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/BasLift.java
new file mode 100644
index 0000000..5c1166d
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/BasLift.java
@@ -0,0 +1,250 @@
+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);
+ }
+ }
+
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/ShuttleStandby.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/ShuttleStandby.java
new file mode 100644
index 0000000..e7b5d41
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/ShuttleStandby.java
@@ -0,0 +1,243 @@
+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: 姝e父 0: 绂佺敤
+ */
+ @ApiModelProperty(value= "鐘舵�� 1: 姝e父 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 "姝e父";
+ 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;
+ }
+
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
index 2702cdc..0e3e5f2 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -3,11 +3,13 @@
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;
@@ -16,9 +18,11 @@
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;
@@ -48,6 +52,8 @@
// private ConveyorDispatcher conveyorDispatcher;
@Autowired
private DeviceService deviceService;
+ @Autowired
+ private ShuttleStandbyService shuttleStandbyService;
public List<Motion> generateMotion(Task task) {
List<Motion> motionList = new ArrayList<>();
@@ -714,164 +720,189 @@
*/
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;
}
@@ -881,40 +912,47 @@
*/
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;
}
@@ -957,11 +995,11 @@
// 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅
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
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/BasLiftMapper.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/BasLiftMapper.java
new file mode 100644
index 0000000..ecee5b3
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/BasLiftMapper.java
@@ -0,0 +1,12 @@
+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> {
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/ShuttleStandbyMapper.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/ShuttleStandbyMapper.java
new file mode 100644
index 0000000..7464706
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/ShuttleStandbyMapper.java
@@ -0,0 +1,12 @@
+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> {
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java
index 05ce37a..ddcac62 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java
@@ -36,6 +36,8 @@
List<Task> selectWorkingByShuttle(Integer shuttleNo);
+ List<Task> selectWorkingByLift(Integer liftNo);
+
Task selectChargeWorking(Integer shuttleNo);
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/BasLiftService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/BasLiftService.java
new file mode 100644
index 0000000..4789a24
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/BasLiftService.java
@@ -0,0 +1,8 @@
+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> {
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/ShuttleStandbyService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/ShuttleStandbyService.java
new file mode 100644
index 0000000..85f5466
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/ShuttleStandbyService.java
@@ -0,0 +1,8 @@
+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> {
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java
index 47a8862..166eb58 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java
@@ -34,6 +34,8 @@
List<Task> selectWorkingByShuttle(Integer shuttleNo);
+ List<Task> selectWorkingByLift(Integer liftNo);
+
Task selectChargeWorking(Integer shuttleNo);
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/BasLiftServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/BasLiftServiceImpl.java
new file mode 100644
index 0000000..b5b2fc3
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/BasLiftServiceImpl.java
@@ -0,0 +1,12 @@
+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 {
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/ShuttleStandbyServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/ShuttleStandbyServiceImpl.java
new file mode 100644
index 0000000..d24b76d
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/ShuttleStandbyServiceImpl.java
@@ -0,0 +1,12 @@
+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 {
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java
index 5d58baf..394edcf 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java
@@ -112,6 +112,11 @@
}
@Override
+ public List<Task> selectWorkingByLift(Integer liftNo) {
+ return this.baseMapper.selectWorkingByLift(liftNo);
+ }
+
+ @Override
public Task selectChargeWorking(Integer shuttleNo) {
return this.baseMapper.selectChargeWorking(shuttleNo);
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java
index d308757..6c3b59b 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java
@@ -4,9 +4,13 @@
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;
@@ -77,34 +81,38 @@
//鑾峰彇闄ょ櫧鍚嶅崟澶栫殑鎸囧畾妤煎眰鍏ㄩ儴绌挎杞y鍧愭爣鐐�
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());//閫氳繃搴撲綅鍙疯幏鍙杧y鍧愭爣
-// 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());//閫氳繃搴撲綅鍙疯幏鍙杧y鍧愭爣
+ list.add(xyPosition);
+ }
return list;
}
@@ -175,4 +183,64 @@
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;
+ }
+
}
diff --git a/zy-asrs-wcs/src/main/java/shuttleStandby.sql b/zy-asrs-wcs/src/main/java/shuttleStandby.sql
new file mode 100644
index 0000000..ff02352
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/shuttleStandby.sql
@@ -0,0 +1,9 @@
+-- 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');
+
diff --git a/zy-asrs-wcs/src/main/resources/mapper/core/BasLiftMapper.xml b/zy-asrs-wcs/src/main/resources/mapper/core/BasLiftMapper.xml
new file mode 100644
index 0000000..a5653dc
--- /dev/null
+++ b/zy-asrs-wcs/src/main/resources/mapper/core/BasLiftMapper.xml
@@ -0,0 +1,5 @@
+<?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>
diff --git a/zy-asrs-wcs/src/main/resources/mapper/core/ShuttleStandbyMapper.xml b/zy-asrs-wcs/src/main/resources/mapper/core/ShuttleStandbyMapper.xml
new file mode 100644
index 0000000..761d485
--- /dev/null
+++ b/zy-asrs-wcs/src/main/resources/mapper/core/ShuttleStandbyMapper.xml
@@ -0,0 +1,5 @@
+<?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>
diff --git a/zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml b/zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml
index 93b2cc3..81aefdb 100644
--- a/zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml
+++ b/zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml
@@ -79,11 +79,18 @@
<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)
--
Gitblit v1.9.1