新增acs手持取消任务调用wms删除任务

This commit is contained in:
loujf
2022-10-28 09:34:10 +08:00
parent f406acfd07
commit a6ccdac531
6 changed files with 84 additions and 3 deletions

View File

@@ -774,6 +774,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
StandardStorageDeviceDriver standardStorageDeviceDriver;
LnshStationDeviceDriver lnshStationDeviceDriver;
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
//mes = AgvClientXZ.mes(zlbh, device, type);
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
@@ -801,6 +802,15 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
}
if (addressdevice.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) addressdevice.getDeviceDriver();
flag = true;
log.info("agvstatus:" + lnshLaminatingMachineDeviceDriver.getFlag() + "");
//放货完成离开
flag = true;
}
if (addressdevice.getDeviceDriver() instanceof LnshStationDeviceDriver) {
lnshStationDeviceDriver = (LnshStationDeviceDriver) addressdevice.getDeviceDriver();
// flag = true;

View File

@@ -624,9 +624,9 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("type",type);
json.put("material",material);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
json.put("is_full","1");
// json.put("material",material);
// json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
// json.put("is_full","1");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());

View File

@@ -18,6 +18,13 @@ public interface AcsToWmsService {
*/
HttpResponse lnshApplyTaskToWms(JSONObject json);
/**
* 删除任务
* @param task_code
* @return
*/
HttpResponse deleteTask(String task_code);
/**
* 申请入窑
* @param json

View File

@@ -142,8 +142,40 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
@Override
public HttpResponse deleteTask(String task_code) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
AddressDto addressDto = addressService.findByCode("deleteTask");
String url = wmsurl + addressDto.getMethods_url();
JSONObject jo = new JSONObject();
jo.put("task_code",task_code);
log.info("deleteTask-----请求参数{}", jo.toString());
HttpResponse result2 = null;
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result2 = HttpRequest.post(url)
.header("Authorization", token)
.body(String.valueOf(jo))
.execute();
System.out.println(result2);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
log.info("deleteTask-----输出参数{}", result2.body());
return result2;
} finally {
MDC.remove(log_file_type);
}
}
@Override
public HttpResponse applyIntoKiln(JSONObject json) {
try {

View File

@@ -20,6 +20,8 @@ import org.nl.acs.device.service.dto.DeviceDto;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.instruction.service.dto.InstructionDto;
@@ -694,6 +696,33 @@ public class JnHandServiceImpl implements JnHandService {
nextDevice.setIslock("false");
}
//取消任务
if (type.equals("3")) {
//手工完成
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
TaskDto acsTask = taskjo.toJavaObject(TaskDto.class);
InstructionService instructionservice = SpringContextHolder.getBean(InstructionServiceImpl.class);
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
InstructionDto instdto = instructionservice.findByTaskid(acsTask.getTask_id(), "instruction_status <2 ");
if (instdto != null){
jo.put("code", "0");
jo.put("desc", "有指令未完成!");
jo.put("result", new JSONObject());
return jo;
}
taskService.cancel(acsTask.getTask_id());
try {
//删除wms任务
acsToWmsService.deleteTask(acsTask.getTask_code());
} catch (Exception e) {
e.printStackTrace();
}
Device startDevice = deviceAppService.findDeviceByCode(acsTask.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(acsTask.getNext_device_code());
startDevice.setIslock("false");
nextDevice.setIslock("false");
}
jo.put("code", "1");
jo.put("desc", "操作成功");

View File

@@ -871,6 +871,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
point_table.update(nextObj);
task_table.delete(taskObj);
JSONObject groupObj = group_table.query("task_id ='" + taskObj.getString("task_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(groupObj)) {
throw new BadRequestException("找不到task_id为" + taskObj.getString("task_id") +"的盘信息");
}
group_table.delete(groupObj);
JSONObject result = new JSONObject();