|
|
|
@ -114,6 +114,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesPartService mesPartService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesWorkCenterPartRelationRepository workCenterPartRelationRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) {
|
|
|
|
|
|
|
|
|
@ -469,8 +472,30 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
|
|
|
|
|
if (version != null) {
|
|
|
|
|
srcLocateNo = version.getReceiveInventoryPoint();
|
|
|
|
|
} else {
|
|
|
|
|
//当前为初判, 生产版本不存在的情况下, 取生产线信息的材料库位, 如果没有加工记录,生产线使用产线与零件关系表的唯一生产线
|
|
|
|
|
String workCenterCode;
|
|
|
|
|
if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
|
|
|
|
|
if (null == produceSn || StringUtils.isEmpty(produceSn.getProcessCode())) {
|
|
|
|
|
List<MesWorkCenterPartRelation> workCenterPartRelationList = getWorkCenterPartRelation(org, model.getPartNo());
|
|
|
|
|
if (CollectionUtils.isEmpty(workCenterPartRelationList) || workCenterPartRelationList.size() > 1 || StringUtils.isEmpty(workCenterPartRelationList.get(0).getWorkCenterCode())) {
|
|
|
|
|
throw new ImppBusiException(String.format("条码[%s]未查询到有效的来源库位!", model.getSn()));
|
|
|
|
|
}
|
|
|
|
|
workCenterCode = workCenterPartRelationList.get(0).getWorkCenterCode();
|
|
|
|
|
} else {
|
|
|
|
|
workCenterCode = produceSn.getWorkCenterCode();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
workCenterCode = model.getWorkCenterCode();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MesWorkCenter workCenter = prodOrgExtService.getWorkCenterDb(org, workCenterCode);
|
|
|
|
|
if (null == workCenter) throw new ImppBusiException(String.format("条码[%s]查询来源库位时获取的生产线代码[%s]信息不存在!", model.getSn(), workCenterCode));
|
|
|
|
|
if (StringUtils.isEmpty(workCenter.getRawLocate())) throw new ImppBusiException(String.format("条码[%s]查询来源库位时获取的生产线代码[%s]信息未维护[材料库位]!", model.getSn(), workCenterCode));
|
|
|
|
|
srcLocateNo = workCenter.getRawLocate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (model.getOptType() != 2) {
|
|
|
|
|
//移库
|
|
|
|
|
//移库
|
|
|
|
@ -487,8 +512,6 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(model.getPartInspection(), AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
if (model.getOptType() != null && model.getOptType() == 2) {
|
|
|
|
@ -524,7 +547,6 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】位置不存在,请检查数据", defectTypeNoExitList));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//若是扫描条码 则判定条码可疑
|
|
|
|
|
if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
|
|
|
|
|
|
|
|
|
@ -583,12 +605,20 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<MesWorkCenterPartRelation> getWorkCenterPartRelation(String org, String partNo) {
|
|
|
|
|
return workCenterPartRelationRepository.findByProperty(
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.PART_NO},
|
|
|
|
|
new Object[]{org, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), partNo});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MesWorkOrder getWorkOrder(String organizeCode, String workOrderNo) {
|
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workOrderNo)) return null;
|
|
|
|
|
return workOrderRepository.getByProperty(
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.WORK_ORDER_NO},
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workOrderNo});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getDestLocateNo(MesPartInspectionInputModel model, String org) {
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(model.getSn(), "productSn", packBean);
|
|
|
|
@ -1082,18 +1112,25 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
// 查询生产版本
|
|
|
|
|
String workCenterCode = model.getWorkCenterCode();
|
|
|
|
|
String productVersion = model.getProductVersion();
|
|
|
|
|
|
|
|
|
|
MesProductVersion version = null;
|
|
|
|
|
if (!StringUtils.isEmpty(productVersion)) {
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(partNo, "partNo", ddlPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", ddlPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(productVersion, "productVersion", ddlPackBean);
|
|
|
|
|
|
|
|
|
|
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
|
|
|
|
|
version = productVersionRepository.getByProperty(ddlPackBean);
|
|
|
|
|
if (version != null) {
|
|
|
|
|
source = version.getShipInventoryPoint();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生产版本不存在的情况下, 取生产线信息的材料库位
|
|
|
|
|
if (null == version) {
|
|
|
|
|
MesWorkCenter workCenter = prodOrgExtService.getWorkCenterDb(org, workCenterCode);
|
|
|
|
|
if (null != workCenter && !StringUtils.isEmpty(workCenter.getRawLocate())) source = workCenter.getRawLocate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MesMove move = createMove(model, source, configService.getCfgValue(org, "UMLGO"), org, model.getWorkCenterCode());
|
|
|
|
|
moveRepository.insert(move);
|
|
|
|
|
}
|
|
|
|
|