change - add采购申请流程v1、提资单BOM导入、发送邮件方法

master
yinq 9 months ago
parent 851832812b
commit b8344eadde

@ -8,10 +8,7 @@ import com.hw.system.api.domain.common.WfProcessActivity;
import com.hw.system.api.domain.common.vo.WfProcessActivityVo;
import com.hw.system.api.factory.RemoteSysCommonFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -34,4 +31,7 @@ public interface RemoteSysCommonService {
@PostMapping("/pointRouter/insertPointRouterInfo")
R<SysPointRouter> insertSysPointRouterPort(@RequestBody List<SysPointRouter> sysPointRouterList, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/wfprocessactivity/processActivityUserInfo")
R<WfProcessActivity> selectProcessActivityUserInfo(@RequestHeader(SecurityConstants.FROM_SOURCE) String source, Long processActivityId);
}

@ -31,6 +31,26 @@ public class WfProcessActivityAuth extends BaseEntity
private Long authTargetId;
private String nickName;
private String userName;
private String email;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getNickName() {
return nickName;
}

@ -52,6 +52,12 @@ public class RemoteSysCommonFallbackFactory implements FallbackFactory<RemoteSys
return R.fail("调用提示路由信息失败:" + throwable.getMessage());
}
@Override
public R<WfProcessActivity> selectProcessActivityUserInfo(String source, Long processActivityId) {
return R.fail("获取工单流程步骤用户信息失败:" + throwable.getMessage());
}
};
}
}

@ -33,7 +33,35 @@ public class WfConstants {
/**质检文件关联类型*/
public static final String QMS_FILE_TARGET_TYPE_QUALITY_INSTANCE_ACTIVITY = "1";//质检工单实例节点
/**采购申请流程ID*/
public static final Long WF_PURCHASE_REQUISITION_PROCESS_ID = 401L;
/**流程节点:采购申请流程创建*/
public static final Long WF_PURCHASE_ACTIVITY_CREATE_ID = 4011L;
/**流程节点:采购申请流程采购审核*/
public static final Long WF_PURCHASE_ACTIVITY_PROCUREMENT_AUDIT_ID = 4012L;
/**流程节点:采购申请流程技术修改*/
public static final Long WF_PURCHASE_ACTIVITY_TECHNICAL_MODIFY_ID = 4013L;
/**流程节点采购申请流程ERP修改*/
public static final Long WF_PURCHASE_ACTIVITY_ERP_MODIFY_ID = 4014L;
/**流程节点:采购申请流程完成*/
public static final Long WF_PURCHASE_ACTIVITY_FINISH_ID = 4015L;
/**采购申请流程:通知标识(0否 1是)*/
public static final String PA_NOTICE_FLAG_YES = "1";
/**采购申请流程:通知标识(0否 1是)*/
public static final String PA_NOTICE_FLAG_NO = "0";
/**采购申请流程:异常标识(0否 1是)*/
public static final String PA_ANOMALY_FLAG_YES = "1";
/**采购申请流程:异常标识(0否 1是)*/
public static final String PA_ANOMALY_FLAG_NO = "0";
/**采购申请流程:更新标识(0否 1是)*/
public static final String PA_UPDATE_FLAG_YES = "1";
/**采购申请流程:更新标识(0否 1是)*/
public static final String PA_UPDATE_FLAG_NO = "0";
/**采购申请流程:导入标识(0否 1是)*/
public static final String PA_IMPORT_FLAG_YES = "1";
/**采购申请流程:导入标识(0否 1是)*/
public static final String PA_IMPORT_FLAG_NO = "0";
}

@ -48,4 +48,53 @@ public class MailUtils {
throw new RuntimeException(e);
}
}
/**
*
* @param receiverEmail
* @param subject
* @param text
*/
public static void processSendEmail(String receiverEmail, String subject, String text) {
// 设置发件人、收件人、SMTP服务器等信息
String senderEmail = "chencheng01@jsjyep.com";
// String receiverEmail = "chencheng01@jsjyep.com";
String password = "QH6faJaWw5rgvM4u";
String host = "smtp.exmail.qq.com"; // SMTP服务器地址
int port = 465; // 端口号如果是SSL连接常用465非SSL常用587或25
// 设置邮件服务器的属性
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.enable", "true"); // 启用SSL
props.put("mail.smtp.ssl.protocols", "TLSv1.2"); // 设置SSL/TLS版本
// props.put("mail.smtp.starttls.enable", "true"); // 如果是SSL连接则不需要这行
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
// 创建会话
Session session = Session.getInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(senderEmail, password);
}
});
try {
// 创建邮件消息
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(senderEmail));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(receiverEmail));
message.setSubject(subject);
message.setText(text);
// 发送邮件
Transport.send(message);
System.out.println("邮件已成功发送!");
} catch (MessagingException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}

@ -301,6 +301,14 @@ public class Seq {
// 虚拟采购订单信息的记录标识
public static final String mesVirtualPurchaseOrderCode = "VP";
// 采购申请任务编号
public static final String mesPurchaseApplyProcessSeqType = "purchaseApplyProcess";
// 采购申请任务编号序列数
private static AtomicInteger mesPurchaseApplyProcessSeq = new AtomicInteger(1);
// 采购申请任务编号的记录标识
public static final String mesPurchaseApplyProcessCode = "CG";
/**
*
@ -414,6 +422,8 @@ public class Seq {
atomicInt = mesVirtualSaleOrderSeq;
}else if (mesVirtualPurchaseOrderSeqType.equals(type)) {
atomicInt = mesVirtualPurchasaeOrderSeq;
}else if (mesPurchaseApplyProcessSeqType.equals(type)) {
atomicInt = mesPurchaseApplyProcessSeq;
}
return getId(atomicInt, 3, code);
}

@ -94,6 +94,10 @@
<groupId>com.hw</groupId>
<artifactId>hw-api-wms</artifactId>
</dependency>
<dependency>
<groupId>com.hw</groupId>
<artifactId>hw-api-system</artifactId>
</dependency>
</dependencies>
<build>

@ -60,4 +60,19 @@ public class MesImportController extends BaseController {
return success(message);
}
/**
* BOMexcel
* @param file
* @param updateSupport
* @return
*/
@Log(title = "提资单BOM信息", businessType = BusinessType.IMPORT)
@PostMapping(("/raiseCapitalImportData"))
public AjaxResult raiseCapitalImportData(MultipartFile file, boolean updateSupport)
{
String operName = SecurityUtils.getUsername();
String message = mesImportService.raiseCapitalImportData(file, updateSupport, operName);
return success(message);
}
}

