关灯修改

bozhou-古井贡酒
LAPTOP-S9HJSOEB\昊天 4 months ago
parent 47a2a00c66
commit cb033949e0

@ -79,11 +79,10 @@
<artifactId>filter</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.1.1</version>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>com.sun.jna</groupId>

@ -92,6 +92,10 @@ public class OrderController {
return ResultResp.success(ksecDataInfos);
}
public static void main(String[] args) {
String i = "KsecInfos(header=BQ, Type=C, data=[KsecDataInfo(SRMNumber=SRM01, cmdName=C1, taskId=96d2c9a0e6664cc88e9b97c5aba02808, fromColumn=0, fromRow=0, fromStorey=0, fromDirection=2, fromSide=null, fromSeparation=0, toColumn=25, toRow=1, toStorey=6, toDirection=1, toSide=null, toSeparation=2, code=, warnCode=, ackStatus=null, trayCode=100132049539, goodsType=, goodsNumber=0, goodsTypeResult=, goodsNumberResult=0, result=0, lotnum=, fromAround=1), KsecDataInfo(SRMNumber=SRM01, cmdName=C1, taskId=f5ed012f8d92418387b4b57462928bce, fromColumn=0, fromRow=0, fromStorey=0, fromDirection=2, fromSide=null, fromSeparation=0, toColumn=26, toRow=1, toStorey=6, toDirection=1, toSide=null, toSeparation=2, code=, warnCode=, ackStatus=null, trayCode=100132049539, goodsType=, goodsNumber=0, goodsTypeResult=, goodsNumberResult=0, result=0, lotnum=, fromAround=2)])";
}
@ApiOperation("发生告警")
@GetMapping("/error")
public Result orderError(@ApiParam("plc") @RequestParam String plcId){

@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
@Api(value = "StreetController",tags = "巷道管理")
@RestController(value = "StreetController")
@ -129,6 +131,58 @@ public class StreetController {
return Result.success();
}
// 在 PlcService 类中已有类似的实现
private static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10);
private static ConcurrentHashMap<String, ScheduledFuture<?>> scheduledTasks = new ConcurrentHashMap<>();
// 添加可刷新的延时任务
public void addRefreshableDelayTask(String taskId, Runnable task, long delaySeconds) {
// 取消已存在的任务
ScheduledFuture<?> existingTask = scheduledTasks.remove(taskId);
if (existingTask != null && !existingTask.isDone()) {
existingTask.cancel(false);
}
// 添加新任务
ScheduledFuture<?> future = scheduler.schedule(task, delaySeconds, TimeUnit.SECONDS);
scheduledTasks.put(taskId, future);
}
// 刷新任务时间(重新调度)
public void refreshDelayTask(String taskId, Runnable task, long delaySeconds) {
addRefreshableDelayTask(taskId, task, delaySeconds);
}
// 取消任务
public void cancelDelayTask(String taskId) {
ScheduledFuture<?> existingTask = scheduledTasks.remove(taskId);
if (existingTask != null && !existingTask.isDone()) {
existingTask.cancel(false);
}
}
public void openStreetLightSourceAsyncClose(Integer streetId){
List<LightSource> lightSources = lightSourceService.getLightSourceByStreetId(streetId);
lightSources.forEach(lightSource -> {
if(configProperties.getLightSource().getType() == 1){
JYDAMEquip equip = JYDamHelper.Connect(lightSource.getIp(),lightSource.getPort());
JYDamHelper.openDO(equip,configProperties.getLightSource().getIndex());
Integer status = JYDamHelper.ReadStatus(equip,configProperties.getLightSource().getNum(),configProperties.getLightSource().getIndex());
log.info("ip:{},status:{}",lightSource.getIp(),status);
equip.DisConnect();
}else if(configProperties.getLightSource().getType() == 2){
HikControlSocket.openLight(lightSource.getIp(),lightSource.getPort(),configProperties.getLightSource().getIndex(),1);
}else if (configProperties.getLightSource().getType() == 3){
LightSourceService.lightController(lightSource.getIp(),lightSource.getPort(),1);
}
});
addRefreshableDelayTask("closeLightSource"+streetId,()->{
closeStreetLightSource(streetId);
},30);
}
@GetMapping("/lightSource/open/{streetId}")
@ApiOperation(value = "开启单个巷道光源")

