|
@@ -27,6 +27,7 @@ import com.github.zuihou.business.productionReadyCenter.dao.CuttingToolMapper;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.*;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.BomProcedureProductionresourceService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.BomProcedureToolService;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.service.CuttingToolService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.MachineCuttingToolService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.CutterCategoriesService;
|
|
@@ -51,6 +52,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.github.zuihou.common.constant.CacheKey.TENANT;
|
|
|
import static com.github.zuihou.utils.BizAssert.isFalse;
|
|
|
+import static java.util.stream.Collectors.groupingBy;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -105,6 +107,9 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
|
|
|
@Autowired
|
|
|
private ProductionresourceBizService productionresourceBizService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CuttingToolService cuttingToolService;
|
|
|
+
|
|
|
//默认机床刀位数
|
|
|
private final int DEVICE_CUTTER_POSITION = 40;
|
|
|
|
|
@@ -195,6 +200,7 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
|
|
|
|
|
|
List<ToolCheckDTO> returnList=new ArrayList<>();
|
|
|
|
|
|
+
|
|
|
planIds.stream().forEach(item ->{
|
|
|
PlanProduct planProduct = planProductMapper.selectOne(Wraps.<PlanProduct>lbQ().eq(PlanProduct::getPlanId, item));
|
|
|
Long bomId=planProduct.getBomId();
|
|
@@ -205,6 +211,7 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
|
|
|
.eq(BomVersionInfo::getBomId,bomId));
|
|
|
if(Objects.isNull(bomVersionInfo)){
|
|
|
ToolCheckDTO toolCheckDTO=new ToolCheckDTO();
|
|
|
+ toolCheckDTO.setIsNoCutter(0);
|
|
|
toolCheckDTO.setName(bBom.getName());
|
|
|
toolCheckDTO.setHasCuttingToolsFlag("否");
|
|
|
toolCheckDTO.setIsTask("否");
|
|
@@ -247,6 +254,7 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
|
|
|
if(needToolList.isEmpty()|| needToolList.size()<=0){
|
|
|
log.info("刀具校验:未配置工艺刀具");
|
|
|
ToolCheckDTO toolCheckDTO=new ToolCheckDTO();
|
|
|
+ toolCheckDTO.setIsNoCutter(0);
|
|
|
toolCheckDTO.setName(bBom.getName());
|
|
|
toolCheckDTO.setHasCuttingToolsFlag("否");
|
|
|
toolCheckDTO.setIsTask("否");
|
|
@@ -258,6 +266,58 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
|
|
|
//List<Long> resourceId = resourceList.stream().map(BomProcedureProductionresource::getResourceId).collect(Collectors.toList());
|
|
|
|
|
|
List<CutterCategories> finalNeedToolList = needToolList;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 刀具不在产线,需要发送刀具需求
|
|
|
+ HashMap<String, CutterCategories> noCuttersHashMap = new HashMap();
|
|
|
+ resourceList.stream().forEach(vo->{
|
|
|
+ List<CutterCategories> needCutterCategories = new ArrayList<>();
|
|
|
+ // 需求的刀具数据
|
|
|
+ Map<String, List<CutterCategories>> collect = finalNeedToolList.stream().collect(groupingBy(CutterCategories::getCutterT));
|
|
|
+ //机床现有刀具集合
|
|
|
+ Productionresource productionresource = productionresourceBizService.getById(vo.getResourceId());
|
|
|
+ //判断是否机床
|
|
|
+ if(StringUtils.isEmpty(productionresource.getModeSpecification())){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> realToolId = machineCuttingToolService.list(new LbqWrapper<MachineCuttingTool>().eq(MachineCuttingTool::getMachineId, vo.getResourceId())).stream().map(obj->obj.getCuttingToolId()).collect(Collectors.toList());
|
|
|
+ // 查询刀架有的刀
|
|
|
+ List<CuttingTool> cutterInStorgeInfo = cuttingToolService.getCutterInStorgeInfo();
|
|
|
+ if(cutterInStorgeInfo!=null && !cutterInStorgeInfo.isEmpty()){
|
|
|
+ List<String> collect1 = cutterInStorgeInfo.stream().map(CuttingTool::getCuttingToolNo).map(Object::toString).collect(Collectors.toList());
|
|
|
+ realToolId.addAll(collect1);
|
|
|
+ }
|
|
|
+ // 比对是否有缺失的数据
|
|
|
+ collect.forEach((s, cutterCategories) -> {
|
|
|
+ if(!realToolId.contains(s)){
|
|
|
+ needCutterCategories.add(cutterCategories.get(0));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if(needCutterCategories.isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<String> cutterTs = needCutterCategories.stream().map(CutterCategories::getCutterT).collect(Collectors.toList());
|
|
|
+
|
|
|
+ ToolCheckDTO toolCheckDTO =new ToolCheckDTO();
|
|
|
+ toolCheckDTO.setIsNoCutter(1);
|
|
|
+ toolCheckDTO.setIsTask(needCutterCategories.size()>0?"是":"否");
|
|
|
+ toolCheckDTO.setNumber(needCutterCategories.size());
|
|
|
+ toolCheckDTO.setId(vo.getResourceId());
|
|
|
+ toolCheckDTO.setDeviceName(vo.getName());
|
|
|
+ toolCheckDTO.setName(bBom.getName());
|
|
|
+ toolCheckDTO.setList(cutterTs);
|
|
|
+ toolCheckDTO.setHasCuttingToolsFlag(CollectionUtil.isEmpty(cutterTs) ? "是" : "否" );
|
|
|
+ toolCheckDTO.setMsg(CollectionUtil.isNotEmpty(cutterTs) ?
|
|
|
+ "缺少:"+needCutterCategories.stream().map(obj->obj.getCutterName()).collect(Collectors.joining(",")):"校验成功" );
|
|
|
+ toolCheckDTO.setPlanId(item);
|
|
|
+ returnList.add(toolCheckDTO);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ // 刀具在产线,但没有在机床
|
|
|
resourceList.stream().forEach(vo->{
|
|
|
ToolCheckDTO toolCheckDTO=new ToolCheckDTO();
|
|
|
|
|
@@ -300,6 +360,8 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
|
|
|
//true 机床刀库空闲个数大于缺刀个数
|
|
|
Boolean isFree=freeCount > lackTools.size();
|
|
|
//ToolTask findToolTask = toolTaskMapper.selectOne(Wraps.<ToolTask>lbQ().eq(ToolTask::getPlanId, item));
|
|
|
+
|
|
|
+ toolCheckDTO.setIsNoCutter(0);
|
|
|
toolCheckDTO.setIsTask(lackTools.size()>0?"是":"否");
|
|
|
toolCheckDTO.setId(vo.getResourceId());
|
|
|
toolCheckDTO.setDeviceName(vo.getName());
|