问题清单修复

tags/yfai-mes-ext-v1.0
jun 12 months ago
parent d72767f2ac
commit 816ca4bec6

@ -1,7 +1,9 @@
package cn.estsh.i3plus.ext.mes.api.base;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheck;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheckDetail;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @Description :
@ -12,5 +14,8 @@ import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheckDetail;
**/
public interface IMesEquipmentSpotCheckService extends IBaseMesService<MesEquipmentSpotCheck>{
@ApiModelProperty("查询设备点检配置")
List<MesEquipmentSpotCheck> findMesEquipmentSpotCheck(MesEquipmentSpotCheck mesEquipmentSpotCheck);
}

@ -1,8 +1,11 @@
package cn.estsh.i3plus.ext.mes.api.busi;
import cn.estsh.i3plus.ext.mes.api.base.IBaseMesService;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheck;
import cn.estsh.i3plus.pojo.mes.bean.MesSpotCheckOrder;
import cn.estsh.i3plus.pojo.mes.bean.MesSpotCheckOrderPart;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @Description : IMaximoService
@ -12,5 +15,8 @@ import cn.estsh.i3plus.pojo.mes.bean.MesSpotCheckOrderPart;
**/
public interface IMesSpotCheckOrderService extends IBaseMesService<MesSpotCheckOrder> {
@ApiOperation("生成点检单")
void insertMesSpotCheckOrder(List<MesEquipmentSpotCheck> mesEquipmentSpotCheckList, String userName);
}

@ -62,6 +62,7 @@ public class MesSendOutTimeReworkOrderEmailJob extends BaseMesScheduleJob {
}
for (String organizeCode : jobParam.split(",")) {
try {
long startTime = System.currentTimeMillis();
//超时时间
int minutes = Integer.parseInt(mesConfigService.getCfgValue(organizeCode, MesCommonConstant.OUT_TIME_REWORK_ORDER_MINUTES));
//查询超时返工单
@ -70,7 +71,6 @@ public class MesSendOutTimeReworkOrderEmailJob extends BaseMesScheduleJob {
continue;
}
messagePushService.pushEmail(getContent(minutes, mesReworkTaskList), "返工单超时提醒", "系统管理员", Arrays.asList(mesConfigService.getCfgValue(organizeCode, MesCommonConstant.OUT_TIME_REWORK_ORDER_SEND_URL).split(",")));
long startTime = System.currentTimeMillis();
long endTime = System.currentTimeMillis();
log.info("工厂{}返工单超过时不处理发邮件通知JOB --- END --- 耗时: {} ms", organizeCode, endTime - startTime);
} catch (Exception e) {

@ -0,0 +1,71 @@
package cn.estsh.i3plus.ext.mes.apiservice.schedulejob;
import cn.estsh.i3plus.ext.mes.api.base.IMesEquipmentSpotCheckService;
import cn.estsh.i3plus.ext.mes.api.busi.IMesSpotCheckOrderService;
import cn.estsh.i3plus.mes.apiservice.schedulejob.BaseMesScheduleJob;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheck;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.init.ApplicationProperties;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/7/15 17:08
* @Modify:
**/
@Slf4j
@DisallowConcurrentExecution
@Component
@ApiOperation("定时生成点检单")
public class MesSpotCheckOrderGenerateJob extends BaseMesScheduleJob {
@Autowired
private IMesEquipmentSpotCheckService mesEquipmentSpotCheckService;
@Autowired
private IMesSpotCheckOrderService mesSpotCheckOrderService;
public MesSpotCheckOrderGenerateJob() {
super(MesSpotCheckOrderGenerateJob.class, "定时生成点检单");
}
@Override
public void executeMesJob(JobExecutionContext context, ApplicationProperties applicationProperties) {
String jobParam = this.getJobParam();
if (StringUtils.isBlank(jobParam)) {
throw new IllegalArgumentException("job参数为空请检查参数");
}
for (String organizeCode : jobParam.split(",")) {
try {
long startTime = System.currentTimeMillis();
MesEquipmentSpotCheck mesEquipmentSpotCheck = new MesEquipmentSpotCheck();
mesEquipmentSpotCheck.setOrganizeCode(organizeCode);
mesEquipmentSpotCheck.setTriggerMode(MesExtEnumUtil.EQUIPMENT_CHECK_INSPECTION_TRIGGER_METHOD.TIME_TRIGGERED.getValue());
List<MesEquipmentSpotCheck> spotCheckList = mesEquipmentSpotCheckService.findMesEquipmentSpotCheck(mesEquipmentSpotCheck);
if (CollectionUtils.isEmpty(spotCheckList)) {
log.info("不存在触发方式为【时间触发】的设备点检配置");
continue;
}
mesSpotCheckOrderService.insertMesSpotCheckOrder(spotCheckList, "JOB");
long endTime = System.currentTimeMillis();
log.info("工厂{}定时生成点检单 --- END --- 耗时: {} ms", organizeCode, endTime - startTime);
} catch (Exception e) {
log.info("工厂{}定时生成点检单 执行失败{}", organizeCode, e);
}
}
}
}

@ -80,4 +80,10 @@ public class MesEquipmentSpotCheckService extends BaseMesService<MesEquipmentSpo
}
}
@Override
public List<MesEquipmentSpotCheck> findMesEquipmentSpotCheck(MesEquipmentSpotCheck mesEquipmentSpotCheck) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesEquipmentSpotCheck.getOrganizeCode());
DdlPreparedPack.getNumEqualPack(mesEquipmentSpotCheck.getTriggerMode(), "triggerMode", packBean);
return baseRDao.findByHqlWhere(packBean);
}
}

