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

@@ -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);
@@ -873,6 +873,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
} }
/** /**
* 完成指令 * 完成指令
* *

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 }