From c46a895c46ed9c0b44a9cf181bcdaf31481cf217 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Tue, 7 Jun 2022 19:48:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HaiLiangCoatingDeviceDriver.java | 30 ++++++-- .../HaiLiangFeedingDeviceDriver.java | 37 +++++++--- .../HaiLiangFeedingTrunkDeviceDriver.java | 43 ++++++++--- .../HaiLiangLabelingDeviceDriver.java | 72 +++++++++++++++---- .../HaiLiangLetteringDeviceDriver.java | 31 ++++++-- .../HaiLiangRiskingDeviceDriver.java | 31 ++++++-- .../HaiLiangStrappingDeviceDriver.java | 29 ++++++-- .../ProduceshiftorderdetailService.java | 2 + .../impl/ProduceshiftorderServiceImpl.java | 30 +++++--- .../ProduceshiftorderdetailServiceImpl.java | 2 +- qd/src/views/acs/order/AddDialog.vue | 12 ++-- qd/src/views/acs/order/index.vue | 12 ++-- qd/src/views/acs/order/sorting/index.vue | 6 +- 13 files changed, 257 insertions(+), 80 deletions(-) diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_coating/HaiLiangCoatingDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_coating/HaiLiangCoatingDeviceDriver.java index d033d27..e00ecc0 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_coating/HaiLiangCoatingDeviceDriver.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_coating/HaiLiangCoatingDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.hailiang.hailiang_coating; +import cn.hutool.core.date.DateUtil; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -83,6 +84,7 @@ public class HaiLiangCoatingDeviceDriver extends AbstractOpcDeviceDriver impleme if (mode != last_mode) { logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode)); logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode); + logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess); this.setRequireSucess(false); } if (move != last_move) { @@ -133,14 +135,29 @@ public class HaiLiangCoatingDeviceDriver extends AbstractOpcDeviceDriver impleme break; case 4: //裹膜完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ - update_detail(String.valueOf(order),String.valueOf(order_detail),"01"); + 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"); + } 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; case 5: //强制裹膜完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0 ) { - update_detail(String.valueOf(order),String.valueOf(order_detail),"02"); + 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"); + } 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; } @@ -163,9 +180,12 @@ public class HaiLiangCoatingDeviceDriver extends AbstractOpcDeviceDriver impleme this.detail_time = date; ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail)); dto.setWraping_finished(status); - dto.setWraping_finish_time(date.toString()); + String now = DateUtil.now(); + dto.setWraping_finish_time(now); produceshiftorderdetailService.update(dto); writing(itemProtocol.item_to_command,String.valueOf(mode)); + requireSucess = true; + this.setRequireSucess(true); return true; } } diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java index 0534694..dc638c6 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.hailiang.hailiang_feeding; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -90,6 +91,7 @@ public class HaiLiangFeedingDeviceDriver extends AbstractOpcDeviceDriver impleme if (mode != last_mode) { logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode)); logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode); + logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess); this.setRequireSucess(false); } if (error != last_error) { @@ -148,15 +150,31 @@ public class HaiLiangFeedingDeviceDriver extends AbstractOpcDeviceDriver impleme break; case 4: //上料完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ - update_detail(String.valueOf(order),String.valueOf(order_detail),"01"); + 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"); + } 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; case 5: //强制上料完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0 ) { - update_detail(String.valueOf(order),String.valueOf(order_detail),"02"); + 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"); + } 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; } } @@ -181,12 +199,13 @@ public class HaiLiangFeedingDeviceDriver extends AbstractOpcDeviceDriver impleme } else { this.detail_time = date; ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail)); - if(!StrUtil.equals(dto.getOrder_detail_qty(),String.valueOf(detail_qualified_qty)) ){ - logServer.deviceLogToacs(this.device_code,"","","工单明细上料完成,上料合格数量与订单数量不一致"); - throw new BadRequestException("工单明细上料完成,上料合格数量与订单数量不一致!"); - } +// if(!StrUtil.equals(dto.getOrder_detail_qty(),String.valueOf(detail_qualified_qty)) ){ +// logServer.deviceLogToacs(this.device_code,"","","工单明细上料完成,上料合格数量与订单数量不一致"); +// throw new BadRequestException("工单明细上料完成,上料合格数量与订单数量不一致!"); +// } dto.setFeeding_finished(status); - dto.setFeeding_finish_time(date.toString()); + String now = DateUtil.now(); + dto.setFeeding_finish_time(now); produceshiftorderdetailService.update(dto); writing(itemProtocol.item_to_command,String.valueOf(mode)); requireSucess = true; diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java index 244b5a9..588a818 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java @@ -391,16 +391,27 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im break; case 3: //申请工单 - if(!requireSucess && ready == 1 && order ==0 && order_detail ==0 ){ - logServer.deviceLogToacs(this.device_code,"","","开始申请工单"); - apply_order(); + if(!requireSucess) { + if( ready == 1 && order ==0 && order_detail ==0 ){ + logServer.deviceLogToacs(this.device_code,"","",device_code+":开始申请工单,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" + +order_detail); + apply_order(); + } else { + logServer.deviceLogToacs(this.device_code,"","",device_code+":开始申请工单失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" + +order_detail); + } } + break; case 4: //申请工单明细 - if(!requireSucess && ready == 1 && order != 0 ) { - logServer.deviceLogToacs(this.device_code,"","","开始申请工单明细"); - apply_orderDetail(order); + if(!requireSucess) { + if( ready == 1 && order != 0 ) { + logServer.deviceLogToacs(this.device_code,"","",device_code+":开始申请工单明细,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",ready:"+ready); + apply_orderDetail(order); + } else { + logServer.deviceLogToacs(this.device_code,"","",device_code+":开始申请工单明细失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",ready:"+ready); + } } break; } @@ -505,14 +516,14 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im this.detail_time= date; ProduceshiftorderDto dto = produceshiftorderService.findOrderByOrderCodeFromCache(String.valueOf(order)); if(ObjectUtil.isEmpty(dto)){ - logServer.deviceLogToacs(this.device_code,"","","修改工单状态失败,order:"+order); + logServer.deviceLogToacs(this.device_code,"","","update_order_status 修改工单状态失败,order:"+order); return false; } //02是已下发 if(!StrUtil.equals(dto.getOrder_status(),status) && StrUtil.equals(dto.getOrder_status(),"02") ){ dto.setOrder_status("03"); produceshiftorderService.autoupdate(dto); - logServer.deviceLogToacs(this.device_code,"","","修改工单状态成功,order:"+order); + logServer.deviceLogToacs(this.device_code,"","","update_order_status 修改工单状态成功,order:"+order); } return true; } @@ -522,7 +533,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im public boolean apply_order() throws Exception { ProduceshiftorderDto dto = produceshiftorderService.apply_order(); if(ObjectUtil.isEmpty(dto)){ - logServer.deviceLogToacs(this.device_code,"","","未找到"); + logServer.deviceLogToacs(this.device_code,"","","apply_order 未找到可下发工单!"); throw new BadRequestException("未找到可下发工单!"); } String order = dto.getOrder_code(); @@ -566,12 +577,19 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im public boolean apply_orderDetail(int order) throws Exception { ProduceshiftorderdetailDto dto = produceshiftorderdetailService.apply_orderDetail(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 strap_pack_number = dto.getStrap_pack_number(); + //每捆数量 String strap_number = dto.getStrap_number(); + //尾料数量 + String strap_tailint_number = dto.getStrap_tailint_number(); + //贴标信息 String str = dto.getLabeling_message(); //判断是否最后一个客户 boolean last_detail = produceshiftorderdetailService.isLastOrderDetail(String.valueOf(order)); @@ -594,12 +612,17 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im writing(ItemProtocol.item_to_one_strapping_qty,strap_number); 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_command,String.valueOf(mode)); - dto.setOrder_detail_status("02"); + + dto.setOrder_detail_status("01"); produceshiftorderdetailService.update(dto); send_letter_flag = false; send_letter_flag_back = false; requireSucess = true; + } else { + logServer.deviceLogToacs(this.device_code,"","","申请工单明细等待,order:"+order+",orderdetail:"+orderDetail); } return true; diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java index b5689ab..b414481 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java @@ -1,5 +1,6 @@ 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.StrUtil; import lombok.Data; @@ -90,6 +91,7 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem if (mode != last_mode) { logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode)); logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode); + logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess); this.setRequireSucess(false); } if (move != last_move) { @@ -140,32 +142,71 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem break; case 3: //申请贴标 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ - apply_labeling_message(String.valueOf(order),String.valueOf(order_detail),String.valueOf(detail_qty)); + 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)); + } 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; case 5: //贴标完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ - update_detail(String.valueOf(order),String.valueOf(order_detail),"01"); + 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"); + } 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; case 6: //强制贴标完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0 ) { - update_detail(String.valueOf(order),String.valueOf(order_detail),"02"); + 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"); + } 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; //工单完成 case 7: - if(!requireSucess && order > 0 && order_detail > 0 ) { - finish_order(String.valueOf(order),String.valueOf(order_detail),"01"); + 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"); + } else { + logServer.deviceLogToacs(this.device_code,"","",device_code+":申请工单完成失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" + +order_detail); + } } + break; //工单强制完成 case 8: - if(!requireSucess && order > 0 && order_detail > 0 ) { - finish_order(String.valueOf(order),String.valueOf(order_detail),"02"); + 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"); + } else { + logServer.deviceLogToacs(this.device_code,"","",device_code+":申请工单强制完成失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:" + +order_detail); + } } break; } @@ -188,12 +229,13 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem } else { this.detail_time = date; ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail)); - if(!StrUtil.equals(dto.getWraping_number(),String.valueOf(detail_qualified_qty)) ){ - logServer.deviceLogToacs(this.device_code,"","","工单明细贴标完成,贴标合格数量与订单数量不一致"); - throw new BadRequestException("工单明细贴标完成,贴标合格数量与订单数量不一致!"); - } +// if(!StrUtil.equals(dto.getWraping_number(),String.valueOf(detail_qualified_qty)) ){ +// logServer.deviceLogToacs(this.device_code,"","","工单明细贴标完成,贴标合格数量与订单数量不一致"); +// throw new BadRequestException("工单明细贴标完成,贴标合格数量与订单数量不一致!"); +// } dto.setLabeling_finished(status); - dto.setLabeling_finish_time(date.toString()); + String now = DateUtil.now(); + dto.setLabeling_finish_time(now); produceshiftorderdetailService.update(dto); writing(itemProtocol.item_to_command,String.valueOf(mode)); requireSucess = true; diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java index f4c6db1..31fa65c 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.hailiang.hailiang_lettering; +import cn.hutool.core.date.DateUtil; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -82,6 +83,7 @@ public class HaiLiangLetteringDeviceDriver extends AbstractOpcDeviceDriver imple if (mode != last_mode) { logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode)); logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode); + logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess); this.setRequireSucess(false); } if (move != last_move) { @@ -134,14 +136,29 @@ public class HaiLiangLetteringDeviceDriver extends AbstractOpcDeviceDriver imple case 4: //刻字完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ - update_detail(String.valueOf(order),String.valueOf(order_detail),"01"); + 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"); + } 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; case 5: //强制刻字完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0 ) { - update_detail(String.valueOf(order),String.valueOf(order_detail),"02"); + 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"); + } 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; } @@ -164,10 +181,12 @@ public class HaiLiangLetteringDeviceDriver extends AbstractOpcDeviceDriver imple } else { this.detail_time = date; ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail)); - dto.setLabeling_finished(status); - dto.setLabeling_finish_time(date.toString()); + dto.setLettering_finished(status); + String now = DateUtil.now(); + dto.setLabeling_finish_time(now); produceshiftorderdetailService.update(dto); writing(itemProtocol.item_to_command,String.valueOf(mode)); + requireSucess = true; return true; } } diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/HaiLiangRiskingDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/HaiLiangRiskingDeviceDriver.java index ccd1a23..a6f576e 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/HaiLiangRiskingDeviceDriver.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/HaiLiangRiskingDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.hailiang.hailiang_risking; +import cn.hutool.core.date.DateUtil; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -83,6 +84,7 @@ public class HaiLiangRiskingDeviceDriver extends AbstractOpcDeviceDriver impleme if (mode != last_mode) { logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode)); logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode); + logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess); this.setRequireSucess(false); } if (move != last_move) { @@ -133,14 +135,29 @@ public class HaiLiangRiskingDeviceDriver extends AbstractOpcDeviceDriver impleme break; case 4: //套冒完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ - update_detail(String.valueOf(order),String.valueOf(order_detail),"01"); + 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"); + } 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; case 5: - //强制上料完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0 ) { - update_detail(String.valueOf(order),String.valueOf(order_detail),"02"); + //强制套冒完成 + 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"); + } 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; } @@ -164,9 +181,11 @@ public class HaiLiangRiskingDeviceDriver extends AbstractOpcDeviceDriver impleme this.detail_time = date; ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail)); dto.setSleeveing_finished(status); - dto.setSleeveing_finish_time(date.toString()); + String now = DateUtil.now(); + dto.setSleeveing_finish_time(now); produceshiftorderdetailService.update(dto); writing(itemProtocol.item_to_command,String.valueOf(mode)); + requireSucess = true; return true; } } diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java index 2d73eac..9639d7c 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.hailiang.hailiang_strapping; +import cn.hutool.core.date.DateUtil; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -88,6 +89,7 @@ public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver imple if (mode != last_mode) { logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode)); logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode); + logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess); this.setRequireSucess(false); } if (move != last_move) { @@ -146,14 +148,29 @@ public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver imple break; case 4: //捆扎完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){ - update_detail(String.valueOf(order),String.valueOf(order_detail),"01"); + 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"); + } 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; case 5: //强制捆扎完成 - if(!requireSucess && order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0 ) { - update_detail(String.valueOf(order),String.valueOf(order_detail),"02"); + 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"); + } 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; } @@ -178,9 +195,11 @@ public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver imple this.detail_time = date; ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail)); dto.setStrap_finished(status); - dto.setStrap_finish_time(date.toString()); + String now = DateUtil.now(); + dto.setStrap_finish_time(now); produceshiftorderdetailService.update(dto); writing(itemProtocol.item_to_command,String.valueOf(mode)); + requireSucess = true; return true; } } diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderdetailService.java b/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderdetailService.java index 58f77ca..bfed442 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderdetailService.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderdetailService.java @@ -86,4 +86,6 @@ public interface ProduceshiftorderdetailService { Boolean isLastOrderDetail(String order); + void reload(); + } diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java index 4d39f07..e2a2e1b 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java @@ -64,6 +64,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A public synchronized void reload() { this.order = this.queryAllOrder("(order_status !='07' and order_status !='08' and order_status !='09') and is_deleted =0"); + produceshiftorderdetailService.reload(); } @Override @@ -258,6 +259,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A String strap_number = detaildto.getStrap_number(); //尾料数量 String strap_tailint_number = String.valueOf(Integer.parseInt(detail_qty)%Integer.parseInt(strap_number)); + //捆扎包数 + Double pack =Math.ceil((double)Integer.parseInt(detail_qty)/Integer.parseInt(strap_number)); detaildto.setOrder_id(order_id); detaildto.setOrder_code(order_code); detaildto.setOrder_detail_status("00"); @@ -278,6 +281,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A detaildto.setLettering_message2(lettering_message2); detaildto.setLabeling_template(labeling_template); detaildto.setStrap_number(strap_number); + detaildto.setStrap_pack_number(String.valueOf(pack.intValue())); detaildto.setStrap_tailint_number(strap_tailint_number); WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorderdetail"); JSONObject json = (JSONObject) JSONObject.toJSON(detaildto); @@ -292,9 +296,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A public void update(ProduceshiftorderDto dto) { ProduceshiftorderDto entity = this.findById(dto.getOrder_id()); if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); - if(!StrUtil.equals(entity.getOrder_status(),"00")){ - throw new BadRequestException("单据状态非就绪,修改失败!"); - } String currentUsername = SecurityUtils.getCurrentUsername(); String now = DateUtil.now(); dto.setUpdate_time(now); @@ -311,7 +312,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A iterator.remove(); } } - if (!StrUtil.equals(dto.getOrder_id(), "07") || !StrUtil.equals(dto.getOrder_id(), "08")) { + if (!StrUtil.equals(dto.getOrder_id(), "07") && !StrUtil.equals(dto.getOrder_id(), "08") && !StrUtil.equals(dto.getOrder_id(), "09")) { order.add(dto); } } @@ -492,6 +493,17 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A entity.setOrder_status("01"); JSONObject json= (JSONObject) JSONObject.toJSON(entity); wo.update(json); + + Iterator iterator = order.iterator(); + while (iterator.hasNext()) { + ProduceshiftorderDto produceshiftorderDto = iterator.next(); + if (produceshiftorderDto.getOrder_id().equals(entity.getOrder_id())) { + iterator.remove(); + } + } + if (!StrUtil.equals(entity.getOrder_id(), "07") && !StrUtil.equals(entity.getOrder_id(), "08") && !StrUtil.equals(entity.getOrder_id(), "09")) { + order.add(entity); + } } @Override @@ -716,11 +728,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A } @Override - public ProduceshiftorderDto findOrderByOrderCodeFromCache(String order_id) { + public ProduceshiftorderDto findOrderByOrderCodeFromCache(String order_code) { Iterator var3 = order.iterator(); while (var3.hasNext()) { ProduceshiftorderDto oneorder = (ProduceshiftorderDto) var3.next(); - if (StrUtil.equals(oneorder.getOrder_id(), order_id)) { + if (StrUtil.equals(oneorder.getOrder_code(), order_code)) { return oneorder; } } @@ -728,11 +740,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A } @Override - public ProduceshiftorderDto findOrderByOrderIdFromCache(String order_code) { + public ProduceshiftorderDto findOrderByOrderIdFromCache(String order_id) { Iterator var3 = order.iterator(); while (var3.hasNext()) { ProduceshiftorderDto oneorder = (ProduceshiftorderDto) var3.next(); - if (StrUtil.equals(oneorder.getOrder_code(), order_code)) { + if (StrUtil.equals(oneorder.getOrder_id(), order_id)) { return oneorder; } } @@ -770,7 +782,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A @Override public Map querySorting(Map whereJson, Pageable page) { WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder"); - String where = "1=1 and (order_status !='00' and order_status !='07' and order_status !='08' ) and is_deleted= '0'"; + String where = "1=1 and (order_status !='00' and order_status !='07' and order_status !='08' and order_status !='09' ) and is_deleted= '0'"; ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "order_id desc"); final JSONObject json = rb.pageResult(); JSONArray newja = new JSONArray(); diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java index d0db619..6cebace 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java @@ -280,7 +280,7 @@ public class ProduceshiftorderdetailServiceImpl implements Produceshiftorderdeta public ProduceshiftorderdetailDto apply_orderDetail(String order) { ProduceshiftorderdetailDto order_detail = this.findOrderDetailByOrderFromCache(order,"00"); if(ObjectUtil.isEmpty(order_detail)){ - throw new BadRequestException("未找到处于就绪状态的工单明细!"); + return null; } return order_detail; } diff --git a/qd/src/views/acs/order/AddDialog.vue b/qd/src/views/acs/order/AddDialog.vue index ea4e0db..695413e 100644 --- a/qd/src/views/acs/order/AddDialog.vue +++ b/qd/src/views/acs/order/AddDialog.vue @@ -157,12 +157,12 @@ - - - + + + + + + @@ -247,8 +249,8 @@ export default { mounted() { // 定时器 const timer = setInterval(() => { - // this.crud.toQueryNoLoading() - }, 1000) + this.crud.toQueryNoLoading() + }, 5000) // 销毁定时器 this.$once('hook:beforeDestroy', () => { clearInterval(timer)