change - BOM上传图纸、SOP,选择用户邮箱通知

master
yinq 2 months ago
parent ad2da3edb0
commit d237373e1e

@ -113,4 +113,17 @@ public class MesMaterialBomController extends BaseController
return success(mesMaterialBomService.getMaterialVisionList(materialId));
}
/**
*
* @param mesMaterialBom
* @return
*/
@PostMapping("updateBomAttachInfo")
@RequiresPermissions("mes:materialBom:edit")
@Log(title = "物料BOM信息", businessType = BusinessType.UPDATE)
public AjaxResult updateBomAttachInfo(@RequestBody MesMaterialBom mesMaterialBom)
{
return toAjax(mesMaterialBomService.updateBomAttachInfo(mesMaterialBom));
}
}

@ -1,6 +1,7 @@
package com.hw.mes.domain;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import com.hw.common.core.utils.StringUtils;
@ -116,6 +117,29 @@ public class MesMaterialBom extends TreeEntity {
/** sop附件ID关联附件信息主键;多个用,隔开 */
private String sopId;
/**
* 1-2-SOP
*/
private String attachType;
private List<String> userNameList;
public String getAttachType() {
return attachType;
}
public void setAttachType(String attachType) {
this.attachType = attachType;
}
public List<String> getUserNameList() {
return userNameList;
}
public void setUserNameList(List<String> userNameList) {
this.userNameList = userNameList;
}
public String getAttachId() {
return attachId;
}

@ -82,4 +82,11 @@ public interface IMesMaterialBomService
* @return BOM
*/
public MesMaterialBom selectTopMaterialBomByMaterialBomId(Long materialBomId);
/**
*
* @param mesMaterialBom
* @return
*/
public int updateBomAttachInfo(MesMaterialBom mesMaterialBom);
}

