生产工序代码-生产工序-工序板件信息-柜体搜索

This commit is contained in:
liuzhaotian
2024-05-08 18:01:34 +08:00
parent ed6b6c5052
commit d2a0b45a02
13 changed files with 92 additions and 261 deletions
@@ -14,13 +14,18 @@ public class ProcessPlateReqVO {
@Schema(description = "工序类型",requiredMode = Schema.RequiredMode.REQUIRED)
private Long processType;
@Schema(description = "生产单号",requiredMode = Schema.RequiredMode.REQUIRED)
private Long orderId;
@Schema(description = "工序明细ID",requiredMode = Schema.RequiredMode.REQUIRED)
private Long stepItemId;
@Schema(description = "柜体ID")
private Long bodyId;
}
@@ -178,10 +178,6 @@
<artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-job</artifactId>
</dependency>
</dependencies>
@@ -1,66 +0,0 @@
package com.cf.imes.module.manage.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@Data
@Component
@ConfigurationProperties(prefix = "job.parameters")
public class XxlJobParameter {
/**
* 是否开启,默认为 true 关闭
*/
private Boolean enabled;
/**
* 访问令牌
*/
private String accessToken;
/* *//**
* 控制器配置
*//*
@NotNull(message = "控制器配置不能为空")
private AdminProperties admin;
*//**
* 执行器配置
*//*
@NotNull(message = "执行器配置不能为空")
private ExecutorProperties executor;*/
@NotEmpty(message = "调度器地址不能为空")
private String addresses;
/**
* 应用名
*/
@NotEmpty(message = "应用名不能为空")
private String appName;
/**
* 执行器的 IP
*/
private String ip;
/**
* 执行器的 Port
*/
private Long port;
/**
* 日志地址
*/
@NotEmpty(message = "日志地址不能为空")
private String logPath;
/**
* 日志保留天数
*/
private Long logRetentionDays;
}
@@ -14,7 +14,7 @@ import lombok.ToString;
public class PackPageReqVO extends PageParam {
@Schema(description = "生产状态(2:生产中,3:生产完成)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@Schema(description = "生产状态(2:生产中,4:打包完成,默认生产中)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Long status;
@@ -75,6 +75,15 @@ public class ProductionProcessController {
@GetMapping("/selectBodyName")
@Operation(summary = "查询生产单对应的柜体名称")
public CommonResult<List<OrderBodyRespVo>> selectBodyName(OrderBodyReqVO reqVO){
return success(productionProcessService.selectBodyName(reqVO));
}
// @GetMapping("/selectPlateName")
@@ -0,0 +1,23 @@
package com.cf.imes.module.manage.controller.admin.process.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
@Schema(description = "管理后台 - 查询柜体信息")
@Data
@ToString(callSuper = true)
public class OrderBodyReqVO {
@Schema(description = "工序类型",requiredMode = Schema.RequiredMode.REQUIRED)
private Long processType;
@Schema(description = "生产单号",requiredMode = Schema.RequiredMode.REQUIRED)
private Long orderId;
}
@@ -0,0 +1,19 @@
package com.cf.imes.module.manage.controller.admin.process.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 查看订单柜体信息 Response VO")
@Data
public class OrderBodyRespVo {
@Schema(description = "柜体ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "柜体名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "9822")
private String name;
}
@@ -2,8 +2,6 @@ package com.cf.imes.module.manage.controller.admin.test;
import com.cf.imes.framework.common.util.json.JsonUtils;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.quartz.config.XxlJobProperties;
import com.cf.imes.module.manage.config.XxlJobParameter;
import com.cf.imes.module.manage.controller.admin.patching.vo.PatchingDetailRespVO;
import com.cf.imes.module.manage.controller.admin.patching.vo.PatchingPlateRespVO;
import com.cf.imes.module.manage.dal.dataobject.process.OrderProcessStepItemNDO;
@@ -72,159 +70,17 @@ public class TestController {
}
public class JacobTestController {
/* *
* 语音转文字并播放
*
* @param text
*/
private static void convertTextToSpeech(String text) {
try {
//jacob.dll没成功安装,执行这一步会出错
//构建音频格式 调用注册表应用
Dispatch spAudioFormat = new ActiveXComponent("Sapi.SpAudioFormat").getObject();
//音频文件输出流
Dispatch spFileStream = new ActiveXComponent("Sapi.SpFileStream").getObject();
//构建音频对象
Dispatch spVoice = new ActiveXComponent("Sapi.SpVoice").getObject();
//设置spAudioFormat音频流格式类型22
Dispatch.put(spAudioFormat, "Type", new Variant(22));
//设置spFileStream文件输出流的音频格式
Dispatch.putRef(spFileStream, "Format", spAudioFormat);
//设置spFileStream文件输出流参数地址等
Dispatch.call(spFileStream, "Open", new Variant("E:AAAAA\48641486.wav"), new Variant(3), new Variant(true));
//设置spVoice声音对象的音频输出流为输出文件对象
Dispatch.putRef(spVoice, "AudioOutputStream", spFileStream);
//设置spVoice声音对象的音量大小100
Dispatch.put(spVoice, "Volume", new Variant(100));
//设置spVoice声音对象的速度 0为正常速度,范围【..-2 -1 0 1 2..】
Dispatch.put(spVoice, "Rate", new Variant(0));
//设置spVoice声音对象中的文本内容
Dispatch.call(spVoice, "Speak", new Variant(text));
//关闭spFileStream输出文件
Dispatch.call(spFileStream, "Close");
//释放资源
spVoice.safeRelease();
spAudioFormat.safeRelease();
spFileStream.safeRelease();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
private static XxlJobProperties aabb(){
XxlJobParameter xxlJobParameter = new XxlJobParameter();
xxlJobParameter.setEnabled(false);
xxlJobParameter.setAccessToken("1122");
xxlJobParameter.setAddresses("五阿里乌");
xxlJobParameter.setAppName("aaappn");
XxlJobProperties bean = BeanUtils.toBean(xxlJobParameter, XxlJobProperties.class);
return bean;
}
}
public static void deleteFiles(List<String> filePaths) {
// 检查文件路径集合是否为空
if (filePaths == null || filePaths.isEmpty()) {
System.out.println("文件路径集合为空");
return;
}
for (String filePath : filePaths) {
// 检查文件路径是否为空
if (filePath == null || filePath.isEmpty()) {
System.out.println("文件路径为空");
continue;
}
File file = new File(filePath);
// 检查文件是否存在
if (!file.exists()) {
System.out.println("文件不存在:" + filePath);
continue;
}
// 检查是否是文件
if (!file.isFile()) {
System.out.println("路径指向的不是文件:" + filePath);
continue;
}
// 尝试删除文件
if (file.delete()) {
System.out.println("文件删除成功:" + filePath);
} else {
System.out.println("文件删除失败:" + filePath);
}
}
}
public static Integer aacc(){
RedisTemplate<Object, Object> re = new RedisTemplate<>();
int randomInt = new Random(System.currentTimeMillis()).nextInt(900) + 100;// 生成100到999之间的随机数
return randomInt;
}
@TestOnly
public static void main(String[] args) {
// // 创建文件路径集合并添加文件路径
// List<String> filePaths = new ArrayList<>();
// filePaths.add("E:/BBBBBBB/1.txt");
// filePaths.add("E:/BBBBBBB/2.txt");
// filePaths.add("E:/BBBBBBB/4.txt");
List<Integer> filePaths = new ArrayList<>();
filePaths.add(aacc());
System.out.println(filePaths);
// // 调用 deleteFiles 方法,传入文件路径集合
// deleteFiles(filePaths);
// System.out.println(JacobTestController.aabb());
/* PatchingPlateRespVO patchingPlateRespVO = new PatchingPlateRespVO();
patchingPlateRespVO.setGroupId(11L);
patchingPlateRespVO.setArea(11.2);
patchingPlateRespVO.setColor("红色");
patchingPlateRespVO.setHeight(11.2);
String jsonString = JsonUtils.toJsonString(patchingPlateRespVO);
System.out.println(jsonString);*/
//
/*byte[] 测试测试s = JacobTestController.convertTextToSpeech("测试测试");*/
// JacobTestController.convertTextToSpeech("测试测试");
}
@@ -3,6 +3,7 @@ package com.cf.imes.module.manage.dal.mysql.pack;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.manage.controller.admin.process.vo.OrderBodyRespVo;
import com.cf.imes.module.manage.dal.dataobject.pack.OrderBodyDO;
import org.apache.ibatis.annotations.Mapper;
@@ -11,6 +12,7 @@ import java.util.List;
@Mapper
public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
default List<OrderBodyDO> selectGroup(Long orderId) {
return selectList(new LambdaQueryWrapperX<OrderBodyDO>()
.eqIfPresent(OrderBodyDO::getOrderId, orderId)
@@ -19,4 +21,10 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
default List<OrderBodyDO> selectListBody(Long orderId) {
return selectList(new LambdaQueryWrapperX<OrderBodyDO>()
.eqIfPresent(OrderBodyDO::getOrderId, orderId));
}
}
@@ -25,8 +25,10 @@ public interface ProductionProcessService {
// 查看板材信息的组合名称
List<OrderModuleVO> selectPlateName(Long stepItemId);
// 查询生产单对应的柜体名称
List<OrderBodyRespVo> selectBodyName(OrderBodyReqVO reqVO);
}
@@ -1,18 +1,22 @@
package com.cf.imes.module.manage.service.process;
import cn.hutool.core.bean.BeanUtil;
import com.cf.imes.framework.common.enums.ProcessingStatusEnum;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.manage.config.VocieParameters;
import com.cf.imes.module.manage.controller.admin.process.vo.*;
import com.cf.imes.module.manage.controller.admin.query.vo.productionStatus.OrderModuleVO;
import com.cf.imes.module.manage.dal.dataobject.pack.OrderBodyDO;
import com.cf.imes.module.manage.dal.dataobject.process.OrderProcessStepItemNDO;
import com.cf.imes.module.manage.dal.dataobject.process.OrderProcessStepNDO;
import com.cf.imes.module.manage.dal.dataobject.process.ProcessDO;
import com.cf.imes.module.manage.dal.dataobject.query.OrderItemDO;
import com.cf.imes.module.manage.dal.mysql.pack.OrderBodyMapper;
import com.cf.imes.module.manage.dal.mysql.process.ProcessMapper;
import com.cf.imes.module.manage.dal.mysql.process.ProcessStepItemMapper;
import com.cf.imes.module.manage.dal.mysql.process.ProcessStepMapper;
@@ -61,6 +65,9 @@ public class ProductionProcessServiceImpl implements ProductionProcessService {
private ProcessMapper processMapper;
@Resource
private OrderBodyMapper orderBodyMapper;
@Resource
private OrderItemMapper orderItemMapper;
@@ -176,6 +183,23 @@ public class ProductionProcessServiceImpl implements ProductionProcessService {
// 查询生产单对应的柜体名称
@Override
public List<OrderBodyRespVo> selectBodyName(OrderBodyReqVO reqVO) {
if(reqVO.getProcessType() == 7){
// 等于 7(组件加工) ,则不返回柜体信息
return null;
}
List<OrderBodyDO> orderBodyDOS = orderBodyMapper.selectListBody(reqVO.getOrderId());
return BeanUtils.toBean(orderBodyDOS, OrderBodyRespVo.class);
}
}
@@ -1,9 +1,7 @@
package com.cf.imes.module.manage.service.voice;
import com.cf.imes.framework.quartz.config.XxlJobProperties;
import com.cf.imes.module.manage.config.VocieParameters;
import com.cf.imes.module.manage.config.XxlJobParameter;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
@@ -1,43 +0,0 @@
package com.cf.imes.module.manage.util.xxjJob;
import com.cf.imes.framework.quartz.config.XxlJobProperties;
import com.cf.imes.module.manage.config.XxlJobParameter;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.XxlJob;
import javax.annotation.Resource;
public class XxlJobUtil extends IJobHandler {
@Resource
private XxlJobParameter xxlJobParameter;
// 定时删除
public void deleteFile(){
XxlJobProperties xxlJobProperties = new XxlJobProperties();
xxlJobProperties.setEnabled(xxlJobParameter.getEnabled());
xxlJobProperties.setAccessToken(xxlJobParameter.getAccessToken());
xxlJobProperties.getAdmin().setAddresses(xxlJobParameter.getAddresses());
xxlJobProperties.getExecutor().setAppName(xxlJobParameter.getAppName());
xxlJobProperties.getExecutor().setPort(xxlJobParameter.getPort().intValue());
xxlJobProperties.getExecutor().setIp(xxlJobParameter.getIp());
xxlJobProperties.getExecutor().setLogPath(xxlJobParameter.getLogPath());
xxlJobProperties.getExecutor().setLogRetentionDays(xxlJobParameter.getLogRetentionDays().intValue());
}
@Override
@XxlJob("demoJobHandler")
public void execute() throws Exception {
deleteFile();
System.out.println("定时任务测试");
}
}