|
|
|
@ -21,9 +21,7 @@ import org.springblade.desk.produce.pojo.entity.*; |
|
|
|
import org.springblade.desk.produce.pojo.vo.*; |
|
|
|
import org.springblade.desk.produce.pojo.vo.*; |
|
|
|
import org.springblade.desk.produce.service.*; |
|
|
|
import org.springblade.desk.produce.service.*; |
|
|
|
import org.springblade.desk.quality.pojo.entity.ProReTemplate; |
|
|
|
import org.springblade.desk.quality.pojo.entity.ProReTemplate; |
|
|
|
import org.springblade.desk.quality.service.IProReTemplateDetailService; |
|
|
|
|
|
|
|
import org.springblade.desk.quality.service.IProReTemplateService; |
|
|
|
import org.springblade.desk.quality.service.IProReTemplateService; |
|
|
|
import org.springblade.desk.quality.service.IProReTemplateTankService; |
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
@ -385,6 +383,7 @@ public class ProcessQualityMaintenanceServiceImpl implements IProcessQualityMain |
|
|
|
throw new ServiceException("未找到维护的数据!!!"); |
|
|
|
throw new ServiceException("未找到维护的数据!!!"); |
|
|
|
} |
|
|
|
} |
|
|
|
MesQcProduceRunEntity qcProduceRunOld = null; |
|
|
|
MesQcProduceRunEntity qcProduceRunOld = null; |
|
|
|
|
|
|
|
List<MesQcProduceRunEntity> qcProduceRunsListIndexOne = new ArrayList<>(); |
|
|
|
for (ProduceMonitorFileSlotVO dsRbFilePreserveSlot : preserveSlotList) { |
|
|
|
for (ProduceMonitorFileSlotVO dsRbFilePreserveSlot : preserveSlotList) { |
|
|
|
for (MesQcProduceRunEntity qcProduceRun : qcProduceRunsList) { |
|
|
|
for (MesQcProduceRunEntity qcProduceRun : qcProduceRunsList) { |
|
|
|
if (dsRbFilePreserveSlot.getSlotName().equals(qcProduceRun.getWorkSlot())) { |
|
|
|
if (dsRbFilePreserveSlot.getSlotName().equals(qcProduceRun.getWorkSlot())) { |
|
|
|
@ -393,10 +392,9 @@ public class ProcessQualityMaintenanceServiceImpl implements IProcessQualityMain |
|
|
|
} |
|
|
|
} |
|
|
|
List<MesRbFilePreserveDetailEntity> childrenList = dsRbFilePreserveSlot.getChildrenList(); |
|
|
|
List<MesRbFilePreserveDetailEntity> childrenList = dsRbFilePreserveSlot.getChildrenList(); |
|
|
|
this.savePreserveSlotList(childrenList, qcProduceRunOld, dsRbFilePreserveSlot.getRfpsType()); |
|
|
|
this.savePreserveSlotList(childrenList, qcProduceRunOld, dsRbFilePreserveSlot.getRfpsType()); |
|
|
|
|
|
|
|
qcProduceRunsListIndexOne.add(qcProduceRunOld); |
|
|
|
qcProduceRunService.updateById(qcProduceRunOld); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return qcProduceRunService.updateBatchById(qcProduceRunsListIndexOne); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@ -404,6 +402,70 @@ public class ProcessQualityMaintenanceServiceImpl implements IProcessQualityMain |
|
|
|
return macToolUseService.getMaterialMess(goodsCode); |
|
|
|
return macToolUseService.getMaterialMess(goodsCode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
|
|
public boolean saveRetrospectDefend(EleFilesEditVO eleFilesEditVO) { |
|
|
|
|
|
|
|
WorkPlan prWorkPlan; |
|
|
|
|
|
|
|
EquipmentEntity equipmentCard = mesEquipmentCardService.getById(eleFilesEditVO.getEcId()); |
|
|
|
|
|
|
|
MacToolUse prMacToolUse; |
|
|
|
|
|
|
|
List<MesQcProduceRunEntity> produceRunList; |
|
|
|
|
|
|
|
String code = macToolUseService.nextCode(2); |
|
|
|
|
|
|
|
for (Long wpId : eleFilesEditVO.getWpIdList()) { |
|
|
|
|
|
|
|
prWorkPlan = workPlanService.getById(wpId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prWorkPlan.setPrintType((short) 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!prWorkPlan.getStatus().equals(WorkPlan.STATUS_START)) { |
|
|
|
|
|
|
|
throw new ServiceException("流程卡为 " + prWorkPlan.getCaId() + " 的订单对应的工序不在加工中暂时不可再维护!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 查询自动生产追溯是否已经开始
|
|
|
|
|
|
|
|
produceRunList = qcProduceRunService.listPrByWpIdIndex(wpId, 2, Boolean.FALSE); |
|
|
|
|
|
|
|
// 上线前 没有生产追溯数据
|
|
|
|
|
|
|
|
if (eleFilesEditVO.getLine().equals(Boolean.TRUE)) { |
|
|
|
|
|
|
|
if (produceRunList != null && !produceRunList.isEmpty()) { |
|
|
|
|
|
|
|
throw new ServiceException("流程卡为 " + prWorkPlan.getCaId() + " 的订单对应的工序已经在已上线,不可再维护!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (eleFilesEditVO.getLine().equals(Boolean.FALSE)) { |
|
|
|
|
|
|
|
// 下线后 有自动生产追溯数据
|
|
|
|
|
|
|
|
if (produceRunList.isEmpty()) { |
|
|
|
|
|
|
|
throw new ServiceException("流程卡为 " + prWorkPlan.getId() + " 的订单对应的工序还未下线,不可再维护!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
MacToolUse macToolUse = macToolUseService.getDataByWpIdAndIndex(wpId, String.valueOf(2)); |
|
|
|
|
|
|
|
if (macToolUse != null && macToolUse.getRfpId() != null && macToolUse.getFinished() != 1) { |
|
|
|
|
|
|
|
macToolUse.setFinished(1); |
|
|
|
|
|
|
|
String deviceCode = macToolUse.getEquipmentCard() != null ? macToolUse.getMtnCode() : ""; |
|
|
|
|
|
|
|
log.info("修改设备绑定状态:设备编号:{},批次号:{},槽号:{},方法名:saveRetrospectDefend(),{}", deviceCode, macToolUse.getHangNum(), macToolUse.getMtnCode(), macToolUse.getFinished()); |
|
|
|
|
|
|
|
macToolUseService.updateById(macToolUse); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 创建一条绑定记录
|
|
|
|
|
|
|
|
prMacToolUse = new MacToolUse(); |
|
|
|
|
|
|
|
prMacToolUse.setWpId(prWorkPlan.getId()); |
|
|
|
|
|
|
|
prMacToolUse.setEquipmentCard(equipmentCard.getId()); |
|
|
|
|
|
|
|
prMacToolUse.setFinished(1); |
|
|
|
|
|
|
|
prMacToolUse.setCreateMan(AuthUtil.getUserId()); |
|
|
|
|
|
|
|
prMacToolUse.setBindTime(new Date()); |
|
|
|
|
|
|
|
prMacToolUse.setRfpId(eleFilesEditVO.getRfpId().toString()); |
|
|
|
|
|
|
|
prMacToolUse.setMtnCode(code); |
|
|
|
|
|
|
|
prMacToolUse.setMtuIndex(String.valueOf(eleFilesEditVO.getLine() ? 1 : 3)); |
|
|
|
|
|
|
|
macToolUseService.save(prMacToolUse); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<ProduceMonitorFileSlotVO> preserveSlotList = eleFilesEditVO.getProduceMonitorFileSlotVOList(); |
|
|
|
|
|
|
|
MesQcProduceRunEntity qcProduceRun; |
|
|
|
|
|
|
|
List<MesQcProduceRunEntity> qcProduceRunList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (ProduceMonitorFileSlotVO mesRbFilePreserveSlotEntity : preserveSlotList) { |
|
|
|
|
|
|
|
qcProduceRun = new MesQcProduceRunEntity(); |
|
|
|
|
|
|
|
qcProduceRun.setMtnCode(code); |
|
|
|
|
|
|
|
qcProduceRun.setDeviceId(equipmentCard.getDeviceCode()); |
|
|
|
|
|
|
|
qcProduceRun.setWorkSlot(mesRbFilePreserveSlotEntity.getSlotName()); |
|
|
|
|
|
|
|
List<MesRbFilePreserveDetailEntity> childrenList = mesRbFilePreserveSlotEntity.getChildrenList(); |
|
|
|
|
|
|
|
this.savePreserveSlotList(childrenList, qcProduceRun, mesRbFilePreserveSlotEntity.getRfpsType()); |
|
|
|
|
|
|
|
qcProduceRunList.add(qcProduceRun); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
qcProduceRunService.saveBatch(qcProduceRunList); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void savePreserveSlotList(List<MesRbFilePreserveDetailEntity> childrenList, MesQcProduceRunEntity qcProduceRun, Short rfpsType) { |
|
|
|
private void savePreserveSlotList(List<MesRbFilePreserveDetailEntity> childrenList, MesQcProduceRunEntity qcProduceRun, Short rfpsType) { |
|
|
|
for (int i = 0; i < childrenList.size(); i++) { |
|
|
|
for (int i = 0; i < childrenList.size(); i++) { |
|
|
|
MesRbFilePreserveDetailEntity dsRbFilePreserveDetail = childrenList.get(i); |
|
|
|
MesRbFilePreserveDetailEntity dsRbFilePreserveDetail = childrenList.get(i); |
|
|
|
|