修改查看盘点逻辑

修改逻辑
赣州-jastRFID
LAPTOP-S9HJSOEB\昊天 7 months ago
parent b0bab2b1b0
commit a2b6595d2e

@ -167,7 +167,7 @@ public class StockController {
@ApiOperation(value = "人工复核")
@RequestMapping(value = "/checkCorrect", method = RequestMethod.POST)
public Result<Stock> check(@RequestBody StockCheck stockCheck) {
validatorUtil.validate(stockCheck);
// validatorUtil.validate(stockCheck);
return Result.success(stockService.checkCorrect(stockCheck));
}

@ -6,6 +6,16 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
@Setter
@ -68,5 +78,54 @@ public class OrderInfo {
cmdCode = c;
}
public static List<String> readLinesToList(String path) {
List<String> lines = new ArrayList<>();
try (BufferedReader reader = new BufferedReader( new InputStreamReader(Files.newInputStream(Paths.get(path)), StandardCharsets.UTF_8))) {
//InputStreamReader isr = new InputStreamReader(reader,"UTF-8");//避免中文乱码
String line;
while ((line = reader.readLine()) != null) {
// lines.add(line);
String [] split = line.split(";");
for (String s : split){
if (s.contains("error")){
System.out.println(s);
}else {
if (s.contains("4.PNG")){
System.out.println(s.replace("4.PNG","2.PNG"));
}else {
System.out.println(s.replace("3.PNG","1.PNG"));
}
}
}
}
}catch (IOException e){
}
return lines;
}
public static void main(String[] args) {
String filePath = "E://91.txt";
String result = readLinesWithSemicolon(filePath);
if (result != null) {
System.out.println(result);
} else {
System.err.println("Failed to read file: " + filePath);
}
}
public static String readLinesWithSemicolon(String path) {
try {
List<String> lines = readLinesToList(path);
return null;
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
return null;
}
}
}

@ -2,6 +2,7 @@ package com.zhehekeji.web.lib.joyware;
import com.sun.jna.Pointer;
import com.zhehekeji.web.lib.CameraConnMap;
import com.zhehekeji.web.lib.OrderInfo;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@ -69,7 +70,7 @@ public class CallBack {
// if(PTZInfo.bState == 2){
// Integer cameraId = CameraConnMap.getCameraIdByLoginId(lLoginId);
// if(cameraId != null){
// OrderInfo orderInfo = CameraCaptureMap.getOrderInfoByStreetId(cameraId);
// OrderInfo orderInfo = CameraCaptureMap.getOrderInfoByStreetId(cameraId);
// log.info("cameraId:{}",cameraId);
// if(orderInfo != null && !"C6".equals(orderInfo.getCode())){
// log.info("cameraId:{} 到位 拍照,code:{},orderNUm:{}",cameraId,orderInfo.getCode(),orderInfo.getOrderNum());

@ -28,4 +28,5 @@ public class StockCheck {
private Integer column;
private Integer ok;
private Integer id;
}

@ -84,6 +84,32 @@ public class StockService {
}
public static void main(String[] args) {
// 示例main函数用于读取指定文件并将每行中含有"time:"的部分提取出来
String filePath ="E:\\m\\duoji-web-info.log";
System.out.println("正在读取文件: " + filePath);
try {
java.nio.file.Path path = java.nio.file.Paths.get(filePath);
java.nio.file.Files.lines(path)
.filter(line -> line.contains("time:"))
.forEach(line -> {
int startIndex = line.indexOf("time:") + 5; // "time:"的长度是5
// 提取"time:"后面的内容
String timeValue = line.substring(startIndex).trim();
// 去除millisecond
timeValue = timeValue.replace("millisecond","");
if (Integer.valueOf(timeValue) > 4000)
System.out.println(timeValue);
});
} catch (Exception e) {
System.err.println("读取文件时发生错误: " + e.getMessage());
e.printStackTrace();
}
}
public CheckStatus statusByRowColumn(RowColumnStatus rowColumnStatus){
CheckStatus checkStatus = new CheckStatus();
checkStatus.setColumnStart(rowColumnStatus.getColumnStart());
@ -109,7 +135,7 @@ public class StockService {
}
Map<String,Integer> columnTabCorrectCount = new LinkedHashMap<>();
Map<String,Integer> rowTabCorrectCount = new LinkedHashMap<>();
List<Stock> stocks = stockMapper.selectList(new QueryWrapper<Stock>().select("status","`row`","`column`","tray_code").eq("`street_id`",rowColumnStatus.getStreetId()).eq("direction",rowColumnStatus.getDirection()).eq("side",rowColumnStatus.getSide()));
List<Stock> stocks = stockMapper.selectList(new QueryWrapper<Stock>().select("id","status","`row`","`column`","tray_code","wms_tray_code").eq("`street_id`",rowColumnStatus.getStreetId()).eq("direction",rowColumnStatus.getDirection()).eq("side",rowColumnStatus.getSide()));
if(CollectionUtils.isEmpty(stocks)){
stockInit(rowColumnStatus.getRowStart(), rowColumnStatus.getRowEnd(), rowColumnStatus.getColumnStart(), rowColumnStatus.getColumnEnd(), null,stocks);
checkStatus.setStocks(stocks);
@ -361,7 +387,13 @@ public class StockService {
* @param stockCheck
*/
public Stock checkCorrect(StockCheck stockCheck) {
Stock stock = stockInfo(stockCheck);
Stock stock = null;
if (stockCheck.getId() != null){
stock = stockMapper.selectById(stockCheck.getId());
}else {
stockInfo(stockCheck);
}
Assert.isTrue(stock != null && stock.getId() != null, "该货位暂时没有记录");
Integer oldStatus = stock.getStatus();
//Assert.isTrue(StockStatus.ERROR.getStatus().equals(oldStatus), "无需核对");

Loading…
Cancel
Save