Merge branch 'master' of http://121.40.234.130:8899/root/nladmin
This commit is contained in:
@@ -16,20 +16,25 @@
|
||||
package org.nl.modules.quartz.config;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.quartz.domain.QuartzJob;
|
||||
import org.nl.modules.quartz.repository.QuartzJobRepository;
|
||||
import org.nl.modules.quartz.utils.QuartzManage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-01-07
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Order(100)
|
||||
public class JobRunner implements ApplicationRunner {
|
||||
private static final Logger log = LoggerFactory.getLogger(JobRunner.class);
|
||||
private final QuartzJobRepository quartzJobRepository;
|
||||
@@ -42,9 +47,9 @@ public class JobRunner implements ApplicationRunner {
|
||||
*/
|
||||
@Override
|
||||
public void run(ApplicationArguments applicationArguments) {
|
||||
/* log.info("--------------------注入定时任务---------------------");
|
||||
log.info("--------------------注入定时任务---------------------");
|
||||
List<QuartzJob> quartzJobs = quartzJobRepository.findByIsPauseIsFalse();
|
||||
quartzJobs.forEach(quartzManage::addJob);
|
||||
log.info("--------------------定时任务注入完成---------------------");*/
|
||||
log.info("--------------------定时任务注入完成---------------------");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -52,38 +50,24 @@ public class QuartzJobController {
|
||||
@ApiOperation("查询定时任务")
|
||||
@GetMapping
|
||||
@SaCheckPermission("timing:list")
|
||||
public ResponseEntity<Object> query(JobQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(quartzJobService.queryAll(criteria,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出任务数据")
|
||||
@GetMapping(value = "/download")
|
||||
@SaCheckPermission("timing:list")
|
||||
public void download(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
quartzJobService.download(quartzJobService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("导出日志数据")
|
||||
@GetMapping(value = "/logs/download")
|
||||
@SaCheckPermission("timing:list")
|
||||
public void downloadLog(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
quartzJobService.downloadLog(quartzJobService.queryAllLog(criteria), response);
|
||||
public ResponseEntity<Object> query(JobQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(quartzJobService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务执行日志")
|
||||
@GetMapping(value = "/logs")
|
||||
@SaCheckPermission("timing:list")
|
||||
public ResponseEntity<Object> queryJobLog(JobQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryJobLog(JobQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(quartzJobService.queryAllLog(criteria, pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增定时任务")
|
||||
@ApiOperation("新增定时任务")
|
||||
@PostMapping
|
||||
@SaCheckPermission("timing:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody QuartzJob resources){
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody QuartzJob resources) {
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
throw new BadRequestException("A new " + ENTITY_NAME + " cannot already have an ID");
|
||||
}
|
||||
quartzJobService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -93,7 +77,7 @@ public class QuartzJobController {
|
||||
@ApiOperation("修改定时任务")
|
||||
@PutMapping
|
||||
@SaCheckPermission("timing:edit")
|
||||
public ResponseEntity<Object> update(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){
|
||||
public ResponseEntity<Object> update(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources) {
|
||||
quartzJobService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -102,7 +86,7 @@ public class QuartzJobController {
|
||||
@ApiOperation("更改定时任务状态")
|
||||
@PutMapping(value = "/{id}")
|
||||
@SaCheckPermission("timing:edit")
|
||||
public ResponseEntity<Object> update(@PathVariable Long id){
|
||||
public ResponseEntity<Object> update(@PathVariable Long id) {
|
||||
quartzJobService.updateIsPause(quartzJobService.findById(id));
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -111,7 +95,7 @@ public class QuartzJobController {
|
||||
@ApiOperation("执行定时任务")
|
||||
@PutMapping(value = "/exec/{id}")
|
||||
@SaCheckPermission("timing:edit")
|
||||
public ResponseEntity<Object> execution(@PathVariable Long id){
|
||||
public ResponseEntity<Object> execution(@PathVariable Long id) {
|
||||
quartzJobService.execution(quartzJobService.findById(id));
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -120,7 +104,7 @@ public class QuartzJobController {
|
||||
@ApiOperation("删除定时任务")
|
||||
@DeleteMapping
|
||||
@SaCheckPermission("timing:del")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids) {
|
||||
quartzJobService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ import org.nl.modules.quartz.domain.QuartzLog;
|
||||
import org.nl.modules.quartz.service.dto.JobQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -33,6 +31,7 @@ public interface QuartzJobService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return /
|
||||
@@ -41,6 +40,7 @@ public interface QuartzJobService {
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param criteria 条件
|
||||
* @return /
|
||||
*/
|
||||
@@ -48,6 +48,7 @@ public interface QuartzJobService {
|
||||
|
||||
/**
|
||||
* 分页查询日志
|
||||
*
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return /
|
||||
@@ -56,6 +57,7 @@ public interface QuartzJobService {
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param criteria 条件
|
||||
* @return /
|
||||
*/
|
||||
@@ -63,24 +65,28 @@ public interface QuartzJobService {
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param resources /
|
||||
*/
|
||||
void create(QuartzJob resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param resources /
|
||||
*/
|
||||
void update(QuartzJob resources);
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void delete(Set<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return /
|
||||
*/
|
||||
@@ -88,34 +94,22 @@ public interface QuartzJobService {
|
||||
|
||||
/**
|
||||
* 更改定时任务状态
|
||||
*
|
||||
* @param quartzJob /
|
||||
*/
|
||||
void updateIsPause(QuartzJob quartzJob);
|
||||
|
||||
/**
|
||||
* 立即执行定时任务
|
||||
*
|
||||
* @param quartzJob /
|
||||
*/
|
||||
void execution(QuartzJob quartzJob);
|
||||
|
||||
/**
|
||||
* 导出定时任务
|
||||
* @param queryAll 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<QuartzJob> queryAll, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 导出定时任务日志
|
||||
* @param queryAllLog 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void downloadLog(List<QuartzLog> queryAllLog, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 执行子任务
|
||||
*
|
||||
* @param tasks /
|
||||
* @throws InterruptedException /
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,10 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.*;
|
||||
import org.nl.modules.common.utils.PageUtil;
|
||||
import org.nl.modules.common.utils.QueryHelp;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.common.utils.ValidationUtil;
|
||||
import org.nl.modules.quartz.domain.QuartzJob;
|
||||
import org.nl.modules.quartz.domain.QuartzLog;
|
||||
import org.nl.modules.quartz.repository.QuartzJobRepository;
|
||||
@@ -33,9 +36,9 @@ import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
@@ -51,36 +54,36 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
@Override
|
||||
public Object queryAll(JobQueryCriteria criteria, Pageable pageable){
|
||||
return PageUtil.toPage(quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
|
||||
public Object queryAll(JobQueryCriteria criteria, Pageable pageable) {
|
||||
return PageUtil.toPage(quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object queryAllLog(JobQueryCriteria criteria, Pageable pageable){
|
||||
return PageUtil.toPage(quartzLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
|
||||
public Object queryAllLog(JobQueryCriteria criteria, Pageable pageable) {
|
||||
return PageUtil.toPage(quartzLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuartzJob> queryAll(JobQueryCriteria criteria) {
|
||||
return quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
|
||||
return quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuartzLog> queryAllLog(JobQueryCriteria criteria) {
|
||||
return quartzLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
|
||||
return quartzLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder));
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuartzJob findById(Long id) {
|
||||
QuartzJob quartzJob = quartzJobRepository.findById(id).orElseGet(QuartzJob::new);
|
||||
ValidationUtil.isNull(quartzJob.getId(),"QuartzJob","id",id);
|
||||
ValidationUtil.isNull(quartzJob.getId(), "QuartzJob", "id", id);
|
||||
return quartzJob;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(QuartzJob resources) {
|
||||
if (!CronExpression.isValidExpression(resources.getCronExpression())){
|
||||
if (!CronExpression.isValidExpression(resources.getCronExpression())) {
|
||||
throw new BadRequestException("cron表达式格式错误");
|
||||
}
|
||||
resources = quartzJobRepository.save(resources);
|
||||
@@ -90,10 +93,10 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(QuartzJob resources) {
|
||||
if (!CronExpression.isValidExpression(resources.getCronExpression())){
|
||||
if (!CronExpression.isValidExpression(resources.getCronExpression())) {
|
||||
throw new BadRequestException("cron表达式格式错误");
|
||||
}
|
||||
if(StrUtil.isNotEmpty(resources.getSubTask())){
|
||||
if (StrUtil.isNotEmpty(resources.getSubTask())) {
|
||||
List<String> tasks = Arrays.asList(resources.getSubTask().split("[,,]"));
|
||||
if (tasks.contains(resources.getId().toString())) {
|
||||
throw new BadRequestException("子任务中不能添加当前任务ID");
|
||||
@@ -148,47 +151,11 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||
Thread.sleep(5000);
|
||||
result = (Boolean) redisUtils.get(uuid);
|
||||
}
|
||||
if(!result){
|
||||
if (!result) {
|
||||
redisUtils.del(uuid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<QuartzJob> quartzJobs, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (QuartzJob quartzJob : quartzJobs) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("任务名称", quartzJob.getJobName());
|
||||
map.put("Bean名称", quartzJob.getBeanName());
|
||||
map.put("执行方法", quartzJob.getMethodName());
|
||||
map.put("参数", quartzJob.getParams());
|
||||
map.put("表达式", quartzJob.getCronExpression());
|
||||
map.put("状态", quartzJob.getIsPause() ? "暂停中" : "运行中");
|
||||
map.put("描述", quartzJob.getDescription());
|
||||
map.put("创建日期", quartzJob.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadLog(List<QuartzLog> queryAllLog, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (QuartzLog quartzLog : queryAllLog) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("任务名称", quartzLog.getJobName());
|
||||
map.put("Bean名称", quartzLog.getBeanName());
|
||||
map.put("执行方法", quartzLog.getMethodName());
|
||||
map.put("参数", quartzLog.getParams());
|
||||
map.put("表达式", quartzLog.getCronExpression());
|
||||
map.put("异常详情", quartzLog.getExceptionDetail());
|
||||
map.put("耗时/毫秒", quartzLog.getTime());
|
||||
map.put("状态", quartzLog.getIsSuccess() ? "成功" : "失败");
|
||||
map.put("创建日期", quartzLog.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class TestSch {
|
||||
public void run() {
|
||||
log.info("run 执行成功1");
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -28,6 +29,7 @@ import org.springframework.stereotype.Component;
|
||||
public class TestTask {
|
||||
|
||||
public void run(){
|
||||
|
||||
log.info("run 执行成功");
|
||||
}
|
||||
|
||||
@@ -36,6 +38,7 @@ public class TestTask {
|
||||
}
|
||||
|
||||
public void run2(){
|
||||
WQLObject.getWQLObject("sys_param");
|
||||
log.info("run2 执行成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package org.nl.modules.security.rest;
|
||||
|
||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description 密码加密测试
|
||||
*/
|
||||
public class test {
|
||||
public static void main(String[] args) {
|
||||
String salt = SaSecureUtil.md5BySalt("123456", "salt");
|
||||
System.out.println(salt);
|
||||
}
|
||||
}
|
||||
@@ -98,12 +98,11 @@ public class ParamServiceImpl implements ParamService {
|
||||
ParamDto entity = this.findById(dto.getId());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
CurrentUser currentUsername = SecurityUtils.getCurrentUser();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setUpdate_optid(StpUtil.getLoginIdAsLong());
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optname(currentUsername.getNickName());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_param");
|
||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||
|
||||
19
nladmin-system/src/main/java/org/nl/modules/wql/WQLInit.java
Normal file
19
nladmin-system/src/main/java/org/nl/modules/wql/WQLInit.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package org.nl.modules.wql;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Order(0)
|
||||
@Component
|
||||
@Slf4j
|
||||
public class WQLInit implements ApplicationRunner {
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
WQLCore.ROOT = "org.nl";
|
||||
WQLCore.init();
|
||||
log.info("WQL初始化成功!");
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,10 @@ package org.nl.start;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.quartz.domain.QuartzJob;
|
||||
import org.nl.modules.quartz.repository.QuartzJobRepository;
|
||||
import org.nl.modules.quartz.utils.QuartzManage;
|
||||
import org.nl.modules.wql.WQLCore;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 随项目启动模块
|
||||
*/
|
||||
@@ -19,34 +13,9 @@ import java.util.List;
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class Init implements ApplicationRunner {
|
||||
private final QuartzJobRepository quartzJobRepository;
|
||||
private final QuartzManage quartzManage;
|
||||
|
||||
|
||||
private void init() throws Exception {
|
||||
//初始化WQL
|
||||
initWql();
|
||||
//初始化任务调度
|
||||
initQuartz();
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
System.out.println("项目启动成功!");
|
||||
}
|
||||
|
||||
private void initQuartz() {
|
||||
log.info("--------------------注入定时任务---------------------");
|
||||
List<QuartzJob> quartzJobs = quartzJobRepository.findByIsPauseIsFalse();
|
||||
quartzJobs.forEach(quartzManage::addJob);
|
||||
log.info("--------------------定时任务注入完成---------------------");
|
||||
|
||||
}
|
||||
|
||||
private void initWql() throws Exception {
|
||||
WQLCore.ROOT = "org.nl";
|
||||
WQLCore.init();
|
||||
log.info("WQL初始化成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package org.nl.wms.ext.mes.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.mes.service.MesToLmsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -23,11 +27,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
* "RTYPE": "S",
|
||||
* "RTMSG": "成功",
|
||||
* "RTOAL": 1,
|
||||
* "RTDAT": [{
|
||||
* "ContainerName": "母卷号",
|
||||
* "ResourceName": "设备号",
|
||||
* "Weight": 80
|
||||
* }]
|
||||
* "RTDAT": null
|
||||
* }
|
||||
*
|
||||
*
|
||||
@@ -37,12 +37,73 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
public JSONObject momRollFoilStart(JSONObject param) {
|
||||
log.info("momRollFoilStart接口输入参数为:-------------------"+param.toString());
|
||||
|
||||
String containerName = param.getString("ContainerName");
|
||||
String ResourceName = param.getString("ResourceName");
|
||||
String MfgOrderName = param.getString("MfgOrderName");
|
||||
String ProductName = param.getString("ProductName");
|
||||
String Description = param.getString("Description");
|
||||
String TheoryHeight = param.getString("TheoryHeight");
|
||||
String EqpVelocity = param.getString("EqpVelocity");
|
||||
String UpCoilerDate = param.getString("UpCoilerDate");
|
||||
String IsReloadSend = param.getString("IsReloadSend");
|
||||
|
||||
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder");
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 0);
|
||||
result.put("RTDAT", new JSONArray());
|
||||
System.out.println(result);
|
||||
try {
|
||||
// 校验数据
|
||||
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
|
||||
if (ObjectUtil.isEmpty(ResourceName)) throw new BadRequestException("机台编码不能为空");
|
||||
if (ObjectUtil.isEmpty(MfgOrderName)) throw new BadRequestException("生产工单不能为空");
|
||||
if (ObjectUtil.isEmpty(ProductName)) throw new BadRequestException("产品编码不能为空");
|
||||
if (ObjectUtil.isEmpty(Description)) throw new BadRequestException("产品名称不能为空");
|
||||
if (ObjectUtil.isEmpty(TheoryHeight)) throw new BadRequestException("理论长度不能为空");
|
||||
if (ObjectUtil.isEmpty(EqpVelocity)) throw new BadRequestException("生产速度不能为空");
|
||||
if (ObjectUtil.isEmpty(UpCoilerDate)) throw new BadRequestException("开始时间不能为空");
|
||||
if (ObjectUtil.isEmpty(IsReloadSend)) throw new BadRequestException("是否重新更新不能为空");
|
||||
|
||||
JSONObject jsonPoint = pointTab.query("ext_code ='" + ResourceName + "' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("对应点位不存在");
|
||||
|
||||
// 插入生箔工序工单表
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("container_name",containerName);
|
||||
json.put("resource_name",ResourceName);
|
||||
json.put("mfg_order_name",MfgOrderName);
|
||||
json.put("product_name",ProductName);
|
||||
json.put("description",Description);
|
||||
json.put("theory_height",TheoryHeight);
|
||||
json.put("eqp_velocity",EqpVelocity);
|
||||
json.put("up_coiler_date",UpCoilerDate);
|
||||
json.put("is_reload_send",IsReloadSend);
|
||||
json.put("product_area", jsonPoint.getString("product_area"));
|
||||
json.put("point_code", jsonPoint.getString("point_code"));
|
||||
json.put("realstart_time", DateUtil.now());
|
||||
json.put("status", "01");
|
||||
json.put("is_delete", "0");
|
||||
json.put("agvno", "0");
|
||||
json.put("productin_qty", 0);
|
||||
json.put("create_id", "1");
|
||||
json.put("create_name", "管理员");
|
||||
json.put("create_time", DateUtil.now());
|
||||
orderTab.insert(json);
|
||||
|
||||
// 返回成功
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
} catch (Exception e) {
|
||||
// 返回失败
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作失败!"+e.getMessage());
|
||||
result.put("RTOAL", 0);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
package org.nl.wms.pdm.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pdm.service.RawfoilworkorderService;
|
||||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @date 2022-10-08
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "生箔工序工单管理")
|
||||
@RequestMapping("/api/rawfoilworkorder")
|
||||
@Slf4j
|
||||
public class RawfoilworkorderController {
|
||||
|
||||
private final RawfoilworkorderService rawfoilworkorderService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询生箔工序工单")
|
||||
@ApiOperation("查询生箔工序工单")
|
||||
//@SaCheckPermission("@el.check('rawfoilworkorder:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(rawfoilworkorderService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增生箔工序工单")
|
||||
@ApiOperation("新增生箔工序工单")
|
||||
//@SaCheckPermission("@el.check('rawfoilworkorder:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody RawfoilworkorderDto dto) {
|
||||
rawfoilworkorderService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改生箔工序工单")
|
||||
@ApiOperation("修改生箔工序工单")
|
||||
//@SaCheckPermission("@el.check('rawfoilworkorder:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody RawfoilworkorderDto dto) {
|
||||
rawfoilworkorderService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除生箔工序工单")
|
||||
@ApiOperation("删除生箔工序工单")
|
||||
//@SaCheckPermission("@el.check('rawfoilworkorder:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
rawfoilworkorderService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("强制确认")
|
||||
@ApiOperation("强制确认")
|
||||
@PostMapping("/compelEnd")
|
||||
public ResponseEntity<Object> compelEnd(@RequestBody JSONObject whereJson) {
|
||||
rawfoilworkorderService.compelEnd(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
package org.nl.wms.pdm.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-10-08
|
||||
**/
|
||||
public interface RawfoilworkorderService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<RawfoilworkorderDto>
|
||||
*/
|
||||
List<RawfoilworkorderDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param workorder_id ID
|
||||
* @return Rawfoilworkorder
|
||||
*/
|
||||
RawfoilworkorderDto findById(Long workorder_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Rawfoilworkorder
|
||||
*/
|
||||
RawfoilworkorderDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(RawfoilworkorderDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(RawfoilworkorderDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 强制确认
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void compelEnd(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package org.nl.wms.pdm.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description /
|
||||
* @date 2022-10-08
|
||||
**/
|
||||
@Data
|
||||
public class RawfoilworkorderDto implements Serializable {
|
||||
|
||||
/** 工单标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long workorder_id;
|
||||
|
||||
/**
|
||||
* 母卷号
|
||||
*/
|
||||
private String container_name;
|
||||
|
||||
/**
|
||||
* 机台编码
|
||||
*/
|
||||
private String resource_name;
|
||||
|
||||
/**
|
||||
* 生产工单
|
||||
*/
|
||||
private String mfg_order_name;
|
||||
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String product_name;
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 理论长度
|
||||
*/
|
||||
private BigDecimal theory_height;
|
||||
|
||||
/**
|
||||
* 设备生产速度
|
||||
*/
|
||||
private BigDecimal eqp_velocity;
|
||||
|
||||
/**
|
||||
* 上卷开始时间
|
||||
*/
|
||||
private String up_coiler_date;
|
||||
|
||||
/**
|
||||
* 是否重新更新
|
||||
*/
|
||||
private String is_reload_send;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private BigDecimal productin_qty;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private String realstart_time;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private String realend_time;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 完成方式
|
||||
*/
|
||||
private String finish_type;
|
||||
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
private String agvno;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 生产区域
|
||||
*/
|
||||
private String product_area;
|
||||
|
||||
/**
|
||||
* 点位编码
|
||||
*/
|
||||
private String point_code;
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
|
||||
package org.nl.wms.pdm.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.pdm.service.RawfoilworkorderService;
|
||||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-10-08
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class RawfoilworkorderServiceImpl implements RawfoilworkorderService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String product_area = MapUtil.getStr(whereJson, "product_area");
|
||||
String resource_name = MapUtil.getStr(whereJson, "resource_name");
|
||||
String status = MapUtil.getStr(whereJson, "status");
|
||||
String container_name = MapUtil.getStr(whereJson, "container_name");
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
if (ObjectUtil.isNotEmpty(resource_name)) map.put("resource_name","%"+resource_name+"%");
|
||||
if (ObjectUtil.isNotEmpty(container_name)) map.put("container_name","%"+container_name+"%");
|
||||
map.put("begin_time",begin_time);
|
||||
map.put("end_time",end_time);
|
||||
map.put("product_area",product_area);
|
||||
map.put("status",status);
|
||||
|
||||
JSONObject json = WQL.getWO("PDM_BI_RAWFOILWORKORDER_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "der.update_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RawfoilworkorderDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(RawfoilworkorderDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RawfoilworkorderDto findById(Long workorder_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||
JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(RawfoilworkorderDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RawfoilworkorderDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(RawfoilworkorderDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(RawfoilworkorderDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(RawfoilworkorderDto dto) {
|
||||
RawfoilworkorderDto entity = this.findById(dto.getWorkorder_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||
for (Long workorder_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("workorder_id", String.valueOf(workorder_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void compelEnd(JSONObject whereJson) {
|
||||
String workorder_id = whereJson.getString("workorder_id");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder");
|
||||
|
||||
JSONObject json = tab.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
||||
json.put("status", "02");
|
||||
json.put("finish_type", "02");
|
||||
json.put("realend_time", DateUtil.now());
|
||||
json.put("update_optid", currentUserId);
|
||||
json.put("update_optname", currentUsername);
|
||||
json.put("update_time", DateUtil.now());
|
||||
tab.update(json);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
[交易说明]
|
||||
交易名: 生箔工单查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.resource_name TYPEAS s_string
|
||||
输入.container_name TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.status TYPEAS s_string
|
||||
输入.product_area TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
der.*
|
||||
FROM
|
||||
pdm_bi_rawfoilworkorder der
|
||||
WHERE
|
||||
der.is_delete = '0'
|
||||
|
||||
OPTION 输入.resource_name <> ""
|
||||
der.resource_name like 输入.resource_name
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.container_name <> ""
|
||||
der.container_name like 输入.container_name
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.product_area <> ""
|
||||
der.product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.status <> ""
|
||||
der.status = 输入.status
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
der.create_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
der.create_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -22,12 +22,6 @@
|
||||
<el-form-item label="值" prop="value">
|
||||
<el-input v-model="form.value" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="启用" prop="is_active">
|
||||
<el-radio-group v-model="form.is_active" size="mini">
|
||||
<el-radio-button label="1">是</el-radio-button>
|
||||
<el-radio-button label="0">否</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="description">
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="5" type="textarea" />
|
||||
</el-form-item>
|
||||
@@ -49,16 +43,10 @@
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-if="false" prop="id" label="id" />
|
||||
<el-table-column prop="code" label="编码" />
|
||||
<el-table-column prop="name" label="名称" />
|
||||
<el-table-column prop="value" label="值" width="270" />
|
||||
<el-table-column prop="name" label="名称" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="value" label="值" min-width="270" show-overflow-tooltip />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column prop="is_active" label="启用" width="75px">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.is_active==0">否</span>
|
||||
<span v-else>是</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_name" label="创建者" />
|
||||
<el-table-column prop="update_optname" label="修改者" />
|
||||
<el-table-column v-permission="['admin','param:edit','param:del']" label="操作" width="150px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
||||
<el-table-column show-overflow-tooltip prop="id" label="任务ID" />
|
||||
<el-table-column show-overflow-tooltip prop="jobName" label="任务名称" />
|
||||
<el-table-column show-overflow-tooltip prop="jobName" label="任务名称" min-width="120" />
|
||||
<el-table-column show-overflow-tooltip prop="beanName" label="Bean名称" />
|
||||
<el-table-column show-overflow-tooltip prop="methodName" label="执行方法" />
|
||||
<el-table-column show-overflow-tooltip prop="params" label="参数" />
|
||||
|
||||
@@ -8,17 +8,6 @@
|
||||
<el-option v-for="item in enabledTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
|
||||
</el-select>
|
||||
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
|
||||
<!-- 导出 -->
|
||||
<div style="display: inline-block;">
|
||||
<el-button
|
||||
:loading="downloadLoading"
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
@click="downloadMethod"
|
||||
>导出</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
<el-table v-loading="loading" :data="data" style="width: 100%;margin-top: -10px;">
|
||||
|
||||
@@ -56,20 +56,18 @@
|
||||
<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="point_code" label="点位编码" />
|
||||
<el-table-column prop="full_point_code" label="满轴位编码" />
|
||||
<el-table-column prop="full_point_status" label="满轴位状态" />
|
||||
<el-table-column prop="full_point_code" label="满轴位" />
|
||||
<el-table-column prop="is_used" label="是否启用" />
|
||||
<el-table-column prop="full_point_status" label="满轴位状态" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="container_name" label="母卷号" />
|
||||
<el-table-column prop="full_vehicle_code" label="母卷轴编码" />
|
||||
<el-table-column prop="empty_point_code" label="空轴位编码" />
|
||||
<el-table-column prop="empty_point_status" label="空轴位状态" />
|
||||
<el-table-column prop="full_vehicle_code" label="母卷轴编号" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="empty_point_code" label="空轴位" />
|
||||
<el-table-column prop="empty_point_status" label="空轴位状态" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="empty_vehicle_code" label="空轴编码" />
|
||||
<el-table-column prop="product_area" label="生产区域" />
|
||||
<el-table-column prop="point_location" label="位置" />
|
||||
<el-table-column prop="sort_seq" label="顺序号" />
|
||||
<el-table-column prop="is_used" label="是否启用" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column prop="create_name" label="创建人姓名" />
|
||||
<el-table-column prop="update_time" label="修改时间" />
|
||||
<el-table-column prop="update_time" label="修改时间" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
|
||||
@@ -37,10 +37,8 @@
|
||||
<el-table-column prop="point_code" label="点位编码" />
|
||||
<el-table-column prop="product_area" label="生产区域" />
|
||||
<el-table-column prop="point_location" label="位置" />
|
||||
<el-table-column prop="sort_seq" label="顺序号" />
|
||||
<el-table-column prop="is_used" label="是否启用" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column prop="create_name" label="创建人姓名" />
|
||||
<el-table-column prop="update_time" label="修改时间" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
|
||||
271
nladmin-ui/src/views/wms/pdm/order/rawfoilworkorder/index.vue
Normal file
271
nladmin-ui/src/views/wms/pdm/order/rawfoilworkorder/index.vue
Normal file
@@ -0,0 +1,271 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
|
||||
<el-form-item label="生产区域">
|
||||
<el-select
|
||||
v-model="query.product_area"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_area"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="机台编码">
|
||||
<el-input
|
||||
v-model="query.resource_name"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="机台编码"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="母卷号">
|
||||
<el-input
|
||||
v-model="query.container_name"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="母卷号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="工单状态">
|
||||
<el-select
|
||||
v-model="query.status"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="工单状态"
|
||||
class="filter-item"
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_status"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="工单日期">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
@change="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@click="compelEnd"
|
||||
>
|
||||
强制结束
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="500px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||
<el-form-item label="母卷号" prop="container_name">
|
||||
<el-input v-model="form.container_name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="机台编码" prop="resource_name">
|
||||
<el-input v-model="form.resource_name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产工单" prop="mfg_order_name">
|
||||
<el-input v-model="form.mfg_order_name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品编码" prop="product_name">
|
||||
<el-input v-model="form.product_name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品名称" prop="description">
|
||||
<el-input v-model="form.description" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="重量">
|
||||
<el-input v-model="form.productin_qty" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车号">
|
||||
<el-input v-model="form.agvno" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
</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 v-if="false" prop="workorder_id" label="工单标识" />
|
||||
<el-table-column prop="mfg_order_name" label="工单号" />
|
||||
<el-table-column prop="status" label="工单状态" :formatter="formatStatusName" />
|
||||
<el-table-column prop="container_name" label="母卷号" />
|
||||
<el-table-column prop="resource_name" label="机台编码" />
|
||||
<el-table-column prop="product_name" label="产品编码" />
|
||||
<el-table-column prop="theory_height" label="理论长度" />
|
||||
<el-table-column prop="realstart_time" label="开始时间" width="150px" />
|
||||
<el-table-column prop="realend_time" label="结束时间" width="150px" />
|
||||
<el-table-column prop="productin_qty" label="重量" />
|
||||
<el-table-column prop="agvno" label="车号" />
|
||||
<el-table-column prop="product_area" label="生产区域" />
|
||||
<el-table-column prop="update_time" label="更新时间" width="150px" />
|
||||
<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 crudRawfoilworkorder from '@/views/wms/pdm/order/rawfoilworkorder/rawfoilworkorder'
|
||||
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'
|
||||
|
||||
const defaultForm = {
|
||||
workorder_id: null,
|
||||
container_name: null,
|
||||
resource_name: null,
|
||||
mfg_order_name: null,
|
||||
product_name: null,
|
||||
description: null,
|
||||
theory_height: null,
|
||||
eqp_velocity: null,
|
||||
up_coiler_date: null,
|
||||
is_reload_send: null,
|
||||
productin_qty: null,
|
||||
realstart_time: null,
|
||||
realend_time: null,
|
||||
status: null,
|
||||
finish_type: null,
|
||||
agvno: null,
|
||||
remark: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
is_delete: null
|
||||
}
|
||||
export default {
|
||||
name: 'Rawfoilworkorder',
|
||||
dicts: ['product_area', 'product_status'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '生箔工序工单',
|
||||
url: 'api/rawfoilworkorder',
|
||||
idField: 'workorder_id',
|
||||
sort: 'workorder_id,desc',
|
||||
crudMethod: { ...crudRawfoilworkorder },
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
rules: {
|
||||
container_name: [
|
||||
{ required: true, message: '母卷号不能为空', trigger: 'blur' }
|
||||
],
|
||||
resource_name: [
|
||||
{ required: true, message: '机台编码不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
hand() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
formatStatusName(row) {
|
||||
return this.dict.label.product_status[row.status]
|
||||
},
|
||||
compelEnd() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
const data = _selectData[0]
|
||||
if (data.status !== '01') {
|
||||
return this.crud.notify('只能对开始状态的工单结束', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
crudRawfoilworkorder.compelEnd(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,35 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/rawfoilworkorder',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/rawfoilworkorder/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/rawfoilworkorder',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function compelEnd(data) {
|
||||
return request({
|
||||
url: 'api/rawfoilworkorder/compelEnd',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, compelEnd }
|
||||
Reference in New Issue
Block a user