更新
This commit is contained in:
@@ -8,6 +8,10 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
@@ -45,6 +49,9 @@ public class HaiLiangCoatingDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
String device_code;
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -92,6 +99,13 @@ public class HaiLiangCoatingDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号move:" + last_move + "->" + move);
|
||||
}
|
||||
if (error != last_error) {
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
@@ -43,7 +47,8 @@ public class HaiLiangFeedingDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
@Autowired
|
||||
ProduceshiftorderdetailService produceshiftorderdetailService = SpringContextHolder.getBean(ProduceshiftorderdetailService.class);
|
||||
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
@@ -95,6 +100,13 @@ public class HaiLiangFeedingDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
if (error != last_error) {
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,10 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
@@ -41,6 +45,8 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
@@ -211,6 +217,13 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
|
||||
if(error != last_error)
|
||||
{
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
@@ -50,6 +54,9 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
// @Autowired
|
||||
// LabelingTemplateService labelingTemplateService = SpringContextHolder.getBean(LabelingTemplateService.class);
|
||||
|
||||
@@ -80,7 +87,6 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
private int detail_time_out = 3000;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
@@ -95,38 +101,45 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
one_qty = this.itemProtocol.getOne_qty();
|
||||
|
||||
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);
|
||||
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) {
|
||||
logServer.deviceLog(this.device_code,"move" ,String.valueOf(move));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号move:" + last_move + "->" + move);
|
||||
logServer.deviceLog(this.device_code, "move", String.valueOf(move));
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||
}
|
||||
if (error != last_error) {
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceLog(this.device_code, "error", String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
||||
}
|
||||
if (order != last_order) {
|
||||
logServer.deviceLog(this.device_code,"order" ,String.valueOf(order));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号order:" + last_order + "->" + order);
|
||||
logServer.deviceLog(this.device_code, "order", String.valueOf(order));
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "信号order:" + last_order + "->" + order);
|
||||
}
|
||||
if (order_detail != last_order_detail) {
|
||||
logServer.deviceLog(this.device_code,"order_detail" ,String.valueOf(order_detail));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号order_detail:" + last_order_detail + "->" + order_detail);
|
||||
logServer.deviceLog(this.device_code, "order_detail", String.valueOf(order_detail));
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "信号order_detail:" + last_order_detail + "->" + order_detail);
|
||||
}
|
||||
if (detail_qty != last_detail_qty) {
|
||||
logServer.deviceLog(this.device_code,"detail_qty" ,String.valueOf(detail_qty));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号detail_qty:" + last_detail_qty + "->" + detail_qty);
|
||||
logServer.deviceLog(this.device_code, "detail_qty", String.valueOf(detail_qty));
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "信号detail_qty:" + last_detail_qty + "->" + detail_qty);
|
||||
}
|
||||
if (detail_qualified_qty != last_detail_qualified_qty) {
|
||||
logServer.deviceLog(this.device_code,"detail_qualified_qty" ,String.valueOf(detail_qualified_qty));
|
||||
logServer.deviceLogToacs(this.device_code,"","","detail_qualified_qty:" + last_detail_qualified_qty + "->" + detail_qualified_qty);
|
||||
logServer.deviceLog(this.device_code, "detail_qualified_qty", String.valueOf(detail_qualified_qty));
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "detail_qualified_qty:" + last_detail_qualified_qty + "->" + detail_qualified_qty);
|
||||
}
|
||||
if (one_qty != last_one_qty) {
|
||||
logServer.deviceLog(this.device_code,"finish_status" ,String.valueOf(one_qty));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号one_qty:" + last_one_qty + "->" + one_qty);
|
||||
logServer.deviceLog(this.device_code, "finish_status", String.valueOf(one_qty));
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "信号one_qty:" + last_one_qty + "->" + one_qty);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
@@ -153,71 +166,71 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
break;
|
||||
case 4:
|
||||
//申请贴标
|
||||
if(!requireSucess){
|
||||
if(order > 0 && order_detail > 0 && detail_qty>0 ){
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:"
|
||||
+order_detail+",detail_qty:"+detail_qty);
|
||||
logServer.deviceLogToacs(this.device_code,"","","申请贴标");
|
||||
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) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":申请贴标,mode:" + mode + ",requireSucess:" + requireSucess + ",order:" + order + ",order_detail:"
|
||||
+ order_detail + ",detail_qty:" + detail_qty);
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "申请贴标");
|
||||
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);
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":申请贴标失败,mode:" + mode + ",requireSucess:" + requireSucess + ",order:" + order + ",order_detail:"
|
||||
+ order_detail + ",detail_qty:" + detail_qty);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 5:
|
||||
//贴标完成
|
||||
if(!requireSucess){
|
||||
if(order > 0 && order_detail > 0 && detail_qty>0 ){
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标完成,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:"
|
||||
+order_detail+",detail_qty:"+detail_qty);
|
||||
update_detail(String.valueOf(order),String.valueOf(order_detail),"01");
|
||||
if (!requireSucess) {
|
||||
if (order > 0 && order_detail > 0 && detail_qty > 0) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":申请贴标完成,mode:" + mode + ",requireSucess:" + requireSucess + ",order:" + order + ",order_detail:"
|
||||
+ order_detail + ",detail_qty:" + detail_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);
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":申请贴标完成失败,mode:" + mode + ",requireSucess:" + requireSucess + ",order:" + order + ",order_detail:"
|
||||
+ order_detail + ",detail_qty:" + detail_qty);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 6:
|
||||
//强制贴标完成
|
||||
if(!requireSucess){
|
||||
if( order > 0 && order_detail > 0 && detail_qty>0) {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请强制贴标完成,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:"
|
||||
+order_detail+",detail_qty:"+detail_qty);
|
||||
update_detail(String.valueOf(order),String.valueOf(order_detail),"02");
|
||||
if (!requireSucess) {
|
||||
if (order > 0 && order_detail > 0 && detail_qty > 0) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":申请强制贴标完成,mode:" + mode + ",requireSucess:" + requireSucess + ",order:" + order + ",order_detail:"
|
||||
+ order_detail + ",detail_qty:" + detail_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);
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":申请强制贴标完成失败,mode:" + mode + ",requireSucess:" + requireSucess + ",order:" + order + ",order_detail:"
|
||||
+ order_detail + ",detail_qty:" + detail_qty);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
//工单完成
|
||||
//工单完成
|
||||
case 7:
|
||||
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");
|
||||
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);
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":申请工单完成失败,mode:" + mode + ",requireSucess:" + requireSucess + ",order:" + order + ",order_detail:"
|
||||
+ order_detail);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
//工单强制完成
|
||||
//工单强制完成
|
||||
case 8:
|
||||
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");
|
||||
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);
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":申请工单强制完成失败,mode:" + mode + ",requireSucess:" + requireSucess + ",order:" + order + ",order_detail:"
|
||||
+ order_detail);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -236,7 +249,7 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
}
|
||||
|
||||
|
||||
public synchronized boolean update_detail(String order, String order_detail,String status) {
|
||||
public synchronized boolean update_detail(String order, String order_detail, String status) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.detail_time_out < (long) this.detail_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.detail_time_out);
|
||||
@@ -253,37 +266,37 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
dto.setLabeling_finish_time(now);
|
||||
dto.setOrder_detail_status("08");
|
||||
produceshiftorderdetailService.update(dto);
|
||||
writing(itemProtocol.item_to_command,String.valueOf(mode));
|
||||
writing(itemProtocol.item_to_command, String.valueOf(mode));
|
||||
requireSucess = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean finish_order(String order, String order_detail,String status) {
|
||||
public synchronized boolean finish_order(String order, String order_detail, String status) {
|
||||
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 {
|
||||
ProduceshiftorderDto dto = produceshiftorderService.findOrderByOrderCodeFromCache(String.valueOf(order));
|
||||
if(ObjectUtil.isEmpty(dto)){
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
return false;
|
||||
}
|
||||
if(!StrUtil.equals(dto.getOrder_status(),status)){
|
||||
if(StrUtil.equals(status,"1")){
|
||||
if (!StrUtil.equals(dto.getOrder_status(), status)) {
|
||||
if (StrUtil.equals(status, "1")) {
|
||||
dto.setOrder_status("07");
|
||||
} else {
|
||||
dto.setOrder_status("08");
|
||||
}
|
||||
produceshiftorderService.autoupdate(dto);
|
||||
}
|
||||
writing(itemProtocol.item_to_command,String.valueOf(mode));
|
||||
writing(itemProtocol.item_to_command, String.valueOf(mode));
|
||||
requireSucess = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean apply_labeling_message(String order, String order_detail,String qty) {
|
||||
public synchronized boolean apply_labeling_message(String order, String order_detail, String qty) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.detail_time_out < (long) this.detail_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.detail_time_out);
|
||||
@@ -292,7 +305,7 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
this.detail_time = date;
|
||||
ProduceshiftorderDto dto = produceshiftorderService.findOrderByOrderCodeFromCache(String.valueOf(order));
|
||||
ProduceshiftorderdetailDto detaildto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail));
|
||||
if(ObjectUtil.isEmpty(dto)){
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
throw new BadRequestException("未找到可下发工单明细!");
|
||||
}
|
||||
Boolean flag = false;
|
||||
@@ -301,34 +314,34 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
|
||||
//labelingTemplateService.printMessage(dto,qty);
|
||||
String path = jsonStor.getString("path");
|
||||
String pathName = "E:\\work\\"+jsonStor.getString("name")+ jsonStor.getString("storage_id") + ".xlsx";
|
||||
String pathName = "E:\\work\\" + jsonStor.getString("name") + jsonStor.getString("storage_id") + ".xlsx";
|
||||
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("order_id",dto.getOrder_id());
|
||||
jo.put("template_id",detaildto.getTemplate_id());
|
||||
jo.put("path",path);
|
||||
jo.put("url",pathName);
|
||||
jo.put("alloy",dto.getAlloy());
|
||||
jo.put("temper",dto.getTemper());
|
||||
jo.put("material_spec",dto.getMaterial_spec());
|
||||
jo.put("number",String.valueOf(one_qty));
|
||||
jo.put("outer_diameter",dto.getOuter_diameter());
|
||||
jo.put("standard",detaildto.getStandard());
|
||||
jo.put("batch",detaildto.getBatch());
|
||||
jo.put("prod_date",detaildto.getProd_date());
|
||||
jo.put("present_strap_pack_number",String.valueOf(labeling_index));
|
||||
jo.put("inspector",detaildto.getInspector());
|
||||
jo.put("mg_weight",detaildto.getMg_weight());
|
||||
jo.put("order_id", dto.getOrder_id());
|
||||
jo.put("template_id", detaildto.getTemplate_id());
|
||||
jo.put("path", path);
|
||||
jo.put("url", pathName);
|
||||
jo.put("alloy", dto.getAlloy());
|
||||
jo.put("temper", dto.getTemper());
|
||||
jo.put("material_spec", dto.getMaterial_spec());
|
||||
jo.put("number", String.valueOf(one_qty));
|
||||
jo.put("outer_diameter", dto.getOuter_diameter());
|
||||
jo.put("standard", detaildto.getStandard());
|
||||
jo.put("batch", detaildto.getBatch());
|
||||
jo.put("prod_date", detaildto.getProd_date());
|
||||
jo.put("present_strap_pack_number", String.valueOf(labeling_index));
|
||||
jo.put("inspector", detaildto.getInspector());
|
||||
jo.put("mg_weight", detaildto.getMg_weight());
|
||||
//打印纸张大小
|
||||
jo.put("page_length","600");
|
||||
jo.put("page_height","400");
|
||||
logServer.deviceLogToacs(this.device_code,"","","申请贴标接口信息:"+jo.toString());
|
||||
jo.put("page_length", "600");
|
||||
jo.put("page_height", "400");
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "申请贴标接口信息:" + jo.toString());
|
||||
|
||||
flag = produceshiftorderService.print(jo);
|
||||
if(flag){
|
||||
logServer.deviceLogToacs(this.device_code,"","","下发贴标信息成功");
|
||||
writing(itemProtocol.item_to_command,String.valueOf(mode));
|
||||
if (flag) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "下发贴标信息成功");
|
||||
writing(itemProtocol.item_to_command, String.valueOf(mode));
|
||||
requireSucess = true;
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -8,6 +8,10 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
@@ -38,6 +42,8 @@ public class HaiLiangLetteringDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
String device_code;
|
||||
int mode = 0;
|
||||
@@ -91,6 +97,13 @@ public class HaiLiangLetteringDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号move:" + last_move + "->" + move);
|
||||
}
|
||||
if (error != last_error) {
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
@@ -39,7 +43,8 @@ public class HaiLiangRiskingDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
String device_code;
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -92,6 +97,13 @@ public class HaiLiangRiskingDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号move:" + last_move + "->" + move);
|
||||
}
|
||||
if (error != last_error) {
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
@@ -43,7 +47,8 @@ public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
String device_code;
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -101,6 +106,13 @@ public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号move:" + last_move + "->" + move);
|
||||
}
|
||||
if (error != last_error) {
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.nl.acs.history;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import net.dreamlu.mica.core.result.R;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.nl.modules.system.domain.Dict;
|
||||
import org.nl.modules.system.service.DictDetailService;
|
||||
import org.nl.modules.system.service.DictService;
|
||||
import org.nl.modules.system.service.dto.DictDetailDto;
|
||||
import org.nl.modules.system.service.dto.DictDto;
|
||||
import org.nl.modules.system.service.dto.DictQueryCriteria;
|
||||
import org.nl.modules.system.service.impl.DictDetailServiceImpl;
|
||||
import org.nl.modules.system.service.impl.DictServiceImpl;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @author: geng by
|
||||
* @createDate: 2023/3/15
|
||||
*/
|
||||
public class ErrorUtil {
|
||||
|
||||
public static ConcurrentHashMap<String, List<DictDetailDto>> dictMap = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
public static String getDictDetail(String type, String error_code) {
|
||||
getDict();
|
||||
List<DictDetailDto> dictDetailDtos = dictMap.get(type);
|
||||
String detail = null;
|
||||
if (ObjectUtil.isNotEmpty(dictDetailDtos)) {
|
||||
for (int i = 0; i < dictDetailDtos.size(); i++) {
|
||||
DictDetailDto dictDetailDto = dictDetailDtos.get(i);
|
||||
String value = dictDetailDto.getValue();
|
||||
String label = dictDetailDto.getLabel();
|
||||
if (StrUtil.equals(value, error_code)) {
|
||||
detail = label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return detail == null ? "字典表未配置对应的报警信息" : detail;
|
||||
}
|
||||
|
||||
|
||||
public static void getDict() {
|
||||
if (ObjectUtil.isEmpty(dictMap)) {
|
||||
DictDetailService dictDetailService = SpringContextHolder.getBean(DictDetailServiceImpl.class);
|
||||
DictService dictService = SpringContextHolder.getBean(DictServiceImpl.class);
|
||||
List<Dict> dictDtos = dictService.queryAll();
|
||||
for (int i = 0; i < dictDtos.size(); i++) {
|
||||
Dict dictDto = dictDtos.get(i);
|
||||
dictMap.put(dictDto.getName(), getDict(dictDto.getName(), t -> {
|
||||
return dictDetailService.getDictByName(t);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<DictDetailDto> getDict(String name, Function<String, List<DictDetailDto>> f) {
|
||||
return f.apply(name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
package org.nl.acs.history.rest;
|
||||
|
||||
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author gengby
|
||||
* @date 2023-03-15
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "设备报警记录管理")
|
||||
@RequestMapping("/api/deviceErrorLog")
|
||||
@Slf4j
|
||||
public class DeviceErrorLogController {
|
||||
|
||||
private final DeviceErrorLogService acsDeviceErrorLogService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备报警记录")
|
||||
@ApiOperation("查询设备报警记录")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(acsDeviceErrorLogService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备报警记录")
|
||||
@ApiOperation("新增设备报警记录")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DeviceErrorLogDto dto){
|
||||
acsDeviceErrorLogService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备报警记录")
|
||||
@ApiOperation("修改设备报警记录")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody DeviceErrorLogDto dto){
|
||||
acsDeviceErrorLogService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除设备报警记录")
|
||||
@ApiOperation("删除设备报警记录")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
acsDeviceErrorLogService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出设备报警记录")
|
||||
@ApiOperation("导出设备报警记录")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:list')")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
acsDeviceErrorLogService.download(acsDeviceErrorLogService.queryAll(whereJson), response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
package org.nl.acs.history.service;
|
||||
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author gengby
|
||||
* @date 2023-03-15
|
||||
**/
|
||||
public interface DeviceErrorLogService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<AcsDeviceErrorLogDto>
|
||||
*/
|
||||
List<DeviceErrorLogDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param error_log_uuid ID
|
||||
* @return AcsDeviceErrorLog
|
||||
*/
|
||||
DeviceErrorLogDto findById(String error_log_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return AcsDeviceErrorLog
|
||||
*/
|
||||
DeviceErrorLogDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(DeviceErrorLogDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(DeviceErrorLogDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<DeviceErrorLogDto> dtos, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.acs.history.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author gengby
|
||||
* @date 2023-03-15
|
||||
**/
|
||||
@Data
|
||||
public class DeviceErrorLogDto implements Serializable {
|
||||
|
||||
/** 报警日志标识 */
|
||||
private String error_log_uuid;
|
||||
|
||||
/** 设备编码 */
|
||||
private String device_code;
|
||||
|
||||
/** 报警编码 */
|
||||
private String error_code;
|
||||
|
||||
/** 报警信息 */
|
||||
private String error_info;
|
||||
|
||||
/** 报警时间 */
|
||||
private String error_time;
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
|
||||
package org.nl.acs.history.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.acs.device.service.dto.AcsDeviceErpmappingDto;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author gengby
|
||||
* @description 服务实现
|
||||
* @date 2023-03-15
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DeviceErrorLogServiceImpl implements DeviceErrorLogService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String error_code = MapUtil.getStr(whereJson, "error_code");
|
||||
String error_info = MapUtil.getStr(whereJson, "error_info");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
String where = "1 = 1 ";
|
||||
if (StrUtil.isNotEmpty(device_code)) {
|
||||
where += "and device_code like '%" + device_code + "%'";
|
||||
}
|
||||
if (StrUtil.isNotEmpty(error_code)) {
|
||||
where += "and error_code like '%" + error_code + "%'";
|
||||
}
|
||||
if (StrUtil.isNotEmpty(error_info)) {
|
||||
where += "and error_info like '%" + error_info + "%'";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "error_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceErrorLogDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<DeviceErrorLogDto> list = arr.toJavaList(DeviceErrorLogDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceErrorLogDto findById(String error_log_uuid) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONObject json = wo.query("error_log_uuid ='" + error_log_uuid + "'").uniqueResult(0);
|
||||
final DeviceErrorLogDto obj = (DeviceErrorLogDto) JSONObject.toJavaObject(json, DeviceErrorLogDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceErrorLogDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final DeviceErrorLogDto obj = (DeviceErrorLogDto) JSONObject.toJavaObject(json, DeviceErrorLogDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DeviceErrorLogDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setError_log_uuid(IdUtil.simpleUUID());
|
||||
dto.setDevice_code(dto.getDevice_code());
|
||||
dto.setError_code(dto.getError_code());
|
||||
dto.setError_info(dto.getError_info());
|
||||
dto.setError_time(now);
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DeviceErrorLogDto dto) {
|
||||
DeviceErrorLogDto entity = this.findById(dto.getError_log_uuid());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
for (String error_log_uuid : ids) {
|
||||
wo.delete("error_log_uuid = '" + error_log_uuid + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<DeviceErrorLogDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (DeviceErrorLogDto acsDeviceErrorLog : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("设备编码", acsDeviceErrorLog.getDevice_code());
|
||||
map.put("报警编码", acsDeviceErrorLog.getError_code());
|
||||
map.put("报警信息", acsDeviceErrorLog.getError_info());
|
||||
map.put("报警时间", acsDeviceErrorLog.getError_time());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -9,11 +9,11 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.hand.service.HandService;
|
||||
import org.nl.wql.core.content.HttpContext;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@@ -39,6 +39,7 @@ public class HandController {
|
||||
return new ResponseEntity<>(handService.handlogin(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询工单及明细
|
||||
*
|
||||
@@ -129,4 +130,14 @@ public class HandController {
|
||||
public ResponseEntity<JSONObject> queryDeviceInfo() {
|
||||
return new ResponseEntity<>(handService.queryDeviceInfo(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryDeviceErrorInfo")
|
||||
@Log("查询设备报警记录")
|
||||
@ApiOperation("查询设备报警记录")
|
||||
public ResponseEntity<Object> queryDeviceErrorInfo(@RequestBody JSONObject whereJson) {
|
||||
HttpContext ctx = new HttpContext("11");
|
||||
ctx.setPage((String) (whereJson.get("page")));
|
||||
ctx.setRows((String) (whereJson.get("size")));
|
||||
return new ResponseEntity<>(handService.queryDeviceErrorInfo(whereJson,ctx), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.hand.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wql.core.content.HttpContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
@@ -17,6 +19,9 @@ public interface HandService {
|
||||
*/
|
||||
JSONObject handlogin(Map<String, String> param);
|
||||
|
||||
JSONObject queryDeviceErrorInfo(JSONObject whereJson, HttpContext ctx);
|
||||
|
||||
|
||||
/**
|
||||
* 查询工单及明细
|
||||
*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.hand.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -21,6 +22,10 @@ import org.nl.modules.system.service.UserService;
|
||||
import org.nl.modules.system.service.dto.UserDto;
|
||||
import org.nl.utils.RsaUtils;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.core.content.HttpContext;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -99,6 +104,31 @@ public class HandServiceImpl implements HandService {
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryDeviceErrorInfo(JSONObject whereJson, HttpContext ctx) {
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String error_code = MapUtil.getStr(whereJson, "error_code");
|
||||
String error_info = MapUtil.getStr(whereJson, "error_info");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
String where = "1 = 1 ";
|
||||
if (StrUtil.isNotEmpty(device_code)) {
|
||||
where += "and device_code like '%" + device_code + "%'";
|
||||
}
|
||||
if (StrUtil.isNotEmpty(error_code)) {
|
||||
where += "and error_code like '%" + error_code + "%'";
|
||||
}
|
||||
if (StrUtil.isNotEmpty(error_info)) {
|
||||
where += "and error_info like '%" + error_info + "%'";
|
||||
}
|
||||
JSONArray jsonArray = wo.pagequery(ctx, where, "error_time desc").getResultJSONArray(0);
|
||||
// 返回
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "1");
|
||||
resultJSON.put("desc", "查询成功");
|
||||
resultJSON.put("result", jsonArray);
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject order() {
|
||||
// 查询工单
|
||||
@@ -522,8 +552,8 @@ public class HandServiceImpl implements HandService {
|
||||
int wrap_control = hailiangFlatDeviceDriver.getWrap_control();
|
||||
int strapping_finish = hailiangFlatDeviceDriver.getStrapping_finish();
|
||||
int error_clear = hailiangFlatDeviceDriver.getError_clear();
|
||||
float motor_frequency_setting= hailiangFlatDeviceDriver.getMotor_frequency_setting();
|
||||
float nip_setting= hailiangFlatDeviceDriver.getNip_setting();
|
||||
float motor_frequency_setting = hailiangFlatDeviceDriver.getMotor_frequency_setting();
|
||||
float nip_setting = hailiangFlatDeviceDriver.getNip_setting();
|
||||
int cowl_pass_jacking_need_num = hailiangFlatDeviceDriver.getCowl_pass_jacking_need_num();
|
||||
int cowl_pass_jacking_has_num = hailiangFlatDeviceDriver.getCowl_pass_jacking_has_num();
|
||||
resp.put("code", "1");
|
||||
|
||||
@@ -48,6 +48,8 @@ public interface DictService {
|
||||
*/
|
||||
List<DictDto> queryAll(DictQueryCriteria dict);
|
||||
|
||||
List<Dict> queryAll();
|
||||
|
||||
/**
|
||||
* 根据字典名查询字典详情
|
||||
* @param name
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package org.nl.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.modules.system.domain.Dict;
|
||||
import org.nl.modules.system.domain.DictDetail;
|
||||
import org.nl.modules.system.repository.DictDetailRepository;
|
||||
@@ -37,11 +40,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "dict")
|
||||
@@ -53,8 +57,8 @@ public class DictDetailServiceImpl implements DictDetailService {
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) {
|
||||
Page<DictDetail> page = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
public Map<String, Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) {
|
||||
Page<DictDetail> page = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
return PageUtil.toPage(page.map(dictDetailMapper::toDto));
|
||||
}
|
||||
|
||||
@@ -64,17 +68,21 @@ public class DictDetailServiceImpl implements DictDetailService {
|
||||
dictDetailRepository.save(resources);
|
||||
// 清理缓存
|
||||
delCaches(resources);
|
||||
Dict dict = dictRepository.findById(resources.getDict().getId()).get();
|
||||
ErrorUtil.dictMap.put(dict.getName(), this.getDictByName(dict.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DictDetail resources) {
|
||||
DictDetail dictDetail = dictDetailRepository.findById(resources.getId()).orElseGet(DictDetail::new);
|
||||
ValidationUtil.isNull( dictDetail.getId(),"DictDetail","id",resources.getId());
|
||||
ValidationUtil.isNull(dictDetail.getId(), "DictDetail", "id", resources.getId());
|
||||
resources.setId(dictDetail.getId());
|
||||
dictDetailRepository.save(resources);
|
||||
// 清理缓存
|
||||
delCaches(resources);
|
||||
Dict dict = dictRepository.findById(resources.getDict().getId()).get();
|
||||
ErrorUtil.dictMap.put(dict.getName(), this.getDictByName(dict.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,9 +98,11 @@ public class DictDetailServiceImpl implements DictDetailService {
|
||||
// 清理缓存
|
||||
delCaches(dictDetail);
|
||||
dictDetailRepository.deleteById(id);
|
||||
Dict dict = dictRepository.findById(id).get();
|
||||
ErrorUtil.dictMap.put(dict.getName(), this.getDictByName(dict.getName()));
|
||||
}
|
||||
|
||||
public void delCaches(DictDetail dictDetail){
|
||||
public void delCaches(DictDetail dictDetail) {
|
||||
Dict dict = dictRepository.findById(dictDetail.getDict().getId()).orElseGet(Dict::new);
|
||||
redisUtils.del("dict::name:" + dict.getName());
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.nl.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -63,6 +64,12 @@ public class DictServiceImpl implements DictService {
|
||||
return dictMapper.toDto(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dict> queryAll() {
|
||||
List<Dict> list = dictRepository.findAll();
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray queryDetailByName(String name) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
|
||||
@@ -9,11 +9,11 @@ spring:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
#url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_zgbz_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.1.90}:${DB_PORT:3306}/${DB_NAME:hl_zgbz_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_zgbz_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USER:root}
|
||||
#password: ${DB_PWD:P@ssw0rd}
|
||||
#password: ${DB_PWD:Root.123456}
|
||||
password: ${DB_PWD:123456}
|
||||
password: ${DB_PWD:password}
|
||||
#password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
||||
27
qd/src/api/acs/history/acsDeviceErrorLog.js
Normal file
27
qd/src/api/acs/history/acsDeviceErrorLog.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/deviceErrorLog',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/deviceErrorLog/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/deviceErrorLog',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
145
qd/src/views/acs/history/deviceErrorInfo/index.vue
Normal file
145
qd/src/views/acs/history/deviceErrorInfo/index.vue
Normal file
@@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<label class="el-form-item-label">设备编码</label>
|
||||
<el-input
|
||||
v-model="query.device_code"
|
||||
clearable
|
||||
placeholder="设备编码"
|
||||
style="width: 185px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<el-input
|
||||
v-model="query.error_code"
|
||||
clearable
|
||||
placeholder="报警编码"
|
||||
style="width: 185px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<el-input
|
||||
v-model="query.error_info"
|
||||
clearable
|
||||
placeholder="报警信息"
|
||||
style="width: 185px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<date-range-picker
|
||||
v-model="query.error_time"
|
||||
start-placeholder="error_timeStart"
|
||||
end-placeholder="error_timeStart"
|
||||
class="date-item"
|
||||
/>
|
||||
<rrOperation :crud="crud" />
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="500px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="device_code" label="设备编码" />
|
||||
<el-table-column prop="error_code" label="报警编码" />
|
||||
<el-table-column prop="error_info" label="报警信息" />
|
||||
<el-table-column prop="error_time" label="报警时间" />
|
||||
<el-table-column
|
||||
v-permission="['admin','acsDeviceErrorLog:edit','acsDeviceErrorLog:del']"
|
||||
label="操作"
|
||||
width="150px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
:disabled-edit="true"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudAcsDeviceErrorLog from '@/api/acs/history/acsDeviceErrorLog'
|
||||
|
||||
const defaultForm = { error_log_uuid: null, device_code: null, error_code: null, error_info: null, error_time: null }
|
||||
export default {
|
||||
name: 'DeviceErrorLog',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '设备报警记录',
|
||||
url: 'api/deviceErrorLog',
|
||||
idField: 'error_log_uuid',
|
||||
sort: 'error_log_uuid,desc',
|
||||
crudMethod: { ...crudAcsDeviceErrorLog },
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
add: ['admin', 'deviceErrorLog:add'],
|
||||
edit: ['admin', 'deviceErrorLog:edit'],
|
||||
del: ['admin', 'adeviceErrorLog:del']
|
||||
},
|
||||
rules: {},
|
||||
queryTypeOptions: [
|
||||
{ key: 'device_code', display_name: '设备编码' },
|
||||
{ key: 'error_code', display_name: '报警编码' },
|
||||
{ key: 'error_info', display_name: '报警信息' }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user