代码优化

tags/yfai-pcn-ext-v2.1
王杰 7 months ago
parent 23b774af3a
commit 8930187f6f

@ -683,10 +683,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
* @return * @return
*/ */
private MesMove createMove(MesPartInspectionInputModel model, String source, String target, String org, String workCenterCode) { private MesMove createMove(MesPartInspectionInputModel model, String source, String target, String org, String workCenterCode) {
if (StringUtils.isEmpty(model.getUserInfo())) model.setUserInfo("系统");
GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM"); GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM");
serialNoModel.setPartNo(model.getPart().getPartNo()); serialNoModel.setPartNo(model.getPart().getPartNo());
// ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1); ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, model.getUserInfo(), org, 1);
ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, "系统", org, 1);
String zrsum = ""; String zrsum = "";
if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) {
zrsum = (rb.getResultList().get(0)).toString(); zrsum = (rb.getResultList().get(0)).toString();
@ -707,8 +707,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
move.setMoveType(MesExtEnumUtil.MOVE_TYPE.SUSPICIOUS_MOVE.getValue()); move.setMoveType(MesExtEnumUtil.MOVE_TYPE.SUSPICIOUS_MOVE.getValue());
move.setProductSn(model.getSn()); move.setProductSn(model.getSn());
move.setWorkCenter(prodOrgExtService.getErpWorkCenterCode(org, workCenterCode)); move.setWorkCenter(prodOrgExtService.getErpWorkCenterCode(org, workCenterCode));
// ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName()); ConvertBean.serviceModelInitialize(move, model.getUserInfo());
ConvertBean.serviceModelInitialize(move, "系统");
return move; return move;
} }
@ -894,7 +893,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
public void saveSusPartInspection(MesPartInspectionInputModel model, String org) { public void saveSusPartInspection(MesPartInspectionInputModel model, String org) {
MesPartInspection partInspection = new MesPartInspection(); MesPartInspection partInspection = new MesPartInspection();
BeanUtils.copyProperties(model, partInspection); BeanUtils.copyProperties(model, partInspection, "id");
partInspection.setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()); partInspection.setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue());
partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue()); partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue());
partInspection.setOrganizeCode(org); partInspection.setOrganizeCode(org);
@ -908,8 +907,8 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
partInspection.setDefectTypeCode(defectType.getDefectTypeCode()); partInspection.setDefectTypeCode(defectType.getDefectTypeCode());
partInspection.setDefectTypeId(defectType.getId()); partInspection.setDefectTypeId(defectType.getId());
ConvertBean.serviceModelInitialize(partInspection, model.getUserInfo());
partInspectionRepository.save(partInspection); partInspection = partInspectionRepository.insert(partInspection);
log.info("生成的缺陷记录id ={}", partInspection); log.info("生成的缺陷记录id ={}", partInspection);
MesPartInspectionDetail detail = new MesPartInspectionDetail(); MesPartInspectionDetail detail = new MesPartInspectionDetail();
@ -923,7 +922,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
detail.setDefectTypeName(defectType.getDefectTypeName()); detail.setDefectTypeName(defectType.getDefectTypeName());
detail.setId(null); detail.setId(null);
detail.setOrganizeCode(org); detail.setOrganizeCode(org);
ConvertBean.serviceModelInitialize(detail, "系统"); ConvertBean.serviceModelInitialize(detail, model.getUserInfo());
partInspectionDetailRepository.insert(detail); partInspectionDetailRepository.insert(detail);
// //
String source = configService.getCfgValue(org, "LGORT"); String source = configService.getCfgValue(org, "LGORT");
@ -945,7 +944,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
} }
} }
MesMove move = createMove(model, source, configService.getCfgValue(org, "UMLGO"), org, model.getWorkCenterCode()); MesMove move = createMove(model, source, configService.getCfgValue(org, "UMLGO"), org, model.getWorkCenterCode());
moveRepository.save(move); moveRepository.insert(move);
} }
@ApiOperation(value = "客退品查询") @ApiOperation(value = "客退品查询")

@ -123,10 +123,12 @@ public class MesProduceSnExtService implements IMesProduceSnExtService {
@Override @Override
public void saveProduceSnList(StationRequestBean reqBean, Integer snStatus, List<Long> idList) { public void saveProduceSnList(StationRequestBean reqBean, Integer snStatus, List<Long> idList) {
idList = CollectionUtils.isEmpty(idList) ? idList : idList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList());
if (CollectionUtils.isEmpty(idList)) return;
DdlPackBean packBean = new DdlPackBean(); DdlPackBean packBean = new DdlPackBean();
DdlPreparedPack.getStringEqualPack(reqBean.getOrganizeCode(), MesPcnExtConstWords.ORGANIZE_CODE, packBean); DdlPreparedPack.getStringEqualPack(reqBean.getOrganizeCode(), MesPcnExtConstWords.ORGANIZE_CODE, packBean);
DdlPreparedPack.getInPackList(idList, MesPcnExtConstWords.ID, packBean); if (idList.size() == 1) DdlPreparedPack.getNumEqualPack(idList.get(0), MesPcnExtConstWords.ID, packBean);
else DdlPreparedPack.getInPackList(idList, MesPcnExtConstWords.ID, packBean);
produceSnRepository.updateByProperties( produceSnRepository.updateByProperties(
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE, MesPcnExtConstWords.SN_STATUS}, new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE, MesPcnExtConstWords.SN_STATUS},
new Object[]{reqBean.getUserInfo(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), snStatus}, new Object[]{reqBean.getUserInfo(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), snStatus},

@ -157,6 +157,7 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
model.setPart(mesPartSap); model.setPart(mesPartSap);
model.setPartInspectionDetailList(Arrays.asList(mesPartInspectionDetail)); model.setPartInspectionDetailList(Arrays.asList(mesPartInspectionDetail));
if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) { if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) {
//TODO 有问题 需要修改条码质量状态
ncProcessingService.saveNc(model, reqBean.getOrganizeCode(), true); ncProcessingService.saveNc(model, reqBean.getOrganizeCode(), true);
} else { } else {
MesPartInspectionInputModel inspectModel = new MesPartInspectionInputModel(); MesPartInspectionInputModel inspectModel = new MesPartInspectionInputModel();
@ -169,6 +170,7 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
inspectModel.setPartInspection(partInspection); inspectModel.setPartInspection(partInspection);
inspectModel.setShiftCode(mesProduceSn.getShiftCode()); inspectModel.setShiftCode(mesProduceSn.getShiftCode());
inspectModel.setProductVersion(productVersion); inspectModel.setProductVersion(productVersion);
inspectModel.setUserInfo(reqBean.getUserInfo());
inputDefectRecordService.saveSusPartInspection(inspectModel, reqBean.getOrganizeCode()); inputDefectRecordService.saveSusPartInspection(inspectModel, reqBean.getOrganizeCode());
} }

Loading…
Cancel
Save