@@ -32,6 +32,7 @@ import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService ;
import org.nl.modules.lucene.service.LuceneExecuteLogService ;
import org.nl.modules.lucene.service.dto.LuceneLogDto ;
import org.nl.modules.system.domain.Param ;
import org.nl.modules.wql.util.SpringContextHolder ;
import org.openscada.opc.lib.da.Server ;
@@ -70,7 +71,8 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
int mode = 0 ;
int move = 0 ;
int weight = 0 ;
String material_code = " " ;
int error = 0 ;
int action = 0 ;
int last_action = 0 ;
@@ -102,6 +104,18 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
String device_code ;
int status = 0 ;
int last_status = 0 ;
String last_laser_marking_code = " " ;
String last_grinding_number = " " ;
int last_height1 = 0 ;
int last_height2 = 0 ;
int last_height3 = 0 ;
int last_height4 = 0 ;
int last_width1 = 0 ;
int last_width2 = 0 ;
int last_len = 0 ;
int last_volume = 0 ;
int last_flatness = 0 ;
int last_unqualified_qty = 0 ;
//开机时间
String open_time = " 0 " ;
String last_open_time = " 0 " ;
@@ -119,32 +133,22 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
int last_get_station = 0 ;
int put_station = 0 ;
int last_put_station = 0 ;
int is_qualified = 0 ;
int last_is_qualified = 0 ;
String laser_marking_code = " " ;
String last_laser_marking_code = " " ;
Str ing grinding_number = " " ;
Str ing last_grinding_number = " " ;
Str ing height1 = " " ;
Str ing last_ height1 = " " ;
Str ing height2 = " " ;
Str ing last_height 2 = " " ;
Str ing height3 = " " ;
Str ing last_height3 = " " ;
Str ing height4 = " " ;
String last_height4 = " " ;
Str ing width1 = " " ;
String last_width1 = " " ;
String width2 = " " ;
String last_width2 = " " ;
String len = " " ;
String last_len = " " ;
String volume = " " ;
String last_volume = " " ;
String flatness = " " ;
String last_flatness = " " ;
String unqualified_qty = " " ;
String last_unqualified_qty = " " ;
int is_qualified = 0 ;
int last_is_qualified = 0 ;
String laser_marking_code = " " ;
String grinding_number = " " ;
int height1 = 0 ;
int height2 = 0 ;
int height3 = 0 ;
int height4 = 0 ;
int width1 = 0 ;
int width 2 = 0 ;
int len = 0 ;
int volume = 0 ;
int flatness = 0 ;
int unqualified_qty = 0 ;
@Override
public Device getDevice ( ) {
@@ -155,6 +159,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
@Override
public void execute ( ) {
String message = null ;
try {
device_code = this . getDeviceCode ( ) ;
mode = this . itemProtocol . getMode ( ) ;
@@ -186,96 +191,96 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
logServer . deviceItemValue ( this . device_code , " mode " , String . valueOf ( mode ) ) ;
logServer . deviceExecuteLog ( this . device_code , " " , " " , " 信号mode: " + last_mode + " -> " + mode ) ;
}
if ( status ! = last_status) {
logServer. deviceItemValue( this . device_code , " status " , String. valueOf( status) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号status: " + last_status + " -> " + status) ;
}
if ( action ! = last_action) {
logServer. deviceItemValue( this . device_code , " action " , String. valueOf( action) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号action: " + last_action + " -> " + action) ;
}
if ( error ! = last_error) {
logServer. deviceItemValue( this . device_code , " error " , String. valueOf( error ) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号error: " + last_error + " -> " + error ) ;
}
if ( ! open_time. equals( last_open_time) ) {
logServer. deviceItemValue( this . device_code , " open_time " , String. valueOf( open_time) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号open_time: " + last_open_time + " -> " + open_time) ;
}
if ( standby_time ! = last_standby_time) {
logServer. deviceItemValue( this . device_code , " standby_time" , String. valueOf( standby_time) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号standby_time: " + last_standby_time + " -> " + standby_time) ;
}
if ( production_time ! = last_production_time) {
logServer. deviceItemValue( this . device_code , " production_time" , String. valueOf( production_time) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号production_time: " + last_production_time + " -> " + production_time) ;
}
if ( error_time ! = last_error_time) {
logServer. deviceItemValue( this . device_code , " error_time " , String. valueOf( error_time) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号error_time: " + last_error_time + " -> " + error_time) ;
}
if ( get_station ! = last_get_station) {
this. setRequireSucess( false ) ;
logServer. deviceItemValue( this . device_code , " get_station " , String. valueOf( get_station) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号get_station: " + last_get_station + " -> " + get_station) ;
}
if ( put_station ! = last_put_station) {
logServer. deviceItemValue( this . device_code , " put_station " , String. valueOf( put_station) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号put_station: " + last_put_station + " -> " + put_station) ;
}
if ( is_qualified ! = last_is_qualified) {
logServer. deviceItemValue( this . device_code , " is_qualified" , String. valueOf( is_qualified) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号is_qualified: " + last_is_qualified + " -> " + is_qualified) ;
}
if ( ! laser_marking_code. equals( last_laser_marking_code) ) {
logServer. deviceItemValue( this . device_code , " laser_marking_code" , String. valueOf( laser_marking_code) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号laser_marking_code: " + last_laser_marking_code + " -> " + laser_marking_code) ;
}
if ( ! grinding_number. equals( last_grinding_number) ) {
logServer. deviceItemValue( this . device_code , " grinding_number" , String. valueOf( grinding_number) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号grinding_number: " + last_grinding_number + " -> " + grinding_number) ;
}
if ( ! height1. equals( last_height1) ) {
logServer. deviceItemValue( this . device_code , " height1 " , String. valueOf( height1) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号height1: " + last_height1 + " -> " + height1) ;
}
if ( ! height2. equals( last_height2) ) {
logServer. deviceItemValue( this . device_code , " height2 " , String. valueOf( height2) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号height2: " + last_height2 + " -> " + height2) ;
}
if ( ! height3. equals( last_height3) ) {
logServer. deviceItemValue( this . device_code , " height3 " , String. valueOf( height3) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号height3: " + last_height3 + " -> " + height3) ;
}
if ( ! height4. equals( last_height4) ) {
logServer. deviceItemValue( this . device_code , " height4 " , String. valueOf( height4) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号height4: " + last_height4 + " -> " + height4) ;
}
if ( ! width1. equals( last_width1) ) {
logServer. deviceItemValue( this . device_code , " width1 " , String. valueOf( width1) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号width1: " + last_width1 + " -> " + width1) ;
}
if ( ! width2. equals( last_width2) ) {
logServer. deviceItemValue( this . device_code , " width2 " , String. valueOf( width2) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号width2: " + last_width2 + " -> " + width2) ;
}
if ( ! len . equals( last_len) ) {
logServer. deviceItemValue( this . device_code , " len " , String. valueOf( len ) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号len: " + last_len + " -> " + len ) ;
}
if ( ! volume. equals( last_volume) ) {
logServer. deviceItemValue( this . device_code , " volume " , String. valueOf( volume) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号volume: " + last_volume + " -> " + volume) ;
}
if ( ! flatness. equals( last_flatness) ) {
logServer. deviceItemValue( this . device_code , " flatness " , String. valueOf( flatness) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号flatness: " + last_flatness + " -> " + flatness) ;
}
if ( ! unqualified_qty. equals( last_unqualified_qty) ) {
logServer. deviceItemValue( this . device_code , " unqualified_qty" , String. valueOf( unqualified_qty) ) ;
logServer. deviceExecuteLog( this . device_code , " " , " " , " 信号unqualified_qty: " + last_unqualified_qty + " -> " + unqualified_qty) ;
}
// if (status != last_status) {
// logServer. deviceItemValue(this.device_code, "status", String. valueOf( status)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号status: " + last_status + " -> " + status) ;
// }
// if (action != last_action) {
// logServer. deviceItemValue(this.device_code, "action", String. valueOf( action)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号action: " + last_action + " -> " + action) ;
// }
// if (error != last_error) {
// logServer. deviceItemValue(this.device_code, "error", String. valueOf(error)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号error: " + last_error + " -> " + error) ;
// }
// if (! open_time. equals( last_open_time)) {
// logServer. deviceItemValue(this.device_code, "open_time", String. valueOf( open_time)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号open_time: " + last_open_time + " -> " + open_time) ;
// }
// if (standby_time != last_standby_time) {
// logServer. deviceItemValue(this.device_code, " standby_time", String. valueOf( standby_time)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", " 信号standby_time: " + last_standby_time + " -> " + standby_time) ;
// }
// if ( production_time != last_production_time) {
// logServer. deviceItemValue(this.device_code, " production_time", String. valueOf( production_time)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", " 信号production_time: " + last_production_time + " -> " + production_time) ;
// }
// if (error_time != last_error_time) {
// logServer. deviceItemValue(this.device_code, "error_time", String. valueOf( error_time)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号error_time: " + last_error_time + " -> " + error_time) ;
// }
//
// if (get_station != last_get_station) {
// this. setRequireSucess(false) ;
// logServer. deviceItemValue(this.device_code, "get_station", String. valueOf( get_station)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号get_station: " + last_get_station + " -> " + get_station) ;
// }
// if (put_station != last_put_station) {
// logServer. deviceItemValue(this.device_code, "put_station", String. valueOf( put_station)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号put_station: " + last_put_station + " -> " + put_station) ;
// }
// if (is_qualified != last_is_qualified) {
// logServer. deviceItemValue(this.device_code, " is_qualified", String. valueOf( is_qualified)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", " 信号is_qualified: " + last_is_qualified + " -> " + is_qualified) ;
// }
// if (! laser_marking_code. equals( last_laser_marking_code)) {
// logServer. deviceItemValue(this.device_code, " laser_marking_code", String. valueOf( laser_marking_code)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", " 信号laser_marking_code: " + last_laser_marking_code + " -> " + laser_marking_code) ;
// }
// if (! grinding_number. equals( last_grinding_number)) {
// logServer. deviceItemValue(this.device_code, " grinding_number", String. valueOf( grinding_number)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", " 信号grinding_number: " + last_grinding_number + " -> " + grinding_number) ;
// }
// if (! height1. equals( last_height1)) {
// logServer. deviceItemValue(this.device_code, "height1", String. valueOf( height1)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号height1: " + last_height1 + " -> " + height1) ;
// }
// if (! height2. equals( last_height2)) {
// logServer. deviceItemValue(this.device_code, "height2", String. valueOf( height2)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号height2: " + last_height2 + " -> " + height2) ;
// }
// if (! height3. equals( last_height3)) {
// logServer. deviceItemValue(this.device_code, "height3", String. valueOf( height3)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号height3: " + last_height3 + " -> " + height3) ;
// }
// if (! height4. equals( last_height4)) {
// logServer. deviceItemValue(this.device_code, "height4", String. valueOf( height4)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号height4: " + last_height4 + " -> " + height4) ;
// }
// if (! width1. equals( last_width1)) {
// logServer. deviceItemValue(this.device_code, "width1", String. valueOf( width1)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号width1: " + last_width1 + " -> " + width1) ;
// }
// if (! width2. equals( last_width2)) {
// logServer. deviceItemValue(this.device_code, "width2", String. valueOf( width2)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号width2: " + last_width2 + " -> " + width2) ;
// }
// if (!len. equals( last_len)) {
// logServer. deviceItemValue(this.device_code, "len", String. valueOf(len)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号len: " + last_len + " -> " + len) ;
// }
// if (! volume. equals( last_volume)) {
// logServer. deviceItemValue(this.device_code, "volume", String. valueOf( volume)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号volume: " + last_volume + " -> " + volume) ;
// }
// if (! flatness. equals( last_flatness)) {
// logServer. deviceItemValue(this.device_code, "flatness", String. valueOf( flatness)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", "信号flatness: " + last_flatness + " -> " + flatness) ;
// }
// if (! unqualified_qty. equals( last_unqualified_qty)) {
// logServer. deviceItemValue(this.device_code, " unqualified_qty", String. valueOf( unqualified_qty)) ;
// logServer. deviceExecuteLog(this.device_code, "", "", " 信号unqualified_qty: " + last_unqualified_qty + " -> " + unqualified_qty) ;
// }
} catch ( Exception var17 ) {
return ;
@@ -672,22 +677,22 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
request . setDevice_code ( this . getDevice_code ( ) ) ;
request . setRequest_medthod_code ( Thread . currentThread ( ) . getStackTrace ( ) [ 1 ] . getMethodName ( ) ) ;
request . setRequest_medthod_name ( RequestMethodEnum . getName ( Thread . currentThread ( ) . getStackTrace ( ) [ 1 ] . getMethodName ( ) ) ) ;
List < String > getDeviceCodeList = this . getExtraDeviceCodes ( " get_station " ) ;
List < String > putDeviceCodeList = this . getExtraDeviceCodes ( " put_station " ) ;
List < String > getDeviceCodeList = this . getExtraDeviceCodes ( " link_ get_station" ) ;
List < String > putDeviceCodeList = this . getExtraDeviceCodes ( " link_ put_station" ) ;
request . setGet_station ( getDeviceCodeList . get ( 0 ) ) ;
request . setPut_station ( putDeviceCodeList . get ( put_station ) ) ;
request . setLaser_marking_code ( laser_marking_code ) ;
request . setGrinding_number ( grinding_number ) ;
request . setHeight1 ( height1 ) ;
request . setHeight2 ( height2 ) ;
request . setHeight3 ( height3 ) ;
request . setHeight4 ( height4 ) ;
request . setWidth1 ( width1 ) ;
request . setWidth2 ( width2 ) ;
request . setLen ( len ) ;
request . setVolume ( volume ) ;
request . setFlatness ( flatness ) ;
request . setUnqualified_qty ( unqualified_qty ) ;
request . setHeight1 ( String . valueOf ( height1) ) ;
request . setHeight2 ( String . valueOf ( height2) ) ;
request . setHeight3 ( String . valueOf ( height3) ) ;
request . setHeight4 ( String . valueOf ( height4) ) ;
request . setWidth1 ( String . valueOf ( width1) ) ;
request . setWidth2 ( String . valueOf ( width2) ) ;
request . setLen ( String . valueOf ( len ) ) ;
request . setVolume ( String . valueOf ( volume) ) ;
request . setFlatness ( String . valueOf ( flatness) ) ;
request . setUnqualified_qty ( String . valueOf ( unqualified_qty) ) ;
message = RequestMethodEnum . getName ( " apply_one_grab " ) + " apply_one_grab 接口请求LMS... " ;
lucene . deviceExecuteLog ( new LuceneLogDto ( this . device_code , message + " 参数: " + JSON . toJSONString ( request ) ) ) ;
ApplyTaskResponse resp = JSON . toJavaObject ( JSONObject . parseObject ( acsToWmsService . applyTask ( request ) ) , ApplyTaskResponse . class ) ;
@@ -703,6 +708,31 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
return true ;
}
/**
* 反馈压机残留重量
*/
public synchronized boolean apply_feedback_weight ( ) {
ApplyTaskRequest request = new ApplyTaskRequest ( ) ;
request . setDevice_code ( this . getDevice_code ( ) ) ;
request . setRequest_medthod_code ( Thread . currentThread ( ) . getStackTrace ( ) [ 1 ] . getMethodName ( ) ) ;
request . setRequest_medthod_name ( RequestMethodEnum . getName ( Thread . currentThread ( ) . getStackTrace ( ) [ 1 ] . getMethodName ( ) ) ) ;
request . setWeight ( String . valueOf ( weight ) ) ;
request . setMaterial_code ( String . valueOf ( material_code ) ) ;
ApplyTaskResponse resp = JSON . toJavaObject ( JSONObject . parseObject ( acsToWmsService . applyTask ( request ) ) , ApplyTaskResponse . class ) ;
message = RequestMethodEnum . getName ( " apply_feedback_weight " ) + " apply_feedback_weight 接口请求LMS... " ;
lucene . deviceExecuteLog ( new LuceneLogDto ( this . device_code , message + " 参数: " + JSON . toJSONString ( request ) ) ) ;
if ( resp . getCode ( ) = = 200 ) {
this . writing ( 200 ) ;
this . setRequireSucess ( true ) ;
} else {
this . writing ( 400 ) ;
message = RequestMethodEnum . getName ( " apply_feedback_weight " ) + " apply_feedback_weight 接口请求失败 " + resp . getMessage ( ) ;
;
}
return true ;
}
/**
* 获取托盘信息
*