From eeee3d8fa04aff41db6ee2418468e7371ecad57d Mon Sep 17 00:00:00 2001
From: liuxm <liuxm_a@163.com>
Date: 星期二, 04 六月 2024 19:27:36 +0800
Subject: [PATCH] 生产计划部分修改
---
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java | 2 +
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java | 7 +++
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java | 25 ++++++++++--
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java | 12 +++++-
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsSv.java | 6 +++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrDevOpsPlanMapper.java | 1
pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml | 11 +++++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrAssemblyPlanMapper.java | 1
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrProductionProcessMapper.java | 4 +
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessCtrl.java | 4 +-
pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml | 8 ++++
pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml | 8 ++++
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml | 6 +++
13 files changed, 86 insertions(+), 9 deletions(-)
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java
index 330624a..c28b029 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java
@@ -23,4 +23,6 @@
List<PltProduct> selectAll(Map<String, Object> params);
String selectMaxCode();
+
+ boolean exists(String name, Long id);
}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrAssemblyPlanMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrAssemblyPlanMapper.java
index 9b6206e..a6c101c 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrAssemblyPlanMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrAssemblyPlanMapper.java
@@ -33,4 +33,5 @@
int deleteLogicById(Long id);
+ boolean exists(String name, Long id);
}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrDevOpsPlanMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrDevOpsPlanMapper.java
index 8acb980..d5f042f 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrDevOpsPlanMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrDevOpsPlanMapper.java
@@ -33,4 +33,5 @@
int deleteLogicById(Long id);
+ boolean exists(String name, Long id);
}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrProductionProcessMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrProductionProcessMapper.java
index 2fcc57f..321c4da 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrProductionProcessMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrProductionProcessMapper.java
@@ -31,5 +31,7 @@
int deleteLogicById(Long id);
@MapKey("id")
- List<Map<String,String>> queryAll();
+ List<Map<String,String>> queryAll(Long proId);
+
+ boolean exists(String name, Long id);
}
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
index f78eb0c..b67cae4 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
@@ -195,5 +195,11 @@
<select id="selectMaxCode" resultType="java.lang.String">
select max(code) from plt_product
</select>
+ <select id="exists" resultType="java.lang.Boolean">
+ select count(1) from plt_product where name = #{name}
+ <if test="id != null">
+ and id != #{id}
+ </if>
+ </select>
</mapper>
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
index 0660179..193996c 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
@@ -191,6 +191,14 @@
</if>
</trim>
</select>
+ <select id="exists" resultType="java.lang.Boolean">
+ select count(1) > 0
+ from pr_assembly_plan
+ where name = #{name,jdbcType=VARCHAR}
+ <if test="id != null">
+ and id != #{id,jdbcType=BIGINT}
+ </if>
+ </select>
<update id="deleteLogicById" parameterType="java.lang.Long">
update pr_assembly_plan set deleted = 1
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml
index 567af34..de4b2ea 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml
@@ -160,6 +160,14 @@
</if>
</trim>
</select>
+ <select id="exists" resultType="java.lang.Boolean">
+ select count(1) > 0
+ from pr_dev_ops_plan
+ where name = #{name,jdbcType=VARCHAR}
+ <if test="id != null">
+ and id != #{id,jdbcType=BIGINT}
+ </if>
+ </select>
<update id="deleteLogicById" parameterType="java.lang.Long">
update pr_dev_ops_plan set deleted = 1
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml
index a195aee..5dc10ae 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml
@@ -175,6 +175,17 @@
CAST(id AS CHAR) AS id,name
from pr_production_process
where deleted = 0
+ <trim prefix="and" suffixOverrides=",">
+ pro_id = #{proId,jdbcType=BIGINT}
+ </trim>
+ </select>
+ <select id="exists" resultType="java.lang.Boolean">
+ select count(1)
+ from pr_production_process
+ where name = #{name} and deleted = 0
+ <if test="id != null">
+ and id != #{id}
+ </if>
</select>
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
index 13089bc..84f5689 100644
--- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
@@ -76,6 +76,10 @@
@Transactional
public int save(PltProduct p) {
+ //鍒ゆ柇浜у搧涓嶈兘閲嶅悕
+ if (dao.exists(p.name, p.id)) {
+ throw new RuntimeException("浜у搧鍚嶇О閲嶅");
+ }
int flag=0;
do {
p.code = getNextCode();
@@ -110,6 +114,9 @@
@Transactional
public int update(PltProduct p) {
+ if (dao.exists(p.name, p.id)) {
+ throw new RuntimeException("浜у搧鍚嶇О閲嶅");
+ }
int count = dao.updateByPrimaryKeySelective(p);
//鍒犻櫎鏃ф暟鎹�,閲嶆柊鎻掑叆
pfDao.deleteByProId(p.id);
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessCtrl.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessCtrl.java
index f29263e..bafc03d 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessCtrl.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessCtrl.java
@@ -125,9 +125,9 @@
@GetMapping(path="queryAll")
@SsoPowerAop(power = "-1")
@Log("鏌ヨ鎵�鏈夌敓浜ф祦绋�")
- public BaseResponse<List<Map<String,String>>> queryAll(){
+ public BaseResponse<List<Map<String,String>>> queryAll(Long proId){
try {
- return BaseResponseUtils.buildSuccess(sv.queryAll());
+ return BaseResponseUtils.buildSuccess(sv.queryAll(proId));
}catch (Exception e){
log.error("鏌ヨ鎵�鏈夌敓浜ф祦绋嬪紓甯�", e);
return BaseResponseUtils.buildException(e.getMessage());
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 e7bed98..fa3c6c1 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
@@ -63,6 +63,10 @@
}
@Transactional
public int save(PrProductionProcess process){
+ //娴佺▼鍚嶇О涓嶈兘閲嶅
+ if (processDao.exists(process.name, process.id)) {
+ throw new RuntimeException("娴佺▼鍚嶇О涓嶈兘閲嶅");
+ }
prepareProcess(process);
int count = processDao.insertSelective(process);
saveNodesAndInstructions(process);
@@ -71,6 +75,10 @@
@Transactional
public int update(PrProductionProcess process){
+ //娴佺▼鍚嶇О涓嶈兘閲嶅
+ if (processDao.exists(process.name, process.id)) {
+ throw new RuntimeException("娴佺▼鍚嶇О涓嶈兘閲嶅");
+ }
prepareProcess(process);
int count = processDao.updateByPrimaryKeySelective(process);
// 浼樺寲锛氬彧鏈夊綋鑺傜偣鏈夊彉鏇存椂鎵嶅垹闄ゅ苟閲嶆柊鎻掑叆
@@ -159,8 +167,8 @@
return rsVo ;
}
- public List<Map<String,String>> queryAll(){
- return processDao.queryAll();
+ public List<Map<String,String>> queryAll(Long proId){
+ return processDao.queryAll(proId);
}
private void addUrl(PrWorkingInstruction ins){
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java
index c9f9598..252dff5 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java
@@ -8,11 +8,13 @@
import com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper;
import com.dy.pmsGlobal.daoPr.PrBatchNumberMapper;
import com.dy.pmsGlobal.daoPr.PrEquipMapper;
+import com.dy.pmsGlobal.daoPr.PrProductionProcessMapper;
import com.dy.pmsGlobal.pojoBa.BaUser;
import com.dy.pmsGlobal.pojoPlt.PltProduct;
import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan;
import com.dy.pmsGlobal.pojoPr.PrBatchNumber;
import com.dy.pmsGlobal.pojoPr.PrEquip;
+import com.dy.pmsGlobal.pojoPr.PrProductionProcess;
import com.dy.pmsGlobal.util.QrCodeUtil;
import com.dy.pmsGlobal.util.UserUtil;
import lombok.extern.slf4j.Slf4j;
@@ -38,7 +40,7 @@
private PrBatchNumberMapper batchDao;
private PrEquipMapper equipDao;
private PltProductMapper productDao;
- private SqlSessionFactory sqlSessionFactory;
+ private PrProductionProcessMapper processDao;
@Autowired
public void setAssemblyDao(PrAssemblyPlanMapper assemblyDao) {
this.assemblyDao = assemblyDao;
@@ -61,12 +63,20 @@
}
@Autowired
- public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
- this.sqlSessionFactory = sqlSessionFactory;
+ public void setProcessDao(PrProductionProcessMapper processDao) {
+ this.processDao = processDao;
}
@Transactional
public int save(PrAssemblyPlan plan){
+ //璁″垝鍚嶇О涓嶈兘閲嶅
+ if(assemblyDao.exists(plan.name,plan.id)){
+ throw new RuntimeException("璁″垝鍚嶇О涓嶈兘閲嶅");
+ }
+ PrProductionProcess process = processDao.selectByPrimaryKey(plan.processId);
+ if(process == null || process.proId != plan.proId){
+ throw new RuntimeException("浜у搧涓庣敓浜ф祦绋嬩笉鍖归厤");
+ }
PrBatchNumber batch = new PrBatchNumber();
batch.batchNumber = getNextCode();
batch.proId = plan.proId;
@@ -87,10 +97,17 @@
@Transactional
public int update(PrAssemblyPlan plan){
+ //璁″垝鍚嶇О涓嶈兘閲嶅
+ if(assemblyDao.exists(plan.name,plan.id)){
+ throw new RuntimeException("璁″垝鍚嶇О涓嶈兘閲嶅");
+ }
PrAssemblyPlan origPlan = assemblyDao.selectByPrimaryKey(plan.id);
PrBatchNumber batch = batchDao.selectByPrimaryKey(origPlan.batchId);
//浜у搧鏀瑰彉鍒欐洿鏂板叏閮ㄥ凡鐢熸垚璁惧鍙�
if(origPlan.proId != plan.proId){
+ batch.proId = plan.proId;
+ batchDao.updateByPrimaryKeySelective(batch);
+
equipDao.deleteByBatchId(origPlan.batchId);
insertEquip(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,1);
}else if(origPlan.number < plan.number){
@@ -107,7 +124,7 @@
PrBatchNumber batch = batchDao.selectByPrimaryKey(plan.batchId);
int count =insertEquip(plan.proId,plan.batchId,batch.batchNumber,num + plan.number,plan.number+1);
plan.number = plan.number + num;
- assemblyDao.updateByPrimaryKeySelective(plan);
+ assemblyDao.updateByPrimaryKeySelective (plan);
return count;
}
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsSv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsSv.java
index 23846b8..47cfefb 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsSv.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsSv.java
@@ -35,6 +35,9 @@
@Transactional
public int save(PrDevOpsPlan plan) {
+ if(devOpsDao.exists(plan.name,plan.id)){
+ throw new RuntimeException("璁″垝鍚嶄笉鑳介噸澶�");
+ }
BaUser loginUser = userUtil.getUser(UserTokenContext.get());
if(loginUser!=null){
plan.creator = loginUser.id;
@@ -44,6 +47,9 @@
}
@Transactional
public int update(PrDevOpsPlan plan) {
+ if(devOpsDao.exists(plan.name,plan.id)){
+ throw new RuntimeException("璁″垝鍚嶄笉鑳介噸澶�");
+ }
return devOpsDao.updateByPrimaryKeySelective(plan);
}
public QueryResultVo<List<PrDevOpsPlan>> selectSome(QueryVo queryVo) {
--
Gitblit v1.8.0