@ -0,0 +1,128 @@
package com.hw.mes.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesPurchaseApplyProcess;
import com.hw.mes.service.IMesPurchaseApplyProcessService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-09-19
*/
@RestController
@RequestMapping("/purchaseApplyProcess")
public class MesPurchaseApplyProcessController extends BaseController {
@Autowired
private IMesPurchaseApplyProcessService mesPurchaseApplyProcessService;
/**
*
*/
@RequiresPermissions("mes:purchaseApplyProcess:list")
@GetMapping("/list")
public TableDataInfo list(MesPurchaseApplyProcess mesPurchaseApplyProcess) {
startPage();
List<MesPurchaseApplyProcess> list = mesPurchaseApplyProcessService.selectMesPurchaseApplyProcessList(mesPurchaseApplyProcess);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:purchaseApplyProcess:export")
@Log(title = "采购申请流程", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesPurchaseApplyProcess mesPurchaseApplyProcess) {
List<MesPurchaseApplyProcess> list = mesPurchaseApplyProcessService.selectMesPurchaseApplyProcessList(mesPurchaseApplyProcess);
ExcelUtil<MesPurchaseApplyProcess> util = new ExcelUtil<MesPurchaseApplyProcess>(MesPurchaseApplyProcess.class);
util.exportExcel(response, list, "采购申请流程数据");
}
/**
*
*/
@RequiresPermissions("mes:purchaseApplyProcess:query")
@GetMapping(value = "/{purchaseApplyId}")
public AjaxResult getInfo(@PathVariable("purchaseApplyId") Long purchaseApplyId) {
return success(mesPurchaseApplyProcessService.selectMesPurchaseApplyProcessByPurchaseApplyId(purchaseApplyId));
}
/**
*
*/
@RequiresPermissions("mes:purchaseApplyProcess:add")
@Log(title = "采购申请流程", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesPurchaseApplyProcess mesPurchaseApplyProcess) {
return toAjax(mesPurchaseApplyProcessService.insertMesPurchaseApplyProcess(mesPurchaseApplyProcess));
}
/**
*
*/
@RequiresPermissions("mes:purchaseApplyProcess:edit")
@Log(title = "采购申请流程", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesPurchaseApplyProcess mesPurchaseApplyProcess) {
return toAjax(mesPurchaseApplyProcessService.updateMesPurchaseApplyProcess(mesPurchaseApplyProcess));
}
/**
*
*/
@RequiresPermissions("mes:purchaseApplyProcess:remove")
@Log(title = "采购申请流程", businessType = BusinessType.DELETE)
@DeleteMapping("/{purchaseApplyIds}")
public AjaxResult remove(@PathVariable Long[] purchaseApplyIds) {
return toAjax(mesPurchaseApplyProcessService.deleteMesPurchaseApplyProcessByPurchaseApplyIds(purchaseApplyIds));
}
/**
*
* 1BOM
* 2
* @param mesPurchaseApplyProcess
* @return
*/
@Log(title = "采购申请流程", businessType = BusinessType.OTHER)
@PostMapping("purchaseAbnormalFlow")
@RequiresPermissions("mes:purchaseApplyProcess:purchaseEdit")
public AjaxResult purchaseAbnormalFlow(@RequestBody MesPurchaseApplyProcess mesPurchaseApplyProcess) {
return toAjax(mesPurchaseApplyProcessService.purchaseAbnormalFlow(mesPurchaseApplyProcess));
}
/**
*
* 1
* 2ERP
* @param mesPurchaseApplyProcess
* @return
*/
@Log(title = "采购申请流程", businessType = BusinessType.OTHER)
@PostMapping("technicalProcessing")
@RequiresPermissions("mes:purchaseApplyProcess:technicalEdit")
public AjaxResult technicalProcessing(@RequestBody MesPurchaseApplyProcess mesPurchaseApplyProcess) {
return toAjax(mesPurchaseApplyProcessService.technicalProcessing(mesPurchaseApplyProcess));
}
}

@ -0,0 +1,98 @@
package com.hw.mes.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesRaiseCapitalBom;
import com.hw.mes.service.IMesRaiseCapitalBomService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
/**
* BOMController
*
* @author Yinq
* @date 2024-09-18
*/
@RestController
@RequestMapping("/mesRaiseCapitalBom")
public class MesRaiseCapitalBomController extends BaseController {
@Autowired
private IMesRaiseCapitalBomService mesRaiseCapitalBomService;
/**
* BOM
*/
@RequiresPermissions("mes:mesRaiseCapitalBom:list")
@GetMapping("/list")
public AjaxResult list(MesRaiseCapitalBom mesRaiseCapitalBom)
{
List<MesRaiseCapitalBom> list = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(mesRaiseCapitalBom);
return success(list);
}
/**
* BOM
*/
@RequiresPermissions("mes:mesRaiseCapitalBom:export")
@Log(title = "提资单BOM信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesRaiseCapitalBom mesRaiseCapitalBom) {
List<MesRaiseCapitalBom> list = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(mesRaiseCapitalBom);
ExcelUtil<MesRaiseCapitalBom> util = new ExcelUtil<MesRaiseCapitalBom>(MesRaiseCapitalBom.class);
util.exportExcel(response, list, "提资单BOM信息数据");
}
/**
* BOM
*/
@RequiresPermissions("mes:mesRaiseCapitalBom:query")
@GetMapping(value = "/{raiseCapitalId}")
public AjaxResult getInfo(@PathVariable("raiseCapitalId") Long raiseCapitalId) {
return success(mesRaiseCapitalBomService.selectMesRaiseCapitalBomByRaiseCapitalId(raiseCapitalId));
}
/**
* BOM
*/
@RequiresPermissions("mes:mesRaiseCapitalBom:add")
@Log(title = "提资单BOM信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesRaiseCapitalBom mesRaiseCapitalBom) {
return toAjax(mesRaiseCapitalBomService.insertMesRaiseCapitalBom(mesRaiseCapitalBom));
}
/**
* BOM
*/
@RequiresPermissions("mes:mesRaiseCapitalBom:edit")
@Log(title = "提资单BOM信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesRaiseCapitalBom mesRaiseCapitalBom) {
return toAjax(mesRaiseCapitalBomService.updateMesRaiseCapitalBom(mesRaiseCapitalBom));
}
/**
* BOM
*/
@RequiresPermissions("mes:mesRaiseCapitalBom:remove")
@Log(title = "提资单BOM信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{raiseCapitalIds}")
public AjaxResult remove(@PathVariable Long[] raiseCapitalIds) {
return toAjax(mesRaiseCapitalBomService.deleteMesRaiseCapitalBomByRaiseCapitalIds(raiseCapitalIds));
}
}

@ -99,6 +99,24 @@ public class MesMaterialBom extends TreeEntity {
@Excel(name = "安装时长")
private Long assembleTime;
/**
*
*/
private String brand;
/**
*
*/
private String ancestors;
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public Long getAssembleTime() {
return assembleTime;
}
@ -247,4 +265,28 @@ public class MesMaterialBom extends TreeEntity {
.append("updateTime", getUpdateTime())
.toString();
}
public void copyFromMesRaiseCapitalBom(MesRaiseCapitalBom source) {
if (source != null) {
this.setMaterialBomId(source.getRaiseCapitalId());
this.setParentId(source.getParentId());
this.setAncestors(source.getAncestors());
this.setErpMaterialId(source.getErpMaterialId());
this.setMaterialClassfication(source.getMaterialClassfication());
this.setMaterialId(source.getMaterialId());
this.setMaterialName(source.getMaterialName());
this.setMaterialBomDesc(source.getMaterialBomDesc());
this.setStandardAmount(source.getStandardAmount());
this.setTopFlag(source.getTopFlag());
this.setCheckType(source.getCheckType());
this.setProjectId(source.getProjectId());
this.setActiveFlag(source.getActiveFlag());
this.setMaterialCode(source.getMaterialCode());
this.setMaterialSpec(source.getMaterialSpec());
this.setAssembleTime(source.getAssembleTime());
this.setMaterialNameDesc(source.getMaterialName());
this.setCreateBy(source.getCreateBy());
this.setCreateTime(source.getCreateTime());
}
}
}

@ -0,0 +1,155 @@
package com.hw.mes.domain;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* mes_purchase_apply_process
*
* @author Yinq
* @date 2024-09-19
*/
public class MesPurchaseApplyProcess extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long purchaseApplyId;
/**
*
*/
@Excel(name = "任务编号")
private String taskCode;
/**
*
*/
@Excel(name = "提资单成品名称")
private String materialName;
/**
* ID
*/
private Long wfProcessId;
/**
* ID
*/
private Long processActivityId;
/**
*
*/
private String processActivityName;
/**
* BOM(0 1)
*/
@Excel(name = "导入BOM标识(0否 1是)")
private String importFlag;
/**
*
*/
private List<MesPurchaseApplyProcessDetail> mesPurchaseApplyProcessDetailList;
/**
* (0 1)
*/
@Excel(name = "异常标识(0否 1是)")
private String currentAnomalyFlag;
public String getCurrentAnomalyFlag() {
return currentAnomalyFlag;
}
public void setCurrentAnomalyFlag(String currentAnomalyFlag) {
this.currentAnomalyFlag = currentAnomalyFlag;
}
public String getProcessActivityName() {
return processActivityName;
}
public void setProcessActivityName(String processActivityName) {
this.processActivityName = processActivityName;
}
public Long getProcessActivityId() {
return processActivityId;
}
public void setProcessActivityId(Long processActivityId) {
this.processActivityId = processActivityId;
}
public void setPurchaseApplyId(Long purchaseApplyId) {
this.purchaseApplyId = purchaseApplyId;
}
public Long getPurchaseApplyId() {
return purchaseApplyId;
}
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
public String getTaskCode() {
return taskCode;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialName() {
return materialName;
}
public void setWfProcessId(Long wfProcessId) {
this.wfProcessId = wfProcessId;
}
public Long getWfProcessId() {
return wfProcessId;
}
public void setImportFlag(String importFlag) {
this.importFlag = importFlag;
}
public String getImportFlag() {
return importFlag;
}
public List<MesPurchaseApplyProcessDetail> getMesPurchaseApplyProcessDetailList() {
return mesPurchaseApplyProcessDetailList;
}
public void setMesPurchaseApplyProcessDetailList(List<MesPurchaseApplyProcessDetail> mesPurchaseApplyProcessDetailList) {
this.mesPurchaseApplyProcessDetailList = mesPurchaseApplyProcessDetailList;
}
@Override
public String toString() {
return "MesPurchaseApplyProcess{" +
"purchaseApplyId=" + purchaseApplyId +
", taskCode='" + taskCode + '\'' +
", materialName='" + materialName + '\'' +
", wfProcessId=" + wfProcessId +
", processActivityId=" + processActivityId +
", processActivityName='" + processActivityName + '\'' +
", importFlag='" + importFlag + '\'' +
", mesPurchaseApplyProcessDetailList=" + mesPurchaseApplyProcessDetailList +
", currentAnomalyFlag='" + currentAnomalyFlag + '\'' +
'}';
}
}

@ -0,0 +1,158 @@
package com.hw.mes.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* mes_purchase_apply_process_detail
*
* @author Yinq
* @date 2024-09-19
*/
public class MesPurchaseApplyProcessDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long purchaseApplyDetailId;
/**
*
*/
@Excel(name = "任务编号")
private String taskCode;
/**
* ID
*/
@Excel(name = "流程节点ID")
private Long processActivityId;
/**
* (0 1)
*/
@Excel(name = "异常标识(0否 1是)")
private String anomalyFlag;
/**
* (0 1)
*/
@Excel(name = "更新标识(0否 1是)")
private String updateFlag;
/**
* (0 1)
*/
@Excel(name = "通知标识(0否 1是)")
private String noticeFlag;
/**
*
*/
@Excel(name = "通知用户编号")
private String noticeAuth;
/**
*
*/
@Excel(name = "备注")
private String purchaseRemark;
/**
*
*/
private String processActivityName;
public String getProcessActivityName() {
return processActivityName;
}
public void setProcessActivityName(String processActivityName) {
this.processActivityName = processActivityName;
}
public void setPurchaseApplyDetailId(Long purchaseApplyDetailId) {
this.purchaseApplyDetailId = purchaseApplyDetailId;
}
public Long getPurchaseApplyDetailId() {
return purchaseApplyDetailId;
}
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
public String getTaskCode() {
return taskCode;
}
public void setProcessActivityId(Long processActivityId) {
this.processActivityId = processActivityId;
}
public Long getProcessActivityId() {
return processActivityId;
}
public void setAnomalyFlag(String anomalyFlag) {
this.anomalyFlag = anomalyFlag;
}
public String getAnomalyFlag() {
return anomalyFlag;
}
public void setUpdateFlag(String updateFlag) {
this.updateFlag = updateFlag;
}
public String getUpdateFlag() {
return updateFlag;
}
public void setNoticeFlag(String noticeFlag) {
this.noticeFlag = noticeFlag;
}
public String getNoticeFlag() {
return noticeFlag;
}
public void setNoticeAuth(String noticeAuth) {
this.noticeAuth = noticeAuth;
}
public String getNoticeAuth() {
return noticeAuth;
}
public void setPurchaseRemark(String purchaseRemark) {
this.purchaseRemark = purchaseRemark;
}
public String getPurchaseRemark() {
return purchaseRemark;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("purchaseApplyDetailId", getPurchaseApplyDetailId())
.append("taskCode", getTaskCode())
.append("processActivityId", getProcessActivityId())
.append("anomalyFlag", getAnomalyFlag())
.append("updateFlag", getUpdateFlag())
.append("noticeFlag", getNoticeFlag())
.append("noticeAuth", getNoticeAuth())
.append("purchaseRemark", getPurchaseRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,292 @@
package com.hw.mes.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* BOM mes_raise_capital_bom
*
* @author Yinq
* @date 2024-09-18
*/
public class MesRaiseCapitalBom extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long raiseCapitalId;
/**
*
*/
@Excel(name = "任务编号")
private String taskCode;
/**
* bom;bom
*/
@Excel(name = "bom说明;顶级不能为空在选择bom时可以用此字段区分")
private String materialBomDesc;
/**
* ,bom
*/
@Excel(name = "父级标识,关联物料bom表主键")
private Long parentId;
/**
*
*/
@Excel(name = "祖级列表")
private String ancestors;
/**
* ID
*/
@Excel(name = "物料ID关联物料信息表主键")
private Long materialId;
/**
*
*/
@Excel(name = "物料名称")
private String materialName;
/**
* ;1
*/
@Excel(name = "标准数量;最顶级数量须为1")
private BigDecimal standardAmount;
/**
* (1,0)
*/
@Excel(name = "顶级标识(1是,0否)")
private Long topFlag;
/**
* (0,1,2)
*/
@Excel(name = "校验类型(0不校验,1人工校验,2自动校验)")
private String checkType;
/**
* IDmes_project_info
*/
@Excel(name = "项目ID关联mes_project_info的主键")
private Long projectId;
/**
* (s)
*/
@Excel(name = "装配时长(单位s)")
private Long assembleTime;
/**
* 1-0-
*/
@Excel(name = "激活标识1-是0-否")
private String activeFlag;
/**
*
*/
@Excel(name = "品牌")
private String brand;
/**
* 1ERP23MES
*/
@Excel(name = "物料分类1ERP同步2虚拟物料3MES物料")
private String materialClassfication;
/**
* ERPID
*/
@Excel(name = "物料信息表的ERPID")
private Long erpMaterialId;
/**
*
*/
@Excel(name = "物料编号")
private String materialCode;
private String materialSpec;
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
public void setRaiseCapitalId(Long raiseCapitalId) {
this.raiseCapitalId = raiseCapitalId;
}
public Long getRaiseCapitalId() {
return raiseCapitalId;
}
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
public String getTaskCode() {
return taskCode;
}
public void setMaterialBomDesc(String materialBomDesc) {
this.materialBomDesc = materialBomDesc;
}
public String getMaterialBomDesc() {
return materialBomDesc;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Long getParentId() {
return parentId;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public String getAncestors() {
return ancestors;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialName() {
return materialName;
}
public void setStandardAmount(BigDecimal standardAmount) {
this.standardAmount = standardAmount;
}
public BigDecimal getStandardAmount() {
return standardAmount;
}
public void setTopFlag(Long topFlag) {
this.topFlag = topFlag;
}
public Long getTopFlag() {
return topFlag;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public String getCheckType() {
return checkType;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
public Long getProjectId() {
return projectId;
}
public void setAssembleTime(Long assembleTime) {
this.assembleTime = assembleTime;
}
public Long getAssembleTime() {
return assembleTime;
}
public void setActiveFlag(String activeFlag) {
this.activeFlag = activeFlag;
}
public String getActiveFlag() {
return activeFlag;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getBrand() {
return brand;
}
public void setMaterialClassfication(String materialClassfication) {
this.materialClassfication = materialClassfication;
}
public String getMaterialClassfication() {
return materialClassfication;
}
public void setErpMaterialId(Long erpMaterialId) {
this.erpMaterialId = erpMaterialId;
}
public Long getErpMaterialId() {
return erpMaterialId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("raiseCapitalId", getRaiseCapitalId())
.append("taskCode", getTaskCode())
.append("materialBomDesc", getMaterialBomDesc())
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("materialId", getMaterialId())
.append("materialName", getMaterialName())
.append("standardAmount", getStandardAmount())
.append("topFlag", getTopFlag())
.append("checkType", getCheckType())
.append("projectId", getProjectId())
.append("assembleTime", getAssembleTime())
.append("activeFlag", getActiveFlag())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("brand", getBrand())
.append("materialClassfication", getMaterialClassfication())
.append("erpMaterialId", getErpMaterialId())
.toString();
}
}

@ -66,4 +66,12 @@ public interface MesMaterialBomMapper
* @return BOM
*/
public List<MesMaterialBom> selectMesMaterialBomJoinList(MesMaterialBom mesMaterialBom);
/**
* BOM
*
* @param mesMaterialBomList BOM
* @return
*/
public int batchMesMaterialBom(List<MesMaterialBom> mesMaterialBomList);
}

@ -0,0 +1,61 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesPurchaseApplyProcessDetail;
/**
* Mapper
*
* @author Open Platform
* @date 2024-09-24
*/
public interface MesPurchaseApplyProcessDetailMapper {
/**
*
*
* @param purchaseApplyDetailId
* @return
*/
public MesPurchaseApplyProcessDetail selectMesPurchaseApplyProcessDetailByPurchaseApplyDetailId(Long purchaseApplyDetailId);
/**
*
*
* @param mesPurchaseApplyProcessDetail
* @return
*/
public List<MesPurchaseApplyProcessDetail> selectMesPurchaseApplyProcessDetailList(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail);
/**
*
*
* @param mesPurchaseApplyProcessDetail
* @return
*/
public int insertMesPurchaseApplyProcessDetail(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail);
/**
*
*
* @param mesPurchaseApplyProcessDetail
* @return
*/
public int updateMesPurchaseApplyProcessDetail(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail);
/**
*
*
* @param purchaseApplyDetailId
* @return
*/
public int deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailId(Long purchaseApplyDetailId);
/**
*
*
* @param purchaseApplyDetailIds
* @return
*/
public int deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailIds(Long[] purchaseApplyDetailIds);
}

@ -0,0 +1,88 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesPurchaseApplyProcess;
import com.hw.mes.domain.MesPurchaseApplyProcessDetail;
/**
* Mapper
*
* @author Yinq
* @date 2024-09-19
*/
public interface MesPurchaseApplyProcessMapper {
/**
*
*
* @param purchaseApplyId
* @return
*/
public MesPurchaseApplyProcess selectMesPurchaseApplyProcessByPurchaseApplyId(Long purchaseApplyId);
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
public List<MesPurchaseApplyProcess> selectMesPurchaseApplyProcessList(MesPurchaseApplyProcess mesPurchaseApplyProcess);
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
public int insertMesPurchaseApplyProcess(MesPurchaseApplyProcess mesPurchaseApplyProcess);
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
public int updateMesPurchaseApplyProcess(MesPurchaseApplyProcess mesPurchaseApplyProcess);
/**
*
*
* @param purchaseApplyId
* @return
*/
public int deleteMesPurchaseApplyProcessByPurchaseApplyId(Long purchaseApplyId);
/**
*
*
* @param purchaseApplyIds
* @return
*/
public int deleteMesPurchaseApplyProcessByPurchaseApplyIds(Long[] purchaseApplyIds);
/**
*
*
* @param purchaseApplyIds
* @return
*/
public int deleteMesPurchaseApplyProcessDetailByTaskCodes(Long[] purchaseApplyIds);
/**
*
*
* @param mesPurchaseApplyProcessDetailList
* @return
*/
public int batchMesPurchaseApplyProcessDetail(List<MesPurchaseApplyProcessDetail> mesPurchaseApplyProcessDetailList);
/**
*
*
* @param purchaseApplyId ID
* @return
*/
public int deleteMesPurchaseApplyProcessDetailByTaskCode(Long purchaseApplyId);
}

@ -0,0 +1,61 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesRaiseCapitalBom;
/**
* BOMMapper
*
* @author Yinq
* @date 2024-09-18
*/
public interface MesRaiseCapitalBomMapper {
/**
* BOM
*
* @param raiseCapitalId BOM
* @return BOM
*/
public MesRaiseCapitalBom selectMesRaiseCapitalBomByRaiseCapitalId(Long raiseCapitalId);
/**
* BOM
*
* @param mesRaiseCapitalBom BOM
* @return BOM
*/
public List<MesRaiseCapitalBom> selectMesRaiseCapitalBomList(MesRaiseCapitalBom mesRaiseCapitalBom);
/**
* BOM
*
* @param mesRaiseCapitalBom BOM
* @return
*/
public int insertMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom);
/**
* BOM
*
* @param mesRaiseCapitalBom BOM
* @return
*/
public int updateMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom);
/**
* BOM
*
* @param raiseCapitalId BOM
* @return
*/
public int deleteMesRaiseCapitalBomByRaiseCapitalId(Long raiseCapitalId);
/**
* BOM
*
* @param raiseCapitalIds
* @return
*/
public int deleteMesRaiseCapitalBomByRaiseCapitalIds(Long[] raiseCapitalIds);
}

@ -31,4 +31,14 @@ public interface IMesImportService
* @return
*/
String BOMImportData(MultipartFile file, boolean updateSupport, String operName);
/**
* BOMexcel
* @param file
* @param updateSupport
* @param operName
* @return
*/
String raiseCapitalImportData(MultipartFile file, boolean updateSupport, String operName);
}

@ -0,0 +1,61 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesPurchaseApplyProcessDetail;
/**
* Service
*
* @author Open Platform
* @date 2024-09-24
*/
public interface IMesPurchaseApplyProcessDetailService
{
/**
*
*
* @param purchaseApplyDetailId
* @return
*/
public MesPurchaseApplyProcessDetail selectMesPurchaseApplyProcessDetailByPurchaseApplyDetailId(Long purchaseApplyDetailId);
/**
*
*
* @param mesPurchaseApplyProcessDetail
* @return
*/
public List<MesPurchaseApplyProcessDetail> selectMesPurchaseApplyProcessDetailList(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail);
/**
*
*
* @param mesPurchaseApplyProcessDetail
* @return
*/
public int insertMesPurchaseApplyProcessDetail(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail);
/**
*
*
* @param mesPurchaseApplyProcessDetail
* @return
*/
public int updateMesPurchaseApplyProcessDetail(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail);
/**
*
*
* @param purchaseApplyDetailIds
* @return
*/
public int deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailIds(Long[] purchaseApplyDetailIds);
/**
*
*
* @param purchaseApplyDetailId
* @return
*/
public int deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailId(Long purchaseApplyDetailId);
}

@ -0,0 +1,89 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesPurchaseApplyProcess;
import com.hw.mes.domain.MesPurchaseApplyProcessDetail;
/**
* Service
*
* @author Yinq
* @date 2024-09-19
*/
public interface IMesPurchaseApplyProcessService {
/**
*
*
* @param purchaseApplyId
* @return
*/
public MesPurchaseApplyProcess selectMesPurchaseApplyProcessByPurchaseApplyId(Long purchaseApplyId);
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
public List<MesPurchaseApplyProcess> selectMesPurchaseApplyProcessList(MesPurchaseApplyProcess mesPurchaseApplyProcess);
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
public int insertMesPurchaseApplyProcess(MesPurchaseApplyProcess mesPurchaseApplyProcess);
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
public int updateMesPurchaseApplyProcess(MesPurchaseApplyProcess mesPurchaseApplyProcess);
/**
*
*
* @param purchaseApplyIds
* @return
*/
public int deleteMesPurchaseApplyProcessByPurchaseApplyIds(Long[] purchaseApplyIds);
/**
*
*
* @param purchaseApplyId
* @return
*/
public int deleteMesPurchaseApplyProcessByPurchaseApplyId(Long purchaseApplyId);
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
public int insertRaisePurchaseApplyProcess(MesPurchaseApplyProcess mesPurchaseApplyProcess);
/**
*
* 1BOM
* 2
* @param mesPurchaseApplyProcess
* @return
*/
public int purchaseAbnormalFlow(MesPurchaseApplyProcess mesPurchaseApplyProcess);
/**
*
* 1
* 2ERP
* @param mesPurchaseApplyProcess
* @return
*/
public int technicalProcessing(MesPurchaseApplyProcess mesPurchaseApplyProcess);
}

@ -0,0 +1,68 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesRaiseCapitalBom;
/**
* BOMService
*
* @author Yinq
* @date 2024-09-18
*/
public interface IMesRaiseCapitalBomService {
/**
* BOM
*
* @param raiseCapitalId BOM
* @return BOM
*/
public MesRaiseCapitalBom selectMesRaiseCapitalBomByRaiseCapitalId(Long raiseCapitalId);
/**
* BOM
*
* @param mesRaiseCapitalBom BOM
* @return BOM
*/
public List<MesRaiseCapitalBom> selectMesRaiseCapitalBomList(MesRaiseCapitalBom mesRaiseCapitalBom);
/**
* BOM
*
* @param mesRaiseCapitalBom BOM
* @return
*/
public int insertMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom);
/**
* BOM
*
* @param mesRaiseCapitalBom BOM
* @return
*/
public int updateMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom);
/**
* BOM
*
* @param raiseCapitalIds BOM
* @return
*/
public int deleteMesRaiseCapitalBomByRaiseCapitalIds(Long[] raiseCapitalIds);
/**
* BOM
*
* @param raiseCapitalId BOM
* @return
*/
public int deleteMesRaiseCapitalBomByRaiseCapitalId(Long raiseCapitalId);
/**
* BOM
* @param taskCode
*/
public void importRaiseCapitalBom(String taskCode);
}

@ -3,25 +3,24 @@ package com.hw.mes.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WfConstants;
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.StringUtils;
import com.hw.common.core.utils.bean.BeanValidators;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.jindie.api.RemoteJindieService;
import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.domain.MesBaseUnitInfo;
import com.hw.mes.domain.MesMaterialBom;
import com.hw.mes.domain.MesPurchaseRequisitionTemplate;
import com.hw.mes.domain.*;
import com.hw.mes.mapper.MesBaseMaterialInfoMapper;
import com.hw.mes.mapper.MesBaseUnitInfoMapper;
import com.hw.mes.mapper.MesMaterialBomMapper;
import com.hw.mes.service.IMesBaseMaterialInfoService;
import com.hw.mes.service.IMesImportService;
import com.hw.mes.service.IMesMaterialBomService;
import com.hw.mes.service.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -37,6 +36,7 @@ import java.io.InputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static org.apache.poi.ss.usermodel.CellType.NUMERIC;
import static org.apache.poi.ss.usermodel.CellType.STRING;
@ -62,6 +62,12 @@ public class MesImportImpl implements IMesImportService {
@Autowired
private MesBaseMaterialInfoMapper mesBaseMaterialInfoMapper;
@Autowired
private IMesRaiseCapitalBomService mesRaiseCapitalBomService;
@Autowired
private IMesPurchaseApplyProcessService mesPurchaseApplyProcessService;
private static final Logger log = LoggerFactory.getLogger(MesImportImpl.class);
/**
@ -147,7 +153,7 @@ public class MesImportImpl implements IMesImportService {
/**
* BOMexcel
*
*
* @param file
* @param updateSupport
* @param operName
@ -156,7 +162,127 @@ public class MesImportImpl implements IMesImportService {
@Override
@Transactional(rollbackFor = ServiceException.class)
public String BOMImportData(MultipartFile file, boolean updateSupport, String operName) {
// InputStream is = null;
// StringBuilder failureMsg = new StringBuilder();
// try {
// is = file.getInputStream();
// Workbook workbook = new XSSFWorkbook(is);
// Sheet sheet = workbook.getSheetAt(0);
// int lastRowNum = sheet.getLastRowNum();
// for (int i = 0; i < lastRowNum; i++) {
// Row rowT = sheet.getRow(i);
// if (rowT == null) {
// continue; // 如果行为空,跳过
// }
// Cell cellT = rowT.getCell(2);
// if (StringUtils.isNull(cellT)) {
// throw new ServiceException("Excel格式错误");
// }
// String productBom = cellT.getStringCellValue();
// productBom = productBom.replaceAll(".*?", "");
// MesBaseMaterialInfo productMaterial = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(productBom);
// if (productMaterial == null) {
// throw new ServiceException("Excel格式错误:物料编号:" + productBom + "的信息不存在!");
// }
//
// i = i + 3;//标题下一行
// MesMaterialBom selectBom = new MesMaterialBom();
// selectBom.setMaterialId(productMaterial.getMaterialId());
// selectBom.setMaterialBomDesc(productMaterial.getMaterialName());
// List<MesMaterialBom> productBomList = mesMaterialBomService.selectMesMaterialBomList(selectBom);
// Long parentBomId = 0L;
// String parentBomDesc = productMaterial.getMaterialName();
// if (productBomList.size() > 0) {
// MesMaterialBom mesMaterialBom = productBomList.get(0);
// parentBomId = mesMaterialBom.getMaterialBomId();
// MesMaterialBom materialBom = new MesMaterialBom();
// materialBom.setParentId(mesMaterialBom.getMaterialBomId());
// List<MesMaterialBom> mesMaterialBoms = mesMaterialBomService.selectMesMaterialBomList(materialBom);
// for (MesMaterialBom bom : mesMaterialBoms) {
// mesMaterialBomService.deleteMesMaterialBomByMaterialBomId(bom.getMaterialBomId());
// }
// } else {
// MesMaterialBom materialBom = new MesMaterialBom();
// materialBom.setMaterialId(productMaterial.getMaterialId());
// materialBom.setMaterialName(productMaterial.getMaterialName());
// materialBom.setMaterialBomDesc(productMaterial.getMaterialName());
// materialBom.setParentId(0L);
// materialBom.setActiveFlag("1");
// materialBom.setStandardAmount(new BigDecimal(1));
// materialBom.setCreateBy(operName);
// mesMaterialBomService.insertMesMaterialBom(materialBom);
// parentBomId = materialBom.getMaterialBomId();
// }
//
// ArrayList<MesMaterialBom> bomList = new ArrayList<>();
// while (true) {
// if (i > lastRowNum) {
// break;
// }
// Row rowC = sheet.getRow(i);
// Cell numberCell = rowC.getCell(0);
// if (StringUtils.isNull(numberCell) || numberCell.getCellType() != NUMERIC) {
// break;
// }
// Cell materialCodeCell = rowC.getCell(1);
// String materialCode = null;
// if (materialCodeCell.getCellType() == NUMERIC) {
// double numericCellValue = materialCodeCell.getNumericCellValue();
// materialCode = new BigDecimal(numericCellValue).toString();
// } else if (materialCodeCell.getCellType() == STRING) {
// materialCode = materialCodeCell.getStringCellValue();
// }
// Cell amountCell = rowC.getCell(5);
// if (StringUtils.isNotEmpty(materialCode)) {
// MesBaseMaterialInfo materialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(materialCode);
// if (StringUtils.isNotNull(materialInfo)) {
// MesMaterialBom materialBom = new MesMaterialBom();
// materialBom.setMaterialId(materialInfo.getMaterialId());
// materialBom.setMaterialName(materialInfo.getMaterialName());
// materialBom.setMaterialCode(materialInfo.getMaterialCode());
// materialBom.setMaterialBomDesc(parentBomDesc);
// materialBom.setParentId(parentBomId);
// materialBom.setActiveFlag("1");
// materialBom.setStandardAmount(BigDecimal.valueOf(amountCell.getNumericCellValue()));
// materialBom.setCreateBy(operName);
// bomList.add(materialBom);
// } else {
// failureMsg.append("物料编号:").append(materialCode).append("|");
// }
// }
// i++;
// }
// if (failureMsg.length() != 0){
// failureMsg.append("MES中未同步该物料信息");
// throw new ServiceException(failureMsg.toString());
// }
// for (MesMaterialBom materialBom : bomList) {
// mesMaterialBomService.insertMesMaterialBom(materialBom);
// }
// }
// } catch (IOException e) {
// throw new ServiceException("文件处理错误:" + e);
// } finally {
// IOUtils.closeQuietly(is);
// }
return "BOM导入成功";
}
/**
* BOMexcel
* @param file
* @param updateSupport
* @param operName
* @return
*/
@Override
@Transactional(rollbackFor = ServiceException.class)
public String raiseCapitalImportData(MultipartFile file, boolean updateSupport, String operName) {
InputStream is = null;
StringBuilder failureMsg = new StringBuilder();
List<String> finishedProductNameList = new ArrayList<>();
String taskCode = Seq.getId(Seq.mesPurchaseApplyProcessSeqType, Seq.mesPurchaseApplyProcessCode);
try {
is = file.getInputStream();
Workbook workbook = new XSSFWorkbook(is);
@ -175,39 +301,41 @@ public class MesImportImpl implements IMesImportService {
productBom = productBom.replaceAll(".*?", "");
MesBaseMaterialInfo productMaterial = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(productBom);
if (productMaterial == null) {
throw new ServiceException("Excel格式错误:找不到父级BOM信息");
throw new ServiceException("Excel格式错误:物料编号:" + productBom + "的信息不存在");
}
i = i + 3;//标题下一行
MesMaterialBom selectBom = new MesMaterialBom();
MesRaiseCapitalBom selectBom = new MesRaiseCapitalBom();
selectBom.setMaterialId(productMaterial.getMaterialId());
selectBom.setMaterialBomDesc(productMaterial.getMaterialName());
List<MesMaterialBom> productBomList = mesMaterialBomService.selectMesMaterialBomList(selectBom);
List<MesRaiseCapitalBom> productBomList = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(selectBom);
Long parentBomId = 0L;
String parentBomDesc = productMaterial.getMaterialName();
finishedProductNameList.add(productMaterial.getMaterialName());
if (productBomList.size() > 0) {
MesMaterialBom mesMaterialBom = productBomList.get(0);
parentBomId = mesMaterialBom.getMaterialBomId();
MesMaterialBom materialBom = new MesMaterialBom();
materialBom.setParentId(mesMaterialBom.getMaterialBomId());
List<MesMaterialBom> mesMaterialBoms = mesMaterialBomService.selectMesMaterialBomList(materialBom);
for (MesMaterialBom bom : mesMaterialBoms) {
mesMaterialBomService.deleteMesMaterialBomByMaterialBomId(bom.getMaterialBomId());
MesRaiseCapitalBom mesMaterialBom = productBomList.get(0);
parentBomId = mesMaterialBom.getRaiseCapitalId();
MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
materialBom.setParentId(mesMaterialBom.getRaiseCapitalId());
List<MesRaiseCapitalBom> mesMaterialBoms = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(materialBom);
for (MesRaiseCapitalBom bom : mesMaterialBoms) {
mesRaiseCapitalBomService.deleteMesRaiseCapitalBomByRaiseCapitalId(bom.getRaiseCapitalId());
}
} else {
MesMaterialBom materialBom = new MesMaterialBom();
MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
materialBom.setTaskCode(taskCode);
materialBom.setMaterialId(productMaterial.getMaterialId());
materialBom.setMaterialName(productMaterial.getMaterialName());
materialBom.setMaterialBomDesc(productMaterial.getMaterialName());
materialBom.setParentId(0L);
materialBom.setActiveFlag("1");
materialBom.setStandardAmount(new BigDecimal(1));
materialBom.setCreateBy(operName);
mesMaterialBomService.insertMesMaterialBom(materialBom);
parentBomId = materialBom.getMaterialBomId();
materialBom.setErpMaterialId(productMaterial.getErpId());
mesRaiseCapitalBomService.insertMesRaiseCapitalBom(materialBom);
parentBomId = materialBom.getRaiseCapitalId();
}
ArrayList<MesMaterialBom> bomList = new ArrayList<>();
ArrayList<MesRaiseCapitalBom> bomList = new ArrayList<>();
while (true) {
if (i > lastRowNum) {
break;
@ -229,30 +357,46 @@ public class MesImportImpl implements IMesImportService {
if (StringUtils.isNotEmpty(materialCode)) {
MesBaseMaterialInfo materialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(materialCode);
if (StringUtils.isNotNull(materialInfo)) {
MesMaterialBom materialBom = new MesMaterialBom();
MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
materialBom.setTaskCode(taskCode);
materialBom.setMaterialId(materialInfo.getMaterialId());
materialBom.setMaterialName(materialInfo.getMaterialName());
materialBom.setMaterialCode(materialInfo.getMaterialName());
materialBom.setMaterialBomDesc(parentBomDesc);
materialBom.setParentId(parentBomId);
materialBom.setActiveFlag("1");
materialBom.setStandardAmount(BigDecimal.valueOf(amountCell.getNumericCellValue()));
materialBom.setCreateBy(operName);
materialBom.setErpMaterialId(materialInfo.getErpId());
bomList.add(materialBom);
} else {
failureMsg.append("物料编号:").append(materialCode).append("|");
}
}
i++;
}
for (MesMaterialBom materialBom : bomList) {
mesMaterialBomService.insertMesMaterialBom(materialBom);
if (failureMsg.length() != 0){
failureMsg.append("MES中未同步该物料信息");
throw new ServiceException(failureMsg.toString());
}
for (MesRaiseCapitalBom materialBom : bomList) {
mesRaiseCapitalBomService.insertMesRaiseCapitalBom(materialBom);
}
}
//存入采购申请流程
MesPurchaseApplyProcess applyProcess = new MesPurchaseApplyProcess();
applyProcess.setTaskCode(taskCode);
String materialName = String.join(",", finishedProductNameList);
applyProcess.setMaterialName(materialName);
applyProcess.setWfProcessId(WfConstants.WF_PURCHASE_REQUISITION_PROCESS_ID);
applyProcess.setProcessActivityId(WfConstants.WF_PURCHASE_ACTIVITY_CREATE_ID);
applyProcess.setCreateBy(SecurityUtils.getUsername());
applyProcess.setCreateTime(DateUtils.getNowDate());
//新增采购申请流程
mesPurchaseApplyProcessService.insertRaisePurchaseApplyProcess(applyProcess);
} catch (IOException e) {
throw new ServiceException("文件处理错误:" + e);
} finally {
IOUtils.closeQuietly(is);
}
return "BOM导入成功";
}

@ -0,0 +1,93 @@
package com.hw.mes.service.impl;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesPurchaseApplyProcessDetailMapper;
import com.hw.mes.domain.MesPurchaseApplyProcessDetail;
import com.hw.mes.service.IMesPurchaseApplyProcessDetailService;
/**
* Service
*
* @author Open Platform
* @date 2024-09-24
*/
@Service
public class MesPurchaseApplyProcessDetailServiceImpl implements IMesPurchaseApplyProcessDetailService {
@Autowired
private MesPurchaseApplyProcessDetailMapper mesPurchaseApplyProcessDetailMapper;
/**
*
*
* @param purchaseApplyDetailId
* @return
*/
@Override
public MesPurchaseApplyProcessDetail selectMesPurchaseApplyProcessDetailByPurchaseApplyDetailId(Long purchaseApplyDetailId) {
return mesPurchaseApplyProcessDetailMapper.selectMesPurchaseApplyProcessDetailByPurchaseApplyDetailId(purchaseApplyDetailId);
}
/**
*
*
* @param mesPurchaseApplyProcessDetail
* @return
*/
@Override
public List<MesPurchaseApplyProcessDetail> selectMesPurchaseApplyProcessDetailList(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail) {
return mesPurchaseApplyProcessDetailMapper.selectMesPurchaseApplyProcessDetailList(mesPurchaseApplyProcessDetail);
}
/**
*
*
* @param mesPurchaseApplyProcessDetail
* @return
*/
@Override
public int insertMesPurchaseApplyProcessDetail(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail) {
mesPurchaseApplyProcessDetail.setCreateBy(SecurityUtils.getUsername());
mesPurchaseApplyProcessDetail.setCreateTime(DateUtils.getNowDate());
return mesPurchaseApplyProcessDetailMapper.insertMesPurchaseApplyProcessDetail(mesPurchaseApplyProcessDetail);
}
/**
*
*
* @param mesPurchaseApplyProcessDetail
* @return
*/
@Override
public int updateMesPurchaseApplyProcessDetail(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail) {
mesPurchaseApplyProcessDetail.setUpdateBy(SecurityUtils.getUsername());
mesPurchaseApplyProcessDetail.setUpdateTime(DateUtils.getNowDate());
return mesPurchaseApplyProcessDetailMapper.updateMesPurchaseApplyProcessDetail(mesPurchaseApplyProcessDetail);
}
/**
*
*
* @param purchaseApplyDetailIds
* @return
*/
@Override
public int deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailIds(Long[] purchaseApplyDetailIds) {
return mesPurchaseApplyProcessDetailMapper.deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailIds(purchaseApplyDetailIds);
}
/**
*
*
* @param purchaseApplyDetailId
* @return
*/
@Override
public int deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailId(Long purchaseApplyDetailId) {
return mesPurchaseApplyProcessDetailMapper.deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailId(purchaseApplyDetailId);
}
}

@ -0,0 +1,277 @@
package com.hw.mes.service.impl;
import java.util.List;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WfConstants;
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.security.utils.SecurityUtils;
import com.hw.mes.service.IMesPurchaseApplyProcessDetailService;
import com.hw.mes.service.IMesRaiseCapitalBomService;
import com.hw.system.api.RemoteSysCommonService;
import com.hw.system.api.domain.common.WfProcessActivity;
import com.hw.system.api.domain.common.WfProcessActivityAuth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.mes.domain.MesPurchaseApplyProcessDetail;
import com.hw.mes.mapper.MesPurchaseApplyProcessMapper;
import com.hw.mes.domain.MesPurchaseApplyProcess;
import com.hw.mes.service.IMesPurchaseApplyProcessService;
/**
* Service
*
* @author Yinq
* @date 2024-09-19
*/
@Service
public class MesPurchaseApplyProcessServiceImpl implements IMesPurchaseApplyProcessService {
@Autowired
private MesPurchaseApplyProcessMapper mesPurchaseApplyProcessMapper;
@Autowired
private IMesPurchaseApplyProcessDetailService mesPurchaseApplyProcessDetailService;
@Autowired
private RemoteSysCommonService remoteSysCommonService;
@Autowired
private IMesRaiseCapitalBomService mesRaiseCapitalBomService;
/**
*
*
* @param purchaseApplyId
* @return
*/
@Override
public MesPurchaseApplyProcess selectMesPurchaseApplyProcessByPurchaseApplyId(Long purchaseApplyId) {
return mesPurchaseApplyProcessMapper.selectMesPurchaseApplyProcessByPurchaseApplyId(purchaseApplyId);
}
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
@Override
public List<MesPurchaseApplyProcess> selectMesPurchaseApplyProcessList(MesPurchaseApplyProcess mesPurchaseApplyProcess) {
return mesPurchaseApplyProcessMapper.selectMesPurchaseApplyProcessList(mesPurchaseApplyProcess);
}
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
@Transactional
@Override
public int insertMesPurchaseApplyProcess(MesPurchaseApplyProcess mesPurchaseApplyProcess) {
mesPurchaseApplyProcess.setCreateTime(DateUtils.getNowDate());
int rows = mesPurchaseApplyProcessMapper.insertMesPurchaseApplyProcess(mesPurchaseApplyProcess);
insertMesPurchaseApplyProcessDetail(mesPurchaseApplyProcess);
return rows;
}
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
@Transactional
@Override
public int updateMesPurchaseApplyProcess(MesPurchaseApplyProcess mesPurchaseApplyProcess) {
mesPurchaseApplyProcess.setUpdateBy(SecurityUtils.getUsername());
mesPurchaseApplyProcess.setUpdateTime(DateUtils.getNowDate());
return mesPurchaseApplyProcessMapper.updateMesPurchaseApplyProcess(mesPurchaseApplyProcess);
}
/**
*
*
* @param purchaseApplyIds
* @return
*/
@Transactional
@Override
public int deleteMesPurchaseApplyProcessByPurchaseApplyIds(Long[] purchaseApplyIds) {
mesPurchaseApplyProcessMapper.deleteMesPurchaseApplyProcessDetailByTaskCodes(purchaseApplyIds);
return mesPurchaseApplyProcessMapper.deleteMesPurchaseApplyProcessByPurchaseApplyIds(purchaseApplyIds);
}
/**
*
*
* @param purchaseApplyId
* @return
*/
@Transactional
@Override
public int deleteMesPurchaseApplyProcessByPurchaseApplyId(Long purchaseApplyId) {
mesPurchaseApplyProcessMapper.deleteMesPurchaseApplyProcessDetailByTaskCode(purchaseApplyId);
return mesPurchaseApplyProcessMapper.deleteMesPurchaseApplyProcessByPurchaseApplyId(purchaseApplyId);
}
/**
*
*
* @param mesPurchaseApplyProcess
*/
public void insertMesPurchaseApplyProcessDetail(MesPurchaseApplyProcess mesPurchaseApplyProcess) {
List<MesPurchaseApplyProcessDetail> mesPurchaseApplyProcessDetailList = mesPurchaseApplyProcess.getMesPurchaseApplyProcessDetailList();
String taskCode = mesPurchaseApplyProcess.getTaskCode();
if (StringUtils.isNotNull(mesPurchaseApplyProcessDetailList)) {
List<MesPurchaseApplyProcessDetail> list = new ArrayList<>();
for (MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail : mesPurchaseApplyProcessDetailList) {
mesPurchaseApplyProcessDetail.setTaskCode(taskCode);
list.add(mesPurchaseApplyProcessDetail);
}
if (list.size() > 0) {
mesPurchaseApplyProcessMapper.batchMesPurchaseApplyProcessDetail(list);
}
}
}
/**
*
*
* @param mesPurchaseApplyProcess
* @return
*/
@Override
@Transactional(rollbackFor = ServiceException.class)
public int insertRaisePurchaseApplyProcess(MesPurchaseApplyProcess mesPurchaseApplyProcess) {
String taskCode = mesPurchaseApplyProcess.getTaskCode();
Long processActivityId = mesPurchaseApplyProcess.getProcessActivityId();
mesPurchaseApplyProcessMapper.insertMesPurchaseApplyProcess(mesPurchaseApplyProcess);
//存采购申请流程创建流程节点
MesPurchaseApplyProcessDetail processDetail = new MesPurchaseApplyProcessDetail();
processDetail.setTaskCode(taskCode);
processDetail.setProcessActivityId(processActivityId);
//技术导入提资单BOM -> 邮件通知采购
String text = mesPurchaseApplyProcess.getMaterialName() + ",提资单已导入请采购确认!";
mesPurchaseApplyProcess.setRemark(text);
this.processActivityEmailNotice(mesPurchaseApplyProcess, processDetail, WfConstants.WF_PURCHASE_ACTIVITY_PROCUREMENT_AUDIT_ID);
mesPurchaseApplyProcessDetailService.insertMesPurchaseApplyProcessDetail(processDetail);
// /**流程节点:采购申请流程创建*/
// public static final Long WF_PURCHASE_ACTIVITY_CREATE_ID = 4011L;
// /**流程节点:采购申请流程采购审核*/
// public static final Long WF_PURCHASE_ACTIVITY_PROCUREMENT_AUDIT_ID = 4012L;
// /**流程节点:采购申请流程技术修改*/
// public static final Long WF_PURCHASE_ACTIVITY_TECHNICAL_MODIFY_ID = 4013L;
// /**流程节点采购申请流程ERP修改*/
// public static final Long WF_PURCHASE_ACTIVITY_ERP_MODIFY_ID = 4014L;
return 1;
}
/**
*
* @param mesPurchaseApplyProcess
* @param processDetail
* @param processActivityId
*/
private void processActivityEmailNotice(MesPurchaseApplyProcess mesPurchaseApplyProcess, MesPurchaseApplyProcessDetail processDetail, Long processActivityId) {
R<WfProcessActivity> activityRes = remoteSysCommonService.selectProcessActivityUserInfo(SecurityConstants.INNER, processActivityId);
String title = activityRes.getData().getProcessActivityName() + "[" + mesPurchaseApplyProcess.getTaskCode() + "]";
String text = mesPurchaseApplyProcess.getRemark();
List<WfProcessActivityAuth> activityAuthList = activityRes.getData().getWfProcessActivityAuthList();
List<String> userNameList = new ArrayList<>();//已通知用户
for (WfProcessActivityAuth activityAuth : activityAuthList) {
//邮件通知
String email = activityAuth.getEmail();
if (StringUtils.isNotEmpty(email)){
MailUtils.processSendEmail(email, title, text);
userNameList.add(activityAuth.getUserName());
}
}
if (userNameList.size() > 0){
processDetail.setNoticeFlag(WfConstants.PA_NOTICE_FLAG_YES);
processDetail.setNoticeAuth(String.join(",", userNameList));
} else {
processDetail.setNoticeFlag(WfConstants.PA_NOTICE_FLAG_NO);
}
}
/**
*
* 1BOM
* 2
* @param mesPurchaseApplyProcess
* @return
*/
@Override
@Transactional(rollbackFor = ServiceException.class)
public int purchaseAbnormalFlow(MesPurchaseApplyProcess mesPurchaseApplyProcess) {
//流程节点:采购申请流程采购审核
String currentAnomalyFlag = mesPurchaseApplyProcess.getCurrentAnomalyFlag();
Long processActivityId = WfConstants.WF_PURCHASE_ACTIVITY_PROCUREMENT_AUDIT_ID;
MesPurchaseApplyProcessDetail processDetail = new MesPurchaseApplyProcessDetail();
processDetail.setTaskCode(mesPurchaseApplyProcess.getTaskCode());
processDetail.setProcessActivityId(processActivityId);
processDetail.setAnomalyFlag(currentAnomalyFlag);
processDetail.setPurchaseRemark(mesPurchaseApplyProcess.getRemark());
if (currentAnomalyFlag.equals(WfConstants.PA_ANOMALY_FLAG_YES)){
//异常通知,技术修改
this.processActivityEmailNotice(mesPurchaseApplyProcess, processDetail, WfConstants.WF_PURCHASE_ACTIVITY_TECHNICAL_MODIFY_ID);
mesPurchaseApplyProcess.setProcessActivityId(processActivityId);
}
mesPurchaseApplyProcessDetailService.insertMesPurchaseApplyProcessDetail(processDetail);
if (currentAnomalyFlag.equals(WfConstants.PA_ANOMALY_FLAG_NO)){
//导入BOM流程完成
mesRaiseCapitalBomService.importRaiseCapitalBom(mesPurchaseApplyProcess.getTaskCode());
mesPurchaseApplyProcess.setProcessActivityId(WfConstants.WF_PURCHASE_ACTIVITY_FINISH_ID);
mesPurchaseApplyProcess.setImportFlag(WfConstants.PA_IMPORT_FLAG_YES);
//流程节点:采购申请流程完成
processDetail.setProcessActivityId(WfConstants.WF_PURCHASE_ACTIVITY_FINISH_ID);
mesPurchaseApplyProcessDetailService.insertMesPurchaseApplyProcessDetail(processDetail);
}
this.updateMesPurchaseApplyProcess(mesPurchaseApplyProcess);
return 1;
}
/**
*
* 1
* 2ERP
* @param mesPurchaseApplyProcess
* @return
*/
@Override
@Transactional(rollbackFor = ServiceException.class)
public int technicalProcessing(MesPurchaseApplyProcess mesPurchaseApplyProcess) {
//流程节点:采购申请流程技术修改
String currentAnomalyFlag = mesPurchaseApplyProcess.getCurrentAnomalyFlag();
Long processActivityId = WfConstants.WF_PURCHASE_ACTIVITY_TECHNICAL_MODIFY_ID;
MesPurchaseApplyProcessDetail processDetail = new MesPurchaseApplyProcessDetail();
processDetail.setTaskCode(mesPurchaseApplyProcess.getTaskCode());
processDetail.setProcessActivityId(processActivityId);
processDetail.setAnomalyFlag(currentAnomalyFlag);
processDetail.setPurchaseRemark(mesPurchaseApplyProcess.getRemark());
if (currentAnomalyFlag.equals(WfConstants.PA_ANOMALY_FLAG_NO)){
//处理完成返回采购修改节点
this.processActivityEmailNotice(mesPurchaseApplyProcess, processDetail, WfConstants.WF_PURCHASE_ACTIVITY_PROCUREMENT_AUDIT_ID);
mesPurchaseApplyProcess.setProcessActivityId(WfConstants.WF_PURCHASE_ACTIVITY_CREATE_ID);
}
if (currentAnomalyFlag.equals(WfConstants.PA_ANOMALY_FLAG_YES)){
//缺物料通知ERP人员
this.processActivityEmailNotice(mesPurchaseApplyProcess, processDetail, WfConstants.WF_PURCHASE_ACTIVITY_ERP_MODIFY_ID);
mesPurchaseApplyProcess.setProcessActivityId(processActivityId);
}
mesPurchaseApplyProcessDetailService.insertMesPurchaseApplyProcessDetail(processDetail);
this.updateMesPurchaseApplyProcess(mesPurchaseApplyProcess);
return 1;
}
}

@ -0,0 +1,141 @@
package com.hw.mes.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesMaterialBom;
import com.hw.mes.mapper.MesMaterialBomMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesRaiseCapitalBomMapper;
import com.hw.mes.domain.MesRaiseCapitalBom;
import com.hw.mes.service.IMesRaiseCapitalBomService;
import org.springframework.transaction.annotation.Transactional;
/**
* BOMService
*
* @author Yinq
* @date 2024-09-18
*/
@Service
public class MesRaiseCapitalBomServiceImpl implements IMesRaiseCapitalBomService {
@Autowired
private MesRaiseCapitalBomMapper mesRaiseCapitalBomMapper;
@Autowired
private MesMaterialBomMapper mesMaterialBomMapper;
/**
* BOM
*
* @param raiseCapitalId BOM
* @return BOM
*/
@Override
public MesRaiseCapitalBom selectMesRaiseCapitalBomByRaiseCapitalId(Long raiseCapitalId) {
return mesRaiseCapitalBomMapper.selectMesRaiseCapitalBomByRaiseCapitalId(raiseCapitalId);
}
/**
* BOM
*
* @param mesRaiseCapitalBom BOM
* @return BOM
*/
@Override
public List<MesRaiseCapitalBom> selectMesRaiseCapitalBomList(MesRaiseCapitalBom mesRaiseCapitalBom) {
return mesRaiseCapitalBomMapper.selectMesRaiseCapitalBomList(mesRaiseCapitalBom);
}
/**
* BOM
*
* @param mesRaiseCapitalBom BOM
* @return
*/
@Override
public int insertMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom) {
isTopFlag(mesRaiseCapitalBom);
mesRaiseCapitalBom.setCreateBy(SecurityUtils.getUsername());
mesRaiseCapitalBom.setCreateTime(DateUtils.getNowDate());
MesRaiseCapitalBom info = mesRaiseCapitalBomMapper.selectMesRaiseCapitalBomByRaiseCapitalId(mesRaiseCapitalBom.getParentId());
if (StringUtils.isNull(info)){
mesRaiseCapitalBom.setAncestors(mesRaiseCapitalBom.getParentId().toString());
}else {
mesRaiseCapitalBom.setAncestors(info.getAncestors() + "," + mesRaiseCapitalBom.getParentId());
}
return mesRaiseCapitalBomMapper.insertMesRaiseCapitalBom(mesRaiseCapitalBom);
}
/**
* SET
* BOM
* @param mesRaiseCapitalBom
*/
private void isTopFlag(MesRaiseCapitalBom mesRaiseCapitalBom){
// 顶级标识1=是0=否
if (StringUtils.isNull(mesRaiseCapitalBom.getParentId()) || mesRaiseCapitalBom.getParentId() == 0L){
mesRaiseCapitalBom.setTopFlag(1L);
}else {
mesRaiseCapitalBom.setTopFlag(0L);
}
}
/**
* BOM
*
* @param mesRaiseCapitalBom BOM
* @return
*/
@Override
public int updateMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom) {
mesRaiseCapitalBom.setUpdateBy(SecurityUtils.getUsername());
mesRaiseCapitalBom.setUpdateTime(DateUtils.getNowDate());
return mesRaiseCapitalBomMapper.updateMesRaiseCapitalBom(mesRaiseCapitalBom);
}
/**
* BOM
*
* @param raiseCapitalIds BOM
* @return
*/
@Override
public int deleteMesRaiseCapitalBomByRaiseCapitalIds(Long[] raiseCapitalIds) {
return mesRaiseCapitalBomMapper.deleteMesRaiseCapitalBomByRaiseCapitalIds(raiseCapitalIds);
}
/**
* BOM
*
* @param raiseCapitalId BOM
* @return
*/
@Override
public int deleteMesRaiseCapitalBomByRaiseCapitalId(Long raiseCapitalId) {
return mesRaiseCapitalBomMapper.deleteMesRaiseCapitalBomByRaiseCapitalId(raiseCapitalId);
}
@Override
@Transactional(rollbackFor = ServiceException.class)
public void importRaiseCapitalBom(String taskCode) {
MesRaiseCapitalBom raiseCapitalBom = new MesRaiseCapitalBom();
raiseCapitalBom.setTaskCode(taskCode);
List<MesRaiseCapitalBom> capitalBomList = mesRaiseCapitalBomMapper.selectMesRaiseCapitalBomList(raiseCapitalBom);
//TODO 异常处理
List<MesMaterialBom> materialBomList = new ArrayList<>();
for (MesRaiseCapitalBom capitalBom : capitalBomList) {
MesMaterialBom mesMaterialBom = new MesMaterialBom();
mesMaterialBom.copyFromMesRaiseCapitalBom(capitalBom);
materialBomList.add(mesMaterialBom);
}
mesMaterialBomMapper.batchMesMaterialBom(materialBomList);
}
}

@ -202,5 +202,11 @@
order by mmb.material_bom_id desc
</select>
<insert id="batchMesMaterialBom">
insert into mes_material_bom( material_bom_id, material_bom_desc, parent_id, ancestors, material_id, material_name, standard_amount, top_flag, check_type, project_id, assemble_time, active_flag, remark, create_by, create_time, update_by, update_time, brand, material_classfication, erp_material_id) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.materialBomId}, #{item.materialBomDesc}, #{item.parentId}, #{item.ancestors}, #{item.materialId}, #{item.materialName}, #{item.standardAmount}, #{item.topFlag}, #{item.checkType}, #{item.projectId}, #{item.assembleTime}, #{item.activeFlag}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.brand}, #{item.materialClassfication}, #{item.erpMaterialId})
</foreach>
</insert>
</mapper>

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesPurchaseApplyProcessDetailMapper">
<resultMap type="MesPurchaseApplyProcessDetail" id="MesPurchaseApplyProcessDetailResult">
<result property="purchaseApplyDetailId" column="purchase_apply_detail_id"/>
<result property="taskCode" column="task_code"/>
<result property="processActivityId" column="process_activity_id"/>
<result property="anomalyFlag" column="anomaly_flag"/>
<result property="updateFlag" column="update_flag"/>
<result property="noticeFlag" column="notice_flag"/>
<result property="noticeAuth" column="notice_auth"/>
<result property="purchaseRemark" column="purchase_remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectMesPurchaseApplyProcessDetailVo">
select purchase_apply_detail_id,
task_code,
process_activity_id,
anomaly_flag,
update_flag,
notice_flag,
notice_auth,
purchase_remark,
create_by,
create_time,
update_by,
update_time
from mes_purchase_apply_process_detail
</sql>
<select id="selectMesPurchaseApplyProcessDetailList" parameterType="MesPurchaseApplyProcessDetail"
resultMap="MesPurchaseApplyProcessDetailResult">
<include refid="selectMesPurchaseApplyProcessDetailVo"/>
<where>
<if test="taskCode != null and taskCode != ''">and task_code = #{taskCode}</if>
<if test="processActivityId != null ">and process_activity_id = #{processActivityId}</if>
<if test="anomalyFlag != null and anomalyFlag != ''">and anomaly_flag = #{anomalyFlag}</if>
<if test="updateFlag != null and updateFlag != ''">and update_flag = #{updateFlag}</if>
<if test="noticeFlag != null and noticeFlag != ''">and notice_flag = #{noticeFlag}</if>
<if test="noticeAuth != null and noticeAuth != ''">and notice_auth = #{noticeAuth}</if>
<if test="purchaseRemark != null and purchaseRemark != ''">and purchase_remark = #{purchaseRemark}</if>
</where>
</select>
<select id="selectMesPurchaseApplyProcessDetailByPurchaseApplyDetailId" parameterType="Long"
resultMap="MesPurchaseApplyProcessDetailResult">
<include refid="selectMesPurchaseApplyProcessDetailVo"/>
where purchase_apply_detail_id = #{purchaseApplyDetailId}
</select>
<insert id="insertMesPurchaseApplyProcessDetail" parameterType="MesPurchaseApplyProcessDetail"
useGeneratedKeys="true" keyProperty="purchaseApplyDetailId">
insert into mes_purchase_apply_process_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">task_code,</if>
<if test="processActivityId != null">process_activity_id,</if>
<if test="anomalyFlag != null">anomaly_flag,</if>
<if test="updateFlag != null">update_flag,</if>
<if test="noticeFlag != null">notice_flag,</if>
<if test="noticeAuth != null">notice_auth,</if>
<if test="purchaseRemark != null">purchase_remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">#{taskCode},</if>
<if test="processActivityId != null">#{processActivityId},</if>
<if test="anomalyFlag != null">#{anomalyFlag},</if>
<if test="updateFlag != null">#{updateFlag},</if>
<if test="noticeFlag != null">#{noticeFlag},</if>
<if test="noticeAuth != null">#{noticeAuth},</if>
<if test="purchaseRemark != null">#{purchaseRemark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateMesPurchaseApplyProcessDetail" parameterType="MesPurchaseApplyProcessDetail">
update mes_purchase_apply_process_detail
<trim prefix="SET" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">task_code = #{taskCode},</if>
<if test="processActivityId != null">process_activity_id = #{processActivityId},</if>
<if test="anomalyFlag != null">anomaly_flag = #{anomalyFlag},</if>
<if test="updateFlag != null">update_flag = #{updateFlag},</if>
<if test="noticeFlag != null">notice_flag = #{noticeFlag},</if>
<if test="noticeAuth != null">notice_auth = #{noticeAuth},</if>
<if test="purchaseRemark != null">purchase_remark = #{purchaseRemark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where purchase_apply_detail_id = #{purchaseApplyDetailId}
</update>
<delete id="deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailId" parameterType="Long">
delete
from mes_purchase_apply_process_detail
where purchase_apply_detail_id = #{purchaseApplyDetailId}
</delete>
<delete id="deleteMesPurchaseApplyProcessDetailByPurchaseApplyDetailIds" parameterType="String">
delete from mes_purchase_apply_process_detail where purchase_apply_detail_id in
<foreach item="purchaseApplyDetailId" collection="array" open="(" separator="," close=")">
#{purchaseApplyDetailId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesPurchaseApplyProcessMapper">
<resultMap type="MesPurchaseApplyProcess" id="MesPurchaseApplyProcessResult">
<result property="purchaseApplyId" column="purchase_apply_id"/>
<result property="taskCode" column="task_code"/>
<result property="materialName" column="material_name"/>
<result property="wfProcessId" column="wf_process_id"/>
<result property="processActivityId" column="process_activity_id"/>
<result property="importFlag" column="import_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="processActivityName" column="process_activity_name"/>
</resultMap>
<resultMap id="MesPurchaseApplyProcessMesPurchaseApplyProcessDetailResult" type="MesPurchaseApplyProcess"
extends="MesPurchaseApplyProcessResult">
<collection property="mesPurchaseApplyProcessDetailList" notNullColumn="sub_purchase_apply_detail_id"
javaType="java.util.List" resultMap="MesPurchaseApplyProcessDetailResult"/>
</resultMap>
<resultMap type="MesPurchaseApplyProcessDetail" id="MesPurchaseApplyProcessDetailResult">
<result property="purchaseApplyDetailId" column="sub_purchase_apply_detail_id"/>
<result property="taskCode" column="sub_task_code"/>
<result property="processActivityId" column="sub_process_activity_id"/>
<result property="anomalyFlag" column="sub_anomaly_flag"/>
<result property="updateFlag" column="sub_update_flag"/>
<result property="noticeFlag" column="sub_notice_flag"/>
<result property="noticeAuth" column="sub_notice_auth"/>
<result property="purchaseRemark" column="sub_purchase_remark"/>
<result property="createBy" column="sub_create_by"/>
<result property="createTime" column="sub_create_time"/>
<result property="updateBy" column="sub_update_by"/>
<result property="updateTime" column="sub_update_time"/>
<result property="processActivityName" column="sub_process_activity_name"/>
</resultMap>
<sql id="selectMesPurchaseApplyProcessVo">
select mpap.purchase_apply_id,
mpap.task_code,
mpap.material_name,
mpap.wf_process_id,
mpap.process_activity_id,
mpap.import_flag,
mpap.create_by,
mpap.create_time,
mpap.update_by,
mpap.update_time,
wpa.process_activity_name
from mes_purchase_apply_process mpap
left join wf_process_activity wpa on mpap.process_activity_id + 1 = wpa.process_activity_id
</sql>
<select id="selectMesPurchaseApplyProcessList" parameterType="MesPurchaseApplyProcess"
resultMap="MesPurchaseApplyProcessResult">
<include refid="selectMesPurchaseApplyProcessVo"/>
<where>
<if test="taskCode != null and taskCode != ''">and mpap.task_code = #{taskCode}</if>
<if test="materialName != null and materialName != ''">and mpap.material_name like concat('%', #{materialName},
'%')
</if>
<if test="wfProcessId != null ">and mpap.wf_process_id = #{wfProcessId}</if>
<if test="processActivityId != null ">and mpap.process_activity_id = #{processActivityId}</if>
<if test="importFlag != null and importFlag != ''">and mpap.import_flag = #{importFlag}</if>
</where>
order by mpap.create_time desc
</select>
<select id="selectMesPurchaseApplyProcessByPurchaseApplyId" parameterType="Long"
resultMap="MesPurchaseApplyProcessMesPurchaseApplyProcessDetailResult">
select a.purchase_apply_id,
a.task_code,
a.material_name,
a.wf_process_id,
a.process_activity_id,
a.import_flag,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
b.purchase_apply_detail_id as sub_purchase_apply_detail_id,
b.task_code as sub_task_code,
b.process_activity_id as sub_process_activity_id,
b.anomaly_flag as sub_anomaly_flag,
b.update_flag as sub_update_flag,
b.notice_flag as sub_notice_flag,
b.notice_auth as sub_notice_auth,
b.purchase_remark as sub_purchase_remark,
b.create_by as sub_create_by,
b.create_time as sub_create_time,
b.update_by as sub_update_by,
b.update_time as sub_update_time,
wpa.process_activity_name as sub_process_activity_name,
wp2.process_activity_name
from mes_purchase_apply_process a
left join mes_purchase_apply_process_detail b on b.task_code = a.task_code
left join wf_process_activity wpa on wpa.process_activity_id = b.process_activity_id
left join wf_process_activity wp2 on a.process_activity_id + 1 = wp2.process_activity_id
where a.purchase_apply_id = #{purchaseApplyId}
</select>
<insert id="insertMesPurchaseApplyProcess" parameterType="MesPurchaseApplyProcess" useGeneratedKeys="true"
keyProperty="purchaseApplyId">
insert into mes_purchase_apply_process
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">task_code,</if>
<if test="materialName != null">material_name,</if>
<if test="wfProcessId != null">wf_process_id,</if>
<if test="processActivityId != null">process_activity_id,</if>
<if test="importFlag != null">import_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">#{taskCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="wfProcessId != null">#{wfProcessId},</if>
<if test="processActivityId != null">#{processActivityId},</if>
<if test="importFlag != null">#{importFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateMesPurchaseApplyProcess" parameterType="MesPurchaseApplyProcess">
update mes_purchase_apply_process
<trim prefix="SET" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">task_code = #{taskCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="wfProcessId != null">wf_process_id = #{wfProcessId},</if>
<if test="processActivityId != null">process_activity_id = #{processActivityId},</if>
<if test="importFlag != null">import_flag = #{importFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where purchase_apply_id = #{purchaseApplyId}
</update>
<delete id="deleteMesPurchaseApplyProcessByPurchaseApplyId" parameterType="Long">
delete
from mes_purchase_apply_process
where purchase_apply_id = #{purchaseApplyId}
</delete>
<delete id="deleteMesPurchaseApplyProcessByPurchaseApplyIds" parameterType="String">
delete from mes_purchase_apply_process where purchase_apply_id in
<foreach item="purchaseApplyId" collection="array" open="(" separator="," close=")">
#{purchaseApplyId}
</foreach>
</delete>
<delete id="deleteMesPurchaseApplyProcessDetailByTaskCodes" parameterType="String">
delete from mes_purchase_apply_process_detail where task_code in
<foreach item="taskCode" collection="array" open="(" separator="," close=")">
#{taskCode}
</foreach>
</delete>
<delete id="deleteMesPurchaseApplyProcessDetailByTaskCode" parameterType="Long">
delete
from mes_purchase_apply_process_detail
where task_code = #{taskCode}
</delete>
<insert id="batchMesPurchaseApplyProcessDetail">
insert into mes_purchase_apply_process_detail( purchase_apply_detail_id, task_code, process_activity_id,
anomaly_flag, update_flag, notice_flag, notice_auth, purchase_remark, create_by, create_time, update_by,
update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.purchaseApplyDetailId}, #{item.taskCode}, #{item.processActivityId}, #{item.anomalyFlag},
#{item.updateFlag}, #{item.noticeFlag}, #{item.noticeAuth}, #{item.purchaseRemark}, #{item.createBy},
#{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
</mapper>

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesRaiseCapitalBomMapper">
<resultMap type="MesRaiseCapitalBom" id="MesRaiseCapitalBomResult">
<result property="raiseCapitalId" column="raise_capital_id"/>
<result property="taskCode" column="task_code"/>
<result property="materialBomDesc" column="material_bom_desc"/>
<result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/>
<result property="materialId" column="material_id"/>
<result property="materialName" column="material_name"/>
<result property="standardAmount" column="standard_amount"/>
<result property="topFlag" column="top_flag"/>
<result property="checkType" column="check_type"/>
<result property="projectId" column="project_id"/>
<result property="assembleTime" column="assemble_time"/>
<result property="activeFlag" column="active_flag"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="brand" column="brand"/>
<result property="materialClassfication" column="material_classfication"/>
<result property="erpMaterialId" column="erp_material_id"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
</resultMap>
<sql id="selectMesRaiseCapitalBomVo">
select mrcb.raise_capital_id,
mrcb.task_code,
mrcb.material_bom_desc,
mrcb.parent_id,
mrcb.ancestors,
mrcb.material_id,
mrcb.standard_amount,
mrcb.top_flag,
mrcb.check_type,
mrcb.project_id,
mrcb.assemble_time,
mrcb.active_flag,
mrcb.remark,
mrcb.create_by,
mrcb.create_time,
mrcb.update_by,
mrcb.update_time,
mrcb.brand,
mrcb.material_classfication,
mrcb.erp_material_id,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec
from mes_raise_capital_bom mrcb
left join mes_base_material_info mbmi on mrcb.material_id = mbmi.material_id
</sql>
<select id="selectMesRaiseCapitalBomList" parameterType="MesRaiseCapitalBom" resultMap="MesRaiseCapitalBomResult">
<include refid="selectMesRaiseCapitalBomVo"/>
<where>
<if test="taskCode != null and taskCode != ''">and mrcb.task_code = #{taskCode}</if>
<if test="materialBomDesc != null and materialBomDesc != ''">and mrcb.material_bom_desc = #{materialBomDesc}
</if>
<if test="parentId != null ">and mrcb.parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''">and mrcb.ancestors = #{ancestors}</if>
<if test="materialId != null ">and mrcb.material_id = #{materialId}</if>
<if test="materialName != null and materialName != ''">and mrcb.material_name like concat('%', #{materialName},
'%')
</if>
<if test="standardAmount != null ">and mrcb.standard_amount = #{standardAmount}</if>
<if test="topFlag != null ">and mrcb.top_flag = #{topFlag}</if>
<if test="checkType != null and checkType != ''">and mrcb.check_type = #{checkType}</if>
<if test="projectId != null ">and mrcb.project_id = #{projectId}</if>
<if test="assembleTime != null ">and mrcb.assemble_time = #{assembleTime}</if>
<if test="activeFlag != null and activeFlag != ''">and mrcb.active_flag = #{activeFlag}</if>
<if test="brand != null and brand != ''">and mrcb.brand = #{brand}</if>
<if test="materialClassfication != null and materialClassfication != ''">and mrcb.material_classfication =
#{materialClassfication}
</if>
<if test="erpMaterialId != null ">and mrcb.erp_material_id = #{erpMaterialId}</if>
</where>
</select>
<select id="selectMesRaiseCapitalBomByRaiseCapitalId" parameterType="Long" resultMap="MesRaiseCapitalBomResult">
<include refid="selectMesRaiseCapitalBomVo"/>
where mrcb.raise_capital_id = #{raiseCapitalId}
</select>
<insert id="insertMesRaiseCapitalBom" parameterType="MesRaiseCapitalBom" useGeneratedKeys="true"
keyProperty="raiseCapitalId">
insert into mes_raise_capital_bom
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">task_code,</if>
<if test="materialBomDesc != null">material_bom_desc,</if>
<if test="parentId != null">parent_id,</if>
<if test="ancestors != null">ancestors,</if>
<if test="materialId != null">material_id,</if>
<if test="materialName != null">material_name,</if>
<if test="standardAmount != null">standard_amount,</if>
<if test="topFlag != null">top_flag,</if>
<if test="checkType != null">check_type,</if>
<if test="projectId != null">project_id,</if>
<if test="assembleTime != null">assemble_time,</if>
<if test="activeFlag != null and activeFlag != ''">active_flag,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="brand != null">brand,</if>
<if test="materialClassfication != null">material_classfication,</if>
<if test="erpMaterialId != null">erp_material_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">#{taskCode},</if>
<if test="materialBomDesc != null">#{materialBomDesc},</if>
<if test="parentId != null">#{parentId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialName != null">#{materialName},</if>
<if test="standardAmount != null">#{standardAmount},</if>
<if test="topFlag != null">#{topFlag},</if>
<if test="checkType != null">#{checkType},</if>
<if test="projectId != null">#{projectId},</if>
<if test="assembleTime != null">#{assembleTime},</if>
<if test="activeFlag != null and activeFlag != ''">#{activeFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="brand != null">#{brand},</if>
<if test="materialClassfication != null">#{materialClassfication},</if>
<if test="erpMaterialId != null">#{erpMaterialId},</if>
</trim>
</insert>
<update id="updateMesRaiseCapitalBom" parameterType="MesRaiseCapitalBom">
update mes_raise_capital_bom
<trim prefix="SET" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">task_code = #{taskCode},</if>
<if test="materialBomDesc != null">material_bom_desc = #{materialBomDesc},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="standardAmount != null">standard_amount = #{standardAmount},</if>
<if test="topFlag != null">top_flag = #{topFlag},</if>
<if test="checkType != null">check_type = #{checkType},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="assembleTime != null">assemble_time = #{assembleTime},</if>
<if test="activeFlag != null and activeFlag != ''">active_flag = #{activeFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="brand != null">brand = #{brand},</if>
<if test="materialClassfication != null">material_classfication = #{materialClassfication},</if>
<if test="erpMaterialId != null">erp_material_id = #{erpMaterialId},</if>
</trim>
where raise_capital_id = #{raiseCapitalId}
</update>
<delete id="deleteMesRaiseCapitalBomByRaiseCapitalId" parameterType="Long">
delete
from mes_raise_capital_bom
where raise_capital_id = #{raiseCapitalId}
</delete>
<delete id="deleteMesRaiseCapitalBomByRaiseCapitalIds" parameterType="String">
delete from mes_raise_capital_bom where raise_capital_id in
<foreach item="raiseCapitalId" collection="array" open="(" separator="," close=")">
#{raiseCapitalId}
</foreach>
</delete>
</mapper>

@ -121,4 +121,11 @@ public class WfProcessActivityController extends BaseController
return success(wfProcessActivityService.selectWfProcessActivityByUI(queryProcessActivityVo.getWfProcessId(),
queryProcessActivityVo.getProcessActivityOrder()));
}
@InnerAuth
@PostMapping(value = "/processActivityUserInfo")
public AjaxResult processActivityUserInfo(@RequestBody Long processActivityId)
{
return success(wfProcessActivityService.selectProcessActivityUserInfo(processActivityId));
}
}

@ -100,4 +100,5 @@ public interface WfProcessActivityMapper
public WfProcessActivity selectWfProcessActivityByUI(@Param("wfProcessId") Long wfProcessId,
@Param("processActivityOrder") Long processActivityOrder);
public WfProcessActivity selectProcessActivityUserInfo(Long processActivityId);
}

@ -70,4 +70,7 @@ public interface IWfProcessActivityService {
* @return
*/
public WfProcessActivity selectWfProcessActivityByUI(Long wfProcessId, Long processActivityOrder);
WfProcessActivity selectProcessActivityUserInfo(Long processActivityId);
}

@ -179,4 +179,10 @@ public class WfProcessActivityServiceImpl implements IWfProcessActivityService
public WfProcessActivity selectWfProcessActivityByUI(Long wfProcessId, Long processActivityOrder){
return wfProcessActivityMapper.selectWfProcessActivityByUI(wfProcessId, processActivityOrder);
}
@Override
public WfProcessActivity selectProcessActivityUserInfo(Long processActivityId) {
WfProcessActivity wfProcessActivity = wfProcessActivityMapper.selectProcessActivityUserInfo(processActivityId);
return wfProcessActivity;
}
}

