增加随行记录

未连接到也会返回视觉报错
just-order
LAPTOP-S9HJSOEB\昊天 2 years ago
parent 916e07a081
commit 3e7d5b601c

@ -119,11 +119,38 @@ public class PlcService {
* @param plcCmdInfo
*/
public void orderStop(PlcCmdInfo plcCmdInfo) {
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
if (street != null) {
if(plcCmdInfo.getLeftRight1() == 1){
if(plcCmdInfo.getRow1()>street.getLeftRow() && plcCmdInfo.getColumn1() > street.getLeftColumn()){
log.error("row:{},column:{},error in streetId:{} left",plcCmdInfo.getRow1(),plcCmdInfo.getColumn1(),street.getId());
return;
}
}else {
if(plcCmdInfo.getRow1()>street.getRightRow() && plcCmdInfo.getColumn1() > street.getRightColumn()){
log.error("row:{},column:{},error in streetId:{} right",plcCmdInfo.getRow1(),plcCmdInfo.getColumn1(),street.getId());
return;
}
}
//石家庄只记录入库情况
Order order = new Order();
order.setOrderNum(plcCmdInfo.getOrderNum());
order.setStreetId(street.getId());
order.setInOut1(plcCmdInfo.getSide2());
order.setLeftRight1(plcCmdInfo.getLeftRight2());
order.setColumn1(plcCmdInfo.getColumn2());
order.setRow1(plcCmdInfo.getRow2());
order.setIntoStockOverTime(LocalDateTime.now());
//todo 昆船的项目 ,取货 放货是独立的
//取货是是不知道放货的位置的所以订单开始的时候只写1位置
//订单结束写2位置
orderMapper.insert(order);
OrderRealtime.startOrder(street.getId(), plcCmdInfo.getOrderNum());
TransmissionPojo transmissionPojo = new TransmissionPojo( street, plcCmdInfo.getRow2(), plcCmdInfo.getColumn2(),plcCmdInfo.getLeftRight2(),order.getId().toString());
ClientChanel.get(street.getPlcId()).writeAndFlush(transmissionPojo.toString(TransmissionType.SGPS));
}
}
@ -244,9 +271,6 @@ public class PlcService {
} else if (code.startsWith("C4")) {
TransmissionPojo transmissionPojo = new TransmissionPojo( street, plcCmdInfo.getRow2(), plcCmdInfo.getColumn2());
ClientChanel.get(street.getPlcId()).writeAndFlush(transmissionPojo.toString(TransmissionType.GPS));
if (sep == 1) {
delayTime = configProperties.getCameraConfig().getC4DelayCaptureTime();
} else {
@ -673,14 +697,17 @@ public class PlcService {
stockMapper.insert(stock);
} else stockMapper.updateById(stock);
TransmissionPojo transmissionPojo = new TransmissionPojo(checkLog, street);
ClientChanel.get(dataInfo.getSRMNumber()).writeAndFlush(transmissionPojo.toString(TransmissionType.ST));
if(ClientChanel.get(dataInfo.getSRMNumber()) != null) {
ClientChanel.get(dataInfo.getSRMNumber()).writeAndFlush(transmissionPojo.toString(TransmissionType.ST));
}else {
log.error("未找到对应plc" + transmissionPojo.toString());
}
//取货完成进行拍照
try {
Thread.sleep(50L);
if (lock.tryLock()) {
//队列中没有任务,发送取图指令
if (GetPhotoDelayExecutor.cameraDelayTasks.size() ==0) {
if (GetPhotoDelayExecutor.cameraDelayTasks.size() ==0 && ClientChanel.get(dataInfo.getSRMNumber()) != null) {
ClientChanel.get(dataInfo.getSRMNumber()).writeAndFlush(transmissionPojo.toString(TransmissionType.GPS));
}
//放置到队列中,等待取图返回后删除
@ -755,4 +782,12 @@ public class PlcService {
KsecInfo ksecInfo = new KsecInfo("KC", "E", ksecDataInfo);
return ksecInfo;
}
public void saveFollowPhoto(TransmissionPojo transmissionPojo) {
Street street = streetMapper.getStreetByPlcId(transmissionPojo.getStreetNumber());
Order order = orderMapper.selectById(transmissionPojo.getTaskId());
order.setIntoStockOverPic(transmissionPojo.getPicsPath()[0]);
orderMapper.updateById(order);
}
}

@ -7,14 +7,8 @@ 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;
import com.zhehekeji.web.entity.Street;
import com.zhehekeji.web.mapper.CheckLogMapper;
import com.zhehekeji.web.mapper.StockLogMapper;
import com.zhehekeji.web.mapper.StockMapper;
import com.zhehekeji.web.mapper.StreetMapper;
import com.zhehekeji.web.entity.*;
import com.zhehekeji.web.mapper.*;
import com.zhehekeji.web.pojo.category.PageSearch;
import com.zhehekeji.web.pojo.stock.*;
import com.zhehekeji.web.util.FileUtil;
@ -47,6 +41,9 @@ public class StockService {
private StreetMapper streetMapper;
@Resource
ConfigProperties configProperties;
@Resource
OrderMapper orderMapper;
public void importExcel(MultipartFile file) {
log.info("import excel stock");
@ -331,6 +328,15 @@ public class StockService {
stock.setStatus(0);
}
Order order = orderMapper.selectOne(new QueryWrapper<Order>()
.eq("left_right1",stockCheck.getDirection())
.eq("column1",stock.getColumn())
.eq("row1",stock.getRow())
.orderByDesc("into_Stock_Over_Time")
.last("limit 1"));
if(order != null){
stock.setOveroperationPic(order.getIntoStockOverPic());
}
return stock;
}

@ -36,6 +36,7 @@ public class Decoder extends DelimiterBasedFrameDecoder {
private static String GET_PHOTO = "GP";
private static String GET_PHOTO_END = "GPE";
private static String RETURN_CHECK = "RTE";
private static String FOLLOW_GET_PHOTO_END = "SGPE";
private static String END_CHECK = "EN";
private static String HEART_BEAT = "HB";
@ -126,6 +127,11 @@ public class Decoder extends DelimiterBasedFrameDecoder {
}
//照片和结果保存,并发送给上位机
else if(FOLLOW_GET_PHOTO_END.equals(transmissionPojo.getHeader())){
//保存数据
plcService.saveFollowPhoto(transmissionPojo);
}
}
}

@ -38,16 +38,22 @@ public class TransmissionPojo {
this.column = checkLog.getColumn();
this.direction = checkLog.getDirection();
this.count = checkLog.getCount();
this.category = checkLog.getCategory().split("/")[0];
if(checkLog.getCategory().contains("/")) {
this.category = checkLog.getCategory().split("/")[0];
}else {
this.category = checkLog.getCategory();
}
}
public TransmissionPojo( Street street,Integer row , Integer column){
public TransmissionPojo( Street street,Integer row , Integer column,Integer direction,String orderId){
this.streetNumber = street.getPlcId();
this.row = row;
this.taskId = orderId;
this.direction = direction;
this.column = column;
this.checkId = 0;
this.taskId = "0";
}
public String toString(TransmissionType type) {
@ -59,7 +65,7 @@ public class TransmissionPojo {
}else if (type == TransmissionType.RTS) {
return "RTS&" + streetNumber +"/"+row +"/"+column+ "&" + checkId + "&" + taskId + "&" + direction + "&" + category + "&" + count;
}else if (type == TransmissionType.SGPS) {
return "SRTS&" + streetNumber +"/"+row +"/"+column+ "&" + checkId + "&" + taskId + "&" + direction ;
return "SGPS&" + streetNumber +"/"+row +"/"+column+ "&" + checkId + "&" + taskId + "&" + direction ;
}
return "";
}
@ -85,7 +91,9 @@ public class TransmissionPojo {
if (dataArray.length > 5) {
this.category = dataArray[5];
this.count = Integer.valueOf(dataArray[6]);
if(!"".equals(dataArray[6]) && dataArray[6] != null) {
this.count = Integer.valueOf(dataArray[6]);
}
}
if (dataArray.length > 7) {
this.result = Integer.parseInt(dataArray[7])==0 ?0:1;

Loading…
Cancel
Save