@ -67,7 +67,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
int detail_strapping_qty = 0 ;
int detail_strapping_oneqty = 0 ;
int detail_coating_qty = 0 ;
int labeling_order = 0 ;
int labeling_order_detail = 0 ;
int detail_labeling_qualified_qty = 0 ;
int detail_labeling_qty = 0 ;
Float line_speed = 0 . 0f ;
@ -81,6 +81,8 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
int lettering_frequency = 0 ;
Float one_speed = 0 . 0f ;
int coating_frequency = 0 ;
int strapping_order_detail = 0 ;
int order_feeding_finish = 0 ;
int last_mode = 0 ;
int last_error = 0 ;
@ -101,7 +103,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
int last_detail_strapping_qty = 0 ;
int last_detail_strapping_oneqty = 0 ;
int last_detail_coating_qty = 0 ;
int last_labeling_order = 0 ;
int last_labeling_order_detail = 0 ;
int last_detail_labeling_qualified_qty = 0 ;
int last_detail_labeling_qty = 0 ;
Float last_line_speed = 0 . 0f ;
@ -115,6 +117,8 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
int last_lettering_frequency = 0 ;
Float last_one_speed = 0 . 0f ;
int last_coating_frequency = 0 ;
int last_strapping_order_detail = 0 ;
int last_order_feeding_finish = 0 ;
Boolean send_letter_flag_back = false ;
Boolean send_letter_flag = false ;
@ -156,7 +160,9 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
//当前工单明细号裹膜数
detail_coating_qty = this . itemProtocol . getDetail_coating_qty ( ) ;
//当前贴标工单明细号
labeling_order = this . itemProtocol . getLabeling_order ( ) ;
labeling_order_detail = this . itemProtocol . getLabeling_order_detail ( ) ;
//捆扎明细
strapping_order_detail = this . itemProtocol . getStrapping_order_detail ( ) ;
//当前贴标工单明细号贴标合格数
detail_labeling_qualified_qty = this . itemProtocol . getDetail_strapping_qty ( ) ;
//当前贴标工单明细号贴标数
@ -172,6 +178,9 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
lettering_frequency = this . itemProtocol . getLettering_frequency ( ) ;
one_speed = this . itemProtocol . getOne_speed ( ) ;
coating_frequency = this . itemProtocol . getCoating_frequency ( ) ;
strapping_order_detail = this . itemProtocol . getStrapping_order_detail ( ) ;
order_feeding_finish = this . itemProtocol . getOrder_feeding_finish ( ) ;
if ( mode ! = last_mode ) {
this . setRequireSucess ( false ) ;
@ -281,10 +290,10 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
logServer . deviceLogToacs ( this . device_code , "" , "" , "信号detail_coating_qty:" + last_detail_coating_qty + "->" + detail_coating_qty ) ;
}
if ( labeling_order ! = last_labeling_order )
if ( labeling_order_detail ! = last_labeling_order_detail )
{
logServer . deviceLog ( this . device_code , "labeling_order" , String . valueOf ( labeling_order ) ) ;
logServer . deviceLogToacs ( this . device_code , "" , "" , "信号labeling_order:" + last_labeling_order + "->" + labeling_order ) ;
logServer . deviceLog ( this . device_code , "labeling_order" , String . valueOf ( labeling_order_detail ) ) ;
logServer . deviceLogToacs ( this . device_code , "" , "" , "信号labeling_order:" + last_labeling_order_detail + "->" + labeling_order_detail ) ;
}
if ( detail_labeling_qualified_qty ! = last_detail_labeling_qualified_qty )
@ -358,11 +367,36 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
logServer . deviceLog ( this . device_code , "coating_frequency" , String . valueOf ( coating_frequency ) ) ;
logServer . deviceLogToacs ( this . device_code , "" , "" , "信号coating_frequency:" + last_coating_frequency + "->" + coating_frequency ) ;
}
if ( strapping_order_detail ! = last_strapping_order_detail )
{
logServer . deviceLog ( this . device_code , "strapping_order_detail" , String . valueOf ( strapping_order_detail ) ) ;
logServer . deviceLogToacs ( this . device_code , "" , "" , "信号strapping_order_detail:" + last_strapping_order_detail + "->" + strapping_order_detail ) ;
}
if ( order_feeding_finish ! = last_order_feeding_finish )
{
logServer . deviceLog ( this . device_code , "order_feeding_finish" , String . valueOf ( order_feeding_finish ) ) ;
logServer . deviceLogToacs ( this . device_code , "" , "" , "信号order_feeding_finish:" + last_order_feeding_finish + "->" + order_feeding_finish ) ;
}
try {
if ( order > 0 & & order_detail > 0 ) {
update_detail ( String . valueOf ( order ) , String . valueOf ( order_detail ) ) ;
}
//上料明细更新
if ( order > 0 & & order_detail > 0 ) {
update_detail ( String . valueOf ( order ) , String . valueOf ( order_detail ) ) ;
}
//贴标明细更新
if ( order > 0 & & labeling_order_detail > 0 ) {
update_labeling_detail ( String . valueOf ( order ) , String . valueOf ( labeling_order_detail ) ) ;
}
//捆扎明细更新
if ( order > 0 & & strapping_order_detail > 0 ) {
update_strapping_detail ( String . valueOf ( order ) , String . valueOf ( strapping_order_detail ) ) ;
}
}
catch ( Exception e ) {
@ -389,7 +423,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
break ;
case 2 :
break ;
case 3 :
case 4 :
//申请工单
if ( ! requireSucess ) {
if ( ready = = 1 & & order = = 0 & & order_detail = = 0 ) {
@ -403,7 +437,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
}
break ;
case 4 :
case 5 :
//申请工单明细
if ( ! requireSucess ) {
if ( ready = = 1 & & order ! = 0 ) {
@ -435,7 +469,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
last_detail_strapping_qty = detail_strapping_qty ;
last_detail_strapping_oneqty = detail_strapping_oneqty ;
last_detail_coating_qty = detail_coating_qty ;
last_labeling_order = labeling_order ;
last_labeling_order_detail = labeling_order_detail ;
last_detail_labeling_qualified_qty = detail_labeling_qualified_qty ;
last_detail_labeling_qty = detail_labeling_qty ;
last_line_speed = line_speed ;
@ -451,6 +485,45 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
last_coating_frequency = coating_frequency ;
}
public synchronized boolean update_strapping_detail ( String order , String order_detail ) throws Exception {
Date date = new Date ( ) ;
if ( date . getTime ( ) - this . detail_time_out < ( long ) this . detail_time_out ) {
log . trace ( "触发时间因为小于{}毫秒,而被无视" , this . detail_time_out ) ;
return false ;
} else {
this . detail_time = date ;
ProduceshiftorderdetailDto dto = produceshiftorderdetailService . findOrderDetailFromCache ( String . valueOf ( order ) , String . valueOf ( order_detail ) ) ;
if ( ObjectUtil . isEmpty ( dto ) ) {
return false ;
}
dto . setPresent_labeling_number ( String . valueOf ( detail_labeling_qty ) ) ;
dto . setQualified_lettering_number ( String . valueOf ( detail_labeling_qualified_qty ) ) ;
produceshiftorderdetailService . update ( dto ) ;
return true ;
}
}
public synchronized boolean update_labeling_detail ( String order , String order_detail ) throws Exception {
Date date = new Date ( ) ;
if ( date . getTime ( ) - this . detail_time_out < ( long ) this . detail_time_out ) {
log . trace ( "触发时间因为小于{}毫秒,而被无视" , this . detail_time_out ) ;
return false ;
} else {
this . detail_time = date ;
ProduceshiftorderdetailDto dto = produceshiftorderdetailService . findOrderDetailFromCache ( String . valueOf ( order ) , String . valueOf ( order_detail ) ) ;
if ( ObjectUtil . isEmpty ( dto ) ) {
return false ;
}
dto . setPresent_labeling_number ( String . valueOf ( detail_labeling_qty ) ) ;
dto . setQualified_lettering_number ( String . valueOf ( detail_labeling_qualified_qty ) ) ;
produceshiftorderdetailService . update ( dto ) ;
return true ;
}
}
public synchronized boolean update_detail ( String order , String order_detail ) throws Exception {
Date date = new Date ( ) ;
if ( date . getTime ( ) - this . detail_time_out < ( long ) this . detail_time_out ) {
@ -458,6 +531,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
return false ;
} else {
this . detail_time = date ;
ProduceshiftorderdetailDto dto = produceshiftorderdetailService . findOrderDetailFromCache ( String . valueOf ( order ) , String . valueOf ( order_detail ) ) ;
if ( ObjectUtil . isEmpty ( dto ) ) {
return false ;
@ -474,14 +548,14 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
dto . setPresent_sleeveing_number ( String . valueOf ( detail_risking_qty ) ) ;
//当前工单明细号套冒合格数
dto . setQualified_sleeveing_number ( String . valueOf ( detail_risking_qualified_qty ) ) ;
//当前捆扎包数
dto . setPresent_strap_pack_number ( String . valueOf ( detail_strapping_qty ) ) ;
//当前捆扎数
dto . setPresent_strap_number ( String . valueOf ( detail_strapping_oneqty ) ) ;
//当前工单明细号裹膜数
dto . setPresent_wraping_number ( String . valueOf ( detail_coating_qty ) ) ;
produceshiftorderdetailService . update ( dto ) ;
// //当前捆扎包数
// dto.setPresent_strap_pack_number(String.valueOf(detail_strapping_qty));
// //当前捆扎数
// dto.setPresent_strap_number(String.valueOf(detail_strapping_oneqty));
// //当前工单明细号裹膜数
// dto.setPresent_wraping_number(String.valueOf(detail_coating_qty));
return true ;
}
}
@ -537,36 +611,23 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
throw new BadRequestException ( "未找到可下发工单!" ) ;
}
String order = dto . getOrder_code ( ) ;
//是否刻字
String is_lettering = dto . getIs_lettering ( ) ;
//是否套冒
String is_risking = dto . getIs_risking ( ) ;
//是否捆扎
String is_strapping = dto . getIs_strapping ( ) ;
//是否裹膜
String is_coating = dto . getIs_coating ( ) ;
//是否贴标
String is_labeling = dto . getIs_labeling ( ) ;
//选择上料口
String feeding_mouth = dto . getFeeding_mouth ( ) ;
String outer_diameter = dto . getOuter_diameter ( ) ;
String wall_thickness = dto . getWall_thickness ( ) ;
String length = dto . getLength ( ) ;
String qty = dto . getQty ( ) ;
String jackup_num = dto . getJackup_num ( ) ;
logServer . deviceLogToacs ( this . device_code , "" , "" , "申请工单号成功,order:" + order ) ;
writing ( ItemProtocol . item_to_order , order ) ;
writing ( ItemProtocol . item_to_feeding_mouth , feeding_mouth ) ;
writing ( ItemProtocol . item_to_order_feeding_qty , qty ) ;
writing ( ItemProtocol . item_to_outer_diameter , outer_diameter ) ;
writing ( ItemProtocol . item_to_wall_thickness , wall_thickness ) ;
writing ( ItemProtocol . item_to_jackup_num , jackup_num ) ;
writing ( ItemProtocol . item_to_length , length ) ;
writing ( ItemProtocol . item_to_is_labeling , is_labeling ) ;
writing ( ItemProtocol . item_to_is_risking , is_risking ) ;
writing ( ItemProtocol . item_to_is_strapping , is_strapping ) ;
writing ( ItemProtocol . item_to_is_coating , is_coating ) ;
writing ( ItemProtocol . item_to_is_lettering , is_lettering ) ;
writing ( ItemProtocol . item_to_command , String . valueOf ( mode ) ) ;
dto . setOrder_status ( "02" ) ;
produceshiftorderService . autoupdate ( dto ) ;
@ -576,13 +637,14 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
public boolean apply_orderDetail ( int order ) throws Exception {
ProduceshiftorderdetailDto dto = produceshiftorderdetailService . apply_orderDetail ( String . valueOf ( order ) ) ;
ProduceshiftorderDto orderdto = produceshiftorderService . findOrderByOrderCodeFromCache ( String . valueOf ( order ) ) ;
if ( ObjectUtil . isEmpty ( dto ) ) {
logServer . deviceLogToacs ( this . device_code , "" , "" , "apply_orderDetail 未找到可下发工单明细!" ) ;
throw new BadRequestException ( "未找到可下发工单明细!" ) ;
}
String orderDetail = dto . getOrder_detail_code ( ) ;
//上料数量
String feeding_qty = dto . getFeeding _qty ( ) ;
String feeding_qty = dto . getOrder_detail _qty ( ) ;
//捆扎包数
String strap_pack_number = dto . getStrap_pack_number ( ) ;
//每捆数量
@ -593,6 +655,18 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
String str = dto . getLabeling_message ( ) ;
//判断是否最后一个客户
boolean last_detail = produceshiftorderdetailService . isLastOrderDetail ( String . valueOf ( order ) ) ;
//套冒颜色
String color = dto . getColor_type ( ) ;
//是否刻字
String is_lettering = orderdto . getIs_lettering ( ) ;
//是否套冒
String is_risking = orderdto . getIs_risking ( ) ;
//是否捆扎
String is_strapping = orderdto . getIs_strapping ( ) ;
//是否裹膜
String is_coating = orderdto . getIs_coating ( ) ;
//是否贴标
String is_labeling = orderdto . getIs_labeling ( ) ;
//下发激光刻字信息
//判断下发刻字成功
if ( ! send_letter_flag ) {
@ -613,10 +687,15 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
writing ( ItemProtocol . item_to_coating_qty , strap_pack_number ) ;
writing ( ItemProtocol . item_to_labeling_qty , strap_pack_number ) ;
writing ( ItemProtocol . item_to_lastone_strapping_qty , strap_tailint_number ) ;
writing ( ItemProtocol . item_to_is_labeling , is_labeling ) ;
writing ( ItemProtocol . item_to_is_risking , is_risking ) ;
writing ( ItemProtocol . item_to_is_strapping , is_strapping ) ;
writing ( ItemProtocol . item_to_is_coating , is_coating ) ;
writing ( ItemProtocol . item_to_is_lettering , is_lettering ) ;
writing ( ItemProtocol . item_to_color , color ) ;
writing ( ItemProtocol . item_to_command , String . valueOf ( mode ) ) ;
dto . setOrder_detail_status ( "01" ) ;
dto . setOrder_detail_status ( "02 " ) ;
produceshiftorderdetailService . update ( dto ) ;
send_letter_flag = false ;
send_letter_flag_back = false ;