@ -37,6 +37,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
<result property="userName" column="sub_user_name" />
<result property="nickName" column="sub_nick_name" />
<result property="email" column="sub_email" />
</resultMap>
<sql id="selectWfProcessActivityVo">
@ -170,4 +173,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from wf_process_activity a
where a.wf_process_id = #{wfProcessId} and a.process_activity_order = #{processActivityOrder} limit 1
</select>
<select id="selectProcessActivityUserInfo" parameterType="Long" resultMap="WfProcessActivityWfProcessActivityAuthResult">
select a.process_activity_id,
a.wf_process_id,
a.process_activity_name,
a.process_activity_order,
a.wf_activity_type,
a.email_notice,
a.wechat_offical_notice,
a.wecom_notice,
a.sms_notice,
a.dingtalk_notice,
a.time_limit,
a.is_assist,
a.remark,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
b.process_activity_auth_id as sub_process_activity_auth_id,
b.process_activity_id as sub_process_activity_id,
b.auth_target_type as sub_auth_target_type,
b.auth_target_id as sub_auth_target_id,
b.create_by as sub_create_by,
b.create_time as sub_create_time,
b.update_by as sub_update_by,
b.update_time as sub_update_time,
u.user_name as sub_user_name,
u.nick_name as sub_nick_name,
u.email as sub_email
from wf_process_activity a
left join wf_process_activity_auth b on b.process_activity_id = a.process_activity_id
left join sys_user u on u.user_id = b.auth_target_id
where a.process_activity_id = #{processActivityId}
</select>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询提资单BOM信息列表
export function listMesRaiseCapitalBom(query) {
return request({
url: '/mes/mesRaiseCapitalBom/list',
method: 'get',
params: query
})
}
// 查询提资单BOM信息详细
export function getMesRaiseCapitalBom(raiseCapitalId) {
return request({
url: '/mes/mesRaiseCapitalBom/' + raiseCapitalId,
method: 'get'
})
}
// 新增提资单BOM信息
export function addMesRaiseCapitalBom(data) {
return request({
url: '/mes/mesRaiseCapitalBom',
method: 'post',
data: data
})
}
// 修改提资单BOM信息
export function updateMesRaiseCapitalBom(data) {
return request({
url: '/mes/mesRaiseCapitalBom',
method: 'put',
data: data
})
}
// 删除提资单BOM信息
export function delMesRaiseCapitalBom(raiseCapitalId) {
return request({
url: '/mes/mesRaiseCapitalBom/' + raiseCapitalId,
method: 'delete'
})
}

