change - 生产派工图纸按照用户分组、BOM附件校验生产派工是否已绑定附件

master
yinq 3 months ago
parent ac66d555f1
commit 7c5f12ce00

@ -323,4 +323,28 @@ public class MesProductPlanController extends BaseController {
return R.fail(e.getMessage());
}
}
/**
* List
* @param attachType
* @param dispatchCode
* @param processId
* @param userId
* @return
*/
@GetMapping(value = "/attachInfoList/{attachType}/{dispatchCode}/{processId}/{userId}")
public AjaxResult getAttachInfoList(@PathVariable("attachType") String attachType, @PathVariable("dispatchCode") String dispatchCode,
@PathVariable("processId") Long processId, @PathVariable("userId") Long userId) {
return success(mesProductPlanService.getAttachInfoList(dispatchCode, processId, userId, attachType));
}
/**
*
* @param attachId
* @return
*/
@GetMapping(value = "/checkMesProductPlanAttachInfo/{attachType}/{attachId}")
public AjaxResult checkMesProductPlanAttachInfo(@PathVariable("attachType") String attachType, @PathVariable("attachId") String attachId) {
return success(mesProductPlanService.checkMesProductPlanAttachInfo(attachType, attachId));
}
}

@ -5,14 +5,12 @@ import java.util.List;
import java.util.Map;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.domain.MesMaterialBom;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.domain.MesProductPlan;
import com.hw.mes.domain.vo.MesAssignTaskVo;
import com.hw.mes.domain.vo.MesMaterialScanVo;
import com.hw.mes.domain.vo.MesProductPlanDeleteVo;
import com.hw.mes.domain.vo.MesProductPlanEditVo;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -187,4 +185,21 @@ public interface IMesProductPlanService
*/
public List<MesProductPlan> selectMesProductPlanJoinUserList(MesProductPlan mesProductPlan);
/**
* List
* @param attachType
* @param dispatchCode
* @param processId
* @param userId
* @return
*/
public List<MesBaseAttachInfo> getAttachInfoList(String dispatchCode, Long processId, Long userId, String attachType);
/**
*
* @param attachType
* @param attachId
* @return
*/
String checkMesProductPlanAttachInfo(String attachType, String attachId);
}

@ -7,6 +7,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.hw.common.core.constant.CacheConstants;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException;
@ -15,6 +16,7 @@ import com.hw.common.core.utils.MailUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.redis.service.RedisService;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.mapper.MesProductPlanMapper;
import com.hw.mes.service.IMesBaseAttachInfoService;
import com.hw.system.api.RemoteUserService;
import com.hw.system.api.domain.SysUser;
@ -46,6 +48,9 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService {
@Autowired
private RedisService redisService;
@Autowired
private MesProductPlanMapper mesProductPlanMapper;
/**
* BOM
*
@ -290,23 +295,26 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService {
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);
MesMaterialBom mesMaterialBom = new MesMaterialBom();
mesMaterialBom.setAncestors(materialBomId.toString());
List<MesMaterialBom> materialBomList = mesMaterialBomMapper.selectMesMaterialBomList(mesMaterialBom);
for (MesMaterialBom materialBom : materialBomList) {
if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)){
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 {
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);
}
}
}
}

@ -9,12 +9,10 @@ import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.SocketUtils;
import com.hw.common.core.utils.ip.IpUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseStationInfo;
import com.hw.mes.config.MesConfig;
import com.hw.mes.domain.*;
import com.hw.mes.domain.vo.MesAssignTaskVo;
@ -25,7 +23,6 @@ import com.hw.mes.mapper.*;
import com.hw.mes.service.IMesBaseAttachInfoService;
import com.hw.mes.service.IMesProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import com.hw.common.core.utils.StringUtils;
@ -776,6 +773,81 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
return mesProductPlanMapper.selectMesProductPlanJoinUserList(mesProductPlan);
}
/**
* List
* @param attachType
* @param dispatchCode
* @param processId
* @param userId
* @return
*/
@Override
public List<MesBaseAttachInfo> getAttachInfoList(String dispatchCode, Long processId, Long userId, String attachType) {
MesProductPlan queryProductPlan = new MesProductPlan();
queryProductPlan.setProcessId(processId);
queryProductPlan.setDispatchCode(dispatchCode);
queryProductPlan.setUserId(userId);
List<MesProductPlan> mesProductPlans = mesProductPlanMapper.selectOnlyMesProductPlans(queryProductPlan);
if (mesProductPlans != null && !mesProductPlans.isEmpty()) {
MesProductPlan mesProductPlan = mesProductPlans.get(0);
try {
if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)) {
if (StringUtils.isEmpty(mesProductPlan.getAttachId())) {
return new ArrayList<>();
}
Long[] attachIds = Arrays.stream(mesProductPlan.getAttachId().split(","))
.map(String::trim)
.map(Long::parseLong)
.toArray(Long[]::new);
return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(attachIds);
} else if (attachType.equals(MesConstants.MES_ATTACH_TYPE_SOP)) {
if (StringUtils.isEmpty(mesProductPlan.getSopId())) {
return new ArrayList<>();
}
Long[] sopIds = Arrays.stream(mesProductPlan.getSopId().split(","))
.map(String::trim)
.map(Long::parseLong)
.toArray(Long[]::new);
return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(sopIds);
} else {
return new ArrayList<>();
}
} catch (Exception e) {
return new ArrayList<>();
}
}
return new ArrayList<>();
}
/**
*
* @param attachType
* @param attachId
* @return
*/
@Override
public String checkMesProductPlanAttachInfo(String attachType, String attachId) {
String result = null;
StringBuilder buffer = new StringBuilder();
buffer.append("生产派工已绑定此");
List<MesProductPlan> productPlanList = new ArrayList<>();
MesProductPlan mesProductPlan = new MesProductPlan();
if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)) {
mesProductPlan.setAttachId(attachId);
productPlanList = mesProductPlanMapper.selectMesProductPlanList(mesProductPlan);
buffer.append("图纸!");
} else if (attachType.equals(MesConstants.MES_ATTACH_TYPE_SOP)){
mesProductPlan.setSopId(attachId);
productPlanList = mesProductPlanMapper.selectMesProductPlanList(mesProductPlan);
buffer.append("SOP");
}
if (productPlanList.size() > 0){
result = buffer.toString();
}
//未绑定
return result;
}
// public String executeAssignTaskResultTask() {
// ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

