|
|
@ -19,6 +19,7 @@ import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTask;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTask;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTaskDetail;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
@ -31,6 +32,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
@ -82,6 +84,11 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
private MesPartInspectionDetailRepository partInspectionDetailRepository;
|
|
|
|
private MesPartInspectionDetailRepository partInspectionDetailRepository;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesReworkTaskRepository reworkTaskRepository;
|
|
|
|
private MesReworkTaskRepository reworkTaskRepository;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesReworkTaskDetailRepository reworkTaskDetailRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesDefectTypeRepository defectTypeRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -127,11 +134,20 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
|
|
|
|
|
|
|
//构造返回结果
|
|
|
|
//构造返回结果
|
|
|
|
MesNcProcessingModel model = getModel(part, detailList, partInspection.getOrganizeCode());
|
|
|
|
MesNcProcessingModel model = getModel(part, detailList, partInspection.getOrganizeCode());
|
|
|
|
|
|
|
|
model.setPartInspection(partInspection);
|
|
|
|
return model;
|
|
|
|
return model;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MesDefectType> queryPerson(String org) {
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.RESPONSIBILITY.getValue(), "", packBean);
|
|
|
|
|
|
|
|
List<MesDefectType> defectTypeList = defectTypeRepository.findByHqlWhere(packBean);
|
|
|
|
|
|
|
|
return defectTypeList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ListPager<MesNcProcessingPartAndLotModel> queryPartLot(String partNo, String lot, String org, Pager pager) {
|
|
|
|
public ListPager<MesNcProcessingPartAndLotModel> queryPartLot(String partNo, String lot, String org, Pager pager) {
|
|
|
|
|
|
|
|
|
|
|
|
pager = PagerHelper.getPager(pager, ncProcessingDao.queryDefectRecordByPagerCount(partNo, lot, org));
|
|
|
|
pager = PagerHelper.getPager(pager, ncProcessingDao.queryDefectRecordByPagerCount(partNo, lot, org));
|
|
|
@ -145,27 +161,18 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
public void saveNc(MesNcProcessingInputModel model, String org) {
|
|
|
|
public void saveNc(MesNcProcessingInputModel model, String org) {
|
|
|
|
|
|
|
|
|
|
|
|
if (model.getPartInspection().getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
|
|
|
|
if (model.getPartInspection().getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
|
|
|
|
String serialNumber = model.getPartInspection().getSn();
|
|
|
|
|
|
|
|
Integer type = model.getType();
|
|
|
|
Integer type = model.getType();
|
|
|
|
Integer person = model.getPerson();
|
|
|
|
MesDefectType person = model.getPerson();
|
|
|
|
|
|
|
|
|
|
|
|
//检查物料
|
|
|
|
|
|
|
|
MesPart part = checkPartByPartNo(model.getPartInspection().getPartNo(), org);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存数据
|
|
|
|
//保存数据
|
|
|
|
saveDate(model, part, type, person, org);
|
|
|
|
saveDate(model, model.getPart(), type, person, org);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
String partNo = model.getPartInspection().getPartNo();
|
|
|
|
|
|
|
|
String lot = model.getPartInspection().getLot();
|
|
|
|
|
|
|
|
Integer type = model.getType();
|
|
|
|
Integer type = model.getType();
|
|
|
|
Integer person = model.getPerson();
|
|
|
|
MesDefectType person = model.getPerson();
|
|
|
|
|
|
|
|
|
|
|
|
//检查物料
|
|
|
|
|
|
|
|
MesPart part = checkPartByPartNo(partNo, org);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存数据
|
|
|
|
//保存数据
|
|
|
|
saveDate(model, part, type, person, org);
|
|
|
|
saveDate(model, model.getPart(), type, person, org);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -210,58 +217,6 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
return part;
|
|
|
|
return part;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 检查不良条码
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param serialNumber
|
|
|
|
|
|
|
|
* @param org
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<MesDefectRecord> queryDefectRecordBySerialNumber(String serialNumber, String org) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询扫描的条码
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(serialNumber, "serialNumber", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(0, "ncType", packBean);
|
|
|
|
|
|
|
|
List<MesDefectRecord> defectRecordList = defectRecordRepository.findByHqlWhere(packBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(defectRecordList)) {
|
|
|
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】此条码不存在可疑品记录或已经过NC处理,请检查数据", serialNumber));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// defectRecordList.forEach(k -> {
|
|
|
|
|
|
|
|
// if (k.getNcType() != 0) {
|
|
|
|
|
|
|
|
// throw new ImppBusiException(String.format("【%s】此条码已经过NC处理,请检查数据", serialNumber));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return defectRecordList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<MesDefectRecord> queryDefectRecordByPartAndLot(String partNo, String Lot, String org) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询扫描的条码
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(partNo, "partNo", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(Lot, "lot", packBean);
|
|
|
|
|
|
|
|
// DdlPreparedPack.getNumEqualPack(0, "ncType", packBean);
|
|
|
|
|
|
|
|
List<MesDefectRecord> defectRecordList = defectRecordRepository.findByHqlWhere(packBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(defectRecordList)) {
|
|
|
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】此物料号+【%s】批次不存在可疑品记录,请检查数据", partNo, Lot));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defectRecordList.forEach(k -> {
|
|
|
|
|
|
|
|
if (k.getNcType() != 0) {
|
|
|
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】此物料号+【%s】批次已经过NC处理,请检查数据", partNo, Lot));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return defectRecordList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MesPartTypePicture checkPartTypePicture(MesPart part, String org) {
|
|
|
|
private MesPartTypePicture checkPartTypePicture(MesPart part, String org) {
|
|
|
|
|
|
|
|
|
|
|
@ -365,49 +320,37 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
* @param person
|
|
|
|
* @param person
|
|
|
|
* @param org
|
|
|
|
* @param org
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void saveDate(MesNcProcessingInputModel model, MesPart part, Integer type, Integer person, String org) {
|
|
|
|
private void saveDate(MesNcProcessingInputModel model, MesPart part, Integer type, MesDefectType person, String org) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type == MesExtEnumUtil.NC_TYPE.NORMAL.getValue()) {
|
|
|
|
if (type == MesExtEnumUtil.NC_TYPE.NORMAL.getValue()) {
|
|
|
|
|
|
|
|
//更新条码质量状态
|
|
|
|
MesProduceSn sn = checkProduceSn(model.getSn(), org);
|
|
|
|
MesProduceSn sn = checkProduceSn(model.getSn(), org);
|
|
|
|
sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
|
|
|
sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
produceSnRepository.save(sn);
|
|
|
|
produceSnRepository.save(sn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新检验单
|
|
|
|
|
|
|
|
model.getPartInspection().setDefectTypeId(person.getId());
|
|
|
|
model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue());
|
|
|
|
model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue());
|
|
|
|
model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.NORMAL.getValue());
|
|
|
|
model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.NORMAL.getValue());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
partInspectionRepository.save(model.getPartInspection());
|
|
|
|
partInspectionRepository.save(model.getPartInspection());
|
|
|
|
|
|
|
|
|
|
|
|
GenSerialNoModel serialNoModel = new GenSerialNoModel("NC_DEFECT_ZRSUM");
|
|
|
|
//移库 转正常
|
|
|
|
serialNoModel.setPartNo(part.getPartNo());
|
|
|
|
MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org);
|
|
|
|
ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1);
|
|
|
|
|
|
|
|
String zrsum = "";
|
|
|
|
|
|
|
|
if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) {
|
|
|
|
|
|
|
|
zrsum = (rb.getResultList().get(0)).toString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesMove move = new MesMove();
|
|
|
|
|
|
|
|
move.setMatnr(part.getPartNo());
|
|
|
|
|
|
|
|
move.setOrganizeCode(org);
|
|
|
|
|
|
|
|
move.setFactoryCode(org);
|
|
|
|
|
|
|
|
move.setLgort(configService.getCfgValue(org, "UMLGO"));
|
|
|
|
|
|
|
|
move.setUmlgo(configService.getCfgValue(org, "LGORT"));
|
|
|
|
|
|
|
|
move.setMenge(model.getPartInspection().getQty().intValue());
|
|
|
|
|
|
|
|
move.setMeins(part.getUnit());
|
|
|
|
|
|
|
|
move.setZrsum(zrsum);
|
|
|
|
|
|
|
|
move.setPostDate(TimeTool.getToday());
|
|
|
|
|
|
|
|
move.setPostTime(TimeTool.getTimeShortWithColon());
|
|
|
|
|
|
|
|
ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
moveRepository.save(move);
|
|
|
|
moveRepository.save(move);
|
|
|
|
|
|
|
|
|
|
|
|
} else if (type == MesExtEnumUtil.NC_TYPE.REWORK.getValue()) {
|
|
|
|
} else if (type == MesExtEnumUtil.NC_TYPE.REWORK.getValue()) {
|
|
|
|
|
|
|
|
|
|
|
|
GenSerialNoModel serialNoModel1 = new GenSerialNoModel("NC_REWORK");
|
|
|
|
|
|
|
|
serialNoModel1.setPartNo(part.getPartNo());
|
|
|
|
//生成返工单
|
|
|
|
ResultBean rb1 = syncFuncService.syncSerialNo(serialNoModel1, AuthUtil.getSessionUser().getUserName(), org, 1);
|
|
|
|
GenSerialNoModel serialNoModel = new GenSerialNoModel("NC_REWORK");
|
|
|
|
|
|
|
|
serialNoModel.setPartNo(part.getPartNo());
|
|
|
|
|
|
|
|
ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1);
|
|
|
|
String rework = "";
|
|
|
|
String rework = "";
|
|
|
|
if (null != rb1 && !CollectionUtils.isEmpty(rb1.getResultList())) {
|
|
|
|
if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) {
|
|
|
|
rework = (rb1.getResultList().get(0)).toString();
|
|
|
|
rework = (rb.getResultList().get(0)).toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MesReworkTask reworkTask = new MesReworkTask();
|
|
|
|
MesReworkTask reworkTask = new MesReworkTask();
|
|
|
@ -421,75 +364,65 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
ConvertBean.serviceModelInitialize(reworkTask, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelInitialize(reworkTask, AuthUtil.getSessionUser().getUserName());
|
|
|
|
reworkTaskRepository.save(reworkTask);
|
|
|
|
reworkTaskRepository.save(reworkTask);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MesReworkTaskDetail> taskDetailList = new ArrayList<>();
|
|
|
|
|
|
|
|
for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesReworkTaskDetail taskDetail = new MesReworkTaskDetail();
|
|
|
|
|
|
|
|
taskDetail.setPid(reworkTask.getId());
|
|
|
|
|
|
|
|
taskDetail.setStatus(MesExtEnumUtil.REWORK_TASK_DETAIL_STATUS.REWORK_TASK_DETAIL_STATUS_10.getValue());
|
|
|
|
|
|
|
|
taskDetail.setPartInspectionDetailId(detail.getId());
|
|
|
|
|
|
|
|
taskDetail.setOrganizeCode(org);
|
|
|
|
|
|
|
|
ConvertBean.serviceModelInitialize(taskDetail, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
taskDetailList.add(taskDetail);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reworkTaskDetailRepository.saveAll(taskDetailList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.getPartInspection().setDefectTypeId(person.getId());
|
|
|
|
model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.REWORK.getValue());
|
|
|
|
model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.REWORK.getValue());
|
|
|
|
model.getPartInspection().setDefectTypeId(reworkTask.getId());
|
|
|
|
model.getPartInspection().setDefectTypeId(reworkTask.getId());
|
|
|
|
partInspectionRepository.save(model.getPartInspection());
|
|
|
|
partInspectionRepository.save(model.getPartInspection());
|
|
|
|
|
|
|
|
|
|
|
|
} else if (type == MesExtEnumUtil.NC_TYPE.SCRAP.getValue()) {
|
|
|
|
} else if (type == MesExtEnumUtil.NC_TYPE.SCRAP.getValue()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新条码质量状态
|
|
|
|
MesProduceSn sn = checkProduceSn(model.getSn(), org);
|
|
|
|
MesProduceSn sn = checkProduceSn(model.getSn(), org);
|
|
|
|
sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue());
|
|
|
|
sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
produceSnRepository.save(sn);
|
|
|
|
produceSnRepository.save(sn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新检验单
|
|
|
|
|
|
|
|
model.getPartInspection().setDefectTypeId(person.getId());
|
|
|
|
model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue());
|
|
|
|
model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue());
|
|
|
|
model.getPartInspection().setRejectQty(model.getPartInspection().getQty());
|
|
|
|
model.getPartInspection().setRejectQty(model.getPartInspection().getQty());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
partInspectionRepository.save(model.getPartInspection());
|
|
|
|
partInspectionRepository.save(model.getPartInspection());
|
|
|
|
|
|
|
|
|
|
|
|
GenSerialNoModel serialNoModel = new GenSerialNoModel("NC_DEFECT_ZRSUM");
|
|
|
|
//移库 转报废
|
|
|
|
serialNoModel.setPartNo(part.getPartNo());
|
|
|
|
MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org);
|
|
|
|
ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1);
|
|
|
|
|
|
|
|
String zrsum = "";
|
|
|
|
|
|
|
|
if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) {
|
|
|
|
|
|
|
|
zrsum = (rb.getResultList().get(0)).toString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesMove move = new MesMove();
|
|
|
|
|
|
|
|
move.setMatnr(part.getPartNo());
|
|
|
|
|
|
|
|
move.setOrganizeCode(org);
|
|
|
|
|
|
|
|
move.setFactoryCode(org);
|
|
|
|
|
|
|
|
move.setLgort(configService.getCfgValue(org, "UMLGO"));
|
|
|
|
|
|
|
|
move.setUmlgo(configService.getCfgValue(org, "LGORT"));
|
|
|
|
|
|
|
|
move.setMenge(model.getPartInspection().getQty().intValue());
|
|
|
|
|
|
|
|
move.setMeins(part.getUnit());
|
|
|
|
|
|
|
|
move.setZrsum(zrsum);
|
|
|
|
|
|
|
|
move.setPostDate(TimeTool.getToday());
|
|
|
|
|
|
|
|
move.setPostTime(TimeTool.getTimeShortWithColon());
|
|
|
|
|
|
|
|
ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
moveRepository.save(move);
|
|
|
|
moveRepository.save(move);
|
|
|
|
|
|
|
|
|
|
|
|
} else if (type == MesExtEnumUtil.NC_TYPE.RELEASE.getValue()) {
|
|
|
|
} else if (type == MesExtEnumUtil.NC_TYPE.RELEASE.getValue()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新条码质量状态
|
|
|
|
MesProduceSn sn = checkProduceSn(model.getSn(), org);
|
|
|
|
MesProduceSn sn = checkProduceSn(model.getSn(), org);
|
|
|
|
sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
|
|
|
sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
produceSnRepository.save(sn);
|
|
|
|
produceSnRepository.save(sn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新检验单
|
|
|
|
|
|
|
|
model.getPartInspection().setDefectTypeId(person.getId());
|
|
|
|
model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue());
|
|
|
|
model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue());
|
|
|
|
model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.RELEASE.getValue());
|
|
|
|
model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.RELEASE.getValue());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
partInspectionRepository.save(model.getPartInspection());
|
|
|
|
partInspectionRepository.save(model.getPartInspection());
|
|
|
|
|
|
|
|
|
|
|
|
GenSerialNoModel serialNoModel = new GenSerialNoModel("NC_DEFECT_ZRSUM");
|
|
|
|
|
|
|
|
serialNoModel.setPartNo(part.getPartNo());
|
|
|
|
|
|
|
|
ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1);
|
|
|
|
|
|
|
|
String zrsum = "";
|
|
|
|
|
|
|
|
if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) {
|
|
|
|
|
|
|
|
zrsum = (rb.getResultList().get(0)).toString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesMove move = new MesMove();
|
|
|
|
//移库 转正常
|
|
|
|
move.setMatnr(part.getPartNo());
|
|
|
|
MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org);
|
|
|
|
move.setOrganizeCode(org);
|
|
|
|
|
|
|
|
move.setFactoryCode(org);
|
|
|
|
|
|
|
|
move.setLgort(configService.getCfgValue(org, "UMLGO"));
|
|
|
|
|
|
|
|
move.setUmlgo(configService.getCfgValue(org, "LGORT"));
|
|
|
|
|
|
|
|
move.setMenge(model.getPartInspection().getQty().intValue());
|
|
|
|
|
|
|
|
move.setMeins(part.getUnit());
|
|
|
|
|
|
|
|
move.setZrsum(zrsum);
|
|
|
|
|
|
|
|
move.setPostDate(TimeTool.getToday());
|
|
|
|
|
|
|
|
move.setPostTime(TimeTool.getTimeShortWithColon());
|
|
|
|
|
|
|
|
ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
moveRepository.save(move);
|
|
|
|
moveRepository.save(move);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -508,4 +441,28 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
|
|
|
|
|
|
|
return produceSn;
|
|
|
|
return produceSn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MesMove createMove(MesNcProcessingInputModel model, String source, String target, String org) {
|
|
|
|
|
|
|
|
GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM");
|
|
|
|
|
|
|
|
serialNoModel.setPartNo(model.getPart().getPartNo());
|
|
|
|
|
|
|
|
ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1);
|
|
|
|
|
|
|
|
String zrsum = "";
|
|
|
|
|
|
|
|
if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) {
|
|
|
|
|
|
|
|
zrsum = (rb.getResultList().get(0)).toString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesMove move = new MesMove();
|
|
|
|
|
|
|
|
move.setMatnr(model.getPart().getPartNo());
|
|
|
|
|
|
|
|
move.setOrganizeCode(org);
|
|
|
|
|
|
|
|
move.setFactoryCode(org);
|
|
|
|
|
|
|
|
move.setLgort(source);
|
|
|
|
|
|
|
|
move.setUmlgo(target);
|
|
|
|
|
|
|
|
move.setMenge(model.getPartInspection().getQty());
|
|
|
|
|
|
|
|
move.setMeins(model.getPart().getUnit());
|
|
|
|
|
|
|
|
move.setZrsum(zrsum);
|
|
|
|
|
|
|
|
move.setPostDate(TimeTool.getToday());
|
|
|
|
|
|
|
|
move.setPostTime(TimeTool.getTimeShortWithColon());
|
|
|
|
|
|
|
|
ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
return move;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|