@ -0,0 +1,62 @@
import request from '@/utils/request'
// 查询采购申请流程列表
export function listPurchaseApplyProcess(query) {
return request({
url: '/mes/purchaseApplyProcess/list',
method: 'get',
params: query
})
}
// 查询采购申请流程详细
export function getPurchaseApplyProcess(purchaseApplyId) {
return request({
url: '/mes/purchaseApplyProcess/' + purchaseApplyId,
method: 'get'
})
}
// 新增采购申请流程
export function addPurchaseApplyProcess(data) {
return request({
url: '/mes/purchaseApplyProcess',
method: 'post',
data: data
})
}
// 修改采购申请流程
export function updatePurchaseApplyProcess(data) {
return request({
url: '/mes/purchaseApplyProcess',
method: 'put',
data: data
})
}
// 删除采购申请流程
export function delPurchaseApplyProcess(purchaseApplyId) {
return request({
url: '/mes/purchaseApplyProcess/' + purchaseApplyId,
method: 'delete'
})
}
// 采购异常流转
export function purchaseAbnormalFlowApi(data) {
return request({
url: '/mes/purchaseApplyProcess/purchaseAbnormalFlow',
method: 'post',
data: data
})
}
// 技术处理
export function technicalProcessingFlowApi(data) {
return request({
url: '/mes/purchaseApplyProcess/technicalProcessing',
method: 'post',
data: data
})
}

