Commit 7bcdd2232fa109b8a16b4c70d2de16126d82281d

Authored by pengcheng
1 parent 90a67c23

wcs接口和address模块

Showing 28 changed files with 1114 additions and 1 deletions
src/main/java/com/huaheng/api/wcs/controller/EmptyOutHandle.java 0 → 100644
  1 +package com.huaheng.api.wcs.controller;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService;
  5 +import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService;
  6 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  7 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  8 +import com.huaheng.framework.web.controller.BaseController;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import io.swagger.annotations.Api;
  11 +import io.swagger.annotations.ApiOperation;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import javax.annotation.Resource;
  15 +
  16 +/**空出处理接口
  17 + * wcs向wms传递数据
  18 + * @author ricard
  19 + * @date 2019/10/11
  20 + *
  21 + */
  22 +
  23 +@RestController
  24 +@RequestMapping("/WCS/v1")
  25 +@Api(tags = {"OverrideHandle"}, description = "wcs空出处理接口")
  26 +public class EmptyOutHandle extends BaseController {
  27 +
  28 + @Resource
  29 + private EmptyOutHandleService emptyOutHandleService;
  30 +
  31 + @Log(title = "wcs空出处理", action = BusinessType.INSERT)
  32 + @PostMapping("/EmptyOutHandle")
  33 + @ApiOperation("wcs空出处理")
  34 + @ResponseBody
  35 + public AjaxResult EmptyOutHandle(@RequestBody WcsTask wcsTask)
  36 + {
  37 + AjaxResult ajaxResult =emptyOutHandleService.EmptyOutHandle(wcsTask) ;
  38 + return ajaxResult;
  39 + }
  40 +
  41 +
  42 +}
... ...
src/main/java/com/huaheng/api/wcs/controller/OverrideHandle.java 0 → 100644
  1 +package com.huaheng.api.wcs.controller;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService;
  5 +import com.huaheng.api.wcs.service.taskFinish.TaskFinishService;
  6 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  7 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  8 +import com.huaheng.framework.web.controller.BaseController;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import io.swagger.annotations.Api;
  11 +import io.swagger.annotations.ApiOperation;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import javax.annotation.Resource;
  15 +
  16 +/**重入处理接口
  17 + * wcs向wms传递数据
  18 + * @author ricard
  19 + * @date 2019/10/11
  20 + *
  21 + */
  22 +
  23 +@RestController
  24 +@RequestMapping("/WCS/v1")
  25 +@Api(tags = {"OverrideHandle"}, description = "wcs重入处理接口")
  26 +public class OverrideHandle extends BaseController {
  27 +
  28 + @Resource
  29 + private OverrideHandleService overrideHandleService;
  30 +
  31 + @Log(title = "wcs重入处理", action = BusinessType.INSERT)
  32 + @PostMapping("/OverrideHandle")
  33 + @ApiOperation("wcs重入处理")
  34 + @ResponseBody
  35 + public AjaxResult OverrideHandle(@RequestBody WcsTask wcsTask)
  36 + {
  37 + AjaxResult ajaxResult =overrideHandleService.OverrideHandle(wcsTask) ;
  38 + return ajaxResult;
  39 + }
  40 +
  41 +
  42 +}
... ...
src/main/java/com/huaheng/api/wcs/controller/TaskFinish.java 0 → 100644
  1 +package com.huaheng.api.wcs.controller;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.api.wcs.service.taskFinish.TaskFinishService;
  5 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  6 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  7 +import com.huaheng.framework.web.controller.BaseController;
  8 +import com.huaheng.framework.web.domain.AjaxResult;
  9 +import io.swagger.annotations.Api;
  10 +import io.swagger.annotations.ApiOperation;
  11 +import org.springframework.web.bind.annotation.*;
  12 +
  13 +import javax.annotation.Resource;
  14 +
  15 +/**任务完成
  16 + * wcs向wms传递数据
  17 + * @author ricard
  18 + * @date 2019/10/11
  19 + *
  20 + */
  21 +
  22 +@RestController
  23 +@RequestMapping("/WCS/v1")
  24 +@Api(tags = {"TaskFinish"}, description = "wcs任务完成数据接口")
  25 +public class TaskFinish extends BaseController {
  26 +
  27 + @Resource
  28 + private TaskFinishService taskFinishService;
  29 +
  30 + @Log(title = "wcs任务完成", action = BusinessType.INSERT)
  31 + @PostMapping("/TaskFinish")
  32 + @ApiOperation("wcs任务完成")
  33 + @ResponseBody
  34 + public AjaxResult TaskFinish(@RequestBody WcsTask wcsTask)
  35 + {
  36 + AjaxResult ajaxResult =taskFinishService.completeTaskByWCS(wcsTask) ;
  37 + return ajaxResult;
  38 + }
  39 +
  40 +
  41 +}
