@ -14,6 +14,7 @@ import org.nl.acs.device_driver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver ;
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver ;
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver ;
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver ;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver ;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver ;
import org.nl.acs.device_driver.standard_inspect_site_smart200.StandardInspectSiteSmartDeviceDriver ;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver ;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver ;
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver ;
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver ;
import org.nl.acs.ext.wms.service.AcsToWmsService ;
import org.nl.acs.ext.wms.service.AcsToWmsService ;
@ -156,6 +157,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
StandardStorageDeviceDriver standardStorageDeviceDriver ;
StandardStorageDeviceDriver standardStorageDeviceDriver ;
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver ;
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver ;
StandardEmptyPalletSiteDeviceDriver standardEmptyPalletSiteDeviceDriver ;
StandardEmptyPalletSiteDeviceDriver standardEmptyPalletSiteDeviceDriver ;
StandardInspectSiteSmartDeviceDriver standardInspectSiteSmartDeviceDriver ;
int type = Integer . parseInt ( acsConfigService . findConfigFromCache ( ) . get ( AcsConfig . BUSINESSTYPE ) ) ;
int type = Integer . parseInt ( acsConfigService . findConfigFromCache ( ) . get ( AcsConfig . BUSINESSTYPE ) ) ;
try {
try {
@ -180,7 +182,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
// 到达取货点请求取货
// 到达取货点请求取货
else if ( phase = = 0x03 ) {
else if ( phase = = 0x03 ) {
if ( ObjectUtil . isEmpty ( inst ) ) {
if ( ObjectUtil . isEmpty ( inst ) ) {
logServer . deviceExecuteLog ( "未找到指令号对应的指令:" , "" , "" , String . valueOf ( ikey ) ) ;
logServer . deviceExecuteLog ( "未找到指令号对应的指令:" , "" , "" , String . valueOf ( ikey ) ) ;
break ;
break ;
}
}
//检测站点
//检测站点
@ -194,7 +196,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
flag = true ;
flag = true ;
} else {
} else {
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求取货设备{}无货,无法反馈" ) ;
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求取货设备{}无货,无法反馈" ) ;
}
}
}
}
//普通站点
//普通站点
@ -212,10 +214,41 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
flag = true ;
flag = true ;
} else {
} else {
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求取货设备{}无货,无法反馈" ) ;
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求取货设备{}无货,无法反馈" ) ;
}
}
}
}
}
}
//检测站点smart200
if ( device . getDeviceDriver ( ) instanceof StandardInspectSiteSmartDeviceDriver ) {
standardInspectSiteSmartDeviceDriver = ( StandardInspectSiteSmartDeviceDriver ) device . getDeviceDriver ( ) ;
if ( StrUtil . equals ( acsConfigService . findConfigFromCache ( ) . get ( AcsConfig . IGNOREHASGOODS ) , "1" ) ) {
inst . setExecute_status ( "1" ) ;
instructionService . update ( inst ) ;
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
flag = true ;
} else {
if ( device . getHas_goods ( ) ! = 0 ) {
inst . setExecute_status ( "1" ) ;
instructionService . update ( inst ) ;
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
flag = true ;
} else {
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求取货设备{}无货,无法反馈" ) ;
}
}
//如果是混料区则上送LMS当前点位的字段,同步到st_ivt_structivt仓位库存表
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( "device_code" , device_code ) ;
jsonObject . put ( "weight" , standardInspectSiteSmartDeviceDriver . getWeight ( ) ) ;
jsonObject . put ( "product_code" , standardInspectSiteSmartDeviceDriver . getProduct_code ( ) ) ;
jsonObject . put ( "batch_code" , standardInspectSiteSmartDeviceDriver . getBatch_code ( ) ) ;
jsonObject . put ( "product_specifications" , standardInspectSiteSmartDeviceDriver . getProduct_specifications ( ) ) ;
jsonObject . put ( "time" , standardInspectSiteSmartDeviceDriver . getTime ( ) ) ;
jsonObject . put ( "type" , "9" ) ;
acsToWmsService . lnshApplyTaskToWms ( jsonObject ) ;
}
// 检验取放货条件
// 检验取放货条件
JSONObject agv_check = device_extra_table
JSONObject agv_check = device_extra_table
. query ( "is_delete = '0' AND extra_code = 'agv_check' AND device_code = '" + device . getDevice_code ( ) + "'" )
. query ( "is_delete = '0' AND extra_code = 'agv_check' AND device_code = '" + device . getDevice_code ( ) + "'" )
@ -232,14 +265,14 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
agv_check_status . put ( "extra_value" , "0" ) ;
agv_check_status . put ( "extra_value" , "0" ) ;
device_extra_table . update ( agv_check_status ) ;
device_extra_table . update ( agv_check_status ) ;
} else {
} else {
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求取货设备{}未放盖确认,无法反馈" ) ;
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求取货设备{}未放盖确认,无法反馈" ) ;
}
}
}
}
}
}
// 取货完成请求离开
// 取货完成请求离开
else if ( phase = = 0x05 ) {
else if ( phase = = 0x05 ) {
if ( ObjectUtil . isEmpty ( inst ) ) {
if ( ObjectUtil . isEmpty ( inst ) ) {
logServer . deviceExecuteLog ( "未找到指令号对应的指令:" , "" , "" , String . valueOf ( ikey ) ) ;
logServer . deviceExecuteLog ( "未找到指令号对应的指令:" , "" , "" , String . valueOf ( ikey ) ) ;
break ;
break ;
}
}
if ( device . getDeviceDriver ( ) instanceof StandardInspectSiteDeviceDriver ) {
if ( device . getDeviceDriver ( ) instanceof StandardInspectSiteDeviceDriver ) {
@ -252,7 +285,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
flag = true ;
flag = true ;
} else {
} else {
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV取货完成请求离开设备{}有货,无法反馈" ) ;
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV取货完成请求离开设备{}有货,无法反馈" ) ;
}
}
}
}
@ -273,19 +306,20 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//请求放货
//请求放货
else if ( phase = = 0x07 ) {
else if ( phase = = 0x07 ) {
if ( ObjectUtil . isEmpty ( inst ) ) {
if ( ObjectUtil . isEmpty ( inst ) ) {
logServer . deviceExecuteLog ( "未找到指令号对应的指令:" , "" , "" , String . valueOf ( ikey ) ) ;
logServer . deviceExecuteLog ( "未找到指令号对应的指令:" , "" , "" , String . valueOf ( ikey ) ) ;
break ;
break ;
}
}
if ( device . getDeviceDriver ( ) instanceof StandardInspectSiteDeviceDriver ) {
if ( device . getDeviceDriver ( ) instanceof StandardInspectSiteDeviceDriver ) {
standardInspectSiteDeviceDriver = ( StandardInspectSiteDeviceDriver ) device . getDeviceDriver ( ) ;
standardInspectSiteDeviceDriver = ( StandardInspectSiteDeviceDriver ) device . getDeviceDriver ( ) ;
standardInspectSiteDeviceDriver . writing ( 4 ) ;
standardInspectSiteDeviceDriver . writing ( 4 ) ;
if ( standardInspectSiteDeviceDriver . getMode ( ) ! = 0
if ( standardInspectSiteDeviceDriver . getMode ( ) ! = 0
& & standardInspectSiteDeviceDriver . getMove ( ) = = 0 ) { inst . setExecute_status ( "3" ) ;
& & standardInspectSiteDeviceDriver . getMove ( ) = = 0 ) {
inst . setExecute_status ( "3" ) ;
instructionService . update ( inst ) ;
instructionService . update ( inst ) ;
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
flag = true ;
flag = true ;
} else {
} else {
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求放货设备{}有货,无法反馈" ) ;
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求放货设备{}有货,无法反馈" ) ;
}
}
}
}
// 检验取放货条件
// 检验取放货条件
@ -304,14 +338,14 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
agv_check_status . put ( "extra_value" , "0" ) ;
agv_check_status . put ( "extra_value" , "0" ) ;
device_extra_table . update ( agv_check_status ) ;
device_extra_table . update ( agv_check_status ) ;
} else {
} else {
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求取货设备{}未取盖确认,无法反馈" ) ;
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV请求取货设备{}未取盖确认,无法反馈" ) ;
}
}
}
}
}
}
// 放货完成请求离开
// 放货完成请求离开
else if ( phase = = 0x09 ) {
else if ( phase = = 0x09 ) {
if ( ObjectUtil . isEmpty ( inst ) ) {
if ( ObjectUtil . isEmpty ( inst ) ) {
logServer . deviceExecuteLog ( "未找到指令号对应的指令:" , "" , "" , String . valueOf ( ikey ) ) ;
logServer . deviceExecuteLog ( "未找到指令号对应的指令:" , "" , "" , String . valueOf ( ikey ) ) ;
break ;
break ;
}
}
if ( device . getDeviceDriver ( ) instanceof StandardInspectSiteDeviceDriver ) {
if ( device . getDeviceDriver ( ) instanceof StandardInspectSiteDeviceDriver ) {
@ -324,7 +358,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
data = AgvService . sendAgvOneModeInst ( phase , index , 0 ) ;
flag = true ;
flag = true ;
} else {
} else {
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV放货完成请求离开设备{}无货,无法反馈" ) ;
logServer . deviceExecuteLog ( device_code , "" , "" , "AGV放货完成请求离开设备{}无货,无法反馈" ) ;
}
}
}
}
@ -477,27 +511,32 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if ( ! ObjectUtil . isEmpty ( data ) ) {
if ( ! ObjectUtil . isEmpty ( data ) ) {
write ( data ) ;
write ( data ) ;
}
}
} catch ( Exception e ) {
} catch ( Exception e ) {
System . out . println ( e ) ;
System . out . println ( e ) ;
log . info ( e . toString ( ) ) ;
log . info ( e . toString ( ) ) ;
log . info ( e . getMessage ( ) ) ;
log . info ( e . getMessage ( ) ) ;
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}
} else {
} else {
System . out . println ( "agv上报不是0073类型动作,不处理" ) ;
System . out . println ( "agv上报不是0073类型动作,不处理" ) ;
}
}
}
}
} catch ( Exception e ) {
} catch (
Exception e )
{
} finally {
} finally
{
}
}
}
}
@Override
@Override
public void stop ( ) {
public void stop ( ) {