@ -64,7 +64,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
private int toQty = 0 ;
private int lastToQty = this . toQty ;
private String d eviceCode = null ;
private String currentD eviceCode = null ;
private boolean isOnline = false ;
private boolean isError = false ;
private String message = "" ;
@ -85,7 +85,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
this . message = "" ;
try {
this . d eviceCode = this . device . getDevice_c ode( ) ;
this . currentD eviceCode = this . getDeviceC ode( ) ;
this . mode = this . itemProtocol . getMode ( ) ;
this . move = this . itemProtocol . getMove ( ) ;
@ -99,40 +99,43 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
if ( this . mode ! = this . lastMode ) {
this . requireSuccess = false ;
this . deviceExecuteLogService . deviceItemValue ( this . deviceCode , ItemProtocol . ITEM_MODE , String . valueOf ( mode ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , ItemProtocol . ITEM_MODE + " " + this . lastMode + " -> " + this . mode ) ;
if ( mode = = 2 ) {
this . writing ( "to_command" , "0" ) ;
}
this . deviceExecuteLogService . deviceItemValue ( this . currentDeviceCode , ItemProtocol . ITEM_MODE , String . valueOf ( mode ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , ItemProtocol . ITEM_MODE + " " + this . lastMode + " -> " + this . mode ) ;
}
if ( this . move ! = this . lastMove ) {
this . deviceExecuteLogService . deviceItemValue ( this . deviceCode , ItemProtocol . ITEM_MOVE , String . valueOf ( this . move ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , ItemProtocol . ITEM_MOVE + " " + this . lastMove + " -> " + this . move ) ;
this . deviceExecuteLogService . deviceItemValue ( this . currentD eviceCode, ItemProtocol . ITEM_MOVE , String . valueOf ( this . move ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , ItemProtocol . ITEM_MOVE + " " + this . lastMove + " -> " + this . move ) ;
}
if ( this . action ! = this . lastAction ) {
this . deviceExecuteLogService . deviceItemValue ( this . d eviceCode, ItemProtocol . ITEM_ACTION , String . valueOf ( this . action ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , ItemProtocol . ITEM_ACTION + " " + this . lastAction + " -> " + this . action ) ;
this . deviceExecuteLogService . deviceItemValue ( this . currentD eviceCode, ItemProtocol . ITEM_ACTION , String . valueOf ( this . action ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , ItemProtocol . ITEM_ACTION + " " + this . lastAction + " -> " + this . action ) ;
}
if ( this . error ! = this . lastError ) {
this . deviceExecuteLogService . deviceItemValue ( this . d eviceCode, ItemProtocol . ITEM_ERROR , String . valueOf ( this . error ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , ItemProtocol . ITEM_ERROR + " " + this . lastError + " -> " + this . error ) ;
this . deviceExecuteLogService . deviceItemValue ( this . currentD eviceCode, ItemProtocol . ITEM_ERROR , String . valueOf ( this . error ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , ItemProtocol . ITEM_ERROR + " " + this . lastError + " -> " + this . error ) ;
}
if ( this . task ! = this . lastTask ) {
this . deviceExecuteLogService . deviceItemValue ( this . d eviceCode, ItemProtocol . ITEM_TASK , String . valueOf ( this . task ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , ItemProtocol . ITEM_TASK + " " + this . lastTask + " -> " + this . task ) ;
this . deviceExecuteLogService . deviceItemValue ( this . currentD eviceCode, ItemProtocol . ITEM_TASK , String . valueOf ( this . task ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , ItemProtocol . ITEM_TASK + " " + this . lastTask + " -> " + this . task ) ;
}
if ( this . toCommand ! = this . lastToCommand ) {
this . deviceExecuteLogService . deviceItemValue ( this . d eviceCode, ItemProtocol . ITEM_TO_COMMAND , String . valueOf ( this . toCommand ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , ItemProtocol . ITEM_TO_COMMAND + " " + this . lastToCommand + " -> " + this . toCommand ) ;
this . deviceExecuteLogService . deviceItemValue ( this . currentD eviceCode, ItemProtocol . ITEM_TO_COMMAND , String . valueOf ( this . toCommand ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , ItemProtocol . ITEM_TO_COMMAND + " " + this . lastToCommand + " -> " + this . toCommand ) ;
}
if ( this . toMaterial ! = this . lastToMaterial ) {
this . deviceExecuteLogService . deviceItemValue ( this . d eviceCode, ItemProtocol . ITEM_TO_MATERIAL , String . valueOf ( this . toMaterial ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , ItemProtocol . ITEM_TO_MATERIAL + " " + this . lastToMaterial + " -> " + this . toMaterial ) ;
this . deviceExecuteLogService . deviceItemValue ( this . currentD eviceCode, ItemProtocol . ITEM_TO_MATERIAL , String . valueOf ( this . toMaterial ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , ItemProtocol . ITEM_TO_MATERIAL + " " + this . lastToMaterial + " -> " + this . toMaterial ) ;
}
if ( this . toQty ! = this . lastToQty ) {
this . deviceExecuteLogService . deviceItemValue ( this . d eviceCode, ItemProtocol . ITEM_TO_QTY , String . valueOf ( this . toQty ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , ItemProtocol . ITEM_TO_QTY + " " + this . lastToQty + " -> " + this . toQty ) ;
this . deviceExecuteLogService . deviceItemValue ( this . currentD eviceCode, ItemProtocol . ITEM_TO_QTY , String . valueOf ( this . toQty ) ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , ItemProtocol . ITEM_TO_QTY + " " + this . lastToQty + " -> " + this . toQty ) ;
}
} catch ( Exception e ) {
log . error ( "{} device driver execute error!" , d eviceCode) ;
log . error ( "{} device driver execute error!" , currentD eviceCode) ;
log . error ( e . getMessage ( ) , e ) ;
return ;
}
@ -158,23 +161,32 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
if ( ObjectUtil . isNotEmpty ( methodName ) ) {
try {
this . executionMethodByMode ( methodName . toString ( ) ) ;
this . requireSuccess = true ;
} catch ( Exception e ) {
log . error ( "{} device driver execute error!" , d eviceCode) ;
log . error ( "{} device driver execute error!" , currentD eviceCode) ;
log . error ( e . getMessage ( ) , e ) ;
String message = "执行工作模式对应方法 " + methodName + " 错误!错误信息:" + e . getMessage ( ) ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , message ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , message ) ;
this . isError = true ;
}
} else {
String message = "未知工作模式,驱动未配置对应方法。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , message ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , message ) ;
}
}
}
this . lastMode = this . mode ;
this . lastMove = this . move ;
this . lastAction = this . action ;
this . lastError = this . error ;
this . lastTask = this . task ;
this . lastToCommand = this . toCommand ;
this . lastToMaterial = this . toMaterial ;
this . lastToQty = this . toQty ;
}
@Override
@ -198,7 +210,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
itemMap . put ( to_param , value ) ;
this . control ( itemMap ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . d eviceCode, "" , "" , param + " 写入 " + value ) ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentD eviceCode, "" , "" , param + " 写入 " + value ) ;
}
private synchronized void executionMethodByMode ( String methodName ) throws NoSuchMethodException , InvocationTargetException , IllegalAccessException {
@ -244,7 +256,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
private Device findHasGoodsDevice ( JSONArray deviceCodes ) {
for ( int i = 0 ; i < deviceCodes . size ( ) ; i + + ) {
Device device = this . deviceAppService . findDeviceByCode ( deviceCodes . getString ( i ) ) ;
if ( "0" . equals ( device . getIslock ( ) ) & & 1 = = device . getHas_goods ( ) ) {
if ( device ! = null & & "0" . equals ( device . getIslock ( ) ) & & 1 = = device . getHas_goods ( ) ) {
return device ;
}
}
@ -254,7 +266,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
private Device findNotHasGoodsDevice ( JSONArray deviceCodes ) {
for ( int i = 0 ; i < deviceCodes . size ( ) ; i + + ) {
Device device = this . deviceAppService . findDeviceByCode ( deviceCodes . getString ( i ) ) ;
if ( "0" . equals ( device . getIslock ( ) ) & & 0 = = device . getHas_goods ( ) ) {
if ( device ! = null & & "0" . equals ( device . getIslock ( ) ) & & 0 = = device . getHas_goods ( ) ) {
return device ;
}
}
@ -265,49 +277,53 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
* 门架上料完成
* /
@SuppressWarnings ( "unused" )
public synchronized void gantryMaterialFinished ( ) throws Exception {
Device currentDevice = this . deviceAppService . findDeviceByCode ( this . deviceCode ) ;
if ( "0" . equals ( currentDevice . getIslock ( ) ) ) {
// 门架上料完成放空设备
Object gantryDeviceCode1 = this . getDevice ( ) . getExtraValue ( ) . get ( "gantry_device_code1" ) ;
if ( ObjectUtil . isEmpty ( gantryDeviceCode1 ) ) {
String message = "门架上料完成放空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray emptyDeviceCodes = JSONArray . parseArray ( gantryDeviceCode1 . toString ( ) ) ;
// 门架上料完成取满设备
Object gantryDeviceCode2 = this . getDevice ( ) . getExtraValue ( ) . get ( "gantry_device_code2" ) ;
if ( ObjectUtil . isEmpty ( gantryDeviceCode2 ) ) {
String message = "门架上料完成取满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray materialDeviceCodes = JSONArray . parseArray ( gantryDeviceCode2 . toString ( ) ) ;
// 查找合适的放空设备
Device emptyDevice = this . findNotHasGoodsDevice ( emptyDeviceCodes ) ;
if ( ObjectUtil . isEmpty ( emptyDevice ) ) {
String message = "未找到合适的门架上料完成放空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert emptyDevice ! = null ;
// 查找合适的取满设备
Device materialDevice = this . findHasGoodsDevice ( materialDeviceCodes ) ;
if ( ObjectUtil . isEmpty ( materialDevice ) ) {
String message = "未找到合适的门架上料完成取满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert materialDevice ! = null ;
public void gantryMaterialFinished ( ) throws Exception {
synchronized ( NL4StationDeviceDriver . class ) {
Device currentDevice = this . deviceAppService . findDeviceByCode ( this . currentDeviceCode ) ;
if ( "0" . equals ( currentDevice . getIslock ( ) ) ) {
// 门架上料完成放空设备
Object gantryDeviceCode1 = this . getDevice ( ) . getExtraValue ( ) . get ( "gantry_device_code1" ) ;
if ( ObjectUtil . isEmpty ( gantryDeviceCode1 ) ) {
String message = "门架上料完成放空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray emptyDeviceCodes = JSONArray . parseArray ( gantryDeviceCode1 . toString ( ) ) ;
// 门架上料完成取满设备
Object gantryDeviceCode2 = this . getDevice ( ) . getExtraValue ( ) . get ( "gantry_device_code2" ) ;
if ( ObjectUtil . isEmpty ( gantryDeviceCode2 ) ) {
String message = "门架上料完成取满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray materialDeviceCodes = JSONArray . parseArray ( gantryDeviceCode2 . toString ( ) ) ;
// 查找合适的放空设备
Device emptyDevice = this . findNotHasGoodsDevice ( emptyDeviceCodes ) ;
if ( ObjectUtil . isEmpty ( emptyDevice ) ) {
String message = "未找到合适的门架上料完成放空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert emptyDevice ! = null ;
// 查找合适的取满设备
Device materialDevice = this . findHasGoodsDevice ( materialDeviceCodes ) ;
if ( ObjectUtil . isEmpty ( materialDevice ) ) {
String message = "未找到合适的门架上料完成取满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert materialDevice ! = null ;
this . taskService . create ( this . creatTask ( currentDevice , emptyDevice , materialDevice , currentDevice , RequestMethodEnum . GANTRY_MATERIAL_FINISHED ) ) ;
this . taskService . create ( this . creatTask ( currentDevice , emptyDevice , materialDevice , currentDevice , RequestMethodEnum . GANTRY_MATERIAL_FINISHED ) ) ;
this . requireSuccess = true ;
this . writing ( "to_command" , this . mode ) ;
}
}
}
@ -315,68 +331,72 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
* 槽钢上料完成
* /
@SuppressWarnings ( "unused" )
public synchronized void channelSteelMaterialFinished ( ) throws Exception {
Device currentDevice = this . deviceAppService . findDeviceByCode ( this . deviceCode ) ;
if ( "0" . equals ( currentDevice . getIslock ( ) ) ) {
// 槽钢上料完成取满设备
Object channelSteelDeviceCode1 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_device_code1" ) ;
if ( ObjectUtil . isEmpty ( channelSteelDeviceCode1 ) ) {
String message = "槽钢上料完成取满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes1 = JSONArray . parseArray ( channelSteelDeviceCode1 . toString ( ) ) ;
// 槽钢上料完成放满设备
Object channelSteelDeviceCode2 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_device_code2" ) ;
if ( ObjectUtil . isEmpty ( channelSteelDeviceCode2 ) ) {
String message = "槽钢上料完成放满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes2 = JSONArray . parseArray ( channelSteelDeviceCode2 . toString ( ) ) ;
// 槽钢上料完成放空设备
Object channelSteelDeviceCode4 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_device_code4" ) ;
if ( ObjectUtil . isEmpty ( channelSteelDeviceCode4 ) ) {
String message = "槽钢上料完成放空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes4 = JSONArray . parseArray ( channelSteelDeviceCode4 . toString ( ) ) ;
// 查找合适的取满设备
Device device1 = this . findHasGoodsDevice ( deviceCodes1 ) ;
if ( ObjectUtil . isEmpty ( device1 ) ) {
String message = "未找到合适的槽钢上料完成取满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert device1 ! = null ;
// 查找合适的放满设备
Device device2 = this . findNotHasGoodsDevice ( deviceCodes2 ) ;
if ( ObjectUtil . isEmpty ( device2 ) ) {
String message = "未找到合适的槽钢上料完成放满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert device2 ! = null ;
// 查找合适的放空设备
Device device4 = this . findNotHasGoodsDevice ( deviceCodes4 ) ;
if ( ObjectUtil . isEmpty ( device4 ) ) {
String message = "未找到合适的槽钢上料完成放空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert device4 ! = null ;
public void channelSteelMaterialFinished ( ) throws Exception {
synchronized ( NL4StationDeviceDriver . class ) {
Device currentDevice = this . deviceAppService . findDeviceByCode ( this . currentDeviceCode ) ;
if ( "0" . equals ( currentDevice . getIslock ( ) ) ) {
// 槽钢上料完成取满设备
Object channelSteelDeviceCode1 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_device_code1" ) ;
if ( ObjectUtil . isEmpty ( channelSteelDeviceCode1 ) ) {
String message = "槽钢上料完成取满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes1 = JSONArray . parseArray ( channelSteelDeviceCode1 . toString ( ) ) ;
// 槽钢上料完成放满设备
Object channelSteelDeviceCode2 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_device_code2" ) ;
if ( ObjectUtil . isEmpty ( channelSteelDeviceCode2 ) ) {
String message = "槽钢上料完成放满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes2 = JSONArray . parseArray ( channelSteelDeviceCode2 . toString ( ) ) ;
// 槽钢上料完成放空设备
Object channelSteelDeviceCode4 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_device_code4" ) ;
if ( ObjectUtil . isEmpty ( channelSteelDeviceCode4 ) ) {
String message = "槽钢上料完成放空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes4 = JSONArray . parseArray ( channelSteelDeviceCode4 . toString ( ) ) ;
// 查找合适的取满设备
Device device1 = this . findHasGoodsDevice ( deviceCodes1 ) ;
if ( ObjectUtil . isEmpty ( device1 ) ) {
String message = "未找到合适的槽钢上料完成取满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert device1 ! = null ;
// 查找合适的放满设备
Device device2 = this . findNotHasGoodsDevice ( deviceCodes2 ) ;
if ( ObjectUtil . isEmpty ( device2 ) ) {
String message = "未找到合适的槽钢上料完成放满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert device2 ! = null ;
// 查找合适的放空设备
Device device4 = this . findNotHasGoodsDevice ( deviceCodes4 ) ;
if ( ObjectUtil . isEmpty ( device4 ) ) {
String message = "未找到合适的槽钢上料完成放空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert device4 ! = null ;
this . taskService . create ( this . creatTask ( device1 , device2 , currentDevice , device4 , RequestMethodEnum . CHANNEL_STEEL_MATERIAL_FINISHED ) ) ;
this . taskService . create ( this . creatTask ( device1 , device2 , currentDevice , device4 , RequestMethodEnum . CHANNEL_STEEL_MATERIAL_FINISHED ) ) ;
this . requireSuccess = true ;
this . writing ( "to_command" , this . mode ) ;
}
}
}
@ -384,68 +404,72 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
* 槽钢呼叫满料
* /
@SuppressWarnings ( "unused" )
public synchronized void channelSteelCallMaterial ( ) throws Exception {
Device currentDevice = this . deviceAppService . findDeviceByCode ( this . deviceCode ) ;
if ( "0" . equals ( currentDevice . getIslock ( ) ) ) {
// 槽钢呼叫满料取满设备
Object channelSteelCallMaterialDeviceCode1 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_call_material_device_code1" ) ;
if ( ObjectUtil . isEmpty ( channelSteelCallMaterialDeviceCode1 ) ) {
String message = "槽钢呼叫满料取满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes1 = JSONArray . parseArray ( channelSteelCallMaterialDeviceCode1 . toString ( ) ) ;
// 槽钢呼叫满料取空设备
Object channelSteelCallMaterialDeviceCode3 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_call_material_device_code3" ) ;
if ( ObjectUtil . isEmpty ( channelSteelCallMaterialDeviceCode3 ) ) {
String message = "槽钢呼叫满料取空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes3 = JSONArray . parseArray ( channelSteelCallMaterialDeviceCode3 . toString ( ) ) ;
// 槽钢呼叫满料放空设备
Object channelSteelCallMaterialDeviceCode4 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_call_material_device_code4" ) ;
if ( ObjectUtil . isEmpty ( channelSteelCallMaterialDeviceCode4 ) ) {
String message = "槽钢呼叫满料放空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes4 = JSONArray . parseArray ( channelSteelCallMaterialDeviceCode4 . toString ( ) ) ;
// 查找合适的取满设备
Device device1 = this . findHasGoodsDevice ( deviceCodes1 ) ;
if ( ObjectUtil . isEmpty ( device1 ) ) {
String message = "未找到合适的槽钢呼叫满料取满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert device1 ! = null ;
// 查找合适的取空设备
Device device3 = this . findHasGoodsDevice ( deviceCodes3 ) ;
if ( ObjectUtil . isEmpty ( device3 ) ) {
String message = "未找到合适的槽钢呼叫满料取空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert device3 ! = null ;
// 查找合适的放空设备
Device device4 = this . findNotHasGoodsDevice ( deviceCodes4 ) ;
if ( ObjectUtil . isEmpty ( device4 ) ) {
String message = "未找到合适的槽钢呼叫满料放空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert device4 ! = null ;
public void channelSteelCallMaterial ( ) throws Exception {
synchronized ( NL4StationDeviceDriver . class ) {
Device currentDevice = this . deviceAppService . findDeviceByCode ( this . currentDeviceCode ) ;
if ( "0" . equals ( currentDevice . getIslock ( ) ) ) {
// 槽钢呼叫满料取满设备
Object channelSteelCallMaterialDeviceCode1 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_call_material_device_code1" ) ;
if ( ObjectUtil . isEmpty ( channelSteelCallMaterialDeviceCode1 ) ) {
String message = "槽钢呼叫满料取满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes1 = JSONArray . parseArray ( channelSteelCallMaterialDeviceCode1 . toString ( ) ) ;
// 槽钢呼叫满料取空设备
Object channelSteelCallMaterialDeviceCode3 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_call_material_device_code3" ) ;
if ( ObjectUtil . isEmpty ( channelSteelCallMaterialDeviceCode3 ) ) {
String message = "槽钢呼叫满料取空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes3 = JSONArray . parseArray ( channelSteelCallMaterialDeviceCode3 . toString ( ) ) ;
// 槽钢呼叫满料放空设备
Object channelSteelCallMaterialDeviceCode4 = this . getDevice ( ) . getExtraValue ( ) . get ( "channel_steel_call_material_device_code4" ) ;
if ( ObjectUtil . isEmpty ( channelSteelCallMaterialDeviceCode4 ) ) {
String message = "槽钢呼叫满料放空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes4 = JSONArray . parseArray ( channelSteelCallMaterialDeviceCode4 . toString ( ) ) ;
// 查找合适的取满设备
Device device1 = this . findHasGoodsDevice ( deviceCodes1 ) ;
if ( ObjectUtil . isEmpty ( device1 ) ) {
String message = "未找到合适的槽钢呼叫满料取满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert device1 ! = null ;
// 查找合适的取空设备
Device device3 = this . findHasGoodsDevice ( deviceCodes3 ) ;
if ( ObjectUtil . isEmpty ( device3 ) ) {
String message = "未找到合适的槽钢呼叫满料取空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert device3 ! = null ;
this . taskService . create ( this . creatTask ( device1 , currentDevice , device3 , device4 , RequestMethodEnum . CHANNEL_STEEL_CALL_MATERIAL ) ) ;
// 查找合适的放空设备
Device device4 = this . findNotHasGoodsDevice ( deviceCodes4 ) ;
if ( ObjectUtil . isEmpty ( device4 ) ) {
String message = "未找到合适的槽钢呼叫满料放空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert device4 ! = null ;
this . taskService . create ( this . creatTask ( device1 , currentDevice , device3 , device4 , RequestMethodEnum . CHANNEL_STEEL_CALL_MATERIAL ) ) ;
this . requireSuccess = true ;
this . writing ( "to_command" , this . mode ) ;
}
}
}
@ -453,49 +477,53 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
* 下料完成
* /
@SuppressWarnings ( "unused" )
public synchronized void productionCompleted ( ) throws Exception {
Device currentDevice = this . deviceAppService . findDeviceByCode ( this . deviceCode ) ;
if ( "0" . equals ( currentDevice . getIslock ( ) ) ) {
// 下料完成放满设备
Object productionCompletedDeviceCode2 = this . getDevice ( ) . getExtraValue ( ) . get ( "production_completed_device_code2" ) ;
if ( ObjectUtil . isEmpty ( productionCompletedDeviceCode2 ) ) {
String message = "下料完成放满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes2 = JSONArray . parseArray ( productionCompletedDeviceCode2 . toString ( ) ) ;
// 下料完成取空设备
Object productionCompletedDeviceCode3 = this . getDevice ( ) . getExtraValue ( ) . get ( "production_completed_device_code3" ) ;
if ( ObjectUtil . isEmpty ( productionCompletedDeviceCode3 ) ) {
String message = "下料完成取空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes3 = JSONArray . parseArray ( productionCompletedDeviceCode3 . toString ( ) ) ;
// 查找合适的放满设备
Device device2 = this . findNotHasGoodsDevice ( deviceCodes2 ) ;
if ( ObjectUtil . isEmpty ( device2 ) ) {
String message = "未找到合适的下料完成放满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert device2 ! = null ;
// 查找合适的取空设备
Device device3 = this . findHasGoodsDevice ( deviceCodes3 ) ;
if ( ObjectUtil . isEmpty ( device3 ) ) {
String message = "未找到合适的下料完成取空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . deviceCode , "" , "" , message ) ;
return ;
}
assert device3 ! = null ;
public void productionCompleted ( ) throws Exception {
synchronized ( NL4StationDeviceDriver . class ) {
Device currentDevice = this . deviceAppService . findDeviceByCode ( this . currentDeviceCode ) ;
if ( "0" . equals ( currentDevice . getIslock ( ) ) ) {
// 下料完成放满设备
Object productionCompletedDeviceCode2 = this . getDevice ( ) . getExtraValue ( ) . get ( "production_completed_device_code2" ) ;
if ( ObjectUtil . isEmpty ( productionCompletedDeviceCode2 ) ) {
String message = "下料完成放满设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes2 = JSONArray . parseArray ( productionCompletedDeviceCode2 . toString ( ) ) ;
// 下料完成取空设备
Object productionCompletedDeviceCode3 = this . getDevice ( ) . getExtraValue ( ) . get ( "production_completed_device_code3" ) ;
if ( ObjectUtil . isEmpty ( productionCompletedDeviceCode3 ) ) {
String message = "下料完成取空设备未配置。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
JSONArray deviceCodes3 = JSONArray . parseArray ( productionCompletedDeviceCode3 . toString ( ) ) ;
// 查找合适的放满设备
Device device2 = this . findNotHasGoodsDevice ( deviceCodes2 ) ;
if ( ObjectUtil . isEmpty ( device2 ) ) {
String message = "未找到合适的下料完成放满设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert device2 ! = null ;
this . taskService . create ( this . creatTask ( currentDevice , device2 , device3 , currentDevice , RequestMethodEnum . PRODUCTION_COMPLETED ) ) ;
// 查找合适的取空设备
Device device3 = this . findHasGoodsDevice ( deviceCodes3 ) ;
if ( ObjectUtil . isEmpty ( device3 ) ) {
String message = "未找到合适的下料完成取空设备。" ;
this . message = message ;
this . deviceExecuteLogService . deviceExecuteLog ( this . currentDeviceCode , "" , "" , message ) ;
return ;
}
assert device3 ! = null ;
this . taskService . create ( this . creatTask ( currentDevice , device2 , device3 , currentDevice , RequestMethodEnum . PRODUCTION_COMPLETED ) ) ;
this . requireSuccess = true ;
this . writing ( "to_command" , this . mode ) ;
}
}
}
}