@ -62,7 +62,7 @@
<include refid="selectMesMaterialBomVo"/>
<where>
<if test="parentId != null ">and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''">and ancestors like concat('%', #{ancestors},'%')</if>
<if test="ancestors != null and ancestors != ''">and (material_bom_id = #{ancestors} or ancestors like concat('%', #{ancestors},'%'))</if>
<if test="materialId != null ">and material_id = #{materialId}</if>
<if test="erpMaterialId != null ">and erp_material_id = #{erpMaterialId}</if>
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},

@ -152,7 +152,8 @@
<if test="planEndTime != null ">and mpp.plan_end_time = #{planEndTime}</if>
<if test="realBeginTime != null ">and mpp.real_begin_time = #{realBeginTime}</if>
<if test="realEndTime != null ">and mpp.real_end_time = #{realEndTime}</if>
<if test="attachId != null and attachId != ''">and mpp.attach_id = #{attachId}</if>
<if test="attachId != null and attachId != ''">and mpp.attach_id like concat('%', #{attachId},'%')</if>
<if test="sopId != null and sopId != ''">and mpp.sop_id like concat('%', #{sopId},'%')</if>
<if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</if>
<if test="isFlag != null and isFlag != ''">and mpp.is_flag = #{isFlag}</if>
</where>
@ -510,6 +511,7 @@
<where>
<if test="dispatchCode != null and dispatchCode != ''">and a.dispatch_code = #{dispatchCode}</if>
<if test="processId != null ">and a.process_id = #{processId}</if>
<if test="userId != null ">and a.user_id = #{userId}</if>
<if test="finalProcessFlag != null and finalProcessFlag != ''">and a.final_process_flag = #{finalProcessFlag}</if>
<if test="productOrderId != null ">and a.product_order_id = #{productOrderId}</if>
</where>

@ -154,3 +154,19 @@ export function getUserList(query) {
params: query
})
}
// 获取生产派工附件List列表
export function getAttachInfoList(attachType, dispatchCode, processId, userId) {
return request({
url: '/mes/productplan/attachInfoList/' + attachType + '/' + dispatchCode + '/' + processId + '/' + userId,
method: 'get'
})
}
// 校验生产派工是否已绑定附件
export function checkMesProductPlanAttachInfo(attachType, attachIds) {
return request({
url: '/mes/productplan/checkMesProductPlanAttachInfo/' + attachType + '/' + attachIds,
method: 'get'
})
}

