This commit is contained in:
zhangjiangwei
2023-03-18 13:47:44 +08:00
parent f98efc0ca2
commit 2acfa85a68
6 changed files with 34 additions and 52 deletions

View File

@@ -392,9 +392,9 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
json.put("device_code",this.device_code); json.put("device_code",this.device_code);
json.put("type","4"); json.put("type","4");
// json.put("vehicle_code",barcode); // json.put("vehicle_code",barcode);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "申请空盘请求参数:" + json); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "申请空盘请求参数:" + json);
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "申请空盘返回参数:" + result); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "申请空盘返回参数:" + result);
if (ObjectUtil.isNotEmpty(result)) { if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body()); JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
@@ -418,9 +418,9 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
return false; return false;
} else { } else {
this.instruction_require_time = date; this.instruction_require_time = date;
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "排产单确认请求参数:" + json); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "排产单确认请求参数:" + json);
HttpResponse result = acsToWmsService.enterOrder(json); HttpResponse result = acsToWmsService.enterOrder(json);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "排产单确认返回参数:" + result); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "排产单确认返回参数:" + result);
if (ObjectUtil.isNotEmpty(result)) { if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body()); JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
@@ -463,9 +463,9 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
json.put("producetask_code",order_No); json.put("producetask_code",order_No);
json.put("unqualified_qty",unqualified_qty); json.put("unqualified_qty",unqualified_qty);
json.put("is_full","1"); json.put("is_full","1");
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "码垛完成请求参数:" + json); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "码垛完成请求参数:" + json);
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "码垛完成返回参数:" + result); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "码垛完成返回参数:" + result);
if (ObjectUtil.isNotEmpty(result)) { if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body()); JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
@@ -501,9 +501,9 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
json.put("batch",batch); json.put("batch",batch);
json.put("producetask_code",order_No); json.put("producetask_code",order_No);
json.put("is_full","0"); json.put("is_full","0");
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "码垛强制完成请求参数:" + json); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "码垛强制完成请求参数:" + json);
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "码垛强制完成返回参数:" + result); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "码垛强制完成返回参数:" + result);
if (ObjectUtil.isNotEmpty(result)) { if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body()); JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
@@ -535,9 +535,9 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
json.put("qty",encoder_qty); json.put("qty",encoder_qty);
json.put("unqualified_qty",unqualified_qty); json.put("unqualified_qty",unqualified_qty);
json.put("is_full","1"); json.put("is_full","1");
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "申请入库请求参数:" + json); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "申请入库请求参数:" + json);
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), "申请入库返回参数:" + result); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", "申请入库返回参数:" + result);
if (ObjectUtil.isNotEmpty(result)) { if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body()); JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
@@ -607,13 +607,13 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
Map<String, Object> itemMap = new HashMap<String, Object>(); Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) { if (type == 1) {
itemMap.put(to_command, command); itemMap.put(to_command, command);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), to_command + "下发" + command); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", to_command + "下发" + command);
} else if (type == 2) { } else if (type == 2) {
itemMap.put(to_target, command); itemMap.put(to_target, command);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), to_target + "下发" + command); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", to_target + "下发" + command);
} else if (type == 3) { } else if (type == 3) {
itemMap.put(to_task, command); itemMap.put(to_task, command);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), to_task + "下发" + command); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", to_task + "下发" + command);
} }
ReadUtil.write(itemMap, server); ReadUtil.write(itemMap, server);
@@ -627,7 +627,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
Server server = ReadUtil.getServer(opcservcerid); Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>(); Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value); itemMap.put(to_param, value);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), to_param + "下发" + value); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", to_param + "下发" + value);
ReadUtil.write(itemMap, server); ReadUtil.write(itemMap, server);
} }
@@ -638,7 +638,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
Server server = ReadUtil.getServer(opcservcerid); Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>(); Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command); itemMap.put(to_command, command);
logServer.deviceExecuteLog(device_code, String.valueOf(barcode), inst.getInstruction_code(), to_command + "下发" + command); logServer.deviceExecuteLog(device_code, String.valueOf(barcode), "", to_command + "下发" + command);
ReadUtil.write(itemMap, server); ReadUtil.write(itemMap, server);
} }

View File

@@ -1579,7 +1579,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
Map<String, Object> itemMap = new HashMap<String, Object>(); Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command); itemMap.put(to_command, command);
ReadUtil.write(itemMap, server); ReadUtil.write(itemMap, server);
logServer.deviceExecuteLog(this.device_code,"","","下发电气信号:to_command,value"+command);
} }
public void writing(String param, String value) { public void writing(String param, String value) {
@@ -1592,6 +1592,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
itemMap.put(to_param, value); itemMap.put(to_param, value);
ReadUtil.write(itemMap, server); ReadUtil.write(itemMap, server);
logServer.deviceExecuteLog(this.device_code,"","","下发电气信号:"+to_param+",value"+value);
} }
@Override @Override

View File

@@ -122,7 +122,7 @@ IF 输入.flag = "3"
left join st_rule_IOdisStruct ruledis on ruledis.struct_uuid = ivt.struct_id left join st_rule_IOdisStruct ruledis on ruledis.struct_uuid = ivt.struct_id
LEFT JOIN st_buss_vehiclegroup vehiclegroup ON vehiclegroup.vehicle_code = ivt.vehicle_code LEFT JOIN st_buss_vehiclegroup vehiclegroup ON vehiclegroup.vehicle_code = ivt.vehicle_code
WHERE WHERE
ivt.canuse_qty > 0 ivt.canuse_qty >= 0
AND point.point_status = '02' AND point.point_status = '02'
AND point.lock_type = '00' AND point.lock_type = '00'
AND point.is_used ='1' AND point.is_used ='1'

