|
|
@ -16,6 +16,7 @@ import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
|
|
|
|
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.tool.TimeTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
|
|
|
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.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
@ -132,6 +133,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesWorkCellRepository workCellRDao;
|
|
|
|
private MesWorkCellRepository workCellRDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesWorkCenterRepository mesWorkCenterRDao;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model) {
|
|
|
|
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model) {
|
|
|
|
|
|
|
|
|
|
|
@ -145,6 +149,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
ValidatorBean.checkNotNull(model.getFrontBack(), "正反面不能为空");
|
|
|
|
ValidatorBean.checkNotNull(model.getFrontBack(), "正反面不能为空");
|
|
|
|
//检查条码
|
|
|
|
//检查条码
|
|
|
|
MesProduceSn produceSn = checkProduceSn(model.getSn(), model.getOrganizeCode());
|
|
|
|
MesProduceSn produceSn = checkProduceSn(model.getSn(), model.getOrganizeCode());
|
|
|
|
|
|
|
|
checkOtherWorkCell(produceSn, model, model.getOrganizeCode());
|
|
|
|
|
|
|
|
|
|
|
|
//获取NC-零件检测-单据
|
|
|
|
//获取NC-零件检测-单据
|
|
|
|
partInspection = getPartInspection(produceSn, model, model.getOrganizeCode());
|
|
|
|
partInspection = getPartInspection(produceSn, model, model.getOrganizeCode());
|
|
|
@ -252,7 +257,6 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
if (!StringUtil.isEmpty(produceSn)){
|
|
|
|
if (!StringUtil.isEmpty(produceSn)){
|
|
|
|
model.setCustSn(produceSn.getCustSn());
|
|
|
|
model.setCustSn(produceSn.getCustSn());
|
|
|
|
model.setSn(produceSn.getProductSn());
|
|
|
|
model.setSn(produceSn.getProductSn());
|
|
|
|
model.setWorkCenterCode(produceSn.getWorkCenterCode());
|
|
|
|
|
|
|
|
//排序产线 更新工单的 qcStatus
|
|
|
|
//排序产线 更新工单的 qcStatus
|
|
|
|
MesWorkCenter centerDb = prodOrgExtService.getWorkCenterDb(model.getOrganizeCode(), produceSn.getWorkCenterCode());
|
|
|
|
MesWorkCenter centerDb = prodOrgExtService.getWorkCenterDb(model.getOrganizeCode(), produceSn.getWorkCenterCode());
|
|
|
|
if (!StringUtil.isEmpty(centerDb)){
|
|
|
|
if (!StringUtil.isEmpty(centerDb)){
|
|
|
@ -797,6 +801,48 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 检查条码是否在其他工位判为不良
|
|
|
|
|
|
|
|
* @param produceSn 条码
|
|
|
|
|
|
|
|
* @param inputModel 前端传入参数
|
|
|
|
|
|
|
|
* @param org 工厂代码
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void checkOtherWorkCell(MesProduceSn produceSn,MesPartInspectionInputModel inputModel, String org) {
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(inputModel.getWorkCellCode())) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int refundFlag = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
|
|
|
|
|
|
|
|
if (inputModel.getOptType() == 2) {
|
|
|
|
|
|
|
|
refundFlag = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据条码找最近一条单据
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(produceSn.getProductSn(), "sn", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringNoEqualPack(inputModel.getWorkCellCode(), "workCellCode", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringNotBlanklPack("workCellCode", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(refundFlag, "refundFlag", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), "inspectionStatus", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
|
|
|
|
|
|
|
|
MesPartInspection partInspection = partInspectionRepository.getByProperty(packBean);
|
|
|
|
|
|
|
|
if (partInspection != null) {
|
|
|
|
|
|
|
|
MesWorkCenter mesWorkCenter = null;
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(partInspection.getWorkCenterCode())) {
|
|
|
|
|
|
|
|
mesWorkCenter = mesWorkCenterRDao.getByProperty(
|
|
|
|
|
|
|
|
new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID, "workCenterCode"},
|
|
|
|
|
|
|
|
new Object[]{org, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), partInspection.getWorkCenterCode()});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
final String workCenterName = mesWorkCenter != null ? mesWorkCenter.getWorkCenterName() : partInspection.getWorkCenterCode();
|
|
|
|
|
|
|
|
MesWorkCell mesWorkCell = workCellRDao.getByProperty(new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID, "workCellCode"},
|
|
|
|
|
|
|
|
new Object[]{org, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), partInspection.getWorkCellCode()});
|
|
|
|
|
|
|
|
final String workCellName = mesWorkCell != null ? mesWorkCell.getWorkCellName() : partInspection.getWorkCellCode();
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance().setErrorCode(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail(String.format("【%s】条码在产线【%s】工位【%s】判为不良,请检查数据", partInspection.getSn(), workCenterName, workCellName))
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取NC-零件检测-单据
|
|
|
|
* 获取NC-零件检测-单据
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param inputModel
|
|
|
|
* @param inputModel
|
|
|
|