|
|
|
@ -49,6 +49,8 @@ import org.springblade.desk.dashboard.pojo.dto.DsTaskingDTO; |
|
|
|
import org.springblade.desk.dashboard.pojo.entity.*; |
|
|
|
import org.springblade.desk.dashboard.pojo.entity.*; |
|
|
|
import org.springblade.desk.dashboard.pojo.vo.*; |
|
|
|
import org.springblade.desk.dashboard.pojo.vo.*; |
|
|
|
import org.springblade.desk.dashboard.service.*; |
|
|
|
import org.springblade.desk.dashboard.service.*; |
|
|
|
|
|
|
|
import org.springblade.desk.device.pojo.entity.MeasurementRecordsEntity; |
|
|
|
|
|
|
|
import org.springblade.desk.device.service.IMeasurementRecordsService; |
|
|
|
import org.springblade.desk.logistics.pojo.vo.TaskVO; |
|
|
|
import org.springblade.desk.logistics.pojo.vo.TaskVO; |
|
|
|
import org.springblade.desk.order.pojo.entity.MoldDemand; |
|
|
|
import org.springblade.desk.order.pojo.entity.MoldDemand; |
|
|
|
import org.springblade.desk.order.pojo.entity.YieldOrder; |
|
|
|
import org.springblade.desk.order.pojo.entity.YieldOrder; |
|
|
|
@ -60,6 +62,7 @@ import org.springblade.desk.quality.pojo.dto.PpmReportDetailDTO; |
|
|
|
import org.springblade.desk.quality.pojo.request.ReviewSheetErpSearch; |
|
|
|
import org.springblade.desk.quality.pojo.request.ReviewSheetErpSearch; |
|
|
|
import org.springblade.desk.quality.service.IReviewSheetService; |
|
|
|
import org.springblade.desk.quality.service.IReviewSheetService; |
|
|
|
import org.springblade.erpdata.feign.IErpDataReworkTaskClient; |
|
|
|
import org.springblade.erpdata.feign.IErpDataReworkTaskClient; |
|
|
|
|
|
|
|
import org.springblade.scheduling.pojo.entity.PartRelationEntity; |
|
|
|
import org.springblade.scheduling.pojo.entity.WorkOrderEntity; |
|
|
|
import org.springblade.scheduling.pojo.entity.WorkOrderEntity; |
|
|
|
import org.springblade.scheduling.pojo.entity.WorkPlanEntity; |
|
|
|
import org.springblade.scheduling.pojo.entity.WorkPlanEntity; |
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
@ -171,6 +174,9 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
ILocallyPlatedPartService locallyPlatedPartService; |
|
|
|
ILocallyPlatedPartService locallyPlatedPartService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
IMeasurementRecordsService measurementRecordsService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IPage<DsTaskingVO> selectAssignList(IPage<DsTaskingVO> page, DsTaskingVO dsTasking) { |
|
|
|
public IPage<DsTaskingVO> selectAssignList(IPage<DsTaskingVO> page, DsTaskingVO dsTasking) { |
|
|
|
List<DsTaskingVO> dsTaskingVOS = baseMapper.selectDsTaskingPage(page, dsTasking); |
|
|
|
List<DsTaskingVO> dsTaskingVOS = baseMapper.selectDsTaskingPage(page, dsTasking); |
|
|
|
@ -1892,7 +1898,6 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
* 递归处理零件及其子件 |
|
|
|
* 递归处理零件及其子件 |
|
|
|
* 核心逻辑:处理基础信息 -> 生成版本号 -> 创建新零件 -> 创建版本记录 -> 同步工艺 -> 处理子件 |
|
|
|
* 核心逻辑:处理基础信息 -> 生成版本号 -> 创建新零件 -> 创建版本记录 -> 同步工艺 -> 处理子件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
// 同时补充修正 processPartRecursively 中对空数据的兼容逻辑
|
|
|
|
|
|
|
|
private DsPartEntity processPartRecursively(DsPartEntity oldMesPart) { |
|
|
|
private DsPartEntity processPartRecursively(DsPartEntity oldMesPart) { |
|
|
|
String partCode = oldMesPart.getPartCode(); |
|
|
|
String partCode = oldMesPart.getPartCode(); |
|
|
|
Long oldMesPartId = oldMesPart.getId(); |
|
|
|
Long oldMesPartId = oldMesPart.getId(); |
|
|
|
@ -1906,7 +1911,8 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 2. 生成新版本号(线程安全)
|
|
|
|
// 2. 生成新版本号(线程安全)
|
|
|
|
String newVersion = generateNewVersion(partCode); |
|
|
|
// String newVersion = generateNewVersion(partCode);
|
|
|
|
|
|
|
|
String newVersion = "1"; |
|
|
|
log.info("零件 {} 生成新版本号:{}", partCode, newVersion); |
|
|
|
log.info("零件 {} 生成新版本号:{}", partCode, newVersion); |
|
|
|
|
|
|
|
|
|
|
|
// 3. 创建新零件(兼容空数据)
|
|
|
|
// 3. 创建新零件(兼容空数据)
|
|
|
|
@ -1954,6 +1960,10 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
for (DsPartSub subPartInfo : subPartList) { |
|
|
|
for (DsPartSub subPartInfo : subPartList) { |
|
|
|
String subCode = subPartInfo.getSubCode(); |
|
|
|
String subCode = subPartInfo.getSubCode(); |
|
|
|
log.info("开始处理子件:{}", subCode); |
|
|
|
log.info("开始处理子件:{}", subCode); |
|
|
|
|
|
|
|
PartRelationEntity partRelation = partRelationService.selectByPartCodeAndSubCode(parentPartCode,subCode); |
|
|
|
|
|
|
|
if(null != partRelation){ |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
// 1. 处理子件数据进行赋值
|
|
|
|
// 1. 处理子件数据进行赋值
|
|
|
|
@ -1990,7 +2000,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
|
|
|
|
|
|
|
|
// 3. 建立父子关联关系
|
|
|
|
// 3. 建立父子关联关系
|
|
|
|
if (!createPartRelation(parentNewPart.getId(), parentNewPart.getPartCode(), |
|
|
|
if (!createPartRelation(parentNewPart.getId(), parentNewPart.getPartCode(), |
|
|
|
newSubPart.getId(), newSubPart.getPartCode())) { |
|
|
|
newSubPart.getId(), newSubPart.getPartCode(),subPartInfo.getQuota())) { |
|
|
|
log.error("建立父子关联关系失败:父{},子{},跳过该子件关联", parentNewPart.getPartCode(), subCode); |
|
|
|
log.error("建立父子关联关系失败:父{},子{},跳过该子件关联", parentNewPart.getPartCode(), subCode); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2028,6 +2038,11 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
log.info("零件 {} 有 {} 个工艺待同步", newPart.getPartCode(), oldCraftList.size()); |
|
|
|
log.info("零件 {} 有 {} 个工艺待同步", newPart.getPartCode(), oldCraftList.size()); |
|
|
|
|
|
|
|
|
|
|
|
for (DsCraftEntity oldCraft : oldCraftList) { |
|
|
|
for (DsCraftEntity oldCraft : oldCraftList) { |
|
|
|
|
|
|
|
DsCraftEntity partCraft = craftService.getPartCraft(newPart.getId(), oldCraft.getRank(),oldCraft.getRoamNo()); |
|
|
|
|
|
|
|
if(null != partCraft){ |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Long oldMesCraftId = oldCraft.getId(); |
|
|
|
Long oldMesCraftId = oldCraft.getId(); |
|
|
|
// 重置工艺ID 不使用老mesID
|
|
|
|
// 重置工艺ID 不使用老mesID
|
|
|
|
oldCraft.setId(null); |
|
|
|
oldCraft.setId(null); |
|
|
|
@ -2083,6 +2098,9 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
processMeasuringToolList.forEach(item -> { |
|
|
|
processMeasuringToolList.forEach(item -> { |
|
|
|
item.setId(null); |
|
|
|
item.setId(null); |
|
|
|
item.setProcessId(dsProcessEntity.getId()); |
|
|
|
item.setProcessId(dsProcessEntity.getId()); |
|
|
|
|
|
|
|
MeasurementRecordsEntity measurementRecords = measurementRecordsService.getById(item.getMtId()); |
|
|
|
|
|
|
|
item.setToolInfo(measurementRecords.getMcName()); |
|
|
|
|
|
|
|
item.setToolSize(measurementRecords.getNorms()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
if(!CollectionUtils.isEmpty(processMeasuringToolList)){ |
|
|
|
if(!CollectionUtils.isEmpty(processMeasuringToolList)){ |
|
|
|
boolean measuringToolSaveBatch = processMeasuringToolService.saveBatch(processMeasuringToolList); |
|
|
|
boolean measuringToolSaveBatch = processMeasuringToolService.saveBatch(processMeasuringToolList); |
|
|
|
@ -2151,52 +2169,83 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
* 创建新零件 |
|
|
|
* 创建新零件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private DsPartEntity createNewPart(DsPartEntity oldMesPart, String newVersion) { |
|
|
|
private DsPartEntity createNewPart(DsPartEntity oldMesPart, String newVersion) { |
|
|
|
try { |
|
|
|
// 1. 根据零件编码 + 新版本号查询是否已存在
|
|
|
|
Long oldId = oldMesPart.getId(); |
|
|
|
DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(oldMesPart.getPartCode(), newVersion); |
|
|
|
oldMesPart.setId(null); |
|
|
|
|
|
|
|
boolean saved = partService.save(oldMesPart); |
|
|
|
|
|
|
|
if (!saved) { |
|
|
|
|
|
|
|
log.error("零件新增失败:{}", oldMesPart.getPartCode()); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DsPartEntity newPart = partService.getById(oldMesPart.getId()); |
|
|
|
if (null == partEntity) { |
|
|
|
log.info("零件新增成功,oldId:{} -> newId:{}", oldId, newPart.getId()); |
|
|
|
try { |
|
|
|
|
|
|
|
//查询老mes零件
|
|
|
|
|
|
|
|
List<DsPartEntity> dsPartEntityList = taskingMapper.getOldMesAllPart(null,null,Arrays.asList(oldMesPart.getPartCode())); |
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(dsPartEntityList)){ |
|
|
|
|
|
|
|
DsPartEntity oldMesPartEntity = dsPartEntityList.get(0); |
|
|
|
|
|
|
|
Long oldId = oldMesPartEntity.getId(); |
|
|
|
|
|
|
|
oldMesPartEntity.setId(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean saved = partService.save(oldMesPartEntity); |
|
|
|
|
|
|
|
if (!saved) { |
|
|
|
|
|
|
|
log.error("零件新增失败:{}", oldMesPartEntity.getPartCode()); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return newPart; |
|
|
|
DsPartEntity newPart = partService.getById(oldMesPartEntity.getId()); |
|
|
|
} catch (Exception e) { |
|
|
|
log.info("零件新增成功,oldId:{} -> newId:{}", oldId, oldMesPartEntity.getId()); |
|
|
|
log.error("创建新零件异常:{}", oldMesPart.getPartCode(), e); |
|
|
|
return newPart; |
|
|
|
return null; |
|
|
|
}else { |
|
|
|
|
|
|
|
Long oldId = oldMesPart.getId(); |
|
|
|
|
|
|
|
oldMesPart.setId(null); |
|
|
|
|
|
|
|
boolean saved = partService.save(oldMesPart); |
|
|
|
|
|
|
|
if (!saved) { |
|
|
|
|
|
|
|
log.error("零件新增失败:{}", oldMesPart.getPartCode()); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DsPartEntity newPart = partService.getById(oldMesPart.getId()); |
|
|
|
|
|
|
|
log.info("零件新增成功,oldId:{} -> newId:{}", oldId, oldMesPart.getId()); |
|
|
|
|
|
|
|
return newPart; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("创建新零件异常:{}", oldMesPart.getPartCode(), e); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return partEntity; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 创建版本号记录 |
|
|
|
* 创建版本号记录 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean createPartVersion(Long partId, String partCode, String version) { |
|
|
|
private boolean createPartVersion(Long partId, String partCode, String version) { |
|
|
|
try { |
|
|
|
// 1. 根据零件编码 + 新版本号查询是否已存在
|
|
|
|
DsPartVersionEntity partVersion = new DsPartVersionEntity(); |
|
|
|
DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(partCode, version); |
|
|
|
partVersion.setPartId(partId); |
|
|
|
if(partEntity == null){ |
|
|
|
partVersion.setPartCode(partCode); |
|
|
|
try { |
|
|
|
partVersion.setPartVersion(version); |
|
|
|
DsPartVersionEntity partVersion = new DsPartVersionEntity(); |
|
|
|
|
|
|
|
partVersion.setPartId(partId); |
|
|
|
boolean saved = partVersionService.save(partVersion); |
|
|
|
partVersion.setPartCode(partCode); |
|
|
|
if (saved) { |
|
|
|
partVersion.setPartVersion(version); |
|
|
|
log.info("版本号记录创建成功:{} -> 版本{}", partCode, version); |
|
|
|
|
|
|
|
} else { |
|
|
|
boolean saved = partVersionService.save(partVersion); |
|
|
|
log.error("版本号记录创建失败:{} -> 版本{}", partCode, version); |
|
|
|
if (saved) { |
|
|
|
|
|
|
|
log.info("版本号记录创建成功:{} -> 版本{}", partCode, version); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
log.error("版本号记录创建失败:{} -> 版本{}", partCode, version); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return saved; |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("创建版本号记录异常:{}", partCode, e); |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return saved; |
|
|
|
}{ |
|
|
|
} catch (Exception e) { |
|
|
|
log.info("版本号已存在,无需新增:{} -> 版本{}", partCode, version); |
|
|
|
log.error("创建版本号记录异常:{}", partCode, e); |
|
|
|
return true; |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 创建零件-子件关联关系 |
|
|
|
* 创建零件-子件关联关系 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean createPartRelation(Long partId, String partCode, Long childPartId, String childPartCode) { |
|
|
|
private boolean createPartRelation(Long partId, String partCode, Long childPartId, String childPartCode,Double quota) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
DsPartRelationEntity relation = new DsPartRelationEntity(); |
|
|
|
DsPartRelationEntity relation = new DsPartRelationEntity(); |
|
|
|
relation.setPartId(partId); |
|
|
|
relation.setPartId(partId); |
|
|
|
@ -2206,6 +2255,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas |
|
|
|
relation.setCreateTime(new Date()); |
|
|
|
relation.setCreateTime(new Date()); |
|
|
|
relation.setStatus(1); |
|
|
|
relation.setStatus(1); |
|
|
|
relation.setIsDeleted(0); |
|
|
|
relation.setIsDeleted(0); |
|
|
|
|
|
|
|
relation.setQuota(quota); |
|
|
|
|
|
|
|
|
|
|
|
boolean saved = partRelationService.save(relation); |
|
|
|
boolean saved = partRelationService.save(relation); |
|
|
|
if (saved) { |
|
|
|
if (saved) { |
|
|
|
|