在删除工艺路线时同时删除对应的工序、产品、BOM配置。

This commit is contained in:
JinLu.Yin 2022-09-12 22:06:48 +08:00
parent 1171380bfc
commit e0576e3514
14 changed files with 130 additions and 0 deletions

View File

@ -5,8 +5,12 @@ import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.pro.service.IProRouteProcessService;
import com.ktg.mes.pro.service.IProRouteProductBomService;
import com.ktg.mes.pro.service.IProRouteProductService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -37,6 +41,15 @@ public class ProRouteController extends BaseController
@Autowired
private IProRouteService proRouteService;
@Autowired
private IProRouteProcessService proRouteProcessService;
@Autowired
private IProRouteProductService proRouteProductService;
@Autowired
private IProRouteProductBomService proRouteProductBomService;
/**
* 查询工艺路线列表
*/
@ -105,9 +118,16 @@ public class ProRouteController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')")
@Log(title = "工艺路线", businessType = BusinessType.DELETE)
@Transactional
@DeleteMapping("/{routeIds}")
public AjaxResult remove(@PathVariable Long[] routeIds)
{
for (Long routeId:routeIds
) {
proRouteProcessService.deleteByRouteId(routeId);
proRouteProductService.deleteByRouteId(routeId);
proRouteProductBomService.deleteByRouteId(routeId);
}
return toAjax(proRouteService.deleteProRouteByRouteIds(routeIds));
}
}

View File

@ -5,8 +5,11 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.pro.domain.ProRouteProductBom;
import com.ktg.mes.pro.service.IProRouteProductBomService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -37,6 +40,9 @@ public class ProRouteProductController extends BaseController
@Autowired
private IProRouteProductService proRouteProductService;
@Autowired
private IProRouteProductBomService proRouteProductBomService;
/**
* 查询产品制程列表
*/
@ -127,9 +133,19 @@ public class ProRouteProductController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('mes:pro:routeproduct:remove')")
@Log(title = "产品制程", businessType = BusinessType.DELETE)
@Transactional
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable Long[] recordIds)
{
for (Long recordId:recordIds
) {
ProRouteProduct product = proRouteProductService.selectProRouteProductByRecordId(recordId);
ProRouteProductBom bom = new ProRouteProductBom();
bom.setRouteId(product.getRouteId());
bom.setProductId(product.getItemId());
proRouteProductBomService.deleteByRouteIdAndProductId(bom);
}
return toAjax(proRouteProductService.deleteProRouteProductByRecordIds(recordIds));
}
}

View File

@ -65,4 +65,11 @@ public interface ProRouteProcessMapper
* @return 结果
*/
public int deleteProRouteProcessByRecordIds(Long[] recordIds);
/**
* 根据工艺路线ID删除所有工序配置
* @param routeId
* @return
*/
public int deleteByRouteId(Long routeId);
}

View File

@ -66,4 +66,18 @@ public interface ProRouteProductBomMapper
* @return 结果
*/
public int deleteProRouteProductBomByRecordIds(Long[] recordIds);
/**
* 根据工艺路线ID删除所有产品BOM设置
* @param routeId
* @return
*/
public int deleteByRouteId(Long routeId);
/**
* 根据工艺路线ID和产品ID删除BOM设置
* @param proRouteProductBom
* @return
*/
public int deleteByRouteIdAndProductId(ProRouteProductBom proRouteProductBom);
}

View File

@ -60,4 +60,11 @@ public interface ProRouteProductMapper
* @return 结果
*/
public int deleteProRouteProductByRecordIds(Long[] recordIds);
/**
* 根据工艺路线ID删除对应的产品配置
* @param routeId
* @return
*/
public int deleteByRouteId(Long routeId);
}

View File

@ -86,4 +86,11 @@ public interface IProRouteProcessService
* @return 结果
*/
public int deleteProRouteProcessByRecordId(Long recordId);
/**
* 根据工艺路线ID删除所有工序配置
* @param routeId
* @return
*/
public int deleteByRouteId(Long routeId);
}

View File

@ -66,4 +66,18 @@ public interface IProRouteProductBomService
* @return 结果
*/
public int deleteProRouteProductBomByRecordId(Long recordId);
/**
* 根据工艺路线ID删除所有产品BOM设置
* @param routeId
* @return
*/
public int deleteByRouteId(Long routeId);
/**
* 根据工艺路线ID和产品ID删除BOM设置
* @param proRouteProductBom
* @return
*/
public int deleteByRouteIdAndProductId(ProRouteProductBom proRouteProductBom);
}

View File

@ -65,4 +65,11 @@ public interface IProRouteProductService
* @return 结果
*/
public int deleteProRouteProductByRecordId(Long recordId);
/**
* 根据工艺路线ID删除对应的产品配置
* @param routeId
* @return
*/
public int deleteByRouteId(Long routeId);
}

View File

@ -126,4 +126,9 @@ public class ProRouteProcessServiceImpl implements IProRouteProcessService
{
return proRouteProcessMapper.deleteProRouteProcessByRecordId(recordId);
}
@Override
public int deleteByRouteId(Long routeId) {
return proRouteProcessMapper.deleteByRouteId(routeId);
}
}

View File

@ -106,4 +106,14 @@ public class ProRouteProductBomServiceImpl implements IProRouteProductBomService
{
return proRouteProductBomMapper.deleteProRouteProductBomByRecordId(recordId);
}
@Override
public int deleteByRouteId(Long routeId) {
return proRouteProductBomMapper.deleteByRouteId(routeId);
}
@Override
public int deleteByRouteIdAndProductId(ProRouteProductBom proRouteProductBom) {
return proRouteProductBomMapper.deleteByRouteIdAndProductId(proRouteProductBom);
}
}

View File

@ -106,4 +106,9 @@ public class ProRouteProductServiceImpl implements IProRouteProductService
{
return proRouteProductMapper.deleteProRouteProductByRecordId(recordId);
}
@Override
public int deleteByRouteId(Long routeId) {
return proRouteProductMapper.deleteByRouteId(routeId);
}
}

View File

@ -188,4 +188,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{recordId}
</foreach>
</delete>
<delete id="deleteByRouteId" parameterType="Long">
delete from pro_route_process where route_id = #{routeId}
</delete>
</mapper>

View File

@ -136,4 +136,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{recordId}
</foreach>
</delete>
<delete id="deleteByRouteId" parameterType="Long">
delete from pro_route_product_bom where route_id = #{routeId}
</delete>
<delete id="deleteByRouteIdAndProductId" parameterType="ProRouteProductBom">
delete from pro_route_product_bom where route_id = #{routeId} and product_id = #{productId}
</delete>
</mapper>

View File

@ -135,4 +135,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{recordId}
</foreach>
</delete>
<delete id="deleteByRouteId" parameterType="Long">
delete from pro_route_product where route_id = #{routeId}
</delete>
</mapper>