add: 创建任务添加扩展字段

This commit is contained in:
yanps
2024-01-15 19:40:03 +08:00
parent 5b483c6936
commit 4742236a7c
7 changed files with 163 additions and 37 deletions

View File

@@ -66,7 +66,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
@Autowired @Autowired
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
/** /**
* 心跳 * 心跳
*/ */
Integer heartbeat = 0; Integer heartbeat = 0;
@@ -76,17 +76,17 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
*/ */
Integer item_deviceCode = 0; Integer item_deviceCode = 0;
Integer last_item_deviceCode = 0; Integer last_item_deviceCode = 0;
/** /**
* 工作模式 * 工作模式
*/ */
Integer mode = 0; Integer mode = 0;
Integer last_mode = 0; Integer last_mode = 0;
/** /**
*作业状态 * 作业状态
*/ */
Integer command = 0; Integer command = 0;
Integer last_command = 0; Integer last_command = 0;
/** /**
* 任务号 * 任务号
*/ */
Integer task = 0; Integer task = 0;
@@ -111,7 +111,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
*/ */
Integer y = 0; Integer y = 0;
Integer last_y = 0; Integer last_y = 0;
/** /**
* 行走开关信号 * 行走开关信号
*/ */
Float move = 0F; Float move = 0F;
@@ -121,12 +121,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
*/ */
Float cargoMove = 0F; Float cargoMove = 0F;
Float last_cargoMove = 0F; Float last_cargoMove = 0F;
/** /**
* 行走动作信号 * 行走动作信号
*/ */
Float action = 0F; Float action = 0F;
Float last_action = 0F; Float last_action = 0F;
/** /**
* 行走激光数值 * 行走激光数值
*/ */
Integer distancex = 0; Integer distancex = 0;
@@ -137,41 +137,41 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Integer distancey = 0; Integer distancey = 0;
Integer last_distancey = 0; Integer last_distancey = 0;
/** /**
*载货台超限信号 * 载货台超限信号
*/ */
Float cargoError = 0F; Float cargoError = 0F;
Float last_cargoError = 0F; Float last_cargoError = 0F;
/** /**
*货叉探货信号 * 货叉探货信号
*/ */
Float forkCargo = 0F; Float forkCargo = 0F;
Float last_forkCargo = 0F; Float last_forkCargo = 0F;
/** /**
*货叉位置信号 * 货叉位置信号
*/ */
Float forkLocation = 0F; Float forkLocation = 0F;
Float last_forkLocation = 0F; Float last_forkLocation = 0F;
/** /**
*货叉动作信号 * 货叉动作信号
*/ */
Float forkAction = 0F; Float forkAction = 0F;
Float last_forkAction = 0F; Float last_forkAction = 0F;
/** /**
* 特殊开关量1 * 特殊开关量1
*/ */
Float special1 = 0F; Float special1 = 0F;
Float last_special1 = 0F; Float last_special1 = 0F;
/** /**
* 特殊开关量2 * 特殊开关量2
*/ */
Float special2 = 0F; Float special2 = 0F;
Float last_special2 = 0F; Float last_special2 = 0F;
/** /**
*托盘条码 * 托盘条码
*/ */
int[] trayCode; int[] trayCode;
int[] last_trayCode; int[] last_trayCode;
/** /**
* 水箱和消防缓存位有无货 * 水箱和消防缓存位有无货
*/ */
Float storage_cache = 0F; Float storage_cache = 0F;
@@ -181,58 +181,58 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
*/ */
Integer stacker_rpm = 0; Integer stacker_rpm = 0;
Integer last_stacker_rpm = 0; Integer last_stacker_rpm = 0;
/** /**
* 电流 * 电流
*/ */
Integer stacker_electricCurrent = 0; Integer stacker_electricCurrent = 0;
Integer last_stacker_electricCurrent = 0; Integer last_stacker_electricCurrent = 0;
/** /**
* 轴运行次数 * 轴运行次数
*/ */
Integer stacker_runing_time = 0; Integer stacker_runing_time = 0;
Integer last_stacker_runing_time = 0; Integer last_stacker_runing_time = 0;
/** /**
* 轴工作时间(小时) * 轴工作时间(小时)
*/ */
Integer stacker_workingHours = 0; Integer stacker_workingHours = 0;
Integer last_stacker_workingHours = 0; Integer last_stacker_workingHours = 0;
/** /**
*载货台速度(转/分钟) * 载货台速度(转/分钟)
*/ */
Integer cargo_rpm = 0; Integer cargo_rpm = 0;
Integer last_cargo_rpm = 0; Integer last_cargo_rpm = 0;
/** /**
*载货台电流 * 载货台电流
*/ */
Integer cargo_electric_Current = 0; Integer cargo_electric_Current = 0;
Integer last_cargo_electric_Current = 0; Integer last_cargo_electric_Current = 0;
/** /**
*载货台轴工作小时数 * 载货台轴工作小时数
*/ */
Integer cargo_workingHour = 0; Integer cargo_workingHour = 0;
Integer last_cargo_workingHour = 0; Integer last_cargo_workingHour = 0;
/** /**
*载货台轴运行次数 * 载货台轴运行次数
*/ */
Integer cargo_runingTimes = 0; Integer cargo_runingTimes = 0;
Integer last_cargo_runingTimes = 0; Integer last_cargo_runingTimes = 0;
/** /**
*货叉速度(转/分钟 * 货叉速度(转/分钟
*/ */
Integer fork_rpm = 0; Integer fork_rpm = 0;
Integer last_fork_rpm = 0; Integer last_fork_rpm = 0;
/** /**
*货叉电流 * 货叉电流
*/ */
Integer fork_electric_Current = 0; Integer fork_electric_Current = 0;
Integer last_fork_electric_Current = 0; Integer last_fork_electric_Current = 0;
/** /**
*货叉轴工作时间(小时 * 货叉轴工作时间(小时
*/ */
Integer fork_workingHours = 0; Integer fork_workingHours = 0;
Integer last_fork_workingHours = 0; Integer last_fork_workingHours = 0;
/** /**
*货叉轴运行次数 * 货叉轴运行次数
*/ */
Integer fork_runingTimes = 0; Integer fork_runingTimes = 0;
Integer last_fork_runingTimes = 0; Integer last_fork_runingTimes = 0;
@@ -250,7 +250,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
List<String> getDeviceCodeList = null; List<String> getDeviceCodeList = null;
List<String> putDeviceCodeList = null; List<String> putDeviceCodeList = null;
/** /**
* 请求成功标记 * 请求成功标记
*/ */
Boolean requireSucess = false; Boolean requireSucess = false;
@@ -459,7 +459,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
//更改指令状态 //更改指令状态
if (task > 0) { if (task > 0) {
Instruction inst = checkInst(); Instruction inst = checkInst();
if (inst != null) { if (ObjectUtil.isNotEmpty(inst)) {
if (StrUtil.equals(inst.getInstruction_status(), "0")) { if (StrUtil.equals(inst.getInstruction_status(), "0")) {
inst.setInstruction_status(CommonFinalParam.ONE); inst.setInstruction_status(CommonFinalParam.ONE);
inst.setExecute_device_code(this.device_code); inst.setExecute_device_code(this.device_code);
@@ -730,7 +730,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
map.put("to_x", inst.getFrom_y()); map.put("to_x", inst.getFrom_y());
} }
if(ObjectUtil.isNotEmpty(map)){ if (ObjectUtil.isNotEmpty(map)) {
list.add(map); list.add(map);
this.writing(list); this.writing(list);
} }
@@ -828,7 +828,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
if (command == 8) { if (command == 8) {
map.put("to_command", 8); map.put("to_command", 8);
} }
if(ObjectUtil.isNotEmpty(map)){ if (ObjectUtil.isNotEmpty(map)) {
list.add(map); list.add(map);
this.writing(list); this.writing(list);
} }
@@ -873,6 +873,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
} }
/** /**
* 完成指令 * 完成指令
* *
@@ -926,7 +927,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
/** /**
* 将扩展表中的字符串数据转换成集合 * 将扩展表中的字符串数据转换成集合
*/ */
@Override @Override

View File

@@ -176,6 +176,13 @@ public interface TaskService extends CommonService<Task> {
*/ */
List<TaskDto> queryByStauts(String task_status); List<TaskDto> queryByStauts(String task_status);
/**
* 根绝状态查询缓存
* @param task_status
* @return
*/
List<TaskDto> findByTaskStatus(String task_status);
/** /**
* 根据编码查询 * 根据编码查询
* *

View File

@@ -456,7 +456,21 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return ConvertUtil.convertList(taskList, TaskDto.class); return ConvertUtil.convertList(taskList, TaskDto.class);
} }
@Override @Override
public List<TaskDto> findByTaskStatus(String status) {
List<TaskDto> taskDtoList = new ArrayList<>();
Iterator<TaskDto> iterator = tasks.iterator();
if (iterator.hasNext()) {
TaskDto task = iterator.next();
if(StrUtil.equals(task.getTask_status(), status)){
taskDtoList.add(task);
}
}
return taskDtoList;
}
public void create(TaskDto dto) throws Exception { public void create(TaskDto dto) throws Exception {
dto = foramte(dto); dto = foramte(dto);
if (!StrUtil.isEmpty(dto.getVehicle_code())) { if (!StrUtil.isEmpty(dto.getVehicle_code())) {

View File

@@ -45,8 +45,7 @@ public class CreateDDJInst {
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceExtraService deviceExtra = SpringContextHolder.getBean(DeviceExtraServiceImpl.class); List<TaskDto> taskDtos = taskserver.findByTaskStatus("0");
List<TaskDto> taskDtos = taskserver.queryByStauts("0");
List<TaskDto> taskDtoList = new ArrayList<>(); List<TaskDto> taskDtoList = new ArrayList<>();
if (CollUtil.isEmpty(taskDtos) || taskDtos.size() < 1) { if (CollUtil.isEmpty(taskDtos) || taskDtos.size() < 1) {
} else { } else {
@@ -69,7 +68,7 @@ public class CreateDDJInst {
if (ObjectUtils.isEmpty(list)) { if (ObjectUtils.isEmpty(list)) {
throw new BadRequestException("路由不通"); throw new BadRequestException("路由不通");
} }
RouteLineDto routeLineDto = (RouteLineDto) list.get(0); RouteLineDto routeLineDto = list.get(0);
String[] path = routeLineDto.getPath().split("->"); String[] path = routeLineDto.getPath().split("->");
List<String> pathlist = Arrays.asList(path); List<String> pathlist = Arrays.asList(path);
String deviceType = appService.findDeviceByCode(pathlist.get(1)).getDevice_type(); String deviceType = appService.findDeviceByCode(pathlist.get(1)).getDevice_type();
@@ -137,7 +136,6 @@ public class CreateDDJInst {
RouteLineDto routeLineDto1 = shortPathsList.get(0); RouteLineDto routeLineDto1 = shortPathsList.get(0);
String path1 = routeLineDto1.getPath(); String path1 = routeLineDto1.getPath();
String type1 = routeLineDto1.getType();
String[] str = path1.split("->"); String[] str = path1.split("->");
List<String> pathlist1 = Arrays.asList(str); List<String> pathlist1 = Arrays.asList(str);

View File

@@ -32,6 +32,7 @@
<el-date-picker <el-date-picker
v-model="value" v-model="value"
type="datetimerange" type="datetimerange"
style="height: 30.5px; display: inline-block; vertical-align: middle; margin: 0 3px 10px 0; line-height: 30.5px;"
:end-placeholder="$t('errorLog.table.end_time')" :end-placeholder="$t('errorLog.table.end_time')"
:start-placeholder="$t('errorLog.table.start_time')" :start-placeholder="$t('errorLog.table.start_time')"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"

View File

@@ -337,6 +337,11 @@
<el-form-item :label="$t('task.txt_box.Vehicle_number')"> <el-form-item :label="$t('task.txt_box.Vehicle_number')">
<el-input v-model="form.vehicle_code" style="width: 370px;" @change="isDisabled=false" /> <el-input v-model="form.vehicle_code" style="width: 370px;" @change="isDisabled=false" />
</el-form-item> </el-form-item>
<el-form-item label="扩展字段">
<div>
<el-button @click="openDialog">请选择</el-button>
</div>
</el-form-item>
<el-form-item :label="$t('task.select.Description')" prop="description"> <el-form-item :label="$t('task.select.Description')" prop="description">
<el-input v-model="form.remark" style="width: 370px;" type="textarea" @change="isDisabled=false" /> <el-input v-model="form.remark" style="width: 370px;" type="textarea" @change="isDisabled=false" />
</el-form-item> </el-form-item>
@@ -348,6 +353,58 @@
<el-button :loading="crud.cu === 2" :disabled="isDisabled" type="primary" @click="saveBtn">{{ $t('task.select.Confirm') }}</el-button> <el-button :loading="crud.cu === 2" :disabled="isDisabled" type="primary" @click="saveBtn">{{ $t('task.select.Confirm') }}</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="dialogVisible" title="扩展字段" @close="closeDialog">
<el-form>
<el-form-item>
<el-button v-if="showAddRowButton" style="color: #6b75e9;" @click="addNewRow">添加新行</el-button>
</el-form-item>
<el-form-item>
<el-form>
<el-table
style="width: 100%;"
:header-cell-style="{'text-align':'center'}"
:data="extension"
stripe
border
>
<el-table-column type="index" label="序号" min-width="50" />
<el-table-column label="扩展字段" prop="name" min-width="115">
<template slot-scope="scope">
<el-select
v-model="scope.row.name"
class="extended-field-select"
filterable
placeholder="请选择"
>
<el-option
v-for="item in dict.kezhuan"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="扩展字段值" prop="value" min-width="115">
<template slot-scope="scope">
<el-input v-model="scope.row.value" style="width: 100%" />
</template>
</el-table-column>
<el-table-column label="操作" min-width="115" align="center">
<template slot-scope="scope">
<el-button size="mini" type="danger" icon="el-icon-minus" circle @click="deleteField(scope.$index)" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-form-item>
<div class="button-container">
<el-button type="danger" @click="cancelForm">取消</el-button>
<!-- 确认按钮 -->
<el-button type="primary" @click="saveForm">确认</el-button>
</div>
</el-form>
</el-dialog>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="25" /> <el-table-column type="selection" width="25" />
@@ -459,7 +516,7 @@ import i18n from '@/i18n'
export default { export default {
name: 'Task', name: 'Task',
components: { pagination, crudOperation }, components: { pagination, crudOperation },
dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type'], dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type', 'kezhuan'],
mixins: [presenter(), header(), crud()], mixins: [presenter(), header(), crud()],
cruds() { cruds() {
return CRUD({ title: i18n.t('task.txt_box.Task'), url: 'api/task', idField: 'task_id', sort: 'task_id,desc', return CRUD({ title: i18n.t('task.txt_box.Task'), url: 'api/task', idField: 'task_id', sort: 'task_id,desc',
@@ -536,6 +593,7 @@ export default {
edit: ['admin', 'task:edit'], edit: ['admin', 'task:edit'],
del: ['admin', 'task:del'] del: ['admin', 'task:del']
}, },
showAddRowButton: true,
form: { form: {
task_id: null, task_id: null,
vehicle_code: null, vehicle_code: null,
@@ -561,6 +619,11 @@ export default {
to_z: null, to_z: null,
agv_system_type: '1' agv_system_type: '1'
}, },
extension: [{
name: '',
value: ''
}],
dialogVisible: false,
rules: { rules: {
start_point_code: [ start_point_code: [
{ required: true, message: '起点不能为空', trigger: 'change' } { required: true, message: '起点不能为空', trigger: 'change' }
@@ -595,12 +658,48 @@ export default {
}) })
}, },
methods: { methods: {
addNewRow() {
this.extension.push({
name: '',
value: ''
})
},
deleteField(index) { // 添加字段的时候删除一条数据
if (this.extension.length > 1) {
this.extension.splice(index, 1)
}
},
cancelForm() {
// 清空表单数据
this.extension = [{
name: '',
value: '' }]
this.dialogVisible = false
},
saveForm() {
// 保存表单数据
// 你可以在这里处理保存逻辑,并发送请求保存表单数据
this.extension.reduce((form, item) => {
form[item.name] = item.value
return form
}, this.form)
this.dialogVisible = false
},
saveBtn() { saveBtn() {
crudTask.add(this.form).then(res => { crudTask.add(this.form).then(res => {
this.crud.toQuery() this.crud.toQuery()
this.formDia = false this.formDia = false
this.isDisabled = true this.isDisabled = true
}) })
this.extension = [{
name: '',
value: '' }]
},
openDialog() {
this.dialogVisible = true
},
closeDialog() {
this.dialogVisible = false
}, },
// 钩子在获取表格数据之前执行false 则代表不获取数据 // 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() { [CRUD.HOOK.beforeRefresh]() {
@@ -766,4 +865,10 @@ export default {
.el-icon-arrow-down { .el-icon-arrow-down {
font-size: 12px; font-size: 12px;
} }
.button-container {
display: flex;
justify-content: flex-end;
align-items: flex-end;
}
</style> </style>

View File

@@ -31,4 +31,4 @@ export function edit(data) {
}) })
} }
export default { add, edit, del } export default { getDicts, add, edit, del }