@@ -5,27 +5,18 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil ;
import cn.hutool.core.util.StrUtil ;
import com.alibaba.fastjson.JSON ;
import com.alibaba.fastjson.JSONArray ;
import com.alibaba.fastjson.JSONObject ;
import lombok.Data ;
import lombok.RequiredArgsConstructor ;
import lombok.extern.slf4j.Slf4j ;
import org.nl.acs.AcsConfig ;
import org.nl.acs.device.service.DeviceService ;
import org.nl.acs.device_driver.DeviceDriver ;
import org.nl.acs.device_driver.FeedLmsRealFailed ;
import org.nl.acs.device_driver.RouteableDeviceDriver ;
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver ;
import org.nl.acs.device_driver.basedriver.lamp_three_color.LampThreecolorDeviceDriver ;
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver ;
import org.nl.acs.device_driver.basedriver.plugging_unplugging_machine.PluggingUnpluggingMachineDeviceDriver ;
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver ;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver ;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver ;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver ;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver ;
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest ;
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse ;
import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest ;
import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse ;
import org.nl.acs.ext.wms.service.AcsToWmsService ;
@@ -36,7 +27,6 @@ import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.service.InstructionService ;
import org.nl.acs.instruction.service.dto.Instruction ;
import org.nl.acs.log.service.DeviceExecuteLogService ;
import org.nl.acs.monitor.DeviceStageMonitor ;
import org.nl.acs.opc.Device ;
import org.nl.acs.opc.DeviceAppService ;
import org.nl.acs.opc.DeviceAppServiceImpl ;
@@ -312,13 +302,13 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 信号inflatable_shaft_size: " + last_inflatable_shaft_size + " -> " + inflatable_shaft_size ) ;
}
if ( task > 0 & & getTo_task_type ( ) = = 1 ) {
if ( task > 0 & & getTo_task_type ( ) = = 1 & & ! requireSucess ) {
update_instruction_status ( ) ;
} else if ( task > 0 & & getTo_task_type ( ) = = 2 ) { //
} else if ( task > 0 & & getTo_task_type ( ) = = 2 & & ! requireSucess ) {
update_instruction_status2 ( ) ;
} else if ( task > 0 & & getTo_task_type ( ) = = 6 ) {
} else if ( task > 0 & & getTo_task_type ( ) = = 6 & & ! requireSucess ) {
update_instruction_status3 ( ) ;
} else if ( task > 0 & & getTo_task_type ( ) = = 7 ) {
} else if ( task > 0 & & getTo_task_type ( ) = = 7 & & ! requireSucess ) {
update_instruction_status4 ( ) ;
}
@@ -426,503 +416,446 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
}
private synchronized void update_instruction_status ( ) {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest ( ) ;
ApplyManipulatorActionResponse applyManipulatorActionResponse ;
Date date = new Date ( ) ;
if ( date . getTime ( ) - this . instruction_update_time . getTime ( ) < ( long ) this . instruction_update_time_out ) {
log . trace ( " 触发时间因为小于{}毫秒,而被无视 " , this . instruction_update_time_out ) ;
} else {
this . instruction_update_time = date ;
//更改任务状态
if ( task > 0 ) {
//inst_message
Instruction inst1 = checkInst ( ) ;
if ( inst1 ! = null ) {
if ( StrUtil . equals ( inst1 . getInstruction_status ( ) , " 0 " ) ) {
inst1 . setInstruction_status ( " 1 " ) ;
inst1 . setExecute_device_code ( this . device_code ) ;
instructionService . update ( inst1 ) ;
Instruction inst1 = checkInst ( ) ;
if ( inst1 ! = null ) {
if ( date . getTime ( ) - this . instruction_update_time . getTime ( ) < ( long ) this . instruction_update_time_out ) {
log . trace ( " 触发时间因为小于{}毫秒,而被无视 " , this . instruction_update_time_out ) ;
} else {
this . instruction_update_time = date ;
//更改任务状态
if ( task > 0 ) {
//inst_message
if ( inst1 ! = null ) {
if ( StrUtil . equals ( inst1 . getInstruction_status ( ) , " 0 " ) ) {
inst1 . setInstruction_status ( " 1 " ) ;
inst1 . setExecute_device_code ( this . device_code ) ;
instructionService . update ( inst1 ) ;
}
}
}
}
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest ( ) ;
A pplyManipulatorActionResponse applyManipulatorActionResponse ;
//反馈尺寸
if ( action = = 2 ) {
Instruction inst2 = checkInst ( ) ;
String task_code = inst2 . getTask_code ( ) ;
TaskDto taskDto = taskserver . findByCode ( task_code ) ;
String truss_type = taskDto . getTruss_type ( ) ;
applyManipulatorActionRequest . setType ( truss_type ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionRequest . setSize ( String . valueOf ( inflatable_shaft_size ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
requireSucess = tru e;
message = " 反馈LMS成功... " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求成功 ,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
String version = applyManipulatorActionResponse . getVersion ( ) ;
String bushing_num = applyManipulatorActionResponse . getBushing_num ( ) ;
String is_bushing = applyManipulatorActionResponse . getIs_bushing ( ) ;
String detail_type = applyManipulatorActionResponse . getDetail_type ( ) ;
String put_device_code = applyManipulatorActionResponse . getPut_device_code ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 2 " ) ;
map . put ( " inflatableShaftVersion " , version ) ;
map . put ( " tube_num " , bushing_num ) ;
map . put ( " is_wrapped " , is_bushing ) ;
map . put ( " to_putpoint " , put_device_code ) ;
this . writing ( map ) ;
} else {
requireSucess = true ;
message = " 完成反馈LMS失败, " + String . valueOf ( applyManipulatorActionResponse ) ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求失败,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
//反馈尺寸
if ( action = = 2 ) {
String task_code = inst1 . getTask_code ( ) ;
a pplyManipulatorActionRequest . setType ( " 2 " ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionRequest . setSize ( String . valueOf ( inflatable_shaft_size ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
requireSucess = true ;
message = " 反馈LMS成功... " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求成功,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
m ap. put ( " to_command " , " 2 " ) ;
this . writing ( m ap) ;
} else {
requireSucess = fals e;
message = " 完成 反馈LMS失败, " + String . valueOf ( applyManipulatorActionResponse ) ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求失败 ,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
}
}
}
//任务完成
if ( action = = 8 ) {
Instruction inst2 = checkInst ( ) ;
if ( inst2 ! = null ) {
//任务完成
if ( action = = 8 ) {
try {
finish_instruction ( inst2 ) ;
finish_instruction ( inst1 ) ;
this . writing ( " to_command " , " 8 " ) ;
requireSucess = true ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
feedMessage = " " ;
}
} else {
feedMessag e = " 行架机械手: " ;
if ( mode ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
}
if ( action ! = 8 ) {
feedMessage = feedMessage + " 动作信号(action)不为完成状态, " ;
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
} else {
feedMessage = " 行架机械手: " ;
if ( mod e ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
}
if ( action ! = 8 ) {
feedMessage = feedMessage + " 动作信号(action)不为完成状态, " ;
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
}
}
}
} else {
feedMessage = " " ;
}
}
private synchronized void update_instruction_status2 ( ) {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest ( ) ;
ApplyManipulatorActionResponse applyManipulatorActionResponse ;
Date date = new Date ( ) ;
if ( date . getTime ( ) - this . instruction_update_time . getTime ( ) < ( long ) this . instruction_update_time_out ) {
log . trace ( " 触发时间因为小于{}毫秒,而被无视 " , this . instruction_update_time_out ) ;
Instruction inst1 = checkInst ( ) ;
if ( inst1 ! = null ) {
if ( date . getTime ( ) - this . instruction_update_time . getTime ( ) < ( long ) this . instruction_update_time_out ) {
log . trace ( " 触发时间因为小于{}毫秒,而被无视 " , this . instruction_update_time_out ) ;
} else {
this . instruction_update_time = date ;
//更改任务状态
if ( task > 0 ) {
//inst_message
Instruction inst1 = checkInst ( ) ;
if ( inst1 ! = null ) {
if ( StrUtil . equals ( inst1 . getInstruction_status ( ) , " 0 " ) ) {
inst1 . setInstruction_status ( " 1 " ) ;
inst1 . setExecute_device_code ( this . device_code ) ;
instructionService . update ( inst1 ) ;
}
}
}
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest ( ) ;
ApplyManipulatorActionResponse applyManipulatorActionResponse ;
//反馈气胀轴尺寸
if ( action = = 2 ) {
Instruction inst2 = checkInst ( ) ;
String task_code = inst2 . getTask_code ( ) ;
TaskDto taskDto = taskserver . findByCode ( task_code ) ;
String truss_type = taskDto . getTruss_type ( ) ;
applyManipulatorActionRequest . setType ( truss_type ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionRequest . setSize ( String . valueOf ( inflatable_shaft_size ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
requireSucess = true ;
message = " 反馈LMS成功... " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求成功,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 2 " ) ;
map . put ( " to_task_type " , " 2 " ) ;
this . writing ( map ) ;
} else {
requireSucess = true ;
message = " 完成反馈LMS失败, " + String . valueOf ( applyManipulatorActionResponse ) ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求失败,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
}
}
//申请放货点
if ( action = = 3 ) {
Instruction inst2 = checkInst ( ) ;
String task_code = inst2 . getTask_code ( ) ;
TaskDto taskDto = taskserver . findByCode ( task_code ) ;
String truss_type = taskDto . getTruss_type ( ) ;
applyManipulatorActionRequest . setType ( truss_type ) ;
applyManipulatorActionRequest . setTask_code ( String . valueOf ( task ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
String put_device_code = applyManipulatorActionResponse . getPut_device_code ( ) ;
String detail_type = applyManipulatorActionResponse . getDetail_type ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 3 " ) ;
map . put ( " to_putpoint " , put_device_code ) ;
this . writing ( map ) ;
requireSucess = true ;
}
//任务完成
if ( action = = 8 ) {
Instruction inst2 = checkInst ( ) ;
if ( inst2 ! = null ) {
try {
finish_instruction ( inst2 ) ;
this . writing ( " to_command " , " 8 " ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
feedMessage = " " ;
}
} else {
feedMessage = " 行架机械手: " ;
if ( mode ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
this . instruction_update_time = date ;
//更改任务状态
if ( task > 0 ) {
//inst_message
if ( inst1 ! = null ) {
if ( StrUtil . equals ( inst1 . getInstruction_status ( ) , " 0 " ) ) {
inst1 . setInstruction_status ( " 1 " ) ;
inst1 . setExecute_device_code ( this . device_code ) ;
instructionService . update ( inst1 ) ;
}
}
}
if ( action ! = 8 ) {
feedMessage = feedMessage + " 动作信号(action)不为完成状态, " ;
//反馈气胀轴尺寸
if ( action = = 2 ) {
String task_code = inst1 . getTask_code ( ) ;
applyManipulatorActionRequest . setType ( " 2 " ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionRequest . setSize ( String . valueOf ( inflatable_shaft_size ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
requireSucess = true ;
message = " 反馈LMS成功... " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求成功,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 2 " ) ;
map . put ( " to_task_type " , " 2 " ) ;
this . writing ( map ) ;
} else {
requireSucess = false ;
message = " 完成反馈LMS失败, " + String . valueOf ( applyManipulatorActionResponse ) ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求失败,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
}
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
//申请放货点
if ( action = = 3 ) {
String task_code = inst1 . getTask_code ( ) ;
applyManipulatorActionRequest . setType ( " 3 " ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
String put_device_code = applyManipulatorActionResponse . getPut_device_code ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 3 " ) ;
map . put ( " to_putpoint " , put_device_code ) ;
this . writing ( map ) ;
requireSucess = true ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
//任务完成
if ( action = = 8 ) {
if ( inst1 ! = null ) {
try {
requireSucess = true ;
finish_instruction ( inst1 ) ;
this . writing ( " to_command " , " 8 " ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
feedMessage = " " ;
}
} else {
feedMessage = " 行架机械手: " ;
if ( mode ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
}
if ( action ! = 8 ) {
feedMessage = feedMessage + " 动作信号(action)不为完成状态, " ;
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
}
}
}
} else {
feedMessage = " " ;
}
}
private synchronized void update_instruction_status3 ( ) {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest ( ) ;
ApplyManipulatorActionResponse applyManipulatorActionResponse ;
Date date = new Date ( ) ;
if ( date . getTime ( ) - this . instruction_update_time . getTime ( ) < ( long ) this . instruction_update_time_out ) {
log . trace ( " 触发时间因为小于{}毫秒,而被无视 " , this . instruction_update_time_out ) ;
Instruction inst1 = checkInst ( ) ;
if ( inst1 ! = null ) {
if ( date . getTime ( ) - this . instruction_update_time . getTime ( ) < ( long ) this . instruction_update_time_out ) {
log . trace ( " 触发时间因为小于{}毫秒,而被无视 " , this . instruction_update_time_out ) ;
} else {
this . instruction_update_time = date ;
//更改任务状态
if ( task > 0 ) {
//inst_message
Instruction inst1 = checkInst ( ) ;
if ( inst1 ! = null ) {
if ( StrUtil . equals ( inst1 . g etInstruction_status( ) , " 0 " ) ) {
inst1 . setInstruction_status ( " 1 " ) ;
inst1 . setExecute_device_code ( this . device_code ) ;
instructionService . update ( inst1 ) ;
}
}
}
//从拔轴机取货的新行架任务
if ( mode = = 3 & & action = = 1 & & move = = 0 & & task > 0 ) {
Instruction inst2 = checkInst ( ) ;
if ( ObjectUtil . isNotEmpty ( inst2 ) ) {
String start_device_code = inst2 . getStart_device_code ( ) ;
Device device = deviceAppService . findDeviceByCode ( start_device_code ) ;
PluggingUnpluggingMachineDeviceDriver pluggingUnpluggingMachineDeviceDriver ;
if ( device . getDeviceDriver ( ) instanceof PluggingUnpluggingMachineDeviceDriver ) {
pluggingUnpluggingMachineDeviceDriver = ( PluggingUnpluggingMachineDeviceDriver ) device . getDeviceDriver ( ) ;
int mode = pluggingUnpluggingMachineDeviceDriver . getMode ( ) ;
int error1 = pluggingUnpluggingMachineDeviceDriver . getError ( ) ;
int move = pluggingUnpluggingMachineDeviceDriver . getMove ( ) ;
if ( mode = = 2 & & error1 = = 0 & & move = = 1 ) {
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 1 " ) ;
this . writing ( map ) ;
this . setFeedbackSucess ( true ) ;
} else {
this . instruction_update_time = date ;
//更改任务状态
if ( task > 0 ) {
//inst_message
if ( inst1 ! = null ) {
if ( StrUtil . equals ( inst1 . getInstruction_status ( ) , " 0 " ) ) {
inst1 . s etInstruction_status( " 1 " ) ;
inst1 . setExecute_device_code ( this . device_code ) ;
instructionService . update ( inst1 ) ;
}
}
}
} else {
feedMessage = " 行架机械手: " ;
if ( mode ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
}
if ( action ! = 1 ) {
feedMessage = feedMessage + " 动作信号(action)不为取货中状态, " ;
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
}
}
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest ( ) ;
ApplyManipulatorActionResponse applyManipulatorActionResponse ;
//反馈尺寸
if ( action = = 2 ) {
Instruction inst2 = checkInst ( ) ;
String task_code = inst2 . getTask_cod e ( ) ;
TaskDto taskDto = taskserver . findByCode ( task_code ) ;
String truss_type = taskDto . getTruss_type ( ) ;
applyManipulatorActionRequest . setType ( truss_type ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionRequest . setSize ( String . valueOf ( inflatable_shaft_siz e ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
requireSucess = true ;
message = " 反馈LMS成功... " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求成功,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
String version = applyManipulatorActionResponse . getVersion ( );
String bushing_num = applyManipulatorActionResponse . getBushing_num ( ) ;
String is_bushing = applyManipulatorActionResponse . getIs_bushing ( ) ;
String detail_type = applyManipulatorActionResponse . getDetail_type ( ) ;
//反馈尺寸
if ( action = = 2 ) {
String task_code = inst1 . getTask_code ( ) ;
applyManipulatorActionRequest . setType ( " 2 " ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionRequest . setSize ( String . valueOf ( inflatable_shaft_siz e ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
requireSucess = true ;
message = " 反馈LMS成功... " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求成功,响应参数: " + JSON . toJSONString ( applyManipulatorActionRespons e ) ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 2 " ) ;
this . writing ( map ) ;
} else {
requireSucess = false ;
message = " 完成反馈LMS失败, " + String . valueOf ( applyManipulatorActionResponse ) ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求失败,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse) ) ;
}
}
//从拔轴机取货的新行架任务
if ( mode = = 3 & & action = = 1 & & move = = 0 & & task > 0 ) {
if ( ObjectUtil . isNotEmpty ( inst1 ) ) {
String start_device_code = inst1 . getStart_device_code ( ) ;
Device device = deviceAppService . findDeviceByCode ( start_device_code ) ;
PluggingUnpluggingMachineDeviceDriver pluggingUnpluggingMachineDeviceDriver ;
if ( device . getDeviceDriver ( ) instanceof PluggingUnpluggingMachineDeviceDriver ) {
pluggingUnpluggingMachineDeviceDriver = ( PluggingUnpluggingMachineDeviceDriver ) device . getDeviceDriver ( ) ;
int mode = pluggingUnpluggingMachineDeviceDriver . getMode ( ) ;
int error1 = pluggingUnpluggingMachineDeviceDriver . getError ( ) ;
int move = pluggingUnpluggingMachineDeviceDriver . getMove ( ) ;
if ( mode = = 2 & & error1 = = 0 & & move = = 1 ) {
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 1 " ) ;
this . writing ( map ) ;
requireSucess = true ;
}
}
}
} else {
feedMessage = " 行架机械手: " ;
if ( mode ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
}
if ( action ! = 1 ) {
feedMessage = feedMessage + " 动作信号(action)不为取货中状态, " ;
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
}
}
//申请放货点
if ( action = = 3 ) {
String task_code = inst1 . getTask_code ( ) ;
applyManipulatorActionRequest . setType ( " 3 " ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
String put_device_code = applyManipulatorActionResponse . getPut_device_code ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 2 " ) ;
map . put ( " inflatableShaftVersion " , version ) ;
map . put ( " tube_num " , bushing_num ) ;
map . put ( " is_wrapped " , is_bushing ) ;
map . put ( " to_command " , " 3 " ) ;
map . put ( " to_putpoint " , put_device_code ) ;
this . writing ( map ) ;
} else {
requireSucess = true ;
message = " 完成反馈LMS失败, " + String . valueOf ( applyManipulatorActionResponse ) ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求失败,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
}
}
//申请放货点
if ( action = = 3 ) {
Instruction inst2 = checkInst ( ) ;
String task_code = inst2 . getTask_code ( ) ;
TaskDto taskDto = taskserver . findByCode ( task_code ) ;
String truss_type = taskDto . getTruss_type ( ) ;
applyManipulatorActionRequest . setType ( truss_type ) ;
applyManipulatorActionRequest . setTask_code ( String . valueOf ( task ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
String put_device_code = applyManipulatorActionResponse . getPut_device_code ( ) ;
String detail_type = applyManipulatorActionResponse . getDetail_type ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 3 " ) ;
map . put ( " to_putpoint " , put_device_code ) ;
this . writing ( map ) ;
this . setFeedbackSucess ( true ) ;
}
//任务完成
if ( action = = 8 ) {
Instruction inst2 = checkInst ( ) ;
if ( inst2 ! = null ) {
//任务完成
if ( action = = 8 ) {
try {
String task_code = inst2 . getTask_code ( ) ;
TaskDto taskDto = taskserver . findByCode ( task_code ) ;
String truss_type = taskDto . getTruss_type ( ) ;
finish_instruction ( inst2 ) ;
requireSucess = true ;
finish_instruction ( inst1 ) ;
this . writing ( " to_command " , " 8 " ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
feedMessage = " " ;
}
} else {
feedMessag e = " 行架机械手: " ;
if ( mode ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
}
if ( action ! = 8 ) {
feedMessage = feedMessage + " 动作信号(action)不为完成状态, " ;
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
} else {
feedMessage = " 行架机械手: " ;
if ( mod e ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
}
if ( action ! = 8 ) {
feedMessage = feedMessage + " 动作信号(action)不为完成状态, " ;
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
}
}
}
} else {
feedMessage = " " ;
}
}
private synchronized void update_instruction_status4 ( ) {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest ( ) ;
ApplyManipulatorActionResponse applyManipulatorActionResponse ;
Date date = new Date ( ) ;
if ( date . getTime ( ) - this . instruction_update_time . getTime ( ) < ( long ) this . instruction_update_time_out ) {
log . trace ( " 触发时间因为小于{}毫秒,而被无视 " , this . instruction_update_time_out ) ;
Instruction inst1 = checkInst ( ) ;
if ( inst1 ! = null ) {
if ( date . getTime ( ) - this . instruction_update_time . getTime ( ) < ( long ) this . instruction_update_time_out ) {
log . trace ( " 触发时间因为小于{}毫秒,而被无视 " , this . instruction_update_time_out ) ;
} else {
this . instruction_update_time = date ;
//更改任务状态
if ( task > 0 ) {
//inst_message
Instruction inst1 = checkInst ( ) ;
if ( inst1 ! = null ) {
if ( StrUtil . equals ( inst1 . getInstruction_status ( ) , " 0 " ) ) {
inst1 . setInstruction_status ( " 1 " ) ;
inst1 . setExecute_device_code ( this . device_code ) ;
instructionService . update ( inst1 ) ;
}
}
}
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest ( ) ;
ApplyManipulatorActionResponse applyManipulatorActionResponse ;
//反馈尺寸
if ( action = = 2 ) {
Instruction inst2 = checkInst ( ) ;
String task_code = inst2 . getTask_code ( ) ;
TaskDto taskDto = taskserver . findByCode ( task_code ) ;
String truss_type = taskDto . getTruss_type ( ) ;
applyManipulatorActionRequest . setType ( truss_type ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionRequest . setSize ( String . valueOf ( inflatable_shaft_size ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
requireSucess = true ;
message = " 反馈LMS成功... " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求成功,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
String version = applyManipulatorActionResponse . getVersion ( ) ;
String bushing_num = applyManipulatorActionResponse . getBushing_num ( ) ;
String is_bushing = applyManipulatorActionResponse . getIs_bushing ( ) ;
String detail_type = applyManipulatorActionResponse . getDetail_type ( ) ;
String put_device_code = applyManipulatorActionResponse . getPut_device_code ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 2 " ) ;
map . put ( " inflatableShaftVersion " , version ) ;
map . put ( " tube_num " , bushing_num ) ;
map . put ( " is_wrapped " , is_bushing ) ;
map . put ( " to_putpoint " , put_device_code ) ;
this . writing ( map ) ;
} else {
requireSucess = true ;
message = " 完成反馈LMS失败, " + String . valueOf ( applyManipulatorActionResponse ) ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求失败,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
}
}
//申请放货点
if ( action = = 3 ) {
Instruction inst2 = checkInst ( ) ;
String task_code = inst2 . getTask_code ( ) ;
TaskDto taskDto = taskserver . findByCode ( task_code ) ;
String truss_type = taskDto . getTruss_type ( ) ;
applyManipulatorActionRequest . setType ( truss_type ) ;
applyManipulatorActionRequest . setTask_code ( String . valueOf ( task ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
String put_device_code = applyManipulatorActionResponse . getPut_device_code ( ) ;
String detail_type = applyManipulatorActionResponse . getDetail_type ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 3 " ) ;
map . put ( " to_task_type " , detail_type ) ;
map . put ( " to_putpoint " , put_device_code ) ;
this . writing ( map ) ;
this . setFeedbackSucess ( true ) ;
}
//申请新取货点
if ( action = = 4 ) {
applyManipulatorActionRequest . setType ( " 4 " ) ;
applyManipulatorActionRequest . setTask_code ( String . valueOf ( task ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
String get_device_code = applyManipulatorActionResponse . getGet_device_code ( ) ;
String put_device_code = applyManipulatorActionResponse . getPut_device_code ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 4 " ) ;
map . put ( " to_new_getpoint " , get_device_code ) ;
map . put ( " to_putpoint " , put_device_code ) ;
this . writing ( map ) ;
requireSucess = true ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 申请新取货点,返回参数: " + applyManipulatorActionResponse ) ;
message = " 申请新取货点成功 " ;
} else {
requireSucess = true ;
message = " 申请失败 " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 申请失败,返回参数: " + applyManipulatorActionResponse ) ;
}
}
//申请二次放货点
if ( action = = 5 ) {
applyManipulatorActionRequest . setType ( " 5 " ) ;
applyManipulatorActionRequest . setTask_code ( String . valueOf ( task ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
String put_device_code2 = applyManipulatorActionResponse . getPut_device_code2 ( ) ;
String detail_type = applyManipulatorActionResponse . getDetail_type ( ) ;
String get_device_code = applyManipulatorActionResponse . getGet_device_code ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 5 " ) ;
map . put ( " to_task_type " , detail_type ) ;
map . put ( " to_two_putpoint " , put_device_code2 ) ;
map . put ( " to_new_getpoint " , get_device_code ) ;
this . writing ( map ) ;
requireSucess = true ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 申请二次放货点,返回参数: " + applyManipulatorActionResponse ) ;
message = " 申请二次放货点成功 " ;
} else {
requireSucess = true ;
message = " 申请失败 " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 申请失败,返回参数: " + applyManipulatorActionResponse ) ;
}
}
//缓存库取货完成
if ( action = = 6 ) {
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 6 " ) ;
requireSucess = true ;
}
//缓存库放货完成
if ( action = = 7 ) {
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 7 " ) ;
requireSucess = true ;
}
//放货完成
if ( action = = 8 ) {
Instruction inst2 = checkInst ( ) ;
if ( inst2 ! = null ) {
try {
String task_code = inst2 . getTask_code ( ) ;
TaskDto taskDto = taskserver . findByCode ( task_code ) ;
String truss_type = taskDto . getTruss_type ( ) ;
finish_instruction ( inst2 ) ;
this . writing ( " to_command " , " 8 " ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
feedMessage = " " ;
}
} else {
feedMessage = " 行架机械手: " ;
if ( mode ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
this . instruction_update_time = date ;
//更改任务状态
if ( task > 0 ) {
//inst_message
if ( inst1 ! = null ) {
if ( StrUtil . equals ( inst1 . getInstruction_status ( ) , " 0 " ) ) {
inst1 . setInstruction_status ( " 1 " ) ;
inst1 . setExecute_device_code ( this . device_code ) ;
instructionService . update ( inst1 ) ;
}
}
}
if ( action ! = 8 ) {
feedMessage = feedMessage + " 动作信号(action)不为放货完成状态, " ;
//反馈尺寸
if ( action = = 2 ) {
String task_code = inst1 . getTask_code ( ) ;
applyManipulatorActionRequest . setType ( " 2 " ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionRequest . setSize ( String . valueOf ( inflatable_shaft_size ) ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
requireSucess = true ;
message = " 反馈LMS成功... " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求成功,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 2 " ) ;
this . writing ( map ) ;
} else {
requireSucess = false ;
message = " 完成反馈LMS失败, " + String . valueOf ( applyManipulatorActionResponse ) ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 反馈完成请求失败,响应参数: " + JSON . toJSONString ( applyManipulatorActionResponse ) ) ;
}
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
//申请放货点
if ( action = = 3 ) {
String task_code = inst1 . getTask_code ( ) ;
applyManipulatorActionRequest . setType ( " 3 " ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
String put_device_code = applyManipulatorActionResponse . getPut_device_code ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 3 " ) ;
map . put ( " to_putpoint " , put_device_code ) ;
this . writing ( map ) ;
requireSucess = true ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
//申请新取货点
if ( action = = 4 ) {
String task_code = inst1 . getTask_code ( ) ;
applyManipulatorActionRequest . setType ( " 4 " ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
String get_device_code = applyManipulatorActionResponse . getGet_device_code ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 4 " ) ;
map . put ( " to_new_getpoint " , get_device_code ) ;
this . writing ( map ) ;
requireSucess = true ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 申请新取货点,返回参数: " + applyManipulatorActionResponse ) ;
message = " 申请新取货点成功 " ;
} else {
requireSucess = false ;
message = " 申请失败 " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 申请失败,返回参数: " + applyManipulatorActionResponse ) ;
}
}
//申请二次放货点
if ( action = = 5 ) {
String task_code = inst1 . getTask_code ( ) ;
applyManipulatorActionRequest . setType ( " 5 " ) ;
applyManipulatorActionRequest . setTask_code ( task_code ) ;
applyManipulatorActionResponse = acsToWmsService . applyManipulatorActionRequest ( applyManipulatorActionRequest ) ;
if ( applyManipulatorActionResponse . getstatus ( ) = = 200 ) {
String put_device_code2 = applyManipulatorActionResponse . getPut_device_code2 ( ) ;
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 5 " ) ;
map . put ( " to_two_putpoint " , put_device_code2 ) ;
this . writing ( map ) ;
requireSucess = true ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 申请二次放货点,返回参数: " + applyManipulatorActionResponse ) ;
message = " 申请二次放货点成功 " ;
} else {
requireSucess = false ;
message = " 申请失败 " ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 申请失败,返回参数: " + applyManipulatorActionResponse ) ;
}
}
//缓存库取货完成
if ( action = = 6 ) {
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 6 " ) ;
requireSucess = true ;
}
//缓存库放货完成
if ( action = = 7 ) {
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " to_command " , " 7 " ) ;
requireSucess = true ;
}
//放货完成
if ( action = = 8 ) {
if ( inst1 ! = null ) {
try {
requireSucess = true ;
finish_instruction ( inst1 ) ;
this . writing ( " to_command " , " 8 " ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
feedMessage = " " ;
}
} else {
feedMessage = " 行架机械手: " ;
if ( mode ! = 3 ) {
feedMessage = feedMessage + " 工作模式(mode)不为运行中状态, " ;
}
if ( action ! = 8 ) {
feedMessage = feedMessage + " 动作信号(action)不为放货完成状态, " ;
}
if ( move ! = 0 ) {
feedMessage = feedMessage + " 光电信号(move)不为无货状态, " ;
}
if ( task = = 0 ) {
feedMessage = feedMessage + " 当前上报任务号(task)不应该为0。 " ;
}
}
}
} else {
feedMessage = " " ;
}
}
@@ -1086,7 +1019,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
taskDtoList = this . sortTask ( taskDtoList ) ;
task = taskDtoList . get ( j ) ;
// 9 行架任务
if ( ! StrUtil . equals ( task . getTruss _type ( ) , " 9 " ) ) {
if ( ! StrUtil . equals ( task . getTask _type ( ) , " 9 " ) ) {
task = null ;
continue ;
}
@@ -1098,7 +1031,6 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
if ( ! ObjectUtil . isEmpty ( task ) ) {
Device nextdevice = deviceAppService . findDeviceByCode ( task . getNext_device_code ( ) ) ;
Device startdevice = deviceAppService . findDeviceByCode ( task . getStart_device_code ( ) ) ;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver ;
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver ;
if ( startdevice . getDeviceDriver ( ) instanceof SiemensConveyorDeviceDriver ) {
siemensConveyorDeviceDriver = ( SiemensConveyorDeviceDriver ) startdevice . getDeviceDriver ( ) ;