fix: 工单、混碾任务单
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package org.nl.wms.pdm.workorder.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.pdm.workorder.service.IPdmBdMixtaskService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdMixtask;
|
||||
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 liyongde
|
||||
* @date 2025-12-15
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/pdmBdMixtask")
|
||||
public class PdmBdMixtaskController {
|
||||
|
||||
@Autowired
|
||||
private IPdmBdMixtaskService pdmBdMixtaskService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询混碾大任务")
|
||||
//@SaCheckPermission("@el.check('pdmBdMixtask:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(pdmBdMixtaskService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增混碾大任务")
|
||||
//@SaCheckPermission("@el.check('pdmBdMixtask:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody PdmBdMixtask entity){
|
||||
pdmBdMixtaskService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改混碾大任务")
|
||||
//@SaCheckPermission("@el.check('pdmBdMixtask:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody PdmBdMixtask entity){
|
||||
pdmBdMixtaskService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除混碾大任务")
|
||||
//@SaCheckPermission("@el.check('pdmBdMixtask:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
pdmBdMixtaskService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.wms.pdm.workorder.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.pdm.workorder.service.dao.PdmBdMixtask;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author liyongde
|
||||
* @date 2025-12-15
|
||||
**/
|
||||
public interface IPdmBdMixtaskService extends IService<PdmBdMixtask> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<PdmBdMixtask>
|
||||
*/
|
||||
IPage<PdmBdMixtask> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(PdmBdMixtask entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(PdmBdMixtask entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.nl.wms.pdm.workorder.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 liyongde
|
||||
* @date 2025-12-15
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("pdm_bd_mixtask")
|
||||
public class PdmBdMixtask implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "task_id", type = IdType.NONE)
|
||||
/** 大任务id */
|
||||
private String task_id;
|
||||
|
||||
/** 物料id */
|
||||
private String material_id;
|
||||
|
||||
/** 泥料号(配方号) */
|
||||
private String raw_material_code;
|
||||
|
||||
/** 混碾数量/重量 */
|
||||
private BigDecimal qty;
|
||||
|
||||
/** 料盅类型 */
|
||||
private String vehicle_type;
|
||||
|
||||
/** 状态(1:创建2:进行中3:已完成) */
|
||||
private String mix_status;
|
||||
|
||||
/** 开工人 */
|
||||
private String operator;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
|
||||
/** 是否删除 */
|
||||
private Boolean id_delete;
|
||||
private String material_name;
|
||||
private String material_code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.pdm.workorder.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdMixtask;
|
||||
|
||||
/**
|
||||
* @author liyongde
|
||||
* @date 2025-12-15
|
||||
**/
|
||||
public interface PdmBdMixtaskMapper extends BaseMapper<PdmBdMixtask> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.pdm.workorder.service.dao.mapper.PdmBdMixtaskMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.wms.pdm.workorder.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author liyongde
|
||||
* @date 2025-12-15
|
||||
**/
|
||||
@Data
|
||||
public class PdmBdMixtaskDto implements Serializable {
|
||||
|
||||
/** 大任务id */
|
||||
private String task_id;
|
||||
|
||||
/** 物料id */
|
||||
private String material_id;
|
||||
|
||||
/** 泥料号(配方号) */
|
||||
private String raw_material_code;
|
||||
|
||||
/** 混碾数量/重量 */
|
||||
private BigDecimal qty;
|
||||
|
||||
/** 料盅类型 */
|
||||
private String vehicle_type;
|
||||
|
||||
/** 状态(1:创建2:进行中3:已完成) */
|
||||
private String mix_status;
|
||||
|
||||
/** 开工人 */
|
||||
private String operator;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
|
||||
/** 是否删除 */
|
||||
private Boolean id_delete;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.pdm.workorder.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdMixtask;
|
||||
|
||||
/**
|
||||
* @author liyongde
|
||||
* @date 2025-12-15
|
||||
**/
|
||||
public class PdmBdMixtaskQuery extends BaseQuery<PdmBdMixtask> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.nl.wms.pdm.workorder.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdMixtaskService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdMixtask;
|
||||
import org.nl.wms.pdm.workorder.service.dao.mapper.PdmBdMixtaskMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author liyongde
|
||||
* @date 2025-12-15
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PdmBdMixtaskServiceImpl extends ServiceImpl<PdmBdMixtaskMapper, PdmBdMixtask> implements IPdmBdMixtaskService {
|
||||
|
||||
@Autowired
|
||||
private PdmBdMixtaskMapper pdmBdMixtaskMapper;
|
||||
|
||||
@Override
|
||||
public IPage<PdmBdMixtask> queryAll(Map form, PageQuery page){
|
||||
String moreStatus = ObjectUtil.isNotEmpty(form.get("more_status")) ? form.get("more_status").toString() : null;
|
||||
String beginTime = ObjectUtil.isNotEmpty(form.get("begin_time")) ? form.get("begin_time").toString() : null;
|
||||
String endTime = ObjectUtil.isNotEmpty(form.get("end_time")) ? form.get("end_time").toString() : null;
|
||||
LambdaQueryWrapper<PdmBdMixtask> lam = new LambdaQueryWrapper<>();
|
||||
IPage<PdmBdMixtask> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
List<String> collect = new ArrayList<>();
|
||||
if (moreStatus != null) {
|
||||
collect = Arrays.stream(moreStatus.split(",")).collect(Collectors.toList());
|
||||
}
|
||||
lam.in(moreStatus != null, PdmBdMixtask::getMix_status, collect)
|
||||
.and(beginTime != null, l2 -> l2.ge(PdmBdMixtask::getCreate_time, beginTime)
|
||||
.le(PdmBdMixtask::getCreate_time, endTime));
|
||||
pdmBdMixtaskMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(PdmBdMixtask entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setTask_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_time(now);
|
||||
pdmBdMixtaskMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(PdmBdMixtask entity) {
|
||||
PdmBdMixtask dto = pdmBdMixtaskMapper.selectById(entity.getTask_id());
|
||||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
pdmBdMixtaskMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
pdmBdMixtaskMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,12 +42,8 @@ public class AutoCreateTask {
|
||||
subTypes.forEach(clz -> {
|
||||
// 调用AbstractAcsTask类的每个子类的schedule()方法
|
||||
try {
|
||||
Object obj = SpringContextHolder.getBean(clz);
|
||||
Method m = obj.getClass().getMethod("schedule");
|
||||
m.invoke(obj);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
log.info("定时器执行失败:{}", e.getTargetException().getMessage());
|
||||
AbstractTask obj = SpringContextHolder.getBean(clz);
|
||||
obj.schedule();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info("定时器执行失败:{}", e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user