代码更新:
1.修复要料 2.增加工站配置报表界面
This commit is contained in:
parent
1592fea84d
commit
819eda7da6
|
|
@ -11,7 +11,6 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
|
|
@ -44,14 +43,13 @@ public class JobComponent {
|
|||
*/
|
||||
private final IWorkService workService;
|
||||
|
||||
|
||||
/**
|
||||
* 向Wcs下发任务
|
||||
* 每2秒执行一次
|
||||
*/
|
||||
@Scheduled(fixedDelay = 2000)
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void executeTasks() {
|
||||
public void sendCommonTasks() {
|
||||
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_TASK.getConfigKey());
|
||||
if (StringUtils.isEmpty(sendTask) || !sendTask.equals("1")) {
|
||||
return;
|
||||
|
|
@ -63,6 +61,19 @@ public class JobComponent {
|
|||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拣选任务
|
||||
* 每2秒执行一次
|
||||
*/
|
||||
@Scheduled(fixedDelay = 2000)
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void sendPickTasks() {
|
||||
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_TASK.getConfigKey());
|
||||
if (StringUtils.isEmpty(sendTask) || !sendTask.equals("1")) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// 发送拣选任务
|
||||
wmsJobService.sendPickTasks();
|
||||
|
|
@ -70,6 +81,19 @@ public class JobComponent {
|
|||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重复入库任务
|
||||
* 每2秒执行一次
|
||||
*/
|
||||
@Scheduled(fixedDelay = 2000)
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void solveDuplicateTask() {
|
||||
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_TASK.getConfigKey());
|
||||
if (StringUtils.isEmpty(sendTask) || !sendTask.equals("1")) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// 针对重复入库的任务,发送新的目的地
|
||||
wmsJobService.solveDuplicateTask();
|
||||
|
|
@ -80,11 +104,11 @@ public class JobComponent {
|
|||
}
|
||||
|
||||
/**
|
||||
* 检测工作
|
||||
* 创建工作
|
||||
*/
|
||||
@Scheduled(fixedDelay = 2000)
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void detectWork() {
|
||||
public void createWork() {
|
||||
String startWork = configMap.get(ConfigMapKeyEnum.START_WORK.getConfigKey());
|
||||
if (StringUtils.isEmpty(startWork) || !startWork.equals("1")) {
|
||||
return;
|
||||
|
|
@ -102,6 +126,24 @@ public class JobComponent {
|
|||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("创建工作时发生错误:{}", convertJsonString(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行工作
|
||||
*/
|
||||
@Scheduled(fixedDelay = 2000)
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void doWork() {
|
||||
String startWork = configMap.get(ConfigMapKeyEnum.START_WORK.getConfigKey());
|
||||
if (StringUtils.isEmpty(startWork) || !startWork.equals("1")) {
|
||||
return;
|
||||
}
|
||||
// 轮询工作站台,判断是否需要下发任务
|
||||
List<Stand> stands = standService.list(new LambdaQueryWrapper<Stand>()
|
||||
.eq(Stand::getIsLock, 0).eq(Stand::getStandStatus, 0)
|
||||
.eq(Stand::getStandType, 2));
|
||||
for (Stand workStation : stands) {
|
||||
try {
|
||||
// 执行工作
|
||||
workService.doWork(workStation.getStandId());
|
||||
|
|
|
|||
|
|
@ -12,14 +12,13 @@ import com.wms.entity.app.dto.PageDto;
|
|||
import com.wms.entity.app.dto.StockDto;
|
||||
import com.wms.entity.app.request.DbsQuery;
|
||||
import com.wms.entity.app.request.KateOrdersQuery;
|
||||
import com.wms.entity.app.request.StationConfigQuery;
|
||||
import com.wms.entity.app.request.StockQuery;
|
||||
import com.wms.entity.app.vo.DbsVo;
|
||||
import com.wms.entity.app.vo.KateOrdersVo;
|
||||
import com.wms.entity.app.vo.LocationVo;
|
||||
import com.wms.entity.app.vo.StockVo;
|
||||
import com.wms.entity.app.vo.*;
|
||||
import com.wms.entity.table.KateDBS;
|
||||
import com.wms.entity.table.KateOrders;
|
||||
import com.wms.entity.table.Stock;
|
||||
import com.wms.entity.table.WorkStationConfig;
|
||||
import com.wms.service.KateDBSService;
|
||||
import com.wms.service.KateOrdersService;
|
||||
import com.wms.service.StockService;
|
||||
|
|
@ -172,9 +171,9 @@ public class KateWorkQueryController {
|
|||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(dbsQuery.getDbsId())) {// id为空,不允许执行
|
||||
logger.error("请求的id为空,不允许修改。");
|
||||
logger.error("请求的id为空,不允许删除。");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求的id为空,不允许修改。");
|
||||
rsp.setMessage("请求的id为空,不允许删除。");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
// 删除数据
|
||||
|
|
@ -299,9 +298,9 @@ public class KateWorkQueryController {
|
|||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(kateOrdersQuery.getOrderId())) {// id为空,不允许执行
|
||||
logger.error("请求的id为空,不允许修改。");
|
||||
logger.error("请求的id为空,不允许删除。");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求的id为空,不允许修改。");
|
||||
rsp.setMessage("请求的id为空,不允许删除。");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
// 删除数据
|
||||
|
|
@ -327,4 +326,126 @@ public class KateWorkQueryController {
|
|||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工站配置
|
||||
*/
|
||||
@PostMapping("/getStationConfigs")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getStationConfigs(@RequestBody StationConfigQuery stationConfigQuery) {
|
||||
logger.info("接收到查询工站配置:{},请求ip:{}", convertJsonString(stationConfigQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
Page<WorkStationConfig> page = stationConfigQuery.toMpPage();
|
||||
Page<WorkStationConfig> configsPage = workStationConfigService.page(page, new LambdaQueryWrapper<WorkStationConfig>()
|
||||
.like(StringUtils.isNotEmpty(stationConfigQuery.getWorkStation()), WorkStationConfig::getWorkStation, stationConfigQuery.getWorkStation())
|
||||
.like(StringUtils.isNotEmpty(stationConfigQuery.getSmallBox()), WorkStationConfig::getSmallBox, stationConfigQuery.getSmallBox()));
|
||||
PageDto<StationConfigVo> pageDto = PageDto.of(configsPage, StationConfigVo::of);
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("查询工站配置");
|
||||
response.setReturnData(pageDto);
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("查询工站配置发生异常:{}", convertJsonString(e));
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("查询工站配置发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工站配置
|
||||
*
|
||||
* @param stationConfigQuery 修改参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updateStationConfigs")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "更新工站配置", logMethod = "updateStationConfigs")
|
||||
public String updateStationConfigs(@RequestBody StationConfigQuery stationConfigQuery) {
|
||||
logger.info("接收到更新工站配置请求:{},请求ip:{}", convertJsonString(stationConfigQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(stationConfigQuery.getConfigId())) {// id为空,不允许执行
|
||||
logger.error("请求的id为空,不允许修改。");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求的id为空,不允许修改。");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
boolean updateResult = workStationConfigService.update(new LambdaUpdateWrapper<WorkStationConfig>()
|
||||
.set(WorkStationConfig::getLastUpdateUser, stationConfigQuery.getUserName())
|
||||
.set(WorkStationConfig::getLastUpdateTime, LocalDateTime.now())
|
||||
.set(StringUtils.isNotEmpty(stationConfigQuery.getWorkStation()), WorkStationConfig::getWorkStation, stationConfigQuery.getWorkStation())
|
||||
.set(stationConfigQuery.getStartDateAdjust() != null, WorkStationConfig::getStartDateAdjust, stationConfigQuery.getStartDateAdjust())
|
||||
.eq(WorkStationConfig::getConfigId, stationConfigQuery.getConfigId()));
|
||||
if (updateResult) {
|
||||
logger.info("更新更新工站配置成功。");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新更新工站配置成功。");
|
||||
} else {
|
||||
logger.error("更新更新工站配置失败。");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新更新工站配置失败。");
|
||||
}
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("更新更新工站配置发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新更新工站配置发生异常");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工站配置
|
||||
*
|
||||
* @param stationConfigQuery 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/deleteStationConfigs")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "删除工站配置", logMethod = "deleteStationConfigs")
|
||||
public String deleteStationConfigs(@RequestBody StationConfigQuery stationConfigQuery) {
|
||||
logger.info("接收到删除工站配置请求:{},请求ip:{}", convertJsonString(stationConfigQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(stationConfigQuery.getConfigId())) {// id为空,不允许执行
|
||||
logger.error("请求的id为空,不允许删除。");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求的id为空,不允许删除。");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
// 删除数据
|
||||
if (workStationConfigService.remove(new LambdaQueryWrapper<WorkStationConfig>().eq(WorkStationConfig::getConfigId, stationConfigQuery.getConfigId()))) {
|
||||
// 返回成功
|
||||
logger.info("删除工站配置成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("删除工站配置成功");
|
||||
} else {
|
||||
// 返回失败
|
||||
logger.error("删除工站配置失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("删除工站配置失败");
|
||||
}
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("删除工站配置发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("删除工站配置发生异常");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 工站配置查询
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class StationConfigQuery extends PageQuery {
|
||||
/**
|
||||
* 配置id
|
||||
*/
|
||||
@JsonProperty("configId")
|
||||
private String configId;
|
||||
/**
|
||||
* 工作站台
|
||||
*/
|
||||
@JsonProperty("workStation")
|
||||
private String workStation;
|
||||
/**
|
||||
* 小盒子---对面工单表里面的小工位
|
||||
*/
|
||||
@JsonProperty("smallBox")
|
||||
private String smallBox;
|
||||
/**
|
||||
* 机型
|
||||
*/
|
||||
@JsonProperty("model")
|
||||
private String model;
|
||||
/**
|
||||
* 工位
|
||||
*/
|
||||
@JsonProperty("workCenter")
|
||||
private String workCenter;
|
||||
/**
|
||||
* 工位大盒子
|
||||
*/
|
||||
@JsonProperty("bigBox")
|
||||
private String bigBox;
|
||||
/**
|
||||
* 车辆
|
||||
*/
|
||||
@JsonProperty("vehicle")
|
||||
private String vehicle;
|
||||
/**
|
||||
* 线边架/车位置
|
||||
*/
|
||||
@JsonProperty("vehicleLocation")
|
||||
private String vehicleLocation;
|
||||
/**
|
||||
* 开工时间调整
|
||||
*/
|
||||
@JsonProperty("startDateAdjust")
|
||||
private Integer startDateAdjust = 0;
|
||||
/**
|
||||
* 最近更新时间
|
||||
*/
|
||||
@JsonProperty("lastUpdateTime")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastUpdateTime;
|
||||
/**
|
||||
* 最近更新用户
|
||||
*/
|
||||
@JsonProperty("lastUpdateUser")
|
||||
private String lastUpdateUser;
|
||||
}
|
||||
83
src/main/java/com/wms/entity/app/vo/StationConfigVo.java
Normal file
83
src/main/java/com/wms/entity/app/vo/StationConfigVo.java
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.wms.entity.table.WorkStationConfig;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 工站配置显示类
|
||||
*/
|
||||
@Data
|
||||
public class StationConfigVo {
|
||||
/**
|
||||
* 配置id
|
||||
*/
|
||||
@JsonProperty("configId")
|
||||
private String configId;
|
||||
/**
|
||||
* 工作站台
|
||||
*/
|
||||
@JsonProperty("workStation")
|
||||
private String workStation;
|
||||
/**
|
||||
* 小盒子---对面工单表里面的小工位
|
||||
*/
|
||||
@JsonProperty("smallBox")
|
||||
private String smallBox;
|
||||
/**
|
||||
* 机型
|
||||
*/
|
||||
@JsonProperty("model")
|
||||
private String model;
|
||||
/**
|
||||
* 工位
|
||||
*/
|
||||
@JsonProperty("workCenter")
|
||||
private String workCenter;
|
||||
/**
|
||||
* 工位大盒子
|
||||
*/
|
||||
@JsonProperty("bigBox")
|
||||
private String bigBox;
|
||||
/**
|
||||
* 车辆
|
||||
*/
|
||||
@JsonProperty("vehicle")
|
||||
private String vehicle;
|
||||
/**
|
||||
* 线边架/车位置
|
||||
*/
|
||||
@JsonProperty("vehicleLocation")
|
||||
private String vehicleLocation;
|
||||
/**
|
||||
* 开工时间调整
|
||||
*/
|
||||
@JsonProperty("startDateAdjust")
|
||||
private Integer startDateAdjust = 0;
|
||||
/**
|
||||
* 最近更新时间
|
||||
*/
|
||||
@JsonProperty("lastUpdateTime")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastUpdateTime;
|
||||
/**
|
||||
* 最近更新用户
|
||||
*/
|
||||
@JsonProperty("lastUpdateUser")
|
||||
private String lastUpdateUser;
|
||||
|
||||
/**
|
||||
* 转化为StationConfigVo
|
||||
* @param stationConfigPo 数据库实体
|
||||
* @return 显示实体
|
||||
*/
|
||||
public static StationConfigVo of(WorkStationConfig stationConfigPo) {
|
||||
return BeanUtil.copyProperties(stationConfigPo, StationConfigVo.class);
|
||||
}
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ public class ELocationConfig {
|
|||
@TableField("print_status")
|
||||
private Integer printStatus = 0;
|
||||
/**
|
||||
* 是否打印
|
||||
* 打印次数
|
||||
*/
|
||||
@TableField("print_counts")
|
||||
private Integer printCounts = 0;
|
||||
|
|
|
|||
|
|
@ -337,7 +337,8 @@ public class WmsTaskServiceImplements implements IWmsTaskService {
|
|||
// 查询库存,判断数量是否充足
|
||||
List<Stock> stockList = stockService.list(new LambdaQueryWrapper<Stock>()
|
||||
.eq(Stock::getStockStatus, StockStatus.OK.getCode())
|
||||
.apply("goods_related ->> '$.goodsId' = {0}", goodsId));
|
||||
.apply("goods_related ->> '$.goodsId' = {0}", goodsId)
|
||||
.orderByAsc(Stock::getCreateTime));
|
||||
if (stockList != null && !stockList.isEmpty()) {
|
||||
List<Stock> waitForOutStockList = new ArrayList<>();
|
||||
// 尝试生成出库任务
|
||||
|
|
|
|||
|
|
@ -194,8 +194,8 @@ public class WorkServiceImplements implements IWorkService {
|
|||
List<String> workFlowIds = currentWorkFlowList.stream().map(WorkFlow::getWorkFlowId).distinct().toList();
|
||||
workFlowService.update(new LambdaUpdateWrapper<WorkFlow>()
|
||||
.set(WorkFlow::getWorkStatus, 2)
|
||||
.set(WorkFlow::getFinishTime, LocalDateTime.now())
|
||||
.set(WorkFlow::getOpUser, "库存等原因,系统自动完成")
|
||||
.set(WorkFlow::getFinishTime, LocalDateTime.now())
|
||||
.set(WorkFlow::getOpUser, "库存等原因,系统自动完成")
|
||||
.in(WorkFlow::getWorkFlowId, workFlowIds)
|
||||
.ne(WorkFlow::getWorkStatus, 2));
|
||||
return;
|
||||
|
|
@ -209,9 +209,8 @@ public class WorkServiceImplements implements IWorkService {
|
|||
}
|
||||
// 判断实际库存是否充足
|
||||
List<Stock> stockList = stockService.list(new LambdaQueryWrapper<Stock>()
|
||||
.eq(Stock::getStockStatus, StockStatus.OK.getCode())
|
||||
.apply("goods_related ->> '$.goodsId' = {0}", goodsToStation.getGoodsId())
|
||||
.apply("goods_related ->> '$.remainNum' > 0", goodsToStation.getGoodsId()));
|
||||
.apply("goods_related ->> '$.remainNum' > 0"));
|
||||
if (stockList == null || stockList.isEmpty()) {
|
||||
goodsToStation.setDistributeStatus(3);
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wms.entity.app.dto.StockDto;
|
||||
import com.wms.entity.table.Stock;
|
||||
import com.wms.entity.table.Vehicle;
|
||||
import com.wms.mapper.StockMapper;
|
||||
import com.wms.service.StockService;
|
||||
import com.wms.utils.StringUtils;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ public class UploadStationConfigListener implements ReadListener<StationConfigEx
|
|||
*/
|
||||
@Override
|
||||
public void invoke(StationConfigExcelVo stationConfigExcelVo, AnalysisContext analysisContext) {
|
||||
if (StringUtils.isNotEmpty(stationConfigExcelVo.getWorkStation())) {
|
||||
if (StringUtils.isNotEmpty(stationConfigExcelVo.getWorkStation())
|
||||
&& StringUtils.isNotEmpty(stationConfigExcelVo.getSmallBox())) {
|
||||
// 符合条件的数据
|
||||
cachedDataList.add(stationConfigExcelVo);
|
||||
}
|
||||
|
|
@ -90,11 +91,27 @@ public class UploadStationConfigListener implements ReadListener<StationConfigEx
|
|||
// 存储数据
|
||||
List<WorkStationConfig> stationConfigList = new ArrayList<>();
|
||||
for (StationConfigExcelVo stationConfigExcelVo : cachedDataList) {
|
||||
WorkStationConfig stationConfig = BeanUtil.copyProperties(stationConfigExcelVo, WorkStationConfig.class);
|
||||
stationConfig.setConfigId(generateId("STATION-CONFIG_"));
|
||||
stationConfig.setLastUpdateTime(LocalDateTime.now());
|
||||
stationConfig.setLastUpdateUser(uploadUser);
|
||||
stationConfigList.add(stationConfig);
|
||||
WorkStationConfig oldConfig = workStationConfigService.getOne(new LambdaQueryWrapper<WorkStationConfig>()
|
||||
.eq(WorkStationConfig::getSmallBox, stationConfigExcelVo.getSmallBox())
|
||||
.last("limit 1"));
|
||||
if (oldConfig != null) {
|
||||
oldConfig.setWorkStation(stationConfigExcelVo.getWorkStation());
|
||||
oldConfig.setVehicle(stationConfigExcelVo.getVehicle());
|
||||
oldConfig.setVehicleLocation(stationConfigExcelVo.getVehicleLocation());
|
||||
oldConfig.setStartDateAdjust(stationConfigExcelVo.getStartDateAdjust());
|
||||
oldConfig.setWorkCenter(stationConfigExcelVo.getWorkCenter());
|
||||
oldConfig.setLastUpdateTime(LocalDateTime.now());
|
||||
oldConfig.setLastUpdateUser(uploadUser);
|
||||
oldConfig.setModel(stationConfigExcelVo.getModel());
|
||||
oldConfig.setBigBox(stationConfigExcelVo.getBigBox());
|
||||
stationConfigList.add(oldConfig);
|
||||
} else {
|
||||
WorkStationConfig stationConfig = BeanUtil.copyProperties(stationConfigExcelVo, WorkStationConfig.class);
|
||||
stationConfig.setConfigId(generateId("STATION-CONFIG_"));
|
||||
stationConfig.setLastUpdateTime(LocalDateTime.now());
|
||||
stationConfig.setLastUpdateUser(uploadUser);
|
||||
stationConfigList.add(stationConfig);
|
||||
}
|
||||
}
|
||||
workStationConfigService.saveOrUpdateBatch(stationConfigList);
|
||||
// 打印数量
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.wms.utils.excel.vo.StockExcelVo;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -77,35 +78,47 @@ public class UploadStocksListener implements ReadListener<StockExcelVo> {
|
|||
private void saveData() {
|
||||
List<Stock> stockList = new ArrayList<>();
|
||||
for (StockExcelVo stockExcelVo : cachedDataList) {
|
||||
if (stockService.exists(new LambdaQueryWrapper<Stock>()
|
||||
Stock oldStock = stockService.getOne(new LambdaQueryWrapper<Stock>()
|
||||
.eq(Stock::getVehicleId, stockExcelVo.getVehicleId())
|
||||
.eq(Stock::getLocationId, stockExcelVo.getLocationId())
|
||||
.apply("goods_related ->> '$.goodsId' = {0}", stockExcelVo.getGoodsId()))) {
|
||||
// 重复库存
|
||||
cachedDataList.remove(stockExcelVo);
|
||||
continue;
|
||||
.apply("goods_related ->> '$.goodsId' = {0}", stockExcelVo.getGoodsId())
|
||||
.last("limit 1"));
|
||||
if (oldStock != null) {
|
||||
StockDetailInfo goodsRelated = oldStock.getGoodsRelated();
|
||||
goodsRelated.setGoodsStatus(stockExcelVo.getGoodsStatus());
|
||||
goodsRelated.setRemainNum(stockExcelVo.getRemainNum());
|
||||
oldStock.setGoodsRelated(goodsRelated);
|
||||
oldStock.setLocationId(stockExcelVo.getLocationId());
|
||||
oldStock.setStockStatus(stockExcelVo.getStockStatus());
|
||||
oldStock.setWeight(stockExcelVo.getWeight());
|
||||
oldStock.setNoUseDays(stockExcelVo.getNoUseDays());
|
||||
oldStock.setLastUpdateTime(LocalDateTime.now());
|
||||
oldStock.setIsInventory(stockExcelVo.getIsInventory());
|
||||
oldStock.setInventoryTaskId(stockExcelVo.getInventoryTaskId());
|
||||
stockList.add(oldStock);
|
||||
} else {
|
||||
Stock stock = new Stock();
|
||||
stock.setStockId(generateId("ST_"));
|
||||
stock.setLocationId(stockExcelVo.getLocationId());
|
||||
stock.setVehicleId(stockExcelVo.getVehicleId());
|
||||
stock.setWeight(stockExcelVo.getWeight());
|
||||
stock.setStockStatus(stockExcelVo.getStockStatus());
|
||||
stock.setCreateTime(stockExcelVo.getCreateTime());
|
||||
stock.setLastUpdateTime(stockExcelVo.getLastUpdateTime());
|
||||
stock.setLastUpdateUser(stockExcelVo.getLastUpdateUser());
|
||||
stock.setIsInventory(stockExcelVo.getIsInventory());
|
||||
stock.setInventoryTaskId(stockExcelVo.getInventoryTaskId());
|
||||
stock.setNoUseDays(stockExcelVo.getNoUseDays());
|
||||
// 物料信息
|
||||
StockDetailInfo goodsRelated = new StockDetailInfo();
|
||||
goodsRelated.setGoodsId(stockExcelVo.getGoodsId());
|
||||
goodsRelated.setGoodsName(stockExcelVo.getGoodsName());
|
||||
goodsRelated.setGoodsStatus(stockExcelVo.getGoodsStatus());
|
||||
goodsRelated.setTotalNum(stockExcelVo.getTotalNum());
|
||||
goodsRelated.setRemainNum(stockExcelVo.getRemainNum());
|
||||
stock.setGoodsRelated(goodsRelated);
|
||||
stockList.add(stock);
|
||||
}
|
||||
Stock stock = new Stock();
|
||||
stock.setStockId(generateId("ST_"));
|
||||
stock.setLocationId(stockExcelVo.getLocationId());
|
||||
stock.setVehicleId(stockExcelVo.getVehicleId());
|
||||
stock.setWeight(stockExcelVo.getWeight());
|
||||
stock.setStockStatus(stockExcelVo.getStockStatus());
|
||||
stock.setCreateTime(stockExcelVo.getCreateTime());
|
||||
stock.setLastUpdateTime(stockExcelVo.getLastUpdateTime());
|
||||
stock.setLastUpdateUser(stockExcelVo.getLastUpdateUser());
|
||||
stock.setIsInventory(stockExcelVo.getIsInventory());
|
||||
stock.setInventoryTaskId(stockExcelVo.getInventoryTaskId());
|
||||
stock.setNoUseDays(stockExcelVo.getNoUseDays());
|
||||
// 物料信息
|
||||
StockDetailInfo goodsRelated = new StockDetailInfo();
|
||||
goodsRelated.setGoodsId(stockExcelVo.getGoodsId());
|
||||
goodsRelated.setGoodsName(stockExcelVo.getGoodsName());
|
||||
goodsRelated.setGoodsStatus(stockExcelVo.getGoodsStatus());
|
||||
goodsRelated.setTotalNum(stockExcelVo.getTotalNum());
|
||||
goodsRelated.setRemainNum(stockExcelVo.getRemainNum());
|
||||
stock.setGoodsRelated(goodsRelated);
|
||||
stockList.add(stock);
|
||||
}
|
||||
stockService.saveBatch(stockList);
|
||||
SAVE_COUNT += stockList.size();
|
||||
|
|
|
|||
|
|
@ -93,11 +93,6 @@ public class GoodsExcelVo {
|
|||
*/
|
||||
@ExcelProperty("Number of kanban")
|
||||
private BigDecimal kanbanNum;
|
||||
/**
|
||||
* 看板详细信息
|
||||
*/
|
||||
@ExcelProperty("看板")
|
||||
private List<KanbanEntity> kanbanList;
|
||||
/**
|
||||
* 补货点
|
||||
*/
|
||||
|
|
|
|||
15
src/main/java/com/wms/utils/excel/vo/KanbanExcelVo.java
Normal file
15
src/main/java/com/wms/utils/excel/vo/KanbanExcelVo.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package com.wms.utils.excel.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 看板导入
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class KanbanExcelVo extends GoodsExcelVo {
|
||||
@ExcelProperty("KANBAN#1")
|
||||
private String KANBAN1;
|
||||
}
|
||||
|
|
@ -8,20 +8,20 @@ spring:
|
|||
# 主库
|
||||
master:
|
||||
# 卡特数据库服务器
|
||||
url: jdbc:mysql://10.90.36.71:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
username: developer
|
||||
password: developer
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://10.90.36.71:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
# username: developer
|
||||
# password: developer
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 宝开服务器--内网
|
||||
# url: jdbc:mysql://192.168.3.254:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
# username: coder
|
||||
# password: coder
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# # 本地环境
|
||||
# url: jdbc:mysql://localhost:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
# username: developer
|
||||
# password: developer
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
username: developer
|
||||
password: developer
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 从库
|
||||
# slave_1:
|
||||
# url: jdbc:mysql://localhost:3306/wms_aaa?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user