... ...
src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java 0 → 100644
  1 +package com.huaheng.api.wcs.controller;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService;
  5 +import com.huaheng.api.wcs.service.warecellAllocation.WarecellAllocationService;
  6 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  7 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  8 +import com.huaheng.framework.web.controller.BaseController;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import io.swagger.annotations.Api;
  11 +import io.swagger.annotations.ApiOperation;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import javax.annotation.Resource;
  15 +
  16 +/**仓位分配 接口
  17 + * wcs向wms传递数据
  18 + * @author ricard
  19 + * @date 2019/10/11
  20 + *
  21 + */
  22 +
  23 +@RestController
  24 +@RequestMapping("/WCS/v1")
  25 +@Api(tags = {"WarecellAllocation"}, description = "wcs仓位分配接口")
  26 +public class WarecellAllocation extends BaseController {
  27 +
  28 + @Resource
  29 + private WarecellAllocationService warecellAllocationService;
  30 +
  31 + @Log(title = "wcs仓位分配", action = BusinessType.INSERT)
  32 + @PostMapping("/WarecellAllocation")
  33 + @ApiOperation("wcs仓位分配")
  34 + @ResponseBody
  35 + public AjaxResult WarecellAllocation(@RequestBody WcsTask wcsTask)
  36 + {
  37 + AjaxResult ajaxResult =warecellAllocationService.WarecellAllocation(wcsTask) ;
  38 + return ajaxResult;
  39 + }
  40 +
  41 +
  42 +}
... ...
src/main/java/com/huaheng/api/wcs/domain/WcsTask.java 0 → 100644
  1 +package com.huaheng.api.wcs.domain;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * wcs任务接口实体层
  7 + * @author ricard
  8 + * @date 2019/10/11
  9 + */
  10 +public class WcsTask implements Serializable {
  11 + private static final long serialVersionUID = -8855840499538794854L;
  12 +
  13 + //任务号
  14 + private String taskNo;
  15 +
  16 + //任务类型
  17 + private String taskType;
  18 +
  19 + //出库站台编码.默认‘0’
  20 + private String station;
  21 +
  22 + //平台
  23 + private String platform;
  24 +
  25 + //容器编码
  26 + private String palletNo;
  27 +
  28 + //源位置库位编码
  29 + private String fromLocationCode;
  30 +
  31 + //目的位置库位编码
  32 + private String toLocationCode;
  33 +
  34 + //重入后再次分配的位置编码
  35 + private String locationCode;
  36 +
  37 + //取消任务
  38 + private String reason;
  39 +
  40 + //长
  41 + private Float length;
  42 +
  43 + //宽
  44 + private Float width;
  45 +
  46 + //高
  47 + private Float height;
  48 +
  49 + //重
  50 + private Float weight;
  51 +
  52 + public String getTaskNo() {
  53 + return taskNo;
  54 + }
  55 +
  56 + public void setTaskNo(String taskNo) {
  57 + this.taskNo = taskNo;
  58 + }
  59 +
  60 + public String getTaskType() {
  61 + return taskType;
  62 + }
  63 +
  64 + public void setTaskType(String taskType) {
  65 + this.taskType = taskType;
  66 + }
  67 +
  68 + public String getStation() {
  69 + return station;
  70 + }
  71 +
  72 + public void setStation(String station) {
  73 + this.station = station;
  74 + }
  75 +
  76 + public String getPlatform() {
  77 + return platform;
  78 + }
  79 +
  80 + public void setPlatform(String platform) {
  81 + this.platform = platform;
  82 + }
  83 +
  84 + public String getPalletNo() {
  85 + return palletNo;
  86 + }
  87 +
  88 + public void setPalletNo(String palletNo) {
  89 + this.palletNo = palletNo;
  90 + }
  91 +
  92 + public String getFromLocationCode() {
  93 + return fromLocationCode;
  94 + }
  95 +
  96 + public void setFromLocationCode(String fromLocationCode) {
  97 + this.fromLocationCode = fromLocationCode;
  98 + }
  99 +
  100 + public String getToLocationCode() {
  101 + return toLocationCode;
  102 + }
  103 +
  104 + public void setToLocationCode(String toLocationCode) {
  105 + this.toLocationCode = toLocationCode;
  106 + }
  107 +
  108 + public String getReason() {
  109 + return reason;
  110 + }
  111 +
  112 + public void setReason(String reason) {
  113 + this.reason = reason;
  114 + }
  115 +
  116 + public float getLength() {
  117 + return length;
  118 + }
  119 +
  120 + public void setLength(float length) {
  121 + this.length = length;
  122 + }
  123 +
  124 + public float getWidth() {
  125 + return width;
  126 + }
  127 +
  128 + public void setWidth(float width) {
  129 + this.width = width;
  130 + }
  131 +
  132 + public float getHeight() {
  133 + return height;
  134 + }
  135 +
  136 + public void setHeight(float height) {
  137 + this.height = height;
  138 + }
  139 +
  140 + public float getWeight() {
  141 + return weight;
  142 + }
  143 +
  144 + public void setWeight(float weight) {
  145 + this.weight = weight;
  146 + }
  147 +
  148 + public String getLocationCode() {
  149 + return locationCode;
  150 + }
  151 +
  152 + public void setLocationCode(String locationCode) {
  153 + this.locationCode = locationCode;
  154 + }
  155 +
  156 + public void setLength(Float length) {
  157 + this.length = length;
  158 + }
  159 +
  160 + public void setWidth(Float width) {
  161 + this.width = width;
  162 + }
  163 +
  164 + public void setHeight(Float height) {
  165 + this.height = height;
  166 + }
  167 +
  168 + public void setWeight(Float weight) {
  169 + this.weight = weight;
  170 + }
  171 +}
