更新
This commit is contained in:
@@ -231,7 +231,7 @@ public class AbstractDriverService<T> implements DriverDeviceService {
|
||||
try {
|
||||
itemProtocol = methodItemProtocol.invoke(driver);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Field[] fields = new Field[0];
|
||||
@@ -247,7 +247,7 @@ public class AbstractDriverService<T> implements DriverDeviceService {
|
||||
try {
|
||||
fieldValue = (String) field.get(fieldName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//e.printStackTrace();
|
||||
}
|
||||
Method method = null;
|
||||
try {
|
||||
@@ -264,7 +264,7 @@ public class AbstractDriverService<T> implements DriverDeviceService {
|
||||
try {
|
||||
stringValueMethod = driverClass.getMethod("getStringValue",String.class,int.class);
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
//e.printStackTrace();
|
||||
}
|
||||
String stringValue = null;
|
||||
if (ObjectUtil.isNotEmpty(stringValueMethod)){
|
||||
@@ -273,7 +273,7 @@ public class AbstractDriverService<T> implements DriverDeviceService {
|
||||
stringValue = (String) stringValueMethod.invoke(driver,fieldValue,(int)itemValue);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotEmpty(stringValue)){
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.acs.common.deviceInfo;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.common.AbstractDriverService;
|
||||
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* 缓存架
|
||||
*/
|
||||
@Component("standard_conveyor_control")
|
||||
public class StandardCoveyorControlDevice extends AbstractDriverService {
|
||||
StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceInfo(Device device) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
JSONObject jo = this.getCommonDeviceInfo(standardCoveyorControlDeviceDriver);
|
||||
jo.put("is_click", true);
|
||||
jo.put("hasGoods", standardCoveyorControlDeviceDriver.getBySignal());
|
||||
jo.put("device_type", "conveyor");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean createInstCheckStartPoint(Device device, TaskDto taskDto) throws Exception {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean createInstCheckNextPoint(Device device, TaskDto taskDto) throws Exception {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeDeviceStatus(Device device, JSONObject form) {
|
||||
int hasGoodStatus = form.getInt("hasGoodStatus");
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
standardCoveyorControlDeviceDriver.setBySignal(hasGoodStatus);
|
||||
// this.changeDeviceStatus(standardCoveyorControlDeviceDriver, form, false);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package org.nl.acs.common.deviceInfo;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.common.AbstractDriverService;
|
||||
import org.nl.acs.common.enums.InstEnum;
|
||||
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* 缓存架
|
||||
*/
|
||||
@Component("standard_inspect_site")
|
||||
public class StandardInspectSiteDevice extends AbstractDriverService {
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
@Override
|
||||
public JSONObject getDeviceInfo(Device device) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
JSONObject jo = this.getCommonDeviceInfo(standardInspectSiteDeviceDriver);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean createInstCheckStartPoint(Device device, TaskDto taskDto) throws Exception {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
return this.checkStartPoint(standardInspectSiteDeviceDriver, taskDto, InstEnum.standard_inspect_site_start.getMode(), InstEnum.standard_inspect_site_start.getMove());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean createInstCheckNextPoint(Device device, TaskDto taskDto) throws Exception {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
return this.checkNextPoint(standardInspectSiteDeviceDriver, taskDto,InstEnum.standard_inspect_site_next.getMode(), InstEnum.standard_conveyor_line_next.getMove());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeDeviceStatus(Device device, JSONObject form) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
this.changeDeviceStatus(standardInspectSiteDeviceDriver, form, false);
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,11 @@ public class AgvWaitUtil {
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
if (standardCoveyorControlDeviceDriver.getBySignal() == 1 && standardCoveyorControlDeviceDriver.getByAction() == 0) {
|
||||
int byError = standardCoveyorControlDeviceDriver.getByError();
|
||||
int bySignal = standardCoveyorControlDeviceDriver.getBySignal();
|
||||
int byAction = standardCoveyorControlDeviceDriver.getByAction();
|
||||
if (byError == 0 && bySignal == 1 && byAction == 0) {
|
||||
standardCoveyorControlDeviceDriver.writing(1, "0");
|
||||
feedMap.put("feedbackStatus", "applyTake");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
|
||||
@@ -94,7 +98,7 @@ public class AgvWaitUtil {
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,起点位置无货!move = " + standardCoveyorControlDeviceDriver.getBySignal());
|
||||
map.put("message", "请求失败,起点位置无货!move = " + bySignal + ",action = " + byAction + ",error = " + byError);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,起点位置无货!");
|
||||
@@ -213,7 +217,11 @@ public class AgvWaitUtil {
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
if (standardCoveyorControlDeviceDriver.getBySignal() == 0 && standardCoveyorControlDeviceDriver.getByAction() == 0) {
|
||||
int byError = standardCoveyorControlDeviceDriver.getByError();
|
||||
int bySignal = standardCoveyorControlDeviceDriver.getBySignal();
|
||||
int byAction = standardCoveyorControlDeviceDriver.getByAction();
|
||||
if (byError == 0 && bySignal == 0 && byAction == 0) {
|
||||
standardCoveyorControlDeviceDriver.writing(1, "0");
|
||||
feedMap.put("feedbackStatus", "applyPut");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
|
||||
@@ -234,7 +242,7 @@ public class AgvWaitUtil {
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,终点位置有货!move = " + standardCoveyorControlDeviceDriver.getBySignal());
|
||||
map.put("message", "请求失败,终点位置有货!move = " + bySignal + ",action = " + byAction + ",error = " + byError);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,终点位置有货!");
|
||||
|
||||
@@ -4,16 +4,11 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
|
||||
import org.nl.acs.device_driver.standard_conveyor_line.StandardConveyorLineDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AgvToAcsService;
|
||||
import org.nl.acs.ext.wms.service.AgvWaitUtil;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -26,9 +21,6 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
|
||||
private final TaskService taskService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final AcsToWmsZDServiceImpl acsToWmsZDService;
|
||||
private final InstructionService instructionService;
|
||||
private final AgvWaitUtil agvWaitUtil;
|
||||
@Autowired
|
||||
@@ -52,23 +44,22 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
feedMap.put("taskCode", task_code);
|
||||
feedMap.put("taskType", instructionDto.getInstruction_type());
|
||||
feedMap.put("carId", instructionDto.getAgv_jobno());
|
||||
String type = "";
|
||||
String start_device_code = instructionDto.getStart_device_code();
|
||||
String next_device_code = instructionDto.getNext_device_code();
|
||||
if (address.contains("IN")) {
|
||||
String deviceCodeNow = address.substring(0, address.length() - 2);
|
||||
if (start_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitInGet(deviceCodeNow,feedMap,param);
|
||||
}else if (next_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitOutGet(deviceCodeNow,feedMap,param);
|
||||
return agvWaitUtil.waitInGet(deviceCodeNow, feedMap, param);
|
||||
} else if (next_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitOutGet(deviceCodeNow, feedMap, param);
|
||||
}
|
||||
}
|
||||
if (address.contains("OUT")) {
|
||||
String deviceCodeNow = address.substring(0, address.length() - 3);
|
||||
if (start_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitInPut(deviceCodeNow,feedMap,param);
|
||||
}else if (next_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitOutPut(deviceCodeNow,feedMap,param);
|
||||
return agvWaitUtil.waitInPut(deviceCodeNow, feedMap, param);
|
||||
} else if (next_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitOutPut(deviceCodeNow, feedMap, param);
|
||||
}
|
||||
}
|
||||
map.put("status", 400);
|
||||
|
||||
@@ -121,6 +121,14 @@ public class TaskController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("非终点位放货完成")
|
||||
@ApiOperation("非终点位放货完成")
|
||||
@PostMapping(value = "/noTargetPutFinish/{id}")
|
||||
public ResponseEntity<Object> noTargetPutFinish(@RequestBody String id) throws Exception {
|
||||
taskService.noTargetPutFinish(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("任务异常完成")
|
||||
@ApiOperation("任务异常完成")
|
||||
@PostMapping(value = "/errorFinish/{id}")
|
||||
|
||||
@@ -173,6 +173,13 @@ public interface TaskService {
|
||||
*/
|
||||
void finish(String ids);
|
||||
|
||||
/**
|
||||
* 非终点位放货完成
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void noTargetPutFinish(String ids);
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
*
|
||||
|
||||
@@ -698,6 +698,33 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void noTargetPutFinish(String ids) {
|
||||
TaskDto entity = this.findById(ids);
|
||||
Instruction instruction = instructionService.findByTaskcode(entity.getTask_code());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
InstructionDto instdto = instructionservice.findByTaskid(ids, "instruction_status <2 ");
|
||||
if (instdto != null) throw new BadRequestException("有指令未完成!");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setTask_status("3");
|
||||
entity.setRemark("非终点位放货完成");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = JSONObject.fromObject(entity);
|
||||
wo.update(json);
|
||||
Map<String, Object> feedMap = new HashMap();
|
||||
feedMap.put("taskCode", entity.getTask_code());
|
||||
feedMap.put("taskType", entity.getTask_type());
|
||||
feedMap.put("carId", instruction.getAgv_jobno());
|
||||
feedMap.put("feedbackStatus", "NoTargetPutFinish");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finish(String id) {
|
||||
|
||||
@@ -48,6 +48,14 @@ export function errorFinish(task_id) {
|
||||
})
|
||||
}
|
||||
|
||||
export function noTargetPutFinish(task_id) {
|
||||
return request({
|
||||
url: 'api/task/noTargetPutFinish/' + task_id,
|
||||
method: 'post',
|
||||
data: task_id
|
||||
})
|
||||
}
|
||||
|
||||
export function exceptions(task_id) {
|
||||
return request({
|
||||
url: 'api/task/exception/' + task_id,
|
||||
@@ -119,5 +127,5 @@ export function specialTaskCreate(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, finish, cancel, createTaskByClick, deviceAskTask, ordinaryTaskCreate, specialTaskCreate, createInst, reload, errorFinish, exceptions, deprecate }
|
||||
export default { add, edit, del, noTargetPutFinish, finish, cancel, createTaskByClick, deviceAskTask, ordinaryTaskCreate, specialTaskCreate, createInst, reload, errorFinish, exceptions, deprecate }
|
||||
|
||||
|
||||
@@ -271,6 +271,7 @@
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'d')">异常完成</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'e')">异常</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'f')">作废</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'g')">非终点任务完成</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
@@ -467,6 +468,14 @@ export default {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
noTargetPutFinish(index, row) {
|
||||
crudTask.noTargetPutFinish(row.task_id).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
reload() {
|
||||
crudTask.reload().then(res => {
|
||||
this.crud.toQuery()
|
||||
@@ -502,6 +511,9 @@ export default {
|
||||
case 'f':// 作废
|
||||
this.deprecate(command.index, command.row)
|
||||
break
|
||||
case 'g':// 作废
|
||||
this.noTargetPutFinish(command.index, command.row)
|
||||
break
|
||||
}
|
||||
},
|
||||
showStartStorage(val) {
|
||||
|
||||
Reference in New Issue
Block a user