球机IO code配置

camera_merge
王一鸣 5 years ago
parent a0de768638
commit 6726fffe35

@ -9,7 +9,7 @@ import java.util.List;
public interface CameraIOMapper extends BaseMapper<CameraIO> { public interface CameraIOMapper extends BaseMapper<CameraIO> {
@Select("select t.name as name ,io.id ,io.aperture,io.camera_id,io.focusing,io.multiple,io.position,io.ptz_id,io.update_time\n" + @Select("select t.code as code,t.name as name ,io.id ,io.aperture,io.camera_id,io.focusing,io.multiple,io.position,io.ptz_id,io.update_time\n" +
"from camera_io_config t \n" + "from camera_io_config t \n" +
"left join (select * from camera_io where camera_id = #{cameraId}) io on io.name = t.name order by t.id") "left join (select * from camera_io where camera_id = #{cameraId}) io on io.name = t.name order by t.id")
List<CameraIO> cameraIOs (@Param("cameraId") Integer cameraId); List<CameraIO> cameraIOs (@Param("cameraId") Integer cameraId);

@ -86,7 +86,10 @@ public class MyProtocolDecoder extends FixedLengthFrameDecoder {
} else if (type.equals("0C")) { } else if (type.equals("0C")) {
log.info("action code,{} plcId:{},orderInfo:{}", code, plcId, plcOrderInfo.toString()); log.info("action code,{} plcId:{},orderInfo:{}", code, plcId, plcOrderInfo.toString());
Integer times = OrderAction.put(plcOrderInfo.getOrderNum()); Integer times = 1;
if(!code.equals("C6")){
times = OrderAction.put(plcOrderInfo.getOrderNum());
}
//执行动作 //执行动作
plcService.action(plcOrderInfo, plcId, times, code); plcService.action(plcOrderInfo, plcId, times, code);

@ -97,22 +97,17 @@ public class PlcService {
if(street == null){ if(street == null){
return; return;
} }
if(times == 1 || times == 3){ //拍照,转动 需要知道是哪个货架
//找到球机IO配置的预置点
log.info("预置点:{}",code);
move(street.getCamera1Id(),street.getCamera2Id(),code);
return;
}
//拍照 需要知道是哪个货架
//1 判断是左右货架 1:左货架 2右货架 //1 判断是左右货架 1:左货架 2右货架
//判断左右 行列号
Integer leftRight = 0; Integer leftRight = 0;
Integer row = 0; Integer row = 0;
Integer column = 0; Integer column = 0;
if(times == 2){ if(times == 2 || times == 1){
leftRight = plcOrderInfo.getLeftRight1(); leftRight = plcOrderInfo.getLeftRight1();
row = plcOrderInfo.getRow1(); row = plcOrderInfo.getRow1();
column = plcOrderInfo.getColumn1(); column = plcOrderInfo.getColumn1();
}else if(times == 4){ }else if(times == 4 || times == 3){
leftRight = plcOrderInfo.getLeftRight2(); leftRight = plcOrderInfo.getLeftRight2();
row = plcOrderInfo.getRow2(); row = plcOrderInfo.getRow2();
column = plcOrderInfo.getColumn2(); column = plcOrderInfo.getColumn2();
@ -120,6 +115,18 @@ public class PlcService {
log.error("异常的任务次数orderInfo:{},plcId:{},time:{}",plcOrderInfo.toString(),plcId,times); log.error("异常的任务次数orderInfo:{},plcId:{},time:{}",plcOrderInfo.toString(),plcId,times);
return; return;
} }
if(times == 1 || times == 3){
//找到球机IO配置的预置点
if(leftRight == 1){
code = code+"-L";
}else if(leftRight == 2){
code = code+"-R";
}
log.info("预置点:{}",code);
move(street.getCamera1Id(),street.getCamera2Id(),code);
return;
}
//2 得到相应的货架号(目前订单 只支持单伸货架) //2 得到相应的货架号(目前订单 只支持单伸货架)
//todo 后面可能会有双伸这里要改plc那里也要改 //todo 后面可能会有双伸这里要改plc那里也要改
String shelveId; String shelveId;

Loading…
Cancel
Save