|
|
|
|
@ -31,6 +31,7 @@ import org.springblade.desk.produce.pojo.dto.MesRbRedoRoutDTO; |
|
|
|
|
import org.springblade.desk.produce.pojo.dto.PrMacTooUseSpec; |
|
|
|
|
import org.springblade.desk.produce.pojo.dto.ShiftTransferDTO; |
|
|
|
|
import org.springblade.desk.produce.pojo.entity.*; |
|
|
|
|
import org.springblade.desk.produce.pojo.vo.MacToolUseVO; |
|
|
|
|
import org.springblade.desk.produce.pojo.vo.SjEcBingCardVo; |
|
|
|
|
import org.springblade.desk.produce.pojo.vo.UnBingDeviceVo; |
|
|
|
|
import org.springblade.desk.produce.pojo.vo.UnBingVo; |
|
|
|
|
@ -40,10 +41,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -78,7 +76,10 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
|
|
|
|
|
private final IBsAdditionalMessService bsAdditionalMessService; |
|
|
|
|
|
|
|
|
|
private final IDsPartService dsPartService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void bindingCard(DeviceBindDTO deviceBindDTO) { |
|
|
|
|
Long rsId = deviceBindDTO.getRsId(); |
|
|
|
|
Long fsId = deviceBindDTO.getFsId(); |
|
|
|
|
@ -122,6 +123,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
//处理绑定信息
|
|
|
|
|
WorkPlan workPlan; |
|
|
|
|
MacToolUse mtu; |
|
|
|
|
Date date = new Date(); |
|
|
|
|
List<WorkPlan> workPlans = this.listByIds(planListIds); |
|
|
|
|
// stream流将workPlans按照ID转换为map
|
|
|
|
|
Map<Long, WorkPlan> workPlanMap = workPlans.stream().collect(Collectors.toMap(WorkPlan::getId, wp -> wp)); |
|
|
|
|
@ -129,7 +131,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
workPlan = workPlanMap.get(planId); |
|
|
|
|
mtu = new MacToolUse(); |
|
|
|
|
mtu.setWpId(planId); |
|
|
|
|
this.packageMtu(mtu, rsId, fsId, ecId, code); |
|
|
|
|
this.packageMtu(mtu, rsId, fsId, ecId, code, date); |
|
|
|
|
macToolUseService.save(mtu); |
|
|
|
|
//修改作业计划绑定状态为绑定
|
|
|
|
|
workPlan.setBindStatus(WorkPlan.BIND_STATUS_BIND); |
|
|
|
|
@ -179,6 +181,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void binding(DeviceBindDTO deviceBindDTO) { |
|
|
|
|
Long fsId = deviceBindDTO.getFsId(); |
|
|
|
|
Long ecId = deviceBindDTO.getEcId(); |
|
|
|
|
@ -190,9 +193,9 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
//获取同槽号
|
|
|
|
|
String code = null; |
|
|
|
|
FeiBaSetEntity feiBaSet = this.getFeiBaSetByFsId(fsId); |
|
|
|
|
|
|
|
|
|
Date date = new Date(); |
|
|
|
|
//挂具集合不为空,则代表是挂具相关绑定,反之则是飞靶绑定设备
|
|
|
|
|
if (rsListIds != null) { |
|
|
|
|
if (CollectionUtils.isNotEmpty(rsListIds)) { |
|
|
|
|
if (fsId != null) { |
|
|
|
|
code = macToolUseService.findMaxCodeByParams(null, fsId); |
|
|
|
|
//修改飞靶状态
|
|
|
|
|
@ -223,7 +226,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
if (mtu.getBsFeiBaSet() != null || mtu.getEquipmentCard() != null) { |
|
|
|
|
throw new ServiceException("挂具【" + rackSet.getRsCode() + "】已绑定" + (mtu.getBsFeiBaSet() == null ? "设备【" + mtu.getEquipmentCard() : "飞靶【" + mtu.getBsFeiBaSet()) + "】,不能重复绑定!"); |
|
|
|
|
} |
|
|
|
|
this.packageMtu(mtu, rsId, fsId, ecId, code); |
|
|
|
|
this.packageMtu(mtu, rsId, fsId, ecId, code, date); |
|
|
|
|
} |
|
|
|
|
macToolUseService.updateBatchById(mtuLst); |
|
|
|
|
// 存储同槽额外面积
|
|
|
|
|
@ -257,7 +260,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
mtu.setHangNum(deviceBindDTO.getHangNum()); |
|
|
|
|
this.packageMtu(mtu, mtu.getBsRackSet(), fsId, ecId, code); |
|
|
|
|
this.packageMtu(mtu, mtu.getBsRackSet(), fsId, ecId, code, date); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 开始绑定
|
|
|
|
|
@ -266,7 +269,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
newMtu = new MacToolUse(); |
|
|
|
|
newMtu.setWpId(mtu.getWpId()); |
|
|
|
|
// 直接共享产线设备的同槽(烘箱)
|
|
|
|
|
this.packageMtu(newMtu, mtu.getBsRackSet(), null, mtu.getEquipmentCard(), mtu.getMtnCode()); |
|
|
|
|
this.packageMtu(newMtu, mtu.getBsRackSet(), null, mtu.getEquipmentCard(), mtu.getMtnCode(), date); |
|
|
|
|
macToolUseService.save(newMtu); |
|
|
|
|
|
|
|
|
|
//标识绑定记录状态为解绑
|
|
|
|
|
@ -283,11 +286,13 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void packageMtu(MacToolUse mtu, Long rsId, Long fsId, Long ecId, String code) { |
|
|
|
|
private void packageMtu(MacToolUse mtu, Long rsId, Long fsId, Long ecId, String code, Date date) { |
|
|
|
|
mtu.setMtnCode(code); |
|
|
|
|
mtu.setBsRackSet(rsId); |
|
|
|
|
mtu.setBsFeiBaSet(fsId); |
|
|
|
|
mtu.setEquipmentCard(ecId); |
|
|
|
|
mtu.setBindTime(date); |
|
|
|
|
mtu.setCreateMan(AuthUtil.getUserId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -330,7 +335,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
String deviceCode = mtu.getEquipmentCard() != null ? mtu.getMtnCode() : ""; |
|
|
|
|
log.info("修改设备绑定状态:设备编号:{},批次号:{},槽号:{},方法名:sjBindingCard(),{}", deviceCode, mtu.getHangNum(), mtu.getMtnCode(), mtu.getFinished()); |
|
|
|
|
} |
|
|
|
|
this.packageMtu(mtu, null, null, equipment.getId(), code); |
|
|
|
|
this.packageMtu(mtu, null, null, equipment.getId(), code, nowDate); |
|
|
|
|
mtuList.add(mtu); |
|
|
|
|
//修改作业计划绑定状态为绑定
|
|
|
|
|
workPlan.setBindStatus(WorkPlan.BIND_STATUS_BIND); |
|
|
|
|
@ -419,62 +424,64 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
//更新飞靶下挂具相关信息
|
|
|
|
|
this.unBindBsRackSet(bsRackSet); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<MacToolUse> getUnbindByCard(String cardNo) { |
|
|
|
|
|
|
|
|
|
public List<MacToolUseVO> getUnbindByCard(String cardNo) { |
|
|
|
|
WorkOrder prWorkOrder = workOrderService.getWorkOrderByCardNo(cardNo); |
|
|
|
|
if (prWorkOrder == null) { |
|
|
|
|
throw new ServiceException("未找到对应的订单"); |
|
|
|
|
} |
|
|
|
|
return macToolUseService.list(Wrappers.<MacToolUse>lambdaQuery().eq(MacToolUse::getWpId, prWorkOrder.getWpId())); |
|
|
|
|
return macToolUseService.queryByWpId(prWorkOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void sjDeviceUnBind(UnBingDeviceVo unBingDeviceVo) { |
|
|
|
|
for (PrMacTooUseSpec prMacTooUseSpec : unBingDeviceVo.getList()) { |
|
|
|
|
|
|
|
|
|
MacToolUse prMacToolUse = macToolUseService.getById(Long.valueOf(prMacTooUseSpec.getMtuId())); |
|
|
|
|
WorkPlan prWorkPlan = baseMapper.selectById(prMacToolUse.getWpId()); |
|
|
|
|
prWorkPlan.setBindStatus(WorkPlan.BIND_STATUS_FREE); |
|
|
|
|
baseMapper.updateById(prWorkPlan); |
|
|
|
|
|
|
|
|
|
List<PrMacTooUseSpec> macTooUseSpecList = unBingDeviceVo.getList(); |
|
|
|
|
Date oneData = unBingDeviceVo.getOneData(); |
|
|
|
|
String tempSlot = unBingDeviceVo.getTempSlot(); |
|
|
|
|
String twoData = unBingDeviceVo.getTwoData(); |
|
|
|
|
Date threeData = unBingDeviceVo.getThreeData(); |
|
|
|
|
String dataFourteen = unBingDeviceVo.getDataFourteen(); |
|
|
|
|
// macTooUseSpecList的mtuId转换为list
|
|
|
|
|
List<MacToolUse> macToolUses = macToolUseService.listByIds(macTooUseSpecList.stream().map(PrMacTooUseSpec::getMtuId).toList()); |
|
|
|
|
List<WorkPlan> workPlans = this.listByIds(macToolUses.stream().map(MacToolUse::getWpId).filter(Objects::nonNull).collect(Collectors.toList())); |
|
|
|
|
if (CollectionUtils.isNotEmpty(workPlans)) { |
|
|
|
|
workPlans.forEach(workPlan -> workPlan.setBindStatus(WorkPlan.BIND_STATUS_FREE)); |
|
|
|
|
this.updateBatchById(workPlans); |
|
|
|
|
} |
|
|
|
|
for (MacToolUse macToolUse : macToolUses) { |
|
|
|
|
List<MesQcProduceRunEntity> qcProduceRuns = mesQcProduceRunService.list(Wrappers.<MesQcProduceRunEntity>lambdaQuery(). |
|
|
|
|
eq(MesQcProduceRunEntity::getMtnCode, prMacToolUse.getMtnCode())); |
|
|
|
|
eq(MesQcProduceRunEntity::getMtnCode, macToolUse.getMtnCode()) |
|
|
|
|
.and(q -> q.notLike(MesQcProduceRunEntity::getWorkSlot, "入料区").or().isNull(MesQcProduceRunEntity::getWorkSlot))); |
|
|
|
|
|
|
|
|
|
if (qcProduceRuns == null || qcProduceRuns.size() == 0) { |
|
|
|
|
if (CollectionUtils.isEmpty(qcProduceRuns)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (qcProduceRuns != null && qcProduceRuns.size() > 0) { |
|
|
|
|
for (MesQcProduceRunEntity qcProduceRun : qcProduceRuns) { |
|
|
|
|
qcProduceRun.setOutDate(DateUtil.now()); |
|
|
|
|
if (unBingDeviceVo.getOneData() != null) { |
|
|
|
|
if (oneData != null) { |
|
|
|
|
qcProduceRun.setDataThirteen(DateUtil.now()); // 保温开始时间
|
|
|
|
|
} |
|
|
|
|
if (unBingDeviceVo.getThreeData() != null) { |
|
|
|
|
if (threeData != null) { |
|
|
|
|
qcProduceRun.setDataTwelve(DateUtil.now()); // 保温结束时间
|
|
|
|
|
} |
|
|
|
|
qcProduceRun.setTempSlot(unBingDeviceVo.getTempSlot()); // 退火温度
|
|
|
|
|
qcProduceRun.setDataFourteen(unBingDeviceVo.getDataFourteen()); // 退火温度
|
|
|
|
|
qcProduceRun.setDataTwo(unBingDeviceVo.getTwoData()); // 保温温度
|
|
|
|
|
qcProduceRun.setTempSlot(tempSlot); // 退火温度
|
|
|
|
|
qcProduceRun.setDataFourteen(dataFourteen); // 退火温度
|
|
|
|
|
qcProduceRun.setDataTwo(twoData); // 保温温度
|
|
|
|
|
|
|
|
|
|
mesQcProduceRunService.updateById(qcProduceRun); |
|
|
|
|
// 获取设备所需参数
|
|
|
|
|
// 如果没有填写退火温度
|
|
|
|
|
if (StringUtils.isBlank(unBingDeviceVo.getTempSlot())) { |
|
|
|
|
// macToolUseService.setSjDataCapture(qcProduceRun, Boolean.TRUE); //todo
|
|
|
|
|
if (StringUtils.isBlank(tempSlot)) { |
|
|
|
|
// todo 第三方获取
|
|
|
|
|
// macToolUseService.setSjDataCapture(qcProduceRun, Boolean.TRUE);
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
mesQcProduceRunService.updateBatchById(qcProduceRuns); |
|
|
|
|
macToolUse.setFinished(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
prMacToolUse.setFinished(1); |
|
|
|
|
String deviceCode = prMacToolUse.getEquipmentCard() != null ? prMacToolUse.getMtnCode() : ""; |
|
|
|
|
log.info("修改设备绑定状态:设备编号:{},批次号:{},槽号:{},方法名:sjDeviceUnBind(),{}", deviceCode, prMacToolUse.getHangNum(), prMacToolUse.getMtnCode(), prMacToolUse.getFinished()); |
|
|
|
|
macToolUseService.updateById(prMacToolUse); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
macToolUseService.updateBatchById(macToolUses); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -484,7 +491,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
this.completeOrder(rr, AuthUtil.getUserName()); |
|
|
|
|
} |
|
|
|
|
String memo = ""; |
|
|
|
|
List<PrReworkProcessEntity> rpList = listByReworkCode(rr.getRedono(), rr.getSeqno(), rr.getPrtno(), rr.getSplcode()); |
|
|
|
|
List<PrReworkProcessEntity> rpList = dsPartService.selectReworkPartCraft(rr.getPrtno(), rr.getRedono(), rr.getSplcode(), String.valueOf(rr.getSeqno())); |
|
|
|
|
if (rpList == null && rpList.size() == 0) { |
|
|
|
|
//修改erp返工单工艺状态为无工艺
|
|
|
|
|
//prReworkProcessDao.receiveOrder(rr, user.getLdapName(), 0);
|
|
|
|
|
|