add: 添加物料图片显示
This commit is contained in:
@@ -39,6 +39,14 @@ public class SchBaseVehiclematerialgroupController {
|
|||||||
return new ResponseEntity<>(TableDataInfo.build(schBaseVehiclematerialgroupService.queryAll(whereJson,page)),HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(schBaseVehiclematerialgroupService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("selectMaterialFile")
|
||||||
|
@Log("查询物料图片啊")
|
||||||
|
@ApiOperation("查询物料图片啊")
|
||||||
|
//@SaCheckPermission("@el.check('schBaseVehiclematerialgroup:list')")
|
||||||
|
public ResponseEntity<Object> selectMaterialFile(@RequestParam String groupId){
|
||||||
|
return new ResponseEntity<>(schBaseVehiclematerialgroupService.selectMaterialFile(groupId),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增组盘信息管理")
|
@Log("新增组盘信息管理")
|
||||||
@ApiOperation("新增组盘信息管理")
|
@ApiOperation("新增组盘信息管理")
|
||||||
|
|||||||
@@ -99,4 +99,11 @@ public interface ISchBaseVehiclematerialgroupService extends IService<SchBaseVeh
|
|||||||
* 查询物料路径是空的
|
* 查询物料路径是空的
|
||||||
*/
|
*/
|
||||||
List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty();
|
List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询物料图片路径
|
||||||
|
* @param groupId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String selectMaterialFile(String groupId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,6 +162,9 @@ public class SchBaseVehiclematerialgroup implements Serializable {
|
|||||||
@ApiModelProperty(value = "物料图片路径")
|
@ApiModelProperty(value = "物料图片路径")
|
||||||
private String material_path;
|
private String material_path;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String materialFile;
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String material_name;
|
private String material_name;
|
||||||
|
|||||||
@@ -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.nl.wms.sch.task_manage.task.tasks.pcoperation.PcOperationCMTask;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
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.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -215,8 +220,45 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
|||||||
@Override
|
@Override
|
||||||
public List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty() {
|
public List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty() {
|
||||||
return this.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
return this.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||||
.isNull(SchBaseVehiclematerialgroup::getMaterial_path)
|
.isNull(SchBaseVehiclematerialgroup::getMaterial_path));
|
||||||
.eq(SchBaseVehiclematerialgroup::getGroup_id,"9434"));
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@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) {
|
private Long getTime(String dateString) {
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ public class CNTTask extends AbstractTask {
|
|||||||
} else if(task.getPoint_code1().endsWith("4")){
|
} else if(task.getPoint_code1().endsWith("4")){
|
||||||
String replace = task.getPoint_code1().replace("4", "3");
|
String replace = task.getPoint_code1().replace("4", "3");
|
||||||
SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class)
|
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)){
|
if(ObjectUtil.isNotEmpty(schBaseTask)){
|
||||||
task.setTask_status(TaskStatus.TIMEOUT.getCode());
|
task.setTask_status(TaskStatus.TIMEOUT.getCode());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,7 +268,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-dialog :visible.sync="dialogVisible1" title="物料图片">
|
<el-dialog :visible.sync="dialogVisible1" title="物料图片">
|
||||||
<img :src="imageUrl" alt="物料图片" style="max-width: 100%;">
|
<img :src="materialFile" alt="物料图片" style="max-width: 100%;">
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="创建任务"
|
title="创建任务"
|
||||||
@@ -332,7 +332,7 @@
|
|||||||
content="点击查看图片"
|
content="点击查看图片"
|
||||||
placement="top"
|
placement="top"
|
||||||
>
|
>
|
||||||
<div @click="showImage(scope.row.material_id)">
|
<div @click="showImage(scope.row.group_id)">
|
||||||
{{ scope.row.material_id }}
|
{{ scope.row.material_id }}
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@@ -469,7 +469,8 @@ export default {
|
|||||||
vehicle_code: '',
|
vehicle_code: '',
|
||||||
point_code1: ''
|
point_code1: ''
|
||||||
},
|
},
|
||||||
errGif: errGif
|
errGif: errGif,
|
||||||
|
materialFile: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -482,9 +483,12 @@ export default {
|
|||||||
[CRUD.HOOK.beforeRefresh]() {
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
showImage(materialId) {
|
showImage(groupId) {
|
||||||
console.log('Clicked material_id:', materialId)
|
|
||||||
this.dialogVisible1 = true
|
this.dialogVisible1 = true
|
||||||
|
crudSchBaseVehiclematerialgroup.selectMaterialFile(groupId).then(res => {
|
||||||
|
console.log(res.data)
|
||||||
|
this.materialFile = res
|
||||||
|
})
|
||||||
// 在这里处理点击逻辑,例如弹出图片、显示详情等
|
// 在这里处理点击逻辑,例如弹出图片、显示详情等
|
||||||
},
|
},
|
||||||
getWorkShopList() { // 获取车间列表
|
getWorkShopList() { // 获取车间列表
|
||||||
@@ -557,6 +561,7 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
crudSchBaseVehiclematerialgroup.createTask(this.newTask).then(res => {
|
crudSchBaseVehiclematerialgroup.createTask(this.newTask).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
|
this.$notify({ type: 'success', message: '任务创建成功!' })
|
||||||
this.dialogVisible = false // 只在成功后关闭对话框
|
this.dialogVisible = false // 只在成功后关闭对话框
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('任务创建失败:', error)
|
console.error('任务创建失败:', error)
|
||||||
|
|||||||
@@ -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 }
|
||||||
|
|||||||
Reference in New Issue
Block a user