@ -5,13 +5,21 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.MailUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.system.api.RemoteUserService;
import com.hw.system.api.domain.SysUser;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesMaterialBomMapper;
import com.hw.mes.domain.MesMaterialBom;
import com.hw.mes.service.IMesMaterialBomService;
import org.springframework.transaction.annotation.Transactional;
/**
* BOMService
@ -24,6 +32,9 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService {
@Autowired
private MesMaterialBomMapper mesMaterialBomMapper;
@Autowired
private RemoteUserService remoteUserService;
/**
* BOM
*
@ -214,4 +225,39 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService {
}
}
/**
*
* @param mesMaterialBom
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int updateBomAttachInfo(MesMaterialBom mesMaterialBom) {
List<SysUser> sysUserList = new ArrayList<>();
StringBuilder sendMsg = new StringBuilder();
sendMsg.append("BOM名称:").append(mesMaterialBom.getMaterialName());
if (mesMaterialBom.getUserNameList().size() == 0){
throw new ServiceException("请选择通知用户!");
}
for (String userName : mesMaterialBom.getUserNameList()) {
R<LoginUser> userInfo = remoteUserService.getUserInfo(userName, SecurityConstants.INNER);
SysUser sysUser = userInfo.getData().getSysUser();
if (StringUtils.isEmpty(sysUser.getEmail())){
throw new ServiceException(sysUser.getNickName() + "用户未维护邮箱!");
}
sysUserList.add(sysUser);
}
if (mesMaterialBom.getAttachType().equals("1")){
sendMsg.append(",图纸已维护成功!");
} else {
sendMsg.append("SOP已维护成功");
}
for (SysUser sysUser : sysUserList) {
String email = sysUser.getEmail();
MailUtils.processSendEmail(email, "通知", sendMsg.toString());
}
mesMaterialBom.setUpdateTime(DateUtils.getNowDate());
return mesMaterialBomMapper.updateMesMaterialBom(mesMaterialBom);
}
}

@ -65,3 +65,12 @@ export function changeBomStatus(materialBomId, activeFlag) {
data: data
})
}
// 更新附件信息并通知用户
export function updateBomAttachInfo(data) {
return request({
url: '/mes/materialBom/updateBomAttachInfo',
method: 'post',
data: data
})
}

@ -298,6 +298,18 @@
title="上传图纸"
width="30%"
@before-close="blueprintModel = false">
<el-form ref="form">
<el-form-item label="通知用户">
<el-select v-model="userNoticeList" placeholder="请选择通知用户" multiple filterable>
<el-option
v-for="item in userList"
:key="item.userName"
:label="item.nickName"
:value="item.userName"
></el-option>
</el-select>
</el-form-item>
</el-form>
<el-upload
single
ref="drawingUpload"
@ -360,6 +372,18 @@
title="上传SOP附件"
width="30%"
@before-close="sopViewModel = false">
<el-form ref="form">
<el-form-item label="通知用户">
<el-select v-model="userNoticeList" placeholder="请选择通知用户" multiple filterable>
<el-option
v-for="item in userList"
:key="item.userName"
:label="item.nickName"
:value="item.userName"
></el-option>
</el-select>
</el-form-item>
</el-form>
<el-upload
single
ref="drawingUpload"
@ -439,7 +463,7 @@ import {
delMaterialBom,
addMaterialBom,
updateMaterialBom,
changeBomStatus
changeBomStatus, updateBomAttachInfo
} from "@/api/mes/materialBom";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@ -448,6 +472,7 @@ import {verifyBOMIsProduction} from "@//api/mes/productOrder";
import {getToken} from "@/utils/auth";
import {getDispatchDrawingList, getDispatchSOPAttachList, uploadFile} from "@/api/mes/productplan";
import {selectByAttachIds} from "@/api/mes/baseAttachInfo";
import {findUserList} from "@/api/system/user";
export default {
name: "MaterialBom",
@ -599,6 +624,10 @@ export default {
headers: {
Authorization: "Bearer " + getToken(),
},
//List
userList: [],
//List
userNoticeList: [],
};
},
watch: {
@ -621,6 +650,9 @@ export default {
/** 查询物料BOM信息列表 */
getList() {
this.loading = true;
findUserList({}).then(response => {
this.userList = response.data;
});
listMaterialBom(this.queryParams).then(response => {
this.materialBomList = this.handleTree(response.data, "materialBomId", "parentId");
this.loading = false;
@ -888,6 +920,7 @@ export default {
/** 查看图纸 */
handleDrawing(row) {
this.fileList = [];
this.userNoticeList = [];
if (row.attachId != null && row.attachId !== "") {
selectByAttachIds(row.attachId).then(res => {
let attachList = res.data;
@ -913,14 +946,19 @@ export default {
this.uploadAttachList = [];
let updateData = {
materialBomId: this.addProductPlanObject.materialBomId,
parentId: this.addProductPlanObject.parentId,
materialName: this.addProductPlanObject.materialName,
userNameList: this.userNoticeList,
attachType: "1",
attachId: this.addProductPlanObject.attachId
}
updateMaterialBom(updateData).then(response => {
updateBomAttachInfo(updateData).then(response => {
this.$modal.msgSuccess("更新图纸成功");
this.addProductPlanObject = null;
this.blueprintModel = false;
this.getList();
}).catch(() => {
this.addProductPlanObject = null;
this.sopViewModel = false;
});
},
//
@ -960,6 +998,7 @@ export default {
/** 查看sop */
handleSop(row) {
this.fileList = [];
this.userNoticeList = [];
if (row.sopId != null && row.sopId !== "") {
selectByAttachIds(row.sopId).then(res => {
let attachList = res.data;
@ -985,14 +1024,19 @@ export default {
this.uploadSopList = [];
let updateData = {
materialBomId: this.addProductPlanObject.materialBomId,
parentId: this.addProductPlanObject.parentId,
materialName: this.addProductPlanObject.materialName,
userNameList: this.userNoticeList,
attachType: "2",
sopId: this.addProductPlanObject.sopId
}
updateMaterialBom(updateData).then(response => {
updateBomAttachInfo(updateData).then(response => {
this.$modal.msgSuccess("更新SOP成功");
this.addProductPlanObject = null;
this.sopViewModel = false;
this.getList();
}).catch(() => {
this.addProductPlanObject = null;
this.sopViewModel = false;
});
},
//Sop

Loading…
Cancel
Save