苏宠新增代码提交

main
Comair 7 months ago
parent 6653b0e8b3
commit cf34501387
  1. 2
      shkj-admin/pom.xml
  2. 4
      shkj-admin/src/main/resources/application-test.yml
  3. 2
      shkj-admin/src/main/resources/application-yun.yml
  4. 2
      shkj-admin/src/main/resources/application.yml
  5. 2
      shkj-admin/src/main/resources/logback.xml
  6. 23
      shkj-wms/src/main/java/com/shkj/wcs/bo/WcsRequestBo.java
  7. 35
      shkj-wms/src/main/java/com/shkj/wcs/controller/busin/AgvTaskContorller.java
  8. 85
      shkj-wms/src/main/java/com/shkj/wcs/controller/busin/WcsTaskController.java
  9. 11
      shkj-wms/src/main/java/com/shkj/wcs/domain/BusinDataTask.java
  10. 4
      shkj-wms/src/main/java/com/shkj/wcs/mapper/BusinDataTaskMapper.java
  11. 6
      shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java
  12. 12
      shkj-wms/src/main/java/com/shkj/wcs/service/IBusinDataTaskService.java
  13. 10
      shkj-wms/src/main/java/com/shkj/wcs/service/impl/BusinDataTaskServiceImpl.java
  14. 14
      shkj-wms/src/main/java/com/shkj/wcs/third/rcs/RCSUtil.java
  15. 63
      shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WcsCreateTaskBody.java
  16. 21
      shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WcsCreateTaskDto.java
  17. 14
      shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WcsCreateTaskHeader.java
  18. 24
      shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/enums/WcsCallbackTaskEnum.java
  19. 15
      shkj-wms/src/main/java/com/shkj/wcs/vo/QueryAreaStatusVo.java
  20. 60
      shkj-wms/src/main/java/com/shkj/wcs/vo/WcsResponseVo.java
  21. 2
      shkj-wms/src/main/java/com/shkj/wms/mapper/BusinPickupMapper.java
  22. 3
      shkj-wms/src/main/java/com/shkj/wms/vo/BusinDataTaskVo.java
  23. 7
      shkj-wms/src/main/resources/mapper/wcs/BusinDataTaskMapper.xml

@ -121,7 +121,7 @@
</configuration>
</plugin>
</plugins>
<finalName>kmv2-admin</finalName>
<finalName>sc-admin</finalName>
</build>
<repositories>

@ -12,9 +12,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://127.0.0.1:3306/mjk_wcs_2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://127.0.0.1:3306/mjk_wms_wcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: Sh@2024_
password: root
# 从库数据源
slave:
# 从数据源开关/默认关闭

@ -12,7 +12,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://120.77.94.227:3306/mjk_wcs_2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://120.77.94.227:3306/sc-wcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: CTlTwKgIrRVTsEHqxxx
# 从库数据源

@ -45,7 +45,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: yun
active: pro146
# 文件上传
servlet:
multipart:

@ -8,7 +8,7 @@
<contextName>logback</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<!-- <property name="log.path" value="/opt/logs/mjk2" />-->
<property name="log.path" value="E:/wcs/logs" />
<property name="log.path" value="D:/wcs/logs" />
<!-- 彩色日志 -->
<!-- 配置格式变量:CONSOLE_LOG_PATTERN 彩色日志格式 -->

@ -0,0 +1,23 @@
package com.shkj.wcs.bo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class WcsRequestBo implements Serializable {
private Header header;
private List<Object> body;
@Data
public static class Header {
private String businessType;
}
}

@ -0,0 +1,35 @@
package com.shkj.wcs.controller.busin;
import com.shkj.common.annotation.Log;
import com.shkj.common.annotation.RepeatSubmit;
import com.shkj.common.enums.BusinessType;
import com.shkj.wcs.bo.WcsRequestBo;
import com.shkj.wcs.vo.QueryAreaStatusVo;
import com.shkj.wcs.vo.WcsResponseVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RequiredArgsConstructor(onConstructor_ =@Autowired)
@RestController
@RequestMapping("/api")
public class AgvTaskContorller {
/**
* 执行task
*/
@Log(title = "查询每个库区状态",businessType = BusinessType.UPDATE)
@PostMapping("/toKjWcs/queryAreaStatus")
@RepeatSubmit
public WcsResponseVo queryAreaStatus(WcsRequestBo wcsRequestBo){
// 请求agv接口...
List<QueryAreaStatusVo> areaStatusVos = new ArrayList<>();
return WcsResponseVo.success(areaStatusVos);
}
}

