add:预警管理功能新增
This commit is contained in:
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -27,4 +28,12 @@ public interface IMdPbStoragevehicleextService extends IService<MdPbStoragevehic
|
||||
*/
|
||||
IPage<JSONObject> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
|
||||
/**
|
||||
* 全部查询
|
||||
* @param whereJson : {查询参数}
|
||||
* @return 返回结果
|
||||
*/
|
||||
List<MdPbStoragevehicleextDto> queryAll(Map whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -46,6 +46,12 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
|
||||
*/
|
||||
IPage<JSONObject> queryAllByPage(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* @param whereJson 查询条件
|
||||
*/
|
||||
List<MdPbStoragevehicleextDto> queryAll( @Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* erp查询库存
|
||||
* @param whereJson {
|
||||
|
||||
@@ -265,4 +265,71 @@
|
||||
</where>
|
||||
ORDER BY ext.create_time
|
||||
</select>
|
||||
|
||||
<select id="queryAll" resultType="org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto">
|
||||
SELECT
|
||||
ext.group_id as storagevehicleext_id,
|
||||
ext.storagevehicle_code,
|
||||
ext.pcsn,
|
||||
ext.qty_unit_name,
|
||||
ext.qty,
|
||||
ext.frozen_qty,
|
||||
ext.remark,
|
||||
ext.create_time,
|
||||
attr.struct_code,
|
||||
attr.struct_name,
|
||||
attr.stor_name,
|
||||
attr.sect_code,
|
||||
attr.sect_name,
|
||||
attr.stor_code,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
ext.material_id
|
||||
FROM
|
||||
md_pb_groupplate ext
|
||||
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.stor_id != null and param.stor_id != ''">
|
||||
AND
|
||||
attr.stor_id = #{param.stor_id}
|
||||
</if>
|
||||
|
||||
<if test="param.sect_id != null and param.sect_id != ''">
|
||||
AND
|
||||
attr.sect_id = #{param.sect_id}
|
||||
</if>
|
||||
|
||||
<if test="param.struct_code != null and param.struct_code != ''">
|
||||
AND
|
||||
(attr.struct_code LIKE #{param.struct_code} or
|
||||
attr.struct_name LIKE #{param.struct_code} )
|
||||
</if>
|
||||
|
||||
<if test="param.material_code != null and param.material_code != ''">
|
||||
AND
|
||||
(mater.material_code LIKE #{param.material_code} or
|
||||
mater.material_name LIKE #{param.material_code} )
|
||||
</if>
|
||||
|
||||
<if test="param.pcsn != null and param.pcsn != ''">
|
||||
AND
|
||||
ext.pcsn LIKE #{param.pcsn}
|
||||
</if>
|
||||
<if test="param.material_id_list != null and param.material_id_list.size() > 0">
|
||||
AND ext.material_id in
|
||||
<foreach collection="param.material_id_list" item="value" index="key" open="(" close=")" separator=",">
|
||||
#{value}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.stor_code_list != null and param.stor_code_list.size() > 0">
|
||||
AND attr.stor_code in
|
||||
<foreach collection="param.stor_code_list" item="value" index="key" open="(" close=")" separator=",">
|
||||
#{value}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ext.create_time Desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.wms.basedata_manage.service.dto;
|
||||
import lombok.Data;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/5
|
||||
@@ -20,6 +22,11 @@ public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
|
||||
*/
|
||||
private String sect_code;
|
||||
|
||||
/**
|
||||
* 仓库编码
|
||||
*/
|
||||
private String stor_code;
|
||||
|
||||
/**
|
||||
* 库区名称
|
||||
*/
|
||||
@@ -45,4 +52,13 @@ public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
private String create_time;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -31,5 +33,10 @@ public class MdPbStoragevehicleextServiceImpl extends ServiceImpl<MdPbStorageveh
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MdPbStoragevehicleextDto> queryAll(Map whereJson) {
|
||||
return this.baseMapper.queryAll(whereJson);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
package org.nl.wms.sch_manage.service.util;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.nl.wms.warehouse_manage.service.*;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningconfig;
|
||||
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningmaterial;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtSafetyforewarning;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtOverdueforewarning;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class ForewarningTask {
|
||||
|
||||
@Autowired
|
||||
private IStIvtOverdueforewarningService stIvtOverdueforewarningService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtSafetyforewarningService stIvtSafetyforewarningService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtForewarningconfigService forewarningconfigService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtForewarningmaterialService stIvtForewarningmaterialService;
|
||||
|
||||
@Autowired
|
||||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
||||
|
||||
@Autowired
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
//定时任务
|
||||
@SneakyThrows
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void run() {
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(2, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
runTask();
|
||||
}
|
||||
lock.unlock();
|
||||
} catch (Exception e) {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 预警数据生成
|
||||
* <p>
|
||||
* 1、删除st_ivt_overdueforewarning、st_ivt_safetyforewarning表中的全部数据
|
||||
* 2、查询st_ivt_forewarningconfig,获取正在启用的、未删除的配置
|
||||
* 3、通过st_ivt_forewarningconfig表的id字段,匹配上st_ivt_forewarningmaterial表的config_id字段,获取对应的物料。赋值给
|
||||
* StIvtForewarningconfigDto的tableData
|
||||
* 4、循环,判断每条数据下的对应物料的安全库存数量、入库时间(以组盘时间为准)
|
||||
* 其中库存表:md_pb_groupplate,实体类:GroupPlate,组盘时间create_time,物料编码id material_id
|
||||
* 5、 分别生成st_ivt_safetyforewarning(安全库存数量超期) 和 st_ivt_overdueforewarning(安全库存天数超期) ,插入到对应数据库中
|
||||
*/
|
||||
private void runTask() {
|
||||
// 1. 删除st_ivt_overdueforewarning、st_ivt_safetyforewarning表中的全部数据
|
||||
stIvtOverdueforewarningService.deleteAllNoParam();
|
||||
stIvtSafetyforewarningService.deleteAllNoParam();
|
||||
|
||||
// 2. 查询st_ivt_forewarningconfig,获取正在启用的、未删除的配置
|
||||
List<StIvtForewarningconfig> configList = forewarningconfigService.list(new LambdaQueryWrapper<StIvtForewarningconfig>()
|
||||
.eq(StIvtForewarningconfig::getIs_active,true)
|
||||
.eq(StIvtForewarningconfig::getIs_delete,false));
|
||||
if (CollectionUtil.isEmpty(configList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> configStringList =configList.stream().map(StIvtForewarningconfig::getId).collect(Collectors.toList());
|
||||
|
||||
// 获取配置文件下的所有物料
|
||||
List<StIvtForewarningmaterial> materialList = stIvtForewarningmaterialService.list(new LambdaQueryWrapper<StIvtForewarningmaterial>()
|
||||
.eq(StIvtForewarningmaterial::getIs_active,true)
|
||||
.eq(StIvtForewarningmaterial::getIs_delete,false)
|
||||
.in(StIvtForewarningmaterial::getConfig_id,configStringList));
|
||||
|
||||
List<String> materialIdList = materialList.stream().map(StIvtForewarningmaterial::getMaterial_id).collect(Collectors.toList());
|
||||
List<String> storCodeList = configList.stream().map(StIvtForewarningconfig::getStor_code).collect(Collectors.toList());
|
||||
// 查询库存信息
|
||||
Map<String,Object> queryMap = new HashMap();
|
||||
queryMap.put("stor_code_list",storCodeList);
|
||||
queryMap.put("material_id_list",materialIdList);
|
||||
List<MdPbStoragevehicleextDto> mdPbStoragevehicleextDtos = mdPbStoragevehicleextMapper.queryAll(queryMap);
|
||||
if (CollectionUtil.isEmpty(mdPbStoragevehicleextDtos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (StIvtForewarningconfig config : configList) {
|
||||
//3. 通过st_ivt_forewarningconfig表的id字段,匹配上st_ivt_forewarningmaterial表的config_id字段,获取对应的物料
|
||||
List<StIvtForewarningmaterial> configMaterialList = materialList.stream().
|
||||
filter(a->config.getId().equals(a.getConfig_id())).collect(Collectors.toList());
|
||||
// 4. 循环,判断每条数据下的对应物料的安全库存数量、入库时间(以组盘时间为准)
|
||||
for (StIvtForewarningmaterial material : configMaterialList) {
|
||||
|
||||
// 计算安全库存数量
|
||||
BigDecimal totalQty = mdPbStoragevehicleextDtos.stream()
|
||||
.filter(a -> config.getStor_code().equals(a.getStor_code())
|
||||
&& material.getMaterial_id().equals(a.getMaterial_id()))
|
||||
.map(MdPbStoragevehicleextDto::getQty)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
|
||||
// 计算最早的组盘时间
|
||||
LocalDateTime earliestPlate = null;
|
||||
try {
|
||||
earliestPlate = mdPbStoragevehicleextDtos.stream()
|
||||
.filter(a -> config.getStor_code().equals(a.getStor_code())
|
||||
&& material.getMaterial_id().equals(a.getMaterial_id()))
|
||||
.map(a -> {
|
||||
try {
|
||||
String createTimeStr = a.getCreate_time();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
return LocalDateTime.parse(createTimeStr, formatter);
|
||||
} catch (Exception ex) {
|
||||
// 解析失败,返回null
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.min(LocalDateTime::compareTo)
|
||||
.orElse(null);
|
||||
} catch (Exception ex) {
|
||||
// 处理整体异常
|
||||
earliestPlate = null;
|
||||
}
|
||||
// 计算 earliestPlate 与当前时间的天数差,返回int类型
|
||||
BigDecimal daysDiff = BigDecimal.ZERO;
|
||||
if (earliestPlate != null) {
|
||||
long millis = java.time.Duration.between(earliestPlate, LocalDateTime.now()).toMillis();
|
||||
daysDiff = new BigDecimal(millis)
|
||||
.divide(new BigDecimal(1000 * 60 * 60 * 24), 4, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 5. 分别生成st_ivt_safetyforewarning(安全库存数量超期) 和 st_ivt_overdueforewarning(安全库存天数超期)
|
||||
// 安全库存数量超期
|
||||
if (config.getSafe_qty() != null && totalQty.compareTo(config.getSafe_qty()) > 0) {
|
||||
StIvtSafetyforewarning safety = new StIvtSafetyforewarning();
|
||||
safety.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
safety.setConfig_id(config.getId());
|
||||
safety.setMaterial_code(material.getMaterial_code());
|
||||
safety.setMaterial_name(material.getMaterial_name());
|
||||
safety.setSafe_qty(config.getSafe_qty());
|
||||
safety.setStor_code(config.getStor_code());
|
||||
safety.setCurrent_qty(totalQty);
|
||||
safety.setCreate_name("JOB");
|
||||
safety.setCreate_time(DateUtil.now());
|
||||
stIvtSafetyforewarningService.save(safety);
|
||||
}
|
||||
|
||||
// 安全库存天数超期
|
||||
|
||||
if (config.getSafe_days() != null && daysDiff.compareTo(config.getSafe_days())>0) {
|
||||
// 将 earliestPlate 转化成 yyyy-MM-dd HH:mm:ss 的String 类型
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String earliestPlateStr = earliestPlate.format(formatter);
|
||||
|
||||
StIvtOverdueforewarning overdue = new StIvtOverdueforewarning();
|
||||
overdue.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
overdue.setConfig_id(config.getId());
|
||||
overdue.setMaterial_code(material.getMaterial_code());
|
||||
overdue.setMaterial_name(material.getMaterial_name());
|
||||
overdue.setOverdue_days(daysDiff);
|
||||
overdue.setStor_code(config.getStor_code());
|
||||
overdue.setSafe_days(config.getSafe_days());
|
||||
overdue.setInsert_time(earliestPlateStr);
|
||||
overdue.setCreate_name("JOB");
|
||||
overdue.setCreate_time(DateUtil.now());
|
||||
stIvtOverdueforewarningService.save(overdue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,11 @@ import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
/**
|
||||
* 定时任务配置
|
||||
@@ -64,4 +69,16 @@ public class QuartzConfig {
|
||||
scheduler.start();
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
@Bean(name = "wmshandlerPool")
|
||||
public ThreadPoolExecutor wmshandlerPool() {
|
||||
return new ThreadPoolExecutor(
|
||||
10, // corePoolSize
|
||||
20, // maximumPoolSize
|
||||
60, // keepAliveTime
|
||||
TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<>(1000),
|
||||
new ThreadPoolExecutor.CallerRunsPolicy()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Author: /
|
||||
@@ -36,7 +38,7 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
* 该处仅供参考
|
||||
*/
|
||||
@Resource
|
||||
@Qualifier("meshandlerPool")
|
||||
@Qualifier("wmshandlerPool")
|
||||
private ThreadPoolExecutor EXECUTOR;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.nl.wms.warehouse_manage.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.decision_manage.service.strategyConfig.dao.StStrategyConfig;
|
||||
import org.nl.wms.warehouse_manage.service.IStIvtForewarningconfigService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningconfig;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtForewarningconfigDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/stIvtForewarningconfig")
|
||||
public class StIvtForewarningconfigController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtForewarningconfigService stIvtForewarningconfigService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询预警配置")
|
||||
//@SaCheckPermission("stIvtForewarningconfig:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(stIvtForewarningconfigService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增预警配置")
|
||||
//@SaCheckPermission("stIvtForewarningconfig:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StIvtForewarningconfigDto entity){
|
||||
stIvtForewarningconfigService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改预警配置")
|
||||
//@SaCheckPermission("stIvtForewarningconfig:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StIvtForewarningconfigDto entity){
|
||||
stIvtForewarningconfigService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除预警配置")
|
||||
//@SaCheckPermission("stIvtForewarningconfig:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
stIvtForewarningconfigService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getWarningMaterial")
|
||||
@Log("查询预警物料")
|
||||
public ResponseEntity<Object> getWarningMaterial(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(stIvtForewarningconfigService.getWarningMaterial(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActive")
|
||||
@Log("修改启用状态规格")
|
||||
public ResponseEntity<Object> changeActive(@Validated @RequestBody StIvtForewarningconfigDto dao) {
|
||||
stIvtForewarningconfigService.changeActive(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.nl.wms.warehouse_manage.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.warehouse_manage.service.IStIvtOverdueforewarningService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtOverdueforewarning;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/stIvtOverdueforewarning")
|
||||
public class StIvtOverdueforewarningController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtOverdueforewarningService stIvtOverdueforewarningService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询库存超期预警")
|
||||
//@SaCheckPermission("stIvtOverdueforewarning:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(stIvtOverdueforewarningService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增库存超期预警")
|
||||
//@SaCheckPermission("stIvtOverdueforewarning:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StIvtOverdueforewarning entity){
|
||||
stIvtOverdueforewarningService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改库存超期预警")
|
||||
//@SaCheckPermission("stIvtOverdueforewarning:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StIvtOverdueforewarning entity){
|
||||
stIvtOverdueforewarningService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除库存超期预警")
|
||||
//@SaCheckPermission("stIvtOverdueforewarning:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
stIvtOverdueforewarningService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.nl.wms.warehouse_manage.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.warehouse_manage.service.IStIvtSafetyforewarningService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtSafetyforewarning;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/stIvtSafetyforewarning")
|
||||
public class StIvtSafetyforewarningController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtSafetyforewarningService stIvtSafetyforewarningService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询安全库存预警")
|
||||
//@SaCheckPermission("stIvtSafetyforewarning:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(stIvtSafetyforewarningService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增安全库存预警")
|
||||
//@SaCheckPermission("stIvtSafetyforewarning:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StIvtSafetyforewarning entity){
|
||||
stIvtSafetyforewarningService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改安全库存预警")
|
||||
//@SaCheckPermission("stIvtSafetyforewarning:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StIvtSafetyforewarning entity){
|
||||
stIvtSafetyforewarningService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除安全库存预警")
|
||||
//@SaCheckPermission("stIvtSafetyforewarning:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
stIvtSafetyforewarningService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.nl.wms.warehouse_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.decision_manage.service.strategyConfig.dao.StStrategyConfig;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningconfig;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtForewarningconfigDto;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtForewarningmaterialDto;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtOverdueforewarningDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
public interface IStIvtForewarningconfigService extends IService<StIvtForewarningconfig> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<StIvtForewarningconfig>
|
||||
*/
|
||||
IPage<StIvtForewarningconfigDto> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(StIvtForewarningconfigDto entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(StIvtForewarningconfigDto entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
List<StIvtOverdueforewarningDto> getWarningMaterial(Map whereJson);
|
||||
|
||||
/**
|
||||
* 修改启用状态
|
||||
* @param dao:实体类
|
||||
*/
|
||||
void changeActive(StIvtForewarningconfigDto dao);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.wms.warehouse_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningmaterial;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-15
|
||||
**/
|
||||
public interface IStIvtForewarningmaterialService extends IService<StIvtForewarningmaterial> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<StIvtForewarningmaterial>
|
||||
*/
|
||||
IPage<StIvtForewarningmaterial> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(StIvtForewarningmaterial entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(StIvtForewarningmaterial entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.wms.warehouse_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtOverdueforewarning;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtOverdueforewarningDto;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
public interface IStIvtOverdueforewarningService extends IService<StIvtOverdueforewarning> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<StIvtOverdueforewarning>
|
||||
*/
|
||||
IPage<StIvtOverdueforewarningDto> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(StIvtOverdueforewarning entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(StIvtOverdueforewarning entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除全部
|
||||
*/
|
||||
void deleteAllNoParam();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.warehouse_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtSafetyforewarning;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtSafetyforewarningDto;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
public interface IStIvtSafetyforewarningService extends IService<StIvtSafetyforewarning> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<StIvtSafetyforewarning>
|
||||
*/
|
||||
IPage<StIvtSafetyforewarningDto> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(StIvtSafetyforewarning entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(StIvtSafetyforewarning entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
void deleteAllNoParam();
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.wms.warehouse_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_forewarningconfig")
|
||||
public class StIvtForewarningconfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.NONE)
|
||||
/** id */
|
||||
private String id;
|
||||
|
||||
/** 方案名称 */
|
||||
private String name;
|
||||
|
||||
/** 仓库编码 */
|
||||
private String stor_code;
|
||||
|
||||
/** 安全库存数量 */
|
||||
private BigDecimal safe_qty;
|
||||
|
||||
/** 安全库存天数 */
|
||||
private BigDecimal safe_days;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否启用 */
|
||||
private Boolean is_active;
|
||||
|
||||
/** 是否删除 */
|
||||
private Boolean is_delete;
|
||||
|
||||
/** 创建id */
|
||||
private String create_id;
|
||||
|
||||
/** 创建者 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改id */
|
||||
private String update_id;
|
||||
|
||||
/** 修改者 */
|
||||
private String update_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
|
||||
/** 表达式 */
|
||||
private String cron;
|
||||
|
||||
/** 通知类型 */
|
||||
private String notify_type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.wms.warehouse_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-15
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_forewarningmaterial")
|
||||
public class StIvtForewarningmaterial implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.NONE)
|
||||
/** 明细id */
|
||||
private String id;
|
||||
|
||||
/** 预警id */
|
||||
private String config_id;
|
||||
|
||||
/** 物料标识 */
|
||||
private String material_id;
|
||||
|
||||
/** 物料编号 */
|
||||
private String material_code;
|
||||
|
||||
/** 物料名称 */
|
||||
private String material_name;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_active;
|
||||
|
||||
/** 是否删除 */
|
||||
private String is_delete;
|
||||
|
||||
/** 创建id */
|
||||
private String create_id;
|
||||
|
||||
/** 创建者 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改id */
|
||||
private String update_id;
|
||||
|
||||
/** 修改者 */
|
||||
private String update_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.wms.warehouse_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_overdueforewarning")
|
||||
public class StIvtOverdueforewarning implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.NONE)
|
||||
/** id */
|
||||
private String id;
|
||||
|
||||
/** 配置id */
|
||||
private String config_id;
|
||||
|
||||
/** 物料编码 */
|
||||
private String material_code;
|
||||
|
||||
/** 物料名称 */
|
||||
private String material_name;
|
||||
|
||||
/** 仓位编码 */
|
||||
private String stor_code;
|
||||
|
||||
/** 入库时间 */
|
||||
private String insert_time;
|
||||
|
||||
/** 超时天数 */
|
||||
private BigDecimal overdue_days;
|
||||
|
||||
/** 安全天数 */
|
||||
private BigDecimal safe_days;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否删除 */
|
||||
private String is_delete;
|
||||
|
||||
/** 创建id */
|
||||
private String create_id;
|
||||
|
||||
/** 创建者 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改id */
|
||||
private String update_id;
|
||||
|
||||
/** 修改者 */
|
||||
private String update_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.nl.wms.warehouse_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_safetyforewarning")
|
||||
public class StIvtSafetyforewarning implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.NONE)
|
||||
/** id */
|
||||
private String id;
|
||||
|
||||
/** 配置id */
|
||||
private String config_id;
|
||||
|
||||
/** 物料编码 */
|
||||
private String material_code;
|
||||
|
||||
/** 物料名称 */
|
||||
private String material_name;
|
||||
|
||||
/** 仓位编码 */
|
||||
private String stor_code;
|
||||
|
||||
/** 当前数量 */
|
||||
private BigDecimal current_qty;
|
||||
|
||||
/** 安全数量 */
|
||||
private BigDecimal safe_qty;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否删除 */
|
||||
private String is_delete;
|
||||
|
||||
/** 创建id */
|
||||
private String create_id;
|
||||
|
||||
/** 创建者 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改id */
|
||||
private String update_id;
|
||||
|
||||
/** 修改者 */
|
||||
private String update_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.warehouse_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningconfig;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtForewarningconfigDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
public interface StIvtForewarningconfigMapper extends BaseMapper<StIvtForewarningconfig> {
|
||||
IPage<StIvtForewarningconfigDto> queryAllByPage(Page<StIvtForewarningconfigDto> page, @Param("params") Map params);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.warehouse_manage.service.dao.mapper.StIvtForewarningconfigMapper">
|
||||
<select id="queryAllByPage" resultType="org.nl.wms.warehouse_manage.service.dto.StIvtForewarningconfigDto">
|
||||
SELECT config.*,stor.stor_name FROM st_ivt_forewarningconfig config
|
||||
LEFT JOIN st_ivt_bsrealstorattr stor ON config.stor_code =
|
||||
stor.stor_code
|
||||
<where>
|
||||
config.is_delete = '0'
|
||||
<if test="params.name != null">
|
||||
AND
|
||||
config.name LIKE CONCAT('%', #{params.name}, '%')
|
||||
</if>
|
||||
<if test="params.stor_code != null">
|
||||
AND
|
||||
config.stor_code = #{params.stor_code}
|
||||
</if>
|
||||
<if test="params.safe_qty != null">
|
||||
AND
|
||||
config.safe_qty = #{params.safe_qty}
|
||||
</if>
|
||||
<if test="params.safe_days != null">
|
||||
AND
|
||||
config.safe_days = #{params.safe_days}
|
||||
</if>
|
||||
<if test="params.notify_type != null">
|
||||
AND
|
||||
config.notify_type = #{params.notify_type}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY config.create_time Desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.wms.warehouse_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningmaterial;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtOverdueforewarningDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-15
|
||||
**/
|
||||
public interface StIvtForewarningmaterialMapper extends BaseMapper<StIvtForewarningmaterial> {
|
||||
List<StIvtOverdueforewarningDto> queryAllByList(@Param("params") Map params);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.warehouse_manage.service.dao.mapper.StIvtForewarningmaterialMapper">
|
||||
<select id="queryAllByList" resultType="org.nl.wms.warehouse_manage.service.dto.StIvtForewarningmaterialDto">
|
||||
SELECT material.*,base.material_name,base.material_spec,base.material_model FROM st_ivt_forewarningmaterial material
|
||||
LEFT JOIN md_me_materialbase base ON material.material_id = base.material_id
|
||||
<where>
|
||||
material.is_delete = '0'
|
||||
<if test="params.config_id != null">
|
||||
AND
|
||||
material.config_id =#{params.config_id}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY material.update_time Desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.warehouse_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtOverdueforewarning;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtOverdueforewarningDto;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
public interface StIvtOverdueforewarningMapper extends BaseMapper<StIvtOverdueforewarning> {
|
||||
IPage<StIvtOverdueforewarningDto> queryAllByPage(Page<StIvtOverdueforewarningDto> page, @Param("params") Map params);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.warehouse_manage.service.dao.mapper.StIvtOverdueforewarningMapper">
|
||||
<select id="queryAllByPage" resultType="org.nl.wms.warehouse_manage.service.dto.StIvtOverdueforewarningDto">
|
||||
SELECT forewarning.*,stor.stor_name,config.name config_name FROM st_ivt_overdueforewarning forewarning
|
||||
LEFT JOIN st_ivt_bsrealstorattr stor ON forewarning.stor_code =
|
||||
stor.stor_code
|
||||
LEFT JOIN st_ivt_forewarningconfig config ON forewarning.config_id = config.id
|
||||
<where>
|
||||
forewarning.is_delete = '0'
|
||||
<if test="params.material_code != null">
|
||||
AND
|
||||
forewarning.material_code LIKE CONCAT('%', #{params.material_code}, '%')
|
||||
</if>
|
||||
<if test="params.material_name != null">
|
||||
AND
|
||||
forewarning.material_name LIKE CONCAT('%', #{params.material_name}, '%')
|
||||
</if>
|
||||
<if test="params.stor_code != null">
|
||||
AND
|
||||
forewarning.stor_code = #{params.stor_code}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY forewarning.update_time Desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.wms.warehouse_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattrDto;
|
||||
import org.nl.wms.basedata_manage.service.dao.SectattrDto;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtSafetyforewarning;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtSafetyforewarningDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
public interface StIvtSafetyforewarningMapper extends BaseMapper<StIvtSafetyforewarning> {
|
||||
IPage<StIvtSafetyforewarningDto> queryAllByPage(Page<StIvtSafetyforewarningDto> page, @Param("params") Map params);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.warehouse_manage.service.dao.mapper.StIvtSafetyforewarningMapper">
|
||||
<select id="queryAllByPage" resultType="org.nl.wms.warehouse_manage.service.dto.StIvtSafetyforewarningDto">
|
||||
SELECT forewarning.*,stor.stor_name,config.name config_name FROM st_ivt_safetyforewarning forewarning
|
||||
LEFT JOIN st_ivt_bsrealstorattr stor ON forewarning.stor_code =
|
||||
stor.stor_code
|
||||
LEFT JOIN st_ivt_forewarningconfig config ON forewarning.config_id = config.id
|
||||
<where>
|
||||
forewarning.is_delete = '0'
|
||||
<if test="params.material_code != null">
|
||||
AND
|
||||
forewarning.material_code LIKE CONCAT('%', #{params.material_code}, '%')
|
||||
</if>
|
||||
<if test="params.material_name != null">
|
||||
AND
|
||||
forewarning.material_name LIKE CONCAT('%', #{params.material_name}, '%')
|
||||
</if>
|
||||
<if test="params.stor_code != null">
|
||||
AND
|
||||
forewarning.stor_code = #{params.stor_code}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY forewarning.update_time Desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.nl.wms.warehouse_manage.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningmaterial;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Data
|
||||
public class StIvtForewarningconfigDto implements Serializable {
|
||||
|
||||
/** id */
|
||||
private String id;
|
||||
|
||||
/** 方案名称 */
|
||||
private String name;
|
||||
|
||||
/** 仓库编码 */
|
||||
private String stor_code;
|
||||
|
||||
/** 仓库名称 */
|
||||
private String stor_name;
|
||||
|
||||
/** 安全库存数量 */
|
||||
private BigDecimal safe_qty;
|
||||
|
||||
/** 安全库存天数 */
|
||||
private BigDecimal safe_days;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否启用 */
|
||||
private Boolean is_active;
|
||||
|
||||
/** 是否删除 */
|
||||
private Boolean is_delete;
|
||||
|
||||
/** 创建id */
|
||||
private String create_id;
|
||||
|
||||
/** 创建者 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改id */
|
||||
private String update_id;
|
||||
|
||||
/** 修改者 */
|
||||
private String update_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
|
||||
/** 表达式 */
|
||||
private String cron;
|
||||
|
||||
/** 通知类型 */
|
||||
private String notify_type;
|
||||
|
||||
List<StIvtForewarningmaterial> tableData;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.warehouse_manage.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningconfig;
|
||||
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
public class StIvtForewarningconfigQuery extends BaseQuery<StIvtForewarningconfig> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.nl.wms.warehouse_manage.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-15
|
||||
**/
|
||||
@Data
|
||||
public class StIvtForewarningmaterialDto implements Serializable {
|
||||
|
||||
/** 明细id */
|
||||
private String id;
|
||||
|
||||
/** 预警id */
|
||||
private String config_id;
|
||||
|
||||
/** 物料标识 */
|
||||
private String material_id;
|
||||
|
||||
/** 物料编号 */
|
||||
private String material_code;
|
||||
|
||||
/** 物料名称 */
|
||||
private String material_name;
|
||||
|
||||
/** 物料规格 */
|
||||
private String material_spec;
|
||||
|
||||
/** 物料型号 */
|
||||
private String material_model;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_active;
|
||||
|
||||
/** 是否删除 */
|
||||
private String is_delete;
|
||||
|
||||
/** 创建id */
|
||||
private Long create_id;
|
||||
|
||||
/** 创建者 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改id */
|
||||
private Long update_id;
|
||||
|
||||
/** 修改者 */
|
||||
private String update_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.warehouse_manage.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningmaterial;
|
||||
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-15
|
||||
**/
|
||||
public class StIvtForewarningmaterialQuery extends BaseQuery<StIvtForewarningmaterial> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.nl.wms.warehouse_manage.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Data
|
||||
public class StIvtOverdueforewarningDto implements Serializable {
|
||||
|
||||
/** id */
|
||||
private String id;
|
||||
|
||||
/** 配置id */
|
||||
private String config_id;
|
||||
|
||||
private String config_name;
|
||||
|
||||
/** 物料编码 */
|
||||
private String material_code;
|
||||
|
||||
/** 物料名称 */
|
||||
private String material_name;
|
||||
|
||||
/** 仓位编码 */
|
||||
private String stor_code;
|
||||
|
||||
private String stor_name;
|
||||
|
||||
/** 入库时间 */
|
||||
private String insert_time;
|
||||
|
||||
/** 超时天数 */
|
||||
private BigDecimal overdue_days;
|
||||
|
||||
/** 安全天数 */
|
||||
private BigDecimal safe_days;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否删除 */
|
||||
private String is_delete;
|
||||
|
||||
/** 创建id */
|
||||
private String create_id;
|
||||
|
||||
/** 创建者 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改id */
|
||||
private String update_id;
|
||||
|
||||
/** 修改者 */
|
||||
private String update_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.warehouse_manage.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtOverdueforewarning;
|
||||
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
public class StIvtOverdueforewarningQuery extends BaseQuery<StIvtOverdueforewarning> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.nl.wms.warehouse_manage.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Data
|
||||
public class StIvtSafetyforewarningDto implements Serializable {
|
||||
|
||||
/** id */
|
||||
private String id;
|
||||
|
||||
/** 配置id */
|
||||
private String config_id;
|
||||
|
||||
private String config_name;
|
||||
|
||||
/** 物料编码 */
|
||||
private String material_code;
|
||||
|
||||
/** 物料名称 */
|
||||
private String material_name;
|
||||
|
||||
/** 仓位编码 */
|
||||
private String stor_code;
|
||||
|
||||
private String stor_name;
|
||||
|
||||
/** 当前数量 */
|
||||
private BigDecimal current_qty;
|
||||
|
||||
/** 安全数量 */
|
||||
private BigDecimal safe_qty;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否删除 */
|
||||
private String is_delete;
|
||||
|
||||
/** 创建id */
|
||||
private String create_id;
|
||||
|
||||
/** 创建者 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改id */
|
||||
private String update_id;
|
||||
|
||||
/** 修改者 */
|
||||
private String update_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.warehouse_manage.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtSafetyforewarning;
|
||||
|
||||
/**
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
public class StIvtSafetyforewarningQuery extends BaseQuery<StIvtSafetyforewarning> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package org.nl.wms.warehouse_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.system_manage.service.dict.dao.Dict;
|
||||
import org.nl.wms.warehouse_manage.service.IStIvtForewarningconfigService;
|
||||
import org.nl.wms.warehouse_manage.service.IStIvtForewarningmaterialService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningmaterial;
|
||||
import org.nl.wms.warehouse_manage.service.dao.mapper.StIvtForewarningconfigMapper;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningconfig;
|
||||
import org.nl.wms.warehouse_manage.service.dao.mapper.StIvtForewarningmaterialMapper;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtForewarningconfigDto;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtForewarningmaterialDto;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtOverdueforewarningDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class StIvtForewarningconfigServiceImpl extends ServiceImpl<StIvtForewarningconfigMapper, StIvtForewarningconfig> implements IStIvtForewarningconfigService {
|
||||
|
||||
@Autowired
|
||||
private StIvtForewarningconfigMapper stIvtForewarningconfigMapper;
|
||||
|
||||
@Autowired
|
||||
private IStIvtForewarningmaterialService iStIvtForewarningmaterialService;
|
||||
|
||||
@Autowired
|
||||
private StIvtForewarningmaterialMapper stIvtForewarningmaterialMapper;
|
||||
|
||||
@Override
|
||||
public IPage<StIvtForewarningconfigDto> queryAll(Map whereJson, PageQuery page){
|
||||
return stIvtForewarningconfigMapper.queryAllByPage(new Page<>(page.getPage() +1 ,page.getSize()), whereJson);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(StIvtForewarningconfigDto dto) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setCreate_time(now);
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_name(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
StIvtForewarningconfig entity = BeanUtil.copyProperties(dto, StIvtForewarningconfig.class);
|
||||
List<StIvtForewarningmaterial> stIvtForewarningmaterialList = dto.getTableData();
|
||||
|
||||
if( stIvtForewarningconfigMapper.insert(entity)>0) {
|
||||
stIvtForewarningmaterialList.forEach(stIvtForewarningmaterial -> {
|
||||
stIvtForewarningmaterial.setConfig_id(dto.getId());
|
||||
iStIvtForewarningmaterialService.create(stIvtForewarningmaterial);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(StIvtForewarningconfigDto dto) {
|
||||
StIvtForewarningconfig entity = stIvtForewarningconfigMapper.selectById(dto.getId());
|
||||
if (dto == null) throw new BadRequestException(LangProcess.msg("error_SystemAuthError"));
|
||||
|
||||
entity = BeanUtil.copyProperties(dto, StIvtForewarningconfig.class);
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
List<StIvtForewarningmaterial> stIvtForewarningmaterialList = dto.getTableData();
|
||||
|
||||
if( stIvtForewarningconfigMapper.updateById(entity)>0) {
|
||||
stIvtForewarningmaterialMapper.delete(new LambdaQueryWrapper<StIvtForewarningmaterial>()
|
||||
.eq(StIvtForewarningmaterial::getConfig_id,dto.getId()));
|
||||
stIvtForewarningmaterialList.forEach(stIvtForewarningmaterial -> {
|
||||
stIvtForewarningmaterial.setConfig_id(dto.getId());
|
||||
iStIvtForewarningmaterialService.create(stIvtForewarningmaterial);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
if (stIvtForewarningconfigMapper.deleteBatchIds(ids) > 0) {
|
||||
stIvtForewarningmaterialMapper.delete(new LambdaQueryWrapper<StIvtForewarningmaterial>()
|
||||
.in(StIvtForewarningmaterial::getConfig_id, ids));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StIvtOverdueforewarningDto> getWarningMaterial(Map whereJson) {
|
||||
return stIvtForewarningmaterialMapper.queryAllByList(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeActive(StIvtForewarningconfigDto dao) {
|
||||
if(StringUtils.isBlank(dao.getId())){
|
||||
return;
|
||||
}
|
||||
Boolean isUsed = true;
|
||||
if (dao.getIs_active()) {
|
||||
isUsed = false;
|
||||
}
|
||||
StIvtForewarningconfig stIvtForewarningconfig = stIvtForewarningconfigMapper.selectById(dao.getId());
|
||||
stIvtForewarningconfig.setIs_active(isUsed);
|
||||
stIvtForewarningconfig.setUpdate_time(DateUtil.now());
|
||||
stIvtForewarningconfig.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
this.updateById(stIvtForewarningconfig);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package org.nl.wms.warehouse_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.warehouse_manage.service.IStIvtForewarningmaterialService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.mapper.StIvtForewarningmaterialMapper;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningmaterial;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-15
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class StIvtForewarningmaterialServiceImpl extends ServiceImpl<StIvtForewarningmaterialMapper, StIvtForewarningmaterial> implements IStIvtForewarningmaterialService {
|
||||
|
||||
@Autowired
|
||||
private StIvtForewarningmaterialMapper stIvtForewarningmaterialMapper;
|
||||
|
||||
@Override
|
||||
public IPage<StIvtForewarningmaterial> queryAll(Map whereJson, PageQuery page){
|
||||
LambdaQueryWrapper<StIvtForewarningmaterial> lam = new LambdaQueryWrapper<>();
|
||||
IPage<StIvtForewarningmaterial> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
stIvtForewarningmaterialMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(StIvtForewarningmaterial entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
stIvtForewarningmaterialMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(StIvtForewarningmaterial entity) {
|
||||
StIvtForewarningmaterial dto = stIvtForewarningmaterialMapper.selectById(entity.getId());
|
||||
if (dto == null) throw new BadRequestException(LangProcess.msg("error_SystemAuthError"));
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
stIvtForewarningmaterialMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
stIvtForewarningmaterialMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package org.nl.wms.warehouse_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.warehouse_manage.service.IStIvtOverdueforewarningService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.mapper.StIvtOverdueforewarningMapper;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtOverdueforewarning;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtOverdueforewarningDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class StIvtOverdueforewarningServiceImpl extends ServiceImpl<StIvtOverdueforewarningMapper, StIvtOverdueforewarning> implements IStIvtOverdueforewarningService {
|
||||
|
||||
@Autowired
|
||||
private StIvtOverdueforewarningMapper stIvtOverdueforewarningMapper;
|
||||
|
||||
@Override
|
||||
public IPage<StIvtOverdueforewarningDto> queryAll(Map whereJson, PageQuery page){
|
||||
return stIvtOverdueforewarningMapper.queryAllByPage(new Page<>(page.getPage() +1 ,page.getSize()), whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(StIvtOverdueforewarning entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
stIvtOverdueforewarningMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(StIvtOverdueforewarning entity) {
|
||||
StIvtOverdueforewarning dto = stIvtOverdueforewarningMapper.selectById(entity.getId());
|
||||
if (dto == null) throw new BadRequestException(LangProcess.msg("error_SystemAuthError"));
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
stIvtOverdueforewarningMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
stIvtOverdueforewarningMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllNoParam() {
|
||||
// 真删除
|
||||
stIvtOverdueforewarningMapper.deleteByMap(null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package org.nl.wms.warehouse_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.BsrealStorattrMapper;
|
||||
import org.nl.wms.warehouse_manage.service.IStIvtSafetyforewarningService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtForewarningconfig;
|
||||
import org.nl.wms.warehouse_manage.service.dao.mapper.StIvtForewarningconfigMapper;
|
||||
import org.nl.wms.warehouse_manage.service.dao.mapper.StIvtSafetyforewarningMapper;
|
||||
import org.nl.wms.warehouse_manage.service.dao.StIvtSafetyforewarning;
|
||||
import org.nl.wms.warehouse_manage.service.dto.StIvtSafetyforewarningDto;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author zhengxuming
|
||||
* @date 2025-07-14
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class StIvtSafetyforewarningServiceImpl extends ServiceImpl<StIvtSafetyforewarningMapper, StIvtSafetyforewarning> implements IStIvtSafetyforewarningService {
|
||||
|
||||
@Autowired
|
||||
private StIvtSafetyforewarningMapper stIvtSafetyforewarningMapper;
|
||||
|
||||
@Autowired
|
||||
private StIvtForewarningconfigMapper stIvtForewarningconfigMapper;
|
||||
|
||||
@Autowired
|
||||
private BsrealStorattrMapper bsrealStorattrMapper;
|
||||
|
||||
@Override
|
||||
public IPage<StIvtSafetyforewarningDto> queryAll(Map whereJson, PageQuery page) {
|
||||
return stIvtSafetyforewarningMapper.queryAllByPage(new Page<>(page.getPage() +1 ,page.getSize()), whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(StIvtSafetyforewarning entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
stIvtSafetyforewarningMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(StIvtSafetyforewarning entity) {
|
||||
StIvtSafetyforewarning dto = stIvtSafetyforewarningMapper.selectById(entity.getId());
|
||||
if (dto == null) throw new BadRequestException(LangProcess.msg("error_SystemAuthError"));
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
stIvtSafetyforewarningMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
stIvtSafetyforewarningMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllNoParam() {
|
||||
// 真删除
|
||||
stIvtSafetyforewarningMapper.deleteByMap(null);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user