From 8e64fdbe79f48c9635ded95860c3b1a364ecb1ea Mon Sep 17 00:00:00 2001
From: 刘小明 <liuxm_a@163.com>
Date: 星期四, 26 九月 2024 16:09:39 +0800
Subject: [PATCH] 生产流程-节点相关接口添加物料清单信息
---
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrBillOfMaterial.java | 45 +++++++++++
pms-parent/pms-global/src/main/resources/mapper/PrBillOfMaterialMapper.xml | 92 +++++++++++++++++++++++
pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml | 2
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java | 50 ++++++++++--
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrBillOfMaterialMapper.java | 23 +++++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java | 2
pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java | 4
7 files changed, 206 insertions(+), 12 deletions(-)
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrBillOfMaterialMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrBillOfMaterialMapper.java
new file mode 100644
index 0000000..ffee6ba
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrBillOfMaterialMapper.java
@@ -0,0 +1,23 @@
+package com.dy.pmsGlobal.daoPr;
+
+import com.dy.pmsGlobal.pojoPr.PrBillOfMaterial;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface PrBillOfMaterialMapper {
+ int deleteByPrimaryKey(Long id);
+
+ int insert(PrBillOfMaterial record);
+
+ int insertSelective(PrBillOfMaterial record);
+
+ PrBillOfMaterial selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(PrBillOfMaterial record);
+
+ int updateByPrimaryKey(PrBillOfMaterial record);
+
+ int insertMany(List<PrBillOfMaterial> records);
+}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrBillOfMaterial.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrBillOfMaterial.java
new file mode 100644
index 0000000..62087f6
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrBillOfMaterial.java
@@ -0,0 +1,45 @@
+package com.dy.pmsGlobal.pojoPr;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dy.common.po.BaseEntity;
+import lombok.*;
+
+/**
+ * 鑺傜偣-鐗╂枡娓呭崟鍏宠仈琛�
+ */
+@TableName(value="pr_bill_of_material", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+public class PrBillOfMaterial implements BaseEntity {
+ @JSONField(serializeUsing= ObjectWriterImplToString.class)
+ public Long id;
+
+ /**
+ * 鑺傜偣瀹炰綋缂栧彿
+ */
+ @JSONField(serializeUsing= ObjectWriterImplToString.class)
+ public Long nodeId;
+
+ /**
+ * 鏂囦欢缂栧彿
+ */
+ @JSONField(serializeUsing= ObjectWriterImplToString.class)
+ public Long fileId;
+
+ /**
+ * 鏂囦欢涓嬭浇鍦板潃
+ */
+ @TableField(exist = false)
+ public String webUrl;
+
+ @TableField(exist = false)
+ public String orgName;
+ @TableField(exist = false)
+ public String extName;
+}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java
index a33064b..497b981 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java
@@ -94,5 +94,7 @@
@TableField(exist = false)
public PrWorkingInstruction instruction;
+ @TableField(exist = false)
+ public PrBillOfMaterial bill;
}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrBillOfMaterialMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrBillOfMaterialMapper.xml
new file mode 100644
index 0000000..a9c0e69
--- /dev/null
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrBillOfMaterialMapper.xml
@@ -0,0 +1,92 @@
+<?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.dy.pmsGlobal.daoPr.PrBillOfMaterialMapper">
+ <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPr.PrBillOfMaterial">
+ <!--@mbg.generated-->
+ <!--@Table pr_bill_of_material-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="node_id" jdbcType="BIGINT" property="nodeId" />
+ <result column="file_id" jdbcType="BIGINT" property="fileId" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--@mbg.generated-->
+ id, node_id, file_id
+ </sql>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+ <!--@mbg.generated-->
+ select
+ <include refid="Base_Column_List" />
+ from pr_bill_of_material
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+ <select id="selectByNodeId" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List" />
+ from pr_bill_of_material
+ where node_id = #{nodeId,jdbcType=BIGINT}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+ <!--@mbg.generated-->
+ delete from pr_bill_of_material
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+ <insert id="insertMany" parameterType="java.util.List">
+ insert into pr_bill_of_material
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ id,node_id,file_id
+ </trim>
+ values
+ <foreach collection="list" item="item" separator=",">
+ (
+ #{item.id,jdbcType=BIGINT},
+ #{item.nodeId,jdbcType=BIGINT},
+ #{item.fileId,jdbcType=BIGINT}
+ )
+ </foreach>
+ </insert>
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPr.PrBillOfMaterial" useGeneratedKeys="true">
+ <!--@mbg.generated-->
+ insert into pr_bill_of_material (node_id, file_id)
+ values (#{nodeId,jdbcType=BIGINT}, #{fileId,jdbcType=BIGINT})
+ </insert>
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPr.PrBillOfMaterial" useGeneratedKeys="true">
+ <!--@mbg.generated-->
+ insert into pr_bill_of_material
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="nodeId != null">
+ node_id,
+ </if>
+ <if test="fileId != null">
+ file_id,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="nodeId != null">
+ #{nodeId,jdbcType=BIGINT},
+ </if>
+ <if test="fileId != null">
+ #{fileId,jdbcType=BIGINT},
+ </if>
+ </trim>
+ </insert>
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPr.PrBillOfMaterial">
+ <!--@mbg.generated-->
+ update pr_bill_of_material
+ <set>
+ <if test="nodeId != null">
+ node_id = #{nodeId,jdbcType=BIGINT},
+ </if>
+ <if test="fileId != null">
+ file_id = #{fileId,jdbcType=BIGINT},
+ </if>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+ <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPr.PrBillOfMaterial">
+ <!--@mbg.generated-->
+ update pr_bill_of_material
+ set node_id = #{nodeId,jdbcType=BIGINT},
+ file_id = #{fileId,jdbcType=BIGINT}
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+</mapper>
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml
index cd93f4c..67b5e16 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml
@@ -18,6 +18,8 @@
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<association property="instruction"
column="id" javaType="java.lang.Long" select="com.dy.pmsGlobal.daoPr.PrWorkingInstructionMapper.selectByNodeId" fetchType="eager" />
+ <association property="bill"
+ column="id" javaType="java.lang.Long" select="com.dy.pmsGlobal.daoPr.PrBillOfMaterialMapper.selectByNodeId" fetchType="eager" />
</resultMap>
<sql id="Base_Column_List">
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java
index 4f2a3b7..54ff76d 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java
@@ -3,18 +3,12 @@
import com.dy.common.webFilter.UserTokenContext;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pmsGlobal.daoOth.OthFileMapper;
-import com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper;
-import com.dy.pmsGlobal.daoPr.PrProductionNodeMapper;
-import com.dy.pmsGlobal.daoPr.PrProductionProcessMapper;
-import com.dy.pmsGlobal.daoPr.PrWorkingInstructionMapper;
+import com.dy.pmsGlobal.daoPr.*;
import com.dy.pmsGlobal.dyFile.FileOperate;
import com.dy.pmsGlobal.dyFile.FileRestVo;
import com.dy.pmsGlobal.pojoBa.BaUser;
import com.dy.pmsGlobal.pojoOth.OthFile;
-import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan;
-import com.dy.pmsGlobal.pojoPr.PrProductionNode;
-import com.dy.pmsGlobal.pojoPr.PrProductionProcess;
-import com.dy.pmsGlobal.pojoPr.PrWorkingInstruction;
+import com.dy.pmsGlobal.pojoPr.*;
import com.dy.pmsGlobal.util.UserUtil;
import com.dy.pmsProduct.taskPlan.PlanStatusEnum;
import lombok.extern.slf4j.Slf4j;
@@ -39,6 +33,7 @@
private PrProductionProcessMapper processDao;
private PrProductionNodeMapper nodeDao;
private PrWorkingInstructionMapper workDao;
+ private PrBillOfMaterialMapper billDao;
private UserUtil userUtil;
private FileOperate fileOperate;
private OthFileMapper othFileMapper;
@@ -78,6 +73,10 @@
@Autowired
public void setOthFileMapper(OthFileMapper othFileMapper) {
this.othFileMapper = othFileMapper;
+ }
+ @Autowired
+ public void setBillDao(PrBillOfMaterialMapper billDao) {
+ this.billDao = billDao;
}
@Transactional
@@ -164,7 +163,7 @@
}
});
if (startCount.get() != 1 || endCount.get() != 1) {
- throw new RuntimeException("鑺傜偣寮�濮嬪拰缁撴潫鑺傜偣鏈変笖鍙兘鏈変竴涓�");
+ throw new RuntimeException("寮�濮嬭妭鐐瑰拰缁撴潫鑺傜偣鏈変笖鍙兘鏈変竴涓�");
}
}
@@ -203,6 +202,17 @@
if (CollectionUtils.isNotEmpty(workList)) {
workDao.insertMany(workList);
}
+
+ List<PrBillOfMaterial> billList = process.nodes.stream().map(node -> {
+ if (node.bill != null) {
+ node.bill.nodeId = node.id;
+ return node.bill;
+ }
+ return null;
+ }).filter(bill -> bill != null).toList();
+ if (CollectionUtils.isNotEmpty(billList)) {
+ billDao.insertMany(billList);
+ }
}
public int delete(Long id) {
@@ -215,6 +225,9 @@
process.nodes.forEach(node -> {
if (node.instruction != null) {
addUrl(node.instruction);
+ }
+ if (node.bill != null) {
+ addBillUrl(node.bill);
}
});
}
@@ -238,6 +251,9 @@
if (node.instruction != null) {
addUrl(node.instruction);
}
+ if (node.bill != null) {
+ addBillUrl(node.bill);
+ }
});
});
return rsVo;
@@ -256,8 +272,22 @@
return;
}
FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
- ins.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + ins.fileId;
+ ins.webUrl = fileRestVo.fileWebDownloadPath + ins.fileId;
ins.orgName = file.orgName;
ins.extName = file.extName;
}
+
+ private void addBillUrl(PrBillOfMaterial bill) {
+ if (bill == null || bill.fileId == null) {
+ return;
+ }
+ OthFile file = othFileMapper.selectByPrimaryKey(bill.fileId);
+ if (file == null) {
+ return;
+ }
+ FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
+ bill.webUrl = fileRestVo.fileWebDownloadPath + bill.fileId;
+ bill.orgName = file.orgName;
+ bill.extName = file.extName;
+ }
}
diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
index c9071ae..860b7d3 100644
--- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
+++ b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
@@ -480,7 +480,7 @@
return;
}
FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
- doc.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + doc.fileId;
+ doc.webUrl = fileRestVo.fileWebDownloadPath + doc.fileId;
doc.orgName = file.orgName;
doc.extName = file.extName;
});
@@ -522,7 +522,7 @@
return;
}
FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
- ins.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + ins.fileId;
+ ins.webUrl = fileRestVo.fileWebDownloadPath + ins.fileId;
ins.orgName = file.orgName;
ins.extName = file.extName;
}
--
Gitblit v1.8.0