forked from BaoKaiWms/202501-Wms-Kate-Wuxi
1.添加站台后端获取, 更新, 关闭接口
2.完善standSetting.vue页面
This commit is contained in:
parent
a901b2847d
commit
5b543ca793
|
|
@ -0,0 +1,57 @@
|
|||
package com.wms_main.controller.wms;
|
||||
|
||||
import com.wms_main.model.dto.query.StandQuery;
|
||||
import com.wms_main.model.dto.request.wms.UpdateStandRequest;
|
||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.vo.wms.StandVo;
|
||||
import com.wms_main.service.controller.IStandControllerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站台控制器
|
||||
*/
|
||||
@RestController
|
||||
@ResponseBody
|
||||
@CrossOrigin
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/wms/stand")
|
||||
public class StandController {
|
||||
|
||||
private final IStandControllerService standControllerService;
|
||||
/**
|
||||
* 获取所有站台信息
|
||||
*
|
||||
* @param standQuery 查询参数
|
||||
* @return 站台信息列表
|
||||
*/
|
||||
@PostMapping("/getAllStands")
|
||||
public WmsApiResponse<List<StandVo>> getAllStands(@RequestBody StandQuery standQuery) {
|
||||
return standControllerService.getAllStands(standQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新站台信息
|
||||
*
|
||||
* @param request 更新请求
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PostMapping("/updateStandInfo")
|
||||
public BaseWmsApiResponse updateStandInfo(@RequestBody UpdateStandRequest request) {
|
||||
return standControllerService.updateStandInfo(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭站台
|
||||
*
|
||||
* @param request 关闭请求
|
||||
* @return 关闭结果
|
||||
*/
|
||||
@PostMapping("/closeStandInfo")
|
||||
public BaseWmsApiResponse closeStandInfo(@RequestBody UpdateStandRequest request) {
|
||||
return standControllerService.closeStandInfo(request);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.wms_main.model.dto.query;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 站台查询参数
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class StandQuery extends PageQuery {
|
||||
/**
|
||||
* 站台ID
|
||||
*/
|
||||
private String standId;
|
||||
|
||||
/**
|
||||
* 站台名称
|
||||
*/
|
||||
private String standName;
|
||||
|
||||
/**
|
||||
* 站台类型 1:入库 2:出库
|
||||
*/
|
||||
private Integer standType;
|
||||
|
||||
/**
|
||||
* 站台状态 0:关闭 1:开启
|
||||
*/
|
||||
private Integer standStatus;
|
||||
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
private String warehouseId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.wms_main.model.dto.request.wms;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 物料信息更新请求
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UpdateGoodsRequest extends BaseWmsRequest {
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
@JsonProperty("goodsId")
|
||||
private String goodsId;
|
||||
|
||||
/**
|
||||
* 每盒数量
|
||||
*/
|
||||
@JsonProperty("boxQty")
|
||||
private Integer boxQty;
|
||||
|
||||
/**
|
||||
* 最大盒数
|
||||
*/
|
||||
@JsonProperty("maxBoxNum")
|
||||
private Integer maxBoxNum;
|
||||
|
||||
/**
|
||||
* 存放区域
|
||||
*/
|
||||
@JsonProperty("putArea")
|
||||
private String putArea;
|
||||
|
||||
/**
|
||||
* 热点区域
|
||||
*/
|
||||
@JsonProperty("hotPoint")
|
||||
private String hotPoint;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.wms_main.model.dto.request.wms;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 站台更新请求参数
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UpdateStandRequest extends BaseWmsRequest {
|
||||
|
||||
/**
|
||||
* 站台号
|
||||
*/
|
||||
private String standId;
|
||||
|
||||
/**
|
||||
* 站台名称
|
||||
*/
|
||||
private String standName;
|
||||
|
||||
/**
|
||||
* 站台类型 1:入库 2:出库
|
||||
*/
|
||||
private Integer standType;
|
||||
|
||||
/**
|
||||
* 站台状态 0:可用 1:不可用
|
||||
*/
|
||||
private Integer standStatus;
|
||||
|
||||
/**
|
||||
* 站台电脑的IP
|
||||
*/
|
||||
private String standIp;
|
||||
|
||||
/**
|
||||
* 站台描述
|
||||
*/
|
||||
private String standDesc;
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
|
|||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 应用配置表映射
|
||||
* 站台表映射
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
|
|
@ -18,40 +18,47 @@ import java.time.LocalDateTime;
|
|||
@TableName(value = "t_app_stand", autoResultMap = true)
|
||||
public class TAppStand {
|
||||
/**
|
||||
* 站台id
|
||||
* 站台号
|
||||
*/
|
||||
@TableId(value = "stand_id")
|
||||
private String standId;
|
||||
|
||||
/**
|
||||
* 站台类型
|
||||
*/
|
||||
@TableField(value = "stand_type")
|
||||
private Integer standType;
|
||||
|
||||
/**
|
||||
* 站台状态
|
||||
*/
|
||||
@TableField(value = "stand_status")
|
||||
private Integer standStatus;
|
||||
|
||||
/**
|
||||
* 站台ip
|
||||
* 站台电脑的ip
|
||||
*/
|
||||
@TableField(value = "stand_ip")
|
||||
private String standIp;
|
||||
|
||||
/**
|
||||
* 站台名称
|
||||
*/
|
||||
@TableField(value = "stand_name")
|
||||
private String standName;
|
||||
|
||||
/**
|
||||
* 站台描述
|
||||
*/
|
||||
@TableField(value = "stand_desc")
|
||||
private String standDesc;
|
||||
|
||||
/**
|
||||
* 上次更新时间
|
||||
*/
|
||||
@TableField(value = "last_update_time")
|
||||
private LocalDateTime lastUpdateTime;
|
||||
|
||||
/**
|
||||
* 上次更新用户
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,25 +1,82 @@
|
|||
package com.wms_main.model.vo.wms;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.wms_main.model.po.TAppStand;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 站台Vo
|
||||
* 站台视图对象
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class StandVo {
|
||||
|
||||
/**
|
||||
* 站台id
|
||||
* 站台号
|
||||
*/
|
||||
@JsonProperty("standId")
|
||||
private String standId;
|
||||
|
||||
/**
|
||||
* 站台类型
|
||||
* 站台名称
|
||||
*/
|
||||
private String standName;
|
||||
|
||||
/**
|
||||
* 站台类型 1:入库 2:出库
|
||||
*/
|
||||
@JsonProperty("standType")
|
||||
private Integer standType;
|
||||
|
||||
/**
|
||||
* 站台状态 0:可用 1:不可用
|
||||
*/
|
||||
private Integer standStatus;
|
||||
|
||||
/**
|
||||
* 站台电脑的IP
|
||||
*/
|
||||
private String standIp;
|
||||
|
||||
/**
|
||||
* 站台描述
|
||||
*/
|
||||
private String standDesc;
|
||||
|
||||
/**
|
||||
* 上次更新时间
|
||||
*/
|
||||
private LocalDateTime lastUpdateTime;
|
||||
|
||||
/**
|
||||
* 上次更新用户
|
||||
*/
|
||||
private String lastUpdateUser;
|
||||
|
||||
/**
|
||||
* 将TAppStand转换为StandVo
|
||||
*
|
||||
* @param stand 站台实体
|
||||
* @return 站台视图对象
|
||||
*/
|
||||
public static StandVo of(TAppStand stand) {
|
||||
if (stand == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StandVo standVo = new StandVo();
|
||||
standVo.setStandId(stand.getStandId());
|
||||
standVo.setStandName(stand.getStandName());
|
||||
standVo.setStandType(stand.getStandType());
|
||||
standVo.setStandStatus(stand.getStandStatus());
|
||||
standVo.setStandIp(stand.getStandIp());
|
||||
standVo.setStandDesc(stand.getStandDesc());
|
||||
standVo.setLastUpdateTime(stand.getLastUpdateTime());
|
||||
standVo.setLastUpdateUser(stand.getLastUpdateUser());
|
||||
|
||||
return standVo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.wms_main.service.controller;
|
||||
|
||||
import com.wms_main.model.dto.query.StandQuery;
|
||||
import com.wms_main.model.dto.request.wms.UpdateStandRequest;
|
||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.po.TAppStand;
|
||||
import com.wms_main.model.vo.wms.PageVo;
|
||||
import com.wms_main.model.vo.wms.StandVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站台控制器服务接口
|
||||
*/
|
||||
public interface IStandControllerService {
|
||||
/**
|
||||
* 获取所有站台信息
|
||||
*
|
||||
* @param standQuery 查询参数
|
||||
* @return 站台列表
|
||||
*/
|
||||
WmsApiResponse<List<StandVo>> getAllStands(StandQuery standQuery);
|
||||
|
||||
/**
|
||||
* 更新站台信息
|
||||
*
|
||||
* @param request 更新请求
|
||||
* @return 更新结果
|
||||
*/
|
||||
BaseWmsApiResponse updateStandInfo(UpdateStandRequest request);
|
||||
|
||||
/**
|
||||
* 关闭站台
|
||||
*
|
||||
* @param request 关闭请求
|
||||
* @return 关闭结果
|
||||
*/
|
||||
BaseWmsApiResponse closeStandInfo(UpdateStandRequest request);
|
||||
}
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
package com.wms_main.service.controller.serviceImpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms_main.dao.ITAppStandService;
|
||||
import com.wms_main.model.dto.query.StandQuery;
|
||||
import com.wms_main.model.dto.request.wms.UpdateStandRequest;
|
||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.po.TAppStand;
|
||||
import com.wms_main.model.vo.wms.PageVo;
|
||||
import com.wms_main.model.vo.wms.StandVo;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import com.wms_main.service.controller.IStandControllerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 站台控制器服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class StandControllerServiceImpl implements IStandControllerService {
|
||||
|
||||
private final ITAppStandService standService;
|
||||
|
||||
/**
|
||||
* 获取所有站台信息
|
||||
*
|
||||
* @param standQuery 查询参数
|
||||
* @return 站台信息列表
|
||||
*/
|
||||
@Override
|
||||
public WmsApiResponse<List<StandVo>> getAllStands(StandQuery standQuery) {
|
||||
log.info("开始获取所有站台信息,参数:{}", standQuery);
|
||||
try {
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<TAppStand> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 添加站台ID条件
|
||||
if (StringUtils.isNotEmpty(standQuery.getStandId())) {
|
||||
queryWrapper.like(TAppStand::getStandId, standQuery.getStandId());
|
||||
}
|
||||
|
||||
// 添加站台类型条件
|
||||
if (standQuery.getStandType() != null) {
|
||||
queryWrapper.eq(TAppStand::getStandType, standQuery.getStandType());
|
||||
}
|
||||
|
||||
// 执行查询
|
||||
List<TAppStand> standList = standService.list(queryWrapper);
|
||||
|
||||
// 转换为VO对象
|
||||
List<StandVo> standVoList = standList.stream()
|
||||
.map(StandVo::of)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return WmsApiResponse.success("获取站台信息成功", standVoList);
|
||||
} catch (Exception e) {
|
||||
log.error("获取站台信息异常", e);
|
||||
return WmsApiResponse.error("获取站台信息异常:" + e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A更新站台信息
|
||||
*
|
||||
* @param request 更新请求
|
||||
* @return 更新结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseWmsApiResponse updateStandInfo(UpdateStandRequest request) {
|
||||
log.info("开始更新站台信息,参数:{}", request);
|
||||
try {
|
||||
// 参数校验
|
||||
if (request == null) {
|
||||
return BaseWmsApiResponse.error("更新参数不能为空");
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(request.getStandId())) {
|
||||
return BaseWmsApiResponse.error("站台ID不能为空");
|
||||
}
|
||||
|
||||
// 查询站台是否存在
|
||||
TAppStand stand = standService.getById(request.getStandId());
|
||||
if (stand == null) {
|
||||
return BaseWmsApiResponse.error("站台不存在");
|
||||
}
|
||||
|
||||
// 设置需要更新的字段
|
||||
stand.setStandType(request.getStandType());
|
||||
stand.setStandStatus(request.getStandStatus());
|
||||
stand.setStandName(request.getStandName());
|
||||
stand.setStandIp(request.getStandIp());
|
||||
stand.setStandDesc(request.getStandDesc());
|
||||
|
||||
// 设置更新时间和更新人
|
||||
stand.setLastUpdateTime(LocalDateTime.now());
|
||||
stand.setLastUpdateUser(request.getUserName());
|
||||
|
||||
// 更新站台信息
|
||||
boolean result = standService.updateById(stand);
|
||||
|
||||
if (result) {
|
||||
log.info("站台信息更新成功,ID:{}", request.getStandId());
|
||||
return BaseWmsApiResponse.success("更新站台信息成功");
|
||||
} else {
|
||||
log.warn("站台信息更新失败,ID:{}", request.getStandId());
|
||||
return BaseWmsApiResponse.error("更新站台信息失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("更新站台信息异常", e);
|
||||
return BaseWmsApiResponse.error("更新站台信息异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭站台
|
||||
*
|
||||
* @param request 关闭请求
|
||||
* @return 关闭结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseWmsApiResponse closeStandInfo(UpdateStandRequest request) {
|
||||
log.info("开始关闭站台,参数:{}", request);
|
||||
try {
|
||||
// 参数校验
|
||||
if (request == null) {
|
||||
return BaseWmsApiResponse.error("关闭参数不能为空");
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(request.getStandId())) {
|
||||
return BaseWmsApiResponse.error("站台ID不能为空");
|
||||
}
|
||||
|
||||
// 查询站台是否存在
|
||||
TAppStand stand = standService.getById(request.getStandId());
|
||||
if (stand == null) {
|
||||
return BaseWmsApiResponse.error("站台不存在");
|
||||
}
|
||||
|
||||
// 设置站台状态为不可用
|
||||
stand.setStandStatus(1);
|
||||
stand.setLastUpdateTime(LocalDateTime.now());
|
||||
stand.setLastUpdateUser(request.getUserName());
|
||||
|
||||
// 更新站台信息
|
||||
boolean result = standService.updateById(stand);
|
||||
|
||||
if (result) {
|
||||
log.info("站台关闭成功,ID:{}", request.getStandId());
|
||||
return BaseWmsApiResponse.success("关闭站台成功");
|
||||
} else {
|
||||
log.warn("站台关闭失败,ID:{}", request.getStandId());
|
||||
return BaseWmsApiResponse.error("关闭站台失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("关闭站台异常", e);
|
||||
return BaseWmsApiResponse.error("关闭站台异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user