玉溪修改

玉溪
LAPTOP-S9HJSOEB\昊天 4 months ago
parent 0004020a91
commit 4e21675f19

@ -14,6 +14,7 @@ import cn.iocoder.yudao.module.camera.dal.dataobject.checklog.CheckLogDO;
import cn.iocoder.yudao.module.camera.dal.dataobject.resources.URLResourcesDo;
import cn.iocoder.yudao.module.camera.dal.dataobject.stock.StockDO;
import cn.iocoder.yudao.module.camera.dal.entity.ScanData;
import cn.iocoder.yudao.module.camera.dal.entity.ScanDateReqs;
import cn.iocoder.yudao.module.camera.dal.entity.ScanStatus;
import cn.iocoder.yudao.module.camera.dal.entity.echarts.EChartsOption;
import cn.iocoder.yudao.module.camera.service.checklog.CheckLogService;
@ -110,13 +111,13 @@ public class StockController {
@Operation(summary = "获得巷道所有盘点状态")
//@Parameter(name = "id", description = "巷道id", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('logistics:stock:getStreetList')")
public CommonResult<List<ScanData>> getStreetStatus(@RequestBody ScanData scanData) {
public CommonResult<List<ScanDateReqs>> getStreetStatus(@RequestBody ScanData scanData) {
List<StockDO> stockStreetList = stockService.list(new QueryWrapper<StockDO>()
.eq(scanData.getStreetId()!=null,"street_Id", scanData.getStreetId())
.eq(scanData.getDirection()!=null,"direction", scanData.getDirection()));
Map<String, DictDataDO> dictValueMap = dictDataService.getDictValueMap("check_status");
List<ScanData> scanDataList = BeanUtils.toBean(stockStreetList, ScanData.class);
for (ScanData scan:scanDataList){
List<ScanDateReqs> scanDataList = BeanUtils.toBean(stockStreetList, ScanDateReqs.class);
for (ScanDateReqs scan:scanDataList){
scan.setColour(dictValueMap.get(String.valueOf(scan.getStatus())).getColorType());
scan.setStatusString(dictValueMap.get(String.valueOf(scan.getStatus())).getLabel());
}

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.camera.dal.entity;
import lombok.Data;
@Data
public class ScanDateReqs {
private Long id;
private String colour;
private Integer row;
private Integer column;
private String statusString;
private Integer status;
}

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.camera.framework.netty.ksec;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.module.camera.controller.admin.tcpclientlog.vo.TcpClientLogSaveReqVO;
import cn.iocoder.yudao.module.camera.framework.netty.NettyFilterDate;
import cn.iocoder.yudao.module.camera.service.plc.PLCService;
@ -124,6 +125,10 @@ public class KsecDecoder extends DelimiterBasedFrameDecoder {
//智能盘点
plcService.checkYx(dataInfo);
dataInfo.setAckStatus(1);
ctx.channel().writeAndFlush(JSONUtil.toJsonStr(ksecInfo));
// ctx.writeAndFlush(JSONUtil.toJsonStr(ksecInfo));
}

@ -31,6 +31,10 @@ public class CheckIntellBlinkChanel {
public static void pictures(String SRMNumber,String taskId,String cameraType,String cameraId){
Channel channel= channelMap.get( SRMNumber);
System.out.println(SRMNumber+"");
if (channel==null){
log.error("通道不存在");
return;
}
//替换相机
channel.writeAndFlush("replace:"+cameraId+";");
@ -38,6 +42,12 @@ public class CheckIntellBlinkChanel {
channel.writeAndFlush("cameraType:"+cameraType+";");
//唯一id
channel.writeAndFlush("taskId:"+taskId+";");
try {
Thread.sleep(300);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
//拍照
channel.writeAndFlush("camera:1;");
}

@ -20,6 +20,8 @@ public class AlgorithmDelayTask implements Delayed {
private String trayCode = "NULL";
private String storageCode = "NULL";
private String path;
private String uuid;
private Integer status;
private long executeTime;

@ -41,7 +41,7 @@ public class GetPhotoDelayExecutor {
CheckIntellBlinkChanel.pictures(cameraDelayTask.getSRMNumber(),cameraDelayTask.getTaskId(),cameraType
, dictDataService.parseDictData("camera_position", type).getValue());
try {
Thread.sleep(500);
Thread.sleep(200);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@ -51,6 +51,8 @@ public class GetPhotoDelayExecutor {
CheckIntellBlinkChanel.pictures(cameraDelayTask.getSRMNumber(),cameraDelayTask.getTaskId(),cameraTypeDown
, dictDataService.parseDictData("camera_position", typeDown).getValue());
//码位为库 货架号 层 列
CheckIntellBlinkDecoder.setHttp(cameraDelayTask, dictDataService.parseDictData("camera_conf", "storageUrl").getValue());
String storageCode = "F"
+ dictDataService.parseDictData("base_conf", "library_code").getValue()
+formatNumber((Integer.parseInt(cameraDelayTask.getSRMNumber())-1)*2+cameraDelayTask.getDirection(),2)
@ -59,8 +61,6 @@ public class GetPhotoDelayExecutor {
if (cameraDelayTask.getRow()!=0 && cameraDelayTask.getColumn()!=0) {
cameraDelayTask.setStorageCode(storageCode);
}
CheckIntellBlinkDecoder.setHttp(cameraDelayTask, dictDataService.parseDictData("camera_conf", "storageUrl").getValue());
//如果队列中没有,则只记录
plcService.stockSave(cameraDelayTask);

@ -47,6 +47,8 @@ import java.util.UUID;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicReference;
import static cn.iocoder.yudao.module.camera.framework.netty.streetAlgorithm.executor.GetPhotoDelayExecutor.formatNumber;
@Service
@Slf4j
public class PLCServiceImpl implements PLCService {
@ -320,7 +322,7 @@ public class PLCServiceImpl implements PLCService {
// getPhotoDelayExecutor.communicationFactory(algorithmDelayTask);
}
// 玉溪check
public void checkYx(KsecDataInfo dataInfo){
public void checkYx(KsecDataInfo dataInfo){
long startTime = System.currentTimeMillis();
String uuid = UUID.randomUUID().toString();
@ -372,58 +374,67 @@ public void checkYx(KsecDataInfo dataInfo){
// 默认正确
AtomicReference<String> status = new AtomicReference<>("2");
StockDO finalStock = stock;
List<CompletableFuture<ScanData>> futures = dictDataList.values().stream()
.filter(dictDataDO -> !dictDataDO.getValue().equals("0"))
.map(dictDataDO -> CompletableFuture.supplyAsync(() ->
// 调用扫码服务,包含图片保存等不进行修改finalStock
scanServiceFactory.scan(dictDataDO.getValue(), street, dataInfo, finalStock)
).thenApply(result -> {
// 任务完成后,基于返回的结果进行操作
// 如果有扫码结果,并且扫码结果为假,则修改状态为错误
// 获取字段对象
try {
String wmsType = "wms" + capitalize(dictDataDO.getLabel());
Field stockField = finalStock.getClass().getDeclaredField(dictDataDO.getLabel());
Field wmsField = KsecDataInfo.class.getDeclaredField(dictDataDO.getLabel());
Field stockWmsField = finalStock.getClass().getDeclaredField(wmsType);
wmsField.setAccessible(true);
stockField.setAccessible(true);
stockWmsField.setAccessible(true);
String wmsCode = (String) wmsField.get(dataInfo);
if (!result.getCode().equals(wmsCode)) {
status.set("1");
}
stockField.set(finalStock, result.getCode());
stockWmsField.set(finalStock, wmsCode);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
// 扫码枪扫描
ScanData trayCode = scanServiceFactory.scan("1", street, dataInfo, finalStock);
stock.setWmsTrayCode(trayCode.getCode());
stock.setTrayCode(dataInfo.getTrayCode());
if (!stock.getWmsTrayCode().equals(stock.getTrayCode())){
status.set("1");
}
return result;
}
).orTimeout(10, TimeUnit.SECONDS)
.exceptionally(ex -> {
if (ex instanceof TimeoutException) {
status.set("1");
}
return null;
})
)
.toList();
// 等待所有异步任务完成
CompletableFuture<Void> allOf = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
try {
allOf.get(); // 阻塞直到所有任务完成
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
//
//
// List<CompletableFuture<ScanData>> futures = dictDataList.values().stream()
// .filter(dictDataDO -> !dictDataDO.getValue().equals("0"))
// .map(dictDataDO -> CompletableFuture.supplyAsync(() ->
//// 调用扫码服务,包含图片保存等不进行修改finalStock
//
// ).thenApply(result -> {
// // 任务完成后,基于返回的结果进行操作
//// 如果有扫码结果,并且扫码结果为假,则修改状态为错误
// // 获取字段对象
//
// try {
// String wmsType = "wms" + capitalize(dictDataDO.getLabel());
// Field stockField = finalStock.getClass().getDeclaredField(dictDataDO.getLabel());
// Field wmsField = KsecDataInfo.class.getDeclaredField(dictDataDO.getLabel());
//
// Field stockWmsField = finalStock.getClass().getDeclaredField(wmsType);
// wmsField.setAccessible(true);
// stockField.setAccessible(true);
// stockWmsField.setAccessible(true);
// String wmsCode = (String) wmsField.get(dataInfo);
//
// if (!result.getCode().equals(wmsCode)) {
// status.set("1");
// }
// stockField.set(finalStock, result.getCode());
// stockWmsField.set(finalStock, wmsCode);
// } catch (NoSuchFieldException | IllegalAccessException e) {
// e.printStackTrace();
// status.set("1");
// }
//
// return result;
// }
// ).orTimeout(10, TimeUnit.SECONDS)
// .exceptionally(ex -> {
// if (ex instanceof TimeoutException) {
// status.set("1");
// }
// return null;
// })
// )
// .toList();
//
// // 等待所有异步任务完成
// CompletableFuture<Void> allOf = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
// try {
// allOf.get(); // 阻塞直到所有任务完成
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// } catch (ExecutionException e) {
// throw new RuntimeException(e);
// }
// 打印修改后的对象
@ -446,7 +457,18 @@ public void checkYx(KsecDataInfo dataInfo){
String pathSrc = "http://"+ dictDataService.parseDictData("base_conf", "local_path").getValue() + ":9007/pic"+street.getPlcId()+"/" + dataInfo.getTaskId() + "_" + picPath + ".JPEG";
urlResourcesService.save(URLResourcesDo.builder().url(pathSrc).uuid(uuid).type("1").little("拍照").build());
algorithmDelayTask.setPath(pathSrc);
String storageCode = "F"
+ dictDataService.parseDictData("base_conf", "library_code").getValue()
+formatNumber((Integer.parseInt(algorithmDelayTask.getSRMNumber())-1)*2+algorithmDelayTask.getDirection(),2)
+formatNumber(algorithmDelayTask.getRow(),2)
+formatNumber(algorithmDelayTask.getColumn(),2);
if (algorithmDelayTask.getRow()!=0 && algorithmDelayTask.getColumn()!=0) {
algorithmDelayTask.setStorageCode(storageCode);
}
algorithmDelayTask.setUuid(uuid);
getPhotoDelayExecutor.communicationFactory(algorithmDelayTask);
}
public static String capitalize(String str) {
if (str == null || str.isEmpty()) {
@ -508,7 +530,7 @@ public void checkYx(KsecDataInfo dataInfo){
.row(ksecDataInfo.getFromRow())
.column(ksecDataInfo.getFromColumn())
.status("0")
.checkPic("http://" + streetDO.getPlcIp() + ":9007/pic"+streetDO.getPlcId()+"/" + ksecDataInfo.getTaskId() + "_" + cameraType + ".JPEG;")
.checkPic("http://" + dictDataService.parseDictData("base_conf", "local_path").getValue() + ":9007/pic"+streetDO.getPlcId()+"/"+ ksecDataInfo.getTaskId() + "_" + cameraType + ".JPEG")
.exportTime(LocalDateTime.now()).build();
stockService.save(stockDO);
} else {
@ -549,6 +571,12 @@ public void checkYx(KsecDataInfo dataInfo){
stockDO.setCode(algorithmDelayTask.getStorageCode());
stockDO.setWmsCode(algorithmDelayTask.getStorageCode());
stockDO.setTrayCode(algorithmDelayTask.getTrayCode());
if (algorithmDelayTask.getUuid()!=null){
stockDO.setCheckPic(algorithmDelayTask.getUuid());
}
if (algorithmDelayTask.getStatus()!=null){
stockDO.setStatus(String.valueOf(algorithmDelayTask.getStatus()));
}
stockService.updateById(stockDO);
}
CheckLogDO checkLogDO = checkLogService.getOne(new QueryWrapper<CheckLogDO>().eq("task_Id", algorithmDelayTask.getTaskId()).last("limit 1"));
@ -557,6 +585,13 @@ public void checkYx(KsecDataInfo dataInfo){
checkLogDO.setTrayCode(algorithmDelayTask.getTrayCode());
checkLogDO.setCode(algorithmDelayTask.getStorageCode());
checkLogDO.setWmsCode(algorithmDelayTask.getStorageCode());
if (algorithmDelayTask.getUuid()!=null){
checkLogDO.setPic(algorithmDelayTask.getUuid());
}
if (algorithmDelayTask.getStatus()!=null){
checkLogDO.setStatus((algorithmDelayTask.getStatus()));
}
checkLogService.updateById(checkLogDO);
}
}
@ -702,6 +737,8 @@ public void checkYx(KsecDataInfo dataInfo){
stockSave(ksecDataInfo, street, sensorGunCode);
String path = "http://" + dictDataService.parseDictData("base_conf", "local_path").getValue() + ":9007/pic"+street.getPlcId()+"/"+ kescEntity.getData().getTaskId() + "_" + picPath + ".JPEG";
algorithmDelayTask.setPath(path);
algorithmDelayTask.setUuid(uuid);
algorithmDelayTask.setStatus(2);
getPhotoDelayExecutor.communicationFactory(algorithmDelayTask);
urlResourcesService.save(URLResourcesDo.builder().url(path).uuid(uuid).type("1").little("球机拍照").build());

@ -7,12 +7,13 @@ import cn.iocoder.yudao.module.camera.controller.admin.stock.vo.StockSaveReqVO;
import cn.iocoder.yudao.module.camera.controller.admin.stock.vo.StockStreetList;
import cn.iocoder.yudao.module.camera.dal.dataobject.stock.StockDO;
import cn.iocoder.yudao.module.camera.dal.dataobject.street.StreetDO;
import cn.iocoder.yudao.module.camera.dal.entity.echarts.*;
import cn.iocoder.yudao.module.camera.dal.entity.echarts.Axis;
import cn.iocoder.yudao.module.camera.dal.entity.echarts.EChartsOption;
import cn.iocoder.yudao.module.camera.dal.entity.echarts.Series;
import cn.iocoder.yudao.module.camera.dal.mysql.stock.StockMapper;
import cn.iocoder.yudao.module.camera.service.street.StreetService;
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
@ -93,8 +94,11 @@ public class StockServiceImpl extends ServiceImpl<StockMapper,StockDO> implement
stockStreetList.setRows(streetDO.getRightRow());
stockStreetList.setColumns(streetDO.getRightColumn());
}
List<StockDO> list = list(new QueryWrapper<StockDO>().eq("street_Id",stockStreetList.getStreetId()).eq("direction",stockStreetList.getDirection()));
stockStreetList.setButtons(list);
// List<StockDO> list = list(new QueryWrapper<StockDO>()
// .eq("street_Id",stockStreetList.getStreetId())
// .eq("direction",stockStreetList.getDirection()));
// List<StockRespVO> stockRespVOS = BeanUtils.toBean(list, StockRespVO.class);
// stockStreetList.setButtons(stockRespVOS);
return stockStreetList;
}

@ -31,6 +31,10 @@
<artifactId>yudao-module-infra-biz</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-logistics-biz</artifactId>

@ -31,7 +31,7 @@
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
<!-- 日志文件,到达多少容量,进行滚动 -->
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-50MB}</maxFileSize>
<!-- 日志文件的总大小0 表示不限制 -->
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
<!-- 日志文件的保留天数 -->

Loading…
Cancel
Save