|
|
|
@ -4,18 +4,22 @@ 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.api.busi.IMesWorkOrderExtService;
|
|
|
|
|
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;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.MesEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail;
|
|
|
|
@ -103,6 +107,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesProduceSnLogRepository produceSnLogRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesWorkOrderRepository workOrderRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesWorkOrderExtService workOrderExtService;
|
|
|
|
|
@Override
|
|
|
|
|
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) {
|
|
|
|
|
|
|
|
|
@ -118,7 +126,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
MesProduceSn produceSn = checkProduceSn(inputModel.getSn(), org);
|
|
|
|
|
|
|
|
|
|
//获取NC-零件检测-单据
|
|
|
|
|
partInspection = getPartInspection(inputModel, org);
|
|
|
|
|
partInspection = getPartInspection(produceSn,inputModel, org);
|
|
|
|
|
|
|
|
|
|
//检查物料
|
|
|
|
|
part = checkPart(produceSn, org);
|
|
|
|
@ -214,6 +222,17 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
public void savePartInspection(MesPartInspectionInputModel model, String org) {
|
|
|
|
|
|
|
|
|
|
MesProduceSn produceSn = getProduceSn(model.getSn(), org);
|
|
|
|
|
//武汉 会输入客户条码
|
|
|
|
|
boolean isWorkOrderQcStatus=false;
|
|
|
|
|
if (!StringUtil.isEmpty(produceSn)){
|
|
|
|
|
model.setCustSn(produceSn.getCustSn());
|
|
|
|
|
model.setSn(produceSn.getProductSn());
|
|
|
|
|
//排序产线 更新工单的 qcStatus
|
|
|
|
|
MesWorkCenter centerDb = prodOrgExtService.getWorkCenterDb(org, produceSn.getWorkCenterCode());
|
|
|
|
|
if (!StringUtil.isEmpty(centerDb)){
|
|
|
|
|
isWorkOrderQcStatus= centerDb.getCenterType() == MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(model.getPartInspection())){
|
|
|
|
|
model.getPartInspection().setQmsSync(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
@ -242,6 +261,15 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
|
|
|
|
ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
produceSnExtService.update(produceSn);
|
|
|
|
|
//更新工单对应qcStatus
|
|
|
|
|
if(isWorkOrderQcStatus){
|
|
|
|
|
MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo());
|
|
|
|
|
if (!StringUtil.isEmpty(workOrder)){
|
|
|
|
|
workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(produceSn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
workOrderRepository.update(workOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -289,6 +317,15 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
|
|
|
|
ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
produceSnExtService.update(produceSn);
|
|
|
|
|
//更新工单对应qcStatus
|
|
|
|
|
if(isWorkOrderQcStatus){
|
|
|
|
|
MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo());
|
|
|
|
|
if (!StringUtil.isEmpty(workOrder)){
|
|
|
|
|
workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(produceSn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
workOrderRepository.update(workOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//移库
|
|
|
|
|
String srcLocate;
|
|
|
|
@ -349,6 +386,15 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue());
|
|
|
|
|
ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
produceSnExtService.update(produceSn);
|
|
|
|
|
//更新工单对应qcStatus
|
|
|
|
|
if(isWorkOrderQcStatus){
|
|
|
|
|
MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo());
|
|
|
|
|
if (!StringUtil.isEmpty(workOrder)){
|
|
|
|
|
workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(produceSn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
workOrderRepository.update(workOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//查询条码所在库位
|
|
|
|
|
srcLocateNo = getDestLocateNo(model, org);
|
|
|
|
|
}
|
|
|
|
@ -398,6 +444,15 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue());
|
|
|
|
|
ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
produceSnExtService.update(produceSn);
|
|
|
|
|
//更新工单对应qcStatus
|
|
|
|
|
if(isWorkOrderQcStatus){
|
|
|
|
|
MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo());
|
|
|
|
|
if (!StringUtil.isEmpty(workOrder)){
|
|
|
|
|
workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(produceSn, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
workOrderRepository.update(workOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
partInspectionDetailRepository.saveAll(resultDetailList);
|
|
|
|
|
partInspectionDetailRepository.saveAll(model.getPartInspectionDetailList());
|
|
|
|
@ -411,7 +466,12 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
@ -434,11 +494,11 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
* @param org
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private MesPartInspection getPartInspection(MesPartInspectionInputModel inputModel, String org) {
|
|
|
|
|
private MesPartInspection getPartInspection(MesProduceSn produceSn,MesPartInspectionInputModel inputModel, String org) {
|
|
|
|
|
|
|
|
|
|
//根据条码找最近一条单据
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(inputModel.getSn(), "sn", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(produceSn.getProductSn(), "sn", packBean);
|
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
|
|
|
|
|
MesPartInspection partInspection = partInspectionRepository.getByProperty(packBean);
|
|
|
|
|
|
|
|
|
@ -563,7 +623,11 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
|
|
|
|
|
//若不存在则提示条码不存在
|
|
|
|
|
if (StringUtils.isEmpty(produceSn)) {
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】此条码不存在,请检查数据", serialNumber));
|
|
|
|
|
//再查一下排序查产线
|
|
|
|
|
produceSn = (MesProduceSn) workOrderExtService.getWorkOrderSort(org, serialNumber, false);
|
|
|
|
|
if (StringUtils.isEmpty(produceSn)) {
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】此条码不存在,请检查数据", serialNumber));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据条码状态判断 是不是已下线条码
|
|
|
|
@ -582,7 +646,11 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(serialNumber, "productSn", packBean);
|
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
|
|
|
|
|
return produceSnRepository.getByProperty(packBean);
|
|
|
|
|
MesProduceSn produceSn =produceSnRepository.getByProperty(packBean);
|
|
|
|
|
if (StringUtil.isEmpty(produceSn)){
|
|
|
|
|
produceSn = (MesProduceSn) workOrderExtService.getWorkOrderSort(org, serialNumber, false);
|
|
|
|
|
}
|
|
|
|
|
return produceSn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MesProduceSn checkProduceSn(MesProduceSn produceSn, String serialNumber) {
|
|
|
|
@ -619,6 +687,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
|
|
|
|
|
partInspection.setInspectionStatus(inspectionStatus);
|
|
|
|
|
partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue());
|
|
|
|
|
partInspection.setSn(model.getSn());
|
|
|
|
|
partInspection.setCustSn(StringUtil.isEmpty(model.getCustSn())?"":model.getCustSn());
|
|
|
|
|
partInspection.setLotNo(model.getLotNo());
|
|
|
|
|
partInspection.setQty(model.getQty().intValue());
|
|
|
|
|
partInspection.setWorkCenterCode(model.getWorkCenterCode());
|
|
|
|
|