@ -0,0 +1,85 @@
package com.shkj.wcs.controller.busin;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shkj.common.annotation.Log;
import com.shkj.common.annotation.RepeatSubmit;
import com.shkj.common.enums.BusinessType;
import com.shkj.common.utils.DateUtils;
import com.shkj.wcs.service.IBusinDataTaskService;
import com.shkj.wcs.third.workbinWcs.dto.WcsCreateTaskBody;
import com.shkj.wcs.third.workbinWcs.dto.WcsCreateTaskDto;
import com.shkj.wcs.vo.WcsResponseVo;
import com.shkj.wcs.domain.BusinDataTask;
import com.shkj.wms.service.IBusinTaskService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RequiredArgsConstructor(onConstructor_ =@Autowired)
@RestController
@RequestMapping("/api")
public class WcsTaskController {
@Autowired
private IBusinDataTaskService iBusinDataTaskService;
/**
* wz-wcs任务下发
*/
@Log(title = "wz-wcs任务下发",businessType = BusinessType.UPDATE)
@PostMapping("/toKjWcs/commonApi")
@RepeatSubmit
public WcsResponseVo commonApi(WcsCreateTaskDto bo){
if(bo != null){
List<WcsCreateTaskBody> body = bo.getBody();
if(!body.isEmpty()){
for(WcsCreateTaskBody by : body){
String taskId = by.getTaskId();
String trayCode = by.getTrayCode();
String taskType = by.getTaskType();
String fromBinCode = by.getFromBinCode();
String toBinCode = by.getToBinCode();
String dataChange = by.getDataChange();
String priority = by.getPriority();
LambdaQueryWrapper<BusinDataTask> lqwDataTask = new LambdaQueryWrapper<BusinDataTask>()
.eq(BusinDataTask::getContainerId,trayCode)
.in(BusinDataTask::getTaskStatus,"1","2");
BusinDataTask one = iBusinDataTaskService.getOne(lqwDataTask);
if(dataChange.equals("1")){
if (one != null){
return WcsResponseVo.error(500,"该托盘"+trayCode+"存在未完成的任务");
}
BusinDataTask businDataTask = new BusinDataTask();
businDataTask.setTaskCode(taskId);
businDataTask.setTaskType(taskType);
businDataTask.setContainerId(Long.valueOf(trayCode));
businDataTask.setFromSide(fromBinCode);
businDataTask.setToSide(toBinCode);
businDataTask.setCreateTime(DateUtils.getNowDate());
businDataTask.setPriority(priority);
boolean save = iBusinDataTaskService.save(businDataTask);
if(save){
//调用下游接口下任务
}
}else if(dataChange.equals("2")){
if (one == null){
return WcsResponseVo.error(500,"未查询到该托盘"+trayCode+"存在未完成的任务");
}
one.setTaskStatus("6");
iBusinDataTaskService.updateById(one);
//推送给下游
}
}
}
}
return WcsResponseVo.success();
}
}

