1.获取品规列表

2.核对信息逻辑
赣州-富士康-rfid
LAPTOP-S9HJSOEB\昊天 2 years ago
parent a4e97e1190
commit 61001ab6b7

@ -48,6 +48,8 @@ public class ConfigProperties {
private Integer serverPort;
private Long queueSpanTime = 5000L;
private String productDoc;
@Data
public static class CameraConfig{

@ -65,6 +65,13 @@ public class StockController {
}
@ApiOperation(value = "获取品规列表")
@RequestMapping(value = "/getCategoryList", method = RequestMethod.POST)
public Result<List<String>> getCategoryList() {
List<String> list = stockService.getCategoryList();
return Result.success(list);
}
@PostMapping("/statusByRowColumn")
@ApiOperation(value = "行列的盘点状态")
public Result<CheckStatus>checkStatus(@Validated @RequestBody RowColumnStatus rowColumnStatus){

@ -27,4 +27,7 @@ public class StockCheck {
@ApiModelProperty("列")
private Integer column;
private String category;
private Integer count;
}

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhehekeji.core.util.Assert;
import com.zhehekeji.web.config.ConfigProperties;
import com.zhehekeji.web.entity.Stock;
import com.zhehekeji.web.entity.CheckLog;
import com.zhehekeji.web.entity.StockLog;
@ -16,6 +17,7 @@ import com.zhehekeji.web.mapper.StockMapper;
import com.zhehekeji.web.mapper.StreetMapper;
import com.zhehekeji.web.pojo.category.PageSearch;
import com.zhehekeji.web.pojo.stock.*;
import com.zhehekeji.web.util.FileUtil;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@ -43,6 +45,8 @@ public class StockService {
private StockLogMapper stockLogMapper;
@Resource
private StreetMapper streetMapper;
@Resource
ConfigProperties configProperties;
public void importExcel(MultipartFile file) {
log.info("import excel stock");
@ -354,7 +358,10 @@ public class StockService {
log.info("check stock correct, street_id:{},direction:{},side:{},row:{},column:{}", stockCheck.getStreetId(),stockCheck.getDirection(),stockCheck.getSide(), stockCheck.getRow(), stockCheck.getColumn());
stock.setStatus(StockStatus.MANUAL.getStatus());
stock.setCount(stockCheck.getCount());
stock.setCategory(stockCheck.getCategory());
stockMapper.updateById(stock);
stock = stockMapper.selectById(stock.getId());
checkLog(stock);
return stock;
}
@ -379,16 +386,20 @@ public class StockService {
private CheckLogMapper checkLogMapper;
private void checkLog(Stock stock){
CheckLog checkLog = new CheckLog();
CheckLog checkLog = checkLogMapper.selectOne(new QueryWrapper<CheckLog>()
.eq("check_num",stock.getCheckNum())
.last("limit 1"));
checkLog.setRow(stock.getRow());
checkLog.setColumn(stock.getColumn());
checkLog.setCheckNum(stock.getCheckNum());
checkLog.setPic(stock.getCheckPic());
checkLog.setCount(stock.getCount());
checkLog.setCategory(stock.getCategory());
//checkLog.setShelveId(stock.getShelveId());
checkLog.setStatus(stock.getStatus());
checkLog.setCode(stock.getCode());
checkLog.setCreateTime(LocalDateTime.now());
checkLogMapper.insert(checkLog);
checkLogMapper.updateById(checkLog);
}
/**
@ -424,6 +435,14 @@ public class StockService {
return stock;
}
public List<String> getCategoryList() {
List<String> list = new ArrayList<>();
if(configProperties.getProductDoc() != null){
list = FileUtil.readLinesToList(configProperties.getProductDoc());
}
return list;
}
// public void init(String shelveId, Integer row, Integer column){
// Map<String,Object> map = new HashMap<>();
// map.put("shelve_id",shelveId);

@ -0,0 +1,27 @@
package com.zhehekeji.web.util;
import lombok.extern.slf4j.Slf4j;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class FileUtil {
public static List<String> readLinesToList(String path) {
List<String> lines = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(path))) {
String line;
while ((line = reader.readLine()) != null) {
lines.add(line);
}
}catch (IOException e){
log.info("读取数据失败");
}
return lines;
}
}

@ -0,0 +1,30 @@
package com.zhehekeji.web.util;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;
public class ToolUtil {
public static boolean isEmpty(Object o) {
if (o == null) {
return true;
}
if (o instanceof String) {
return ((String) o).isEmpty();
}
if (o instanceof Collection) {
return ((Collection<?>) o).isEmpty();
}
if (o instanceof Map) {
return ((Map<?, ?>) o).isEmpty();
}
if (o.getClass().isArray()) {
return Array.getLength(o) == 0;
}
return "".equals(o.toString());
}
public static boolean isNotEmpty(Object o) {
return !isEmpty(o);
}
}

@ -94,4 +94,6 @@ scanCodeMode:
trayCodeTypes:
- 14
# 照片 視頻保存多久
deleteFileDays: 30
deleteFileDays: 30
productDoc: "C:/Users/昊天/Desktop/新建 文本文档 (3).txt"
Loading…
Cancel
Save