From a0011c62cf02784abe3d33cd4c0eb5f54d2c2d89 Mon Sep 17 00:00:00 2001 From: yanps Date: Thu, 21 Nov 2024 10:18:06 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...SchBaseVehiclematerialgroupController.java | 8 ++++ .../ISchBaseVehiclematerialgroupService.java | 7 +++ .../dao/SchBaseVehiclematerialgroup.java | 3 ++ ...chBaseVehiclematerialgroupServiceImpl.java | 46 ++++++++++++++++++- .../task/tasks/connector/CNTTask.java | 3 +- .../src/views/wms/sch/group/index.vue | 15 ++++-- .../sch/group/schBaseVehiclematerialgroup.js | 9 +++- 7 files changed, 82 insertions(+), 9 deletions(-) diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/controller/SchBaseVehiclematerialgroupController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/controller/SchBaseVehiclematerialgroupController.java index 086c0c2..b0e3508 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/controller/SchBaseVehiclematerialgroupController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/controller/SchBaseVehiclematerialgroupController.java @@ -39,6 +39,14 @@ public class SchBaseVehiclematerialgroupController { return new ResponseEntity<>(TableDataInfo.build(schBaseVehiclematerialgroupService.queryAll(whereJson,page)),HttpStatus.OK); } + @GetMapping("selectMaterialFile") + @Log("查询物料图片啊") + @ApiOperation("查询物料图片啊") + //@SaCheckPermission("@el.check('schBaseVehiclematerialgroup:list')") + public ResponseEntity selectMaterialFile(@RequestParam String groupId){ + return new ResponseEntity<>(schBaseVehiclematerialgroupService.selectMaterialFile(groupId),HttpStatus.OK); + } + @PostMapping @Log("新增组盘信息管理") @ApiOperation("新增组盘信息管理") diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java index 2320678..82e131e 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java @@ -99,4 +99,11 @@ public interface ISchBaseVehiclematerialgroupService extends IService selectMaterialPathIsEmpty(); + + /** + * 查询物料图片路径 + * @param groupId + * @return + */ + String selectMaterialFile(String groupId); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java index 8aa1308..e2307ff 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java @@ -162,6 +162,9 @@ public class SchBaseVehiclematerialgroup implements Serializable { @ApiModelProperty(value = "物料图片路径") private String material_path; + @TableField(exist = false) + private String materialFile; + @TableField(exist = false) private String material_name; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java index bb3d0ab..a7b2e9a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java @@ -33,7 +33,12 @@ import org.nl.wms.sch.task.service.ISchBaseTaskService; import org.nl.wms.sch.task_manage.task.tasks.pcoperation.PcOperationCMTask; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import sun.misc.BASE64Encoder; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.util.*; import java.util.stream.Collectors; @@ -215,8 +220,45 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl selectMaterialPathIsEmpty() { return this.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) - .isNull(SchBaseVehiclematerialgroup::getMaterial_path) - .eq(SchBaseVehiclematerialgroup::getGroup_id,"9434")); + .isNull(SchBaseVehiclematerialgroup::getMaterial_path)); + } + + + @Override + public String selectMaterialFile(String groupId) { + SchBaseVehiclematerialgroup one = this.getOne(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) + .eq(SchBaseVehiclematerialgroup::getGroup_id, groupId)); + if (ObjectUtil.isNotEmpty(one)){ + if(StrUtil.isNotEmpty(one.getMaterial_path())){ + InputStream inputStream = null; + byte[] data = null; + String contentType=""; + try { + String fileName = one.getMaterial_path().substring(one.getMaterial_path().lastIndexOf("/") + 1, one.getMaterial_path().length()); + String suffix = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()); + if ("jpg".equalsIgnoreCase(suffix) || "jpeg".equalsIgnoreCase(suffix)) { + contentType = "data:image/jpeg;base64,"; + } else if ("png".equalsIgnoreCase(suffix)) { + contentType = "data:image/png;base64,"; + } else if("aac".equalsIgnoreCase(suffix)){ + contentType = "data:audio/aac;base64,"; + } else if("mp3".equalsIgnoreCase(suffix)){ + contentType = "data:audio/x-mpeg;base64,"; + } else if("wav".equalsIgnoreCase(suffix)){ + contentType = "data:audio/x-wav;base64,"; + } + inputStream = new FileInputStream(one.getMaterial_path()); + data = new byte[inputStream.available()]; + inputStream.read(data); + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + BASE64Encoder encoder = new BASE64Encoder(); + return contentType + encoder.encode(data).replace("\r\n", ""); + } + } + return null; } private Long getTime(String dateString) { diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java index 462fe83..237fe17 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java @@ -99,7 +99,8 @@ public class CNTTask extends AbstractTask { } else if(task.getPoint_code1().endsWith("4")){ String replace = task.getPoint_code1().replace("4", "3"); SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class) - .eq(SchBaseTask::getPoint_code1, replace)); + .eq(SchBaseTask::getPoint_code1, replace) + .le(SchBaseTask::getTask_status,TaskStatus.EXECUTING.getCode())); if(ObjectUtil.isNotEmpty(schBaseTask)){ task.setTask_status(TaskStatus.TIMEOUT.getCode()); } diff --git a/lms/nladmin-ui/src/views/wms/sch/group/index.vue b/lms/nladmin-ui/src/views/wms/sch/group/index.vue index 9d9114e..9b93afa 100644 --- a/lms/nladmin-ui/src/views/wms/sch/group/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/group/index.vue @@ -268,7 +268,7 @@ - 物料图片 + 物料图片 -
+
{{ scope.row.material_id }}
@@ -469,7 +469,8 @@ export default { vehicle_code: '', point_code1: '' }, - errGif: errGif + errGif: errGif, + materialFile: '' } }, created() { @@ -482,9 +483,12 @@ export default { [CRUD.HOOK.beforeRefresh]() { return true }, - showImage(materialId) { - console.log('Clicked material_id:', materialId) + showImage(groupId) { this.dialogVisible1 = true + crudSchBaseVehiclematerialgroup.selectMaterialFile(groupId).then(res => { + console.log(res.data) + this.materialFile = res + }) // 在这里处理点击逻辑,例如弹出图片、显示详情等 }, getWorkShopList() { // 获取车间列表 @@ -557,6 +561,7 @@ export default { if (valid) { crudSchBaseVehiclematerialgroup.createTask(this.newTask).then(res => { console.log(res) + this.$notify({ type: 'success', message: '任务创建成功!' }) this.dialogVisible = false // 只在成功后关闭对话框 }).catch(error => { console.error('任务创建失败:', error) diff --git a/lms/nladmin-ui/src/views/wms/sch/group/schBaseVehiclematerialgroup.js b/lms/nladmin-ui/src/views/wms/sch/group/schBaseVehiclematerialgroup.js index b275451..b84030a 100644 --- a/lms/nladmin-ui/src/views/wms/sch/group/schBaseVehiclematerialgroup.js +++ b/lms/nladmin-ui/src/views/wms/sch/group/schBaseVehiclematerialgroup.js @@ -48,4 +48,11 @@ export function createTask(data) { }) } -export default { add, edit, del, getGroup, selectByVehicle, createTask } +export function selectMaterialFile(groupId) { + return request({ + url: 'api/schBaseVehiclematerialgroup/selectMaterialFile?groupId=' + groupId, + method: 'get' + }) +} + +export default { add, edit, del, getGroup, selectByVehicle, createTask, selectMaterialFile }