|
@@ -2,11 +2,14 @@ package com.management.platform.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.management.platform.entity.PlanMaterial;
|
|
|
import com.management.platform.entity.ProdMaterial;
|
|
|
import com.management.platform.entity.ProdMaterial;
|
|
|
import com.management.platform.entity.User;
|
|
|
+import com.management.platform.mapper.PlanMaterialMapper;
|
|
|
import com.management.platform.mapper.ProdMaterialMapper;
|
|
|
import com.management.platform.mapper.UserMapper;
|
|
|
+import com.management.platform.service.PlanMaterialService;
|
|
|
import com.management.platform.service.ProdMaterialService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
@@ -32,6 +35,11 @@ public class ProdMaterialServiceImpl extends ServiceImpl<ProdMaterialMapper, Pro
|
|
|
private ProdMaterialMapper prodMaterialMapper;
|
|
|
@Resource
|
|
|
private UserMapper userMapper;
|
|
|
+ @Resource
|
|
|
+ private PlanMaterialMapper planMaterialMapper;
|
|
|
+ @Resource
|
|
|
+ private PlanMaterialService planMaterialService;
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg getVersion(HttpServletRequest request, Integer productId) {
|
|
|
HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
@@ -65,7 +73,6 @@ public class ProdMaterialServiceImpl extends ServiceImpl<ProdMaterialMapper, Pro
|
|
|
@Override
|
|
|
public HttpRespMsg isDelete(HttpServletRequest request, Integer id) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- //TODO: 检查物料是否已经被使用,被使用的不能删除
|
|
|
boolean flag=true;
|
|
|
msg.setData(flag);
|
|
|
return msg;
|
|
@@ -86,7 +93,7 @@ public class ProdMaterialServiceImpl extends ServiceImpl<ProdMaterialMapper, Pro
|
|
|
});
|
|
|
|
|
|
|
|
|
- //1.获取原有的工序id
|
|
|
+ //1.获取原有的物料id
|
|
|
List<ProdMaterial> oldList = prodMaterialMapper.selectList(new LambdaQueryWrapper<ProdMaterial>()
|
|
|
.eq(user.getCompanyId() != null, ProdMaterial::getCompanyId, user.getCompanyId())
|
|
|
.eq(productId != null, ProdMaterial::getProductId, productId)
|
|
@@ -95,7 +102,7 @@ public class ProdMaterialServiceImpl extends ServiceImpl<ProdMaterialMapper, Pro
|
|
|
);
|
|
|
|
|
|
if(oldList!=null&&oldList.size()>0){
|
|
|
- //2.要删除的id
|
|
|
+ //2.要删除物料的id
|
|
|
List<ProdMaterial> deleteList = oldList.stream().filter(old -> {
|
|
|
for (ProdMaterial prodMaterial : prodMaterialList) {
|
|
|
if (prodMaterial.getId() == old.getId()) {
|