... ...
src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.emptyOutHandle;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.framework.web.domain.AjaxResult;
  5 +
  6 +public interface EmptyOutHandleService {
  7 + //空出处理
  8 + AjaxResult EmptyOutHandle(WcsTask wcsTask);
  9 +}
... ...
src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.emptyOutHandle;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.common.utils.StringUtils;
  5 +import com.huaheng.framework.web.domain.AjaxResult;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +@Service
  9 +public class EmptyOutHandleServiceImpl implements EmptyOutHandleService {
  10 +
  11 + /**
  12 + * 空出处理
  13 + * 1、判断非空字段
  14 + * 2、
  15 + * @param wcsTask
  16 + * @return
  17 + */
  18 + @Override
  19 + public AjaxResult EmptyOutHandle(WcsTask wcsTask) {
  20 +
  21 + //1、判断非空字段
  22 + if(StringUtils.isEmpty(wcsTask.getTaskNo())){
  23 + return AjaxResult.error("任务号为空");
  24 + }
  25 +
  26 +
  27 + return null;
  28 + }
  29 +}
... ...
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.overrideHandle;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.framework.web.domain.AjaxResult;
  5 +
  6 +public interface OverrideHandleService {
  7 +
  8 + //重入处理
  9 + AjaxResult OverrideHandle(WcsTask wcsTask);
  10 +}
... ...
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.overrideHandle;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.common.exception.service.ServiceException;
  5 +import com.huaheng.common.utils.StringUtils;
  6 +import com.huaheng.framework.web.domain.AjaxResult;
  7 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +@Service
  11 +public class OverrideHandleServiceImpl implements OverrideHandleService {
  12 +
  13 + /**
  14 + * 重入处理
  15 + * 1、判断非空字段
  16 + * 2、实体转换
  17 + *
  18 + */
  19 +
  20 + @Override
  21 + public AjaxResult OverrideHandle(WcsTask wcsTask) {
  22 + //1、判断非空字段
  23 + if(StringUtils.isEmpty(wcsTask.getTaskNo())){
  24 + return AjaxResult.error("任务号为空");
  25 + }
  26 + if(StringUtils.isEmpty(wcsTask.getToLocationCode())){
  27 + return AjaxResult.error("目的库位为空");
  28 + }
  29 +
  30 + TaskHeader taskHeader =new TaskHeader();
  31 + taskHeader.setId(Integer.valueOf(wcsTask.getTaskNo()));
  32 + taskHeader.setToLocation(wcsTask.getToLocationCode());
  33 + return null;
  34 + }
  35 +}
... ...
src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.stationInfo;
  2 +
  3 +import com.huaheng.framework.web.domain.AjaxResult;
  4 +
  5 +public interface StationInfoService {
  6 +
  7 + //站台信息查询
  8 + AjaxResult StationInfo(String station);
  9 +
  10 +}
