This commit is contained in:
2022-07-05 15:17:55 +08:00
parent ec0afb5dca
commit 856768e006
10 changed files with 65 additions and 23 deletions

View File

@@ -5,6 +5,10 @@ import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_xj_plc_test.Hai
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 海亮-海亮迅捷plc测试
*/
@Service("hailiang_xj_plc_test")
public class HailiangxjplcDevice extends AbstractDriverService {
@Override

View File

@@ -236,6 +236,9 @@ public class HailiangCleaningMachineStorageStationDeviceDriver extends AbstractO
NDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;
}else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因error:"+error+",inst"+inst);
}
}
@@ -247,6 +250,9 @@ public class HailiangCleaningMachineStorageStationDeviceDriver extends AbstractO
NDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;
}else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因error:"+error+",inst"+inst);
}
}

View File

@@ -205,7 +205,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "move=" +move + ",等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "move=" +move + ",等待反馈inst"+inst);
}
}
@@ -223,7 +223,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈inst为空");
}
}
@@ -240,7 +240,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈inst为空");
}
}
@@ -274,7 +274,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
updatejson.put("islock","0");
updatejson.put("material_type","");
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "起点位置刻字机,缓存位锁定成功");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "起点位置包装机,缓存位锁定成功");
}
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
OneNDCSocketConnectionAutoRun.write(data);
@@ -283,7 +283,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈inst为空");
}
}

View File

@@ -365,13 +365,22 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
// if ( full_req == 1 ) {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move+",requireSucess:" + requireSucess + "开始申请任务");
apply_task();
} else {
logServer.deviceLogToacs(this.device_code,"","","不满足下发满框请求任务条件mode:"+mode+"move:"+move+"full_req:"+full_req);
}
if (move == 0 && mode == 1 && empty_req == 1){
// if (empty_req == 1) {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move+",requireSucess:" + requireSucess + "开始申请空箱请求任务");
apply_empty_task();
}else {
logServer.deviceLogToacs(this.device_code,"","","不满足下发空框请求任务条件mode:"+mode+"move:"+move+"empty_req:"+empty_req);
}
}else {
logServer.deviceLogToacs(this.device_code,"","","是否请求成功requireSucess:"+requireSucess);
}
if(agvphase == 0x03)
@@ -387,7 +396,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈inst为空");
}
}
@@ -404,7 +413,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈inst为空");
}
}
@@ -421,7 +430,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈inst为空");
}
}
@@ -436,7 +445,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈inst为空");
}
}

View File

@@ -277,7 +277,6 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
ProduceshiftorderDto dto = new ProduceshiftorderDto();
dto.setOrder_code(order + "");
dto.setOrder_status("2");
produceshiftorderService.updateByOrderCode(dto);
ProduceshiftorderDto deviceInfo = produceshiftorderService.findOrderByDeviceCode(this.device_code);
if(deviceInfo != null){
if (StrUtil.isNotEmpty(deviceInfo.getExt_order_id())) {
@@ -292,6 +291,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
}else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单信息为空");
}
produceshiftorderService.updateByOrderCode(dto);
this.writing("to_confirm_finished","1");
this.writing("to_clear","1");
this.writing("to_pause","1");
@@ -303,7 +303,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
if(ObjectUtil.isEmpty(inst)){
if(!requireSucess){
if (lack_req == 1 && move == 0) {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move+",requireSucess:" + requireSucess + "开始申请任务");
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move+",requireSucess:" + requireSucess + "开始申请缺料请求任务");
apply_task();
}
@@ -311,7 +311,10 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move+",requireSucess:" + requireSucess + "开始申请请求取走空料斗任务");
apply_take_empty_task();
}
logServer.deviceLogToacs(this.device_code,"","","lack_req:"+lack_req+"move:"+move+"req_task_empty:"+req_task_empty);
} else {
logServer.deviceLogToacs(this.device_code,"","","是否请求成功requireSucess:"+requireSucess);
}
}
@@ -330,7 +333,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
/* } else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因move:"+move+",error:"+error+",inst"+inst);
}*/
}
@@ -348,8 +351,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因move:"+move+",error:"+error+",inst"+inst);
}
}
@@ -365,7 +367,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因move:"+move+",error:"+error+",inst"+inst);
}
}
@@ -470,6 +472,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
//判断缓存位是否锁定
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = '1'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)){
logServer.deviceLogToacs(this.device_code, "", "", "对应路由设备,"+next_device_code+"已锁定");
continue;
}
TaskDto onedto = new TaskDto();

View File

@@ -372,7 +372,6 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
ProduceshiftorderDto dto = new ProduceshiftorderDto();
dto.setOrder_code(order + "");
dto.setOrder_status("2");
produceshiftorderService.updateByOrderCode(dto);
ProduceshiftorderDto deviceInfo = produceshiftorderService.findOrderByDeviceCode(this.device_code);
if(deviceInfo != null){
if (StrUtil.isNotEmpty(deviceInfo.getExt_order_id())) {
@@ -380,10 +379,17 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
JSONObject param = new JSONObject();
param.put("ext_order_id",ext_order_id);
acsToWmsService.feedbackOrderStatus(param);
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的外部标识:"+ext_order_id);
}else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的没有外部标识");
}
}else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单信息为空");
}
this.writing("to_confirm_finished","1");
this.writing("to_pause","0");
produceshiftorderService.updateByOrderCode(dto);
this.writing("to_confirm_finished","1");
this.writing("to_clear","1");
this.writing("to_pause","1");
} else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,order_finish>"+ finish +",last_finish>"+last_finish);
}

View File

@@ -249,6 +249,8 @@ public class HailiangSpecialEmptyStationDeviceDriver extends AbstractOpcDeviceDr
NDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;
}else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因move:"+move+",error:"+error+",inst"+inst);
}
}
//放空箱完成
@@ -260,6 +262,8 @@ public class HailiangSpecialEmptyStationDeviceDriver extends AbstractOpcDeviceDr
NDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;
}else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因move:"+move+",error:"+error+",inst"+inst);
}
}
}

View File

@@ -254,7 +254,12 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
if ( move == 1 && mode == 1 ) {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move+",requireSucess:" + requireSucess + "开始申请任务");
apply_task();
} else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move+",requireSucess:" + requireSucess + "申请任务失败,不符合条件");
}
} else {
logServer.deviceLogToacs(this.device_code,"","","是否请求成功requireSucess:"+requireSucess);
}
if(agvphase == 0x03 || agvphase == 0x07 )
@@ -270,7 +275,8 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因move:"+move+",error:"+error+",inst"+inst+",allready:"+allready+",full_number:"+full_number);
}
}
@@ -288,7 +294,8 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因move:"+move+",error:"+error+",inst"+inst+",allready:"+allready+",full_number:"+full_number);
}
}

View File

@@ -253,6 +253,9 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
NDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;
}else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因error:"+error+",inst"+inst);
}
}
@@ -264,6 +267,8 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
agvphase = 0;
index = 0;
}else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,原因error:"+error+",inst"+inst);
}
}

View File

@@ -4,13 +4,10 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mongodb.client.MongoCollection;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.nl.wql.core.bean.WQLObject;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.index.IndexOperations;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
@@ -19,6 +16,7 @@ import java.util.Date;
/**
* @author geng by
* 自动清理大于十五天的日志
*/
@Slf4j