diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanSaveReqVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanSaveReqVO.java index f8e876ff1..e5f417c78 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanSaveReqVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanSaveReqVO.java @@ -4,6 +4,7 @@ import com.cf.imes.framework.es.core.valid.CreateGroup; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; +import javax.validation.Valid; import javax.validation.constraints.*; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; @@ -15,8 +16,8 @@ public class PlanSaveReqVO { @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12776") private Long id; - @Schema(description = "排单号", requiredMode = Schema.RequiredMode.REQUIRED) - private String planNo; + /*@Schema(description = "排单号", requiredMode = Schema.RequiredMode.REQUIRED) + private String planNo;*/ @Schema(description = "排序优先级", requiredMode = Schema.RequiredMode.REQUIRED) //@NotNull(groups = CreateGroup.class,message = "排序优先级不能为空") @@ -45,8 +46,11 @@ public class PlanSaveReqVO { /*@Schema(description = "生产单id列表", requiredMode = Schema.RequiredMode.REQUIRED) private List orderIds;*/ - @Schema(description = "板件id列表") - private List plateIds; + /*@Schema(description = "板件id列表") + private List plateIds;*/ + + @Schema(description = "生产单id与商品id 列表") + private List itemList; @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") private String remark; @@ -58,4 +62,15 @@ public class PlanSaveReqVO { @Schema(description = "生产时间", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "生产时间不能为空", groups = CreateGroup.class) private LocalDateTime produceTime; + + @Valid + @Data + public static class Item { + @Schema(description = "生产单id") + @NotNull + private Long orderId; + @Schema(description = "商品id") + @NotNull + private Long goodsId; + } } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateMapper.java index ce4b887e2..6ccb2ae93 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateMapper.java @@ -10,6 +10,7 @@ import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; +import com.cf.imes.module.executor.controller.admin.plan.vo.PlanSaveReqVO; import com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage; import com.cf.imes.module.executor.controller.admin.plan.vo.PlateParam; import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList; @@ -88,4 +89,6 @@ public interface PlateMapper extends BaseMapperX { } IPage selectProductList(@Param("page") IPage page , @Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId); + + Set selectBatchOrderIdsAndGoodsIds(@Param("itemList") List itemList); } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java index a7b180e1d..b71ac5b98 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.executor.service.plan; import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; @@ -84,6 +85,9 @@ public class PlanServiceImpl implements PlanService { @Resource private OrderBodyMapper orderBodyMapper; + @Resource + private IdentifierGenerator identifierGenerator; + @Override @Transactional(rollbackFor = Exception.class) public Long createPlan(PlanSaveReqVO createReqVO) { @@ -92,6 +96,7 @@ public class PlanServiceImpl implements PlanService { PlanDO plan = BeanUtils.toBean(createReqVO, PlanDO.class); plan.setIsPay(Boolean.FALSE); plan.setSort(sort); + plan.setPlanNo(identifierGenerator.nextId(null).toString()); planMapper.insert(plan); Long planId = plan.getId(); /* List orderIds = createReqVO.getOrderIds(); @@ -105,7 +110,10 @@ public class PlanServiceImpl implements PlanService { } planOrderMapper.insertBatch(planOrderDOS); }*/ - List plateIds = createReqVO.getPlateIds(); + //List plateIds = createReqVO.getPlateIds(); + List itemList = createReqVO.getItemList(); + Set plateIds = plateMapper.selectBatchOrderIdsAndGoodsIds(itemList); + if (CollectionUtil.isNotEmpty(plateIds)) { ArrayList planItemDOS = new ArrayList<>(); for (Long plateId : plateIds) { diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml index b92678619..c43392258 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml @@ -55,4 +55,12 @@ AND (#{bodyId} IS NULL OR b.body_id = #{bodyId}) GROUP BY a.id, c.material, c.color; + + \ No newline at end of file diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/test/TestController.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/test/TestController.java index 7abed1a7f..3366e5e70 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/test/TestController.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/test/TestController.java @@ -70,8 +70,120 @@ 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 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 re = new RedisTemplate<>(); + + int randomInt = new Random(System.currentTimeMillis()).nextInt(900) + 100;// 生成100到999之间的随机数 + + + + return randomInt; + + } + @TestOnly