代码更新

This commit is contained in:
梁州 2024-08-02 23:09:53 +08:00
parent 1f298e89d6
commit 8fd1c50722
10 changed files with 363 additions and 38 deletions

View File

@ -8,7 +8,10 @@ public enum ConfigMapKeyEnum {
URL_WCS_E_TASK("URL_WCS_E_TASK"), URL_WCS_E_TASK("URL_WCS_E_TASK"),
URL_WCS_DISPOSE_VEHICLE("URL_WCS_DISPOSE_VEHICLE"), URL_WCS_DISPOSE_VEHICLE("URL_WCS_DISPOSE_VEHICLE"),
START_WORK("START_WORK"), START_WORK("START_WORK"),
SEND_TASK("SEND_TASK"); SEND_TASK("SEND_TASK"),
MAX_VEHICLE_NUMS("MAX_VEHICLE_NUMS"),
SLOC_FILTER_STRING("SLOC_FILTER_STRING"),
URL_WCS_CHANGE_TASK("URL_WCS_CHANGE_TASK");
private final String configKey; private final String configKey;
ConfigMapKeyEnum(String configKey) { ConfigMapKeyEnum(String configKey) {
this.configKey = configKey; this.configKey = configKey;

View File

@ -1,12 +1,22 @@
package com.wms.controller; package com.wms.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wms.annotation.MyLog; import com.wms.annotation.MyLog;
import com.wms.constants.enums.ResponseCode; import com.wms.constants.enums.ResponseCode;
import com.wms.entity.app.ResponseEntity; import com.wms.entity.app.ResponseEntity;
import com.wms.entity.app.dto.PageDto;
import com.wms.entity.app.request.ConfigQuery;
import com.wms.entity.app.vo.ConfigVo;
import com.wms.entity.app.vo.VehicleVO;
import com.wms.entity.table.Config; import com.wms.entity.table.Config;
import com.wms.entity.table.Vehicle;
import com.wms.service.ConfigService; import com.wms.service.ConfigService;
import com.wms.utils.HttpUtils; import com.wms.utils.HttpUtils;
import com.wms.utils.StringUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -25,6 +35,7 @@ import static com.wms.utils.StringUtils.convertJsonString;
/** /**
* WMS系统配置控制类 * WMS系统配置控制类
*
* @author 梁州 * @author 梁州
* @date 2023/3/23 * @date 2023/3/23
*/ */
@ -32,7 +43,7 @@ import static com.wms.utils.StringUtils.convertJsonString;
@CrossOrigin @CrossOrigin
@RequestMapping(value = "/wms/config") @RequestMapping(value = "/wms/config")
@RequiredArgsConstructor(onConstructor = @__(@Autowired)) @RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ConfigController{ public class ConfigController {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());
/** /**
* 系统配置服务 * 系统配置服务
@ -45,43 +56,92 @@ public class ConfigController{
/** /**
* 查找所有配置 * 查找所有配置
*
* @return 配置 * @return 配置
*/ */
@GetMapping("/getConfigs") @GetMapping("/getConfigs")
@ResponseBody @ResponseBody
public List<Config> getConfigs(){ public List<Config> getConfigs() {
logger.info("查询系统配置查询ip{}", HttpUtils.getIpAddr(servletRequest)); logger.info("查询系统配置查询ip{}", HttpUtils.getIpAddr(servletRequest));
return configService.selectConfigs(""); return configService.selectConfigs("");
} }
/**
* 查询系统配置
*
* @param configQuery 配置
* @return 结果
*/
@PostMapping("/getConfigsByPage")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
@MyLog(logTitle = "查询系统配置", logMethod = "getConfigsByPage")
public String getConfigsByPage(@RequestBody ConfigQuery configQuery) {
logger.info("查询系统配置,{}请求ip{}", convertJsonString(configQuery), HttpUtils.getIpAddr(servletRequest));
// 创建响应信息
ResponseEntity response = new ResponseEntity();
try {
Page<Config> page = configQuery.toMpPage();
Page<Config> configPage = configService.page(page, new LambdaQueryWrapper<Config>()
.like(StringUtils.isNotEmpty(configQuery.getConfigName()), Config::getConfigName, configQuery.getConfigName())
.like(StringUtils.isNotEmpty(configQuery.getConfigKey()), Config::getConfigKey, configQuery.getConfigKey())
.eq(StringUtils.isNotEmpty(configQuery.getConfigType()), Config::getConfigType, configQuery.getConfigType()));
PageDto<ConfigVo> pageDto = PageDto.of(configPage, config -> BeanUtil.copyProperties(config, ConfigVo.class));
response.setCode(ResponseCode.OK.getCode());
response.setMessage("查询系统配置成功。");
response.setReturnData(pageDto);
return convertJsonString(response);
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
logger.error("查询系统配置发生异常。");
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("查询系统配置发生异常。");
return convertJsonString(response);
}
}
/** /**
* 更新系统配置 * 更新系统配置
* *
* @param config 配置 * @param configQuery 配置
* @return 结果 * @return 结果
*/ */
@PostMapping("/updateConfig") @PostMapping("/updateConfig")
@ResponseBody @ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED) @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
@MyLog(logTitle = "更新配置", logMethod = "updateConfig") @MyLog(logTitle = "更新配置", logMethod = "updateConfig")
public String updateConfig(@RequestBody Config config) { public String updateConfig(@RequestBody ConfigQuery configQuery) {
logger.info("更新系统配置,{}请求ip{}", convertJsonString(config), HttpUtils.getIpAddr(servletRequest)); logger.info("更新系统配置,{}请求ip{}", convertJsonString(configQuery), HttpUtils.getIpAddr(servletRequest));
// 创建响应信息 // 创建响应信息
ResponseEntity rsp = new ResponseEntity(); ResponseEntity rsp = new ResponseEntity();
try { try {
configService.updateConfig(config); if (configQuery == null || configQuery.getConfigId() == null) {
logger.info("更新系统配置时配置id为必须项");
// 返回其他异常
rsp.setCode(ResponseCode.ERROR.getCode());
rsp.setMessage("更新系统配置时配置id为必须项");
return JSON.toJSONString(rsp);
}
configService.update(new LambdaUpdateWrapper<Config>()
.set(StringUtils.isNotEmpty(configQuery.getConfigKey()), Config::getConfigKey, configQuery.getConfigKey())
.set(StringUtils.isNotEmpty(configQuery.getConfigType()), Config::getConfigType, configQuery.getConfigType())
.set(StringUtils.isNotEmpty(configQuery.getConfigValue()), Config::getConfigValue, configQuery.getConfigValue())
.set(StringUtils.isNotEmpty(configQuery.getConfigName()), Config::getConfigName, configQuery.getConfigName())
.eq(Config::getConfigId, configQuery.getConfigId()));
// 返回成功
rsp.setCode(ResponseCode.OK.getCode());
rsp.setMessage("更新系统配置成功!");
return JSON.toJSONString(rsp);
} catch (Exception e) { } catch (Exception e) {
// 回滚事务 // 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
logger.info("更新系统配置错误:{}", e.getMessage()); logger.info("更新系统配置错误:{}", e.getMessage());
// 返回其他异常 // 返回其他异常
rsp.setCode(ResponseCode.ERROR.getCode()); rsp.setCode(ResponseCode.ERROR.getCode());
rsp.setMessage(e.getMessage()); rsp.setMessage("更新系统配置错误。");
return JSON.toJSONString(rsp); return JSON.toJSONString(rsp);
} }
// 返回成功
rsp.setCode(ResponseCode.OK.getCode());
rsp.setMessage("更新系统配置成功!");
return JSON.toJSONString(rsp);
} }
} }

View File

@ -777,6 +777,10 @@ public class TaskController {
pickTask.setLastUpdateTime(LocalDateTime.now()); pickTask.setLastUpdateTime(LocalDateTime.now());
// 更新为完成 // 更新为完成
pickTaskService.updateById(pickTask); pickTaskService.updateById(pickTask);
// 更新站台信息
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getPickVehicle, boxArriveRequest.getVehicleNo())
.eq(Stand::getStandId, pickTask.getStandId()));
response.setCode(ResponseCode.OK.getCode()); response.setCode(ResponseCode.OK.getCode());
response.setMessage("上报成功"); response.setMessage("上报成功");
@ -821,7 +825,7 @@ public class TaskController {
// 站台号从ip获取 // 站台号从ip获取
Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>() Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>()
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest)) .eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
.eq(Stand::getStandType, 1)); .eq(Stand::getStandType, 2));
if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) { if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) {
standId = standOfIp.getStandId(); standId = standOfIp.getStandId();
} }
@ -893,6 +897,12 @@ public class TaskController {
eTaskData.setNeedNum(thisPickNum.intValue()); eTaskData.setNeedNum(thisPickNum.intValue());
eTaskData.setLocation(eConfig.getELocationId()); eTaskData.setLocation(eConfig.getELocationId());
eTaskDataList.add(eTaskData); eTaskDataList.add(eTaskData);
// 更新电子标签库位信息
etagLocationService.update(new LambdaUpdateWrapper<ETagLocation>()
.set(ETagLocation::getTaskId, eTaskData.getTaskId())
.set(ETagLocation::getNeedNum, eTaskData.getNeedNum())
.set(ETagLocation::getConfirmNum, eTaskData.getNeedNum())
.eq(ETagLocation::getELocationId, eConfig.getELocationId()));
// 设置工作流更新信息 // 设置工作流更新信息
// tempWork.setPickedNum(tempWork.getPickedNum().add(thisPickNum)); // tempWork.setPickedNum(tempWork.getPickedNum().add(thisPickNum));
tempWork.setLightStatus(1); tempWork.setLightStatus(1);
@ -921,7 +931,16 @@ public class TaskController {
// 更新workFlow数据 // 更新workFlow数据
workFlowService.updateBatchById(workFlows); workFlowService.updateBatchById(workFlows);
// 更新亮灯数据 // 更新亮灯数据
etagLocationService.update(new LambdaUpdateWrapper<ETagLocation>().set(ETagLocation::getPickStatus, 1).in(ETagLocation::getELocationId, eTaskDataList.stream().map(ETaskData::getLocation).collect(Collectors.toList()))); etagLocationService.update(new LambdaUpdateWrapper<ETagLocation>()
.set(ETagLocation::getPickStatus, 1)
.set(ETagLocation::getTaskType, wcsETaskRequest.getTaskType())
.set(ETagLocation::getVehicleNo, wcsETaskRequest.getVehicleNo())
.in(ETagLocation::getELocationId, eTaskDataList.stream().map(ETaskData::getLocation).collect(Collectors.toList())));
// 更新站台数据
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getPickGoods, workQuery.getGoodsId())
.set(Stand::getPickVehicle, vehicleId)
.eq(Stand::getStandId, standId));
// 生成前台VO // 生成前台VO
StandPickVo standPickVo = new StandPickVo(); StandPickVo standPickVo = new StandPickVo();
standPickVo.setStandId(standId); standPickVo.setStandId(standId);
@ -967,6 +986,82 @@ public class TaskController {
} }
} }
/**
* 查询当前站台的正在拣选的物料是否完成
*
* @param workQuery 查询参数
* @return 生成的vo信息
*/
@PostMapping("/queryFinishByStandAndGoods")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
@MyLog(logTitle = "查询当前站台的正在拣选的物料是否完成", logMethod = "queryFinishByStandAndGoods")
public String queryFinishByStandAndGoods(@RequestBody WorkQuery workQuery) {
logger.info("查询当前站台的正在拣选的物料是否完成:{}ip地址{}", convertJsonString(workQuery), HttpUtils.getIpAddr(servletRequest));
ResponseEntity response = new ResponseEntity();
try {
String validateInfo = validateService.validateGetWorkVoRequest(workQuery);
if (!Objects.equals(validateInfo, "")) {
logger.error("查询当前站台的正在拣选的物料是否完成错误:{}", validateInfo);
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage(validateInfo);
return convertJsonString(response);
}
Stand targetStand;
if (StringUtils.isNotEmpty(workQuery.getStandId())) {
// 站台号从请求参数中获取
targetStand = standService.getById(workQuery.getStandId());
} else {
// 站台号从ip获取
targetStand = standService.getOne(new LambdaQueryWrapper<Stand>()
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
.eq(Stand::getStandType, 2));
}
if (targetStand == null) {
logger.error("查询拣选站台错误。");
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("查询拣选站台错误。");
return convertJsonString(response);
}
if (StringUtils.isEmpty(targetStand.getPickGoods())) {
// 返回成功
StandPickVo standPickVo = new StandPickVo();
standPickVo.setTip(targetStand.getPickTip());
response.setCode(ResponseCode.OK.getCode());
response.setMessage("当前物料拣货完成。");
response.setReturnData(standPickVo);
} else {
// 查询当前站台的拣货任务
PickTask pickTask = pickTaskService.getOne(new LambdaQueryWrapper<PickTask>()
.eq(PickTask::getStandId, targetStand.getStandId())
.eq(PickTask::getPickStatus, PickTaskStatusEnum.FINISH.getCode()));
if (pickTask == null) {
// 返回成功
response.setCode(ResponseCode.OK.getCode());
response.setMessage("当前物料拣货完成。");
} else {
if (!targetStand.getPickGoods().equals(workQuery.getGoodsId())) {
// 返回成功
response.setCode(ResponseCode.OK.getCode());
response.setMessage("正在拣选其他物料。");
} else {
// 返回成功
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("当前物料正在拣货");
}
}
}
return convertJsonString(response);
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
logger.error("获取工作信息异常:{}", convertJsonString(e));
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("获取工作信息异常");
return convertJsonString(response);
}
}
/** /**
* 获取电子标签反馈 * 获取电子标签反馈
* *
@ -998,10 +1093,6 @@ public class TaskController {
} }
// 更新实际拣选数量 // 更新实际拣选数量
workFlow.setPickedNum(workFlow.getPickedNum().add(BigDecimal.valueOf(eTaskFeedbackRequest.getConfirmNum()))); workFlow.setPickedNum(workFlow.getPickedNum().add(BigDecimal.valueOf(eTaskFeedbackRequest.getConfirmNum())));
if (eTaskFeedbackRequest.getConfirmNum() < eTaskFeedbackRequest.getNeedNum()) {
// 数量不够时向库存要料
// TODO
}
if (workFlow.getPickedNum().compareTo(workFlow.getNeedNum()) < 0) { if (workFlow.getPickedNum().compareTo(workFlow.getNeedNum()) < 0) {
// 判断后续有无物料进此站台 // 判断后续有无物料进此站台
List<PickTask> pickedTasks = pickTaskService.list(new LambdaQueryWrapper<PickTask>() List<PickTask> pickedTasks = pickTaskService.list(new LambdaQueryWrapper<PickTask>()
@ -1014,7 +1105,6 @@ public class TaskController {
workFlow.setLightStatus(1);// 已亮灯 workFlow.setLightStatus(1);// 已亮灯
workFlow.setWorkStatus(1);// 正在做 workFlow.setWorkStatus(1);// 正在做
} else { } else {
// TODO 继续向库存要料
// 当前物料当前站台需求数量 // 当前物料当前站台需求数量
BigDecimal needNum = workFlow.getNeedNum().subtract(workFlow.getPickedNum()); BigDecimal needNum = workFlow.getNeedNum().subtract(workFlow.getPickedNum());
// 判断当前物料是否在流转中 // 判断当前物料是否在流转中
@ -1048,9 +1138,14 @@ public class TaskController {
existStock.setGoodsRelated(goodsDetail); existStock.setGoodsRelated(goodsDetail);
stockService.updateById(existStock); stockService.updateById(existStock);
} }
// 更新亮灯信息 // 更新电子标签库位信息
etagLocationService.update(new LambdaUpdateWrapper<ETagLocation>() etagLocationService.update(new LambdaUpdateWrapper<ETagLocation>()
.set(ETagLocation::getPickStatus, 0) .set(ETagLocation::getPickStatus, 0)
.set(ETagLocation::getTaskId, "")
.set(ETagLocation::getVehicleNo, "")
.set(ETagLocation::getTaskType, null)
.set(ETagLocation::getNeedNum, null)
.set(ETagLocation::getConfirmNum, null)
.eq(ETagLocation::getELocationId, eTaskFeedbackRequest.getLocation())); .eq(ETagLocation::getELocationId, eTaskFeedbackRequest.getLocation()));
response.setCode(ResponseCode.OK.getCode()); response.setCode(ResponseCode.OK.getCode());
response.setMessage("处理反馈成功"); response.setMessage("处理反馈成功");
@ -1092,7 +1187,7 @@ public class TaskController {
// 站台号从ip获取 // 站台号从ip获取
Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>() Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>()
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest)) .eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
.eq(Stand::getStandType, 1)); .eq(Stand::getStandType, 2));
if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) { if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) {
standId = standOfIp.getStandId(); standId = standOfIp.getStandId();
} }
@ -1120,11 +1215,19 @@ public class TaskController {
// 没有拣货任务直接放行 // 没有拣货任务直接放行
// 调用Wcs的放行接口 // 调用Wcs的放行接口
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, null)); wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, null));
// 更新站台信息
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "")
.eq(Stand::getStandId, standId));
response.setCode(ResponseCode.OK.getCode()); response.setCode(ResponseCode.OK.getCode());
response.setMessage("确认成功,放行"); response.setMessage("确认成功,放行");
} else { } else {
// 处理库存偏差 // 处理库存偏差
if (workConfirmRequest.getRemainNumReal().compareTo(workConfirmRequest.getRemainNumOrigin()) != 0) { if (workConfirmRequest.getRemainNumReal().compareTo(workConfirmRequest.getRemainNumOrigin()) != 0) {
// TODO 这里库存的处理仍然需要完善
if (workConfirmRequest.getRemainNumReal().compareTo(BigDecimal.ZERO) == 0) {// 实际剩余数量为0 if (workConfirmRequest.getRemainNumReal().compareTo(BigDecimal.ZERO) == 0) {// 实际剩余数量为0
// 删除库存 // 删除库存
stockService.remove(new LambdaQueryWrapper<Stock>() stockService.remove(new LambdaQueryWrapper<Stock>()
@ -1166,6 +1269,10 @@ public class TaskController {
// 需要不放行返回前台提示信息 // 需要不放行返回前台提示信息
StandPickVo pickVoEntity = new StandPickVo(); StandPickVo pickVoEntity = new StandPickVo();
pickVoEntity.setTip("当前料箱还有其他物料需要拣货"); pickVoEntity.setTip("当前料箱还有其他物料需要拣货");
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, pickVoEntity.getTip())
.eq(Stand::getStandId, standId));
response.setCode(ResponseCode.WARNING.getCode()); response.setCode(ResponseCode.WARNING.getCode());
response.setMessage("当前料箱还有其他物料需要拣货"); response.setMessage("当前料箱还有其他物料需要拣货");
response.setReturnData(pickVoEntity); response.setReturnData(pickVoEntity);
@ -1183,10 +1290,25 @@ public class TaskController {
.eq(WorkFlow::getWorkStation, standId) .eq(WorkFlow::getWorkStation, standId)
.ne(WorkFlow::getWorkStatus, 2))) { .ne(WorkFlow::getWorkStatus, 2))) {
// 当前站台工作未全部完成 // 当前站台工作未全部完成
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "")
.eq(Stand::getStandId, standId));
response.setMessage("确认成功,放行"); response.setMessage("确认成功,放行");
} else { } else {
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "当前工作已经全部完成,请至完成界面进行后续工作。")
.eq(Stand::getStandId, standId));
StandPickVo pickVoEntity = new StandPickVo();
pickVoEntity.setTip("当前工作已经全部完成,请至完成界面进行后续工作。");
// 当前站台工作已全部完成需要提示工作完成打印标签 // 当前站台工作已全部完成需要提示工作完成打印标签
response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。"); response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。");
response.setReturnData(pickVoEntity);
} }
response.setCode(ResponseCode.OK.getCode()); response.setCode(ResponseCode.OK.getCode());
} }
@ -1204,10 +1326,25 @@ public class TaskController {
.eq(WorkFlow::getWorkStation, standId) .eq(WorkFlow::getWorkStation, standId)
.ne(WorkFlow::getWorkStatus, 2))) { .ne(WorkFlow::getWorkStatus, 2))) {
// 当前站台工作未全部完成 // 当前站台工作未全部完成
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "")
.eq(Stand::getStandId, standId));
response.setMessage("确认成功,放行"); response.setMessage("确认成功,放行");
} else { } else {
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "当前工作已经全部完成,请至完成界面进行后续工作。")
.eq(Stand::getStandId, standId));
StandPickVo pickVoEntity = new StandPickVo();
pickVoEntity.setTip("当前工作已经全部完成,请至完成界面进行后续工作。");
// 当前站台工作已全部完成需要提示工作完成打印标签 // 当前站台工作已全部完成需要提示工作完成打印标签
response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。"); response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。");
response.setReturnData(pickVoEntity);
} }
response.setCode(ResponseCode.OK.getCode()); response.setCode(ResponseCode.OK.getCode());
} }
@ -1246,13 +1383,12 @@ public class TaskController {
// 站台号从ip获取 // 站台号从ip获取
Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>() Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>()
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest)) .eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
.eq(Stand::getStandType, 1)); .eq(Stand::getStandType, 2));
if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) { if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) {
standId = standOfIp.getStandId(); standId = standOfIp.getStandId();
} }
} }
if (StringUtils.isEmpty(standId)) { if (StringUtils.isEmpty(standId)) {
// TODO 这里需要使用websocket从后台向前台推送消息
logger.error("请求参数缺少站台号。"); logger.error("请求参数缺少站台号。");
response.setCode(ResponseCode.ERROR.getCode()); response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("请求参数缺少站台号。"); response.setMessage("请求参数缺少站台号。");
@ -1262,7 +1398,6 @@ public class TaskController {
if (etagLocationService.exists(new LambdaQueryWrapper<ETagLocation>() if (etagLocationService.exists(new LambdaQueryWrapper<ETagLocation>()
.eq(ETagLocation::getWorkStation, standId) .eq(ETagLocation::getWorkStation, standId)
.eq(ETagLocation::getPickStatus, 1))) { .eq(ETagLocation::getPickStatus, 1))) {
// TODO 这里需要使用websocket从后台向前台推送消息
logger.error("站台灯光未全部拍灭,请检查。"); logger.error("站台灯光未全部拍灭,请检查。");
response.setCode(ResponseCode.ERROR.getCode()); response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("站台灯光未全部拍灭,请检查。"); response.setMessage("站台灯光未全部拍灭,请检查。");
@ -1275,7 +1410,14 @@ public class TaskController {
if (pickTask == null) { if (pickTask == null) {
// 没有拣货任务直接放行 // 没有拣货任务直接放行
// 调用Wcs的放行接口 // 调用Wcs的放行接口
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, null)); // wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, null));
// 更新站台信息
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "")
.eq(Stand::getStandId, standId));
response.setCode(ResponseCode.OK.getCode()); response.setCode(ResponseCode.OK.getCode());
response.setMessage("确认成功,放行"); response.setMessage("确认成功,放行");
} else { } else {
@ -1291,12 +1433,16 @@ public class TaskController {
} }
} }
if (goodsIdList.size() > 0) { if (goodsIdList.size() > 0) {
// 判断这些物料是不是当前站台的工作流中否需要 // 判断这些物料是不是当前站台的工作流中否需要
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>() if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
.eq(WorkFlow::getWorkStation, standId) .eq(WorkFlow::getWorkStation, standId)
.in(WorkFlow::getGoodsId, goodsIdList) .in(WorkFlow::getGoodsId, goodsIdList)
.ne(WorkFlow::getWorkStatus, 2))) { .ne(WorkFlow::getWorkStatus, 2))) {
// TODO 这里需要使用websocket从后台向前台推送消息 // 更新站台信息
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "当前料箱还有其他物料需要拣货")
.eq(Stand::getStandId, standId));
// 需要不放行返回前台提示信息 // 需要不放行返回前台提示信息
response.setCode(ResponseCode.ERROR.getCode()); response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("当前料箱还有其他物料需要拣货"); response.setMessage("当前料箱还有其他物料需要拣货");
@ -1313,9 +1459,21 @@ public class TaskController {
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>() if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
.eq(WorkFlow::getWorkStation, standId) .eq(WorkFlow::getWorkStation, standId)
.ne(WorkFlow::getWorkStatus, 2))) { .ne(WorkFlow::getWorkStatus, 2))) {
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "")
.eq(Stand::getStandId, standId));
// 当前站台工作未全部完成 // 当前站台工作未全部完成
response.setMessage("确认成功,放行"); response.setMessage("确认成功,放行");
} else { } else {
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "当前工作已经全部完成,请至完成界面进行后续工作。")
.eq(Stand::getStandId, standId));
// 当前站台工作已全部完成需要提示工作完成打印标签 // 当前站台工作已全部完成需要提示工作完成打印标签
response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。"); response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。");
} }
@ -1335,8 +1493,20 @@ public class TaskController {
.eq(WorkFlow::getWorkStation, standId) .eq(WorkFlow::getWorkStation, standId)
.ne(WorkFlow::getWorkStatus, 2))) { .ne(WorkFlow::getWorkStatus, 2))) {
// 当前站台工作未全部完成 // 当前站台工作未全部完成
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "")
.eq(Stand::getStandId, standId));
response.setMessage("确认成功,放行"); response.setMessage("确认成功,放行");
} else { } else {
standService.update(new LambdaUpdateWrapper<Stand>()
.set(Stand::getLastUseTime, LocalDateTime.now())
.set(Stand::getPickVehicle, "")
.set(Stand::getPickGoods, "")
.set(Stand::getPickTip, "当前工作已经全部完成,请至完成界面进行后续工作。")
.eq(Stand::getStandId, standId));
// 当前站台工作已全部完成需要提示工作完成打印标签 // 当前站台工作已全部完成需要提示工作完成打印标签
response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。"); response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。");
} }
@ -1377,7 +1547,7 @@ public class TaskController {
// 站台号从ip获取 // 站台号从ip获取
Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>() Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>()
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest)) .eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
.eq(Stand::getStandType, 1)); .eq(Stand::getStandType, 2));
if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) { if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) {
standId = standOfIp.getStandId(); standId = standOfIp.getStandId();
} }
@ -1469,7 +1639,7 @@ public class TaskController {
// 站台号从ip获取 // 站台号从ip获取
Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>() Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>()
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest)) .eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
.eq(Stand::getStandType, 1)); .eq(Stand::getStandType, 2));
if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) { if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) {
standId = standOfIp.getStandId(); standId = standOfIp.getStandId();
} }
@ -1601,9 +1771,9 @@ public class TaskController {
} }
} }
// TODO 接收Wcs询问是否回库的请求
/** /**
* Wcs请求箱子是否回库 * Wcs请求箱子是否回库
*
* @param requestBackQuery 请求信息 * @param requestBackQuery 请求信息
* @return 结果 * @return 结果
*/ */

