opt: 通知、点位管理、任务自动创建

This commit is contained in:
2025-09-28 14:44:23 +08:00
parent e69f55c046
commit 7b6fe148f0
14 changed files with 93 additions and 54 deletions

View File

@@ -95,4 +95,10 @@ public class SysNoticeController {
noticeService.changeRead(jsonObject);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("全部已读")
@PostMapping("/allRead")
public ResponseEntity<Object> allRead(@RequestBody JSONObject jsonObject) {
noticeService.allRead(jsonObject);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

View File

@@ -81,4 +81,6 @@ public interface ISysNoticeService extends IService<SysNotice> {
* @param type: 类型
*/
void createNotice(String msg, String title, String type);
void allRead(JSONObject jsonObject);
}

View File

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -183,10 +184,19 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
res.put("data", "notice_message_update");
SocketMsg messageInfo = new SocketMsg(res, MsgType.INFO);
try {
webSocketServer.sendInfo(messageInfo, "messageInfo");
WebSocketServer.sendInfo(messageInfo, "messageInfo");
} catch (IOException e) {
throw new BadRequestException(LangProcess.msg("error_Send"));
}
}
@Override
public void allRead(JSONObject jsonObject) {
LambdaUpdateWrapper<SysNotice> lam = new LambdaUpdateWrapper<>();
lam.set(SysNotice::getHave_read, "2")
.set(SysNotice::getRead_time, DateUtil.now())
.eq(SysNotice::getHave_read, "1");
this.update(lam);
}
}

View File

@@ -15,18 +15,9 @@
<select id="selectPageLeftJoin" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint"
parameterType="org.nl.wms.sch.point.service.dto.SchBasePointQuery">
SELECT
p.*,
IF(LENGTH(vg.material_qty)>0,vg.material_qty,0) AS material_qty,
IF(LENGTH(mm.material_code)>0,mm.material_code,'-') AS material_code,
IF(LENGTH(mm.material_name)>0,mm.material_name,'-') AS material_name,
IF(LENGTH(mm.material_spec)>0,mm.material_spec,'-') AS material_spec,
IF(LENGTH(mm.material_model)>0,mm.material_model,'-') AS material_model,
IF(LENGTH(mm.raw_material_code)>0,mm.raw_material_code,'-') AS raw_material_code
p.*
FROM
`sch_base_point` p
LEFT JOIN sch_base_vehiclematerialgroup vg ON vg.vehicle_code = p.vehicle_code
AND vg.vehicle_type = p.vehicle_type AND vg.group_bind_material_status = '2'
LEFT JOIN md_base_material mm ON mm.material_id = vg.material_id
<where>
<if test="whereJson.workshop_code != null and whereJson.workshop_code != ''">
p.workshop_code = #{whereJson.workshop_code}

View File

