skyouc
1 天以前 1a65da0a6c765b07527082272c8d1afc5119a3fa
接口对接修改
11个文件已修改
4个文件已添加
410 ■■■■ 已修改文件
rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/WmsRcsController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/constant/WmsConstant.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/ExMsgCallbackParams.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsRcsService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/resources/application-dev.yml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/WcsController.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/entity/params/TaskItemParam.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/entity/params/WcsTaskParams.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/WcsService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/DeviceSiteController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/RcsTaskType.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/resources/application-dev.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/WmsRcsController.java
@@ -2,6 +2,7 @@
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.openApi.entity.params.ExMsgCallbackParams;
import com.vincent.rsf.openApi.entity.params.RcsPubTaskParams;
import com.vincent.rsf.openApi.entity.params.SyncRcsLocsParam;
import com.vincent.rsf.openApi.service.WmsRcsService;
@@ -59,7 +60,7 @@
     */
    @ApiOperation("异常任务回调")
    @PostMapping("/callback/event")
    public R callBackEvent(@RequestBody Map<String, Object> params) {
    public R callBackEvent(@RequestBody ExMsgCallbackParams params) {
        return wmsRcsService.callBackEvent(params);
    }
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/constant/WmsConstant.java
New file
@@ -0,0 +1,10 @@
package com.vincent.rsf.openApi.entity.constant;
/**
 * WMS调用接口常量地址
 */
public class WmsConstant {
    public static String callBack = "/rsf-server/wcs/receive/ex/msg";
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/ExMsgCallbackParams.java
New file
@@ -0,0 +1,27 @@
package com.vincent.rsf.openApi.entity.params;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@Accessors(chain = true)
@ApiModel(value = "ExMsgCallbackParams", description = "异常消息上报参数")
public class ExMsgCallbackParams implements Serializable {
    @ApiModelProperty("任务号")
    private String seqNum;
    @ApiModelProperty("回调事件")
    private String eventType;
    @ApiModelProperty("机器人编码")
    private String robotCode;
    @ApiModelProperty("容器码")
    private String zpallet;
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsRcsService.java
@@ -5,6 +5,7 @@
import com.vincent.rsf.openApi.entity.Loc;
import com.vincent.rsf.openApi.entity.LocItem;
import com.vincent.rsf.openApi.entity.dto.SyncLocsDto;
import com.vincent.rsf.openApi.entity.params.ExMsgCallbackParams;
import com.vincent.rsf.openApi.entity.params.RcsPubTaskParams;
import com.vincent.rsf.openApi.entity.params.SyncRcsLocsParam;
@@ -17,7 +18,7 @@
    R cancelTasks(Map<String, Object> params);
    R callBackEvent(Map<String, Object> params);
    R callBackEvent(ExMsgCallbackParams params);
    List<SyncLocsDto> syncLocs(SyncRcsLocsParam params);
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java
@@ -11,9 +11,11 @@
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.openApi.config.PlatformProperties;
import com.vincent.rsf.openApi.entity.Loc;
import com.vincent.rsf.openApi.entity.constant.WmsConstant;
import com.vincent.rsf.openApi.entity.dto.CommonResponse;
import com.vincent.rsf.openApi.entity.constant.RcsConstant;
import com.vincent.rsf.openApi.entity.dto.SyncLocsDto;
import com.vincent.rsf.openApi.entity.params.ExMsgCallbackParams;
import com.vincent.rsf.openApi.entity.params.RcsPubTaskParams;
import com.vincent.rsf.openApi.entity.params.SyncRcsLocsParam;
import com.vincent.rsf.openApi.mapper.LocMapper;
@@ -102,10 +104,33 @@
     * @version 1.0
     */
    @Override
    public R callBackEvent(Map<String, Object> params) {
        String rcsUrl =  wmsApi.getHost() + ":" + wmsApi.getPort() + RcsConstant.pubTask;
    public R callBackEvent(ExMsgCallbackParams params) {
        String callUrl =  wmsApi.getHost() + ":" + wmsApi.getPort() + WmsConstant.callBack;
        /**WMS基础配置链接*/
        log.info("任务执行状态上报,请求地址: {}, 请求参数: {}", callUrl , JSONObject.toJSONString(params));
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        headers.add("api-version", "v2.0");
        HttpEntity httpEntity = new HttpEntity(params, headers);
        ResponseEntity<String> exchange = restTemplate.exchange(callUrl, HttpMethod.POST, httpEntity, String.class);
        log.info("任务执行状态上报,响应结果: {}", exchange);
        if (Objects.isNull(exchange.getBody())) {
            throw new CoolException("任务执行状态上报失败!!");
        } else {
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.coercionConfigDefaults()
                    .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty);
            try {
                CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
                if (result.getCode() == 200) {
        return R.ok();
                } else {
                    throw new CoolException("任务执行状态上报失败!!");
                }
            } catch (JsonProcessingException e) {
                throw new CoolException(e.getMessage());
            }
        }
    }
    /**
rsf-open-api/src/main/resources/application-dev.yml
@@ -14,8 +14,8 @@
#    url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
#    username: rsf
    username: root
    url: jdbc:mysql://127.0.0.1:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    password: 34821015
    url: jdbc:mysql://10.10.10.200:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    password: xltys1995
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      initial-size: 5
@@ -56,7 +56,7 @@
  #RCS链接
  rcs:
    #链接
    host: http://192.168.4.84
    host: http://10.10.10.247
    #端口
    port: 8088
  wms:
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/WcsController.java
@@ -4,6 +4,8 @@
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.server.api.entity.dto.InTaskMsgDto;
import com.vincent.rsf.server.api.controller.erp.params.TaskInParam;
import com.vincent.rsf.server.api.entity.params.ExMsgParams;
import com.vincent.rsf.server.api.entity.params.WcsTaskParams;
import com.vincent.rsf.server.common.annotation.OperationLog;
import com.vincent.rsf.server.manager.enums.TaskType;
import com.vincent.rsf.server.api.service.WcsService;
@@ -90,7 +92,20 @@
    @OperationLog("RCS库位信息同步")
    @PostMapping("/sync/locs")
    public R syncLocsToWms() {
        return wcsService.syncLocsToWms();
         wcsService.syncLocsToWms();
         return R.ok();
    }
    /**
     * 下发任务至WCS,API中转
     * @param
     * @return
     */
    @ApiOperation("下发任务至WCS")
    @OperationLog("下发任务至WCS")
    @PostMapping("/pub/task/wcs")
    public R pubTaskToWcs(@RequestBody WcsTaskParams params) {
        return wcsService.pubWcsTask(params);
    }
    /**
@@ -102,8 +117,8 @@
    @ApiOperation("RCS上报异常执行信息")
    @OperationLog("RCS上报异常执行信息")
    @PostMapping("/receive/ex/msg")
    public R receiveExMsg() {
        return wcsService.receiveExMsg();
    public R receiveExMsg(@RequestBody ExMsgParams params) {
        return wcsService.receiveExMsg(params);
    }
rsf-server/src/main/java/com/vincent/rsf/server/api/entity/params/TaskItemParam.java
New file
@@ -0,0 +1,36 @@
package com.vincent.rsf.server.api.entity.params;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@ApiModel(value = "TaskItem", description = "任务列表")
public class TaskItemParam {
    @ApiModelProperty("任务类型{LOC_TO_LOC: 移库, LOC_TO_STA: 出库, STA_TO_LOC: 入库, STA_TO_STA: 站点间搬运}")
    private String taskType;
    @ApiModelProperty("任务号")
    private String seqNum;
    @ApiModelProperty("起始库位")
    private String oriLoc;
    @ApiModelProperty("起始站点")
    private String oriSta;
    @ApiModelProperty("目标库位")
    private String destLoc;
    @ApiModelProperty("目标站点")
    private String destSta;
    @ApiModelProperty("托盘码")
    private String zpallet;
    @ApiModelProperty("优先级")
    private Integer priority;
}
rsf-server/src/main/java/com/vincent/rsf/server/api/entity/params/WcsTaskParams.java
@@ -20,34 +20,3 @@
    @ApiModelProperty("任务明细")
    private List<TaskItemParam> taskList;
}
@Data
@Accessors(chain = true)
@ApiModel(value = "TaskItem", description = "任务列表")
class TaskItemParam {
    @ApiModelProperty("任务类型{LOC_TO_LOC: 移库, LOC_TO_STA: 出库, STA_TO_LOC: 入库, STA_TO_STA: 站点间搬运}")
    private String taskType;
    @ApiModelProperty("任务号")
    private String seqNum;
    @ApiModelProperty("起始库位")
    private String oriLoc;
    @ApiModelProperty("起始站点")
    private String oriSta;
    @ApiModelProperty("目标库位")
    private String destLoc;
    @ApiModelProperty("目标站点")
    private String destSta;
    @ApiModelProperty("托盘码")
    private String zpallet;
    @ApiModelProperty("优先级")
    private Integer priority;
}
rsf-server/src/main/java/com/vincent/rsf/server/api/service/WcsService.java
@@ -3,6 +3,7 @@
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.server.api.entity.dto.InTaskMsgDto;
import com.vincent.rsf.server.api.controller.erp.params.TaskInParam;
import com.vincent.rsf.server.api.entity.params.ExMsgParams;
import com.vincent.rsf.server.api.entity.params.WcsTaskParams;
public interface WcsService {
@@ -12,5 +13,9 @@
    InTaskMsgDto getLocNo(TaskInParam param) throws Exception;
    R syncLocsToWms();
    void syncLocsToWms();
    R receiveExMsg(ExMsgParams params);
    R pubWcsTask(WcsTaskParams params);
}
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
@@ -19,6 +19,7 @@
import com.vincent.rsf.server.api.controller.erp.params.TaskInParam;
import com.vincent.rsf.server.api.entity.dto.SyncLocsDto;
import com.vincent.rsf.server.api.entity.params.CommonRequest;
import com.vincent.rsf.server.api.entity.params.ExMsgParams;
import com.vincent.rsf.server.api.entity.params.WcsTaskParams;
import com.vincent.rsf.server.manager.enums.*;
import com.vincent.rsf.server.api.service.WcsService;
@@ -407,7 +408,7 @@
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R syncLocsToWms() {
    public void syncLocsToWms() {
        /**RCS基础配置链接*/
        CommonRequest params = new CommonRequest();
        params.setPageSize(100);
@@ -443,11 +444,30 @@
            }
        }, 1, 1, TimeUnit.SECONDS);
        return R.ok();
    }
    private List<SyncLocsDto> syncLocs(CommonRequest params) {
        String rcsUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.syncLocs;
    /**
     * 异常信息上报
     * @return
     */
    @Override
    public R receiveExMsg(ExMsgParams params) {
        if (Objects.isNull(params)) {
            return R.error("参数不能为空!!");
        }
        log.info(JSONObject.toJSONString(params));
        return R.ok(JSONObject.toJSONString(params));
    }
    /**
     * 下发任务至中转API
     * @param params
     * @return
     */
    @Override
    public R pubWcsTask(WcsTaskParams params) {
        String rcsUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.pubTask;
        log.info("任务下发,请求地址: {}, 请求参数: {}", rcsUrl, JSONObject.toJSONString(params));
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
@@ -464,8 +484,7 @@
            try {
                CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
                if (result.getCode() == 200) {
                    JSONObject jsonObject = JSONObject.parseObject(exchange.getBody()).getJSONObject("data");
                    return JSONArray.parseArray(jsonObject.getJSONArray("records").toJSONString(), SyncLocsDto.class);
                    return R.ok();
                } else {
                    throw new CoolException("任务下发失败!!");
                }
@@ -475,6 +494,36 @@
        }
    }
    private List<SyncLocsDto> syncLocs(CommonRequest params) {
        String rcsUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.syncLocs;
        log.info("库位同步,请求地址: {}, 请求参数: {}", rcsUrl, JSONObject.toJSONString(params));
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        headers.add("api-version", "v2.0");
        HttpEntity httpEntity = new HttpEntity(params, headers);
        ResponseEntity<String> exchange = restTemplate.exchange(rcsUrl, HttpMethod.POST, httpEntity, String.class);
        log.info("库位同步,响应结果: {}", exchange);
        if (Objects.isNull(exchange.getBody())) {
            throw new CoolException("库位同步下发失败!!");
        } else {
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.coercionConfigDefaults()
                    .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty);
            try {
                CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
                if (result.getCode() == 200) {
                    JSONObject jsonObject = JSONObject.parseObject(exchange.getBody());
                    return JSONArray.parseArray(jsonObject.getJSONArray("data").toJSONString(), SyncLocsDto.class);
                } else {
                    throw new CoolException("库位同步失败!!");
                }
            } catch (JsonProcessingException e) {
                throw new CoolException(e.getMessage());
            }
        }
    }
    private InTaskMsgDto getLocNoCrn(String orgLoc, DeviceBind deviceBind, Long area, Integer sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) {
        if (Cools.isEmpty(matnr)) {  //物料号
            matnr = "";
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/DeviceSiteController.java
@@ -42,7 +42,7 @@
    @PreAuthorize("hasAuthority('manager:deviceSite:list')")
    @PostMapping("/selectStaList/list")
    @PostMapping("/x`selectStaList/list")
    public R selectStaList(@RequestBody Map<String, Object> map) {
        List<String> longs = null;
        if (map.get("type") != null) {
rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/RcsTaskType.java
New file
@@ -0,0 +1,43 @@
package com.vincent.rsf.server.manager.enums;
import com.vincent.rsf.server.manager.entity.Task;
public enum RcsTaskType {
    //任务类型
    RCS_TASK_TYPE_ENUM_TRANSFER("LOC_TO_LOC", "移库"),
    RCS_TASK_TYPE_ENUM_OUT("LOC_TO_STA", "出库"),
    RCS_TASK_TYPE_ENUM_IN("LOC_TO_LOC", "入库"),
    RCS_TASK_TYPE_ENUM_STA("STA_TO_STA", "站点间搬运"),
    ;
    RcsTaskType(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }
    public String type;
    public String desc;
    /**
     * 获取任务类型
     * @param type
     * @return
     */
    public static String getTypeDesc(Integer type) {
        if (type.equals(TaskType.TASK_TYPE_IN.type)
            || type.equals(TaskType.TASK_TYPE_PICK_IN.type)
                || type.equals(TaskType.TASK_TYPE_CHECK_IN.type)
                || type.equals(TaskType.TASK_TYPE_MERGE_IN.type)) {
            return RcsTaskType.RCS_TASK_TYPE_ENUM_IN.type;
        } else if (type.equals(TaskType.TASK_TYPE_OUT.type)
                || type.equals(TaskType.TASK_TYPE_CHECK_OUT.type)
                || type.equals(TaskType.TASK_TYPE_MERGE_OUT.type)
                || type.equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) {
            return RCS_TASK_TYPE_ENUM_OUT.type;
        } else if (type.equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
            return RcsTaskType.RCS_TASK_TYPE_ENUM_TRANSFER.type;
        } else {
            return RcsTaskType.RCS_TASK_TYPE_ENUM_STA.type;
        }
    }
}
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -1,8 +1,20 @@
package com.vincent.rsf.server.manager.schedules;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.cfg.CoercionAction;
import com.fasterxml.jackson.databind.cfg.CoercionInputShape;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.api.service.WcsService;
import com.vincent.rsf.server.api.config.RemotesInfoProperties;
import com.vincent.rsf.server.api.entity.CommonResponse;
import com.vincent.rsf.server.api.entity.constant.RcsConstant;
import com.vincent.rsf.server.api.entity.params.TaskItemParam;
import com.vincent.rsf.server.api.entity.params.WcsTaskParams;
import com.vincent.rsf.server.api.utils.LocUtils;
import com.vincent.rsf.server.common.constant.Constants;
import com.vincent.rsf.server.manager.controller.params.LocToTaskParams;
@@ -10,23 +22,27 @@
import com.vincent.rsf.server.manager.entity.*;
import com.vincent.rsf.server.manager.service.*;
import com.vincent.rsf.server.manager.service.impl.LocServiceImpl;
import com.vincent.rsf.server.manager.service.impl.TransferOrderServiceImpl;
import com.vincent.rsf.server.manager.utils.LocManageUtil;
import com.vincent.rsf.server.system.constant.GlobalConfigCode;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.entity.Config;
import com.vincent.rsf.server.system.service.ConfigService;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import com.vincent.rsf.server.system.utils.SystemAuthUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import java.util.*;
import java.util.stream.Collectors;
@@ -35,6 +51,7 @@
 * @Author Ryan
 * 任务工作档
 */
@Slf4j
@Component
public class TaskSchedules {
@@ -68,6 +85,12 @@
    private TransferOrderService transferOrderService;
    @Autowired
    private TransferService transferService;
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private RemotesInfoProperties.RcsApi rcsApi;
    /**
     * @param
@@ -220,7 +243,9 @@
    @Transactional(rollbackFor = Exception.class)
    public void taskToWCS() throws Exception {
        Long loginUserId = SystemAuthUtils.getLoginUserId();
        List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type);
        List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_LOC_MOVE.type, TaskType.TASK_TYPE_EMPITY_IN.type
        ,TaskType.TASK_TYPE_CHECK_IN.type, TaskType.TASK_TYPE_MERGE_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type,
                TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type);
        List<Integer> integers = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>()
                .in(Task::getTaskType, list)
@@ -253,6 +278,7 @@
                }
            }
            //TODO 调用下发任务接口
            pubTaskToWcs(task);
        }
    }
@@ -280,6 +306,97 @@
    /**
     * 下发任务至WCS
     * @param task
     */
    @Transactional(rollbackFor = Exception.class)
    public void pubTaskToWcs(Task task) throws Exception{
        WcsTaskParams taskParams = new WcsTaskParams();
        TaskItemParam itemParam = new TaskItemParam();
        //任务类型,任务编码
        itemParam.setTaskType(RcsTaskType.getTypeDesc(task.getTaskType()))
                .setSeqNum(task.getTaskCode());
        //主参数
        taskParams.setBatch(task.getBarcode());
        if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)
                || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type )
                || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)
                || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type)
                || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
            itemParam.setDestLoc(task.getTargLoc())
                    .setOriSta(task.getOrgSite());
        } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
                || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)
                || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)
                || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
                || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)
        ) {
            itemParam.setOriLoc(task.getOrgLoc())
                    .setDestSta(task.getTargSite());
        } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
            itemParam.setOriLoc(task.getOrgLoc()).setDestLoc(task.getTargLoc());
        } else {
            itemParam.setOriSta(task.getOrgSite()).setDestSta(task.getTargSite());
        }
        List<TaskItemParam> items = Arrays.asList(itemParam);
        taskParams.setTaskList(items);
        /**任务下发接口*/
        String pubTakUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.pubTask;
        /**RCS基础配置链接*/
        log.info("任务下发,请求地址: {}, 请求参数: {}", pubTakUrl , JSONObject.toJSONString(taskParams));
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        headers.add("api-version", "v2.0");
        HttpEntity httpEntity = new HttpEntity(taskParams, headers);
        ResponseEntity<String> exchange = restTemplate.exchange(pubTakUrl, HttpMethod.POST, httpEntity, String.class);
        log.info("任务下发后,响应结果: {}", exchange);
        if (Objects.isNull(exchange.getBody())) {
            throw new CoolException("任务下发失败!!");
        } else {
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.coercionConfigDefaults()
                    .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty);
            try {
                CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
                if (result.getCode() == 200) {
                    if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)
                            || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)
                            || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)
                            || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)
                            || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type)
                            || task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
                        if (!taskService.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode())
                                .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_IN.id))) {
                            throw new CoolException("任务状态修改失败!!");
                        }
                    } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) {
                        if (!taskService.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode())
                                .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_OUT.id))) {
                            throw new CoolException("任务状态修改失败!!");
                        }
                    }
                } else {
                    throw new CoolException("任务下发失败!!");
                }
            } catch (JsonProcessingException e) {
                throw new CoolException(e.getMessage());
            }
        }
    }
    /**
     * @param
     * @return
     * @author Ryan
rsf-server/src/main/resources/application-dev.yml
@@ -14,8 +14,8 @@
#    url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
#    username: rsf
    username: root
    url: jdbc:mysql://127.0.0.1:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    password: 34821015
    url: jdbc:mysql://10.10.10.200:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    password: xltys1995
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      initial-size: 5