代码更新
This commit is contained in:
parent
819eda7da6
commit
759fc3a91e
|
|
@ -38,6 +38,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.wms.utils.HttpUtils.getIpAddr;
|
import static com.wms.utils.HttpUtils.getIpAddr;
|
||||||
|
|
@ -287,6 +288,34 @@ public class ExcelController {
|
||||||
.doWrite(stockPoList.stream().map(StockExcelVo::of).toList());
|
.doWrite(stockPoList.stream().map(StockExcelVo::of).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出CLC看板需求
|
||||||
|
*
|
||||||
|
* @param response 请求
|
||||||
|
*/
|
||||||
|
@PostMapping("/downloadClcKanbanRequirementExcel")
|
||||||
|
@ResponseBody
|
||||||
|
public void downloadClcKanbanRequirementExcel(@RequestBody ClcKanbanRequirementRequest 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<ClcKanbanRequirementExcelVo> clcKanbanRequirementExcelVoList = new ArrayList<>();
|
||||||
|
// TODO 需要处理获得数据
|
||||||
|
EasyExcel.write(response.getOutputStream(), StockExcelVo.class)
|
||||||
|
.excelType(ExcelTypeEnum.XLSX)
|
||||||
|
.registerWriteHandler(horizontalCellStyleStrategy)
|
||||||
|
.sheet("CLC看板需求")
|
||||||
|
.doWrite(clcKanbanRequirementExcelVoList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出入库记录
|
* 导出入库记录
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -155,40 +155,13 @@ public class JobComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 每天查询一次是否有入库后长期未使用的库存
|
/**
|
||||||
// * 每天晚上9点执行一次
|
* 每天查询一次是否有过期记录
|
||||||
// */
|
* 每天晚上10点执行一次
|
||||||
//// @Scheduled(cron = "0 0 21 * * ?")
|
*/
|
||||||
// public void detectStockLongTimeNoUse() {
|
// @Scheduled(cron = "0 0 22 * * ?")
|
||||||
// logger.info("执行定时任务:查询是否有入库后长期未使用的库存");
|
public void deleteOutOfDateData() {
|
||||||
// List<StockDto> stocksLongTimeNoUse = stockService.selStockLongTimeNoUse(7);
|
logger.info("执行定时任务:删除过期数据");
|
||||||
// if (stocksLongTimeNoUse.size() > 0) {
|
}
|
||||||
// logger.info("有入库后长期未使用的库存, 准备更新库存状态");
|
|
||||||
// for (StockDto stockLongTimeNoUse : stocksLongTimeNoUse) {
|
|
||||||
// try {
|
|
||||||
// stockLongTimeNoUse.setGoodsStatus(GoodsStatus.SCRAP.getCode());
|
|
||||||
// stockService.modifyStock(stockLongTimeNoUse);
|
|
||||||
// logger.info("长时间未使用库存状态更新成功");
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// logger.error("长时间未使用库存状态更新异常:{}", e.getMessage());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 每天查询一次是否有过期记录
|
|
||||||
// * 每天晚上10点执行一次
|
|
||||||
// */
|
|
||||||
//// @Scheduled(cron = "0 0 22 * * ?")
|
|
||||||
// public void deleteOutOfDateData() {
|
|
||||||
// logger.info("执行定时任务:删除过期数据");
|
|
||||||
// taskRecordService.deleteTaskRecordRegularly();
|
|
||||||
// if (logService.deleteWmsLogsRegularly(90)) {
|
|
||||||
// logger.info("删除过期日志数据成功");
|
|
||||||
// } else {
|
|
||||||
// logger.info("删除过期日志数据失败");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
@ -5,15 +5,14 @@ import com.alibaba.fastjson2.JSON;
|
||||||
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
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.dto.PageDto;
|
||||||
import com.wms.entity.app.dto.StockDto;
|
import com.wms.entity.app.dto.StockDto;
|
||||||
import com.wms.entity.app.request.DbsQuery;
|
import com.wms.entity.app.dto.StockOfGoodsDto;
|
||||||
import com.wms.entity.app.request.KateOrdersQuery;
|
import com.wms.entity.app.request.*;
|
||||||
import com.wms.entity.app.request.StationConfigQuery;
|
|
||||||
import com.wms.entity.app.request.StockQuery;
|
|
||||||
import com.wms.entity.app.vo.*;
|
import com.wms.entity.app.vo.*;
|
||||||
import com.wms.entity.table.KateDBS;
|
import com.wms.entity.table.KateDBS;
|
||||||
import com.wms.entity.table.KateOrders;
|
import com.wms.entity.table.KateOrders;
|
||||||
|
|
@ -39,9 +38,12 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.wms.utils.StringUtils.convertJsonString;
|
import static com.wms.utils.StringUtils.convertJsonString;
|
||||||
|
|
||||||
|
|
@ -69,7 +71,10 @@ public class KateWorkQueryController {
|
||||||
* 站台配置服务
|
* 站台配置服务
|
||||||
*/
|
*/
|
||||||
private final WorkStationConfigService workStationConfigService;
|
private final WorkStationConfigService workStationConfigService;
|
||||||
|
/**
|
||||||
|
* 库存服务
|
||||||
|
*/
|
||||||
|
private final StockService stockService;
|
||||||
/**
|
/**
|
||||||
* 请求头部信息
|
* 请求头部信息
|
||||||
*/
|
*/
|
||||||
|
|
@ -448,4 +453,85 @@ public class KateWorkQueryController {
|
||||||
return convertJsonString(rsp);
|
return convertJsonString(rsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取CLC看板需求
|
||||||
|
*/
|
||||||
|
@PostMapping("/getClcKanbanRequirement")
|
||||||
|
@ResponseBody
|
||||||
|
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||||
|
@MyLog(logTitle = "获取CLC看板需求", logMethod = "getClcKanbanRequirement")
|
||||||
|
public String getClcKanbanRequirement(@RequestBody ClcKanbanRequirementRequest request) {
|
||||||
|
logger.info("获取CLC看板需求:{},请求ip:{}", convertJsonString(request), HttpUtils.getIpAddr(servletRequest));
|
||||||
|
ResponseEntity response = new ResponseEntity();
|
||||||
|
try {
|
||||||
|
// 返回的Vo
|
||||||
|
ClcKanbanRequirementVo clcKanbanVo = new ClcKanbanRequirementVo();
|
||||||
|
// 查询物料库存信息
|
||||||
|
List<StockOfGoodsDto> stockOfGoodsDtoList = stockService.selectSumOfGoods("");
|
||||||
|
if (stockOfGoodsDtoList == null || stockOfGoodsDtoList.isEmpty()) {
|
||||||
|
clcKanbanVo.setAllZero();
|
||||||
|
} else {
|
||||||
|
BigDecimal TotalNumOfType = BigDecimal.ZERO;// 总需求类型数量
|
||||||
|
BigDecimal TotalNumOfPc = BigDecimal.ZERO;// 总需求Pc数量
|
||||||
|
BigDecimal TotalNumOfBox = BigDecimal.ZERO;// 总需求盒数
|
||||||
|
BigDecimal NumOfTypeOf810 = BigDecimal.ZERO;// #810的料号数量
|
||||||
|
BigDecimal NumOfTypeOf811 = BigDecimal.ZERO;// #811的料号数量
|
||||||
|
BigDecimal NumOfTypeOf911 = BigDecimal.ZERO;// #911的料号数量
|
||||||
|
BigDecimal NumOfTypeOf822 = BigDecimal.ZERO;// #822的料号数量
|
||||||
|
BigDecimal NumOfPcOf810 = BigDecimal.ZERO;// #810零件数量
|
||||||
|
BigDecimal NumOfPcOf811 = BigDecimal.ZERO;// #811零件数量
|
||||||
|
BigDecimal NumOfPcOf911 = BigDecimal.ZERO;// #911零件数量
|
||||||
|
BigDecimal NumOfPcOf822 = BigDecimal.ZERO;// #822零件数量
|
||||||
|
BigDecimal NumOfBoxOf810 = BigDecimal.ZERO;// #810需求盒数
|
||||||
|
BigDecimal NumOfBoxOf811 = BigDecimal.ZERO;// #811需求盒数
|
||||||
|
BigDecimal NumOfBoxOf911 = BigDecimal.ZERO;// #911需求盒数
|
||||||
|
BigDecimal NumOfBoxOf822 = BigDecimal.ZERO;// #822需求盒数
|
||||||
|
for (StockOfGoodsDto stockOfGoodsDto : stockOfGoodsDtoList) {
|
||||||
|
if (Objects.equals(stockOfGoodsDto.getFeedType(), "PULL")) {
|
||||||
|
// 剩余数量少于补货点时,需要补货
|
||||||
|
if (stockOfGoodsDto.getRemainNumSum().compareTo(stockOfGoodsDto.getFeedPoint()) <= 0) {
|
||||||
|
TotalNumOfType = TotalNumOfType.add(BigDecimal.ONE);
|
||||||
|
BigDecimal targetNum = stockOfGoodsDto.getNumOfKanban().multiply(stockOfGoodsDto.getNumOfPerKanban());
|
||||||
|
// 计算需要多少个看板
|
||||||
|
BigDecimal needKanbanQuantity = targetNum.subtract(stockOfGoodsDto.getRemainNumSum()).divide(stockOfGoodsDto.getNumOfPerKanban(), 2, RoundingMode.CEILING);
|
||||||
|
TotalNumOfPc = TotalNumOfPc.add(needKanbanQuantity.multiply(stockOfGoodsDto.getNumOfPerKanban()));
|
||||||
|
TotalNumOfBox = TotalNumOfBox.add(needKanbanQuantity);
|
||||||
|
if (stockOfGoodsDto.getBoxType().contains("810")) {
|
||||||
|
|
||||||
|
} else if (stockOfGoodsDto.getBoxType().contains("811")) {
|
||||||
|
|
||||||
|
} else if (stockOfGoodsDto.getBoxType().contains("911")) {
|
||||||
|
|
||||||
|
} else if (stockOfGoodsDto.getBoxType().contains("822")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (stockOfGoodsDto.getBoxType()) {
|
||||||
|
case "810":
|
||||||
|
NumOfTypeOf810 = NumOfTypeOf810.add(BigDecimal.ONE);
|
||||||
|
NumOfPcOf810 = NumOfPcOf810.add(needKanbanQuantity.multiply(stockOfGoodsDto.getNumOfPerKanban()));
|
||||||
|
NumOfBoxOf810 = NumOfBoxOf810.add(needKanbanQuantity);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
response.setCode(ResponseCode.OK.getCode());
|
||||||
|
response.setMessage("获取CLC看板需求成功。");
|
||||||
|
response.setReturnData(clcKanbanVo);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -29,6 +29,9 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.wms.utils.StringUtils.convertJsonString;
|
import static com.wms.utils.StringUtils.convertJsonString;
|
||||||
|
|
||||||
|
|
@ -87,6 +90,54 @@ public class StockController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询某个物料的库存总数
|
||||||
|
*/
|
||||||
|
@PostMapping("/getStocksByGoods")
|
||||||
|
@ResponseBody
|
||||||
|
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||||
|
public String getStocksByGoods(@RequestBody StockQuery stockQuery) {
|
||||||
|
logger.info("接收到查询物料库存数据请求:{},请求ip:{}", convertJsonString(stockQuery), HttpUtils.getIpAddr(servletRequest));
|
||||||
|
ResponseEntity response = new ResponseEntity();
|
||||||
|
try {
|
||||||
|
if (StringUtils.isEmpty(stockQuery.getGoodsId())) {
|
||||||
|
logger.error("查询料号不允许为空");
|
||||||
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
response.setMessage("查询料号不允许为空");
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
// 返回实体
|
||||||
|
StockVo stockVo = new StockVo();
|
||||||
|
stockVo.setGoodsId(stockQuery.getGoodsId());
|
||||||
|
// 查询库存
|
||||||
|
List<Stock> stocks = stockService.list(new LambdaQueryWrapper<Stock>()
|
||||||
|
.apply(StringUtils.isNotEmpty(stockQuery.getGoodsId()), "goods_related ->> '$.goodsId' = {0}", stockQuery.getGoodsId()));
|
||||||
|
if (stocks == null || stocks.isEmpty()) {
|
||||||
|
// 没有库存
|
||||||
|
stockVo.setRemainNum(BigDecimal.ZERO);
|
||||||
|
logger.info("物料{}无库存", stockQuery.getGoodsId());
|
||||||
|
} else {
|
||||||
|
BigDecimal sumNum = BigDecimal.ZERO;
|
||||||
|
for (Stock stock : stocks) {
|
||||||
|
sumNum = sumNum.add(stock.getGoodsRelated().getRemainNum());
|
||||||
|
}
|
||||||
|
// 没有库存
|
||||||
|
stockVo.setRemainNum(sumNum);
|
||||||
|
logger.info("物料{}无库存", stockQuery.getGoodsId());
|
||||||
|
}
|
||||||
|
response.setCode(ResponseCode.OK.getCode());
|
||||||
|
response.setMessage("查询物料" + stockQuery.getGoodsId() + "库存数量成功");
|
||||||
|
response.setReturnData(stockVo);
|
||||||
|
return convertJsonString(response);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 回滚事务
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
logger.error("查询物料库存发生异常:{}", convertJsonString(e));
|
||||||
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
response.setMessage("查询物料库存发生异常");
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新库存信息
|
* 更新库存信息
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,7 @@ public class TaskController {
|
||||||
// 对所有任务组里面的出库任务进行处理
|
// 对所有任务组里面的出库任务进行处理
|
||||||
for (Task outTask : feedBackTasks) {
|
for (Task outTask : feedBackTasks) {
|
||||||
if (!Objects.equals(outTask.getTaskType(), TaskType.OUT.getCode())) {
|
if (!Objects.equals(outTask.getTaskType(), TaskType.OUT.getCode())) {
|
||||||
// 非移库任务跳过
|
// 非出库任务跳过
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (outTask.getIsPicking() == 1) {
|
if (outTask.getIsPicking() == 1) {
|
||||||
|
|
@ -2178,6 +2178,115 @@ public class TaskController {
|
||||||
.in(ETagLocation::getELocationId, eTaskDataList.stream().map(ETaskData::getLocation).collect(Collectors.toList())));
|
.in(ETagLocation::getELocationId, eTaskDataList.stream().map(ETaskData::getLocation).collect(Collectors.toList())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logger.info("处理整理盒子请求成功。");
|
||||||
|
response.setCode(ResponseCode.OK.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直接物料非计划领料
|
||||||
|
*
|
||||||
|
* @param noPlanRequest 请求信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/clcNoPlan")
|
||||||
|
@ResponseBody
|
||||||
|
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||||
|
@MyLog(logTitle = "直接物料非计划领料", logMethod = "clcNoPlan")
|
||||||
|
public String clcNoPlan(@RequestBody NoPlanRequest noPlanRequest) {
|
||||||
|
logger.info("直接物料非计划领料:{},ip地址:{}", convertJsonString(noPlanRequest), HttpUtils.getIpAddr(servletRequest));
|
||||||
|
ResponseEntity response = new ResponseEntity();
|
||||||
|
try {
|
||||||
|
// 获取站台号
|
||||||
|
Stand targetStand;
|
||||||
|
if (StringUtils.isNotEmpty(noPlanRequest.getStandId())) {
|
||||||
|
// 站台号从请求参数中获取
|
||||||
|
targetStand = standService.getById(noPlanRequest.getStandId());
|
||||||
|
} else {
|
||||||
|
// 站台号从ip获取
|
||||||
|
targetStand = standService.getOne(new LambdaQueryWrapper<Stand>()
|
||||||
|
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
|
||||||
|
.eq(Stand::getStandType, 1)
|
||||||
|
.last("limit 1"));
|
||||||
|
}
|
||||||
|
if (targetStand == null) {
|
||||||
|
logger.error("查询拣选站台错误。");
|
||||||
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
response.setMessage("查询拣选站台错误。");
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
// 查询库存
|
||||||
|
// TODO 非计划领料待确认
|
||||||
|
// Task中的isPicking=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
logger.info("处理整理盒子请求成功。");
|
||||||
|
response.setCode(ResponseCode.OK.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直接物料非计划领料确认回库
|
||||||
|
*
|
||||||
|
* @param noPlanRequest 请求信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/clcNoPlanConfirmBack")
|
||||||
|
@ResponseBody
|
||||||
|
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||||
|
@MyLog(logTitle = "直接物料非计划领料", logMethod = "clcNoPlanConfirmBack")
|
||||||
|
public String clcNoPlanConfirmBack(@RequestBody NoPlanRequest noPlanRequest) {
|
||||||
|
logger.info("直接物料非计划领料:{},ip地址:{}", convertJsonString(noPlanRequest), HttpUtils.getIpAddr(servletRequest));
|
||||||
|
ResponseEntity response = new ResponseEntity();
|
||||||
|
try {
|
||||||
|
// 获取站台号
|
||||||
|
Stand targetStand;
|
||||||
|
if (StringUtils.isNotEmpty(noPlanRequest.getStandId())) {
|
||||||
|
// 站台号从请求参数中获取
|
||||||
|
targetStand = standService.getById(noPlanRequest.getStandId());
|
||||||
|
} else {
|
||||||
|
// 站台号从ip获取
|
||||||
|
targetStand = standService.getOne(new LambdaQueryWrapper<Stand>()
|
||||||
|
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
|
||||||
|
.eq(Stand::getStandType, 1)
|
||||||
|
.last("limit 1"));
|
||||||
|
}
|
||||||
|
if (targetStand == null) {
|
||||||
|
logger.error("查询拣选站台错误。");
|
||||||
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
response.setMessage("查询拣选站台错误。");
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
// 查询库存
|
||||||
|
// Task中的isPicking=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger.info("处理整理盒子请求成功。");
|
logger.info("处理整理盒子请求成功。");
|
||||||
response.setCode(ResponseCode.OK.getCode());
|
response.setCode(ResponseCode.OK.getCode());
|
||||||
response.setMessage("请根据灯光拣选盒子。");
|
response.setMessage("请根据灯光拣选盒子。");
|
||||||
|
|
|
||||||
60
src/main/java/com/wms/entity/app/dto/StockOfGoodsDto.java
Normal file
60
src/main/java/com/wms/entity/app/dto/StockOfGoodsDto.java
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.wms.entity.app.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.wms.entity.app.dto.extend.KanbanEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流库存实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StockOfGoodsDto {
|
||||||
|
/**
|
||||||
|
* 料号
|
||||||
|
*/
|
||||||
|
@JsonProperty("goodsId")
|
||||||
|
private String goodsId;
|
||||||
|
/**
|
||||||
|
* 料名
|
||||||
|
*/
|
||||||
|
@JsonProperty("goodsName")
|
||||||
|
private String goodsName;
|
||||||
|
/**
|
||||||
|
* 剩余总数
|
||||||
|
*/
|
||||||
|
@JsonProperty("remainNumSum")
|
||||||
|
private BigDecimal remainNumSum;
|
||||||
|
/**
|
||||||
|
* 补货方式
|
||||||
|
*/
|
||||||
|
@JsonProperty("feedType")
|
||||||
|
private String feedType;
|
||||||
|
/**
|
||||||
|
* 补货点
|
||||||
|
*/
|
||||||
|
@JsonProperty("feedPoint")
|
||||||
|
private BigDecimal feedPoint;
|
||||||
|
/**
|
||||||
|
* 装料盒子类型
|
||||||
|
*/
|
||||||
|
@JsonProperty("boxType")
|
||||||
|
private String boxType;
|
||||||
|
/**
|
||||||
|
* 每个看板的物料数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("numOfPerKanban")
|
||||||
|
private BigDecimal numOfPerKanban;
|
||||||
|
/**
|
||||||
|
* 看板数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("numOfKanban")
|
||||||
|
private BigDecimal numOfKanban;
|
||||||
|
/**
|
||||||
|
* 看板详细信息
|
||||||
|
*/
|
||||||
|
@JsonProperty("kanbanList")
|
||||||
|
private List<KanbanEntity> kanbanList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.wms.entity.app.request;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CLC看板需求请求
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ClcKanbanRequirementRequest extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 站台号
|
||||||
|
*/
|
||||||
|
@JsonProperty("standId")
|
||||||
|
private String standId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.wms.entity.app.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class NoPlanConfirmBackRequest extends PageQuery {
|
||||||
|
// TODO 非计划领料等待做
|
||||||
|
private String vehicleId;
|
||||||
|
private String goodsId;
|
||||||
|
private BigDecimal realPickNum;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
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.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class NoPlanRecordQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@JsonProperty("recordId")
|
||||||
|
private String recordId;
|
||||||
|
/**
|
||||||
|
* 领料类别:1、直接物料,2、间接物料
|
||||||
|
*/
|
||||||
|
@JsonProperty("callType")
|
||||||
|
private Integer callType;
|
||||||
|
/**
|
||||||
|
* 料号
|
||||||
|
*/
|
||||||
|
@JsonProperty("goodsId")
|
||||||
|
private String goodsId;
|
||||||
|
/**
|
||||||
|
* 库存数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("stockNum")
|
||||||
|
private BigDecimal stockNum;
|
||||||
|
/**
|
||||||
|
* 需要数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("needNum")
|
||||||
|
private BigDecimal needNum;
|
||||||
|
/**
|
||||||
|
* 工单---直接物料
|
||||||
|
*/
|
||||||
|
@JsonProperty("workOrder")
|
||||||
|
private String workOrder;
|
||||||
|
/**
|
||||||
|
* 小车号---直接物料
|
||||||
|
*/
|
||||||
|
@JsonProperty("smallVehicleNo")
|
||||||
|
private String smallVehicleNo;
|
||||||
|
/**
|
||||||
|
* 领料原因---直接物料
|
||||||
|
*/
|
||||||
|
@JsonProperty("callReason")
|
||||||
|
private String callReason;
|
||||||
|
/**
|
||||||
|
* 轻流流水号
|
||||||
|
*/
|
||||||
|
@JsonProperty("flowNo")
|
||||||
|
private String flowNo;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@JsonProperty("remark")
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 领料时间
|
||||||
|
*/
|
||||||
|
@JsonProperty("callTime")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime callTime;
|
||||||
|
/**
|
||||||
|
* 领料人
|
||||||
|
*/
|
||||||
|
@JsonProperty("callUser")
|
||||||
|
private String callUser;
|
||||||
|
}
|
||||||
15
src/main/java/com/wms/entity/app/request/NoPlanRequest.java
Normal file
15
src/main/java/com/wms/entity/app/request/NoPlanRequest.java
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.wms.entity.app.request;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class NoPlanRequest extends NoPlanRecordQuery{
|
||||||
|
/**
|
||||||
|
* 站台号
|
||||||
|
*/
|
||||||
|
@JsonProperty("standId")
|
||||||
|
private String standId;
|
||||||
|
}
|
||||||
109
src/main/java/com/wms/entity/app/vo/ClcKanbanRequirementVo.java
Normal file
109
src/main/java/com/wms/entity/app/vo/ClcKanbanRequirementVo.java
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
package com.wms.entity.app.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CLC看板界面显示Vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ClcKanbanRequirementVo {
|
||||||
|
/**
|
||||||
|
* 总需求种类---料号的总数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("TotalNumOfType")
|
||||||
|
private BigDecimal TotalNumOfType;
|
||||||
|
/**
|
||||||
|
* 总需求数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("TotalNumOfPc")
|
||||||
|
private BigDecimal TotalNumOfPc;
|
||||||
|
/**
|
||||||
|
* 总需求盒数
|
||||||
|
*/
|
||||||
|
@JsonProperty("TotalNumOfBox")
|
||||||
|
private BigDecimal TotalNumOfBox;
|
||||||
|
/**
|
||||||
|
* #810的料号数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfTypeOf810")
|
||||||
|
private BigDecimal NumOfTypeOf810;
|
||||||
|
/**
|
||||||
|
* #811的料号数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfTypeOf811")
|
||||||
|
private BigDecimal NumOfTypeOf811;
|
||||||
|
/**
|
||||||
|
* #911的料号数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfTypeOf911")
|
||||||
|
private BigDecimal NumOfTypeOf911;
|
||||||
|
/**
|
||||||
|
* #822的料号数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfTypeOf822")
|
||||||
|
private BigDecimal NumOfTypeOf822;
|
||||||
|
/**
|
||||||
|
* #810零件数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfPcOf810")
|
||||||
|
private BigDecimal NumOfPcOf810;
|
||||||
|
/**
|
||||||
|
* #811零件数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfPcOf811")
|
||||||
|
private BigDecimal NumOfPcOf811;
|
||||||
|
/**
|
||||||
|
* #911零件数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfPcOf911")
|
||||||
|
private BigDecimal NumOfPcOf911;
|
||||||
|
/**
|
||||||
|
* #822零件数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfPcOf822")
|
||||||
|
private BigDecimal NumOfPcOf822;
|
||||||
|
/**
|
||||||
|
* #810需求盒数
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfBoxOf810")
|
||||||
|
private BigDecimal NumOfBoxOf810;
|
||||||
|
/**
|
||||||
|
* #811需求盒数
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfBoxOf811")
|
||||||
|
private BigDecimal NumOfBoxOf811;
|
||||||
|
/**
|
||||||
|
* #911需求盒数
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfBoxOf911")
|
||||||
|
private BigDecimal NumOfBoxOf911;
|
||||||
|
/**
|
||||||
|
* #822需求盒数
|
||||||
|
*/
|
||||||
|
@JsonProperty("NumOfBoxOf822")
|
||||||
|
private BigDecimal NumOfBoxOf822;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部属性设置为0
|
||||||
|
*/
|
||||||
|
public void setAllZero() {
|
||||||
|
this.TotalNumOfType = BigDecimal.ZERO;
|
||||||
|
this.TotalNumOfPc = BigDecimal.ZERO;
|
||||||
|
this.TotalNumOfBox = BigDecimal.ZERO;
|
||||||
|
this.NumOfTypeOf810 = BigDecimal.ZERO;
|
||||||
|
this.NumOfTypeOf811 = BigDecimal.ZERO;
|
||||||
|
this.NumOfTypeOf911 = BigDecimal.ZERO;
|
||||||
|
this.NumOfTypeOf822 = BigDecimal.ZERO;
|
||||||
|
this.NumOfPcOf810 = BigDecimal.ZERO;
|
||||||
|
this.NumOfPcOf811 = BigDecimal.ZERO;
|
||||||
|
this.NumOfPcOf911 = BigDecimal.ZERO;
|
||||||
|
this.NumOfPcOf822 = BigDecimal.ZERO;
|
||||||
|
this.NumOfBoxOf810 = BigDecimal.ZERO;
|
||||||
|
this.NumOfBoxOf811 = BigDecimal.ZERO;
|
||||||
|
this.NumOfBoxOf911 = BigDecimal.ZERO;
|
||||||
|
this.NumOfBoxOf822 = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
}
|
||||||
78
src/main/java/com/wms/entity/app/vo/NoPlanRecordVo.java
Normal file
78
src/main/java/com/wms/entity/app/vo/NoPlanRecordVo.java
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.wms.entity.app.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 非计划领料记录Vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class NoPlanRecordVo {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@JsonProperty("recordId")
|
||||||
|
private String recordId;
|
||||||
|
/**
|
||||||
|
* 领料类别:1、直接物料,2、间接物料
|
||||||
|
*/
|
||||||
|
@JsonProperty("callType")
|
||||||
|
private Integer callType;
|
||||||
|
/**
|
||||||
|
* 料号
|
||||||
|
*/
|
||||||
|
@JsonProperty("goodsId")
|
||||||
|
private String goodsId;
|
||||||
|
/**
|
||||||
|
* 库存数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("stockNum")
|
||||||
|
private BigDecimal stockNum;
|
||||||
|
/**
|
||||||
|
* 需要数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("needNum")
|
||||||
|
private BigDecimal needNum;
|
||||||
|
/**
|
||||||
|
* 工单---直接物料
|
||||||
|
*/
|
||||||
|
@JsonProperty("workOrder")
|
||||||
|
private String workOrder;
|
||||||
|
/**
|
||||||
|
* 小车号---直接物料
|
||||||
|
*/
|
||||||
|
@JsonProperty("smallVehicleNo")
|
||||||
|
private String smallVehicleNo;
|
||||||
|
/**
|
||||||
|
* 领料原因---直接物料
|
||||||
|
*/
|
||||||
|
@JsonProperty("callReason")
|
||||||
|
private String callReason;
|
||||||
|
/**
|
||||||
|
* 轻流流水号
|
||||||
|
*/
|
||||||
|
@JsonProperty("flowNo")
|
||||||
|
private String flowNo;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@JsonProperty("remark")
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 领料时间
|
||||||
|
*/
|
||||||
|
@JsonProperty("callTime")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime callTime;
|
||||||
|
/**
|
||||||
|
* 领料人
|
||||||
|
*/
|
||||||
|
@JsonProperty("callUser")
|
||||||
|
private String callUser;
|
||||||
|
}
|
||||||
77
src/main/java/com/wms/entity/table/NoPlanRecord.java
Normal file
77
src/main/java/com/wms/entity/table/NoPlanRecord.java
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
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.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 非计划领料记录
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "tbl_app_no_plan", autoResultMap = true)
|
||||||
|
public class NoPlanRecord {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId("record_id")
|
||||||
|
private String recordId;
|
||||||
|
/**
|
||||||
|
* 领料类别:1、直接物料,2、间接物料
|
||||||
|
*/
|
||||||
|
@TableField("call_type")
|
||||||
|
private Integer callType;
|
||||||
|
/**
|
||||||
|
* 料号
|
||||||
|
*/
|
||||||
|
@TableField("goods_id")
|
||||||
|
private String goodsId;
|
||||||
|
/**
|
||||||
|
* 库存数量
|
||||||
|
*/
|
||||||
|
@TableField("stock_num")
|
||||||
|
private BigDecimal stockNum;
|
||||||
|
/**
|
||||||
|
* 需要数量
|
||||||
|
*/
|
||||||
|
@TableField("need_num")
|
||||||
|
private BigDecimal needNum;
|
||||||
|
/**
|
||||||
|
* 工单---直接物料
|
||||||
|
*/
|
||||||
|
@TableField("work_order")
|
||||||
|
private String workOrder;
|
||||||
|
/**
|
||||||
|
* 小车号---直接物料
|
||||||
|
*/
|
||||||
|
@TableField("small_vehicle_no")
|
||||||
|
private String smallVehicleNo;
|
||||||
|
/**
|
||||||
|
* 领料原因---直接物料
|
||||||
|
*/
|
||||||
|
@TableField("call_reason")
|
||||||
|
private String callReason;
|
||||||
|
/**
|
||||||
|
* 轻流流水号
|
||||||
|
*/
|
||||||
|
@TableField("flow_no")
|
||||||
|
private String flowNo;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@TableField("remark")
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 领料时间
|
||||||
|
*/
|
||||||
|
@TableField("call_time")
|
||||||
|
private LocalDateTime callTime;
|
||||||
|
/**
|
||||||
|
* 领料人
|
||||||
|
*/
|
||||||
|
@TableField("call_user")
|
||||||
|
private String callUser;
|
||||||
|
}
|
||||||
12
src/main/java/com/wms/mapper/NoPlanRecordMapper.java
Normal file
12
src/main/java/com/wms/mapper/NoPlanRecordMapper.java
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.wms.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.wms.entity.table.NoPlanRecord;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 非计划领料mapper
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NoPlanRecordMapper extends BaseMapper<NoPlanRecord> {
|
||||||
|
}
|
||||||
10
src/main/java/com/wms/service/NoPlanRecordService.java
Normal file
10
src/main/java/com/wms/service/NoPlanRecordService.java
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.wms.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.wms.entity.table.NoPlanRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 非计划领料记录服务
|
||||||
|
*/
|
||||||
|
public interface NoPlanRecordService extends IService<NoPlanRecord> {
|
||||||
|
}
|
||||||
|
|
@ -2,10 +2,13 @@ package com.wms.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.wms.entity.app.dto.StockDto;
|
import com.wms.entity.app.dto.StockDto;
|
||||||
|
import com.wms.entity.app.dto.StockOfGoodsDto;
|
||||||
import com.wms.entity.table.Stock;
|
import com.wms.entity.table.Stock;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface StockService extends IService<Stock> {
|
public interface StockService extends IService<Stock> {
|
||||||
List<StockDto> selectStocks(Stock stock);
|
List<StockOfGoodsDto> selectSumOfGoods(String goodsId);
|
||||||
|
|
||||||
|
List<StockOfGoodsDto> selectSumOfGoods(List<String> goodsIdList);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.wms.service.serviceImplements;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.wms.entity.table.NoPlanRecord;
|
||||||
|
import com.wms.mapper.NoPlanRecordMapper;
|
||||||
|
import com.wms.service.NoPlanRecordService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 非计划领料服务类实现
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class NoPlanRecordServiceImpl extends ServiceImpl<NoPlanRecordMapper, NoPlanRecord> implements NoPlanRecordService {
|
||||||
|
}
|
||||||
|
|
@ -1,31 +1,102 @@
|
||||||
package com.wms.service.serviceImplements;
|
package com.wms.service.serviceImplements;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.wms.entity.app.dto.StockDto;
|
import com.wms.entity.app.dto.StockOfGoodsDto;
|
||||||
|
import com.wms.entity.app.dto.extend.StockDetailInfo;
|
||||||
|
import com.wms.entity.table.Goods;
|
||||||
import com.wms.entity.table.Stock;
|
import com.wms.entity.table.Stock;
|
||||||
|
import com.wms.entity.table.WorkFlow;
|
||||||
import com.wms.mapper.StockMapper;
|
import com.wms.mapper.StockMapper;
|
||||||
|
import com.wms.service.GoodsService;
|
||||||
import com.wms.service.StockService;
|
import com.wms.service.StockService;
|
||||||
import com.wms.utils.StringUtils;
|
import com.wms.utils.StringUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
public class StockServiceImplements extends ServiceImpl<StockMapper, Stock> implements StockService {
|
public class StockServiceImplements extends ServiceImpl<StockMapper, Stock> implements StockService {
|
||||||
|
/**
|
||||||
|
* 库存mapper
|
||||||
|
*/
|
||||||
private final StockMapper stockMapper;
|
private final StockMapper stockMapper;
|
||||||
|
/**
|
||||||
|
* 物料服务
|
||||||
|
*/
|
||||||
|
private final GoodsService goodsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询物流总库存数
|
||||||
|
* @param goodsId 查询条件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<StockDto> selectStocks(Stock stock) {
|
public List<StockOfGoodsDto> selectSumOfGoods(String goodsId) {
|
||||||
// TODO 具体查询条件待添加
|
if (StringUtils.isNotEmpty(goodsId)) {
|
||||||
LambdaQueryWrapper<Stock> queryWrapper = new LambdaQueryWrapper<Stock>()
|
List<String> godsIds = new ArrayList<>();
|
||||||
.eq(StringUtils.isNotEmpty(stock.getVehicleId()), Stock::getVehicleId, stock.getVehicleId());
|
godsIds.add(goodsId);
|
||||||
List<Stock> results = super.list(queryWrapper);
|
return selectSumOfGoods(godsIds);
|
||||||
|
} else {
|
||||||
|
return selectSumOfGoods(new ArrayList<>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return BeanUtil.copyToList(results, StockDto.class);
|
/**
|
||||||
|
* 查询物流总库存数
|
||||||
|
* @param goodsIdList 查询条件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<StockOfGoodsDto> selectSumOfGoods(List<String> goodsIdList) {
|
||||||
|
// 先查询库存
|
||||||
|
List<Stock> stocks = stockMapper.selectList(new LambdaQueryWrapper<Stock>()
|
||||||
|
.apply(goodsIdList != null && !goodsIdList.isEmpty(), "goods_related ->> '$.goodsId' in {0}", goodsIdList));
|
||||||
|
if (stocks == null || stocks.isEmpty()) {
|
||||||
|
// 查不到对应物料的库存
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
// 对库存做处理
|
||||||
|
Map<String, BigDecimal> stockOfGoodsMap = new HashMap<>();
|
||||||
|
for (Stock stock : stocks) {
|
||||||
|
StockDetailInfo goodsDetail = stock.getGoodsRelated();
|
||||||
|
if (stockOfGoodsMap.containsKey(goodsDetail.getGoodsId())) {
|
||||||
|
// 直接增加数量
|
||||||
|
stockOfGoodsMap.replace(goodsDetail.getGoodsId(), stockOfGoodsMap.get(goodsDetail.getGoodsId()).add(goodsDetail.getRemainNum()));
|
||||||
|
} else {
|
||||||
|
// 添加map的键值对
|
||||||
|
stockOfGoodsMap.put(goodsDetail.getGoodsId(), goodsDetail.getRemainNum());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 根据上述结果集查询物料信息
|
||||||
|
List<Goods> goodsList = goodsService.list(new LambdaQueryWrapper<Goods>()
|
||||||
|
.in(Goods::getGoodsId, stockOfGoodsMap.keySet()));
|
||||||
|
// 循环Map生成结果集
|
||||||
|
List<StockOfGoodsDto> resultList = new ArrayList<>();
|
||||||
|
for (String goodsId : stockOfGoodsMap.keySet()) {
|
||||||
|
StockOfGoodsDto tempResult = new StockOfGoodsDto();// 临时结果集
|
||||||
|
tempResult.setGoodsId(goodsId);
|
||||||
|
tempResult.setRemainNumSum(stockOfGoodsMap.get(goodsId));
|
||||||
|
// 获取当前物料信息
|
||||||
|
List<Goods> currentGoodsList = goodsList.stream().filter(goods1 -> goods1.getGoodsId().equals(goodsId)).toList();
|
||||||
|
if (!currentGoodsList.isEmpty()) {
|
||||||
|
// 设定物料相关信息
|
||||||
|
tempResult.setGoodsName(currentGoodsList.get(0).getGoodsName());
|
||||||
|
tempResult.setFeedType(currentGoodsList.get(0).getFeedingType());
|
||||||
|
tempResult.setFeedPoint(currentGoodsList.get(0).getFeedingValue());
|
||||||
|
tempResult.setBoxType(currentGoodsList.get(0).getVehicleTypeDescription());
|
||||||
|
tempResult.setNumOfKanban(currentGoodsList.get(0).getKanbanNum());
|
||||||
|
tempResult.setNumOfPerKanban(currentGoodsList.get(0).getQuantityPerKanban());
|
||||||
|
tempResult.setKanbanList(currentGoodsList.get(0).getKanbanList());
|
||||||
|
}
|
||||||
|
resultList.add(tempResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回结果集
|
||||||
|
return resultList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.wms.utils.excel.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出看板需求
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ClcKanbanRequirementExcelVo extends KanbanExcelVo {
|
||||||
|
@ExcelProperty("料号")
|
||||||
|
private String goodsId;
|
||||||
|
@ExcelProperty("需求数量")
|
||||||
|
private BigDecimal requireNum;
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||||
import com.wms.entity.app.dto.extend.KanbanEntity;
|
import com.wms.entity.app.dto.extend.KanbanEntity;
|
||||||
import com.wms.entity.table.Goods;
|
import com.wms.entity.table.Goods;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
@ -14,8 +15,9 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 物料excel
|
* 物料excel
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class GoodsExcelVo {
|
public class GoodsExcelVo extends KanbanExcelVo {
|
||||||
/**
|
/**
|
||||||
* 物料编号
|
* 物料编号
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,110 @@ package com.wms.utils.excel.vo;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 看板导入
|
* 看板导入
|
||||||
*/
|
*/
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
@Data
|
||||||
public class KanbanExcelVo extends GoodsExcelVo {
|
public class KanbanExcelVo {
|
||||||
@ExcelProperty("KANBAN#1")
|
@ExcelProperty("KANBAN#1")
|
||||||
private String KANBAN1;
|
private String KANBAN1;
|
||||||
|
@ExcelProperty("KANBAN#2")
|
||||||
|
private String KANBAN2;
|
||||||
|
@ExcelProperty("KANBAN#3")
|
||||||
|
private String KANBAN3;
|
||||||
|
@ExcelProperty("KANBAN#4")
|
||||||
|
private String KANBAN4;
|
||||||
|
@ExcelProperty("KANBAN#5")
|
||||||
|
private String KANBAN5;
|
||||||
|
@ExcelProperty("KANBAN#6")
|
||||||
|
private String KANBAN6;
|
||||||
|
@ExcelProperty("KANBAN#7")
|
||||||
|
private String KANBAN7;
|
||||||
|
@ExcelProperty("KANBAN#8")
|
||||||
|
private String KANBAN8;
|
||||||
|
@ExcelProperty("KANBAN#9")
|
||||||
|
private String KANBAN9;
|
||||||
|
@ExcelProperty("KANBAN#10")
|
||||||
|
private String KANBAN10;
|
||||||
|
@ExcelProperty("KANBAN#11")
|
||||||
|
private String KANBAN11;
|
||||||
|
@ExcelProperty("KANBAN#12")
|
||||||
|
private String KANBAN12;
|
||||||
|
@ExcelProperty("KANBAN#13")
|
||||||
|
private String KANBAN13;
|
||||||
|
@ExcelProperty("KANBAN#14")
|
||||||
|
private String KANBAN14;
|
||||||
|
@ExcelProperty("KANBAN#15")
|
||||||
|
private String KANBAN15;
|
||||||
|
@ExcelProperty("KANBAN#16")
|
||||||
|
private String KANBAN16;
|
||||||
|
@ExcelProperty("KANBAN#17")
|
||||||
|
private String KANBAN17;
|
||||||
|
@ExcelProperty("KANBAN#18")
|
||||||
|
private String KANBAN18;
|
||||||
|
@ExcelProperty("KANBAN#19")
|
||||||
|
private String KANBAN19;
|
||||||
|
@ExcelProperty("KANBAN#20")
|
||||||
|
private String KANBAN20;
|
||||||
|
@ExcelProperty("KANBAN#21")
|
||||||
|
private String KANBAN21;
|
||||||
|
@ExcelProperty("KANBAN#22")
|
||||||
|
private String KANBAN22;
|
||||||
|
@ExcelProperty("KANBAN#23")
|
||||||
|
private String KANBAN23;
|
||||||
|
@ExcelProperty("KANBAN#24")
|
||||||
|
private String KANBAN24;
|
||||||
|
@ExcelProperty("KANBAN#25")
|
||||||
|
private String KANBAN25;
|
||||||
|
@ExcelProperty("KANBAN#26")
|
||||||
|
private String KANBAN26;
|
||||||
|
@ExcelProperty("KANBAN#27")
|
||||||
|
private String KANBAN27;
|
||||||
|
@ExcelProperty("KANBAN#28")
|
||||||
|
private String KANBAN28;
|
||||||
|
@ExcelProperty("KANBAN#29")
|
||||||
|
private String KANBAN29;
|
||||||
|
@ExcelProperty("KANBAN#30")
|
||||||
|
private String KANBAN30;
|
||||||
|
@ExcelProperty("KANBAN#31")
|
||||||
|
private String KANBAN31;
|
||||||
|
@ExcelProperty("KANBAN#32")
|
||||||
|
private String KANBAN32;
|
||||||
|
@ExcelProperty("KANBAN#33")
|
||||||
|
private String KANBAN33;
|
||||||
|
@ExcelProperty("KANBAN#34")
|
||||||
|
private String KANBAN34;
|
||||||
|
@ExcelProperty("KANBAN#35")
|
||||||
|
private String KANBAN35;
|
||||||
|
@ExcelProperty("KANBAN#36")
|
||||||
|
private String KANBAN36;
|
||||||
|
@ExcelProperty("KANBAN#37")
|
||||||
|
private String KANBAN37;
|
||||||
|
@ExcelProperty("KANBAN#38")
|
||||||
|
private String KANBAN38;
|
||||||
|
@ExcelProperty("KANBAN#39")
|
||||||
|
private String KANBAN39;
|
||||||
|
@ExcelProperty("KANBAN#40")
|
||||||
|
private String KANBAN40;
|
||||||
|
@ExcelProperty("KANBAN#41")
|
||||||
|
private String KANBAN41;
|
||||||
|
@ExcelProperty("KANBAN#42")
|
||||||
|
private String KANBAN42;
|
||||||
|
@ExcelProperty("KANBAN#43")
|
||||||
|
private String KANBAN43;
|
||||||
|
@ExcelProperty("KANBAN#44")
|
||||||
|
private String KANBAN44;
|
||||||
|
@ExcelProperty("KANBAN#45")
|
||||||
|
private String KANBAN45;
|
||||||
|
@ExcelProperty("KANBAN#46")
|
||||||
|
private String KANBAN46;
|
||||||
|
@ExcelProperty("KANBAN#47")
|
||||||
|
private String KANBAN47;
|
||||||
|
@ExcelProperty("KANBAN#48")
|
||||||
|
private String KANBAN48;
|
||||||
|
@ExcelProperty("KANBAN#49")
|
||||||
|
private String KANBAN49;
|
||||||
|
@ExcelProperty("KANBAN#50")
|
||||||
|
private String KANBAN50;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
src/main/resources/mapper/NoPlanRecordMapper.xml
Normal file
6
src/main/resources/mapper/NoPlanRecordMapper.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?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.NoPlanRecordMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user