@ -27,7 +27,7 @@ public class Category {
@TableField(value = "`number`")
private Integer number;
private Integer degree;
private Double degree;
private Integer milliliter;
private String image;

@ -12,6 +12,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Data
@TableName("`stock`")
@ -108,4 +109,12 @@ public class Stock {
@TableField(exist=false)
private String sidePic4;
// 获取格式化后的字符串
public String getFormattedExportTime() {
if (exportTime != null) {
return exportTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
return null;
}
}

@ -2,8 +2,8 @@ package com.zhehekeji.web.pojo.stock;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.CellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import java.time.LocalDateTime;
@ -20,21 +20,5 @@ public class LocalDateTimeConvert implements Converter<LocalDateTime> {
return null;
}
@Override
public LocalDateTime convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return null;
}
@Override
public CellData convertToExcelData(LocalDateTime localDateTime, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
if (localDateTime != null) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
String time = localDateTime.format(formatter);
return new CellData(time);
}
return null;
}
}

@ -1,6 +1,7 @@
package com.zhehekeji.web.pojo.stock;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.time.LocalDateTime;
@ -11,37 +12,54 @@ public class StockExportExcel {
@ExcelProperty(index = 0, value = "巷道名称")
private String streetName;
@ExcelProperty(index = 8, value = "盘点批次号")
@ExcelProperty(index = 1, value = "盘点批次号")
private String lotnum;
@ExcelProperty(index = 5, value = "条码")
private String code;
@ExcelProperty(index = 6, value = "WMS条码")
private String wmsCode;
@ExcelProperty(index = 2, value = "位置" )
@ColumnWidth(30) // 设置列宽为25个字符宽度
private String direction;
//
// @ExcelProperty(index = 2, value = "深浅,1:浅货位,2:深货位")
// private String side;
//
//// @ExcelProperty(index = 1, value = "货架号")
//// private String shelveId;
//
//// @ExcelProperty(index = 5, value = "数量")
//// private Integer count;
//
// @ExcelProperty(index = 3, value = "行")
// private String row;
//
// @ExcelProperty(index = 4, value = "列")
// private String column;
@ExcelProperty(index = 1, value = "左右,1:左侧,2:右侧")
private Integer direction;
@ExcelProperty(index = 2, value = "深浅,1:浅货位,2:深货位")
private Integer side;
// @ExcelProperty(index = 1, value = "货架号")
// private String shelveId;
@ExcelProperty(index = 3, value = "上位品规")
private String wmsCategory;
// @ExcelProperty(index = 5, value = "数量")
// private Integer count;
@ExcelProperty(index = 3, value = "行")
private Integer row;
@ExcelProperty(index = 4, value = "核对品规结果")
private String category;
@ExcelProperty(index = 4, value = "列")
private Integer column;
@ExcelProperty(index = 7, value = "盘点结果", converter = StockStatusConvert.class)
private Integer status;
@ExcelProperty(index = 5, value = "上位个数")
private Integer wmsCount;
@ExcelProperty(index = 9, value = "时间", converter = LocalDateTimeConvert.class)
private LocalDateTime exportTime;
@ExcelProperty(index = 6, value = "核对个数")
private Integer count;
@ExcelProperty(index = 7, value = "盘点结果")
private String status;
@ExcelProperty(index = 8, value = "时间")
private String exportTime;
}

@ -2,8 +2,8 @@ package com.zhehekeji.web.pojo.stock;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.CellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
public class StockStatusConvert implements Converter<Integer> {
@ -17,20 +17,6 @@ public class StockStatusConvert implements Converter<Integer> {
return null;
}
@Override
public Integer convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return null;
}
@Override
public CellData convertToExcelData(Integer integer, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
for (StockStatus orderStatus : StockStatus.values()) {
if (orderStatus.getStatus().equals(integer)) {
return new CellData(orderStatus.getName());
}
}
return null;
}
}