View File

@ -54,4 +54,16 @@ public class StandDto {
* 最近一次的使用时间 * 最近一次的使用时间
*/ */
private LocalDateTime lastUseTime; private LocalDateTime lastUseTime;
/**
* 正在拣选的物料
*/
private String pickGoods;
/**
* 正在拣选的箱子
*/
private String pickVehicle;
/**
* 拣选提示信息
*/
private String pickTip;
} }

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.wms.entity.table.Config;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -42,4 +43,17 @@ public class ConfigQuery extends PageQuery {
*/ */
@JsonProperty("configName") @JsonProperty("configName")
private String configName; private String configName;
/**
* 返回配置PO
*/
public Config toConfigPO() {
Config config = new Config();
config.setConfigId(this.configId);
config.setConfigKey(this.configKey);
config.setConfigName(this.configName);
config.setConfigValue(this.configValue);
config.setConfigType(this.configType);
return config;
}
} }

View File

@ -0,0 +1,34 @@
package com.wms.entity.app.vo;
import lombok.Data;
/**
* 配置显示类
*/
@Data
public class ConfigVo {
/**
* 配置ID
*/
private Integer configId;
/**
* 配置键
*/
private String configKey;
/**
* 配置值
*/
private String configValue;
/**
* 配置类型
*/
private String configType;
/**
* 配置名称
*/
private String configName;
}

