|
|
@ -1,10 +1,11 @@
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base;
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesEquipmentExtService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.platform.common.util.MesConstWords;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
@ -13,12 +14,16 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesConfigRepository;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesDowntimeRecordRepository;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesProdShiftRecordRepository;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesWcEquipmentRepository;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -37,16 +42,19 @@ public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesProdShiftRecordRepository mesProdShiftRecordRDao;
|
|
|
|
private MesProdShiftRecordRepository mesProdShiftRecordRDao;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesConfigRepository configRepository;
|
|
|
|
private MesConfigRepository configRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesDowntimeRecordRepository mesDowntimeRecordRDao;
|
|
|
|
private MesDowntimeRecordRepository mesDowntimeRecordRDao;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesEquipmentRepository mesEquipmentRDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesWcEquipmentRepository wcEquipmentRepository;
|
|
|
|
private MesWcEquipmentRepository wcEquipmentRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IMesEquipmentExtService mesEquipmentExtService;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ListPager<MesProdShiftRecord> queryMesProdShiftRecordByPager(MesProdShiftRecord bean, Pager pager) {
|
|
|
|
public ListPager<MesProdShiftRecord> queryMesProdShiftRecordByPager(MesProdShiftRecord bean, Pager pager) {
|
|
|
|
|
|
|
|
|
|
|
@ -129,16 +137,12 @@ public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService
|
|
|
|
List<MesWcEquipment> wcEquipmentDbList = wcEquipmentRepository.findByProperty(
|
|
|
|
List<MesWcEquipment> wcEquipmentDbList = wcEquipmentRepository.findByProperty(
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.WORK_CENTER_CODE},
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.WORK_CENTER_CODE},
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), item.getWorkCenterCode()});
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), item.getWorkCenterCode()});
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(wcEquipmentDbList)) {
|
|
|
|
|
|
|
|
MesPcnException.throwMesBusiException("产线【%s】工位设备信息不存在", item.getWorkCenterCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
for (MesWcEquipment mesWcEquipment : wcEquipmentDbList) {
|
|
|
|
for (MesWcEquipment mesWcEquipment : wcEquipmentDbList) {
|
|
|
|
MesEquipment mesEquipment = mesEquipmentRDao.getByProperty(
|
|
|
|
|
|
|
|
new String[]{MesConstWords.ORGANIZE_CODE, MesPcnExtConstWords.EQUIPMENT_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID},
|
|
|
|
|
|
|
|
new Object[]{organizeCode, mesWcEquipment.getEquipmentCode(),
|
|
|
|
|
|
|
|
CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(),
|
|
|
|
|
|
|
|
CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBeanDowntime = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
DdlPackBean ddlPackBeanDowntime = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
DdlPreparedPack.getStringEqualPack(mesEquipment.getEquipmentCode(), "equipmentCode", ddlPackBeanDowntime);
|
|
|
|
DdlPreparedPack.getStringEqualPack(mesWcEquipment.getEquipmentCode(), "equipmentCode", ddlPackBeanDowntime);
|
|
|
|
if (!StringUtil.isEmpty(reason)) {
|
|
|
|
if (!StringUtil.isEmpty(reason)) {
|
|
|
|
DdlPreparedPack.getStringEqualPack(reason, "reasonCode", ddlPackBeanDowntime);
|
|
|
|
DdlPreparedPack.getStringEqualPack(reason, "reasonCode", ddlPackBeanDowntime);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -146,7 +150,11 @@ public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService
|
|
|
|
DdlPreparedPack.getStringEqualPack(type, "reasonTypeCode", ddlPackBeanDowntime);
|
|
|
|
DdlPreparedPack.getStringEqualPack(type, "reasonTypeCode", ddlPackBeanDowntime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MesDowntimeRecord mesDowntimeRecordDao = mesDowntimeRecordRDao.getByProperty(ddlPackBeanDowntime);
|
|
|
|
MesDowntimeRecord mesDowntimeRecordDao = mesDowntimeRecordRDao.getByProperty(ddlPackBeanDowntime);
|
|
|
|
if (StringUtil.isEmpty(mesDowntimeRecordDao)) {
|
|
|
|
if (Objects.isNull(mesDowntimeRecordDao)) {
|
|
|
|
|
|
|
|
MesEquipment mesEquipment = mesEquipmentExtService.getMesEquipment(organizeCode, mesWcEquipment.getEquipmentCode());
|
|
|
|
|
|
|
|
if (Objects.isNull(mesEquipment)) {
|
|
|
|
|
|
|
|
MesPcnException.throwMesBusiException("设备【%s】信息不存在", mesWcEquipment.getEquipmentCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
//新增设备停机记录
|
|
|
|
//新增设备停机记录
|
|
|
|
MesDowntimeRecord mesDowntimeRecord = new MesDowntimeRecord();
|
|
|
|
MesDowntimeRecord mesDowntimeRecord = new MesDowntimeRecord();
|
|
|
|
mesDowntimeRecord.setOrganizeCode(organizeCode);
|
|
|
|
mesDowntimeRecord.setOrganizeCode(organizeCode);
|
|
|
|