@ -16,7 +16,6 @@ import com.zhehekeji.web.service.damLightSource.JYDamHelper;
import com.zhehekeji.web.service.hikLightSource.HikControlSocket;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import net.sf.cglib.core.Local;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@ -113,34 +112,34 @@ public class CronTab {
}
}
}
@Scheduled(cron = "0 0/1 * * * ?")
public void lightStatus() {
log.debug(" lightStatus");
long timeStamp = System.currentTimeMillis();
Iterator<Map.Entry<Integer, Long>> it = lightTimeMap.entrySet().iterator();
while (it.hasNext()){
Map.Entry<Integer, Long> entry = it.next();
if((BigInteger.valueOf(timeStamp).subtract(BigInteger.valueOf(entry.getValue()))).compareTo(timeDIff) > 0){
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",entry.getKey()));
lightSources.forEach(lightSource -> {
if(configProperties.getLightSource().getType() == 1){
JYDAMEquip equip = JYDamHelper.Connect(lightSource.getIp(),lightSource.getPort());
JYDamHelper.closeDO(equip,configProperties.getLightSource().getIndex());
//不再获取灯光状态
//Integer status = JYDamHelper.ReadStatus(equip,configProperties.getLightSource().getNum(),configProperties.getLightSource().getIndex());
//log.info("ip:{},status:{}",lightSource.getIp(),status);
equip.DisConnect();
}else if(configProperties.getLightSource().getType() == 2){
HikControlSocket.openLight(lightSource.getIp(),lightSource.getPort(),configProperties.getLightSource().getIndex(),0);
}
});
it.remove();
}
}
}
//
// @Scheduled(cron = "0 0/1 * * * ?")
// public void lightStatus() {
// log.debug(" lightStatus");
// long timeStamp = System.currentTimeMillis();
//
// Iterator<Map.Entry<Integer, Long>> it = lightTimeMap.entrySet().iterator();
// while (it.hasNext()){
// Map.Entry<Integer, Long> entry = it.next();
// if((BigInteger.valueOf(timeStamp).subtract(BigInteger.valueOf(entry.getValue()))).compareTo(timeDIff) > 0){
// List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",entry.getKey()));
// lightSources.forEach(lightSource -> {
// if(configProperties.getLightSource().getType() == 1){
//
// JYDAMEquip equip = JYDamHelper.Connect(lightSource.getIp(),lightSource.getPort());
// JYDamHelper.closeDO(equip,configProperties.getLightSource().getIndex());
// //不再获取灯光状态
// //Integer status = JYDamHelper.ReadStatus(equip,configProperties.getLightSource().getNum(),configProperties.getLightSource().getIndex());
// //log.info("ip:{},status:{}",lightSource.getIp(),status);
// equip.DisConnect();
// }else if(configProperties.getLightSource().getType() == 2){
// HikControlSocket.openLight(lightSource.getIp(),lightSource.getPort(),configProperties.getLightSource().getIndex(),0);
// }
// });
// it.remove();
// }
// }
// }
@Scheduled(cron = "0 4 0 * * ? ")