View File

@ -1,6 +1,8 @@
package com.wms.entity.app.vo; package com.wms.entity.app.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -50,5 +52,19 @@ public class StandVo {
/** /**
* 最近一次的使用时间 * 最近一次的使用时间
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime lastUseTime; private LocalDateTime lastUseTime;
/**
* 正在拣选的物料
*/
private String pickGoods;
/**
* 正在拣选的物料
*/
private String pickVehicle;
/**
* 拣选提示信息
*/
private String pickTip;
} }

View File

@ -71,4 +71,19 @@ public class Stand {
*/ */
@TableField("last_use_time") @TableField("last_use_time")
private LocalDateTime lastUseTime; private LocalDateTime lastUseTime;
/**
* 正在拣选的物料
*/
@TableField("pick_goods")
private String pickGoods;
/**
* 正在拣选的物料
*/
@TableField("pick_vehicle")
private String pickVehicle;
/**
* 拣选提示信息
*/
@TableField("pick_tip")
private String pickTip;
} }

View File

@ -47,7 +47,7 @@ public class WmsJobServiceImplements implements IWmsJobService {
*/ */
public void sendCommonTasks() throws Exception { public void sendCommonTasks() throws Exception {
try { try {
String max_vehicle_nums = configMap.get("MAX_VEHICLE_NUMS"); String max_vehicle_nums = configMap.get(ConfigMapKeyEnum.MAX_VEHICLE_NUMS.getConfigKey());
if (StringUtils.isEmpty(max_vehicle_nums)) { if (StringUtils.isEmpty(max_vehicle_nums)) {
logger.error("配置未生成"); logger.error("配置未生成");
return; return;

View File

@ -2,6 +2,7 @@ package com.wms.service.business.serviceImplements;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.wms.constants.enums.ConfigMapKeyEnum;
import com.wms.entity.app.dto.WorkCenterAndOrderDto; import com.wms.entity.app.dto.WorkCenterAndOrderDto;
import com.wms.entity.table.*; import com.wms.entity.table.*;
import com.wms.service.*; import com.wms.service.*;
@ -171,7 +172,7 @@ public class WorkServiceImplements implements IWorkService {
// 查找当前站台未开始的工作流 // 查找当前站台未开始的工作流
List<WorkFlow> currentWorkFlowList = workFlowService.list(new LambdaQueryWrapper<WorkFlow>() List<WorkFlow> currentWorkFlowList = workFlowService.list(new LambdaQueryWrapper<WorkFlow>()
.eq(WorkFlow::getWorkStation, workStation) .eq(WorkFlow::getWorkStation, workStation)
.ne(WorkFlow::getWorkStatus, 2)); .eq(WorkFlow::getWorkStatus, 0));
// 没有可做的任务 // 没有可做的任务
if (currentWorkFlowList == null || currentWorkFlowList.isEmpty()) { if (currentWorkFlowList == null || currentWorkFlowList.isEmpty()) {
return; return;
@ -342,7 +343,7 @@ public class WorkServiceImplements implements IWorkService {
List<KateOrders> kateWorkOrders = kateOrdersService.list(new LambdaQueryWrapper<KateOrders>() List<KateOrders> kateWorkOrders = kateOrdersService.list(new LambdaQueryWrapper<KateOrders>()
.eq(KateOrders::getSupplyArea, workConfig.getSmallBox()) .eq(KateOrders::getSupplyArea, workConfig.getSmallBox())
.eq(KateOrders::getOrderStatus, 0) .eq(KateOrders::getOrderStatus, 0)
.eq(KateOrders::getSLoc, configMap.get("SLOC_FILTER_STRING"))); .eq(KateOrders::getSLoc, configMap.get(ConfigMapKeyEnum.SLOC_FILTER_STRING.getConfigKey())));
// 当前工位没有未完成的工单 // 当前工位没有未完成的工单
if (kateWorkOrders == null || kateWorkOrders.isEmpty()) { if (kateWorkOrders == null || kateWorkOrders.isEmpty()) {
continue; continue;
@ -384,7 +385,7 @@ public class WorkServiceImplements implements IWorkService {
.eq(KateOrders::getWorkOrder, currentWorkCenterAndOrderDto.getWorkOrder()) .eq(KateOrders::getWorkOrder, currentWorkCenterAndOrderDto.getWorkOrder())
.eq(KateOrders::getSupplyArea, currentWorkCenterAndOrderDto.getWorkCenter()) .eq(KateOrders::getSupplyArea, currentWorkCenterAndOrderDto.getWorkCenter())
.eq(KateOrders::getOrderStatus, 0) .eq(KateOrders::getOrderStatus, 0)
.eq(KateOrders::getSLoc, configMap.get("SLOC_FILTER_STRING"))); .eq(KateOrders::getSLoc, configMap.get(ConfigMapKeyEnum.SLOC_FILTER_STRING.getConfigKey())));
for (KateOrders tempOrder : kateWorkOrderList) { for (KateOrders tempOrder : kateWorkOrderList) {
// 生成workFlow // 生成workFlow
WorkFlow tempWorkFlow = new WorkFlow(); WorkFlow tempWorkFlow = new WorkFlow();