@ -647,6 +647,20 @@ export const dynamicRoutes = [
},
],
},
{
path: '/mes/raise-capital-bom',
component: Layout,
hidden: true,
permissions: ['mes:mesRaiseCapitalBom:list'],
children: [
{
path: 'index/:taskCode',
component: () => import('@/views/mes/mesRaiseCapitalBom/index'),
name: 'orderBind',
meta: { title: '提资单BOM', activeMenu: '/mes/mesRaiseCapitalBom' }
}
]
},
]

@ -0,0 +1,529 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['mes:mesRaiseCapitalBom:add']"-->
<!-- >新增-->
<!-- </el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="mesRaiseCapitalBomList"
row-key="raiseCapitalId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="父级标识" prop="parentId" v-if="columns[1].visible"/>
<el-table-column label="祖级列表" align="center" prop="ancestors" v-if="columns[2].visible"/>
<el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[3].visible"/>
<el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="left" prop="materialName" v-if="columns[4].visible"/>
<el-table-column label="物料规格" align="center" prop="materialSpec"/>
<el-table-column label="BOM说明" align="center" prop="materialBomDesc" v-if="columns[15].visible"/>
<el-table-column label="任务编号" prop="taskCode" v-if="columns[1].visible"/>
<el-table-column label="标准数量" align="center" prop="standardAmount" v-if="columns[5].visible"/>
<el-table-column label="安装时长" align="center" prop="assembleTime" v-if="columns[16].visible">
<template slot-scope="scope">
<span>{{ formatDayHourMinutes(scope.row.assembleTime) }}</span>
</template>
</el-table-column>
<el-table-column label="顶级标识" align="center" prop="topFlag" v-if="columns[6].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.topFlag"/>
</template>
</el-table-column>
<el-table-column label="校验类型" align="center" prop="checkType" v-if="columns[7].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_type" :value="scope.row.checkType"/>
</template>
</el-table-column>
<el-table-column label="项目ID" align="center" prop="projectId" v-if="columns[8].visible"/>
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[9].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.activeFlag"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[10].visible"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:mesRaiseCapitalBom:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-if="scope.row.parentId === 0"
v-hasPermi="['mes:mesRaiseCapitalBom:add']"
>新增
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:mesRaiseCapitalBom:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改提资单BOM信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="任务编号" prop="taskCode">
<el-input v-model="form.taskCode" disabled/>
</el-form-item>
<el-form-item label="父级BOM" prop="parentId" v-if="topBomVisible">
<treeselect v-model="form.parentId" :options="mesRaiseCapitalBomOptions" :normalizer="normalizer"
v-if="topBomVisible" disabled/>
</el-form-item>
<!-- <el-form-item label="物料ID" prop="materialId">-->
<!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" />-->
<!-- </el-form-item>-->
<el-form-item :label="childBomName" prop="materialName">
<el-input v-model="form.materialName" placeholder="请点击右侧检索子BOM" readonly>
<el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button>
</el-input>
</el-form-item>
<el-form-item label="BOM说明" prop="materialBomDesc">
<el-input v-model="form.materialBomDesc" placeholder="请输入BOM说明(BOM版本)" disabled/>
</el-form-item>
<el-form-item label="安装时长" prop="assembleTime" v-if="assembleTimeVisible">
<el-input-number v-model="form.productionTimeDays" placeholder="请输入天数" :min="0" :max="10000"
:controls="false" :style="{ width: '50px' }"/>
<el-input-number v-model="form.productionTimeHours" placeholder="请输入小时" :min="0" :max="23"
:controls="false" :style="{ width: '50px' }"/>
小时
<el-input-number v-model="form.productionTimeMinutes" placeholder="请输入分钟" :min="0" :max="59"
:controls="false" :style="{ width: '50px' }"/>
分钟
</el-form-item>
<el-form-item label="标准数量" prop="standardAmount">
<el-input-number v-model="form.standardAmount" :min="1" placeholder="请输入标准数量"
:disabled="amountDisabled"/>
</el-form-item>
<!-- <el-form-item label="顶级标识" prop="topFlag">-->
<!-- <el-radio-group v-model="form.topFlag">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.active_flag"-->
<!-- :key="dict.value"-->
<!-- :label="parseInt(dict.value)"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<el-form-item label="校验类型" prop="checkType" v-if="form.topFlag !== TOP_FLAG.YES">
<el-radio-group v-model="form.checkType">
<el-radio
v-for="dict in dict.type.check_type"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="激活标识" prop="activeFlag">
<el-radio-group v-model="form.activeFlag">
<el-radio
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加物料信息对话框 -->
<el-dialog title="选择物料信息" :visible.sync="materialOpen" append-to-body>
<select-material @selection="handleSelection" ref="materialRef" v-if="materialOpen"></select-material>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listMesRaiseCapitalBom,
getMesRaiseCapitalBom,
delMesRaiseCapitalBom,
addMesRaiseCapitalBom,
updateMesRaiseCapitalBom
} from "@/api/mes/mesRaiseCapitalBom";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import selectMaterial from "@/views/mes/materialinfo/selectMaterial";
export default {
name: "MesRaiseCapitalBom",
dicts: ['active_flag', 'check_type'],
components: {
Treeselect,
'select-material': selectMaterial
},
data() {
return {
//
loading: true,
//
showSearch: true,
// BOM
mesRaiseCapitalBomList: [],
// BOM
mesRaiseCapitalBomOptions: [],
//
title: "",
//
open: false,
// BOM
assembleTimeVisible: true,
// BOM
topBomVisible: true,
// BOM
amountDisabled: false,
// BOM
childBomName: "子级BOM",
//
materialOpen: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
taskCode: null,
materialBomDesc: null,
parentId: null,
ancestors: null,
materialId: null,
materialName: null,
standardAmount: null,
topFlag: null,
checkType: null,
projectId: null,
assembleTime: null,
activeFlag: null,
brand: null,
materialClassfication: null,
erpMaterialId: null
},
//
form: {},
//
rules: {
taskCode: [
{required: true, message: "任务编号不能为空", trigger: "blur"}
],
parentId: [
{required: true, message: "父级标识不能为空", trigger: "blur"}
],
materialId: [
{required: true, message: "物料ID不能为空", trigger: "blur"}
],
standardAmount: [
{required: true, message: "标准数量;最顶级数量须为1不能为空", trigger: "blur"}
],
activeFlag: [
{required: true, message: "激活标识不能为空", trigger: "blur"}
],
},
columns: [
{key: 0, label: `主键标识`, visible: false},
{key: 1, label: `父级标识`, visible: false},
{key: 2, label: `祖级列表`, visible: false},
{key: 3, label: `物料ID`, visible: false},
{key: 4, label: `物料名称`, visible: true},
{key: 5, label: `标准数量`, visible: true},
{key: 6, label: `顶级标识`, visible: true},
{key: 7, label: `校验类型`, visible: true},
{key: 8, label: `项目ID`, visible: false},
{key: 9, label: `激活标识`, visible: false},
{key: 10, label: `备注`, visible: true},
{key: 11, label: `创建人`, visible: true},
{key: 12, label: `创建时间`, visible: true},
{key: 13, label: `更新人`, visible: true},
{key: 14, label: `更新时间`, visible: true},
{key: 15, label: `BOM说明`, visible: true},
{key: 16, label: `安装时长`, visible: true},
],
//
TOP_FLAG: {
YES: 1,
NO: 0
}
};
},
created() {
let taskCode = this.$route.params && this.$route.params.taskCode;
if (taskCode != null){
this.queryParams.taskCode = taskCode
}
this.getList();
},
watch: {
'form.parentId': function (newValue, oldValue) {
if (newValue === 0) {
this.topBomVisible = false;
this.amountDisabled = true;
this.childBomName = "成品BOM";
} else {
this.topBomVisible = true;
this.amountDisabled = false;
this.childBomName = "子级BOM";
}
},
},
methods: {
/** 查询提资单BOM信息列表 */
getList() {
this.loading = true;
listMesRaiseCapitalBom(this.queryParams).then(response => {
this.mesRaiseCapitalBomList = this.handleTree(response.data, "raiseCapitalId", "parentId");
this.loading = false;
});
},
/** 转换提资单BOM信息数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.raiseCapitalId,
label: node.materialName,
children: node.children
};
},
/** 查询提资单BOM信息下拉树结构 */
getTreeselect() {
listMesRaiseCapitalBom().then(response => {
this.mesRaiseCapitalBomOptions = [];
const data = {raiseCapitalId: 0, materialName: '顶级节点', children: []};
data.children = this.handleTree(response.data, "raiseCapitalId", "parentId");
this.mesRaiseCapitalBomOptions.push(data);
});
},
/** 新增按钮操作 */
handleMaterialAdd() {
this.materialOpen = true;
},
handleSelection(selection) {
this.ids = selection.map(item => item.materialBomId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 提交物料信息按钮 */
submitMaterialForm() {
let selectedRow = this.$refs.materialRef.selectedRow;
this.$set(this.form, "materialId", selectedRow.materialId);
this.$set(this.form, "materialName", selectedRow.materialName);
this.$set(this.form, "erpMaterialId", selectedRow.erpId);
this.materialOpen = false;
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
raiseCapitalId: null,
taskCode: null,
materialBomDesc: null,
parentId: null,
ancestors: null,
materialId: null,
materialName: null,
standardAmount: null,
productionTimeDays: 0,
productionTimeHours: 0,
productionTimeMinutes: 0,
topFlag: 1,
checkType: '0',
projectId: null,
activeFlag: '1',
assembleTime: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
brand: null,
materialClassfication: null,
erpMaterialId: null
};
this.assembleTimeVisible = true;
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.raiseCapitalId) {
this.form.parentId = row.raiseCapitalId;
this.form.topFlag = this.TOP_FLAG.NO;
this.form.taskCode = row.taskCode
this.form.materialBomDesc = row.materialBomDesc;
this.assembleTimeVisible = true;
} else {
this.form.parentId = 0;
this.form.topFlag = this.TOP_FLAG.YES;
this.assembleTimeVisible = false;
}
this.open = true;
this.title = "添加提资单BOM信息";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.parentId = row.raiseCapitalId;
}
getMesRaiseCapitalBom(row.raiseCapitalId).then(response => {
this.form = response.data;
if (this.form.parentId === 0) {
this.assembleTimeVisible = false;
}
this.open = true;
this.title = "修改提资单BOM信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (!/^[0-9]\d*$/.test(this.form.productionTimeDays)
|| !/^[0-9]\d*$/.test(this.form.productionTimeHours)
|| !/^[0-9]\d*$/.test(this.form.productionTimeMinutes)) {
this.$modal.msgError("安装时长天、小时、分钟需为大于等于0的正整数");
return;
}
this.convertToSeconds();
if (this.form.raiseCapitalId != null) {
updateMesRaiseCapitalBom(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMesRaiseCapitalBom(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 天小时分钟转换为秒 */
convertToSeconds() {
const daysInSeconds = this.form.productionTimeDays * 24 * 60 * 60;
const hoursInSeconds = this.form.productionTimeHours * 60 * 60;
const minutesInSeconds = this.form.productionTimeMinutes * 60;
this.form.assembleTime = daysInSeconds + hoursInSeconds + minutesInSeconds;
},
/** 秒转换为天小时分钟 */
convertToTime() {
const totalSeconds = this.form.assembleTime;
const days = Math.floor(totalSeconds / (24 * 60 * 60));
const hours = Math.floor((totalSeconds % (24 * 60 * 60)) / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
//
this.form.productionTimeDays = days;
this.form.productionTimeHours = hours;
this.form.productionTimeMinutes = minutes;
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除物料名称为"' + row.materialName + '"的数据项?').then(function () {
return delMesRaiseCapitalBom(row.raiseCapitalId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
}
}
};
</script>

@ -0,0 +1,556 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
<el-form-item label="任务编号" prop="taskCode">
<el-input
v-model="queryParams.taskCode"
placeholder="请输入任务编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="导入BOM标识" prop="importFlag">
<el-select v-model="queryParams.importFlag" placeholder="请选择导入BOM标识" clearable>
<el-option
v-for="dict in dict.type.import_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['mes:purchaseApplyProcess:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['mes:purchaseApplyProcess:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['mes:purchaseApplyProcess:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['mes:purchaseApplyProcess:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['mes:purchaseApplyProcess:import']"
>提资单BOM导入
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="purchaseApplyProcessList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键标识" align="center" prop="purchaseApplyId" v-if="columns[0].visible"/>
<el-table-column label="任务编号" align="center" prop="taskCode" v-if="columns[1].visible"/>
<el-table-column label="提资单成品名称" align="center" prop="materialName" v-if="columns[2].visible"/>
<el-table-column label="当前流程节点" align="center" prop="processActivityName" v-if="columns[3].visible"/>
<el-table-column label="导入BOM标识" align="center" prop="importFlag" width="110" v-if="columns[4].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.import_flag" :value="scope.row.importFlag"/>
</template>
</el-table-column>
<el-table-column label="导入人" align="center" prop="createBy" width="80" v-if="columns[5].visible"/>
<el-table-column label="导入时间" align="center" prop="createTime" width="180" v-if="columns[6].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleDetailInfo(scope.row)"
>流程明细
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleRaiseCapitalBom(scope.row)"
v-hasPermi="['mes:mesRaiseCapitalBom:list']"
>提资单BOM
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-user-solid"
@click="handlePurchaseProcess(scope.row)"
v-if="scope.row.processActivityId === PROCESS_NODE.CREATE_ID"
v-hasPermi="['mes:purchaseApplyProcess:purchaseEdit']"
>采购处理
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-user-solid"
@click="handleTechnicalProcessing(scope.row)"
v-if="scope.row.processActivityId === PROCESS_NODE.TECHNICAL_MODIFY_ID
|| scope.row.processActivityId === PROCESS_NODE.PROCUREMENT_AUDIT_ID"
v-hasPermi="['mes:purchaseApplyProcess:technicalEdit']"
>技术处理
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['mes:purchaseApplyProcess:remove']"-->
<!-- >删除</el-button>-->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 采购处理流程对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<el-form-item label="任务编号" prop="taskCode">
<el-input v-model="form.taskCode" placeholder="请输入任务编号" disabled/>
</el-form-item>
<el-form-item label="提资单成品名称" prop="materialName">
<el-input v-model="form.materialName" type="textarea" disabled/>
</el-form-item>
<el-form-item label="当前流程节点" prop="processActivityName">
<el-input v-model="form.processActivityName" disabled/>
</el-form-item>
<el-form-item label="备注(通知内容)" prop="remark">
<el-input v-model="form.remark" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="purchaseAbnormalFlow(ANOMALY_FLAG.NO)">BOM</el-button>
<el-button type="warning" @click="purchaseAbnormalFlow(ANOMALY_FLAG.YES)"></el-button>
</div>
</el-dialog>
<!-- 技术处理流程对话框 -->
<el-dialog :title="title" :visible.sync="technicalOpen" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<el-form-item label="任务编号" prop="taskCode">
<el-input v-model="form.taskCode" placeholder="请输入任务编号" disabled/>
</el-form-item>
<el-form-item label="提资单成品名称" prop="materialName">
<el-input v-model="form.materialName" type="textarea" disabled/>
</el-form-item>
<el-form-item label="当前流程节点" prop="processActivityName">
<el-input v-model="form.processActivityName" disabled/>
</el-form-item>
<el-form-item label="备注(通知内容)" prop="remark">
<el-input v-model="form.remark" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="technicalProcessingFlow(ANOMALY_FLAG.NO)"></el-button>
<el-button type="warning" @click="technicalProcessingFlow(ANOMALY_FLAG.YES)">ERP</el-button>
</div>
</el-dialog>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xlsxlsx格式文件</span>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
<el-dialog :title="detailInfoTitle" :visible.sync="detailInfoOpen" width="1200px" append-to-body>
<el-table :data="mesPurchaseApplyProcessDetailList" ref="mesPurchaseApplyProcessDetail">
<el-table-column label="流程节点ID" align="center" prop="processActivityId" width="100">
<template slot-scope="scope">
<el-input v-model="scope.row.processActivityId" disabled/>
</template>
</el-table-column>
<el-table-column label="流程节点描述" align="center" prop="processActivityName" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.processActivityName" disabled/>
</template>
</el-table-column>
<el-table-column label="异常标识" align="center" prop="anomalyFlag" width="80">
<template slot-scope="scope">
<dict-tag :options="dict.type.import_flag" :value="scope.row.anomalyFlag" disabled/>
</template>
</el-table-column>
<!-- <el-table-column label="更新标识" prop="updateFlag" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.import_flag" :value="scope.row.updateFlag" disabled/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="备注" align="center" prop="purchaseRemark" >
<template slot-scope="scope">
<el-input v-model="scope.row.purchaseRemark" type="textarea" disabled/>
</template>
</el-table-column>
<el-table-column label="通知标识" align="center" prop="noticeFlag" width="80">
<template slot-scope="scope">
<dict-tag :options="dict.type.import_flag" :value="scope.row.noticeFlag" disabled/>
</template>
</el-table-column>
<el-table-column label="通知用户编号" align="center" prop="noticeAuth" width="120"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import {
listPurchaseApplyProcess,
getPurchaseApplyProcess,
delPurchaseApplyProcess,
addPurchaseApplyProcess,
updatePurchaseApplyProcess, purchaseAbnormalFlowApi, technicalProcessingFlowApi
} from "@/api/mes/purchaseApplyProcess";
import {getToken} from "@/utils/auth";
export default {
name: "PurchaseApplyProcess",
dicts: ['import_flag'],
data() {
return {
//
loading: true,
//
ids: [],
//
checkedMesPurchaseApplyProcessDetail: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
purchaseApplyProcessList: [],
//
mesPurchaseApplyProcessDetailList: [],
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: {Authorization: "Bearer " + getToken()},
//
url: process.env.VUE_APP_BASE_API + "/mes/import/raiseCapitalImportData"
},
//
title: "",
detailInfoTitle: "采购申请流程明细",
//
open: false,
technicalOpen: false,
detailInfoOpen: false,
//
daterangeCreateTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
taskCode: null,
materialName: null,
wfProcessId: null,
importFlag: null,
},
//
form: {},
//
rules: {
taskCode: [
{required: true, message: "任务编号不能为空", trigger: "blur"}
],
},
columns: [
{key: 0, label: `主键标识`, visible: false},
{key: 1, label: `任务编号`, visible: true},
{key: 2, label: `提资单成品名称`, visible: true},
{key: 3, label: `当前流程节点`, visible: true},
{key: 4, label: `导入BOM标识`, visible: true},
{key: 5, label: `创建人`, visible: true},
{key: 6, label: `导入时间`, visible: true},
],
//
ANOMALY_FLAG: {
YES: 1,
NO: 0
},
//
PROCESS_NODE: {
CREATE_ID : 4011,
PROCUREMENT_AUDIT_ID: 4012,
TECHNICAL_MODIFY_ID: 4013,
ERP_MODIFY_ID: 4014,
FINISH_ID: 4015,
}
};
},
created() {
this.getList();
},
methods: {
/** 查询采购申请流程列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
}
listPurchaseApplyProcess(this.queryParams).then(response => {
this.purchaseApplyProcessList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
purchaseApplyId: null,
taskCode: null,
materialName: null,
wfProcessId: null,
importFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.mesPurchaseApplyProcessDetailList = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.purchaseApplyId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加采购申请流程";
},
//BOM
handleRaiseCapitalBom(row) {
const taskCode = row.taskCode;
const params = {queryParams: this.queryParams, t: Date.now()};
this.$tab.openPage("提资单BOM[" + taskCode + "]", '/mes/raise-capital-bom/index/' + taskCode, params);
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = "BOM导入";
this.upload.open = true;
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
this.getList();
},
//
submitFileForm() {
this.$refs.upload.submit();
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.mesPurchaseApplyProcessDetailList = this.mesPurchaseApplyProcessDetailList;
if (this.form.purchaseApplyId != null) {
updatePurchaseApplyProcess(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPurchaseApplyProcess(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 申请流程-采购处理对话框 */
handlePurchaseProcess(row){
this.reset();
const purchaseApplyId = row.purchaseApplyId || this.ids
getPurchaseApplyProcess(purchaseApplyId).then(response => {
this.form = response.data;
this.mesPurchaseApplyProcessDetailList = response.data.mesPurchaseApplyProcessDetailList;
this.open = true;
this.title = "采购申请流程-采购处理";
});
},
/** 申请流程-采购处理 */
purchaseAbnormalFlow(anomalyFlag){
this.form.currentAnomalyFlag = anomalyFlag
purchaseAbnormalFlowApi(this.form).then(response => {
if (anomalyFlag === this.ANOMALY_FLAG.YES){
this.$modal.msgSuccess("通知技术人员修改成功!");
} else {
this.$modal.msgSuccess("BOM导入处理成功");
}
this.open = false;
this.getList();
});
},
/** 申请流程-技术处理对话框 */
handleTechnicalProcessing(row){
this.reset();
const purchaseApplyId = row.purchaseApplyId || this.ids
getPurchaseApplyProcess(purchaseApplyId).then(response => {
this.form = response.data;
this.mesPurchaseApplyProcessDetailList = response.data.mesPurchaseApplyProcessDetailList;
this.technicalOpen = true;
this.title = "采购申请流程-技术处理";
});
},
/** 申请流程-技术处理 */
technicalProcessingFlow(anomalyFlag){
this.form.currentAnomalyFlag = anomalyFlag
technicalProcessingFlowApi(this.form).then(response => {
if (anomalyFlag === this.ANOMALY_FLAG.YES){
this.$modal.msgSuccess("通知ERP人员成功");
} else {
this.$modal.msgSuccess("处理成功!");
}
this.technicalOpen = false;
this.getList();
});
},
/** 申请流程-明细信息 */
handleDetailInfo(row){
this.reset();
const purchaseApplyId = row.purchaseApplyId || this.ids
getPurchaseApplyProcess(purchaseApplyId).then(response => {
this.mesPurchaseApplyProcessDetailList = response.data.mesPurchaseApplyProcessDetailList;
this.detailInfoOpen = true;
this.detailInfoTitle = "任务编号[" + row.taskCode + "]采购申请流程明细信息";
});
},
/** 删除按钮操作 */
handleDelete(row) {
const purchaseApplyIds = row.purchaseApplyId || this.ids;
this.$modal.confirm('是否确认删除采购申请流程编号为"' + purchaseApplyIds + '"的数据项?').then(function () {
return delPurchaseApplyProcess(purchaseApplyIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/purchaseApplyProcess/export', {
...this.queryParams
}, `purchaseApplyProcess_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save