|
|
|
|
@ -7,12 +7,15 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import jodd.bean.BeanUtil; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.RelTeamSetUser; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.TeamSet; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.UserRight; |
|
|
|
|
import org.springblade.desk.basic.service.IRelTeamSetUserService; |
|
|
|
|
import org.springblade.desk.basic.service.IUserRightService; |
|
|
|
|
import org.springblade.desk.dashboard.pojo.entity.BsProcessSetEntity; |
|
|
|
|
import org.springblade.desk.dashboard.pojo.entity.BsTeamSetEntity; |
|
|
|
|
import org.springblade.desk.dashboard.pojo.entity.DsPartEntity; |
|
|
|
|
@ -36,14 +39,14 @@ import org.springblade.desk.produce.pojo.vo.WorkPlanLoadVO; |
|
|
|
|
import org.springblade.desk.produce.service.*; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.AuditFile; |
|
|
|
|
import org.springblade.desk.quality.service.IAuditFileService; |
|
|
|
|
import org.springblade.system.cache.UserCache; |
|
|
|
|
import org.springblade.system.pojo.entity.DataScope; |
|
|
|
|
import org.springblade.system.pojo.entity.User; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -80,6 +83,12 @@ public class MakeRecServiceImpl extends BaseServiceImpl<MakeRecMapper, MakeRec> |
|
|
|
|
|
|
|
|
|
private final IMesEquipmentCardService mesEquipmentCardService; |
|
|
|
|
|
|
|
|
|
private final IUserRightService userRightService; |
|
|
|
|
|
|
|
|
|
private final IMesRbFilePreserveSlotService mesRbFilePreserveSlotService; |
|
|
|
|
|
|
|
|
|
private final IMesRbFilePreserveDetailService mesRbFilePreserveDetailService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public WorkPlanDto loadCurrentWp(String cardNo) { |
|
|
|
|
WorkOrder wo = workOrderMapper.getWorkOrderByCardNo(cardNo, (short) 0); |
|
|
|
|
@ -95,7 +104,7 @@ public class MakeRecServiceImpl extends BaseServiceImpl<MakeRecMapper, MakeRec> |
|
|
|
|
if (!WorkPlan.STATUS_START.equals(wp.getStatus())) { |
|
|
|
|
throw new ServiceException("当前工序已报工完成!"); |
|
|
|
|
} |
|
|
|
|
// this.checkTeamWorkPlan(wp, prWorkPlanService.getTeamId(userInfo.getUserId()));
|
|
|
|
|
this.checkTeamWorkPlan(wp, this.getTeamId(AuthUtil.getUserId())); |
|
|
|
|
boolean isBinging = false; |
|
|
|
|
// 查询当前工序是否绑定了挂次号
|
|
|
|
|
long count = macToolUseService.count(Wrappers.<MacToolUse>lambdaQuery().eq(MacToolUse::getWpId, wp.getId()).isNotNull(MacToolUse::getHangNum)); |
|
|
|
|
@ -103,89 +112,105 @@ public class MakeRecServiceImpl extends BaseServiceImpl<MakeRecMapper, MakeRec> |
|
|
|
|
isBinging = true; |
|
|
|
|
} |
|
|
|
|
YieldOrder yieldOrder = yieldOrderService.getById(wo.getYoId()); |
|
|
|
|
return WorkPlanDto.builder().workPlan(wp).workOrder(wo).yieldOrder(yieldOrder).isBinging(isBinging).build(); |
|
|
|
|
WorkPlanDto workPlanDto = new WorkPlanDto(yieldOrder, wo, wp, isBinging); |
|
|
|
|
workPlanDto.setCurrentWpTitle(""); |
|
|
|
|
workPlanDto.setCurrentMakeTeam(""); |
|
|
|
|
workPlanDto.setFrontWpTitle(""); |
|
|
|
|
workPlanDto.setFrontMakeTeam(""); |
|
|
|
|
workPlanDto.setNextWpTitle(""); |
|
|
|
|
workPlanDto.setNextMakeTeam(""); |
|
|
|
|
return workPlanDto; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkTeamWorkPlan(WorkPlan wp, List<Long> teamId) { |
|
|
|
|
Long tsId; |
|
|
|
|
//判断是否特殊工序,如果是特殊工序验证附属班组,反之则为分派班组
|
|
|
|
|
//20260304 逻辑更改,若存在附属班组,则验证附属班组,不存在附属班组,验证加工班组
|
|
|
|
|
if (wp.getSubsidiaryTeam() != null) { |
|
|
|
|
tsId = wp.getSubsidiaryTeam(); |
|
|
|
|
} else { |
|
|
|
|
tsId = wp.getMakeTeam(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (teamId == null) { |
|
|
|
|
throw new ServiceException("当前登录人无对应班组!"); |
|
|
|
|
} |
|
|
|
|
if (!teamId.contains(tsId)) { |
|
|
|
|
throw new ServiceException("当前工序不是登录人所在班组工序,不能操作!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<Long> getTeamId(Long userId) { |
|
|
|
|
List<UserRight> bsTeamSet = userRightService.list(Wrappers.lambdaQuery(UserRight.class).eq(UserRight::getUserId, userId).eq(UserRight::getUrType, "bs_team_set")); |
|
|
|
|
if (CollectionUtils.isEmpty(bsTeamSet)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
return bsTeamSet.stream().map(UserRight::getTheId).toList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void saveMakeRec(MakeRecDTO makeRecDTO) { |
|
|
|
|
public boolean saveMakeRec(MakeRecDTO makeRecDTO) { |
|
|
|
|
WorkPlan wp = workPlanMapper.selectById(makeRecDTO.getWpId()); |
|
|
|
|
if (!WorkPlan.STATUS_START.equals(wp.getStatus())) { |
|
|
|
|
throw new ServiceException("product.prWorkPlan.workOk"); |
|
|
|
|
throw new ServiceException("当前工序已报工完成!"); |
|
|
|
|
} |
|
|
|
|
MacToolUse mtu = null; |
|
|
|
|
MacToolUse mtu; |
|
|
|
|
DsProcessEntity dsProcess = dsProcessService.getById(wp.getPpsId()); |
|
|
|
|
DsProcessEntity frontProcess = dsProcessService.getById(wp.getFrontWpId()); |
|
|
|
|
//如果是上挂工序,需判定是否绑定挂具
|
|
|
|
|
if (dsProcess.getProcessName().equals("上挂")) { |
|
|
|
|
mtu = macToolUseService.getOne(Wrappers.<MacToolUse>lambdaQuery().eq(MacToolUse::getWpId, wp.getId()) |
|
|
|
|
.isNotNull(MacToolUse::getBsRackSet)); |
|
|
|
|
if ("上挂".equals(dsProcess.getProcessName())) { |
|
|
|
|
mtu = macToolUseService.queryByParams(wp.getId(), 1, 0, 0); |
|
|
|
|
if (mtu == null) { |
|
|
|
|
throw new ServiceException("product.prWorkPlan.not.bing.bsRackSet"); |
|
|
|
|
throw new ServiceException("上挂工序未绑定挂具!"); |
|
|
|
|
} |
|
|
|
|
// 如果上序是上挂工序、并且本序是主工序,则代表本序是 需要绑定飞靶及设备的工序 或者手动维护生产追溯信息
|
|
|
|
|
} else if (wp.getFrontWpId() != null && dsProcess.getProcessName().equals("上挂") && wp.getCruxProcess().equals("是")) { |
|
|
|
|
mtu = macToolUseService.getOne(Wrappers.<MacToolUse>lambdaQuery().eq(MacToolUse::getWpId, wp.getId()) |
|
|
|
|
.isNotNull(MacToolUse::getBsRackSet).isNotNull(MacToolUse::getBsFeiBaSet).isNotNull(MacToolUse::getEquipmentCard)); |
|
|
|
|
} else if (wp.getFrontWpId() != null && "上挂".equals(frontProcess.getProcessName()) && "1".equals(wp.getCruxProcess())) { |
|
|
|
|
mtu = macToolUseService.queryByParams(wp.getId(), 1, 1, 1); |
|
|
|
|
if (mtu == null) { |
|
|
|
|
// 验证是否维护了生产追溯信息
|
|
|
|
|
List<String> mtnCodeList = macToolUseService.listObjs(Wrappers.<MacToolUse>lambdaQuery().eq(MacToolUse::getWpId, wp.getId()).select(MacToolUse::getMtnCode)); |
|
|
|
|
List<MesQcProduceRunEntity> qcProduceRunList = mesQcProduceRunService.list(Wrappers.<MesQcProduceRunEntity>lambdaQuery() |
|
|
|
|
.in(MesQcProduceRunEntity::getMtnCode, mtnCodeList)); |
|
|
|
|
if (!(qcProduceRunList != null && qcProduceRunList.size() > 0)) { |
|
|
|
|
throw new ServiceException("product.prWorkPlan.not.bing"); |
|
|
|
|
List<MesQcProduceRunEntity> qcProduceRunList = mesQcProduceRunService.listPrByWpId(wp.getId()); |
|
|
|
|
if (!(qcProduceRunList != null && !qcProduceRunList.isEmpty())) { |
|
|
|
|
throw new ServiceException("此工序卡未绑定飞靶或设备!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (dsProcess.getProcessName().contains("镀金")) { |
|
|
|
|
mtu = macToolUseService.getOne(Wrappers.<MacToolUse>lambdaQuery().eq(MacToolUse::getWpId, wp.getId()) |
|
|
|
|
.isNotNull(MacToolUse::getBsFeiBaSet)); |
|
|
|
|
mtu = macToolUseService.queryByParams(wp.getId(), 0, 1, 0); |
|
|
|
|
if (mtu == null) { |
|
|
|
|
throw new ServiceException("此工序未绑定飞跋,请绑定飞跋!!!"); |
|
|
|
|
} |
|
|
|
|
//验证是否绑定设备
|
|
|
|
|
mtu = macToolUseService.getOne(Wrappers.<MacToolUse>lambdaQuery().eq(MacToolUse::getWpId, wp.getId()) |
|
|
|
|
.isNotNull(MacToolUse::getBsRackSet).isNotNull(MacToolUse::getBsFeiBaSet).isNotNull(MacToolUse::getEquipmentCard)); |
|
|
|
|
mtu = macToolUseService.queryByParams(wp.getId(), 1, 1, 1); |
|
|
|
|
if (mtu == null) { |
|
|
|
|
List<MesQcProduceRunEntity> produceRunList = null; |
|
|
|
|
List<String> mtnCodeList = macToolUseService.listObjs(Wrappers.<MacToolUse>lambdaQuery() |
|
|
|
|
.eq(MacToolUse::getWpId, wp.getId()).eq(MacToolUse::getMtuIndex, 1).select(MacToolUse::getMtnCode)); |
|
|
|
|
produceRunList = mesQcProduceRunService.list(Wrappers.<MesQcProduceRunEntity>lambdaQuery() |
|
|
|
|
.in(MesQcProduceRunEntity::getMtnCode, mtnCodeList).ne(MesQcProduceRunEntity::getWorkSlot, "烘箱")); |
|
|
|
|
if (produceRunList == null || produceRunList.size() == 0) { |
|
|
|
|
List<String> mtnCodeList2 = macToolUseService.listObjs(Wrappers.<MacToolUse>lambdaQuery() |
|
|
|
|
.eq(MacToolUse::getWpId, wp.getId()).eq(MacToolUse::getMtuIndex, 2).select(MacToolUse::getMtnCode)); |
|
|
|
|
produceRunList = mesQcProduceRunService.list(Wrappers.<MesQcProduceRunEntity>lambdaQuery() |
|
|
|
|
.in(MesQcProduceRunEntity::getMtnCode, mtnCodeList2).ne(MesQcProduceRunEntity::getWorkSlot, "烘箱")); |
|
|
|
|
produceRunList = mesQcProduceRunService.listPrByWpIdIndex(wp.getId(), 1, Boolean.FALSE); |
|
|
|
|
if (produceRunList == null || produceRunList.isEmpty()) { |
|
|
|
|
produceRunList = mesQcProduceRunService.listPrByWpIdIndex(wp.getId(), 2, Boolean.FALSE); |
|
|
|
|
} |
|
|
|
|
if (!(produceRunList != null && produceRunList.size() > 0)) { |
|
|
|
|
if (!(produceRunList != null && !produceRunList.isEmpty())) { |
|
|
|
|
throw new ServiceException("未绑定飞跋和设备或未维护生产追溯信息!!!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (dsProcess.getProcessName().equals("玻璃封接清洗") || dsProcess.getProcessName().equals("玻璃封接退火") || |
|
|
|
|
dsProcess.getProcessName().equals("玻璃封接预氧化(箱式炉)") || dsProcess.getProcessName().equals("玻璃封接预氧化(链式炉)") || |
|
|
|
|
dsProcess.getProcessName().equals("玻璃封接(链式炉)") || dsProcess.getProcessName().equals("玻璃封接(真空炉)") || |
|
|
|
|
dsProcess.getProcessName().equals("玻璃封接灌胶") || dsProcess.getProcessName().equals("玻璃饼压制") || |
|
|
|
|
dsProcess.getProcessName().equals("玻璃饼排蜡玻化") || dsProcess.getProcessName().equals("玻璃饼振光") || |
|
|
|
|
dsProcess.getProcessName().equals("石墨模烘干") || dsProcess.getProcessName().equals("石墨模焙烧") || |
|
|
|
|
dsProcess.getProcessName().equals("真空炉灌胶") || dsProcess.getProcessName().equals("玻璃封接电镀去氧化皮") || |
|
|
|
|
dsProcess.getProcessName().equals("玻璃封接电化学抛光") || dsProcess.getProcessName().equals("玻璃封接湿喷砂") || |
|
|
|
|
dsProcess.getProcessName().equals("玻璃封接电镀") || dsProcess.getProcessName().equals("玻璃封接插针电镀") || |
|
|
|
|
dsProcess.getProcessName().equals("玻璃封接壳体电镀") || dsProcess.getProcessName().equals("玻璃封接电镀下挂") || |
|
|
|
|
dsProcess.getProcessName().equals("烧结浸保护剂")) { |
|
|
|
|
mtu = macToolUseService.getOne(Wrappers.<MacToolUse>lambdaQuery().eq(MacToolUse::getWpId, wp.getId()) |
|
|
|
|
.isNotNull(MacToolUse::getBsRackSet).isNotNull(MacToolUse::getBsFeiBaSet).isNotNull(MacToolUse::getEquipmentCard)); |
|
|
|
|
} else if ("玻璃封接清洗".equals(dsProcess.getProcessName()) || "玻璃封接退火".equals(dsProcess.getProcessName()) || |
|
|
|
|
"玻璃封接预氧化(箱式炉)".equals(dsProcess.getProcessName()) || "玻璃封接预氧化(链式炉)".equals(dsProcess.getProcessName()) || |
|
|
|
|
"玻璃封接(链式炉)".equals(dsProcess.getProcessName()) || "玻璃封接(真空炉)".equals(dsProcess.getProcessName()) || |
|
|
|
|
"玻璃封接灌胶".equals(dsProcess.getProcessName()) || "玻璃饼压制".equals(dsProcess.getProcessName()) || |
|
|
|
|
"玻璃饼排蜡玻化".equals(dsProcess.getProcessName()) || "玻璃饼振光".equals(dsProcess.getProcessName()) || |
|
|
|
|
"石墨模烘干".equals(dsProcess.getProcessName()) || "石墨模焙烧".equals(dsProcess.getProcessName()) || |
|
|
|
|
"真空炉灌胶".equals(dsProcess.getProcessName()) || "玻璃封接电镀去氧化皮".equals(dsProcess.getProcessName()) || |
|
|
|
|
"玻璃封接电化学抛光".equals(dsProcess.getProcessName()) || "玻璃封接湿喷砂".equals(dsProcess.getProcessName()) || |
|
|
|
|
"玻璃封接电镀".equals(dsProcess.getProcessName()) || "玻璃封接插针电镀".equals(dsProcess.getProcessName()) || |
|
|
|
|
"玻璃封接壳体电镀".equals(dsProcess.getProcessName()) || "玻璃封接电镀下挂".equals(dsProcess.getProcessName()) || |
|
|
|
|
"烧结浸保护剂".equals(dsProcess.getProcessName())) { |
|
|
|
|
mtu = macToolUseService.queryByParams(wp.getId(), 1, 1, 1); |
|
|
|
|
if (mtu == null) { |
|
|
|
|
// 验证是否维护了生产追溯信息
|
|
|
|
|
List<MesQcProduceRunEntity> qcProduceRunList = null; |
|
|
|
|
List<String> mtnCodeList = macToolUseService.listObjs(Wrappers.<MacToolUse>lambdaQuery() |
|
|
|
|
.eq(MacToolUse::getWpId, wp.getId()).select(MacToolUse::getMtnCode)); |
|
|
|
|
qcProduceRunList = mesQcProduceRunService.list(Wrappers.<MesQcProduceRunEntity>lambdaQuery() |
|
|
|
|
.in(MesQcProduceRunEntity::getMtnCode, mtnCodeList)); |
|
|
|
|
if (!(qcProduceRunList != null && qcProduceRunList.size() > 0)) { |
|
|
|
|
throw new ServiceException("product.prWorkPlan.not.bing"); |
|
|
|
|
List<MesQcProduceRunEntity> qcProduceRunList = mesQcProduceRunService.listPrByWpId(wp.getId()); |
|
|
|
|
if (!(qcProduceRunList != null && !qcProduceRunList.isEmpty())) { |
|
|
|
|
throw new ServiceException("此工序卡未绑定飞靶或设备!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//周新昊 20241114 验证手动维护设备使用记录的工序电子档案数据是否维护完备
|
|
|
|
|
Boolean aBoolean = true; //this.chkRfpDetail(wp);
|
|
|
|
|
boolean aBoolean = this.chkRfpDetail(wp.getId()); |
|
|
|
|
if (!aBoolean) { |
|
|
|
|
throw new ServiceException("生产记录未填写完整,不允许报工!!!!"); |
|
|
|
|
} |
|
|
|
|
@ -197,8 +222,9 @@ public class MakeRecServiceImpl extends BaseServiceImpl<MakeRecMapper, MakeRec> |
|
|
|
|
baseMapper.insertOrUpdate(mr); |
|
|
|
|
if (mr.getScrapQty() > 0) { |
|
|
|
|
wp.setScrapQty(wp.getScrapQty() + mr.getScrapQty()); |
|
|
|
|
WorkOrder wo = null;//workOrderService.getById(wp.getWoId());
|
|
|
|
|
WorkOrder wo = workOrderMapper.selectById(wp.getWoId()); |
|
|
|
|
wo.setMakeQty(wo.getMakeQty() - mr.getScrapQty()); |
|
|
|
|
workOrderMapper.updateById(wo); |
|
|
|
|
} |
|
|
|
|
wp.setWorkQty(wp.getWorkQty() + mr.getWorkQty()); |
|
|
|
|
if (wp.getQualifiedQty().equals(wp.getScrapQty() + wp.getWorkQty())) { |
|
|
|
|
@ -206,7 +232,6 @@ public class MakeRecServiceImpl extends BaseServiceImpl<MakeRecMapper, MakeRec> |
|
|
|
|
} |
|
|
|
|
if ("热处理".equals(dsProcess.getProcessName())) { |
|
|
|
|
wp.setPrintType((short) 1); |
|
|
|
|
//workPlanService.saveOrUpdate(wp);
|
|
|
|
|
String code = macToolUseService.nextCode(2); |
|
|
|
|
MacToolUse prMacToolUse = new MacToolUse(); |
|
|
|
|
prMacToolUse.setWpId(wp.getId()); |
|
|
|
|
@ -232,61 +257,230 @@ public class MakeRecServiceImpl extends BaseServiceImpl<MakeRecMapper, MakeRec> |
|
|
|
|
qcProduceRun.setDataSeven(makeRecDTO.getShape()); |
|
|
|
|
mesQcProduceRunService.save(qcProduceRun); |
|
|
|
|
} |
|
|
|
|
// 保存引用文件或版本号
|
|
|
|
|
WorkOrder prWorkOrder = null; //workOrderService.getById(wp.getWoId());
|
|
|
|
|
if (prWorkOrder != null && prWorkOrder.getId() != null) { |
|
|
|
|
YieldOrder pjYieldOrder = yieldOrderService.getById(prWorkOrder.getYoId()); |
|
|
|
|
if (pjYieldOrder != null && pjYieldOrder.getId() != null) { |
|
|
|
|
BsProcessSetEntity procedureSet = bsProcessSetService.getById(wp.getPpsId()); |
|
|
|
|
AuditFile dsAuditFile = null; |
|
|
|
|
// 如果本序是涂色标或喷砂,直接查维护的数据
|
|
|
|
|
if ("涂色标".equals(procedureSet.getName()) || "喷砂".equals(procedureSet.getName())) { |
|
|
|
|
dsAuditFile = auditFileService.getOne(Wrappers.<AuditFile>lambdaQuery() |
|
|
|
|
.eq(AuditFile::getPpsId, procedureSet.getId())); |
|
|
|
|
} else { |
|
|
|
|
// 如果不是优先判断是否有生产标识
|
|
|
|
|
String prodIdent = pjYieldOrder.getProductIdent(); |
|
|
|
|
BsTeamSetEntity bsTeamSet = teamSetService.getOne(Wrappers.<BsTeamSetEntity>lambdaQuery() |
|
|
|
|
.eq(BsTeamSetEntity::getId, wp.getMakeTeam())); |
|
|
|
|
if (!"AH".equals(prodIdent)) { |
|
|
|
|
prodIdent = null; |
|
|
|
|
} |
|
|
|
|
if (bsTeamSet != null && bsTeamSet.getId() != null) { |
|
|
|
|
// BsCenterTeamEntity bsCenterTeam = bsCenterTeamService.getByTsId(bsTeamSet.getTsId());
|
|
|
|
|
DsPartEntity dsPart = partService.getOne(Wrappers.<DsPartEntity>lambdaQuery().eq(DsPartEntity::getPartCode, pjYieldOrder.getPartCode())); |
|
|
|
|
String productApparea = null; |
|
|
|
|
if (dsPart != null && dsPart.getId() != null) { |
|
|
|
|
productApparea = dsPart.getProductSeries(); |
|
|
|
|
workPlanMapper.updateById(wp); |
|
|
|
|
// 2025-07-23 线上迁移修改
|
|
|
|
|
MacToolUse macToolUse = macToolUseService.getDataByWpIdAndIndex(wp.getId(), "2"); |
|
|
|
|
if (macToolUse != null && macToolUse.getRfpId() != null && macToolUse.getFinished() != 1) { |
|
|
|
|
macToolUse.setFinished(1); |
|
|
|
|
String deviceCode = macToolUse.getEquipmentCard() != null ? macToolUse.getMtnCode() : ""; |
|
|
|
|
log.info("修改设备绑定状态:设备编号:{},批次号:{},槽号:{},方法名:addMakeRec(),{}", deviceCode, macToolUse.getHangNum(), macToolUse.getMtnCode(), macToolUse.getFinished()); |
|
|
|
|
macToolUseService.updateById(macToolUse); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean chkRfpDetail(Long wpId) { |
|
|
|
|
List<MacToolUse> macToolUses = macToolUseService.list(Wrappers.lambdaQuery(MacToolUse.class).isNotNull(MacToolUse::getRfpId).ne(MacToolUse::getMtuIndex, "2").eq(MacToolUse::getWpId, wpId)); |
|
|
|
|
if (CollectionUtils.isNotEmpty(macToolUses)) { |
|
|
|
|
for (MacToolUse macToolUs : macToolUses) { |
|
|
|
|
List<MesQcProduceRunEntity> qcProduceRunList = mesQcProduceRunService.list(Wrappers.lambdaQuery(MesQcProduceRunEntity.class).eq(MesQcProduceRunEntity::getMtnCode, macToolUs.getMtnCode()) |
|
|
|
|
.and(wrapper -> wrapper.isNull(MesQcProduceRunEntity::getWorkSlot).or().notLike(MesQcProduceRunEntity::getWorkSlot, "入料区")).orderByAsc(MesQcProduceRunEntity::getId)); |
|
|
|
|
Map<String, MesQcProduceRunEntity> qcProduceRunMap = qcProduceRunList.stream().collect(Collectors.toMap(MesQcProduceRunEntity::getWorkSlot, Function.identity())); |
|
|
|
|
List<MesRbFilePreserveSlotEntity> dsRbFilePreserveSlots = mesRbFilePreserveSlotService.list(Wrappers.lambdaQuery(MesRbFilePreserveSlotEntity.class).eq(MesRbFilePreserveSlotEntity::getRfpId, macToolUs.getRfpId()).orderByAsc(MesRbFilePreserveSlotEntity::getSlotIndex)); |
|
|
|
|
if (CollectionUtils.isNotEmpty(dsRbFilePreserveSlots)) { |
|
|
|
|
for (MesRbFilePreserveSlotEntity dsRbFilePreserveSlot : dsRbFilePreserveSlots) { |
|
|
|
|
MesQcProduceRunEntity qcProduceRun = qcProduceRunMap.get(dsRbFilePreserveSlot.getSlotName()); |
|
|
|
|
if (qcProduceRun != null) { |
|
|
|
|
List<MesRbFilePreserveDetailEntity> dsRbFilePreserveDetails = mesRbFilePreserveDetailService.getByRfpsId(dsRbFilePreserveSlot.getId()); |
|
|
|
|
if (CollectionUtils.isNotEmpty(dsRbFilePreserveDetails)) { |
|
|
|
|
if (dsRbFilePreserveSlot.getRfpsType() == 1) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getInDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getOutDate())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 2) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getInDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getOutDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataOne())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 3 || dsRbFilePreserveSlot.getRfpsType() == 11) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getInDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getOutDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 4 || dsRbFilePreserveSlot.getRfpsType() == 12) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 5 || dsRbFilePreserveSlot.getRfpsType() == 22) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFour()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFive())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 6) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFour()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFive()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSix())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 7 || dsRbFilePreserveSlot.getRfpsType() == 18) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getDataOne())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 8) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 9) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getInDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getOutDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 13) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFour()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFive()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSix()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSeven()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataEight()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataNine()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTen())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 14) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getInDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getOutDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFour()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFive()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSix()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSeven()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataEight()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataNine()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTen())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 15) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getInDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getOutDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFour()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFive()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSix()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSeven()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataEight()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataNine()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTen()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataEleven()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwelve())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 16) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getInDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getOutDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFour()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFive()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSix()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSeven()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataEight()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataNine()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTen()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataEleven()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwelve()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThirteen()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFourteen())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 17) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getInDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getOutDate()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFour()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFive()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSix())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else if (dsRbFilePreserveSlot.getRfpsType() == 21) { |
|
|
|
|
if (StringUtils.isBlank(qcProduceRun.getDataOne()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataTwo()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataThree()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFour()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataFive()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSix()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataSeven()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataEight()) |
|
|
|
|
|| StringUtils.isBlank(qcProduceRun.getDataNine())) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// if (productApparea!=null){
|
|
|
|
|
// dsAuditFile = dsAuditFileDao.getDataByPpsIdAndApparea(procedureSet.getPpsId(), bsCenterTeam.getBsWorkCenter().getWcId(),productApparea);
|
|
|
|
|
// }
|
|
|
|
|
// if (bsCenterTeam != null && bsCenterTeam.getCtId() != null && dsAuditFile == null) {
|
|
|
|
|
// dsAuditFile = dsAuditFileDao.getDataByPpsIdAndPqName(procedureSet.getPpsId(), bsCenterTeam.getBsWorkCenter().getWcId(), prodIdent);
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (dsAuditFile != null && dsAuditFile.getId() != null) { |
|
|
|
|
wp.setPapers(dsAuditFile.getPapers()); |
|
|
|
|
wp.setReferenceFile(dsAuditFile.getReferenceFile()); |
|
|
|
|
//workPlanService.updateById(wp);
|
|
|
|
|
} |
|
|
|
|
// 2025-07-23 线上迁移修改
|
|
|
|
|
MacToolUse macToolUse = macToolUseService.getOne(Wrappers.<MacToolUse>lambdaQuery() |
|
|
|
|
.eq(MacToolUse::getWpId, wp.getId())); |
|
|
|
|
if (macToolUse != null && macToolUse.getRfpId() != null && macToolUse.getFinished() != 1) { |
|
|
|
|
macToolUse.setFinished(1); |
|
|
|
|
String deviceCode = macToolUse.getEquipmentCard() != null ? macToolUse.getMtnCode() : ""; |
|
|
|
|
log.info("修改设备绑定状态:设备编号:{},批次号:{},槽号:{},方法名:addMakeRec(),{}", deviceCode, macToolUse.getHangNum(), macToolUse.getMtnCode(), macToolUse.getFinished()); |
|
|
|
|
macToolUseService.updateById(macToolUse); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<MesMakeRecVO> selectMesMakeRecPage(IPage<MesMakeRecVO> page, MesMakeRecVO mesMakeRec) { |
|
|
|
|
return page.setRecords(baseMapper.selectMesMakeRecPage(page, mesMakeRec)); |
|
|
|
|
IPage<MesMakeRecVO> mesMakeRecVOIPage = page.setRecords(baseMapper.selectMesMakeRecPage(page, mesMakeRec)); |
|
|
|
|
List<MesMakeRecVO> records = mesMakeRecVOIPage.getRecords(); |
|
|
|
|
if (CollectionUtils.isNotEmpty(records)) { |
|
|
|
|
List<Long> ppsIds = new ArrayList<>(); |
|
|
|
|
List<Long> makeTeams = new ArrayList<>(); |
|
|
|
|
for (MesMakeRecVO record : records) { |
|
|
|
|
ppsIds.add(record.getPpsId()); |
|
|
|
|
if (record.getFrontPpsId() != null) { |
|
|
|
|
ppsIds.add(record.getFrontPpsId()); |
|
|
|
|
} |
|
|
|
|
if (record.getNextPpsId() != null) { |
|
|
|
|
ppsIds.add(record.getNextPpsId()); |
|
|
|
|
} |
|
|
|
|
if (record.getMakeTeam() != null) { |
|
|
|
|
makeTeams.add(record.getMakeTeam()); |
|
|
|
|
} |
|
|
|
|
if (record.getFrontMakeTeam() != null) { |
|
|
|
|
makeTeams.add(record.getFrontMakeTeam()); |
|
|
|
|
} |
|
|
|
|
if (record.getNextMakeTeam() != null) { |
|
|
|
|
makeTeams.add(record.getNextMakeTeam()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
List<BsProcessSetEntity> processSets = bsProcessSetService.list(Wrappers.lambdaQuery(BsProcessSetEntity.class).in(BsProcessSetEntity::getId, ppsIds)); |
|
|
|
|
Map<Long, String> processSetMap = processSets.stream().collect(Collectors.toMap(BsProcessSetEntity::getId, BsProcessSetEntity::getName)); |
|
|
|
|
|
|
|
|
|
List<BsTeamSetEntity> teams = teamSetService.list(Wrappers.lambdaQuery(BsTeamSetEntity.class).in(BsTeamSetEntity::getId, makeTeams)); |
|
|
|
|
Map<Long, String> teamMap = teams.stream().collect(Collectors.toMap(BsTeamSetEntity::getId, BsTeamSetEntity::getTsName)); |
|
|
|
|
for (MesMakeRecVO record : records) { |
|
|
|
|
User user = UserCache.getUser(record.getWorker()); |
|
|
|
|
record.setWorkerName(user != null ? user.getRealName() : ""); |
|
|
|
|
record.setPpsName(processSetMap.get(record.getPpsId())); |
|
|
|
|
record.setMakeTeamName(teamMap.get(record.getMakeTeam())); |
|
|
|
|
record.setFrontPpsName(processSetMap.get(record.getFrontPpsId())); |
|
|
|
|
record.setFrontMakeTeamName(teamMap.get(record.getFrontMakeTeam())); |
|
|
|
|
record.setNextPpsName(processSetMap.get(record.getNextPpsId())); |
|
|
|
|
record.setNextMakeTeamName(teamMap.get(record.getNextMakeTeam())); |
|
|
|
|
} |
|
|
|
|
mesMakeRecVOIPage.setRecords(records); |
|
|
|
|
} |
|
|
|
|
return mesMakeRecVOIPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|