在删除工艺路线时同时删除对应的工序、产品、BOM配置。
This commit is contained in:
parent
1171380bfc
commit
e0576e3514
@ -5,8 +5,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import com.ktg.common.constant.UserConstants;
|
import com.ktg.common.constant.UserConstants;
|
||||||
import com.ktg.common.utils.StringUtils;
|
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.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
@ -37,6 +41,15 @@ public class ProRouteController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IProRouteService proRouteService;
|
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')")
|
@PreAuthorize("@ss.hasPermi('mes:pro:proroute:remove')")
|
||||||
@Log(title = "工艺路线", businessType = BusinessType.DELETE)
|
@Log(title = "工艺路线", businessType = BusinessType.DELETE)
|
||||||
|
@Transactional
|
||||||
@DeleteMapping("/{routeIds}")
|
@DeleteMapping("/{routeIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] 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));
|
return toAjax(proRouteService.deleteProRouteByRouteIds(routeIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.ktg.common.constant.UserConstants;
|
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.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
@ -37,6 +40,9 @@ public class ProRouteProductController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IProRouteProductService proRouteProductService;
|
private IProRouteProductService proRouteProductService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IProRouteProductBomService proRouteProductBomService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询产品制程列表
|
* 查询产品制程列表
|
||||||
*/
|
*/
|
||||||
@ -127,9 +133,19 @@ public class ProRouteProductController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('mes:pro:routeproduct:remove')")
|
@PreAuthorize("@ss.hasPermi('mes:pro:routeproduct:remove')")
|
||||||
@Log(title = "产品制程", businessType = BusinessType.DELETE)
|
@Log(title = "产品制程", businessType = BusinessType.DELETE)
|
||||||
|
@Transactional
|
||||||
@DeleteMapping("/{recordIds}")
|
@DeleteMapping("/{recordIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] 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));
|
return toAjax(proRouteProductService.deleteProRouteProductByRecordIds(recordIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,4 +65,11 @@ public interface ProRouteProcessMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteProRouteProcessByRecordIds(Long[] recordIds);
|
public int deleteProRouteProcessByRecordIds(Long[] recordIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据工艺路线ID删除所有工序配置
|
||||||
|
* @param routeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int deleteByRouteId(Long routeId);
|
||||||
}
|
}
|
||||||
|
@ -66,4 +66,18 @@ public interface ProRouteProductBomMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteProRouteProductBomByRecordIds(Long[] recordIds);
|
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);
|
||||||
}
|
}
|
||||||
|
@ -60,4 +60,11 @@ public interface ProRouteProductMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteProRouteProductByRecordIds(Long[] recordIds);
|
public int deleteProRouteProductByRecordIds(Long[] recordIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据工艺路线ID删除对应的产品配置
|
||||||
|
* @param routeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int deleteByRouteId(Long routeId);
|
||||||
}
|
}
|
||||||
|
@ -86,4 +86,11 @@ public interface IProRouteProcessService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteProRouteProcessByRecordId(Long recordId);
|
public int deleteProRouteProcessByRecordId(Long recordId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据工艺路线ID删除所有工序配置
|
||||||
|
* @param routeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int deleteByRouteId(Long routeId);
|
||||||
}
|
}
|
||||||
|
@ -66,4 +66,18 @@ public interface IProRouteProductBomService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteProRouteProductBomByRecordId(Long recordId);
|
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);
|
||||||
}
|
}
|
||||||
|
@ -65,4 +65,11 @@ public interface IProRouteProductService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteProRouteProductByRecordId(Long recordId);
|
public int deleteProRouteProductByRecordId(Long recordId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据工艺路线ID删除对应的产品配置
|
||||||
|
* @param routeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int deleteByRouteId(Long routeId);
|
||||||
}
|
}
|
||||||
|
@ -126,4 +126,9 @@ public class ProRouteProcessServiceImpl implements IProRouteProcessService
|
|||||||
{
|
{
|
||||||
return proRouteProcessMapper.deleteProRouteProcessByRecordId(recordId);
|
return proRouteProcessMapper.deleteProRouteProcessByRecordId(recordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteByRouteId(Long routeId) {
|
||||||
|
return proRouteProcessMapper.deleteByRouteId(routeId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,4 +106,14 @@ public class ProRouteProductBomServiceImpl implements IProRouteProductBomService
|
|||||||
{
|
{
|
||||||
return proRouteProductBomMapper.deleteProRouteProductBomByRecordId(recordId);
|
return proRouteProductBomMapper.deleteProRouteProductBomByRecordId(recordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteByRouteId(Long routeId) {
|
||||||
|
return proRouteProductBomMapper.deleteByRouteId(routeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteByRouteIdAndProductId(ProRouteProductBom proRouteProductBom) {
|
||||||
|
return proRouteProductBomMapper.deleteByRouteIdAndProductId(proRouteProductBom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,4 +106,9 @@ public class ProRouteProductServiceImpl implements IProRouteProductService
|
|||||||
{
|
{
|
||||||
return proRouteProductMapper.deleteProRouteProductByRecordId(recordId);
|
return proRouteProductMapper.deleteProRouteProductByRecordId(recordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteByRouteId(Long routeId) {
|
||||||
|
return proRouteProductMapper.deleteByRouteId(routeId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,4 +188,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{recordId}
|
#{recordId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteByRouteId" parameterType="Long">
|
||||||
|
delete from pro_route_process where route_id = #{routeId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -136,4 +136,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{recordId}
|
#{recordId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</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>
|
</mapper>
|
@ -135,4 +135,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{recordId}
|
#{recordId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteByRouteId" parameterType="Long">
|
||||||
|
delete from pro_route_product where route_id = #{routeId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user