|
|
|
@ -0,0 +1,71 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesEnumDetailService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesProdShiftRecordService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCcscTask;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEnumDetail;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 枚举明细配置
|
|
|
|
|
* @Author: gsz
|
|
|
|
|
* @Date: 2024/5/21 14:16
|
|
|
|
|
* @Modify:
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MesProdShiftRecordServiceImpl extends BaseMesService<MesProdShiftRecord> implements IMesProdShiftRecordService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void setPackQueryBean(MesProdShiftRecord bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShiftGroup(), "shiftGroup", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShiftCode(), "shiftCode", packBean);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public MesProdShiftRecord insert(MesProdShiftRecord item) {
|
|
|
|
|
if(StringUtil.isEmpty(item.getStartTime())){
|
|
|
|
|
item.setWorkStatus(MesExtEnumUtil.WORK_STATUS.END.getValue());
|
|
|
|
|
}else if(StringUtil.isEmpty(item.getEndTime())){
|
|
|
|
|
item.setWorkStatus(MesExtEnumUtil.WORK_STATUS.START.getValue());
|
|
|
|
|
}
|
|
|
|
|
return baseRDao.insert(item);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void onInsertBean(MesProdShiftRecord item) {
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getOrganizeCode(), "工厂号不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getWorkCenterCode(), "workCenterCode不能为空" );
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShiftGroup(), "shiftGroup不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShiftCode(), "shiftCode不能为空");
|
|
|
|
|
|
|
|
|
|
//唯一性校验
|
|
|
|
|
// DdlPackBean packBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
// DdlPreparedPack.getStringEqualPack(item.getWorkCenterCode(), "workCenterCode", packBean);
|
|
|
|
|
// DdlPreparedPack.getStringEqualPack(item.getShiftGroup(), "shiftGroup", packBean);
|
|
|
|
|
// DdlPreparedPack.getStringEqualPack(item.getShiftCode(), "shiftCode", packBean);
|
|
|
|
|
//
|
|
|
|
|
// boolean flg = baseRDao.isExitByHql(packBean);
|
|
|
|
|
// if (flg) {
|
|
|
|
|
// throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
// .setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
// .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
// .setErrorDetail("开关班记录产线【%s】班组代码【%s】班次代码【%s】已经存在,请检查数据",
|
|
|
|
|
// item.getWorkCenterCode(),item.getShiftGroup(),item.getShiftCode())
|
|
|
|
|
// .build();
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|