|
|
|
|
@ -127,14 +127,14 @@ public class PlcService {
|
|
|
|
|
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());
|
|
|
|
|
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());
|
|
|
|
|
} 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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -148,14 +148,14 @@ public class PlcService {
|
|
|
|
|
order.setRow1(plcCmdInfo.getRow2());
|
|
|
|
|
order.setIntoStockOverTime(LocalDateTime.now());
|
|
|
|
|
//2d图左右为相机id
|
|
|
|
|
order.setIntoStockOverPic("http://" + street.getPlcIp() + ":8007"+"/storeData/"+street.getPlcId()+"/"+plcCmdInfo.getRow2()+"/"+plcCmdInfo.getColumn2()+"/"+(plcCmdInfo.getLeftRight2()+2)+".PNG");
|
|
|
|
|
order.setIntoStockOverPic("http://" + street.getPlcIp() + ":8007" + "/storeData/" + street.getPlcId() + "/" + plcCmdInfo.getRow2() + "/" + plcCmdInfo.getColumn2() + "/" + (plcCmdInfo.getLeftRight2() + 2) + ".PNG");
|
|
|
|
|
//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());
|
|
|
|
|
TransmissionPojo transmissionPojo = new TransmissionPojo(street, plcCmdInfo.getRow2(), plcCmdInfo.getColumn2(), plcCmdInfo.getLeftRight2(), order.getId().toString());
|
|
|
|
|
ClientChanel.get(street.getPlcId()).writeAndFlush(transmissionPojo.toString(TransmissionType.GPS));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -696,7 +696,7 @@ public class PlcService {
|
|
|
|
|
|
|
|
|
|
checkLogMapper.insert(checkLog);
|
|
|
|
|
//如果存在则清空表
|
|
|
|
|
if(stockMapper.selectCount(new QueryWrapper<Stock>().eq("lotnum", checkLog.getLotnum()))==0){
|
|
|
|
|
if (stockMapper.selectCount(new QueryWrapper<Stock>().eq("lotnum", checkLog.getLotnum())) == 0) {
|
|
|
|
|
stockMapper.truncate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -723,9 +723,9 @@ public class PlcService {
|
|
|
|
|
stockMapper.insert(stock);
|
|
|
|
|
} else stockMapper.updateById(stock);
|
|
|
|
|
TransmissionPojo transmissionPojo = new TransmissionPojo(checkLog, street);
|
|
|
|
|
if(ClientChanel.get(dataInfo.getSRMNumber()) != null) {
|
|
|
|
|
if (ClientChanel.get(dataInfo.getSRMNumber()) != null) {
|
|
|
|
|
ClientChanel.get(dataInfo.getSRMNumber()).writeAndFlush(transmissionPojo.toString(TransmissionType.ST));
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
log.error("未找到对应plc" + transmissionPojo.toString());
|
|
|
|
|
}
|
|
|
|
|
//取货完成进行拍照
|
|
|
|
|
@ -733,12 +733,18 @@ public class PlcService {
|
|
|
|
|
Thread.sleep(50L);
|
|
|
|
|
if (lock.tryLock()) {
|
|
|
|
|
//队列中没有任务,发送取图指令
|
|
|
|
|
if (GetPhotoDelayExecutor.cameraDelayTasks.size() ==0 && ClientChanel.get(dataInfo.getSRMNumber()) != null) {
|
|
|
|
|
ClientChanel.get(dataInfo.getSRMNumber()).writeAndFlush(transmissionPojo.toString(TransmissionType.GPS));
|
|
|
|
|
if (GetPhotoDelayExecutor.cameraDelayTasks.size() == 0 && ClientChanel.get(dataInfo.getSRMNumber()) != null) {
|
|
|
|
|
ClientChanel.get(street.getPlcId()).writeAndFlush(transmissionPojo.toString(TransmissionType.GPS));
|
|
|
|
|
}
|
|
|
|
|
//放置到队列中,等待取图返回后删除
|
|
|
|
|
GetPhotoDelayExecutor.addCameraDelayTask(street.getPlcId(), transmissionPojo.toString(TransmissionType.GPS), configProperties.getQueueSpanTime());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (configProperties.isInventorySimulationFollow()) {
|
|
|
|
|
ClientChanel.get(dataInfo.getSRMNumber()).writeAndFlush(
|
|
|
|
|
(new TransmissionPojo(street, transmissionPojo.getRow(), transmissionPojo.getColumn(), transmissionPojo.getDirection(), "")).toString(TransmissionType.GPS));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
log.error("取图命令 error", e);
|
|
|
|
|
} finally {
|
|
|
|
|
@ -749,6 +755,7 @@ public class PlcService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void visualCalculationResults(TransmissionPojo transmissionPojo) {
|
|
|
|
|
CheckLog checkLog = checkLogMapper.selectById(transmissionPojo.getCheckId());
|
|
|
|
|
Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("check_Num", checkLog.getId()));
|
|
|
|
|
@ -763,7 +770,7 @@ public class PlcService {
|
|
|
|
|
stock.setCategory(transmissionPojo.getCategory());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(transmissionPojo.getPcd() != null && !"".equals(transmissionPojo.getPcd())) {
|
|
|
|
|
if (transmissionPojo.getPcd() != null && !"".equals(transmissionPojo.getPcd())) {
|
|
|
|
|
stock.setPcd("http://" + street.getPlcIp() + ":8007" + transmissionPojo.getPcd());
|
|
|
|
|
}
|
|
|
|
|
if (transmissionPojo.getPicsPath() != null && transmissionPojo.getPicsPath().size() > 0) {
|
|
|
|
|
|