|
|
|
|
@ -314,6 +314,8 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
MacToolUse mtu; |
|
|
|
|
//绑定日期
|
|
|
|
|
Date nowDate = new Date(); |
|
|
|
|
List<MacToolUse> mtuList = new ArrayList<>(); |
|
|
|
|
List<WorkPlan> workPlans = new ArrayList<>(); |
|
|
|
|
for (Long id : planList) { |
|
|
|
|
if (operate != null && mesQcProduceRunService.getDataByWpIdAndSlot(id, operate)) { |
|
|
|
|
throw new ServiceException("此工序已有对应操作的记录,请勿重复操作"); |
|
|
|
|
@ -322,7 +324,6 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
mtu = new MacToolUse(); |
|
|
|
|
mtu.setWpId(id); |
|
|
|
|
mtu.setBindType("sj"); |
|
|
|
|
// "玻璃饼排蜡玻化(箱式炉)".equals(ppsName) ||
|
|
|
|
|
if ("配胶".equals(operate) || "玻璃饼压制".equals(ppsName) || "振光".equals(operate) || "玻璃饼印字".equals(ppsName) |
|
|
|
|
|| "I面涂覆".equals(operate) || "II面涂覆".equals(operate)) { |
|
|
|
|
mtu.setFinished(1); |
|
|
|
|
@ -330,18 +331,19 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
log.info("修改设备绑定状态:设备编号:{},批次号:{},槽号:{},方法名:sjBindingCard(),{}", deviceCode, mtu.getHangNum(), mtu.getMtnCode(), mtu.getFinished()); |
|
|
|
|
} |
|
|
|
|
this.packageMtu(mtu, null, null, equipment.getId(), code); |
|
|
|
|
macToolUseService.save(mtu); |
|
|
|
|
mtuList.add(mtu); |
|
|
|
|
//修改作业计划绑定状态为绑定
|
|
|
|
|
workPlan.setBindStatus(WorkPlan.BIND_STATUS_BIND); |
|
|
|
|
workPlan.setPrintType(WorkPlan.PRINT_TYPE_PROCESS); |
|
|
|
|
baseMapper.updateById(workPlan); |
|
|
|
|
workPlans.add(workPlan); |
|
|
|
|
} |
|
|
|
|
macToolUseService.saveBatch(mtuList); |
|
|
|
|
baseMapper.updateById(workPlans); |
|
|
|
|
|
|
|
|
|
MesQcProduceRunEntity qcProduceRun = new MesQcProduceRunEntity(); |
|
|
|
|
qcProduceRun.setMtnCode(code); |
|
|
|
|
qcProduceRun.setDeviceId(equipment != null ? equipment.getDeviceCode() : ""); |
|
|
|
|
qcProduceRun.setInDate(new Date().toString()); |
|
|
|
|
qcProduceRun.setCreateMan(String.valueOf(AuthUtil.getUser().getUserId())); |
|
|
|
|
qcProduceRun.setCreateTime(nowDate); |
|
|
|
|
// 操作的步骤
|
|
|
|
|
qcProduceRun.setWorkSlot(operate); |
|
|
|
|
// 此次绑定的工序
|
|
|
|
|
@ -386,25 +388,24 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void unBind(UnBingVo unBingVo) { |
|
|
|
|
if (StringUtils.isBlank(unBingVo.getRsCode()) && StringUtils.isBlank(unBingVo.getFsCode()) && StringUtils.isBlank(unBingVo.getDeviceCode())) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 查询挂具
|
|
|
|
|
RackSetEntity bsRackSet = rackSetService.getOne(Wrappers.<RackSetEntity>lambdaQuery().eq(RackSetEntity::getRsCode, unBingVo.getRsCode())); |
|
|
|
|
RackSetEntity bsRackSet = rackSetService.getBsRackSetByCode(unBingVo.getRsCode()); |
|
|
|
|
// 查询飞靶
|
|
|
|
|
FeiBaSetEntity bsFeiBaSet = feiBaSetService.getOne(Wrappers.<FeiBaSetEntity>lambdaQuery().eq(FeiBaSetEntity::getFsCode, unBingVo.getFsCode())); |
|
|
|
|
FeiBaSetEntity bsFeiBaSet = feiBaSetService.getBsFeiBaSetByCode(unBingVo.getFsCode()); |
|
|
|
|
//查询设备
|
|
|
|
|
EquipmentEntity equipmentCard = equipmentService.getOne(Wrappers.<EquipmentEntity>lambdaQuery().eq(EquipmentEntity::getDeviceCode, unBingVo.getDeviceCode())); |
|
|
|
|
EquipmentEntity equipmentCard = equipmentService.getDeEquipmentCardByCode(unBingVo.getDeviceCode()); |
|
|
|
|
|
|
|
|
|
// 如果都为空,则返回
|
|
|
|
|
if (equipmentCard == null && bsFeiBaSet == null && bsRackSet == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//绑定记录
|
|
|
|
|
List<MacToolUse> mtuList = macToolUseService.list(Wrappers.<MacToolUse>lambdaQuery() |
|
|
|
|
.eq(MacToolUse::getBsFeiBaSet, bsFeiBaSet.getId()).eq(MacToolUse::getBsRackSet, bsRackSet.getId()) |
|
|
|
|
.eq(MacToolUse::getEquipmentCard, equipmentCard.getId()).eq(MacToolUse::getFinished, 0)); |
|
|
|
|
List<MacToolUse> mtuList = macToolUseService.listByParams(bsRackSet.getId(), bsFeiBaSet != null ? bsFeiBaSet.getId() : null, equipmentCard != null ? equipmentCard.getId() : null, null); |
|
|
|
|
macToolUseService.unMacToolUseBind(mtuList); |
|
|
|
|
this.unBindDetail(mtuList); |
|
|
|
|
|
|
|
|
|
@ -726,16 +727,13 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void unBindBsFeiBaSet(FeiBaSetEntity bsFeiBaSet) { |
|
|
|
|
if (bsFeiBaSet != null) { |
|
|
|
|
bsFeiBaSet.setBindQty((short) 0); |
|
|
|
|
bsFeiBaSet.setStatus(FeiBaSetEntity.FS_STATUS_FREE); |
|
|
|
|
feiBaSetService.updateById(bsFeiBaSet); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void unBindDeEquipmentCard(EquipmentEntity equipmentCard) { |
|
|
|
|
//设备不为空是解绑设备
|
|
|
|
|
if (equipmentCard != null) { |
|
|
|
|
equipmentCard.setBindQty(equipmentCard.getBindQty().subtract(BigDecimal.valueOf(1))); |
|
|
|
|
if (equipmentCard.getBindQty().compareTo(BigDecimal.valueOf(0)) <= 0) { |
|
|
|
|
equipmentCard.setBindQty(BigDecimal.valueOf(0)); |
|
|
|
|
@ -744,19 +742,18 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
equipmentService.updateById(equipmentCard); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void unBindDetail(List<MacToolUse> mtuList) { |
|
|
|
|
if (mtuList == null || mtuList.isEmpty()) { |
|
|
|
|
if (CollectionUtils.isEmpty(mtuList)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<WorkPlan> wpList = new ArrayList<>(); |
|
|
|
|
for (MacToolUse mtu : mtuList) { |
|
|
|
|
//修改作业计划绑定状态
|
|
|
|
|
WorkPlan wp = baseMapper.selectById(mtu.getWpId()); |
|
|
|
|
wp.setBindStatus(WorkPlan.BIND_STATUS_FREE); |
|
|
|
|
baseMapper.updateById(wp); |
|
|
|
|
wpList.add(wp); |
|
|
|
|
} |
|
|
|
|
baseMapper.updateById(wpList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|