@ -60,7 +60,7 @@ public class MesProdRuleNosortCfgService extends BaseMesService<MesProdRuleNosor
DdlPreparedPack.getStringEqualPack(item.getOutPartNo(), "outPartNo", seriesPackBean);
DdlPreparedPack.getStringEqualPack(item.getEquipmentCode(), "equipmentCode", seriesPackBean);
if (!StringUtils.isEmpty(item.getInPartNo())) {
MesPartSap inPart = partSapService.getMesPartSapByPartNo(item.getOrganizeCode(), item.getInPartNo());
MesPartSap inPart = partSapService.getMesPartSapByPartNo(item.getInPartNo(), item.getOrganizeCode());
if (inPart == null) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
@ -70,7 +70,7 @@ public class MesProdRuleNosortCfgService extends BaseMesService<MesProdRuleNosor
}
}
if (!StringUtils.isEmpty(item.getOutPartNo())) {
MesPartSap outPart = partSapService.getMesPartSapByPartNo(item.getOrganizeCode(), item.getOutPartNo());
MesPartSap outPart = partSapService.getMesPartSapByPartNo(item.getOutPartNo(),item.getOrganizeCode());
if (outPart == null) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())

@ -832,10 +832,6 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
if (Objects.isNull(mesWorkOrderDb)) {
MesException.throwMesBusiException("工单id为【%s】工单信息不存在", mesWorkOrder.getId());
}
//试制单不允许报工
if(!Objects.isNull(mesWorkOrderDb.getOrderFlag()) && MesExtEnumUtil.ORDER_TYPE_IDENTIFICATION.P.getValue().equals(mesWorkOrderDb.getOrderFlag())){
MesException.throwMesBusiException("工单【%s】为试制单不允许报工", mesWorkOrder.getWorkOrderNo());
}
//查询物料信息
MesPart mesPart = iMesPartService.getPartByPartNo(mesWorkOrderDb.getPartNo(), mesWorkOrderDb.getOrganizeCode());
//查询产线信息
@ -891,15 +887,16 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
}
//更新工单
updateMesWorkOrder(mesWorkOrderDb);
//生成条码 todo 有条码 不生成
String sn = getStringList(mesWorkOrder);
//保存数据
List<MesProductOffLine> mesProductOffLineList = new ArrayList<>();
for (MesBom mesBom : mesBoms) {
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, false));
//试制单不报工
if(Objects.isNull(mesWorkOrderDb.getOrderFlag()) || !MesExtEnumUtil.ORDER_TYPE_IDENTIFICATION.P.getValue().equals(mesWorkOrderDb.getOrderFlag())){
String sn = getStringList(mesWorkOrder);
//保存数据
List<MesProductOffLine> mesProductOffLineList = new ArrayList<>();
for (MesBom mesBom : mesBoms) {
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, false));
}
mesProductOffLineService.insertBatch(mesProductOffLineList);
}
mesProductOffLineService.insertBatch(mesProductOffLineList);
}
@Override
@ -908,10 +905,6 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
if (Objects.isNull(mesWorkOrder)) {
MesException.throwMesBusiException("工单id为【%s】工单信息不存在", mesWorkOrderNew.getId());
}
//试制单不允许报工
if(!Objects.isNull(mesWorkOrder.getOrderFlag()) && MesExtEnumUtil.ORDER_TYPE_IDENTIFICATION.P.getValue().equals(mesWorkOrder.getOrderFlag())){
MesException.throwMesBusiException("工单【%s】为试制单不允许报工", mesWorkOrder.getWorkOrderNo());
}
//查询物料信息
MesPart mesPart = iMesPartService.getPartByPartNo(mesWorkOrder.getPartNo(), mesWorkOrder.getOrganizeCode());
if (mesWorkOrderNew.getNum() <= 0) {
@ -1020,8 +1013,8 @@ public class MesWorkOrderService extends BaseMesService<MesWorkOrder> implements
//更新工单
updateMesWorkOrder(mesWorkOrder);
//保存报工记录
if (CollectionUtils.isNotEmpty(mesProductOffLineList)) {
//保存报工记录 试制单不报工
if (CollectionUtils.isNotEmpty(mesProductOffLineList) && (Objects.isNull(mesWorkOrder.getOrderFlag()) || !MesExtEnumUtil.ORDER_TYPE_IDENTIFICATION.P.getValue().equals(mesWorkOrder.getOrderFlag()))) {
mesProductOffLineService.insertBatch(mesProductOffLineList);
}
//保存移库记录

@ -8,6 +8,7 @@ import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base.BaseMesService;
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.icloud.core.sdk.ICoreUtilCloud;
import cn.estsh.i3plus.mes.api.iservice.busi.ISyncFuncService;
import cn.estsh.i3plus.mes.apiservice.util.DateUtil;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
@ -22,6 +23,7 @@ import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentSpotCheckDetailRepository
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentSpotCheckPartRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesSpotCheckOrderPartRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesSpotCheckOrderResultRepository;
import cn.estsh.i3plus.pojo.mes.util.DateUtilExt;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
@ -33,9 +35,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
@ -386,4 +387,169 @@ public class MesSpotCheckOrderService extends BaseMesService<MesSpotCheckOrder>
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
}
@Override
public void insertMesSpotCheckOrder(List<MesEquipmentSpotCheck> mesEquipmentSpotCheckList,String userName) {
MesEquipmentSpotCheck next = mesEquipmentSpotCheckList.iterator().next();
List<Long> spotCheckIdList = mesEquipmentSpotCheckList.stream().map(MesEquipmentSpotCheck::getId).collect(Collectors.toList());
//查询未处理的单据
Map<Long, MesSpotCheckOrder> spotCheckOrderMap = getMesSpotCheckOrderMap(next.getOrganizeCode(), spotCheckIdList);
//查询明细数据
DdlPackBean packBean = DdlPackBean.getDdlPackBean(next.getOrganizeCode());
DdlPreparedPack.getInPackList(spotCheckIdList,"pid", packBean);
List<MesEquipmentSpotCheckDetail> detailList = equipmentSpotCheckDetailRepository.findByHqlWhere(packBean);
Map<Long,List<MesEquipmentSpotCheckDetail>> detailMap = null;
if (!CollectionUtils.isEmpty(detailList)) {
detailMap = detailList.stream().collect(Collectors.groupingBy(MesEquipmentSpotCheckDetail::getPid));
}
//查询点检零件
List<MesEquipmentSpotCheckPart> equipmentSpotCheckPartList = equipmentSpotCheckPartRepository.findByHqlWhere(packBean);
Map<Long,List<MesEquipmentSpotCheckPart>> checkPartListMap = null;
if (!CollectionUtils.isEmpty(equipmentSpotCheckPartList)) {
checkPartListMap = equipmentSpotCheckPartList.stream().collect(Collectors.groupingBy(MesEquipmentSpotCheckPart::getPid));
}
//属性校验
List<MesEquipmentSpotCheck> mesEquipmentSpotChecks = getCheckList(mesEquipmentSpotCheckList, spotCheckOrderMap, detailMap, checkPartListMap);
//保存单据
if(mesEquipmentSpotChecks.size() > 0){
saveOrder(userName, next, detailMap, checkPartListMap, mesEquipmentSpotChecks);
}
}
private void saveOrder(String userName, MesEquipmentSpotCheck next, Map<Long, List<MesEquipmentSpotCheckDetail>> detailMap, Map<Long, List<MesEquipmentSpotCheckPart>> checkPartListMap, List<MesEquipmentSpotCheck> mesEquipmentSpotChecks) {
//生成单号
GenSerialNoModel genSerialNoModel = new GenSerialNoModel(MesCommonConstant.SPOT_CHECK_ORDER_NO_RULE);
List<String> resultList = syncFuncService.syncSerialNo(genSerialNoModel, userName, next.getOrganizeCode(), mesEquipmentSpotChecks.size()).getResultList();
String orderNo;
int count = 0 ;
//单据生成
for (MesEquipmentSpotCheck spotCheck : mesEquipmentSpotChecks) {
orderNo = resultList.get(count);
MesSpotCheckOrder mesSpotCheckOrder = new MesSpotCheckOrder();
BeanUtils.copyProperties(spotCheck, mesSpotCheckOrder, "id");
mesSpotCheckOrder.setTaskResource(MesCommonConstant.SPOT_CHECK_ORDER_TASK_RESOURCE);
mesSpotCheckOrder.setStatus(MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.CREATE.getValue());
mesSpotCheckOrder.setSpotCheckId(spotCheck.getId());
mesSpotCheckOrder.setSpotCheckOrderNo(orderNo);
ConvertBean.serviceModelInitialize(mesSpotCheckOrder, userName);
mesSpotCheckOrder = baseRDao.insert(mesSpotCheckOrder);
//保存单据明细
saveMesSpotCheckOrderDetails(userName, detailMap, spotCheck.getId(), mesSpotCheckOrder);
//保存单据零件
saveMesEquipmentSpotCheckPartList(userName, checkPartListMap, spotCheck.getId(), mesSpotCheckOrder.getId());
ConvertBean.serviceModelUpdate(spotCheck, userName);
baseRDao.update(spotCheck);
count++;
}
}
private List<MesEquipmentSpotCheck> getCheckList(List<MesEquipmentSpotCheck> mesEquipmentSpotCheckList, Map<Long, MesSpotCheckOrder> spotCheckOrderMap, Map<Long, List<MesEquipmentSpotCheckDetail>> detailMap, Map<Long, List<MesEquipmentSpotCheckPart>> checkPartListMap) {
List<MesEquipmentSpotCheck> mesEquipmentSpotChecks = new ArrayList<>();
for (MesEquipmentSpotCheck spotCheck : mesEquipmentSpotCheckList) {
log.info("开始处理点检项目代码:{}",spotCheck.getSpotCheckCode());
//校验是否存在未处理的单据
if(!Objects.isNull(spotCheckOrderMap) && spotCheckOrderMap.containsKey(spotCheck.getId())){
log.info("存在相同配置状态为{}的点检单 id{},请检查数据",MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.CREATE.getDescription(), spotCheck.getId());
continue;
}
//时间触发方式
if (checkTime(spotCheck)) continue;
//明细是否存在
if (Objects.isNull(detailMap) || !detailMap.containsKey(spotCheck.getId())) {
log.info("【{}】点检方案明细不存在,请检查数据",spotCheck.getId());
continue;
}
//检测零件
if(spotCheck.getSpotCheckOrderType() == MesExtEnumUtil.SPOT_CHECK_ORDER_TYPE.FIRST_PRODUCT_INSPECTION.getValue() && (Objects.isNull(checkPartListMap) || !checkPartListMap.containsKey(spotCheck.getId()))){
log.info("【{}】点检方案类型为【{}】配置零件号为空,请检查数据", spotCheck.getId(), MesExtEnumUtil.SPOT_CHECK_ORDER_TYPE.FIRST_PRODUCT_INSPECTION.getDescription());
continue;
}
mesEquipmentSpotChecks.add(spotCheck);
}
return mesEquipmentSpotChecks;
}
private boolean checkTime(MesEquipmentSpotCheck spotCheck) {
if(null == MesExtEnumUtil.EQUIPMENT_CHECK_INSPECTION_TRIGGER_CONFIG.valueOfDescription(spotCheck.getTimeTriggerMode())){
log.info("时间触发方式{}不存在,请检查数据", spotCheck.getTimeTriggerMode());
return true;
}
//触发窗口时间
if(MesExtEnumUtil.EQUIPMENT_CHECK_INSPECTION_TRIGGER_CONFIG.OPTION1.getValue() == spotCheck.getTimeTriggerMode()){
try {
if(!DateUtilExt.between(DateUtil.SHORT_FORMAT_HOUR_MINUTE,TimeTool.getTimeShortWithColon(),TimeTool.pareDateToString(DateUtil.SHORT_FORMAT_HOUR_MINUTE,DateUtil.addMinutes(new Date(),30)),spotCheck.getTriggerWindowTime())){
log.info("{},触发窗口时间{}不产生单据,请检查数据", spotCheck.getSpotCheckCode(), spotCheck.getTriggerWindowTime());
return true;
}
} catch (Exception e) {
log.info("{},触发窗口时间格式异常", spotCheck.getSpotCheckCode());
return true;
}
}else{
//查询执行成功的单据信息
MesSpotCheckOrder finishedOrder = getMesSpotCheckOrder(spotCheck);
if(!Objects.isNull(finishedOrder)){
spotCheck.setLastSpotCheckTime(finishedOrder.getModifyDatetime());
if(Integer.parseInt(DateUtil.minutesBetweenTwoTime(new Date(),TimeTool.stringParseToDate(finishedOrder.getModifyDatetime()))+"") < spotCheck.getTriggerWindowInterval()){
log.info("最后点检完成时间:{},距现在不足{}分钟,不创建单据",finishedOrder.getModifyDatetime(), spotCheck.getTriggerWindowInterval());
return true;
}
}
}
return false;
}
private MesSpotCheckOrder getMesSpotCheckOrder(MesEquipmentSpotCheck spotCheck) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(spotCheck.getOrganizeCode());
DdlPreparedPack.getNumEqualPack(spotCheck.getId(),"spotCheckId", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.COMPLETE.getValue(), "status", packBean);
DdlPreparedPack.getOrderBy("modifyDatetime",CommonEnumUtil.ASC_OR_DESC.DESC.getValue(),packBean);
return baseRDao.getByProperty(packBean);
}
private void saveMesEquipmentSpotCheckPartList(String userName,Map<Long, List<MesEquipmentSpotCheckPart>> checkPartListMap, Long spotCheckId, Long spotCheckOrderId) {
if (!Objects.isNull(checkPartListMap) && checkPartListMap.containsKey(spotCheckId)) {
List<MesSpotCheckOrderPart> spotCheckOrderPartList = new ArrayList<>();
checkPartListMap.get(spotCheckId).forEach(k -> {
MesSpotCheckOrderPart spotCheckOrderPart = new MesSpotCheckOrderPart();
spotCheckOrderPart.setSpotCheckOrderId(spotCheckOrderId);
BeanUtils.copyProperties(k, spotCheckOrderPart, "id");
ConvertBean.serviceModelInitialize(spotCheckOrderPart, userName);
spotCheckOrderPartList.add(spotCheckOrderPart);
});
spotCheckOrderPartRepository.saveAll(spotCheckOrderPartList);
}
}
private void saveMesSpotCheckOrderDetails(String userName, Map<Long, List<MesEquipmentSpotCheckDetail>> detailMap, Long spotCheckId, MesSpotCheckOrder mesSpotCheckOrder) {
List<MesSpotCheckOrderResult> spotCheckOrderResults = new ArrayList<>();
detailMap.get(spotCheckId).forEach(k -> {
MesSpotCheckOrderResult result = new MesSpotCheckOrderResult();
BeanUtils.copyProperties(k, result, "id");
result.setSpotCheckOrderNo(mesSpotCheckOrder.getSpotCheckOrderNo());
result.setPid(mesSpotCheckOrder.getId());
result.setWorkCenterCode(mesSpotCheckOrder.getWorkCenterCode());
result.setWorkCellCode(mesSpotCheckOrder.getWorkCellCode());
result.setSpotCheckItemId(k.getId());
result.setTaskItemName(k.getSpotCheckItemName());
result.setSpotCheckStandardValue(k.getStandardValue());
ConvertBean.serviceModelInitialize(result, userName);
spotCheckOrderResults.add(result);
});
spotCheckOrderResultRepository.saveAll(spotCheckOrderResults);
}
private Map<Long, MesSpotCheckOrder> getMesSpotCheckOrderMap(String organizeCode, List<Long> spotCheckIdList) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getInPackList(spotCheckIdList,"spotCheckId", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.CREATE.getValue(), "status", packBean);
List<MesSpotCheckOrder> mesSpotCheckOrderList = baseRDao.findByHqlWhere(packBean);
Map<Long, MesSpotCheckOrder> spotCheckOrderMap = null;
if (!CollectionUtils.isEmpty(mesSpotCheckOrderList)) {
spotCheckOrderMap = new HashMap<>();
for (MesSpotCheckOrder mesSpotCheckOrder : mesSpotCheckOrderList) {
spotCheckOrderMap.put(mesSpotCheckOrder.getSpotCheckId(),mesSpotCheckOrder);
}
}
return spotCheckOrderMap;
}
}