@ -470,7 +470,10 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import selectMaterial from '@//views/mes/materialinfo/selectMaterial.vue';
import {verifyBOMIsProduction} from "@//api/mes/productOrder";
import {getToken} from "@/utils/auth";
import {getDispatchDrawingList, getDispatchSOPAttachList, uploadFile} from "@/api/mes/productplan";
import {
checkMesProductPlanAttachInfo,
uploadFile
} from "@/api/mes/productplan";
import {selectByAttachIds} from "@/api/mes/baseAttachInfo";
import {findUserList} from "@/api/system/user";
import {getConfigKey} from "@/api/system/config";
@ -972,6 +975,7 @@ export default {
},
//
drawingFileUploadSubmit() {
this.$modal.loading();
this.addProductPlanObject.attachId = this.uploadAttachList[this.addProductPlanObject.materialBomId].join(",");
this.uploadAttachList = [];
let updateData = {
@ -984,6 +988,7 @@ export default {
updateBomAttachInfo(updateData).then(response => {
this.$modal.msgSuccess("更新图纸成功");
this.addProductPlanObject = null;
this.$modal.closeLoading();
this.blueprintModel = false;
this.getList();
}).catch(() => {
@ -1013,9 +1018,20 @@ export default {
);
},
//
handleRemoveDrawing(file) {
async handleRemoveDrawing(file) {
let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file);
let flag = false;
let attachId = this.uploadAttachList[this.addProductPlanObject.materialBomId][index];
await checkMesProductPlanAttachInfo("1", attachId).then(res => {
if (res.msg != null){
this.$modal.msgWarning(res.msg);
flag = true
}
})
if (flag){
return
}
this.uploadAttachList[this.addProductPlanObject.materialBomId].splice(index, 1);
let num = 0;
arrPic.map((item) => {
@ -1050,6 +1066,7 @@ export default {
},
//sop
sopFileUploadSubmit() {
this.$modal.loading();
this.addProductPlanObject.sopId = this.uploadSopList[this.addProductPlanObject.materialBomId].join(",");
this.uploadSopList = [];
let updateData = {
@ -1062,6 +1079,7 @@ export default {
updateBomAttachInfo(updateData).then(response => {
this.$modal.msgSuccess("更新SOP成功");
this.addProductPlanObject = null;
this.$modal.closeLoading();
this.sopViewModel = false;
this.getList();
}).catch(() => {
@ -1091,9 +1109,20 @@ export default {
);
},
//
handleRemoveSop(file) {
async handleRemoveSop(file) {
let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file);
let flag = false;
let attachId = this.uploadAttachList[this.addProductPlanObject.materialBomId][index];
await checkMesProductPlanAttachInfo("2", attachId).then(res => {
if (res.msg != null){
this.$modal.msgWarning(res.msg);
flag = true
}
})
if (flag){
return
}
this.uploadSopList[this.addProductPlanObject.materialBomId].splice(index, 1);
let num = 0;
arrPic.map((item) => {

@ -409,13 +409,13 @@
import {getProductOrder} from "@//api/mes/productOrder";
import {
deleteProductPlansByDispatchCode,
getDispatchCode, getDispatchDrawingList, getDispatchSOPAttachList,
getDispatchCode,
selectProductPlans,
checkAddMesProductPlanList,
orderAddMesProductPlanList,
getBaseRouteProcesses,
getProcessUsers,
uploadFile
uploadFile, getAttachInfoList
} from "@//api/mes/productplan";
import {getConfigKey} from "@//api/system/config"
import {deepClone} from "@//utils/index";
@ -604,7 +604,10 @@ export default {
INTERNAL: '2',//
},
id: 1,
ATTACH_TYPE: {
DRAWING: "1",//:
SOP: "2",//:SOP
},
processUsers: [],
//BOMList
attachInfoList: [],
@ -615,7 +618,6 @@ export default {
watch: {
'materialBomAttachIdList': {
handler(newVal, oldVal) {
console.log("val:",newVal,oldVal)
this.updateAttachInfoByBom(newVal, oldVal);
},
}
@ -804,21 +806,23 @@ export default {
this.$set(data.children, data.children.length, {
id: id,
dispatchCode: scope.row.dispatchCode,
processId: scope.row.processId,
productionTime: scope.row.productionTime,
materialBomId: scope.row.materialBomId,
planStatus: this.PLAN_STATUS.DISPATCHED,
userId: ""
userId: null
})
} else {
this.$set(data, 'children', [
{
id: id,
dispatchCode: scope.row.dispatchCode,
processId: scope.row.processId,
productionTime: scope.row.productionTime,
materialBomId: scope.row.materialBomId,
planStatus: this.PLAN_STATUS.DISPATCHED,
userId: "",
userId: null,
}
])
}
@ -901,8 +905,8 @@ export default {
toUpdatedProductPlan.planEndTime = processUser.planEndTime;
toUpdatedProductPlan.planId = processUser.planId;
toUpdatedProductPlan.planStatus = processUser.planStatus;
toUpdatedProductPlan.attachId = e.attachId;
toUpdatedProductPlan.sopId = e.sopId;
toUpdatedProductPlan.attachId = processUser.attachId;
toUpdatedProductPlan.sopId = processUser.sopId;
toUpdatedProductPlan.planAmount = planDispatchAmount;
toUpdatedProductPlan.dispatchAmount = planDispatchAmount;
toUpdatedProductPlan.children = null;
@ -1117,11 +1121,12 @@ export default {
} else {
obj.children = [{
id: this.id,
dispatchCode: obj.dispatchCode,
processId: obj.processId,
materialBomId: obj.materialBomId,
planStatus: this.PLAN_STATUS.DISPATCHED,
productionTime: obj.productionTime,
userId: ""
userId: null
}]
}
@ -1166,10 +1171,10 @@ export default {
/** 查看图纸 */
handleDrawing(row) {
this.fileList = [];
if (row.planId != null && (!this.previewDrawingFlag[row.dispatchCode + "-" + row.processId]
|| this.previewDrawingFlag[row.dispatchCode + "-" + row.processId] !== "1")) {
this.previewDrawingFlag[row.dispatchCode + "-" + row.processId] = "1";
getDispatchDrawingList(row.dispatchCode, row.processId).then(res => {
if (row.planId != null && (!this.previewDrawingFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId]
|| this.previewDrawingFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId] !== "1")) {
this.previewDrawingFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId] = "1";
getAttachInfoList(this.ATTACH_TYPE.DRAWING, row.dispatchCode, row.processId, row.userId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
@ -1183,19 +1188,19 @@ export default {
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 groupAttachFileList = this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupAttachFileList ? this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].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);
let uploadAttachList = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadAttachList ? this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(e.attachId);
})
})
} else {
if (this.groupAttachFileList[row.dispatchCode + "-" + row.processId]) {
this.groupAttachFileList[row.dispatchCode + "-" + row.processId].forEach(e => {
if (this.groupAttachFileList[row.dispatchCode + "-" + row.processId + "-" + row.userId]) {
this.groupAttachFileList[row.dispatchCode + "-" + row.processId + "-" + row.userId].forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
@ -1206,7 +1211,7 @@ export default {
this.addProductPlanObject = row;
this.materialBomAttachIdList = [];
getBomAttachInfo("1", this.addProductPlanObject.materialBomId).then(response => {
getBomAttachInfo(this.ATTACH_TYPE.DRAWING, 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);
@ -1222,9 +1227,12 @@ export default {
drawingFileUploadSubmit() {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
let mesProductPlan = this.mesProductPlanList[i];
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId) {
this.mesProductPlanList[i].attachId = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].join(",");
for (let child of mesProductPlan.children) {
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId
&& child.userId === this.addProductPlanObject.userId) {
child.attachId = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].join(",");
}
}
}
// this.uploadAttachList = [];
@ -1240,12 +1248,12 @@ export default {
const formData = new FormData();
formData.append("file", fileData);
formData.append("processId", this.addProductPlanObject.processId);
formData.append("attachType", "1");
formData.append("attachType", this.ATTACH_TYPE.DRAWING);
uploadFile(formData).then(
(res) => {
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(res.attachId);
let uploadAttachList = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadAttachList ? this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(res.attachId);
//
let groupAttachFile = {};
@ -1254,9 +1262,9 @@ export default {
groupAttachFile.attachId = res.attachId;
groupAttachFile.attachPath = res.imgUrl;
groupAttachFile.attachName = res.fileName;
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 groupAttachFileList = this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupAttachFileList ? this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupAttachFile);
this.$modal.closeLoading();
}, (err) => {
this.$refs.drawingUpload.clearFiles(); //
@ -1269,10 +1277,10 @@ export default {
handleRemoveDrawing(file) {
let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file);
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].splice(index, 1);
// this.uploadAttachList.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 + "-" + this.addProductPlanObject.userId].splice(index, 1);
let num = 0;
arrPic.map((item) => {
if (item.uid === file.uid) {
@ -1290,10 +1298,10 @@ export default {
/** 查看sop */
handleSop(row) {
this.fileList = [];
if (row.planId != null && (!this.previewSopFlag[row.dispatchCode + "-" + row.processId]
|| this.previewSopFlag[row.dispatchCode + "-" + row.processId] !== "1")) {
this.previewSopFlag[row.dispatchCode + "-" + row.processId] = "1";
getDispatchSOPAttachList(row.dispatchCode, row.processId).then(res => {
if (row.planId != null && (!this.previewSopFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId]
|| this.previewSopFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId] !== "1")) {
this.previewSopFlag[row.dispatchCode + "-" + row.processId + "-" + row.userId] = "1";
getAttachInfoList(this.ATTACH_TYPE.SOP, row.dispatchCode, row.processId, row.userId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
@ -1307,19 +1315,19 @@ export default {
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 groupSopFileList = this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupSopFileList ? this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].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);
let uploadSopList = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadSopList ? this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(e.attachId);
})
})
} else {
if (this.groupSopFileList[row.dispatchCode + "-" + row.processId]) {
this.groupSopFileList[row.dispatchCode + "-" + row.processId].forEach(e => {
if (this.groupSopFileList[row.dispatchCode + "-" + row.processId + "-" + row.userId]) {
this.groupSopFileList[row.dispatchCode + "-" + row.processId + "-" + row.userId].forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
@ -1330,7 +1338,7 @@ export default {
this.addProductPlanObject = row;
this.materialBomAttachIdList = [];
getBomAttachInfo("2", this.addProductPlanObject.materialBomId).then(response => {
getBomAttachInfo(this.ATTACH_TYPE.SOP, 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);
@ -1346,10 +1354,12 @@ export default {
sopFileUploadSubmit() {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
let mesProductPlan = this.mesProductPlanList[i];
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId) {
this.mesProductPlanList[i].sopId = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].join(",");
for (let child of mesProductPlan.children) {
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId
&& child.userId === this.addProductPlanObject.userId) {
child.sopId = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].join(",");
}
}
}
// this.uploadAttachList = [];
@ -1365,12 +1375,12 @@ export default {
const formData = new FormData();
formData.append("file", fileData);
formData.append("processId", this.addProductPlanObject.processId);
formData.append("attachType", "2");
formData.append("attachType", this.ATTACH_TYPE.SOP);
uploadFile(formData).then(
(res) => {
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(res.attachId);
let uploadSopList = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadSopList ? this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(res.attachId);
//
let groupSopFile = {};
@ -1379,9 +1389,9 @@ export default {
groupSopFile.attachId = res.attachId;
groupSopFile.attachPath = res.imgUrl;
groupSopFile.attachName = res.fileName;
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 groupSopFileList = this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupSopFileList ? this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupSopFile);
this.$modal.closeLoading();
}, (err) => {
this.$refs.drawingUpload.clearFiles(); //
@ -1394,8 +1404,8 @@ export default {
handleRemoveSop(file) {
let arrPic = this.$refs.drawingUpload.uploadFiles;
let index = arrPic.indexOf(file);
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId].splice(index, 1);
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].splice(index, 1);
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].splice(index, 1);
this.fileList.splice(index, 1);
let num = 0;
arrPic.map((item) => {
@ -1505,12 +1515,12 @@ export default {
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);
let groupAttachFileList = this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupAttachFileList ? this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupAttachFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupAttachFile);
let uploadAttachList = this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadAttachList ? this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadAttachList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(e.attachId);
}
} else {
//SOP
@ -1525,12 +1535,12 @@ export default {
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);
let groupSopFileList = this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = groupSopFileList ? this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.groupSopFileList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(groupSopFile);
let uploadSopList = this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] = uploadSopList ? this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId] : [];
this.uploadSopList[this.addProductPlanObject.dispatchCode + "-" + this.addProductPlanObject.processId + "-" + this.addProductPlanObject.userId].push(e.attachId);
}
}
},

Loading…
Cancel
Save