... ...
src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.stationInfo;
  2 +
  3 +
  4 +import com.alibaba.fastjson.JSON;
  5 +import com.huaheng.api.wcs.domain.WcsTask;
  6 +import com.huaheng.common.exception.service.ServiceException;
  7 +import com.huaheng.common.utils.StringUtils;
  8 +import com.huaheng.common.utils.http.HttpUtils;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import com.huaheng.pc.config.address.service.AddressService;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +@Service
  15 +public class StationInfoServiceImpl implements StationInfoService {
  16 +
  17 + @Autowired
  18 + private AddressService addressService;
  19 +
  20 + /**
  21 + * 站台信息查询
  22 + * 1、判断非空字段
  23 + * 2、实体转换
  24 + * 3、发送数据
  25 + * @param station
  26 + * @return
  27 + */
  28 + @Override
  29 + public AjaxResult StationInfo(String station) {
  30 +
  31 + //1、判断非空字段
  32 + if(StringUtils.isEmpty(station)){
  33 + return AjaxResult.error("站台为空");
  34 + }
  35 +
  36 + //2、实体转换
  37 + WcsTask wcsTask =new WcsTask();
  38 + wcsTask.setStation(station);
  39 +
  40 + //3、发送数据
  41 + String param="wcs";
  42 + String url=addressService.selectAddress(param)+"StationInfo";
  43 + String JsonParam = JSON.toJSONString(wcsTask);
  44 + String result = HttpUtils.bodypost(url, JsonParam);
  45 + if(StringUtils.isEmpty(result)){
  46 + throw new ServiceException("接口地址错误");
  47 + }
  48 + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
  49 + return ajaxResult;
  50 +
  51 + }
  52 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskAssignService;
  2 +
  3 +import com.huaheng.framework.web.domain.AjaxResult;
  4 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  5 +
  6 +/**
  7 + * 任务下发接口Service层
  8 + * @author ricard
  9 + * @date 2019/10/11
  10 + *
  11 + */
  12 +public interface TaskAssignService {
  13 +
  14 + //wms下发任务给wcs
  15 + AjaxResult wcsTaskAssign(TaskHeader taskHeader);
  16 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskAssignService;
  2 +
  3 +
  4 +import com.alibaba.fastjson.JSON;
  5 +import com.huaheng.api.wcs.domain.WcsTask;
  6 +import com.huaheng.common.exception.service.ServiceException;
  7 +import com.huaheng.common.utils.StringUtils;
  8 +import com.huaheng.common.utils.http.HttpUtils;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import com.huaheng.pc.config.address.service.AddressService;
  11 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Service;
  14 +import org.springframework.transaction.annotation.Transactional;
  15 +
  16 +/**
  17 + * 任务下发接口ServiceImpl层
  18 + * @author ricard
  19 + * @date 2019/10/11
  20 + *
  21 + */
  22 +
  23 +@Service
  24 +public class TaskAssignServiceImpl implements TaskAssignService {
  25 +
  26 + @Autowired
  27 + private AddressService addressService;
  28 +
  29 +
  30 + public static String platform = "wms";
  31 +
  32 + //wms下发任务给wcs
  33 + /**
  34 + * 1、判断taskHeader是否为空
  35 + * 2、判断必填字段是否满足
  36 + * 3、转换实体
  37 + * 4、发送数据
  38 + *
  39 + * @param taskHeader
  40 + * @return
  41 + */
  42 + @Override
  43 + @Transactional
  44 + public AjaxResult wcsTaskAssign(TaskHeader taskHeader) {
  45 + //1、判断taskHeader是否为空
  46 + if(taskHeader == null){
  47 + throw new ServiceException("wms任务为空");
  48 + }
  49 +
  50 + //2、判断必填字段是否满足
  51 + if(taskHeader.getId() == null){
  52 + throw new ServiceException("wms任务号Id为空");
  53 + }
  54 + if(taskHeader.getTaskType() == null){
  55 + throw new ServiceException("wms任务类型为空");
  56 + }
  57 + if(StringUtils.isEmpty(taskHeader.getContainerCode())){
  58 + throw new ServiceException("wms任务中容器为空");
  59 + }
  60 +// if(StringUtils.isEmpty(taskHeader.getStation())){
  61 +// throw new ServiceException("wms站台为空");
  62 +// }
  63 +
  64 + //入库性质的任务源库位不能为空
  65 + if(taskHeader.getTaskType()==100 || taskHeader.getTaskType()==200
  66 + || taskHeader.getTaskType()==500 || taskHeader.getTaskType()==800) {
  67 + if (taskHeader.getFromLocation() == null) {
  68 + throw new ServiceException("源库位为空");
  69 + }
  70 + }
  71 +
  72 + // 出库性质的任务目的库位不能为空
  73 + if(taskHeader.getTaskType()==300 || taskHeader.getTaskType()==400
  74 + || taskHeader.getTaskType()==600 || taskHeader.getTaskType()==700
  75 + || taskHeader.getTaskType()==800 || taskHeader.getTaskType()==900)
  76 + {
  77 + if (taskHeader.getToLocation() == null) {
  78 + throw new ServiceException("目的库位为空");
  79 + }
  80 + }
  81 +
  82 + //3、转换实体,初始化wcs任务实体
  83 + WcsTask wcsTask = new WcsTask();
  84 + wcsTask.setTaskNo(taskHeader.getId().toString());
  85 + wcsTask.setTaskType(taskHeader.getTaskType().toString());
  86 +// wcsTask.setStation(taskHeader.getStation);
  87 + wcsTask.setPalletNo(taskHeader.getContainerCode());
  88 + wcsTask.setFromLocationCode(taskHeader.getFromLocation());
  89 + wcsTask.setToLocationCode(taskHeader.getToLocation());
  90 + wcsTask.setPlatform(platform);
  91 +
  92 + //4、发送数据
  93 + String param="wcs";
  94 + String url=addressService.selectAddress(param)+"TaskAssign";
  95 + String JsonParam = JSON.toJSONString(wcsTask);
  96 + String result = HttpUtils.bodypost(url, JsonParam);
  97 + if(StringUtils.isEmpty(result)){
  98 + throw new ServiceException("接口地址错误");
  99 + }
  100 + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
  101 + return ajaxResult;
  102 + }
  103 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskCancel;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.framework.web.domain.AjaxResult;
  5 +
  6 +public interface TaskCancelService {
  7 +
  8 + //取消任务
  9 + AjaxResult TaskCance(Integer id,String reason);
  10 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskCancel;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.huaheng.api.wcs.domain.WcsTask;
  5 +import com.huaheng.common.exception.service.ServiceException;
  6 +import com.huaheng.common.utils.StringUtils;
  7 +import com.huaheng.common.utils.http.HttpUtils;
  8 +import com.huaheng.framework.web.domain.AjaxResult;
  9 +import com.huaheng.pc.config.address.service.AddressService;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +@Service
  14 +public class TaskCancelServiceImpl implements TaskCancelService {
  15 +
  16 +
  17 + @Autowired
  18 + private AddressService addressService;
  19 +
  20 + /**取消任务
  21 + * 1、判断参数是否为空
  22 + * 2、转换实体
  23 + * 3、发送数据
  24 + * @param id
  25 + * @param reason
  26 + * @return
  27 + */
  28 + @Override
  29 + public AjaxResult TaskCance(Integer id, String reason) {
  30 +
  31 + //1、判断参数是否为空
  32 + if(id == null){
  33 + throw new ServiceException("任务号为空");
  34 + }
  35 + if(StringUtils.isEmpty(reason)){
  36 + throw new ServiceException("取消原因");
  37 + }
  38 +
  39 + //2、转换实体
  40 + WcsTask wcsTask = new WcsTask();
  41 + wcsTask.setTaskNo(id.toString());
  42 + wcsTask.setReason(reason);
  43 +
  44 + //3、发送数据
  45 + String param="wcs";
  46 + String url=addressService.selectAddress(param)+"TaskCance";
  47 + String JsonParam = JSON.toJSONString(wcsTask);
  48 + String result = HttpUtils.bodypost(url, JsonParam);
  49 + if(StringUtils.isEmpty(result)){
  50 + throw new ServiceException("接口地址错误");
  51 + }
  52 + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
  53 + return ajaxResult;
  54 + }
  55 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskFinish;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.framework.web.domain.AjaxResult;
  5 +
  6 +public interface TaskFinishService {
  7 +
  8 + //任务完成
  9 + AjaxResult completeTaskByWCS(WcsTask wcsTask);
  10 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskFinish;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.common.support.Convert;
  5 +import com.huaheng.common.utils.StringUtils;
  6 +import com.huaheng.framework.web.domain.AjaxResult;
  7 +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +
  11 +@Service
  12 +public class TaskFinishServiceImpl implements TaskFinishService {
  13 +
  14 + @Autowired
  15 + private TaskHeaderService taskHeaderService;
  16 +
  17 + //任务完成
  18 + @Override
  19 + public AjaxResult completeTaskByWCS(WcsTask wcsTask) {
  20 + AjaxResult ajaxResult=new AjaxResult();
  21 + if(StringUtils.isEmpty(wcsTask.getTaskNo())){
  22 + return AjaxResult.error("任务号为空");
  23 + }
  24 + try{
  25 + ajaxResult=taskHeaderService.completeTaskByWMS(Convert.toIntArray(wcsTask.getTaskNo()));
  26 + } catch (Exception e) {
  27 + e.printStackTrace();
  28 + }
  29 + return ajaxResult;
  30 + }
  31 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskInfo;
  2 +
  3 +import com.huaheng.framework.web.domain.AjaxResult;
  4 +
  5 +public interface TaskInfoService {
  6 +
  7 + //任务信息查询
  8 + AjaxResult TaskInfo(Integer id);
  9 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskInfo;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.huaheng.api.wcs.domain.WcsTask;
  5 +import com.huaheng.common.exception.service.ServiceException;
  6 +import com.huaheng.common.utils.StringUtils;
  7 +import com.huaheng.common.utils.http.HttpUtils;
  8 +import com.huaheng.framework.web.domain.AjaxResult;
  9 +import com.huaheng.pc.config.address.service.AddressService;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +@Service
  14 +public class TaskInfoServiceImpl implements TaskInfoService {
  15 +
  16 +
  17 + @Autowired
  18 + private AddressService addressService;
  19 + /**
  20 + * 任务信息查询
  21 + * 1、判断非空字段
  22 + * 2、实体转换
  23 + * 3、发送数据
  24 + *
  25 + * @param id
  26 + * @return
  27 + */
  28 + @Override
  29 + public AjaxResult TaskInfo(Integer id) {
  30 +
  31 + //1、判断非空字段
  32 + if(id == null){
  33 + return AjaxResult.error("任务号为空");
  34 + }
  35 +
  36 +
  37 + //2、实体转换
  38 + WcsTask wcsTask =new WcsTask();
  39 + wcsTask.setTaskNo(id.toString());
  40 +
  41 + //3、发送数据
  42 + String param="wcs";
  43 + String url=addressService.selectAddress(param)+"TaskInfo";
  44 + String JsonParam = JSON.toJSONString(wcsTask);
  45 + String result = HttpUtils.bodypost(url, JsonParam);
  46 + if(StringUtils.isEmpty(result)){
  47 + throw new ServiceException("接口地址错误");
  48 + }
  49 + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
  50 + return ajaxResult;
  51 + }
  52 +}
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.warecellAllocation;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.framework.web.domain.AjaxResult;
  5 +
  6 +public interface WarecellAllocationService {
  7 +
  8 + //仓位分配
  9 + AjaxResult WarecellAllocation(WcsTask wcsTask);
  10 +}
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.warecellAllocation;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.common.utils.StringUtils;
  5 +import com.huaheng.framework.web.domain.AjaxResult;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +@Service
  9 +public class WarecellAllocationServiceImpl implements WarecellAllocationService {
  10 +
  11 + /**
  12 + * 仓位分配
  13 + * 1、判断非空字段
  14 + * 2、实体转换
  15 + *
  16 + * @param wcsTask
  17 + * @return
  18 + */
  19 + @Override
  20 + public AjaxResult WarecellAllocation(WcsTask wcsTask) {
  21 +
  22 + //1、判断非空字段
  23 + if(StringUtils.isEmpty(wcsTask.getTaskNo())){
  24 + return AjaxResult.error("任务号为空");
  25 + }
  26 + if(StringUtils.isEmpty(wcsTask.getPalletNo())){
  27 + return AjaxResult.error("托盘编号为空");
  28 + }
  29 + if(StringUtils.isEmpty(wcsTask.getStation())){
  30 + return AjaxResult.error("站台编码为空");
  31 + }
  32 + if(StringUtils.isNull(wcsTask.getLength())){
  33 + return AjaxResult.error("长为空");
  34 + }
  35 + if(StringUtils.isNull(wcsTask.getWidth())){
  36 + return AjaxResult.error("宽为空");
  37 + }
  38 + if(StringUtils.isNull(wcsTask.getHeight())){
  39 + return AjaxResult.error("高为空");
  40 + }
  41 + if(StringUtils.isNull(wcsTask.getWeight())){
  42 + return AjaxResult.error("重为空");
  43 + }
  44 +
  45 +
  46 + return null;
  47 + }
  48 +}
... ...
src/main/java/com/huaheng/pc/config/address/controller/AddressController.java 0 → 100644
  1 +package com.huaheng.pc.config.address.controller;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.metadata.IPage;
  5 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  6 +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  7 +import com.huaheng.common.support.Convert;
  8 +import com.huaheng.common.utils.StringUtils;
  9 +import com.huaheng.common.utils.security.ShiroUtils;
  10 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  11 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  12 +import com.huaheng.framework.web.controller.BaseController;
  13 +import com.huaheng.framework.web.domain.AjaxResult;
  14 +import com.huaheng.framework.web.page.PageDomain;
  15 +import com.huaheng.framework.web.page.TableDataInfo;
  16 +import com.huaheng.framework.web.page.TableSupport;
  17 +import com.huaheng.pc.config.address.domain.Address;
  18 +import com.huaheng.pc.config.address.service.AddressService;
  19 +import com.huaheng.pc.config.carrier.domain.Carrier;
  20 +import com.huaheng.pc.config.carrier.service.CarrierService;
  21 +import io.swagger.annotations.ApiOperation;
  22 +import io.swagger.annotations.ApiParam;
  23 +import org.apache.shiro.authz.annotation.RequiresPermissions;
  24 +import org.springframework.stereotype.Controller;
  25 +import org.springframework.ui.ModelMap;
  26 +import org.springframework.web.bind.annotation.*;
  27 +
  28 +import javax.annotation.Resource;
  29 +import java.util.ArrayList;
  30 +import java.util.List;
  31 +
  32 +/**
  33 + * 接口地址
  34 + */
  35 +@Controller
  36 +@RequestMapping("/config/address")
  37 +public class AddressController extends BaseController {
  38 +
  39 + private String prefix = "config/address";
  40 +
  41 + @Resource
  42 + private AddressService addressService;
  43 +
  44 + @RequiresPermissions("config:address:view")
  45 + @GetMapping()
  46 + public String address() {
  47 + return prefix + "/address";
  48 + }
  49 +
  50 + /**
  51 + * 查询接口地址
  52 + */
  53 + @RequiresPermissions("config:address:list")
  54 + @Log(title = "配置-接口地址", operating = "查看接口地址", action = BusinessType.GRANT)
  55 + @PostMapping("/list")
  56 + @ResponseBody
  57 + public TableDataInfo list(Address address) {
  58 + LambdaQueryWrapper<Address> lambdaQueryWrapper = Wrappers.lambdaQuery();
  59 + PageDomain pageDomain = TableSupport.buildPageRequest();
  60 + Integer pageNum = pageDomain.getPageNum();
  61 + Integer pageSize = pageDomain.getPageSize();
  62 + lambdaQueryWrapper
  63 + .eq(StringUtils.isNotEmpty(address.getParam()), Address::getParam, address.getParam())
  64 + .eq(Address::getWarehouseCode, ShiroUtils.getWarehouseCode());
  65 +
  66 + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
  67 + /*使用分页查询*/
  68 + Page<Address> page = new Page<>(pageNum, pageSize);
  69 + IPage<Address> iPage = addressService.page(page, lambdaQueryWrapper);
  70 + return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  71 + } else {
  72 + List<Address> list = addressService.list(lambdaQueryWrapper);
  73 + return getDataTable(list);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * 新增接口地址
  79 + */
  80 + @GetMapping("/add")
  81 + public String add() {
  82 + return prefix + "/add";
  83 + }
  84 +
  85 + /**
  86 + * 新增保存接口地址
  87 + */
  88 + @RequiresPermissions("config:address:add")
  89 + @Log(title = "通用-接口地址", operating = "新增接口地址", action = BusinessType.INSERT)
  90 + @PostMapping("/add")
  91 + @ResponseBody
  92 + public AjaxResult addSave(Address address) {
  93 + address.setWarehouseCode(ShiroUtils.getWarehouseCode());
  94 + return toAjax(addressService.save(address));
  95 + }
  96 +
  97 + /**
  98 + * 修改接口地址
  99 + */
  100 + @GetMapping("/edit/{id}")
  101 + public String edit(@PathVariable("id") Integer id, ModelMap mmap) {
  102 + mmap.put("address", addressService.getById(id));
  103 + return prefix + "/edit";
  104 + }
  105 +
  106 + /**
  107 + * 修改保存接口地址
  108 + */
  109 + @RequiresPermissions("config:address:edit")
  110 + @Log(title = "配置-接口地址", operating = "修改接口地址", action = BusinessType.UPDATE)
  111 + @PostMapping("/edit")
  112 + @ResponseBody
  113 + public AjaxResult editSave(Address address) {
  114 + return toAjax(addressService.updateById(address));
  115 + }
  116 +
  117 + /**
  118 + * 删除接口地址
  119 + */
  120 + @RequiresPermissions("config:address:remove")
  121 + @Log(title = "配置-接口地址", operating = "删除接口地址", action = BusinessType.DELETE)
  122 + @PostMapping( "/remove")
  123 + @ResponseBody
  124 + public AjaxResult remove(String ids) {
  125 + if (StringUtils.isEmpty(ids)){
  126 + return AjaxResult.error("id不能为空");
  127 + }
  128 + List<Integer> list = new ArrayList<>();
  129 + for (Integer id : Convert.toIntArray(ids)) {
  130 + list.add(id);
  131 + }
  132 + return toAjax(addressService.removeByIds(list));
  133 + }
  134 +}
... ...
src/main/java/com/huaheng/pc/config/address/domain/Address.java 0 → 100644
  1 +package com.huaheng.pc.config.address.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import io.swagger.annotations.ApiModel;
  8 +import io.swagger.annotations.ApiModelProperty;
  9 +import lombok.Data;
  10 +
  11 +import java.io.Serializable;
  12 +
  13 +/**
  14 + * 接口地址
  15 + */
  16 +@ApiModel(value="com.huaheng.pc.config.address.domain.Address")
  17 +@Data
  18 +@TableName(value = "address")
  19 +public class Address implements Serializable {
  20 + /**
  21 + * 内部号
  22 + */
  23 + @TableId(value = "id", type = IdType.AUTO)
  24 + @ApiModelProperty(value="内部号")
  25 + private Integer id;
  26 +
  27 +
  28 + /**
  29 + * 仓库代码
  30 + */
  31 + @TableField(value = "warehouseCode")
  32 + @ApiModelProperty(value="仓库代码")
  33 + private String warehouseCode;
  34 +
  35 + /**
  36 + * 参数
  37 + */
  38 + @TableField(value = "param")
  39 + @ApiModelProperty(value="参数")
  40 + private String param;
  41 +
  42 + /**
  43 + * 接口地址
  44 + */
  45 + @TableField(value = "url")
  46 + @ApiModelProperty(value="接口地址")
  47 + private String url;
  48 +
  49 + public Integer getId() {
  50 + return id;
  51 + }
  52 +
  53 + public void setId(Integer id) {
  54 + this.id = id;
  55 + }
  56 +
  57 + public String getWarehouseCode() {
  58 + return warehouseCode;
  59 + }
  60 +
  61 + public void setWarehouseCode(String warehouseCode) {
  62 + this.warehouseCode = warehouseCode;
  63 + }
  64 +
  65 + public String getParam() {
  66 + return param;
  67 + }
  68 +
  69 + public void setParam(String param) {
  70 + this.param = param;
  71 + }
  72 +
  73 + public String getUrl() {
  74 + return url;
  75 + }
  76 +
  77 + public void setUrl(String url) {
  78 + this.url = url;
  79 + }
  80 +}
0 81 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/address/mapper/AddressMapper.java 0 → 100644
  1 +package com.huaheng.pc.config.address.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.huaheng.pc.config.address.domain.Address;
  5 +
  6 +public interface AddressMapper extends BaseMapper<Address> {
  7 +}
0 8 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/address/service/AddressService.java 0 → 100644
  1 +package com.huaheng.pc.config.address.service;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.huaheng.pc.config.address.domain.Address;
  5 +
  6 +public interface AddressService extends IService<Address>{
  7 +
  8 +
  9 + String selectAddress(String param);
  10 +
  11 +}
... ...
src/main/java/com/huaheng/pc/config/address/service/AddressServiceImpl.java 0 → 100644
  1 +package com.huaheng.pc.config.address.service;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  6 +import com.huaheng.common.exception.service.ServiceException;
  7 +import com.huaheng.common.utils.StringUtils;
  8 +import com.huaheng.common.utils.security.ShiroUtils;
  9 +import com.huaheng.pc.config.address.domain.Address;
  10 +import com.huaheng.pc.config.address.mapper.AddressMapper;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +@Service
  14 +public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService {
  15 +
  16 + @Override
  17 + public String selectAddress(String param) {
  18 + if(StringUtils.isEmpty(param)){
  19 + throw new ServiceException("参数为空");
  20 + }
  21 +
  22 + LambdaQueryWrapper<Address> addressLam = Wrappers.lambdaQuery();
  23 + addressLam.eq(Address::getParam,param)
  24 + .eq(Address::getWarehouseCode, ShiroUtils.getWarehouseCode());
  25 + Address address=this.getOne(addressLam);
  26 + if(address == null){
  27 + throw new ServiceException("参数错误,系统没有此参数对应的地址");
  28 + }
  29 + if(StringUtils.isEmpty(address.getUrl())){
  30 + throw new ServiceException("地址为空");
  31 + }
  32 + return address.getUrl();
  33 + }
  34 +}
... ...
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... ... @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
5 5 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6 6 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  7 +import com.huaheng.api.wcs.service.taskAssignService.TaskAssignService;
7 8 import com.huaheng.common.exception.service.ServiceException;
8 9 import com.huaheng.common.utils.DataUtils;
9 10 import com.huaheng.common.utils.StringUtils;
... ... @@ -44,6 +45,7 @@ import com.huaheng.pc.task.taskDetail.service.TaskDetailService;
44 45 import com.huaheng.pc.task.taskHeader.domain.ShipmentTaskCreateModel;
45 46 import org.apache.poi.ss.formula.functions.T;
46 47 import org.jsoup.helper.DataUtil;
  48 +import org.springframework.beans.factory.annotation.Autowired;
47 49 import org.springframework.stereotype.Service;
48 50 import java.math.BigDecimal;
49 51 import java.text.SimpleDateFormat;
... ... @@ -100,6 +102,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
100 102 private ReceiptContainerHeaderService receiptContainerHeaderService;
101 103 @Resource
102 104 private TaskHeaderMapper taskHeaderMapper;
  105 + @Autowired
  106 + private TaskAssignService taskAssignService;
103 107  
104 108  
105 109  
... ... @@ -403,7 +407,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
403 407 // }
404 408 // }
405 409  
406   -
  410 + //给wcs传递任务
  411 +// taskAssignService.wcsTaskAssign(task);
407 412 }
408 413 return AjaxResult.success("执行下发任务成功", task);
409 414 }
... ...
src/main/resources/mybatis/config/AddressMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.huaheng.pc.config.address.mapper.AddressMapper">
  4 + <resultMap id="BaseResultMap" type="com.huaheng.pc.config.address.domain.Address">
  5 + <!--@mbg.generated-->
  6 + <id column="id" jdbcType="INTEGER" property="id" />
  7 + <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
  8 + <result column="param" jdbcType="VARCHAR" property="param" />
  9 + <result column="url" jdbcType="VARCHAR" property="url" />
  10 + </resultMap>
  11 + <sql id="Base_Column_List">
  12 + <!--@mbg.generated-->
  13 + id, warehouseCode, param,url
  14 + </sql>
  15 +</mapper>
0 16 \ No newline at end of file
... ...