@ -21,6 +21,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Objects;
import static cn.estsh.i3plus.ext.mes.apiservice.dbinterface.WmsSAPDbQuery.lz;
@ -221,7 +222,7 @@ public class MesTraceabilityTemp {
tableTop2Cell10.setColspan(5);
tableTop2.addCell(tableTop2Cell10);
PdfPCell tableTop2Cell11 = new PdfPCell(new Paragraph(MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(mesTraceabilityReportModel.getSnStatus()), topValueFont));
PdfPCell tableTop2Cell11 = new PdfPCell(new Paragraph(Objects.isNull(mesTraceabilityReportModel.getSnStatus())?"":MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(mesTraceabilityReportModel.getSnStatus()), topValueFont));
tableTop2Cell11.setHorizontalAlignment(Element.ALIGN_LEFT);
tableTop2Cell11.setVerticalAlignment(Element.ALIGN_MIDDLE);
tableTop2Cell11.setBorder(Rectangle.NO_BORDER);
@ -391,7 +392,7 @@ public class MesTraceabilityTemp {
tableTop2Cell50.setColspan(5);
tableTop2.addCell(tableTop2Cell50);
PdfPCell tableTop2Cell51 = new PdfPCell(new Paragraph(MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(mesTraceabilityReportModel.getProdStatus()), topValueFont));
PdfPCell tableTop2Cell51 = new PdfPCell(new Paragraph(Objects.isNull(mesTraceabilityReportModel.getProdStatus())?"":MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(mesTraceabilityReportModel.getProdStatus()), topValueFont));
tableTop2Cell51.setHorizontalAlignment(Element.ALIGN_LEFT);
tableTop2Cell51.setVerticalAlignment(Element.ALIGN_MIDDLE);
tableTop2Cell51.setBorder(Rectangle.NO_BORDER);
@ -645,8 +646,10 @@ public class MesTraceabilityTemp {
MesException.throwMesBusiException("生成PDF文件失败");
} finally {
//删除文件
Files.deleteIfExists(destFile.toPath());
Files.deleteIfExists(file.toPath());
if(!Objects.isNull(destFile)){
Files.deleteIfExists(destFile.toPath());
}
file.deleteOnExit();
}
return url;
}

Loading…
Cancel
Save