@ -1,4 +1,4 @@
package com.shkj.wms.domain;
package com.shkj.wcs.domain;
import java.io.Serializable;
import java.util.Date;
@ -11,8 +11,6 @@ import com.shkj.common.annotation.Excel;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 任务管理对象 busin_task
@ -51,13 +49,6 @@ public class BusinDataTask implements Serializable {
@Excel(name = " 任务路径")
private String taskPath;
/** 批次信息 以天为单位 日期+流水? */
@Excel(name = "批次信息 以天为单位 日期+流水?")
private String batch;
/** 是否是紧急任务 */
@Excel(name = "是否是紧急任务")
private String isUrgent;
/** 是否是置顶 */
@Excel(name = "是否是置顶")

@ -1,8 +1,8 @@
package com.shkj.wms.mapper;
package com.shkj.wcs.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shkj.wms.bo.BusinTaskQueryBo;
import com.shkj.wms.domain.BusinDataTask;
import com.shkj.wcs.domain.BusinDataTask;
import com.shkj.wms.vo.BusinDataTaskVo;
import java.util.Date;

@ -212,10 +212,10 @@ public class PlcEventTask {
if (pointType.equals("99")) {
//log.info("地址:"+address+" 报警内容:"+devpName);
if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))) {
String message = MessageUtils.message(devpName);
log.info("报警内容转多语言:"+message);
//String message = MessageUtils.message(devpName);
//log.info("报警内容转多语言:"+message);
businPlcException.setPlcPoint(address);
businPlcException.setExecMsg(message);
businPlcException.setExecMsg(devpName);
businPlcException.setExecDate(DateUtils.getTime());
businPlcException.setExecDev(devType);
execList.add(businPlcException);

@ -0,0 +1,12 @@
package com.shkj.wcs.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.shkj.wcs.domain.BusinDataTask;
/**
* @author Comair
* @date 2025年04月18日 9:11
*/
public interface IBusinDataTaskService extends IService<BusinDataTask> {
}

@ -0,0 +1,10 @@
package com.shkj.wcs.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shkj.wcs.domain.BusinDataTask;
import com.shkj.wcs.mapper.BusinDataTaskMapper;
import com.shkj.wcs.service.IBusinDataTaskService;
import com.shkj.wms.service.IBusinTaskService;
public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper,BusinDataTask> implements IBusinDataTaskService {
}

@ -1,12 +1,9 @@
package com.shkj.wcs.third.rcs;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.shkj.common.constant.RedisConstant;
import com.shkj.common.core.domain.Result;
import com.shkj.common.utils.DateUtils;
import com.shkj.plc.sdk.device.PLCReadAndWrite;
import com.shkj.plc.sdk.device.PlcOperate;
import com.shkj.system.service.ISysParameterService;
@ -22,15 +19,7 @@ import com.shkj.wcs.third.rcs.dto.RcsCreateTaskDto;
import com.shkj.wcs.third.rcs.dto.RcsIdList;
import com.shkj.wcs.third.rcs.dto.RcsThirdResult;
import com.shkj.wms.bo.AGVMoveBo;
import com.shkj.wms.bo.BusinDataTaskDatailAddBo;
import com.shkj.wms.bo.BusinTaskAddBo;
import com.shkj.wms.bo.BusinTaskQueryBo;
import com.shkj.wms.constants.ParameterConstants;
import com.shkj.wms.domain.BusinDataTask;
import com.shkj.wms.domain.BusinDataTaskDetail;
import com.shkj.wms.mapper.BusinDataTaskMapper;
import com.shkj.wms.utils.JsonUtil;
import com.shkj.wms.vo.BusinDataTaskVo;
import com.shkj.wcs.mapper.BusinDataTaskMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -39,7 +28,6 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* AGV 接口文档

@ -0,0 +1,63 @@
package com.shkj.wcs.third.workbinWcs.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class WcsCreateTaskBody implements Serializable {
/**
* 任务号唯一编号
*/
@NotBlank(message = "任务id不得为空")
private String taskId;
/**
* 托盘码
*/
@NotBlank(message = "托盘码不得为空")
private String trayCode;
/**
* 任务类型
* 出库1
* 入库2
* 同层同巷道移库3
*/
@NotBlank(message = "任务类型不得为空")
private String taskType;
/**
* 任务起点线体站台立库终点
*/
@NotBlank(message = "任务起点不得为空")
private String fromBinCode;
/**
* 任务终点
*/
@NotBlank(message = "任务终点不得为空")
private String toBinCode;
/**
* 任务下发时间 包括毫秒
*/
private String createDt;
/**
* 新增1
*/
@NotBlank(message = "数据类型不得为空")
private String dataChange;
/**
* 优先级
*/
private String priority;
}

@ -0,0 +1,21 @@
package com.shkj.wcs.third.workbinWcs.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* 任务下发实体类
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class WcsCreateTaskDto implements Serializable {
private WcsCreateTaskHeader header;
private List<WcsCreateTaskBody> body;
}

@ -0,0 +1,14 @@
package com.shkj.wcs.third.workbinWcs.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class WcsCreateTaskHeader implements Serializable {
private String businessType = "commonTask";
}

@ -0,0 +1,24 @@
package com.shkj.wcs.third.workbinWcs.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 任务状态枚举
*
* @author zjx
* @date 2024/09/05
*/
@Getter
@AllArgsConstructor
public enum WcsCallbackTaskEnum {
wait("1", "等待"),
exec("2", "进行中"),
finish("3", "完成"),
fail("4", "失败"),
;
private String value;
private String desc;
}

@ -0,0 +1,15 @@
package com.shkj.wcs.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class QueryAreaStatusVo implements Serializable {
private static final long serialVersionUID = 1L;
//库区标识
private String areaInLocation;
//状态
private Integer status;
}

@ -0,0 +1,60 @@
package com.shkj.wcs.vo;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import java.util.Collections;
import java.util.List;
@Data
public class WcsResponseVo<T> {
private ResponseHeader header;
private List<T> body;
@Data
public static class ResponseHeader {
private Integer msgCode;
private String message;
}
// 成功
public static <T> WcsResponseVo<T> success(List<T> data) {
WcsResponseVo<T> response = new WcsResponseVo<>();
response.setHeader(createSuccessHeader());
response.setBody(data != null ? data : Collections.emptyList());
return response;
}
// 无数据的成功响应
public static <T> WcsResponseVo<T> success() {
return success(null);
}
// 单对象成功响应(非List场景)
public static <T> WcsResponseVo<T> success(T item) {
WcsResponseVo<T> response = new WcsResponseVo<>();
response.setHeader(createSuccessHeader());
response.setBody(item != null ?
Collections.singletonList(item) :
Collections.emptyList());
return response;
}
// 错误响应
public static <T> WcsResponseVo<T> error(int code, String msg) {
WcsResponseVo<T> response = new WcsResponseVo<>();
ResponseHeader header = new ResponseHeader();
header.setMsgCode(code);
header.setMessage(msg);
response.setHeader(header);
response.setBody(Collections.emptyList()); // 错误时body默认为空数组
return response;
}
private static ResponseHeader createSuccessHeader() {
ResponseHeader header = new ResponseHeader();
header.setMsgCode(200);
header.setMessage("调用成功");
return header;
}
}

@ -2,11 +2,9 @@ package com.shkj.wms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shkj.wms.bo.BusinPickupQueryBo;
import com.shkj.wms.domain.BusinDataTask;
import com.shkj.wms.domain.BusinPickup;
import com.shkj.wms.vo.BusinPickupVo;
import java.util.Date;
import java.util.List;
/**

@ -1,10 +1,7 @@
package com.shkj.wms.vo;
import com.shkj.wms.domain.BusinDataTask;
import lombok.Data;
import java.math.BigDecimal;
/**
* 任务视图对象

@ -2,14 +2,13 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shkj.wms.mapper.BusinDataTaskMapper">
<mapper namespace="com.shkj.wcs.mapper.BusinDataTaskMapper">
<resultMap type="com.shkj.wms.domain.BusinDataTask" id="BusinDataTaskInResult">
<resultMap type="com.shkj.wcs.domain.BusinDataTask" id="BusinDataTaskInResult">
<result property="taskCode" column="task_Code"/>
<result property="taskStatus" column="task_Status"/>
<result property="taskType" column="task_Type"/>
<result property="taskPath" column="task_Path"/>
<result property="isUrgent" column="is_Urgent"/>
<result property="isTop" column="is_Top"/>
<result property="priority" column="priority"/>
<result property="fromRow" column="fromR_ow"/>
@ -74,7 +73,6 @@
<if test="exceptionMsg != null">exception_msg,</if>
<if test="taskPath != null">task_path,</if>
<if test="batch != null">batch,</if>
<if test="isUrgent != null">is_urgent,</if>
<if test="isTop != null">is_top,</if>
<if test="priority != null">priority,</if>
<if test="fromRow != null">from_row,</if>
@ -110,7 +108,6 @@
<if test="exceptionMsg != null">#{exceptionMsg},</if>
<if test="taskPath != null">#{taskPath},</if>
<if test="batch != null">#{batch},</if>
<if test="isUrgent != null">#{isUrgent},</if>
<if test="isTop != null">#{isTop},</if>
<if test="priority != null">#{priority},</if>
<if test="fromRow != null">#{fromRow},</if>
Loading…
Cancel
Save