41794 MES-PDA:点检-新增点检单问题汇总

tags/yfai-pcn-ext-v1.0
jun 10 months ago
parent 627217357c
commit 79a5fbbb1e

@ -1,5 +1,6 @@
package cn.estsh.i3plus.ext.mes.pcn.api.busi.spot;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesEquipmentSpotCheckModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSpotCheckOrderModel;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
@ -34,6 +35,16 @@ public interface IMesSpotCheckOrderService {
*
*
* @param spotCheckOrder
* @return
*/
@ApiOperation("查询设备点检")
List<MesEquipmentSpotCheckModel> findEquipmentSpotCheck(MesEquipmentSpotCheck spotCheckOrder);
/**
*
*
*
* @param spotCheckOrder
* @param pager
* @return
*/

@ -28,6 +28,19 @@ public class MesSpotCheckOrderController {
@Autowired
private IMesSpotCheckOrderService spotCheckOrderService;
@GetMapping("/find-equipment-spot")
@ApiOperation(value = "查询设备点检")
public ResultBean queryEquipmentSpotCheckMap(MesEquipmentSpotCheck spotCheckOrder) {
try {
spotCheckOrder.setOrganizeCode(AuthUtil.getOrganizeCode());
return ResultBean.success("查询成功").setResultList(spotCheckOrderService.findEquipmentSpotCheck(spotCheckOrder));
} catch (ImppBusiException imppException) {
return ResultBean.fail(imppException);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@GetMapping("/query-equipment-spot")
@ApiOperation(value = "查询设备点检")

@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.spot.IMesSpotCheckOrderService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesEquipmentSpotCheckModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSpotCheckOrderModel;
import cn.estsh.i3plus.icloud.core.sdk.ICoreUtilCloud;
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
@ -32,10 +33,7 @@ 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.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -89,6 +87,30 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
}
@Override
public List<MesEquipmentSpotCheckModel> findEquipmentSpotCheck(MesEquipmentSpotCheck spotCheckOrder) {
List<MesEquipmentSpotCheck> mesEquipmentSpotCheckList = queryEquipmentSpotCheck(spotCheckOrder);
if(CollectionUtils.isEmpty(mesEquipmentSpotCheckList)){
return null;
}
Map<String, List<MesEquipmentSpotCheck>> mesEquipmentSpotCheckMap = mesEquipmentSpotCheckList.stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getEquipCode));
List<MesEquipmentSpotCheckModel> mesEquipmentSpotCheckModelList = new ArrayList<>();
for (Map.Entry<String, List<MesEquipmentSpotCheck>> mesEquipmentSpotCheckEntry : mesEquipmentSpotCheckMap.entrySet()) {
MesEquipmentSpotCheck next = mesEquipmentSpotCheckEntry.getValue().iterator().next();
MesEquipmentSpotCheckModel mesEquipmentSpotCheckModel = new MesEquipmentSpotCheckModel();
BeanUtils.copyProperties(next,mesEquipmentSpotCheckModel);
Map<Integer, List<MesEquipmentSpotCheck>> listMap = mesEquipmentSpotCheckEntry.getValue().stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getSpotCheckOrderType));
for (Map.Entry<Integer, List<MesEquipmentSpotCheck>> entry : listMap.entrySet()) {
MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel mesEquipmentSpotCheckDataModel = new MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel();
mesEquipmentSpotCheckDataModel.setSpotCheckOrderType(entry.getKey());
mesEquipmentSpotCheckDataModel.setSpotCheckList(entry.getValue());
mesEquipmentSpotCheckModel.getSpotCheckDataModelList().add(mesEquipmentSpotCheckDataModel);
}
mesEquipmentSpotCheckModelList.add(mesEquipmentSpotCheckModel);
}
return mesEquipmentSpotCheckModelList;
}
@Override
public List<MesEquipmentSpotCheck> queryEquipmentSpotCheck(MesEquipmentSpotCheck bean) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode(), bean.getIsValid());
@ -97,7 +119,8 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
DdlPreparedPack.getStringLikerPack(bean.getSpotCheckName(), "spotCheckName", packBean);
DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean);
DdlPreparedPack.getStringEqualPack(bean.getWorkCellCode(), "workCellCode", packBean);
DdlPreparedPack.getStringEqualPack(bean.getEquipCode(), "equipCode", packBean);
DdlPreparedPack.getNumEqualPack(bean.getSpotCheckOrderType(), "spotCheckOrderType", packBean);
return equipmentSpotCheckRepository.findByHqlWhere(packBean);
}

@ -0,0 +1,40 @@
package cn.estsh.i3plus.ext.mes.pcn.pojo.model;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheck;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @Description : Model
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/7/8 17:37
* @Modify:
**/
@Data
public class MesEquipmentSpotCheckModel {
@ApiParam("设备Code")
private String equipCode;
@ApiParam("设备名称")
private String equipName;
@ApiParam("点检单类型")
private List<MesEquipmentSpotCheckDataModel> spotCheckDataModelList = new ArrayList<>();
@Data
public static class MesEquipmentSpotCheckDataModel {
@ApiParam("点检单类型")
private Integer spotCheckOrderType;
@ApiParam("设备点检")
List<MesEquipmentSpotCheck> spotCheckList;
public MesEquipmentSpotCheckDataModel() {
}
}
}
Loading…
Cancel
Save