@@ -194,15 +194,26 @@ public abstract class AbstractTask {
* @param taskConfig
* @param task
* @param apply_point_code
* @see TaskDirectionEnum
*/
protected void setTaskPoint(SchBaseTaskconfig taskConfig, SchBaseTask task, String apply_point_code) {
String taskDirection = taskConfig.getTask_direction();
if (TaskDirectionEnum.SEND.getValue().equals(taskDirection)) {
switch (taskDirection) {
case "1":
task.setPoint_code1(apply_point_code);
} else {
break;
case "2":
task.setPoint_code2(apply_point_code);
break;
case "3":
task.setPoint_code3(apply_point_code);
break;
case "4":
task.setPoint_code4(apply_point_code);
break;
default:
break;
}
}
/**
@@ -251,7 +262,6 @@ public abstract class AbstractTask {
SchBaseTask task = new SchBaseTask();
// 请求点
String applyPointCode = param.getString("device_code");
String requestNo = param.getString("requestNo");
String configCode = param.getString("config_code");
// 1、校验数据
@@ -276,13 +286,14 @@ public abstract class AbstractTask {
AbstractTask bean = SpringContextHolder.getBean(this.getClass());
// 2、创建申请任务
// task.setAcs_trace_id(requestNo);
task.setTask_id(IdUtil.getSnowflake(1, 1).nextIdStr());
task.setTask_code(IdUtil.getSnowflake(1, 1).nextIdStr());
task.setConfig_code(configCode);
task.setVehicle_code(vehicleCode);
task.setVehicle_type(vehicleType);
task.setTask_status(TaskStatus.APPLY.getCode());
// 设置起/终点
bean.setTaskPoint(taskConfig, task, applyPointCode);
// 将所有参数存到表中,后续需要可以提取
task.setRequest_param(JSONObject.toJSONString(param));
TaskUtils.setCreateByAcsOrPda(task, param);

View File

@@ -8,7 +8,6 @@ import org.reflections.Reflections;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
@@ -49,12 +48,8 @@ public class AutoCreateTask {
subTypes.forEach(clz -> {
// 调用AbstractAcsTask类的每个子类的schedule()方法
try {
Object obj = SpringContextHolder.getBean(clz);
Method m = obj.getClass().getMethod("schedule");
m.invoke(obj);
} catch (InvocationTargetException e) {
e.printStackTrace();
log.info("定时器执行失败:{}", e.getTargetException().getMessage());
AbstractTask obj = SpringContextHolder.getBean(clz);
obj.schedule();
} catch (Exception e) {
e.printStackTrace();
log.info("定时器执行失败:{}", e.getMessage());

View File

@@ -1,13 +1,7 @@
package org.nl.wms.sch.task_manage.enums;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.dict.dao.Dict;
import org.nl.system.service.dict.impl.SysDictServiceImpl;
import java.util.List;
/**
* @Author: lyd
@@ -15,33 +9,26 @@ import java.util.List;
* @Date: 2023/5/25
*/
@Getter
@AllArgsConstructor
public enum TaskDirectionEnum {
/**
* 送货
*/
SEND,
POINT1_CONFIRM("1", "取货点1确认"),
/**
* 取货
*/
CALL,
POINT2_CONFIRM("2", "放货点1确认"),
/**
* 移货
*/
MOVE;
POINT3_CONFIRM("3", "取货点2确认"),
POINT4_CONFIRM("4", "放货点2确认"),
POINT_NO_CONFIRM("5", "无确认"),
private String value;
private String label;
;
static {
SysDictServiceImpl bean = SpringContextHolder.getBean(SysDictServiceImpl.class);
List<Dict> taskDirection = bean.list(new LambdaQueryWrapper<Dict>()
.eq(Dict::getCode, "task_direction")
.orderByAsc(Dict::getDict_sort));
TaskDirectionEnum[] values = TaskDirectionEnum.values();
for (int i = 0; i < values.length; i++) {
values[i].value = taskDirection.get(i).getValue();
values[i].label = taskDirection.get(i).getLabel();
}
}
private final String value;
private final String label;
}

View File

@@ -70,7 +70,7 @@ public class DemoTask extends AbstractTask {
// 进行找点创建任务,补齐任务数据
// ....
// 找终点
SchBasePoint point = findNextPoint(nextRegionStr);
SchBasePoint point = this.findNextPoint(nextRegionStr);
if (ObjectUtil.isEmpty(point)) {
task.setRemark("未找到所需点位!");
taskService.updateById(task);

View File

@@ -29,7 +29,7 @@
</div>
</div>
<span slot="reference" @click="fetchNotice">
<el-badge :value="notReadMsgCount" :hidden="notReadMsgCount==0">
<el-badge :value="notReadMsgCount" :max="99" :hidden="notReadMsgCount==0">
<el-icon class="el-icon-bell" style="font-size: 22px;" />
</el-badge>
</span>

View File

@@ -1,5 +1,5 @@
<template>
<div class="app-container">
<div v-loading="loadingAll" class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
@@ -82,6 +82,16 @@
>
{{ $t('Notice.table.batch_reader') }}
</el-button>
<el-button
slot="right"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-circle-check"
@click="allSetRead"
>
{{ $t('Notice.table.all_set_reader') }}
</el-button>
</crudOperation>
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
@@ -244,6 +254,7 @@ export default {
data() {
return {
permission: {},
loadingAll: false,
rules: {
notice_title: [
{ required: true, message: '信息标题不能为空', trigger: 'blur' }
@@ -308,6 +319,17 @@ export default {
this.crud.notify(i18n.t('common.Operation_success'), CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
allSetRead() {
this.loadingAll = true
const param = {}
crudNotice.allRead(param).then(() => {
this.$bus.emit(NOTICE_MESSAGE_UPDATE)
this.crud.notify(i18n.t('common.Operation_success'), CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
}).finally(() => {
this.loadingAll = false
})
}
}
}

View File

@@ -12,7 +12,8 @@ export default {
'see': 'View',
'deal': 'Handle',
'input_tip': 'Please enter the title',
'batch_reader': 'Batch Read'
'batch_reader': 'Batch Read',
'all_set_reader': 'All Read'
},
'reader': {
'title': 'Message Detail',

View File

@@ -12,7 +12,8 @@ export default {
'see': 'Memeriksa',
'deal': 'Beroperasi',
'input_tip': 'Silakan masukkan judul',
'batch_reader': 'Bacaan Batch'
'batch_reader': 'Bacaan Batch',
'all_set_reader': 'Bacaan All'
},
'reader': {
'title': 'Detail Pesan',

View File

@@ -12,7 +12,8 @@ export default {
'see': '查看',
'deal': '处理',
'input_tip': '请输入标题',
'batch_reader': '批量已读'
'batch_reader': '批量已读',
'all_set_reader': '全部设置已读'
},
'reader': {
'title': '消息详情',

View File

@@ -55,6 +55,18 @@ export function changeRead(data) {
data: data
})
}
/**
* 批量已读
* @param data
* @returns {*}
*/
export function allRead(data) {
return request({
url: 'api/notice/allRead',
method: 'post',
data: data
})
}
/**
* 查看消息
@@ -91,4 +103,4 @@ export function edit(data) {
})
}
export default { add, edit, del, pageByReceive, countByReceiveNotRead, read, findById, deal, changeRead }
export default { add, edit, del, pageByReceive, countByReceiveNotRead, read, findById, deal, changeRead, allRead }