@ -53,10 +53,7 @@ import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import java.util.stream.Collectors;
/**
@ -121,7 +118,6 @@ public class PlcService {
private RestTemplate restTemplate;
@Resource
private Environment environment;
@ -264,7 +260,6 @@ public class PlcService {
}
public void orderStopByWarn(String orderNum) {
Order order = orderMapper.getOneByOrderNum(orderNum);
if (order == null) {
@ -278,6 +273,7 @@ public class PlcService {
upd.setStatus(1);
orderMapper.updateById(upd);
}
@Resource
private TaskDelayExecutor taskDelayExecutor;
@ -682,6 +678,8 @@ public class PlcService {
long startTime = System.currentTimeMillis();
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
//打开光源
streetController.openStreetLightSourceAsyncClose(street.getId());
if (checkLogMapper.selectCount(new QueryWrapper<CheckLog>()
.eq("street_Id", street.getId())
.eq("check_Num", plcCmdInfo.getOrderNum())) > 0) {
@ -700,14 +698,12 @@ public class PlcService {
pojo.setGoodsNumberResult(checkLog.getCount());
return pojo;
}
//打开光源
streetController.openStreetLightSource( street.getId());
CronTab.putTime(street.getId());
plcCmdInfo.setStreetName(street.getName());
// List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id", street.getId()));
//关闭光源
streetController.openStreetLightSource(street.getId());
streetController.openStreetLightSourceAsyncClose(street.getId());
log.info("盘点摄像头变化参数:" + plcCmdInfo.toString());
@ -734,17 +730,17 @@ public class PlcService {
//货物使用球机扫码
log.info("盘点信息:{}", algorithmPojo.toString());
//关闭光源
Thread thread = new Thread(() -> {
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
//关闭光源
streetController.closeStreetLightSource(street.getId());
});
thread.start();
// //关闭光源
// Thread thread = new Thread(() -> {
// try {
// Thread.sleep(30000);
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
// //关闭光源
// streetController.closeStreetLightSource(street.getId());
// });
// thread.start();
//核对异常
Integer status = 4;
//托盘和货物都正确
@ -871,6 +867,10 @@ public class PlcService {
return configProperties;
}
// 在PlcService类中添加以下静态成员
private static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10);
private static ConcurrentHashMap<String, ScheduledFuture<?>> scheduledTasks = new ConcurrentHashMap<>();
public KsecDataInfo orderDecoder(KsecInfo ksecInfo) {
log.info("收到命令:{}", ksecInfo.toString());
KsecDataInfo dataInfo = ksecInfo.getData();
@ -944,10 +944,25 @@ public class PlcService {
//任务开始 旋转到原点位
gyrateCamera(plcCmdInfo, Cmd.C5.name());
orderStart(plcCmdInfo);
// 添加延时任务
PlcCmdInfo finalPlcCmdInfo = plcCmdInfo;
ScheduledFuture<?> future = scheduler.schedule(() -> {
// 执行orderStop
orderStop(finalPlcCmdInfo);
// 从map中移除已执行的任务
scheduledTasks.remove(finalPlcCmdInfo.getTaskId());
}, 5, TimeUnit.MINUTES);
// 将future放入map中便于后续取消
scheduledTasks.put(plcCmdInfo.getTaskId(), future);
} else if (Cmd.B2.name().equals(cmdName)) {
// 取消对应的计划任务(如果存在)
ScheduledFuture<?> existingTask = scheduledTasks.remove(plcCmdInfo.getTaskId());
if (existingTask != null && !existingTask.isDone()) {
existingTask.cancel(false); // 取消尚未执行的任务
}
orderStop(plcCmdInfo);
}
} else if (Cmd.C.name().equals(ksecInfo.getType())) {

@ -273,23 +273,34 @@ public class StockService {
* @return
*/
public List<StockExportExcel> exportExcels(Integer streetId) {
String[] status = {"未盘点","盘点异常","盘点正确","人工盘点正确","待人工盘点"};
List<Stock> stocks = list(streetId);
Street street = streetService.streetById(streetId);
List<StockExportExcel> stockExportExcels = new ArrayList<>(stocks.size());
stocks.forEach(stock -> {
StockExportExcel stockExportExcel = new StockExportExcel();
stockExportExcel.setCode(stock.getTrayCode());
stockExportExcel.setLotnum(stock.getLotnum());
stockExportExcel.setColumn(stock.getColumn());
stockExportExcel.setWmsCode(stock.getWmsTrayCode());
//stockExportExcel.setCount(stock.getCount());
stockExportExcel.setRow(stock.getRow());
stockExportExcel.setStreetName(street.getName());
stockExportExcel.setExportTime(stock.getExportTime());
stockExportExcel.setDirection(stock.getDirection());
stockExportExcel.setSide(stock.getSide());
//stockExportExcel.setShelveId(stock.getShelveId());
stockExportExcel.setStatus(stock.getStatus());
stockExportExcel.setLotnum(stock.getLotnum());
stockExportExcel.setDirection((stock.getDirection() == 1 ? "左侧" : "右侧")+"-"+(stock.getSide()==1?"浅货位":"深货位")+"-"+stock.getRow()+"层"+"-"+stock.getColumn()+"列");
stockExportExcel.setWmsCategory(stock.getWmsCategory());
stockExportExcel.setCategory((stock.getCategory() == null||stock.getWmsCategory() == null) ? "无" : (stock.getWmsCategory().equals(stock.getCategory())?"一致":"不一致"));
stockExportExcel.setWmsCount(stock.getWmsCount());
stockExportExcel.setCount(stock.getCount()+stock.getCountTop());
stockExportExcel.setStatus(status[stock.getStatus()]);
stockExportExcel.setExportTime(stock.getFormattedExportTime());
// stockExportExcel.setCode(stock.getTrayCode());
// stockExportExcel.setLotnum(stock.getLotnum());
// stockExportExcel.setColumn(stock.getColumn());
// stockExportExcel.setWmsCode(stock.getWmsTrayCode());
// //stockExportExcel.setCount(stock.getCount());
// stockExportExcel.setRow(stock.getRow());
// stockExportExcel.setStreetName(street.getName());
// stockExportExcel.setExportTime(stock.getExportTime());
// stockExportExcel.setDirection(stock.getDirection());
// stockExportExcel.setSide(stock.getSide());
// //stockExportExcel.setShelveId(stock.getShelveId());
// stockExportExcel.setStatus(stock.getStatus());
stockExportExcels.add(stockExportExcel);
});
return stockExportExcels;
@ -297,6 +308,7 @@ public class StockService {
public List<StockExportExcel> exportAllExcels() {
String[] status = {"未盘点","盘点异常","盘点正确","人工盘点正确","待人工盘点"};
List<Stock> stocks = stockMapper.selectByMap(new HashMap<>());
List<Street> streets = streetMapper.selectByMap(new HashMap<>());
Map<Integer,String> streetMap = new HashMap<>();
@ -307,16 +319,27 @@ public class StockService {
List<StockExportExcel> stockExportExcels = new ArrayList<>(stocks.size());
stocks.forEach(stock -> {
StockExportExcel stockExportExcel = new StockExportExcel();
stockExportExcel.setCode(stock.getTrayCode());
stockExportExcel.setLotnum(stock.getLotnum());
stockExportExcel.setColumn(stock.getColumn());
//stockExportExcel.setCount(stock.getCount());
stockExportExcel.setRow(stock.getRow());
stockExportExcel.setStreetName(streetMap.get(stock.getStreetId()));
stockExportExcel.setExportTime(stock.getExportTime());
stockExportExcel.setDirection(stock.getDirection());
stockExportExcel.setSide(stock.getSide());
stockExportExcel.setStatus(stock.getStatus());
stockExportExcel.setLotnum(stock.getLotnum());
stockExportExcel.setDirection((stock.getDirection() == 1 ? "左侧" : "右侧")+"-"+(stock.getSide()==1?"浅货位":"深货位")+"-"+stock.getRow()+"层"+"-"+stock.getColumn()+"列");
stockExportExcel.setWmsCategory(stock.getWmsCategory());
stockExportExcel.setCategory((stock.getCategory() == null||stock.getWmsCategory() == null) ? "无" : (stock.getWmsCategory().equals(stock.getCategory())?"一致":"不一致"));
stockExportExcel.setWmsCount(stock.getWmsCount());
stockExportExcel.setCount(stock.getCount()+stock.getCountTop());
stockExportExcel.setStatus(status[stock.getStatus()]);
stockExportExcel.setExportTime(stock.getFormattedExportTime());
// stockExportExcel.setCode(stock.getTrayCode());
// stockExportExcel.setLotnum(stock.getLotnum());
// stockExportExcel.setColumn(stock.getColumn());
// stockExportExcel.setWmsCode(stock.getWmsTrayCode());
// //stockExportExcel.setCount(stock.getCount());
// stockExportExcel.setRow(stock.getRow());
// stockExportExcel.setStreetName(street.getName());
// stockExportExcel.setExportTime(stock.getExportTime());
// stockExportExcel.setDirection(stock.getDirection());
// stockExportExcel.setSide(stock.getSide());
// //stockExportExcel.setShelveId(stock.getShelveId());
// stockExportExcel.setStatus(stock.getStatus());
stockExportExcels.add(stockExportExcel);
});
return stockExportExcels;
@ -342,8 +365,6 @@ public class StockService {
}else {
stock.setStreetName(street.getName());
}
//不再需要操作照片
List<StockLog> stockLogs = stockLogMapper.selectList(new QueryWrapper<StockLog>().eq("`row`",stockCheck.getRow()).eq("`column`",stockCheck.getColumn()).eq("street_id",stockCheck.getStreetId()).eq("direction",stockCheck.getDirection()).eq("side",stockCheck.getSide()).orderByDesc("create_time").last(" limit 2"));
// if(stockLogs.size() == 1){
// stock.setOveroperationPic(stockLogs.get(0).getPic());
// }else if(stockLogs.size() == 2){
@ -417,7 +438,7 @@ public class StockService {
log.info("check stock correct, street_id:{},direction:{},side:{},row:{},column:{}", stockCheck.getStreetId(),stockCheck.getDirection(),stockCheck.getSide(), stockCheck.getRow(), stockCheck.getColumn());
int count =(stock.getCount() != null) ? stock.getCount() : 0;
if(stockCheck.getCountTop()+ count == stock.getWmsCount() && stock.getWmsCategory().equals(stockCheck.getCategory())){
if(stockCheck.getCountTop()+ count == stock.getWmsCount() ){
stock.setStatus(StockStatus.MANUAL.getStatus());
}else {
@ -483,26 +504,12 @@ public class StockService {
public Stock nextOne(Long id) {
QueryWrapper<Stock> stockQueryWrapper = new QueryWrapper<>();
stockQueryWrapper.eq("status","0").or().eq("status","1")
stockQueryWrapper.eq("status","0").or().eq("status","1").or().eq("status","4")
.ne(ToolUtil.isNotEmpty(id),"id",id)
.orderByDesc("export_time").last("limit 1");
Stock stock =stockMapper.selectOne(stockQueryWrapper);
if (stock != null) {
Street street = streetMapper.selectById(stock.getStreetId());
stock.setStreetName(street.getName());
List<StockLog> stockLogs = stockLogMapper.selectList(new QueryWrapper<StockLog>()
.eq("`row`",stock.getRow())
.eq("`column`",stock.getColumn())
.eq("street_id",stock.getStreetId())
.eq("direction",stock.getDirection())
.eq("side",stock.getSide())
.orderByDesc("create_time").last(" limit 2"));
if(stockLogs.size() == 1){
stock.setOveroperationPic(stockLogs.get(0).getPic());
}else if(stockLogs.size() == 2){
stock.setOveroperationPic(stockLogs.get(0).getPic());
stock.setPreoperationPic(stockLogs.get(1).getPic());
}
Street street = streetService.getById(stock.getStreetId());
String ip ="http://"+ street.getPlcIp()+":9002/pic/";
if (stock.getPreoperationPic() != null&& stock.getPreoperationPic().length() > 0) {
@ -518,8 +525,6 @@ public class StockService {
stock.setTopPic1(String.format("%s%s", ip, pics[0]));
if (pics.length>1)
stock.setTopPic2(String.format("%s%s", ip, pics[1]));
}
}
return stock;

@ -75,7 +75,7 @@ public class AlgorithmService {
public static List<String> readJsonArrayFile(String fileName) {
try {
String content = new String(Files.readAllBytes(Paths.get(fileName)));
String content = new String(Files.readAllBytes(Paths.get(fileName)), "UTF-8");
return JSON.parseArray(content, String.class);
} catch (IOException e) {
e.printStackTrace();
@ -84,6 +84,11 @@ public class AlgorithmService {
}
public AlgorithmPojo getGoodResultHttp(AlgorithmPojo algorithmPojo) {
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
String url = "http://"+algorithmPojo.getIp()+":8094/industrialCamera/panoramaAlgorithm";
//String url = "http://127.0.0.1:8083"+"/visionCompute";
@ -124,6 +129,8 @@ public class AlgorithmService {
}catch (Exception e){
log.error("堆垛机报错"+e);
e.printStackTrace();
algorithmPojo.setResult(0);
return algorithmPojo;
}
return algorithmPojo;
}

@ -1,6 +1,5 @@
package com.zhehekeji.web.util;
import com.alibaba.excel.util.CollectionUtils;
import org.apache.poi.util.ArrayUtil;
import java.lang.reflect.Array;

Loading…
Cancel
Save