导出修改

下一个修改
bug修改
bozhou-古井贡酒
LAPTOP-S9HJSOEB\昊天 4 months ago
parent 47a2a00c66
commit 59fe298f24

@ -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){

@ -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;

@ -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;
/**
@ -118,8 +115,7 @@ public class PlcService {
private RfidLiveService rfidLiveService;
@Resource
private RestTemplate restTemplate ;
private RestTemplate restTemplate;
@Resource
@ -157,7 +153,7 @@ public class PlcService {
public void orderStart(PlcCmdInfo plcCmdInfo) {
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
//打开光源
streetController.openStreetLightSource( street.getId());
streetController.openStreetLightSource(street.getId());
Integer cameraId = (plcCmdInfo.getFromAround() == 1) ? street.getCamera1Id() : street.getCamera2Id();
gyrateCameraByCode(cameraId, "C5", plcCmdInfo.getTaskId());
@ -233,7 +229,7 @@ public class PlcService {
Street street = streetMapper.selectById(order.getStreetId());
//关闭光源
Thread thread = new Thread(()->{
Thread thread = new Thread(() -> {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
@ -264,7 +260,6 @@ public class PlcService {
}
public void orderStopByWarn(String orderNum) {
Order order = orderMapper.getOneByOrderNum(orderNum);
if (order == null) {
@ -278,12 +273,13 @@ public class PlcService {
upd.setStatus(1);
orderMapper.updateById(upd);
}
@Resource
private TaskDelayExecutor taskDelayExecutor;
public String cameraVideo(Integer cameraId, LocalDateTime startTime, LocalDateTime endTime) {
String path = PathUtil.createFileName("mp4", cameraId);
if(configProperties.getCameraConfig().getDownloadType() == 1){
if (configProperties.getCameraConfig().getDownloadType() == 1) {
String finalPath = path;
Thread thread = new Thread(new Runnable() {
@Override
@ -293,11 +289,11 @@ public class PlcService {
}
});
thread.start();
}else if(configProperties.getCameraConfig().getDownloadType() == 0){
Street street = streetService.getOne(new QueryWrapper<Street>().eq("camera1_Id",cameraId).or().eq("camera2_Id",cameraId));
if(street != null){
} else if (configProperties.getCameraConfig().getDownloadType() == 0) {
Street street = streetService.getOne(new QueryWrapper<Street>().eq("camera1_Id", cameraId).or().eq("camera2_Id", cameraId));
if (street != null) {
// 设置请求URL
String url = "http://"+street.getPlcIp()+":"+environment.getProperty("server.port")+"/api/camera/control/mp4/delay";
String url = "http://" + street.getPlcIp() + ":" + environment.getProperty("server.port") + "/api/camera/control/mp4/delay";
// 设置请求头
HttpHeaders headers = new HttpHeaders();
@ -316,12 +312,12 @@ public class PlcService {
restTemplate.getMessageConverters().add(new StringHttpMessageConverter(Charset.forName("utf-8")));
// 发起POST请求获取响应数据
path = restTemplate.postForObject(url, requestEntity, String.class);
path = "http://"+street.getPlcIp()+":9007/api/mp4/"+path;
path = "http://" + street.getPlcIp() + ":9007/api/mp4/" + path;
// 输出响应数据
System.out.println(path);
}else {
log.error("camera:{}未绑定巷道,无法远程下载",cameraId);
} else {
log.error("camera:{}未绑定巷道,无法远程下载", cameraId);
}
}
@ -682,26 +678,26 @@ public class PlcService {
long startTime = System.currentTimeMillis();
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
//打开光源
streetController.openStreetLightSource(street.getId());
if (checkLogMapper.selectCount(new QueryWrapper<CheckLog>()
.eq("street_Id",street.getId())
.eq("check_Num",plcCmdInfo.getOrderNum()))>0){
.eq("street_Id", street.getId())
.eq("check_Num", plcCmdInfo.getOrderNum())) > 0) {
log.error("库存信息已经盘点");
CheckLog checkLog = checkLogMapper.selectOne(new QueryWrapper<CheckLog>()
.eq("street_Id",street.getId())
.eq("check_Num",plcCmdInfo.getOrderNum()));
.eq("street_Id", street.getId())
.eq("check_Num", plcCmdInfo.getOrderNum()));
AlgorithmPojo pojo = AlgorithmPojo.buildAlgorithmPojo(street, dataInfo);
if (checkLog.getWmsCategory() != null)
pojo.setGoodsType(checkLog.getWmsCategory());
pojo.setGoodsType(checkLog.getWmsCategory());
if (checkLog.getWmsCount() != null)
pojo.setGoodsNumber(checkLog.getWmsCount());
pojo.setGoodsNumber(checkLog.getWmsCount());
if (checkLog.getCategory() != null)
pojo.setGoodsTypeResult(checkLog.getCategory());
pojo.setGoodsTypeResult(checkLog.getCategory());
if (checkLog.getCount() != null)
pojo.setGoodsNumberResult(checkLog.getCount());
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()));
@ -729,7 +725,7 @@ public class PlcService {
OrderInfo orderInfo = new OrderInfo(street, plcCmdInfo, 1, cmdCode);
Stock stock = stockMapper.getByStreetAndDirectionAndSideAndRowColumn(orderInfo.getStreetId(), plcCmdInfo.getFromDirection(), orderInfo.getSeparation(), orderInfo.getRow(), orderInfo.getColumn());
AlgorithmPojo algorithmPojo = algorithmService.getGoodResult(street, dataInfo);
String paths = String.join(";", algorithmPojo.getCalculate().getFisheye()) +";"+String.join(";",algorithmPojo.getCalculate().getCloseUp())+";"+algorithmPojo.getCalculate().getPath();
String paths = String.join(";", algorithmPojo.getCalculate().getFisheye()) + ";" + String.join(";", algorithmPojo.getCalculate().getCloseUp()) + ";" + algorithmPojo.getCalculate().getPath();
//货物使用球机扫码
@ -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();
@ -900,11 +900,11 @@ public class PlcService {
plcCmdInfo.setFromAround(dataInfo.getFromAround());
plcCmdInfo.setToSide(dataInfo.getToSeparation());
//古井贡增加层概念,等于行
if( dataInfo.getToStorey()!=null ){
if (dataInfo.getToStorey() != null) {
plcCmdInfo.setToRow(dataInfo.getToStorey());
plcCmdInfo.setRow2(dataInfo.getToStorey());
}
if( dataInfo.getFromStorey()!=null ){
if (dataInfo.getFromStorey() != null) {
plcCmdInfo.setFromRow(dataInfo.getFromStorey());
plcCmdInfo.setRow1(dataInfo.getFromStorey());
}
@ -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())) {
@ -976,12 +991,12 @@ public class PlcService {
String code = dataInfo.getCmdName();
log.info("盘点指令:{}", ksecInfo);
AlgorithmPojo algorithmPojo = check(plcCmdInfo, ksecInfo.getType(), dataInfo);
ksecInfo.getData().setAckStatus(1);
dataInfo.setResult(algorithmPojo.getResult());
dataInfo.setGoodsTypeResult(algorithmPojo.getGoodsTypeResult());
dataInfo.setGoodsNumberResult(algorithmPojo.getGoodsNumberResult());
log.info("盘点完成");
AlgorithmPojo algorithmPojo = check(plcCmdInfo, ksecInfo.getType(), dataInfo);
ksecInfo.getData().setAckStatus(1);
dataInfo.setResult(algorithmPojo.getResult());
dataInfo.setGoodsTypeResult(algorithmPojo.getGoodsTypeResult());
dataInfo.setGoodsNumberResult(algorithmPojo.getGoodsNumberResult());
log.info("盘点完成");
// if (configProperties.getOrderTest() == 1) {
// checkTest(plcCmdInfo);

@ -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,43 +504,27 @@ 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) {
String[] pics = stock.getPreoperationPic().split(";");
if (pics.length>3)
stock.setSidePic1(String.format("%s%s", ip, pics[3]));
if (pics.length>2)
stock.setSidePic2(String.format("%s%s", ip, pics[2]));
if (pics.length>4)
stock.setSidePic3(String.format("%s%s", ip, pics[4]));
if (pics.length>5)
stock.setSidePic4(String.format("%s%s", ip, pics[5]));
stock.setTopPic1(String.format("%s%s", ip, pics[0]));
if (pics.length>1)
stock.setTopPic2(String.format("%s%s", ip, pics[1]));
}
String ip ="http://"+ street.getPlcIp()+":9002/pic/";
if (stock.getPreoperationPic() != null&& stock.getPreoperationPic().length() > 0) {
String[] pics = stock.getPreoperationPic().split(";");
if (pics.length>3)
stock.setSidePic1(String.format("%s%s", ip, pics[3]));
if (pics.length>2)
stock.setSidePic2(String.format("%s%s", ip, pics[2]));
if (pics.length>4)
stock.setSidePic3(String.format("%s%s", ip, pics[4]));
if (pics.length>5)
stock.setSidePic4(String.format("%s%s", ip, pics[5]));
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();

@ -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