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);
|
||||
}
|
||||
|
||||
}
|
||||
48
nladmin-ui/src/api/forewarning.js
Normal file
48
nladmin-ui/src/api/forewarning.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 安全库存配置
|
||||
export function getSafeStockConfigs() {
|
||||
return request({
|
||||
url: '/api/safeStockConfig',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function saveSafeStockConfig(data) {
|
||||
return request({
|
||||
url: '/api/safeStockConfig',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateSafeStockConfig(data) {
|
||||
return request({
|
||||
url: '/api/safeStockConfig',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteSafeStockConfig(id) {
|
||||
return request({
|
||||
url: `/api/safeStockConfig/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 安全库存预警结果
|
||||
export function getSafetyStockWarningResults() {
|
||||
return request({
|
||||
url: '/api/safetyStockWarningResult',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 库存超期预警结果
|
||||
export function getOverdueStockWarningResults() {
|
||||
return request({
|
||||
url: '/api/overdueStockWarningResult',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="crud.status.title"
|
||||
append-to-body
|
||||
fullscreen
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
||||
width="1200px"
|
||||
@open="open"
|
||||
@close="close"
|
||||
>
|
||||
<el-row v-show="crud.status.cu > 0" :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span />
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form ref="form" :model="form" label-width="100px" :rules="rules" class="custom-form-spacing">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="方案名称" prop="name">
|
||||
<el-input v-model="form.name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="仓库名称" prop="stor_code">
|
||||
<el-select
|
||||
v-model="form.stor_code"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stors"
|
||||
:key="item.stor_code"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="安全库存天数" prop="safe_days">
|
||||
<el-input v-model="form.safe_days" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="安全库存数量" prop="safe_qty">
|
||||
<el-input v-model="form.safe_qty" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="表达式" prop="cron">
|
||||
<el-input v-model="form.cron" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>-->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="通知类型" prop="notify_type">
|
||||
<el-select v-model="form.notify_type" filterable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in dict.NOTIFY_TYPE"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
style="width: 400px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<div class="crud-opts2" style="margin-bottom: 5px;">
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left" />
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="insertEvent()"
|
||||
>
|
||||
添加预警物料
|
||||
</el-button>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="form.tableData"
|
||||
style="width: 100%;"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column show-overflow-tooltip width="300px" prop="material_code" label="物料编码" />
|
||||
<el-table-column show-overflow-tooltip width="300px" prop="material_name" label="物料名称" />
|
||||
<el-table-column show-overflow-tooltip width="300px" prop="material_spec" label="物料规格" />
|
||||
<el-table-column show-overflow-tooltip width="300px" prop="material_model" label="物料型号" />
|
||||
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="0" fixed="right">
|
||||
<template scope="scope">
|
||||
<el-button
|
||||
type="danger"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
icon="el-icon-delete"
|
||||
@click.native.prevent="deleteRow(scope.$index, form.tableData)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<AddMaterial :dialog-show.sync="dtlShow" @tableChanged="tableChanged" />
|
||||
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CRUD, { crud, form } from '@crud/crud'
|
||||
import AddMaterial from '@/views/wms/forewarning_management/forewarning_config/AddMaterial'
|
||||
import stIvtForewarningconfig from '@/views/wms/forewarning_management/forewarning_config/stIvtForewarningconfig'
|
||||
import crudBsrealstorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
import crudStorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
|
||||
const defaultForm = {
|
||||
bill_code: '',
|
||||
stor_code: '',
|
||||
bill_status: '10',
|
||||
total_qty: '0',
|
||||
detail_count: '0',
|
||||
bill_type: '',
|
||||
remark: '',
|
||||
biz_date: new Date(),
|
||||
create_mode: '',
|
||||
tableData: []
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
components: { AddMaterial },
|
||||
mixins: [crud(), form(defaultForm)],
|
||||
dicts: ['io_bill_status', 'ST_QUALITY_SCODE', 'ST_INV_IN_TYPE', 'NOTIFY_TYPE'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
dtlShow: false,
|
||||
bill_btn: false,
|
||||
mater_btn: false,
|
||||
storlist: [],
|
||||
billtypelist: [],
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '方案名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
stor_code: [
|
||||
{ required: true, message: '仓库编码不能为空', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
stors: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudStorattr.getStor().then(res => {
|
||||
this.stors = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
crudBsrealstorattr.getStor().then(res => {
|
||||
this.storlist = res
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('AddChanged')
|
||||
},
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
// 获取预警物料
|
||||
stIvtForewarningconfig.getWarningMaterial({ 'config_id': this.form.id }).then(res => {
|
||||
this.form.tableData = res
|
||||
// 将明细变成不可编辑
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
const row = this.form.tableData[i]
|
||||
this.form.tableData.splice(i, 1, row)
|
||||
}
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.afterToAdd]() {
|
||||
this.bill_btn = false
|
||||
this.mater_btn = false
|
||||
},
|
||||
[CRUD.HOOK.afterToView]() {
|
||||
this.bill_btn = true
|
||||
this.mater_btn = true
|
||||
stIvtForewarningconfig.getWarningMaterial({ 'bill_code': this.form.id }).then(res => {
|
||||
this.form.tableData = res
|
||||
// 将明细变成不可编辑
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
const row = this.form.tableData[i]
|
||||
this.form.tableData.splice(i, 1, row)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
// 提交前校验
|
||||
if (this.form.tableData.length === 0) {
|
||||
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
},
|
||||
billTypeChange(val) {
|
||||
if (val === '000101') {
|
||||
this.bill_btn = false
|
||||
this.mater_btn = true
|
||||
} else if (val === '000102') {
|
||||
this.bill_btn = true
|
||||
this.mater_btn = false
|
||||
} else {
|
||||
this.bill_btn = true
|
||||
this.mater_btn = true
|
||||
}
|
||||
this.form.tableData = []
|
||||
this.form.total_qty = 0
|
||||
this.form.detail_count = 0
|
||||
},
|
||||
fun(val) {
|
||||
return Number(val).toFixed(3)
|
||||
},
|
||||
async insertdtl() {
|
||||
if (this.form.bill_type === '') {
|
||||
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
deleteRow(index, rows) {
|
||||
rows.splice(index, 1)
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
|
||||
tableChanged(rows) {
|
||||
// 对新增的行进行校验不能存在相同物料批次
|
||||
this.form.tableData = rows
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
async insertEvent(row) {
|
||||
if (this.form.stor_code === '') {
|
||||
this.crud.notify('请选择仓库!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
this.dtlShow = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.crud-opts2 {
|
||||
padding: 4px 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .crud-opts-right2 {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.custom-form-spacing .el-row {
|
||||
margin-bottom: 24px; /* 或你想要的间距 */
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="物料新增"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="1000px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="物料编码/物料名称"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<rrOperation />
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation />
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="multipleTable"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column
|
||||
show-overflow-tooltip
|
||||
:min-width="flexWidth('material_code', crud.data, '物料编码')"
|
||||
prop="material_code"
|
||||
label="物料编码"
|
||||
/>
|
||||
<el-table-column
|
||||
show-overflow-tooltip
|
||||
:min-width="flexWidth('material_name', crud.data, '物料名称')"
|
||||
prop="material_name"
|
||||
label="物料名称"
|
||||
/>
|
||||
<el-table-column
|
||||
show-overflow-tooltip
|
||||
width="300px"
|
||||
prop="material_spec"
|
||||
label="物料规格"
|
||||
/>
|
||||
<el-table-column
|
||||
show-overflow-tooltip
|
||||
:min-width="flexWidth('material_model', crud.data, '物料型号')"
|
||||
prop="material_model"
|
||||
label="物料型号"
|
||||
/>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false;query.search=''">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
export default {
|
||||
name: 'AddMaterial',
|
||||
components: { crudOperation, rrOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '物料',
|
||||
url: '/api/Materia',
|
||||
crudMethod: {},
|
||||
optShow: {
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
rows: [],
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
close() {
|
||||
this.query.search = ''
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
submit() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.rows = this.$refs.multipleTable.selection
|
||||
console.log('获取的rows:')
|
||||
console.log(this.rows)
|
||||
this.$emit('tableChanged', this.rows)
|
||||
// crudRawAssist.queryBoxMater(this.rows).then(res => {
|
||||
// this.rows = res
|
||||
// this.$emit('tableChanged', this.rows)
|
||||
// })
|
||||
// this.form = this.$options.data().form
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,270 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<label class="el-form-item-label">方案名称</label>
|
||||
<el-input v-model="query.name" clearable placeholder="方案名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">仓库名称</label>
|
||||
<el-select
|
||||
v-model="query.stor_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="仓库名称"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stors"
|
||||
:key="item.stor_code"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_code"
|
||||
/>
|
||||
</el-select> <label class="el-form-item-label">安全库存数量</label>
|
||||
<el-input v-model="query.safe_qty" clearable placeholder="安全库存数量" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">安全库存天数</label>
|
||||
<el-input v-model="query.safe_days" clearable placeholder="安全库存天数" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">通知类型</label>
|
||||
<el-select
|
||||
v-model="query.notify_type"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="通知类型"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.NOTIFY_TYPE"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<rrOperation :crud="crud" />
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="80%"
|
||||
>
|
||||
<el-form ref="form" :model="form" label-width="100px" :rules="rules" class="custom-form-spacing">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="方案名称" prop="name">
|
||||
<el-input v-model="form.name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="仓库名称" prop="stor_code">
|
||||
<el-select
|
||||
v-model="form.stor_code"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stors"
|
||||
:key="item.stor_code"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="安全库存天数" prop="safe_days">
|
||||
<el-input v-model="form.safe_days" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="安全库存数量" prop="safe_qty">
|
||||
<el-input v-model="form.safe_qty" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="表达式" prop="cron">
|
||||
<el-input v-model="form.cron" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="通知类型" prop="notify_type">
|
||||
<el-select v-model="form.notify_type" filterable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in dict.NOTIFY_TYPE"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
style="width: 400px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="name" label="方案名称" :min-width="flexWidth('name',crud.data,'方案名称')" />
|
||||
<el-table-column prop="stor_name" label="仓库名称" :min-width="flexWidth('stor_name',crud.data,'仓库名称')" />
|
||||
<el-table-column prop="safe_qty" label="安全库存数量" :min-width="flexWidth('safe_qty',crud.data,'安全库存数量')" />
|
||||
<el-table-column prop="safe_days" label="安全库存天数" :min-width="flexWidth('safe_days',crud.data,'安全库存天数')" />
|
||||
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
|
||||
<el-table-column label="是否启用" align="center" prop="is_active">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
:value="scope.row.is_active"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
@change="changeEnabled(scope.row, scope.row.is_active)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="cron" label="表达式" :min-width="flexWidth('cron',crud.data,'表达式')" />
|
||||
<el-table-column prop="notify_type" label="通知类型" :min-width="flexWidth('notify_type',crud.data,'通知类型')">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.NOTIFY_TYPE[scope.row.notify_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<AddDialog @AddChanged="querytable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudStIvtForewarningconfig from './stIvtForewarningconfig'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudStorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
import AddDialog from '@/views/wms/forewarning_management/forewarning_config/AddDialog.vue'
|
||||
import stIvtForewarningconfig from '@/views/wms/forewarning_management/forewarning_config/stIvtForewarningconfig'
|
||||
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
name: null,
|
||||
stor_code: null,
|
||||
safe_qty: null,
|
||||
safe_days: null,
|
||||
remark: null,
|
||||
is_active: null,
|
||||
is_delete: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_id: null,
|
||||
update_name: null,
|
||||
update_time: null,
|
||||
cron: null,
|
||||
notify_type: null
|
||||
}
|
||||
export default {
|
||||
name: 'StIvtForewarningconfig',
|
||||
components: { AddDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
dicts: ['NOTIFY_TYPE'],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '预警配置',
|
||||
url: 'api/stIvtForewarningconfig',
|
||||
idField: 'id',
|
||||
sort: 'id,desc',
|
||||
crudMethod: { ...crudStIvtForewarningconfig }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '方案名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
stor_code: [
|
||||
{ required: true, message: '仓库编码不能为空', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
queryTypeOptions: [
|
||||
{ key: 'name', display_name: '方案名称' },
|
||||
{ key: 'stor_code', display_name: '仓库编码' },
|
||||
{ key: 'safe_qty', display_name: '安全库存数量' },
|
||||
{ key: 'safe_days', display_name: '安全库存天数' },
|
||||
{ key: 'notify_type', display_name: '通知类型' }
|
||||
],
|
||||
stors: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudStorattr.getStor().then(res => {
|
||||
this.stors = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
querytable() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
changeEnabled(data, val) {
|
||||
let msg = '此操作将停用,是否继续!'
|
||||
if (val !== true) {
|
||||
msg = '此操作将启用,是否继续!'
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
stIvtForewarningconfig.changeActive(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
data.is_active = !data.is_active
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.custom-form-spacing .el-form-item {
|
||||
margin-bottom: 24px; /* 或你想要的间距 */
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,43 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/stIvtForewarningconfig',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/stIvtForewarningconfig/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/stIvtForewarningconfig',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getWarningMaterial(params) {
|
||||
return request({
|
||||
url: '/api/stIvtForewarningconfig/getWarningMaterial',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function changeActive(data) {
|
||||
return request({
|
||||
url: 'api/stIvtForewarningconfig/changeActive',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getWarningMaterial, changeActive }
|
||||
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<label class="el-form-item-label">物料编码</label>
|
||||
<el-input v-model="query.material_code" clearable placeholder="物料编码" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">物料名称</label>
|
||||
<el-input v-model="query.material_name" clearable placeholder="物料名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">仓库名称</label>
|
||||
<el-select
|
||||
v-model="query.stor_code"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stors"
|
||||
:key="item.stor_code"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_code"
|
||||
/>
|
||||
</el-select>
|
||||
<rrOperation :crud="crud" />
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="config_name" label="配置名称" :min-width="flexWidth('config_name',crud.data,'配置名称')" />
|
||||
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||||
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
|
||||
<el-table-column prop="stor_code" label="仓库编码" :min-width="flexWidth('stor_code',crud.data,'仓库编码')" />
|
||||
<el-table-column prop="stor_name" label="仓库名称" :min-width="flexWidth('stor_name',crud.data,'仓库名称')" />
|
||||
<el-table-column prop="insert_time" label="入库时间" :min-width="flexWidth('insert_time',crud.data,'入库时间')" />
|
||||
<el-table-column prop="overdue_days" label="超时天数" :min-width="flexWidth('overdue_days',crud.data,'超时天数')" />
|
||||
<el-table-column prop="safe_days" label="安全天数" :min-width="flexWidth('safe_days',crud.data,'安全天数')" />
|
||||
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudStIvtOverdueforewarning from './stIvtOverdueforewarning'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudStorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
config_id: null,
|
||||
material_code: null,
|
||||
material_name: null,
|
||||
stor_code: null,
|
||||
insert_time: null,
|
||||
overdue_days: null,
|
||||
safe_days: null,
|
||||
remark: null,
|
||||
is_delete: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_id: null,
|
||||
update_name: null,
|
||||
update_time: null
|
||||
}
|
||||
export default {
|
||||
name: 'StIvtOverdueforewarning',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '库存超期预警',
|
||||
url: 'api/stIvtOverdueforewarning',
|
||||
idField: 'id',
|
||||
sort: 'id,desc',
|
||||
crudMethod: { ...crudStIvtOverdueforewarning }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
},
|
||||
queryTypeOptions: [
|
||||
{ key: 'material_code', display_name: '物料编码' },
|
||||
{ key: 'material_name', display_name: '物料名称' },
|
||||
{ key: 'stor_code', display_name: '仓位编码' }
|
||||
],
|
||||
stors: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudStorattr.getStor().then(res => {
|
||||
this.stors = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/stIvtOverdueforewarning',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/stIvtOverdueforewarning/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/stIvtOverdueforewarning',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<label class="el-form-item-label">物料编码</label>
|
||||
<el-input v-model="query.material_code" clearable placeholder="物料编码" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">物料名称</label>
|
||||
<el-input v-model="query.material_name" clearable placeholder="物料名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">仓库名称</label>
|
||||
<el-select
|
||||
v-model="query.stor_code"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stors"
|
||||
:key="item.stor_code"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_code"
|
||||
/>
|
||||
</el-select>
|
||||
<rrOperation :crud="crud" />
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="config_name" label="配置名称" :min-width="flexWidth('config_name',crud.data,'配置名称')" />
|
||||
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||||
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
|
||||
<el-table-column prop="stor_code" label="仓库编码" :min-width="flexWidth('stor_code',crud.data,'仓库编码')" />
|
||||
<el-table-column prop="stor_name" label="仓库名称" :min-width="flexWidth('stor_name',crud.data,'仓库名称')" />
|
||||
<el-table-column prop="current_qty" label="当前数量" :min-width="flexWidth('current_qty',crud.data,'当前数量')" />
|
||||
<el-table-column prop="safe_qty" label="安全数量" :min-width="flexWidth('safe_qty',crud.data,'安全数量')" />
|
||||
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudStIvtSafetyforewarning from './stIvtSafetyforewarning'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudStorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
config_id: null,
|
||||
material_code: null,
|
||||
material_name: null,
|
||||
stor_code: null,
|
||||
current_qty: null,
|
||||
safe_qty: null,
|
||||
remark: null,
|
||||
is_delete: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_id: null,
|
||||
update_name: null,
|
||||
update_time: null
|
||||
}
|
||||
export default {
|
||||
name: 'StIvtSafetyforewarning',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '安全库存预警',
|
||||
url: 'api/stIvtSafetyforewarning',
|
||||
idField: 'id',
|
||||
sort: 'id,desc',
|
||||
crudMethod: { ...crudStIvtSafetyforewarning }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
},
|
||||
queryTypeOptions: [
|
||||
{ key: 'material_code', display_name: '物料编码' },
|
||||
{ key: 'material_name', display_name: '物料名称' },
|
||||
{ key: 'stor_code', display_name: '仓位编码' }
|
||||
],
|
||||
stors: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudStorattr.getStor().then(res => {
|
||||
this.stors = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/stIvtSafetyforewarning',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/stIvtSafetyforewarning/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/stIvtSafetyforewarning',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
Reference in New Issue
Block a user