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); noticeService.changeRead(jsonObject);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); 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: 类型 * @param type: 类型
*/ */
void createNotice(String msg, String title, String 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.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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"); res.put("data", "notice_message_update");
SocketMsg messageInfo = new SocketMsg(res, MsgType.INFO); SocketMsg messageInfo = new SocketMsg(res, MsgType.INFO);
try { try {
webSocketServer.sendInfo(messageInfo, "messageInfo"); WebSocketServer.sendInfo(messageInfo, "messageInfo");
} catch (IOException e) { } catch (IOException e) {
throw new BadRequestException(LangProcess.msg("error_Send")); 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" <select id="selectPageLeftJoin" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint"
parameterType="org.nl.wms.sch.point.service.dto.SchBasePointQuery"> parameterType="org.nl.wms.sch.point.service.dto.SchBasePointQuery">
SELECT SELECT
p.*, 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
FROM FROM
`sch_base_point` p `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> <where>
<if test="whereJson.workshop_code != null and whereJson.workshop_code != ''"> <if test="whereJson.workshop_code != null and whereJson.workshop_code != ''">
p.workshop_code = #{whereJson.workshop_code} p.workshop_code = #{whereJson.workshop_code}

View File

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

View File

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

View File

@@ -1,13 +1,7 @@
package org.nl.wms.sch.task_manage.enums; package org.nl.wms.sch.task_manage.enums;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; 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 * @Author: lyd
@@ -15,33 +9,26 @@ import java.util.List;
* @Date: 2023/5/25 * @Date: 2023/5/25
*/ */
@Getter @Getter
@AllArgsConstructor
public enum TaskDirectionEnum { 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 { private final String value;
SysDictServiceImpl bean = SpringContextHolder.getBean(SysDictServiceImpl.class); private final String label;
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();
}
}
} }

View File

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

View File

@@ -29,7 +29,7 @@
</div> </div>
</div> </div>
<span slot="reference" @click="fetchNotice"> <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-icon class="el-icon-bell" style="font-size: 22px;" />
</el-badge> </el-badge>
</span> </span>

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="app-container"> <div v-loading="loadingAll" class="app-container">
<!--工具栏--> <!--工具栏-->
<div class="head-container"> <div class="head-container">
<div v-if="crud.props.searchToggle"> <div v-if="crud.props.searchToggle">
@@ -82,6 +82,16 @@
> >
{{ $t('Notice.table.batch_reader') }} {{ $t('Notice.table.batch_reader') }}
</el-button> </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> </crudOperation>
<!--表单组件--> <!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> <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() { data() {
return { return {
permission: {}, permission: {},
loadingAll: false,
rules: { rules: {
notice_title: [ notice_title: [
{ required: true, message: '信息标题不能为空', trigger: 'blur' } { 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.notify(i18n.t('common.Operation_success'), CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery() 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', 'see': 'View',
'deal': 'Handle', 'deal': 'Handle',
'input_tip': 'Please enter the title', 'input_tip': 'Please enter the title',
'batch_reader': 'Batch Read' 'batch_reader': 'Batch Read',
'all_set_reader': 'All Read'
}, },
'reader': { 'reader': {
'title': 'Message Detail', 'title': 'Message Detail',

View File

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

View File

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

View File

@@ -55,6 +55,18 @@ export function changeRead(data) {
data: 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 }