View File

@@ -21,6 +21,7 @@ import org.nl.wms.common.StructFindUtil;
import org.nl.wms.database.service.VehicleService; import org.nl.wms.database.service.VehicleService;
import org.nl.wms.database.service.dto.VehicleDto; import org.nl.wms.database.service.dto.VehicleDto;
import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.AreaEnum; import org.nl.wms.sch.manage.AreaEnum;
import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.manage.VehicleTypeEnum; import org.nl.wms.sch.manage.VehicleTypeEnum;
@@ -798,25 +799,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
// 任务处理类 // 任务处理类
try { try {
Class<?> clz = Class.forName(processing_class); Class<?> clz = Class.forName(processing_class);
Object obj = clz.newInstance(); AbstractAcsTask bean = (AbstractAcsTask) SpringContextHolder.getBean(clz);
// 调用每个任务类的forceFinishInst()强制结束方法 bean.updateTaskStatus(row, status);
Method m = obj.getClass().getDeclaredMethod("updateTaskStatus", JSONObject.class, String.class); // Object obj = clz.newInstance();
m.invoke(obj, row, status); // // 调用每个任务类的forceFinishInst()强制结束方法
} catch (InvocationTargetException e) { // Method m = obj.getClass().getDeclaredMethod("updateTaskStatus", JSONObject.class, String.class);
e.printStackTrace(); // m.invoke(obj, row, status);
//空指针
if (ObjectUtil.isNull(e.getTargetException().getMessage())) {
message = e.getTargetException().toString();
} else {
message = e.getTargetException().getMessage();
}
log.info("任务状态更新失败:{}", message);
JSONObject json = new JSONObject();
json.put("task_id", task_id);
json.put("message", message);
errArr.add(json);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = e.getMessage(); message = e.getMessage();
@@ -908,21 +896,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
throw new BadRequestException("当前点位有空托任务未完成!"); throw new BadRequestException("当前点位有空托任务未完成!");
} }
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point"); WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
JSONObject produceInfoByCode = this.getProduceInfoByCode(device_code); // JSONObject produceInfoByCode = this.getProduceInfoByCode(device_code);
//根据点位获取排产单 //根据点位获取排产单
String material_id = produceInfoByCode.getString("material_id"); // String material_id = produceInfoByCode.getString("material_id");
String vehicle_code = pointTable.query("point_code = '" + device_code + "'").uniqueResult(0).getString("vehicle_code"); String vehicle_code = pointTable.query("point_code = '" + device_code + "'").uniqueResult(0).getString("vehicle_code");
JSONObject result = new JSONObject(); // WQLObject CribbingInfo_Table = WQLObject.getWQLObject("MD_ME_CribbingInfo");
WQLObject CribbingInfo_Table = WQLObject.getWQLObject("MD_ME_CribbingInfo");
WQLObject group_table = WQLObject.getWQLObject("st_buss_vehiclegroup"); WQLObject group_table = WQLObject.getWQLObject("st_buss_vehiclegroup");
if (StrUtil.isEmpty(vehicle_code)) { //从组盘表里面去获取组盘信息
//从基础表里去获取 JSONObject result = group_table.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
result = CribbingInfo_Table.query("material_id = '" + material_id + "'").uniqueResult(0);
} else {
//从组盘表里面去获取
result = group_table.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
}
JSONObject resultJSON = new JSONObject(); JSONObject resultJSON = new JSONObject();
resultJSON.put("content", result); resultJSON.put("content", result);
resultJSON.put("status", HttpStatus.OK.value()); resultJSON.put("status", HttpStatus.OK.value());

View File

@@ -53,7 +53,7 @@
LEFT JOIN sch_base_point point ON ivt.struct_id = point.point_id LEFT JOIN sch_base_point point ON ivt.struct_id = point.point_id
LEFT JOIN st_buss_vehiclegroup vehiclegroup ON vehiclegroup.vehicle_code = ivt.vehicle_code LEFT JOIN st_buss_vehiclegroup vehiclegroup ON vehiclegroup.vehicle_code = ivt.vehicle_code
WHERE WHERE
ivt.canuse_qty > 0 ivt.canuse_qty >= 0
AND ivt.vehicle_code <> '' AND ivt.vehicle_code <> ''
AND ivt.is_full = '0' AND ivt.is_full = '0'
AND point.is_used = 1 AND point.is_used = 1

View File

@@ -145,9 +145,9 @@ public class SendEmptyVehicleTask extends AbstractAcsTask {
if (StrUtil.isEmpty(vehicle_code) || "0000".equals(vehicle_code) || "0".equals(vehicle_code)) { if (StrUtil.isEmpty(vehicle_code) || "0000".equals(vehicle_code) || "0".equals(vehicle_code)) {
vehicle_code = startPoint.getVehicle_code(); vehicle_code = startPoint.getVehicle_code();
} }
if (StrUtil.isEmpty(vehicle_code)) { // if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("载具未找到!"); // throw new BadRequestException("载具未找到!");
} // }
//判断起点有没有未完成的指令 //判断起点有没有未完成的指令
JSONObject beforTaskObj = taskTable. JSONObject beforTaskObj = taskTable.
query("is_delete='0' and start_point_code='" + start_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'") query("is_delete='0' and start_point_code='" + start_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'")