代码更新:
1. 修改看板需求 2. 增加整理大盒子时的排序 3. 增加电子标签库位监控功能
This commit is contained in:
parent
77fc18f310
commit
3ab306eaf4
|
|
@ -68,6 +68,7 @@ public class ExcelController {
|
|||
private final GoodsService goodsService;// 物料服务
|
||||
private final WorkStationConfigService workStationConfigService;// 工站配置服务
|
||||
private final WorkSummaryService workSummaryService;// 工作分析服务
|
||||
private final KanbanService kanbanService;// 看板服务
|
||||
|
||||
private final List<String> uploadFileHashStringList = new ArrayList<>();
|
||||
|
||||
|
|
@ -265,6 +266,45 @@ public class ExcelController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入看板
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 导入结果
|
||||
*/
|
||||
@PostMapping("/uploadKanban")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String uploadKanban(@RequestPart("file") MultipartFile file, @RequestPart("obj") FileVo fileVo) {
|
||||
logger.info("导入物料,请求ip:{},文件详情:{}", getIpAddr(servletRequest), convertJsonString(fileVo));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
// 判断是否重复导入
|
||||
if (uploadFileHashStringList.contains(fileVo.getHash())) {
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("请勿导入相同文件。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
uploadFileHashStringList.add(fileVo.getHash());
|
||||
// 导入excel
|
||||
EasyExcel.read(file.getInputStream(), GoodsExcelVo.class, new UploadGoodsListener(goodsService, fileVo.getUserName())).sheet("基本信息").doRead();
|
||||
// 添加导入记录
|
||||
uploadRecordService.save(UploadRecord.ofFileVo(fileVo, "GOODS"));
|
||||
uploadFileHashStringList.remove(fileVo.getHash());
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("导入物料成功。");
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
logger.error("导入物料异常:{}", e.getMessage());
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
uploadFileHashStringList.remove(fileVo.getHash());
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("导入物料异常:" + e.getMessage());
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入工站配置
|
||||
*
|
||||
|
|
@ -337,6 +377,36 @@ public class ExcelController {
|
|||
.doWrite(stockPoList.stream().map(StockExcelVo::of).toList());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 导出CLC看板需求
|
||||
// *
|
||||
// * @param response 请求
|
||||
// */
|
||||
// @PostMapping("/downloadClcKanbanRequirementExcel")
|
||||
// @ResponseBody
|
||||
// public void downloadClcKanbanRequirementExcel(@RequestBody KanbanRequest request, HttpServletResponse response) throws IOException {
|
||||
// logger.info("导出CLC看板需求,筛选参数:{},请求ip:{}", convertJsonString(request), getIpAddr(servletRequest));
|
||||
// //设置响应格式
|
||||
// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
//// response.setContentType("application/vnd.ms-excel"); //文件扩展名为excel格式
|
||||
// response.setCharacterEncoding("utf-8");
|
||||
// // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
// String fileName = URLEncoder.encode("CLC看板需求", StandardCharsets.UTF_8).replaceAll("\\+", "%20");
|
||||
// response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
// // 内容样式
|
||||
// HorizontalCellStyleStrategy horizontalCellStyleStrategy = ExcelContentStyle.getContentStyle();
|
||||
// // 获取看板需求
|
||||
// List<Kanban> KanbanList = kanbanService.list(new LambdaQueryWrapper<Kanban>()
|
||||
// .eq(StringUtils.isNotEmpty(request.getGoodsId()), Kanban::getGoodsId, request.getGoodsId())
|
||||
// .eq(request.getKanbanStatus() != null, Kanban::getKanbanStatus, request.getKanbanStatus()));
|
||||
//
|
||||
// EasyExcel.write(response.getOutputStream(), ClcKanbanExcelVo.class)
|
||||
// .excelType(ExcelTypeEnum.XLSX)
|
||||
// .registerWriteHandler(horizontalCellStyleStrategy)
|
||||
// .sheet("CLC看板需求")
|
||||
// .doWrite(KanbanList.stream().map(ClcKanbanExcelVo::of).toList());
|
||||
// }
|
||||
|
||||
/**
|
||||
* 导出CLC看板需求
|
||||
*
|
||||
|
|
|
|||
|
|
@ -9,12 +9,14 @@ import com.wms.constants.enums.ResponseCode;
|
|||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.dto.StockOfGoodsDto;
|
||||
import com.wms.entity.app.dto.extend.KanbanEntity;
|
||||
import com.wms.entity.app.request.*;
|
||||
import com.wms.entity.app.vo.*;
|
||||
import com.wms.entity.table.*;
|
||||
import com.wms.service.*;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import com.wms.utils.excel.vo.ClcKanbanRequirementExcelVo;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -30,8 +32,8 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
|
|
@ -71,6 +73,14 @@ public class KateWorkQueryController {
|
|||
* 工作总结服务
|
||||
*/
|
||||
private final WorkSummaryService workSummaryService;
|
||||
/**
|
||||
* 物料服务
|
||||
*/
|
||||
private final GoodsService goodsService;
|
||||
/**
|
||||
* 看板服务
|
||||
*/
|
||||
private final KanbanService kanbanService;
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
|
|
@ -547,6 +557,87 @@ public class KateWorkQueryController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成CLC看板需求
|
||||
*/
|
||||
@PostMapping("/genClcKanbanRequirement")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "生成CLC看板需求", logMethod = "genClcKanbanRequirement")
|
||||
public String genClcKanbanRequirement(@RequestBody KanbanRequest request) {
|
||||
logger.info("生成CLC看板需求:{},请求ip:{}", convertJsonString(request), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
// 查询所有pull的物料
|
||||
List<Goods> pullGoodsList = goodsService.list(new LambdaQueryWrapper<Goods>()
|
||||
.eq(Goods::getFeedingType, "PULL"));
|
||||
if (pullGoodsList == null || pullGoodsList.isEmpty()) {
|
||||
logger.error("没有PULL的物料信息。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("没有PULL的物料信息。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 查询所有的库存信息
|
||||
List<StockOfGoodsDto> stockOfGoodsDtoList = stockService.selectSumOfGoods("");
|
||||
// 将库存信息转换为Map
|
||||
Map<String, StockOfGoodsDto> stockOfGoodsDtoMap = stockOfGoodsDtoList.stream().collect(Collectors.toMap(StockOfGoodsDto::getGoodsId, stockOfGoodsDto -> stockOfGoodsDto));
|
||||
List<Kanban> dealKanbanList = new ArrayList<>();
|
||||
for (Goods pullGoods : pullGoodsList) {
|
||||
if (pullGoods.getKanbanList() == null || pullGoods.getKanbanList().isEmpty()) {
|
||||
// 没有看板数据,不需要生成看板需求
|
||||
continue;
|
||||
}
|
||||
// 目标数量
|
||||
BigDecimal targetNum = pullGoods.getKanbanNum().multiply(pullGoods.getQuantityPerKanban());
|
||||
BigDecimal remainNum = BigDecimal.ZERO;
|
||||
// 判断是否包含请求物料
|
||||
if (stockOfGoodsDtoMap.containsKey(pullGoods.getGoodsId())) {
|
||||
// 筛选出当前库存
|
||||
StockOfGoodsDto stockOfGoodsDto = stockOfGoodsDtoMap.get(pullGoods.getGoodsId());
|
||||
remainNum = stockOfGoodsDto.getRemainNumSum();
|
||||
}
|
||||
// 计算需要多少个看板
|
||||
BigDecimal needKanbanQuantity = targetNum.subtract(remainNum).divide(pullGoods.getQuantityPerKanban(), 0, RoundingMode.FLOOR);
|
||||
// 看板表中当前物料的所有看板
|
||||
List<Kanban> kanbanList = kanbanService.list(new LambdaQueryWrapper<Kanban>()
|
||||
.eq(Kanban::getGoodsId, pullGoods.getGoodsId())
|
||||
.orderByAsc(Kanban::getKanbanStatus)
|
||||
.orderByAsc(Kanban::getLastPullTime));
|
||||
List<Kanban> emptyKanbanList = kanbanList.stream().filter(kanban -> kanban.getKanbanStatus() == 0).toList();
|
||||
// 扣除之前就有的空看板
|
||||
needKanbanQuantity = needKanbanQuantity.subtract(BigDecimal.valueOf(emptyKanbanList.size()));
|
||||
// 之前的满看板
|
||||
List<Kanban> fullKanbanList = kanbanList.stream().filter(kanban -> kanban.getKanbanStatus() == 1).toList();
|
||||
for (Kanban kanban : fullKanbanList) {
|
||||
if (needKanbanQuantity.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
break;
|
||||
}
|
||||
kanban.setKanbanStatus(0);
|
||||
kanban.setLastRequestTime(LocalDateTime.now());
|
||||
kanban.setLastRequestUser(request.getUserName());
|
||||
// 添加更新列表
|
||||
dealKanbanList.add(kanban);
|
||||
// 更新需求看板的数量
|
||||
needKanbanQuantity = needKanbanQuantity.subtract(BigDecimal.ONE);
|
||||
}
|
||||
}
|
||||
// 更新看板表
|
||||
kanbanService.updateBatchById(dealKanbanList);
|
||||
|
||||
logger.info("生成CLC看板需求成功。");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("生成CLC看板需求成功。");
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("生成CLC看板需求发生异常:{}", convertJsonString(e));
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("生成CLC看板需求发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工作流
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -468,59 +468,26 @@ public class LocationController {
|
|||
rsp.setMessage("缺少库位号");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
|
||||
// 判断拣货状态的变更
|
||||
if (eLocationQuery.getPickStatus() != null) {
|
||||
// 查询原来的电子标签库位信息
|
||||
ETagLocation eTagLocationBefore = etagLocationService.getOne(new LambdaQueryWrapper<ETagLocation>()
|
||||
.eq(ETagLocation::getELocationId, eLocationQuery.getELocationId()).last("limit 1"));
|
||||
if (Objects.equals(eTagLocationBefore.getPickStatus(), eLocationQuery.getPickStatus())) {
|
||||
// 返回失败
|
||||
logger.error("请勿重复更新拣货状态。");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请勿重复更新拣货状态。");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
if (eLocationQuery.getPickStatus() == 1) {
|
||||
// 如果要设定为拣货中,需设定其他信息
|
||||
// TODO
|
||||
// if (StringUtils.isEmpty(eLocationQuery.getVehicleNo())
|
||||
// || ) {
|
||||
//
|
||||
// }
|
||||
} else if (eLocationQuery.getPickStatus() == 0) {
|
||||
// 此时要模拟拍灯反馈
|
||||
WcsETaskFeedbackRequest wcsETaskFeedbackRequest = new WcsETaskFeedbackRequest();
|
||||
wcsETaskFeedbackRequest.setLocation(eTagLocationBefore.getELocationId());
|
||||
wcsETaskFeedbackRequest.setTaskId(eTagLocationBefore.getTaskId());
|
||||
wcsETaskFeedbackRequest.setTaskType(eTagLocationBefore.getTaskType());
|
||||
wcsETaskFeedbackRequest.setVehicleNo(eTagLocationBefore.getVehicleNo());
|
||||
wcsETaskFeedbackRequest.setConfirmNum(eLocationQuery.getConfirmNum() != null ? eLocationQuery.getConfirmNum() : eTagLocationBefore.getNeedNum());
|
||||
wcsETaskFeedbackRequest.setNeedNum(eTagLocationBefore.getNeedNum());
|
||||
wcsETaskFeedbackRequest.setUserName(eLocationQuery.getUserName());
|
||||
ResponseEntity result = JSON.parseObject(taskController.getETaskFeedBack(wcsETaskFeedbackRequest), ResponseEntity.class);
|
||||
if (result != null && Objects.equals(result.getCode(), ResponseCode.OK.getCode())) {
|
||||
logger.info("更新电子标签库位拣货状态成功。");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新电子标签库位拣货状态成功。");
|
||||
} else {
|
||||
logger.error("更新电子标签库位拣货状态失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(result == null ? "更新电子标签库位拣货状态失败" : "更新电子标签库位拣货状态失败," + result.getMessage());
|
||||
}
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
LambdaUpdateWrapper<ETagLocation> updateWrapper = new LambdaUpdateWrapper<ETagLocation>()
|
||||
.set(eLocationQuery.getELocationStatus() != null, ETagLocation::getELocationStatus, eLocationQuery.getELocationStatus())
|
||||
.set(eLocationQuery.getPickStatus() != null, ETagLocation::getPickStatus, eLocationQuery.getPickStatus())
|
||||
.eq(ETagLocation::getELocationId, eLocationQuery.getELocationId());
|
||||
if (etagLocationService.update(updateWrapper)) {
|
||||
// 更新成功
|
||||
logger.info("更新电子标签库位信息成功。");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新电子标签库位信息成功。");
|
||||
} else {
|
||||
LambdaUpdateWrapper<ETagLocation> updateWrapper = new LambdaUpdateWrapper<ETagLocation>()
|
||||
.set(eLocationQuery.getELocationStatus() != null, ETagLocation::getELocationStatus, eLocationQuery.getELocationStatus())
|
||||
.set(eLocationQuery.getPickStatus() != null, ETagLocation::getPickStatus, eLocationQuery.getPickStatus());
|
||||
// 更新失败
|
||||
logger.error("更新电子标签库位信息失败。");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新电子标签库位信息失败。");
|
||||
}
|
||||
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("更新载具信息发生异常:{}", convertJsonString(e));
|
||||
logger.error("更新载具信息发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新载具信息发生异常");
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -148,6 +149,10 @@ public class TaskController {
|
|||
* 库存更新服务
|
||||
*/
|
||||
private final IStockUpdateRecordService stockUpdateRecordService;
|
||||
/**
|
||||
* 看板服务
|
||||
*/
|
||||
private final KanbanService kanbanService;
|
||||
/**
|
||||
* 日志服务
|
||||
*/
|
||||
|
|
@ -362,6 +367,30 @@ public class TaskController {
|
|||
stockService.save(newStock);
|
||||
stockUpdateRecordService.addStockUpdateRecord(null, newStock, StockUpdateReasonEnum.ADD_IN.getReason(), inTask.getUserName(), BigDecimal.ZERO);
|
||||
}
|
||||
// 消除看板
|
||||
Goods goods = goodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, inTask.getGoodsRelated().getGoodsId()).last("limit 1"));
|
||||
if (goods != null && goods.getFeedingType().equals("PULL")) {
|
||||
if (goods.getKanbanList() != null && !goods.getKanbanList().isEmpty()) {
|
||||
BigDecimal kanbanQuantity = inTask.getGoodsRelated().getOpNum().divide(goods.getQuantityPerKanban(), 0, RoundingMode.FLOOR);
|
||||
// 查这个料的看板需求
|
||||
List<Kanban> waitForUpdateKanban = new ArrayList<>();
|
||||
List<Kanban> kanbanList = kanbanService.list(new LambdaQueryWrapper<Kanban>()
|
||||
.eq(Kanban::getGoodsId, goods.getGoodsId())
|
||||
.eq(Kanban::getKanbanStatus, 0)
|
||||
.orderByAsc(Kanban::getLastPullTime));
|
||||
for (Kanban kanban : kanbanList) {
|
||||
if (kanbanQuantity.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
break;
|
||||
}
|
||||
kanban.setKanbanStatus(1);
|
||||
kanban.setLastPullTime(LocalDateTime.now());
|
||||
waitForUpdateKanban.add(kanban);
|
||||
kanbanQuantity = kanbanQuantity.subtract(BigDecimal.ONE);
|
||||
}
|
||||
// 更新看板信息
|
||||
kanbanService.updateBatchById(waitForUpdateKanban);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新库存状态
|
||||
|
|
@ -1987,14 +2016,6 @@ public class TaskController {
|
|||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
// 验证载具号是否重复入库
|
||||
if (vehicleService.exists(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, requestBackQuery.getVehicleId())
|
||||
.and(wrapper -> wrapper.eq(Vehicle::getVehicleStatus, VehicleStatus.ON.getCode())))) {
|
||||
logger.error("当前箱子{}已在库中,无法回库。", requestBackQuery.getVehicleId());
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("当前箱子" + requestBackQuery.getVehicleId() + "已在库中,无法回库。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 判断当前载具是否有回库任务
|
||||
boolean hasBackTask = taskService.exists(new LambdaQueryWrapper<Task>()
|
||||
.eq(Task::getVehicleId, requestBackQuery.getVehicleId())
|
||||
|
|
@ -2110,7 +2131,8 @@ public class TaskController {
|
|||
|
||||
public String requestALocation(String vehicleId) {
|
||||
String nextLocationId = "";
|
||||
for (int i = 0; i < locationService.count(new LambdaQueryWrapper<Location>().eq(Location::getLocationStatus, LocationStatus.EMPTY.getCode())); i++) {
|
||||
int emptyLocationSize = (int) locationService.count(new LambdaQueryWrapper<Location>().eq(Location::getLocationStatus, LocationStatus.EMPTY.getCode()));
|
||||
for (int i = 0; i < emptyLocationSize; i++) {
|
||||
Map<String, String> resultMap = locationService.getOneLocation("", "");
|
||||
if (resultMap.isEmpty() || !resultMap.containsKey("nextLocationId")) {
|
||||
return "";
|
||||
|
|
@ -2428,7 +2450,19 @@ public class TaskController {
|
|||
}
|
||||
// 查找到所有的工单
|
||||
List<String> orderIds = eConfigLastList.stream().map(ELocationConfigLast::getWorkOrder).distinct().toList();
|
||||
List<String> toBeLightedOrders = orderIds.stream().skip((long) (sortBoxRequest.getOrderOfOrders() - 1) * orderQuantity).limit(orderQuantity).toList();
|
||||
// 利用DBS对这些工单id进行排序
|
||||
List<KateDBS> kateDBSList = kateDBSService.list(new LambdaQueryWrapper<KateDBS>()
|
||||
.in(KateDBS::getWorkOrder, orderIds)
|
||||
.orderByAsc(KateDBS::getWorkSequence));
|
||||
if (kateDBSList == null || kateDBSList.isEmpty()) {
|
||||
logger.error("DBS查询错误,请检查DBS清单数据。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("DBS查询错误,请检查DBS清单数据。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 查询到这些工单的dbs
|
||||
List<String> orderedOrdersIds = kateDBSList.stream().map(KateDBS::getWorkOrder).distinct().toList();
|
||||
List<String> toBeLightedOrders = orderedOrdersIds.stream().skip((long) (sortBoxRequest.getOrderOfOrders() - 1) * orderQuantity).limit(orderQuantity).toList();
|
||||
// 生成亮灯数据
|
||||
if (!toBeLightedOrders.isEmpty()) {
|
||||
for (ELocationConfigLast eConfigLast : eConfigLastList) {
|
||||
|
|
|
|||
57
src/main/java/com/wms/entity/app/request/KanbanRequest.java
Normal file
57
src/main/java/com/wms/entity/app/request/KanbanRequest.java
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 看板请求
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class KanbanRequest extends PageQuery {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("recordId")
|
||||
private String recordId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@JsonProperty("goodsId")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 看板id
|
||||
*/
|
||||
@JsonProperty("kanbanId")
|
||||
private String kanbanId;
|
||||
/**
|
||||
* 看板状态
|
||||
* 0:空
|
||||
* 1:满
|
||||
*/
|
||||
@JsonProperty("kanbanStatus")
|
||||
private Integer kanbanStatus;
|
||||
/**
|
||||
* 上次补货时间
|
||||
*/
|
||||
@JsonProperty("lastPullTime")
|
||||
private LocalDateTime lastPullTime;
|
||||
/**
|
||||
* 上次补货人员
|
||||
*/
|
||||
@JsonProperty("lastPullUser")
|
||||
private String lastPullUser;
|
||||
/**
|
||||
* 上次请求看板时间
|
||||
*/
|
||||
@JsonProperty("lastRequestTime")
|
||||
private LocalDateTime lastRequestTime;
|
||||
/**
|
||||
* 上次请求看板用户
|
||||
*/
|
||||
@JsonProperty("lastRequestUser")
|
||||
private String lastRequestUser;
|
||||
}
|
||||
55
src/main/java/com/wms/entity/app/vo/KanbanVo.java
Normal file
55
src/main/java/com/wms/entity/app/vo/KanbanVo.java
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 看板显示类
|
||||
*/
|
||||
@Data
|
||||
public class KanbanVo {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonProperty("recordId")
|
||||
private String recordId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@JsonProperty("goodsId")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 看板id
|
||||
*/
|
||||
@JsonProperty("kanbanId")
|
||||
private String kanbanId;
|
||||
/**
|
||||
* 看板状态
|
||||
* 0:空
|
||||
* 1:满
|
||||
*/
|
||||
@JsonProperty("kanbanStatus")
|
||||
private Integer kanbanStatus;
|
||||
/**
|
||||
* 上次补货时间
|
||||
*/
|
||||
@JsonProperty("lastPullTime")
|
||||
private LocalDateTime lastPullTime;
|
||||
/**
|
||||
* 上次补货人员
|
||||
*/
|
||||
@JsonProperty("lastPullUser")
|
||||
private String lastPullUser;
|
||||
/**
|
||||
* 上次请求看板时间
|
||||
*/
|
||||
@JsonProperty("lastRequestTime")
|
||||
private LocalDateTime lastRequestTime;
|
||||
/**
|
||||
* 上次请求看板用户
|
||||
*/
|
||||
@JsonProperty("lastRequestUser")
|
||||
private String lastRequestUser;
|
||||
}
|
||||
58
src/main/java/com/wms/entity/table/Kanban.java
Normal file
58
src/main/java/com/wms/entity/table/Kanban.java
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
package com.wms.entity.table;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 看板表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "tbl_app_kanban", autoResultMap = true)
|
||||
public class Kanban {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId("record_id")
|
||||
private String recordId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@TableField("goods_id")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 看板id
|
||||
*/
|
||||
@TableField("kanban_id")
|
||||
private String kanbanId;
|
||||
/**
|
||||
* 看板状态
|
||||
* 0:空
|
||||
* 1:满
|
||||
*/
|
||||
@TableField("kanban_status")
|
||||
private Integer kanbanStatus;
|
||||
/**
|
||||
* 上次补货时间
|
||||
*/
|
||||
@TableField("last_pull_time")
|
||||
private LocalDateTime lastPullTime;
|
||||
/**
|
||||
* 上次补货人员
|
||||
*/
|
||||
@TableField("last_pull_user")
|
||||
private String lastPullUser;
|
||||
/**
|
||||
* 上次请求看板时间
|
||||
*/
|
||||
@TableField("last_request_time")
|
||||
private LocalDateTime lastRequestTime;
|
||||
/**
|
||||
* 上次请求看板用户
|
||||
*/
|
||||
@TableField("last_request_user")
|
||||
private String lastRequestUser;
|
||||
}
|
||||
12
src/main/java/com/wms/mapper/KanbanMapper.java
Normal file
12
src/main/java/com/wms/mapper/KanbanMapper.java
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package com.wms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.wms.entity.table.Kanban;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 看板Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface KanbanMapper extends BaseMapper<Kanban> {
|
||||
}
|
||||
10
src/main/java/com/wms/service/KanbanService.java
Normal file
10
src/main/java/com/wms/service/KanbanService.java
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package com.wms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wms.entity.table.Kanban;
|
||||
|
||||
/**
|
||||
* 看板服务接口
|
||||
*/
|
||||
public interface KanbanService extends IService<Kanban> {
|
||||
}
|
||||
|
|
@ -292,6 +292,11 @@ public class WorkServiceImplements implements IWorkService {
|
|||
// 有标签未打印
|
||||
return "有标签未打印";
|
||||
}
|
||||
if (!eLocationConfigService.exists(new LambdaQueryWrapper<ELocationConfig>()
|
||||
.eq(ELocationConfig::getWorkStation, workStation))) {
|
||||
// 没有标签,说明点过确认。
|
||||
return "没有可以确认完成的工作,请勿重复点击。";
|
||||
}
|
||||
// 查找当前站台的标签配置
|
||||
List<ELocationConfig> eLocationConfigList = eLocationConfigService.list(new LambdaQueryWrapper<ELocationConfig>()
|
||||
.eq(ELocationConfig::getWorkStation, workStation));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.wms.service.serviceImplements;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wms.entity.table.Kanban;
|
||||
import com.wms.mapper.KanbanMapper;
|
||||
import com.wms.service.KanbanService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 看板服务实现
|
||||
*/
|
||||
@Service
|
||||
public class KanbanServiceImpl extends ServiceImpl<KanbanMapper, Kanban> implements KanbanService {
|
||||
}
|
||||
|
|
@ -54,12 +54,6 @@ public class LocationServiceImplements extends ServiceImpl<LocationMapper, Locat
|
|||
@Override
|
||||
public Map<String, String> getOneLocation(String inPoint, String goodsId) {
|
||||
Map<String, String> resultMap = new HashMap<>();
|
||||
// 查找对应站台
|
||||
LambdaQueryWrapper<Location> locationQueryWrapper = new LambdaQueryWrapper<Location>()
|
||||
.eq(Location::getAreaId, 1)
|
||||
.eq(Location::getLocationStatus, 0)
|
||||
.eq(Location::getLocationType, 1)
|
||||
.eq(Location::getIsLock, 0);
|
||||
// 添加对应设备的查询条件
|
||||
int equipmentId = -1;
|
||||
if (StringUtils.isNotEmpty(inPoint)) {
|
||||
|
|
@ -74,7 +68,7 @@ public class LocationServiceImplements extends ServiceImpl<LocationMapper, Locat
|
|||
}
|
||||
// 指定设备号
|
||||
if (equipmentId != -1) {
|
||||
return getOneLocationByEquipmentId(resultMap, locationQueryWrapper, equipmentId);
|
||||
return getOneLocationByEquipmentId(resultMap, equipmentId);
|
||||
} else {// 未指定设备号
|
||||
// 选择最近未使用的设备
|
||||
LambdaQueryWrapper<Stand> LRUStandQueryWrapper = new LambdaQueryWrapper<Stand>()
|
||||
|
|
@ -88,12 +82,12 @@ public class LocationServiceImplements extends ServiceImpl<LocationMapper, Locat
|
|||
if (StringUtils.isNotEmpty(goodsId)) {// 需要根据物料编号做出区分
|
||||
equipmentId = selectEquipmentByLRUAndGoods(LRUStands, goodsId);
|
||||
if (equipmentId != -1) {
|
||||
getOneLocationByEquipmentId(resultMap, locationQueryWrapper, equipmentId);
|
||||
getOneLocationByEquipmentId(resultMap, equipmentId);
|
||||
}
|
||||
}
|
||||
if (resultMap.isEmpty()) {// 结果集为空
|
||||
for (Stand lruStand : LRUStands) {
|
||||
getOneLocationByEquipmentId(resultMap, locationQueryWrapper, lruStand.getEquipmentId());
|
||||
getOneLocationByEquipmentId(resultMap, lruStand.getEquipmentId());
|
||||
if (!resultMap.isEmpty()) {
|
||||
// 更新最近使用时间
|
||||
lruStand.setLastUseTime(LocalDateTime.now());
|
||||
|
|
@ -111,14 +105,18 @@ public class LocationServiceImplements extends ServiceImpl<LocationMapper, Locat
|
|||
* 根据设备号查找库位
|
||||
*
|
||||
* @param resultMap 结果集
|
||||
* @param locationQueryWrapper 查询条件
|
||||
* @param equipmentId 设备号
|
||||
* @return 查询结果
|
||||
*/
|
||||
private Map<String, String> getOneLocationByEquipmentId(Map<String, String> resultMap, LambdaQueryWrapper<Location> locationQueryWrapper, int equipmentId) {
|
||||
private Map<String, String> getOneLocationByEquipmentId(Map<String, String> resultMap, int equipmentId) {
|
||||
resultMap.clear();
|
||||
locationQueryWrapper.eq(Location::getEquipmentId, equipmentId);
|
||||
locationQueryWrapper.orderByDesc(Location::getWDepth)
|
||||
LambdaQueryWrapper<Location> locationQueryWrapper = new LambdaQueryWrapper<Location>()
|
||||
.eq(Location::getAreaId, 1)
|
||||
.eq(Location::getLocationStatus, 0)
|
||||
.eq(Location::getLocationType, 1)
|
||||
.eq(Location::getIsLock, 0)
|
||||
.eq(Location::getEquipmentId, equipmentId)
|
||||
.orderByDesc(Location::getWDepth)
|
||||
.orderByAsc(List.of(Location::getWCol, Location::getWLayer, Location::getWRow));
|
||||
List<Location> availableLocations = locationMapper.selectList(locationQueryWrapper);
|
||||
for (Location oneAvailableLocation : availableLocations) {
|
||||
|
|
|
|||
46
src/main/java/com/wms/utils/excel/vo/ClcKanbanExcelVo.java
Normal file
46
src/main/java/com/wms/utils/excel/vo/ClcKanbanExcelVo.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package com.wms.utils.excel.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.wms.entity.table.Kanban;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 看板需求ExcelVo
|
||||
*/
|
||||
@Data
|
||||
public class ClcKanbanExcelVo {
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ExcelProperty("料号")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 看板id
|
||||
*/
|
||||
@ExcelProperty("看板")
|
||||
private String kanbanId;
|
||||
/**
|
||||
* 看板状态
|
||||
* 0:空
|
||||
* 1:满
|
||||
*/
|
||||
@ExcelProperty("状态")
|
||||
private String kanbanStatus;
|
||||
|
||||
/**
|
||||
* 将KanbanPo转化为KanbanExcelVo
|
||||
* @param kanbanPo 数据库Po
|
||||
* @return ExcelVo
|
||||
*/
|
||||
public static ClcKanbanExcelVo of(Kanban kanbanPo) {
|
||||
ClcKanbanExcelVo excelVo = new ClcKanbanExcelVo();
|
||||
excelVo.setKanbanId(kanbanPo.getKanbanId());
|
||||
excelVo.setGoodsId(kanbanPo.getGoodsId());
|
||||
if (kanbanPo.getKanbanStatus() == 1) {
|
||||
excelVo.setKanbanStatus("满");
|
||||
} else {
|
||||
excelVo.setKanbanStatus("空");
|
||||
}
|
||||
return excelVo;
|
||||
}
|
||||
}
|
||||
5
src/main/resources/mapper/KanbanMapper.xml
Normal file
5
src/main/resources/mapper/KanbanMapper.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wms.mapper.KanbanMapper">
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user