change - 生产派工选择BOM上传的图纸、SOP

master
yinq 1 month ago
parent d237373e1e
commit 79f3dad67b

@ -126,4 +126,13 @@ public class MesMaterialBomController extends BaseController
return toAjax(mesMaterialBomService.updateBomAttachInfo(mesMaterialBom)); return toAjax(mesMaterialBomService.updateBomAttachInfo(mesMaterialBom));
} }
/**
* BOM
*/
@GetMapping("getBomAttachInfo/{attachType}/{materialBomIds}")
public AjaxResult getBomAttachInfo(@PathVariable String attachType, @PathVariable Long[] materialBomIds)
{
return success(mesMaterialBomService.getBomAttachInfo(attachType, materialBomIds));
}
} }

@ -1,6 +1,8 @@
package com.hw.mes.service; package com.hw.mes.service;
import java.util.List; import java.util.List;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.domain.MesMaterialBom; import com.hw.mes.domain.MesMaterialBom;
/** /**
@ -89,4 +91,12 @@ public interface IMesMaterialBomService
* @return * @return
*/ */
public int updateBomAttachInfo(MesMaterialBom mesMaterialBom); public int updateBomAttachInfo(MesMaterialBom mesMaterialBom);
/**
* BOM
* @param attachType
* @param materialBomIds
* @return
*/
public List<MesBaseAttachInfo> getBomAttachInfo(String attachType, Long[] materialBomIds);
} }

@ -1,6 +1,7 @@
package com.hw.mes.service.impl; package com.hw.mes.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -11,6 +12,8 @@ import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.MailUtils; import com.hw.common.core.utils.MailUtils;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.service.IMesBaseAttachInfoService;
import com.hw.system.api.RemoteUserService; import com.hw.system.api.RemoteUserService;
import com.hw.system.api.domain.SysUser; import com.hw.system.api.domain.SysUser;
import com.hw.system.api.model.LoginUser; import com.hw.system.api.model.LoginUser;
@ -35,6 +38,9 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService {
@Autowired @Autowired
private RemoteUserService remoteUserService; private RemoteUserService remoteUserService;
@Autowired
private IMesBaseAttachInfoService mesBaseAttachInfoService;
/** /**
* BOM * BOM
* *
@ -260,4 +266,41 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService {
return mesMaterialBomMapper.updateMesMaterialBom(mesMaterialBom); return mesMaterialBomMapper.updateMesMaterialBom(mesMaterialBom);
} }
/**
* BOM
* @param attachType
* @param materialBomIds
* @return
*/
@Override
public List<MesBaseAttachInfo> getBomAttachInfo(String attachType, Long[] materialBomIds) {
List<Long> attachIdList = new ArrayList<>();
for (Long materialBomId : materialBomIds) {
if (attachType.equals("1")){
MesMaterialBom materialBom = mesMaterialBomMapper.selectMesMaterialBomByMaterialBomId(materialBomId);
if (StringUtils.isNotEmpty(materialBom.getAttachId())){
String[] split = materialBom.getAttachId().split(",");
List<Long> longList = Arrays.stream(split)
.map(Long::valueOf) // 转换每个字符串为 Long
.collect(Collectors.toList());
attachIdList.addAll(longList);
}
} else {
MesMaterialBom materialBom = mesMaterialBomMapper.selectMesMaterialBomByMaterialBomId(materialBomId);
if (StringUtils.isNotEmpty(materialBom.getSopId())){
String[] split = materialBom.getSopId().split(",");
List<Long> longList = Arrays.stream(split)
.map(Long::valueOf) // 转换每个字符串为 Long
.collect(Collectors.toList());
attachIdList.addAll(longList);
}
}
}
if (attachIdList.size() > 0){
Long[] attachIds = attachIdList.toArray(new Long[0]);
return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(attachIds);
}
return null;
}
} }

@ -74,3 +74,11 @@ export function updateBomAttachInfo(data) {
data: data data: data
}) })
} }
// 查询物料BOM版本列表
export function getBomAttachInfo(attachType, materialBomIds) {
return request({
url: '/mes/materialBom/getBomAttachInfo/' + attachType + '/' + materialBomIds,
method: 'get'
})
}

