|
@ -1,5 +1,6 @@ |
|
|
package org.nl.acs.device_driver.hailiang.hailiang_labeling; |
|
|
package org.nl.acs.device_driver.hailiang.hailiang_labeling; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import lombok.Data; |
|
|
import lombok.Data; |
|
@ -90,6 +91,7 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem |
|
|
if (mode != last_mode) { |
|
|
if (mode != last_mode) { |
|
|
logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode)); |
|
|
logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode)); |
|
|
logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode); |
|
|
logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode); |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess); |
|
|
this.setRequireSucess(false); |
|
|
this.setRequireSucess(false); |
|
|
} |
|
|
} |
|
|
if (move != last_move) { |
|
|
if (move != last_move) { |
|
@ -140,32 +142,71 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem |
|
|
break; |
|
|
break; |
|
|
case 3: |
|
|
case 3: |
|
|
//申请贴标
|
|
|
//申请贴标
|
|
|
if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ |
|
|
if(!requireSucess){ |
|
|
|
|
|
if(order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty); |
|
|
apply_labeling_message(String.valueOf(order),String.valueOf(order_detail),String.valueOf(detail_qty)); |
|
|
apply_labeling_message(String.valueOf(order),String.valueOf(order_detail),String.valueOf(detail_qty)); |
|
|
|
|
|
} else { |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
case 5: |
|
|
case 5: |
|
|
//贴标完成
|
|
|
//贴标完成
|
|
|
if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ |
|
|
if(!requireSucess){ |
|
|
|
|
|
if(order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标完成,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty); |
|
|
update_detail(String.valueOf(order),String.valueOf(order_detail),"01"); |
|
|
update_detail(String.valueOf(order),String.valueOf(order_detail),"01"); |
|
|
|
|
|
} else { |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标完成失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
case 6: |
|
|
case 6: |
|
|
//强制贴标完成
|
|
|
//强制贴标完成
|
|
|
if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0 ) { |
|
|
if(!requireSucess){ |
|
|
|
|
|
if( order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0 ) { |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请强制贴标完成,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty); |
|
|
update_detail(String.valueOf(order),String.valueOf(order_detail),"02"); |
|
|
update_detail(String.valueOf(order),String.valueOf(order_detail),"02"); |
|
|
|
|
|
} else { |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请强制贴标完成失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
//工单完成
|
|
|
//工单完成
|
|
|
case 7: |
|
|
case 7: |
|
|
if(!requireSucess && order > 0 && order_detail > 0 ) { |
|
|
if(!requireSucess){ |
|
|
|
|
|
if(order > 0 && order_detail > 0 ) { |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请工单完成,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail); |
|
|
finish_order(String.valueOf(order),String.valueOf(order_detail),"01"); |
|
|
finish_order(String.valueOf(order),String.valueOf(order_detail),"01"); |
|
|
|
|
|
} else { |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请工单完成失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
//工单强制完成
|
|
|
//工单强制完成
|
|
|
case 8: |
|
|
case 8: |
|
|
if(!requireSucess && order > 0 && order_detail > 0 ) { |
|
|
if(!requireSucess) { |
|
|
|
|
|
if(order > 0 && order_detail > 0 ) { |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请工单强制完成,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail); |
|
|
finish_order(String.valueOf(order),String.valueOf(order_detail),"02"); |
|
|
finish_order(String.valueOf(order),String.valueOf(order_detail),"02"); |
|
|
|
|
|
} else { |
|
|
|
|
|
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请工单强制完成失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" |
|
|
|
|
|
+order_detail); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
@ -188,12 +229,13 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem |
|
|
} else { |
|
|
} else { |
|
|
this.detail_time = date; |
|
|
this.detail_time = date; |
|
|
ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail)); |
|
|
ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail)); |
|
|
if(!StrUtil.equals(dto.getWraping_number(),String.valueOf(detail_qualified_qty)) ){ |
|
|
// if(!StrUtil.equals(dto.getWraping_number(),String.valueOf(detail_qualified_qty)) ){
|
|
|
logServer.deviceLogToacs(this.device_code,"","","工单明细贴标完成,贴标合格数量与订单数量不一致"); |
|
|
// logServer.deviceLogToacs(this.device_code,"","","工单明细贴标完成,贴标合格数量与订单数量不一致");
|
|
|
throw new BadRequestException("工单明细贴标完成,贴标合格数量与订单数量不一致!"); |
|
|
// throw new BadRequestException("工单明细贴标完成,贴标合格数量与订单数量不一致!");
|
|
|
} |
|
|
// }
|
|
|
dto.setLabeling_finished(status); |
|
|
dto.setLabeling_finished(status); |
|
|
dto.setLabeling_finish_time(date.toString()); |
|
|
String now = DateUtil.now(); |
|
|
|
|
|
dto.setLabeling_finish_time(now); |
|
|
produceshiftorderdetailService.update(dto); |
|
|
produceshiftorderdetailService.update(dto); |
|
|
writing(itemProtocol.item_to_command,String.valueOf(mode)); |
|
|
writing(itemProtocol.item_to_command,String.valueOf(mode)); |
|
|
requireSucess = true; |
|
|
requireSucess = true; |
|
|