|
|
|
@ -71,7 +71,17 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesNcProcessingDao ncProcessingDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesProduceSnRepository produceSnRepository;
|
|
|
|
|
|
|
|
|
|
/***
|
|
|
|
|
* 查询产品条码或零件号
|
|
|
|
|
* @param serialNumber
|
|
|
|
|
* @param partNo
|
|
|
|
|
* @param lot
|
|
|
|
|
* @param org
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public MesNcProcessingModel queryProduceSn(String serialNumber, String partNo, String lot, String org) {
|
|
|
|
|
|
|
|
|
@ -144,6 +154,13 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查物料
|
|
|
|
|
*
|
|
|
|
|
* @param defectRecordList
|
|
|
|
|
* @param org
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private MesPart checkPart(List<MesDefectRecord> defectRecordList, String org) {
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
@ -178,6 +195,13 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
return part;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查不良条码
|
|
|
|
|
*
|
|
|
|
|
* @param serialNumber
|
|
|
|
|
* @param org
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
private List<MesDefectRecord> queryDefectRecordBySerialNumber(String serialNumber, String org) {
|
|
|
|
|
|
|
|
|
@ -336,6 +360,15 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type == MesExtEnumUtil.NC_TYPE.NORMAL.getValue() || type == MesExtEnumUtil.NC_TYPE.RELEASE.getValue()) {
|
|
|
|
|
|
|
|
|
|
String serialNumber = defectRecordList.get(0).getSerialNumber();
|
|
|
|
|
|
|
|
|
|
MesProduceSn sn = checkProduceSn(serialNumber, org);
|
|
|
|
|
sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
|
|
|
|
sn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
produceSnRepository.save(sn);
|
|
|
|
|
|
|
|
|
|
MesMove move = new MesMove();
|
|
|
|
|
move.setMatnr(part.getPartNo());
|
|
|
|
|
move.setOrganizeCode(org);
|
|
|
|
@ -359,4 +392,31 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
|
|
|
|
|
defectRecordRepository.saveAll(defectRecordList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MesProduceSn checkProduceSn(String serialNumber, String org) {
|
|
|
|
|
//根据扫描的条码查询条码是否存在
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(serialNumber, "productSn", packBean);
|
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
|
|
|
|
|
MesProduceSn produceSn = produceSnRepository.getByProperty(packBean);
|
|
|
|
|
|
|
|
|
|
//若不存在则提示条码不存在
|
|
|
|
|
if (StringUtils.isEmpty(produceSn)) {
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】此条码不存在,请检查数据", serialNumber));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据条码状态判断 是不是已下线条码
|
|
|
|
|
//若不是已下线的条码则提示 条码状态 请选择已下线的条码
|
|
|
|
|
if (produceSn.getSnStatus() != MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue()) {
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】此条码状态为【%s】,请选择状态为【%s】状态的条码", serialNumber, MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(produceSn.getSnStatus()),
|
|
|
|
|
MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getDescription()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//是否需要判断条码质量状态
|
|
|
|
|
if (produceSn.getQcStatus() != MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()) {
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】此条码质量状态为【%s】,请选择【%s】状态的条码", serialNumber, MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(produceSn.getQcStatus()),
|
|
|
|
|
MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getDescription()));
|
|
|
|
|
}
|
|
|
|
|
return produceSn;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|