|
|
|
|
@ -201,7 +201,7 @@ public class PlcService {
|
|
|
|
|
* @param plcCmdInfo
|
|
|
|
|
* @param times
|
|
|
|
|
*/
|
|
|
|
|
public void action(PlcCmdInfo plcCmdInfo, Integer times, String code) {
|
|
|
|
|
public void action(PlcCmdInfo plcCmdInfo, Integer times, String code) throws InterruptedException {
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
if (street == null) {
|
|
|
|
|
log.error("street not found ,plcId :{}", plcCmdInfo.getPlcId());
|
|
|
|
|
@ -209,9 +209,7 @@ public class PlcService {
|
|
|
|
|
}
|
|
|
|
|
OrderInfo orderInfo = new OrderInfo(street, plcCmdInfo, times, code);
|
|
|
|
|
String path = null;
|
|
|
|
|
/**
|
|
|
|
|
* 拍照是C2 C4拍照(取货完成、放货完成)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Boolean needCapture = doNeedCaptureByCode(orderInfo.getCmdCode());
|
|
|
|
|
/***
|
|
|
|
|
* 判断该巷道有几个相机
|
|
|
|
|
@ -223,22 +221,43 @@ public class PlcService {
|
|
|
|
|
Integer cameraId = getCameraByPlcCmd(plcCmdInfo,orderInfo.getLeftRight());
|
|
|
|
|
gyrateCameraByCode(cameraId,orderInfo.getCmdCode());
|
|
|
|
|
if(needCapture){
|
|
|
|
|
Boolean delay = false;
|
|
|
|
|
if(code.startsWith("C1") || code.startsWith("C3")){
|
|
|
|
|
delay = true;
|
|
|
|
|
}
|
|
|
|
|
Boolean delay = true;
|
|
|
|
|
Integer row = 0;
|
|
|
|
|
Integer column = 0;
|
|
|
|
|
Integer sep = 0;
|
|
|
|
|
if(times<=2){
|
|
|
|
|
row = plcCmdInfo.getRow1();
|
|
|
|
|
column = plcCmdInfo.getColumn1();
|
|
|
|
|
sep = plcCmdInfo.getSeparation1();
|
|
|
|
|
}else {
|
|
|
|
|
row = plcCmdInfo.getRow2();
|
|
|
|
|
column = plcCmdInfo.getColumn2();
|
|
|
|
|
sep = plcCmdInfo.getSeparation2();
|
|
|
|
|
}
|
|
|
|
|
path = PathUtil.createFileNameByRowColumn("jpg",cameraId,row,column);
|
|
|
|
|
long delayTime = 0;
|
|
|
|
|
|
|
|
|
|
if(code.startsWith("C1")){
|
|
|
|
|
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC1DelayCaptureTime();
|
|
|
|
|
}else if(code.startsWith("C2")){
|
|
|
|
|
if(sep == 1){
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC2DelayCaptureTime();
|
|
|
|
|
}else {
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC2OutDelayCaptureTime();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else if(code.startsWith("C3")){
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC3DelayCaptureTime();
|
|
|
|
|
|
|
|
|
|
path = cameraCapture(cameraId,delay,configProperties.getCameraConfig().getDelayCaptureTime(),path);
|
|
|
|
|
}else if(code.startsWith("C4")){
|
|
|
|
|
if(sep == 1){
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC4DelayCaptureTime();
|
|
|
|
|
}else {
|
|
|
|
|
delayTime = configProperties.getCameraConfig().getC4OutDelayCaptureTime();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
path = PathUtil.createFileNameByRowColumn("jpg",cameraId,row,column);
|
|
|
|
|
path = cameraCapture(cameraId,delay,delayTime,path);
|
|
|
|
|
}
|
|
|
|
|
//update order info after capture
|
|
|
|
|
if (path != null && needCapture) {
|
|
|
|
|
@ -248,10 +267,10 @@ public class PlcService {
|
|
|
|
|
if(times == 2){
|
|
|
|
|
|
|
|
|
|
if(street.getCamera2Id() != null){
|
|
|
|
|
gyrateCameraByCodeTimeLater(street.getCamera2Id(),"C5",configProperties.getCameraConfig().getDelayCaptureTime()+100);
|
|
|
|
|
gyrateCameraByCodeTimeLater(street.getCamera2Id(),"C5",configProperties.getCameraConfig().getC2OutDelayCaptureTime()+500);
|
|
|
|
|
}
|
|
|
|
|
if(street.getCamera1Id() != null){
|
|
|
|
|
gyrateCameraByCodeTimeLater(street.getCamera1Id(),"C5",configProperties.getCameraConfig().getDelayCaptureTime()+100);
|
|
|
|
|
gyrateCameraByCodeTimeLater(street.getCamera1Id(),"C5",configProperties.getCameraConfig().getC2OutDelayCaptureTime()+500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -558,6 +577,7 @@ public class PlcService {
|
|
|
|
|
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
|
CronTab.putTime(street.getId());
|
|
|
|
|
Integer cameraId = getCameraByPlcCmd(plcCmdInfo,plcCmdInfo.getLeftRight1());
|
|
|
|
|
gyrateCameraByCode(cameraId, cmdCode);
|
|
|
|
|
try {
|
|
|
|
|
@ -572,10 +592,10 @@ public class PlcService {
|
|
|
|
|
Boolean trayCheck = Boolean.TRUE;
|
|
|
|
|
//如果是用扫码枪 扫 托盘码,就直接扫
|
|
|
|
|
//if(configProperties.getScanCodeMode().getTray() == 2){
|
|
|
|
|
|
|
|
|
|
SensorGun sensorGun = sensorService.getSensorByPlc(street.getId(),plcCmdInfo.getLeftRight1());
|
|
|
|
|
if(plcCmdInfo.getSeparation1() == 1 && configProperties.getScanCodeMode().getTray() == 2){
|
|
|
|
|
//托盘使用sick扫码枪
|
|
|
|
|
SensorGun sensorGun = sensorService.getSensorByPlc(street.getId(),plcCmdInfo.getLeftRight1());
|
|
|
|
|
|
|
|
|
|
if(sensorGun == null){
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
@ -610,7 +630,7 @@ public class PlcService {
|
|
|
|
|
//RFID
|
|
|
|
|
RFID rfid = rfidService.getRFIDByPlc(street.getId());
|
|
|
|
|
}
|
|
|
|
|
StockCheckRunnable stockCheckRunnable = new StockCheckRunnable(street,plcCmdInfo,cmdCode,stockMapper,path,checkLogMapper,configProperties.getScanCodeMode().getGoods(),wmsCode,wmsTrayCode,trayCode,trayCheck,configProperties);
|
|
|
|
|
StockCheckRunnable stockCheckRunnable = new StockCheckRunnable(street,plcCmdInfo,cmdCode,stockMapper,path,checkLogMapper,configProperties.getScanCodeMode().getGoods(),wmsCode,wmsTrayCode,trayCode,trayCheck,configProperties,sensorGun);
|
|
|
|
|
threadPoolExecutor.execute(stockCheckRunnable);
|
|
|
|
|
|
|
|
|
|
long end = System.currentTimeMillis();
|
|
|
|
|
@ -623,4 +643,8 @@ public class PlcService {
|
|
|
|
|
stockMapper.truncate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConfigProperties getConfigProperties(){
|
|
|
|
|
return configProperties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|