|
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.http.HttpResponse; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.Getter; |
|
|
|
import lombok.Setter; |
|
|
@ -29,6 +30,7 @@ import org.nl.acs.opc.Device; |
|
|
|
import org.nl.acs.route.service.RouteLineService; |
|
|
|
import org.nl.acs.task.service.TaskService; |
|
|
|
import org.nl.modules.lucene.service.LuceneExecuteLogService; |
|
|
|
import org.nl.modules.lucene.service.dto.LuceneLogDto; |
|
|
|
import org.nl.modules.wql.util.SpringContextHolder; |
|
|
|
import org.openscada.opc.lib.da.Server; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
@ -470,29 +472,38 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 申请补满料盅托盘 |
|
|
|
* |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
public synchronized boolean apply_put_full_vehicle() { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("device_code", this.device_code); |
|
|
|
json.put("type", "2"); |
|
|
|
json.put("qty", weight); |
|
|
|
json.put("vehicle_code", barcode); |
|
|
|
json.put("is_full", "1"); |
|
|
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
if (result.getStatus() == HttpStatus.OK.value()) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} |
|
|
|
if(move == 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 设备有货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -501,21 +512,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
public synchronized boolean apply_put_empty_vehicle() { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setRequestNo(IdUtil.simpleUUID()); |
|
|
|
request.setRequestDate(AgvUtil.getDate()); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
if(move == 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
|
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 设备有货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -524,21 +544,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
public synchronized boolean apply_take_empty_vehicle() { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("device_code", this.device_code); |
|
|
|
json.put("type", "2"); |
|
|
|
json.put("is_full", "1"); |
|
|
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
if (result.getStatus() == HttpStatus.OK.value()) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} |
|
|
|
if(move == 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
|
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 设备有货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -548,27 +577,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
public synchronized boolean apply_take_full_vehicle() { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("device_code", this.device_code); |
|
|
|
json.put("type", "1"); |
|
|
|
json.put("weight", weight); |
|
|
|
json.put("vehicle_code", barcode); |
|
|
|
json.put("is_full", "1"); |
|
|
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
if (result.getStatus() == HttpStatus.OK.value()) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
} |
|
|
|
if(move > 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
|
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 设备无货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -577,27 +609,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
public synchronized boolean apply_force_take_full_vehicle() { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("device_code", this.device_code); |
|
|
|
json.put("type", "1"); |
|
|
|
json.put("weight", weight); |
|
|
|
json.put("vehicle_code", barcode); |
|
|
|
json.put("is_full", "1"); |
|
|
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
if (result.getStatus() == HttpStatus.OK.value()) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
} |
|
|
|
if(move > 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
|
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 设备无货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -606,27 +641,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
public synchronized boolean apply_force_take_full_vehicle_in_storage() { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("device_code", this.device_code); |
|
|
|
json.put("type", "1"); |
|
|
|
json.put("weight", weight); |
|
|
|
json.put("vehicle_code", barcode); |
|
|
|
json.put("is_full", "1"); |
|
|
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
if (result.getStatus() == HttpStatus.OK.value()) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
} |
|
|
|
if(move > 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
|
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 设备无货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -635,24 +673,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
public synchronized boolean barcode_sucess_apply() { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("device_code", this.device_code); |
|
|
|
json.put("vehicle_code", barcode); |
|
|
|
HttpResponse result = acsToWmsService.applyOuttoKiln(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
if (result.getStatus() == HttpStatus.OK.value()) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
} |
|
|
|
if(move > 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
message = RequestMethodEnum.getName("barcode_sucess_apply") + "barcode_sucess_apply 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
|
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("barcode_sucess_apply") + "barcode_sucess_apply 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
message = RequestMethodEnum.getName("barcode_sucess_apply") + "barcode_sucess_apply 设备无货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -661,50 +705,61 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
* @param |
|
|
|
*/ |
|
|
|
public synchronized boolean get_vehicle_info() { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("device_code", this.device_code); |
|
|
|
json.put("type", "1"); |
|
|
|
json.put("weight", weight); |
|
|
|
json.put("vehicle_code", barcode); |
|
|
|
json.put("is_full", "1"); |
|
|
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
if (result.getStatus() == HttpStatus.OK.value()) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
} |
|
|
|
if(move > 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
|
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 设备无货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 强制去包装-不包装 |
|
|
|
*/ |
|
|
|
public synchronized boolean force_no_package() { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("type", "5"); |
|
|
|
json.put("device_code", device_code); |
|
|
|
|
|
|
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
if (result.getStatus() == HttpStatus.OK.value()) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
} |
|
|
|
if(move > 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
|
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
message = RequestMethodEnum.getName("force_no_package") + "force_no_package 设备无货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -712,22 +767,29 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements |
|
|
|
* 申请贴标 |
|
|
|
*/ |
|
|
|
public synchronized boolean apply_labelling() { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("type", "5"); |
|
|
|
json.put("device_code", device_code); |
|
|
|
|
|
|
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); |
|
|
|
if (ObjectUtil.isNotEmpty(result)) { |
|
|
|
if (result.getStatus() == HttpStatus.OK.value()) { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result.body()); |
|
|
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
} |
|
|
|
if(move > 0) { |
|
|
|
ApplyTaskRequest request = new ApplyTaskRequest(); |
|
|
|
request.setDevice_code(this.getDevice_code()); |
|
|
|
request.setRequest_medthod_code(this.getClass().getName()); |
|
|
|
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); |
|
|
|
request.setWeight(String.valueOf(weight)); |
|
|
|
request.setVehicle_code(String.valueOf(barcode)); |
|
|
|
Resp resp = acsToWmsService.applyTask(request); |
|
|
|
message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); |
|
|
|
|
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
this.writing(this.mode); |
|
|
|
this.setRequireSucess(true); |
|
|
|
} else { |
|
|
|
this.writing(400); |
|
|
|
message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求失败" + resp.getComment();; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 设备无货未请求LMS..."; |
|
|
|
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|