Browse Source

add:申请任务开关

master
gengby 6 months ago
parent
commit
2d7b4c616b
  1. 51
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java
  2. 4
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java
  3. 27
      nladmin-ui/src/views/acs/device/driver/appearance_inspection_scanner_conveyor_device.vue
  4. 34
      nladmin-ui/src/views/acs/device/driver/with_station_device.vue

51
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java

@ -232,17 +232,18 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
} else { } else {
this.createOutInstruction(this.currentDeviceCode); this.createOutInstruction(this.currentDeviceCode);
} }
} else if (this.mode == 6 && move > 0 && !requireSuccess) {
//向上位申请任务
this.applyInTask();
} else if (this.mode == 2 && this.move > 0 && StrUtil.isEmpty(this.barcode) && !requireSuccess) { } else if (this.mode == 2 && this.move > 0 && StrUtil.isEmpty(this.barcode) && !requireSuccess) {
//下发输送线指令信息 //下发输送线指令信息
this.distribute(); this.distribute();
} else if (this.mode == 6 && move > 0 && !requireSuccess) {
//向上位申请任务
this.applyInTask();
} else if (this.mode == 7 && this.move > 0 && StrUtil.isNotEmpty(this.barcode) && !requireSuccess) {
this.applyAgvTask();
} }
} }
} }
private boolean isTimeValid(long currentTimeMillis) { private boolean isTimeValid(long currentTimeMillis) {
return currentTimeMillis - this.requireTime >= this.requireTimeOut; return currentTimeMillis - this.requireTime >= this.requireTimeOut;
} }
@ -267,6 +268,41 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
} }
} }
/**
* 扫码申请AGV任务
*/
private void applyAgvTask() {
long currentTimeMillis = System.currentTimeMillis();
if (!isTimeValid(currentTimeMillis)) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut);
} else {
this.requireTime = currentTimeMillis;
JSONObject requestParam = new JSONObject();
requestParam.put("device_code1", this.currentDeviceCode);
requestParam.put("type", RequestTypeEnum.APPLY_IN_TASK.getType());
requestParam.put("barcode1", this.barcode);
UnifiedResponse<JSONObject> response = acsToWmsService.applyTaskToWms(requestParam);
if (response.isSuccess()) {
this.requireSuccess = true;
}
}
}
/**
* 自动申请AGV任务
*
* @param barcode
* @return
*/
private UnifiedResponse<JSONObject> applyAgvTask(String barcode) {
JSONObject requestParam = new JSONObject();
requestParam.put("device_code1", this.currentDeviceCode);
requestParam.put("type", RequestTypeEnum.APPLY_IN_TASK.getType());
requestParam.put("barcode1", barcode);
return acsToWmsService.applyTaskToWms(requestParam);
}
public void createInInstruction() { public void createInInstruction() {
long currentTimeMillis = System.currentTimeMillis(); long currentTimeMillis = System.currentTimeMillis();
if (!isTimeValid(currentTimeMillis)) { if (!isTimeValid(currentTimeMillis)) {
@ -497,6 +533,13 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
instructionService.update(instruction); instructionService.update(instruction);
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 -> " + InstructionStatusEnum.BUSY.getName())); logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 -> " + InstructionStatusEnum.BUSY.getName()));
} else if ((InstructionStatusEnum.BUSY.getIndex().equals(instruction.getInstruction_status()) || InstructionStatusEnum.READY.getIndex().equals(instruction.getInstruction_status())) && this.currentDeviceCode.equals(instruction.getNext_device_code())) { } else if ((InstructionStatusEnum.BUSY.getIndex().equals(instruction.getInstruction_status()) || InstructionStatusEnum.READY.getIndex().equals(instruction.getInstruction_status())) && this.currentDeviceCode.equals(instruction.getNext_device_code())) {
Boolean applyTaskFlag = Optional.ofNullable(this.getExtraValue().get("applyTask")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
if (applyTaskFlag) {
UnifiedResponse<JSONObject> response = this.applyAgvTask(instruction.getVehicle_code());
if (!response.isSuccess()) {
return;
}
}
instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex()); instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
instruction.setExecute_device_code(this.currentDeviceCode); instruction.setExecute_device_code(this.currentDeviceCode);
instructionService.finish(instruction); instructionService.finish(instruction);

4
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java

@ -67,6 +67,8 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
@Override @Override
public void execute() { public void execute() {
device_code = this.getDeviceCode(); device_code = this.getDeviceCode();
Boolean applyTaskFlag = Optional.ofNullable(this.getExtraValue().get("applyTask")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
if (!applyTaskFlag) return;
long currentTimeMillis = System.currentTimeMillis(); long currentTimeMillis = System.currentTimeMillis();
if (!isTimeValid(currentTimeMillis)) { if (!isTimeValid(currentTimeMillis)) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut); log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut);
@ -106,7 +108,7 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver2 = (AppearanceInspectionScannerConveyorDeviceDriver) linkDevice.getDeviceDriver(); AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver2 = (AppearanceInspectionScannerConveyorDeviceDriver) linkDevice.getDeviceDriver();
if (appearanceInspectionScannerConveyorDeviceDriver2.getMove() == 1 && !appearanceInspectionScannerConveyorDeviceDriver2.isRequireSuccess()) { if (appearanceInspectionScannerConveyorDeviceDriver2.getMove() == 1 && !appearanceInspectionScannerConveyorDeviceDriver2.isRequireSuccess()) {
TaskDto taskDto2 = taskServer.findByContainer(appearanceInspectionScannerConveyorDeviceDriver2.getBarcode()); TaskDto taskDto2 = taskServer.findByContainer(appearanceInspectionScannerConveyorDeviceDriver2.getBarcode());
if (ObjectUtil.isEmpty(taskDto2) ) { if (ObjectUtil.isEmpty(taskDto2)) {
requestParam.put("device_code1", deviceCode); requestParam.put("device_code1", deviceCode);
requestParam.put("barcode1", appearanceInspectionScannerConveyorDeviceDriver.getBarcode()); requestParam.put("barcode1", appearanceInspectionScannerConveyorDeviceDriver.getBarcode());
requestParam.put("device_code2", getLinkDeviceCode); requestParam.put("device_code2", getLinkDeviceCode);

27
nladmin-ui/src/views/acs/device/driver/appearance_inspection_scanner_conveyor_device.vue

@ -65,8 +65,8 @@
</div> </div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px"> <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row> <el-row>
<el-col :span="6"> <el-col :span="8">
<el-form-item label="关联设备:" prop="getLinkDeviceCode" label-width="105px"> <el-form-item label="关联设备:" prop="getLinkDeviceCode" label-width="150px">
<el-select <el-select
v-model="form.getLinkDeviceCode" v-model="form.getLinkDeviceCode"
filterable filterable
@ -83,25 +83,32 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="8">
<el-form-item label="当前排:" label-width="90px" prop="currentX"> <el-form-item label="自动申请AGV任务:" label-width="150px">
<el-switch v-model="form.applyTask"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="当前排:" label-width="150px" prop="currentX">
<el-input v-model.number="form.currentX" /> <el-input v-model.number="form.currentX" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="8">
<el-form-item label="当前列:" label-width="90px" prop="currentY"> <el-form-item label="当前列:" label-width="150px" prop="currentY">
<el-input v-model.number="form.currentY" /> <el-input v-model.number="form.currentY" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="8">
<el-form-item label="当前层:" label-width="90px" prop="currentZ"> <el-form-item label="当前层:" label-width="150px" prop="currentZ">
<el-input v-model.number="form.currentZ" /> <el-input v-model.number="form.currentZ" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="出库缓存设备:" prop="cacheDeviceCode" label-width="130px"> <el-form-item label="出库缓存设备:" prop="cacheDeviceCode" label-width="150px">
<el-select <el-select
v-model="form.cacheDeviceCode" v-model="form.cacheDeviceCode"
filterable filterable
@ -138,7 +145,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="关联拣选台设备:" prop="pinkDeviceCode" label-width="130px"> <el-form-item label="关联拣选台设备:" prop="pinkDeviceCode" label-width="150px">
<el-select <el-select
v-model="form.pinkDeviceCode" v-model="form.pinkDeviceCode"
filterable filterable

34
nladmin-ui/src/views/acs/device/driver/with_station_device.vue

@ -9,7 +9,7 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="电气调度号" label-width="150px"> <el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.address" /> <el-input v-model="form.address"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -24,17 +24,17 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="检验有货"> <el-form-item label="检验有货">
<el-switch v-model="form.inspect_in_stocck" /> <el-switch v-model="form.inspect_in_stocck"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="忽视取货校验" label-width="150px"> <el-form-item label="忽视取货校验" label-width="150px">
<el-switch v-model="form.ignore_pickup_check" /> <el-switch v-model="form.ignore_pickup_check"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="忽视放货校验" label-width="150px"> <el-form-item label="忽视放货校验" label-width="150px">
<el-switch v-model="form.ignore_release_check" /> <el-switch v-model="form.ignore_release_check"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -42,12 +42,17 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="呼叫"> <el-form-item label="呼叫">
<el-switch v-model="form.apply_task" /> <el-switch v-model="form.apply_task"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="响应" label-width="150px"> <el-form-item label="响应" label-width="150px">
<el-switch v-model="form.manual_create_task" /> <el-switch v-model="form.manual_create_task"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="申请任务" label-width="150px">
<el-switch v-model="form.applyTask"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -72,7 +77,7 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="申请任务时间 (秒)" label-width="150px"> <el-form-item label="申请任务时间 (秒)" label-width="150px">
<el-input v-model="form.apply_time" /> <el-input v-model="form.apply_time"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -87,12 +92,12 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="取货"> <el-form-item label="取货">
<el-switch v-model="form.is_pickup" /> <el-switch v-model="form.is_pickup"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="放货"> <el-form-item label="放货">
<el-switch v-model="form.is_release" /> <el-switch v-model="form.is_release"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -100,7 +105,7 @@
</el-card> </el-card>
<el-card class="box-card" shadow="never"> <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="role-span" /> <span class="role-span"/>
<el-button <el-button
:loading="false" :loading="false"
icon="el-icon-check" icon="el-icon-check"
@ -123,9 +128,9 @@ import {
testRead, testRead,
testwrite testwrite
} from '@/api/acs/device/driverConfig' } from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc' import {selectOpcList} from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc' import {selectPlcList} from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc' import {selectListByOpcID} from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud' import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device' import deviceCrud from '@/api/acs/device/device'
@ -165,7 +170,8 @@ export default {
is_pickup: true, is_pickup: true,
is_release: true, is_release: true,
apply_time: '', apply_time: '',
link_device_code: [] link_device_code: [],
applyTask: false
}, },
rules: {} rules: {}
} }

Loading…
Cancel
Save