Browse Source

add: 添加物料图片显示

master
yanps 3 days ago
parent
commit
a0011c62cf
  1. 8
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/controller/SchBaseVehiclematerialgroupController.java
  2. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java
  3. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java
  4. 46
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java
  5. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java
  6. 15
      lms/nladmin-ui/src/views/wms/sch/group/index.vue
  7. 9
      lms/nladmin-ui/src/views/wms/sch/group/schBaseVehiclematerialgroup.js

8
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); 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("新增组盘信息管理")

7
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<SchBaseVeh
* 查询物料路径是空的 * 查询物料路径是空的
*/ */
List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty(); List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty();
/**
* 查询物料图片路径
* @param groupId
* @return
*/
String selectMaterialFile(String groupId);
} }

3
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 = "物料图片路径") @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;

46
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.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) {

3
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")){ } 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());
} }

15
lms/nladmin-ui/src/views/wms/sch/group/index.vue

@ -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)

9
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 }

Loading…
Cancel
Save