@ -241,6 +241,18 @@
title="上传图纸" title="上传图纸"
width="30%" width="30%"
@before-close="blueprintModel = false"> @before-close="blueprintModel = false">
<el-form ref="form">
<el-form-item label="选择BOM图纸">
<el-select v-model="materialBomAttachIdList" placeholder="请选择选择BOM图纸" multiple filterable :clearable="false">
<el-option
v-for="item in attachInfoList"
:key="item.attachId"
:label="item.attachName"
:value="item.attachId"
></el-option>
</el-select>
</el-form-item>
</el-form>
<el-upload <el-upload
single single
ref="drawingUpload" ref="drawingUpload"
@ -303,6 +315,18 @@
title="上传SOP附件" title="上传SOP附件"
width="30%" width="30%"
@before-close="sopViewModel = false"> @before-close="sopViewModel = false">
<el-form ref="form">
<el-form-item label="选择BOM的SOP">
<el-select v-model="materialBomAttachIdList" placeholder="请选择选择BOM的SOP" multiple filterable :clearable="false">
<el-option
v-for="item in attachInfoList"
:key="item.attachId"
:label="item.attachName"
:value="item.attachId"
></el-option>
</el-select>
</el-form-item>
</el-form>
<el-upload <el-upload
single single
ref="drawingUpload" ref="drawingUpload"
@ -397,6 +421,8 @@ import {getConfigKey} from "@//api/system/config"
import {deepClone} from "@//utils/index"; import {deepClone} from "@//utils/index";
import {getToken} from "@//utils/auth"; import {getToken} from "@//utils/auth";
import applyRawOutstock from '@//views/wms/common/applyRawOutstock.vue'; import applyRawOutstock from '@//views/wms/common/applyRawOutstock.vue';
import {getBomAttachInfo, listMaterialBom} from "@/api/mes/materialBom";
import {listMaterialinfo} from "@/api/mes/materialinfo";
let id = 0 let id = 0
let deepSearch = (arr, target) => { let deepSearch = (arr, target) => {
@ -579,9 +605,21 @@ export default {
}, },
id: 1, id: 1,
processUsers: [] processUsers: [],
//BOMList
attachInfoList: [],
//BOMList
materialBomAttachIdList: [],
}; };
}, },
watch: {
'materialBomAttachIdList': {
handler(newVal, oldVal) {
console.log("val:",newVal,oldVal)
this.updateAttachInfoByBom(newVal, oldVal);
},
}
},
created() { created() {
const productOrderId = this.$route.params && this.$route.params.productOrderId; const productOrderId = this.$route.params && this.$route.params.productOrderId;
if (productOrderId) { if (productOrderId) {
@ -592,6 +630,7 @@ export default {
}); });
} }
this.getConfigValues(); this.getConfigValues();
}, },
methods: { methods: {
@ -616,7 +655,7 @@ export default {
}); });
getConfigKey("mes.sop.maxSize").then(res => { getConfigKey("mes.sop.maxSize").then(res => {
if(res.msg){ if (res.msg) {
this.sopFileSize = res.msg; this.sopFileSize = res.msg;
} }
}); });
@ -1160,6 +1199,16 @@ export default {
} }
this.addProductPlanObject = row; this.addProductPlanObject = row;
this.materialBomAttachIdList = [];
getBomAttachInfo("1", this.addProductPlanObject.materialBomId).then(response => {
this.attachInfoList = response.data;
for (let e of this.fileList) {
let attachInfo = this.attachInfoList.find(item => item.attachPath === e.url);
if (attachInfo != null){
this.materialBomAttachIdList.push(attachInfo.attachId);
}
}
});
this.blueprintModel = true; this.blueprintModel = true;
}, },
@ -1215,9 +1264,10 @@ export default {
handleRemoveDrawing(file) { handleRemoveDrawing(file) {
let arrPic = this.$refs.drawingUpload.uploadFiles; let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file); let index = arrPic.indexOf(file);
console.log("index",index)
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1); this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
// this.uploadAttachList.splice(index, 1); // this.uploadAttachList.splice(index, 1);
// this.fileList.splice(index, 1); this.fileList.splice(index, 1);
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1); this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
let num = 0; let num = 0;
arrPic.map((item) => { arrPic.map((item) => {
@ -1226,6 +1276,10 @@ export default {
} }
num++; num++;
}); });
let attachInfo = this.attachInfoList.find(item => item.attachPath === file.url);
if (attachInfo != null){
this.materialBomAttachIdList = this.materialBomAttachIdList.filter(item => item !== attachInfo.attachId);
}
}, },
@ -1282,6 +1336,16 @@ export default {
} }
this.addProductPlanObject = row; this.addProductPlanObject = row;
this.materialBomAttachIdList = [];
getBomAttachInfo("2", this.addProductPlanObject.materialBomId).then(response => {
this.attachInfoList = response.data;
for (let e of this.fileList) {
let attachInfo = this.attachInfoList.find(item => item.attachPath === e.url);
if (attachInfo != null){
this.materialBomAttachIdList.push(attachInfo.attachId);
}
}
});
this.sopViewModel = true; this.sopViewModel = true;
}, },
@ -1339,6 +1403,7 @@ export default {
let index = arrPic.indexOf(file); let index = arrPic.indexOf(file);
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1); this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1); this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
this.fileList.splice(index, 1);
let num = 0; let num = 0;
arrPic.map((item) => { arrPic.map((item) => {
if (item.uid === file.uid) { if (item.uid === file.uid) {
@ -1346,19 +1411,20 @@ export default {
} }
num++; num++;
}); });
let attachInfo = this.attachInfoList.find(item => item.attachPath === file.url);
if (attachInfo != null){
this.materialBomAttachIdList = this.materialBomAttachIdList.filter(item => item !== attachInfo.attachId);
}
}, },
// loading // loading
handleBeforeUpload(file) { handleBeforeUpload(file) {
let fileType,fileSize; let fileType, fileSize;
if(this.sopViewModel){ if (this.sopViewModel) {
fileType = this.sopFileType; fileType = this.sopFileType;
fileSize = this.sopFileSize; fileSize = this.sopFileSize;
}else if(this.blueprintModel){ } else if (this.blueprintModel) {
fileType = this.drawingFileType; fileType = this.drawingFileType;
fileSize = this.drawingFileSize; fileSize = this.drawingFileSize;
} }
@ -1421,6 +1487,60 @@ export default {
closeRawOutstockDialog() { closeRawOutstockDialog() {
this.applyRawOutstockOpen = false; this.applyRawOutstockOpen = false;
}, },
//BOMSOP
updateAttachInfoByBom(newVal, oldVal) {
if (newVal.length === 0) {
return
}
let result = [];
let targetAttachIds = newVal.filter(item => !oldVal.includes(item));
for (let targetAttachId of targetAttachIds) {
result.push(this.attachInfoList.find(item => item.attachId === targetAttachId));
}
console.log("result:",result);
let isDrawing = this.blueprintModel;
//
if (isDrawing) {
for (let e of result) {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
let groupAttachFile = {};
groupAttachFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupAttachFile.processId = this.addProductPlanObject.processId;
groupAttachFile.attachId = e.attachId;
groupAttachFile.attachPath = e.attachPath;
groupAttachFile.attachName = e.attachName;
let groupAttachFileList = this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = groupAttachFileList ? this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(groupAttachFile);
let uploadAttachList = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = uploadAttachList ? this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(e.attachId);
}
} else {
//SOP
for (let e of result) {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
let groupSopFile = {};
groupSopFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupSopFile.processId = this.addProductPlanObject.processId;
groupSopFile.attachId = e.attachId;
groupSopFile.attachPath = e.attachPath;
groupSopFile.attachName = e.attachName;
let groupSopFileList = this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = groupSopFileList ? this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(groupSopFile);
let uploadSopList = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] = uploadSopList ? this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId] : [];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].push(e.attachId);
}
}
}
}, },
@ -1431,3 +1551,7 @@ export default {
} }
; ;
</script> </script>
<style scoped>
/deep/.el-icon-close{display:none}
</style>

Loading…
Cancel
Save