代码更新
This commit is contained in:
parent
8fd1c50722
commit
f567677685
|
|
@ -11,9 +11,7 @@ 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.Vehicle;
|
||||
import com.wms.service.ConfigService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
|
|
|
|||
|
|
@ -10,10 +10,8 @@ import com.wms.constants.enums.ResponseCode;
|
|||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.dto.GoodsDto;
|
||||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.request.ELocationQuery;
|
||||
import com.wms.entity.app.request.GoodsQuery;
|
||||
import com.wms.entity.app.vo.GoodsVo;
|
||||
import com.wms.entity.table.ETagLocation;
|
||||
import com.wms.entity.table.Goods;
|
||||
import com.wms.service.GoodsService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
|
|
@ -39,6 +37,7 @@ import static com.wms.utils.StringUtils.convertJsonString;
|
|||
|
||||
/**
|
||||
* WMS物料控制类
|
||||
*
|
||||
* @author 梁州
|
||||
* @date 2023/3/9
|
||||
*/
|
||||
|
|
@ -64,7 +63,7 @@ public class GoodsController {
|
|||
@PostMapping("/getGoodsInfoByPage")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getGoodsInfoByPage(@RequestBody GoodsQuery goodsQuery){
|
||||
public String getGoodsInfoByPage(@RequestBody GoodsQuery goodsQuery) {
|
||||
logger.info("接收到查询物料数据请求:{},请求ip:{}", convertJsonString(goodsQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
|
|
@ -134,6 +133,7 @@ public class GoodsController {
|
|||
|
||||
/**
|
||||
* 查询物料信息
|
||||
*
|
||||
* @param goodsQuery 参数
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -167,6 +167,7 @@ public class GoodsController {
|
|||
|
||||
/**
|
||||
* 自动补全物料编码信息---根据物料编号查询物料信息
|
||||
*
|
||||
* @param goodsQuery 参数
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -261,8 +262,8 @@ public class GoodsController {
|
|||
try {
|
||||
List<Goods> goodsList = new ArrayList<>();
|
||||
for (int i = 1; i <= 250; i++) {
|
||||
Goods goods = new Goods();
|
||||
goods.setGoodsId("ASRS" + StringUtils.padLeft(String.valueOf(i), 6, "0"));
|
||||
Goods goods = new Goods();
|
||||
goods.setGoodsId("ASRS" + StringUtils.padLeft(String.valueOf(i), 6, "0"));
|
||||
goods.setGoodsName("测试物料" + StringUtils.padLeft(String.valueOf(i), 6, "0"));
|
||||
goods.setGoodsType("直接物料");
|
||||
goods.setGoodsUnit("PC");
|
||||
|
|
@ -277,7 +278,7 @@ public class GoodsController {
|
|||
goods.setFeedingType("PULL");
|
||||
goods.setLastUpdateTime(LocalDateTime.now());
|
||||
goods.setLastUpdateUser("WMS");
|
||||
goodsList.add(goods);
|
||||
goodsList.add(goods);
|
||||
}
|
||||
goodsService.saveOrUpdateBatch(goodsList);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class JobComponent {
|
|||
* 每2秒执行一次
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(fixedDelay = 2000)
|
||||
// @Scheduled(fixedDelay = 2000)
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void executeTasks() {
|
||||
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_TASK.getConfigKey());
|
||||
|
|
@ -85,7 +85,7 @@ public class JobComponent {
|
|||
* 检测工作
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(fixedDelay = 2000)
|
||||
// @Scheduled(fixedDelay = 2000)
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void detectWork() {
|
||||
String startWork = configMap.get(ConfigMapKeyEnum.START_WORK.getConfigKey());
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.wms.entity.app.request.ELocationQuery;
|
|||
import com.wms.entity.app.request.LocationQuery;
|
||||
import com.wms.entity.app.request.VehicleQuery;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.vo.LocationVo;
|
||||
import com.wms.entity.app.vo.VehicleVO;
|
||||
import com.wms.entity.table.ETagLocation;
|
||||
import com.wms.entity.table.Location;
|
||||
|
|
@ -66,76 +67,40 @@ public class LocationController {
|
|||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
|
||||
/**
|
||||
* 查询库位信息
|
||||
* @param locationQuery 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/getLocationsByPage")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "查询库位信息", logMethod = "getLocationsByPage")
|
||||
public String getLocationsByPage(@RequestBody LocationQuery locationQuery) {
|
||||
logger.info("接收到查询库位信息请求:{},请求ip:{}", convertJsonString(locationQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
Page<Location> page = locationQuery.toMpPage();
|
||||
Page<Location> locationPage = locationService.page(page, new LambdaQueryWrapper<Location>()
|
||||
.like(StringUtils.isNotEmpty(locationQuery.getLocationId()), Location::getLocationId, locationQuery.getLocationId())
|
||||
.like(StringUtils.isNotEmpty(locationQuery.getVehicleId()), Location::getVehicleId, locationQuery.getVehicleId())
|
||||
.eq(locationQuery.getLocationStatus() != null, Location::getLocationStatus, locationQuery.getLocationStatus())
|
||||
.eq(locationQuery.getIsLock() != null, Location::getIsLock, locationQuery.getIsLock()));
|
||||
|
||||
// /**
|
||||
// * 查询库位
|
||||
// *
|
||||
// * @param locationQuery 查询参数
|
||||
// * @return 结果
|
||||
// */
|
||||
// @PostMapping("/getLocations")
|
||||
// @ResponseBody
|
||||
// @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
// @MyLog(logTitle = "删除物料信息", logMethod = "getLocations")
|
||||
// public String getLocations(@RequestBody LocationQuery locationQuery) {
|
||||
// // 创建响应信息
|
||||
// ResponseEntity rsp = new ResponseEntity();
|
||||
// try {
|
||||
// // 查询出所有符合条件的库位
|
||||
// List<LocationDto> locations = locationService.selLocations(location);
|
||||
// if (locations.size() < 1) {
|
||||
// logger.error("查询库位发生错误:库位不存在");
|
||||
// // 返回错误
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage("查询库位发生错误:库位不存在");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// List<RowLocation> rowLocations = new LinkedList<>();
|
||||
// // 查找到最大的排
|
||||
// locations.sort(Comparator.comparing(LocationDto::getQueue).reversed());
|
||||
// int maxRow = locations.get(0).getQueue();
|
||||
// // 按排查找库位
|
||||
// for (int i = 0; i < maxRow; i++) {
|
||||
// int finalI = i;
|
||||
// List<LocationDto> currentRowLocations = new ArrayList<>(locations.stream()
|
||||
// .filter(l -> l.getQueue().equals(finalI + 1))
|
||||
// .toList());
|
||||
// // 先查找每一层的库位
|
||||
// List<LayerLocation> layerLocations = new LinkedList<>();
|
||||
// // 找到这一排最大的层
|
||||
// currentRowLocations.sort(Comparator.comparing(LocationDto::getLayer).reversed());
|
||||
// int maxLayer = currentRowLocations.get(0).getLayer();
|
||||
// // 按照每一列查找库位
|
||||
// for (int j = 0; j < maxLayer; j++) {
|
||||
// int finalJ = j;
|
||||
// List<LocationDto> currentLayerLocations = currentRowLocations.stream()
|
||||
// .filter(l -> l.getLayer().equals(finalJ + 1))
|
||||
// .toList();
|
||||
// LayerLocation tempLayerLocation = new LayerLocation();
|
||||
// tempLayerLocation.setLayer(finalJ + 1);
|
||||
// tempLayerLocation.setCurrentColLocations(currentLayerLocations);
|
||||
// layerLocations.add(tempLayerLocation);
|
||||
// }
|
||||
// RowLocation tempRowLocation = new RowLocation();
|
||||
// tempRowLocation.setRow(finalI + 1);
|
||||
// tempRowLocation.setCurrentLayerLocations(layerLocations);
|
||||
// rowLocations.add(tempRowLocation);
|
||||
// }
|
||||
// logger.info("查询库位数据成功,库区:{}", location.getAreaId());
|
||||
// // 设置最终数据
|
||||
// rsp.setReturnData(rowLocations);
|
||||
// // 返回成功
|
||||
// rsp.setCode(ResponseCode.OK.getCode());
|
||||
// rsp.setMessage("查询库位成功");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// } catch (Exception e) {
|
||||
// logger.info("查询库位发生错误:{}", e.getMessage());
|
||||
// // 返回其他异常
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage(e.getMessage());
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// }
|
||||
PageDto<LocationVo> pageDto = PageDto.of(locationPage, location -> BeanUtil.copyProperties(location, LocationVo.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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新库位信息
|
||||
|
|
@ -321,8 +286,8 @@ public class LocationController {
|
|||
Page<Vehicle> page = vehicleQuery.toMpPage();
|
||||
Page<Vehicle> vehiclePage = vehicleService.page(page, new LambdaQueryWrapper<Vehicle>()
|
||||
.like(StringUtils.isNotEmpty(vehicleQuery.getVehicleId()), Vehicle::getVehicleId, vehicleQuery.getVehicleId())
|
||||
.eq(vehicleQuery.getVehicleStatus() == null, Vehicle::getVehicleStatus, vehicleQuery.getVehicleStatus())
|
||||
.eq(vehicleQuery.getIsEmpty() == null, Vehicle::getIsEmpty, vehicleQuery.getIsEmpty()));
|
||||
.eq(vehicleQuery.getVehicleStatus() != null, Vehicle::getVehicleStatus, vehicleQuery.getVehicleStatus())
|
||||
.eq(vehicleQuery.getIsEmpty() != null, Vehicle::getIsEmpty, vehicleQuery.getIsEmpty()));
|
||||
|
||||
PageDto<VehicleVO> pageDto = PageDto.of(vehiclePage, vehicle -> BeanUtil.copyProperties(vehicle, VehicleVO.class));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
|
@ -7,45 +8,56 @@ public class LocationVo {
|
|||
/**
|
||||
* 库位编号
|
||||
*/
|
||||
@JsonProperty("locationId")
|
||||
private String locationId;
|
||||
/**
|
||||
* 库区编号
|
||||
*/
|
||||
@JsonProperty("areaId")
|
||||
private Integer areaId;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@JsonProperty("equipmentId")
|
||||
private Integer equipmentId;
|
||||
/**
|
||||
* 库位类型
|
||||
*/
|
||||
@JsonProperty("locationType")
|
||||
private Integer locationType;
|
||||
/**
|
||||
* 排
|
||||
*/
|
||||
@JsonProperty("wRow")
|
||||
private Integer wRow;
|
||||
/**
|
||||
* 列
|
||||
*/
|
||||
@JsonProperty("wCol")
|
||||
private Integer wCol;
|
||||
/**
|
||||
* 层
|
||||
*/
|
||||
@JsonProperty("wLayer")
|
||||
private Integer wLayer;
|
||||
/**
|
||||
* 深度
|
||||
*/
|
||||
@JsonProperty("wDepth")
|
||||
private Integer wDepth;
|
||||
/**
|
||||
* 是否锁定
|
||||
*/
|
||||
@JsonProperty("isLock")
|
||||
private Integer isLock;
|
||||
/**
|
||||
* 库位状态
|
||||
*/
|
||||
@JsonProperty("locationStatus")
|
||||
private Integer locationStatus;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@JsonProperty("vehicleId")
|
||||
private String vehicleId;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user