判断可疑

tags/yfai-pcn-ext-v2.0
xiangwei.zhang 8 months ago
parent bb2a3f1092
commit 55984cee69

@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel;
import cn.estsh.i3plus.pojo.mes.bean.MesPartTypeDefect;
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail;
import io.swagger.annotations.ApiOperation;
@ -28,6 +29,12 @@ public interface IMesInputDefectRecordService {
@ApiOperation(value = "完成质检")
void savePartInspection(MesPartInspectionInputModel model, String org);
@ApiOperation(value = "客退品")
MesProduceSn customerBack(String organizeCode, String sn, String userName);
@ApiOperation(value = "客退品提交")
void customerBackCommit(String organizeCode, String sn, String userName);
@ApiOperation(value = "可疑品录入")
void saveSusPartInspection(MesPartInspectionInputModel model, String org);
}

@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesInputDefectRecordService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel;
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
@ -87,5 +88,33 @@ public class MesInputDefectRecordController {
}
}
@PostMapping("/customerBack")
@ApiOperation(value = "客退品")
public ResultBean customerBack(@RequestBody MesPartInspectionInputModel model) {
try {
// inputDefectRecordService.savePartInspection(model, "CK01");
MesProduceSn mesProduceSn = inputDefectRecordService.customerBack(model.getOrganizeCode(), model.getSn(), model.getUserInfo());
return ResultBean.success("客退品已完成,请继续").setResultObject(mesProduceSn);
} catch (ImppBusiException imppException) {
return ResultBean.fail(imppException);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@PostMapping("/customerBackCommit")
@ApiOperation(value = "客退品提交")
public ResultBean customerBackCommit(@RequestBody MesPartInspectionInputModel model) {
try {
// inputDefectRecordService.savePartInspection(model, "CK01");
inputDefectRecordService.customerBackCommit(model.getOrganizeCode(), model.getSn(), model.getUserInfo());
return ResultBean.success("客退品提交已完成,请继续");
} catch (ImppBusiException imppException) {
return ResultBean.fail(imppException);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -4,6 +4,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesConfigService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesInputDefectRecordService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel;
@ -28,6 +29,8 @@ import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ResultBean;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import com.codepoetics.protonpack.collectors.CollectorUtils;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -97,6 +100,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
@Autowired
private MesProductVersionRepository productVersionRepository;
@Autowired
private MesProduceSnLogRepository produceSnLogRepository;
@Override
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) {
@ -902,4 +908,42 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
moveRepository.save(move);
}
@ApiOperation(value = "客退品查询")
public MesProduceSn customerBack(String organizeCode, String sn, String userName) {
List<MesProduceSn> produceSnList = produceSnExtService.getProduceSnList(organizeCode, sn);
if (CollectionUtils.isEmpty(produceSnList)) {
MesPcnException.throwFlowException("条码不存在");
}
MesProduceSn mesProduceSn = produceSnList.get(0);
return mesProduceSn;
}
@ApiOperation(value = "客退品提交")
public void customerBackCommit(String organizeCode, String sn, String userName) {
List<MesProduceSn> produceSnList = produceSnExtService.getProduceSnList(organizeCode, sn);
if (CollectionUtils.isEmpty(produceSnList)) {
MesPcnException.throwFlowException("条码不存在");
}
MesProduceSn produceSn = produceSnList.get(0);
MesProduceSnLog produceSnLog = new MesProduceSnLog();
if (Objects.equals(produceSn.getSnStatus(), MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue())) {
MesPcnException.throwFlowException("条码状态不为已发运");
}
produceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue());
ConvertBean.serviceModelUpdate(produceSn, userName);
produceSnExtService.update(produceSn);
produceSnLog.setProductSn(produceSn.getProductSn());
produceSnLog.setCustSn(produceSn.getCustSn());
produceSnLog.setOriProductSn(null);
produceSnLog.setBeforeSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.SHIPPED.getValue());
produceSnLog.setAfterSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue());
ConvertBean.serviceModelInitialize(produceSnLog, userName);
produceSnLogRepository.save(produceSnLog);
}
}

Loading…
Cancel
Save