diff --git a/modules/i3plus-ext-mes-api/src/main/java/cn/estsh/i3plus/ext/mes/api/base/IMesPartInspectionService.java b/modules/i3plus-ext-mes-api/src/main/java/cn/estsh/i3plus/ext/mes/api/base/IMesPartInspectionService.java index b16b48c..d197332 100644 --- a/modules/i3plus-ext-mes-api/src/main/java/cn/estsh/i3plus/ext/mes/api/base/IMesPartInspectionService.java +++ b/modules/i3plus-ext-mes-api/src/main/java/cn/estsh/i3plus/ext/mes/api/base/IMesPartInspectionService.java @@ -1,5 +1,7 @@ package cn.estsh.i3plus.ext.mes.api.base; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; /** @@ -10,4 +12,5 @@ import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; public interface IMesPartInspectionService extends IBaseMesService { + ListPager queryMesPartInspectionParamByPager(MesPartInspection mesPartInspection, Pager pager); } diff --git a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/controller/base/MesPartInspectionController.java b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/controller/base/MesPartInspectionController.java index 1834a31..aa6b659 100644 --- a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/controller/base/MesPartInspectionController.java +++ b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/controller/base/MesPartInspectionController.java @@ -1,8 +1,16 @@ package cn.estsh.i3plus.ext.mes.apiservice.controller.base; +import cn.estsh.i3plus.ext.mes.api.base.IMesPartInspectionService; import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant; +import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; +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 io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,4 +22,19 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping(MesCommonConstant.MES_YANFEN + "/mesPartInspection") public class MesPartInspectionController extends BaseMesController { + @Autowired + private IMesPartInspectionService mesPartInspectionService; + + @GetMapping("/query-param") + @ApiOperation(value = "查询零件检测") + public ResultBean queryMesPartInspectionParamByPager(MesPartInspection mesPartInspection, Pager pager) { + + try { + return ResultBean.success("查询成功").setListPager(mesPartInspectionService.queryMesPartInspectionParamByPager(mesPartInspection, pager)); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } } diff --git a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/base/MesPartInspectionService.java b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/base/MesPartInspectionService.java index 68e037b..b7c1eb0 100644 --- a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/base/MesPartInspectionService.java +++ b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/base/MesPartInspectionService.java @@ -1,17 +1,29 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base; import cn.estsh.i3plus.ext.mes.api.base.IMesPartInspectionService; +import cn.estsh.i3plus.platform.common.util.MesConstWords; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.base.common.PagerHelper; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; +import cn.estsh.i3plus.pojo.mes.repository.MesWorkCenterRepository; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.util.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service @Slf4j public class MesPartInspectionService extends BaseMesService implements IMesPartInspectionService { - + @Autowired + private MesWorkCenterRepository mesWorkCenterRDao; @Override protected void setPackQueryBean(MesPartInspection bean, DdlPackBean packBean) { DdlPreparedPack.getStringEqualPack(bean.getSn(), "sn", packBean); @@ -28,4 +40,36 @@ public class MesPartInspectionService extends BaseMesService // DdlPreparedPack.getStringLikerPack(bean.getInspectionDate(), "inspectionDate", packBean); } + @Override + public ListPager queryMesPartInspectionParamByPager(MesPartInspection bean, Pager pager) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(bean.getSn(), "sn", packBean); + DdlPreparedPack.getStringLikerPack(bean.getPartNo(), "partNo", packBean); + DdlPreparedPack.getStringLikerPack(bean.getPartName(), "partName", packBean); + DdlPreparedPack.getStringLikerPack(bean.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getNumEqualPack(bean.getNcStatus(), "ncStatus", packBean); + if (StringUtils.isNotBlank(bean.getCreateDateTimeStart()) && StringUtils.isNotBlank(bean.getCreateDateTimeEnd())) { + DdlPreparedPack.timeBuilder(bean.getCreateDateTimeStart(), bean.getCreateDateTimeEnd(), "createDatetime", packBean, true); + } + if (StringUtils.isNotBlank(bean.getModifyDateTimeStart()) && StringUtils.isNotBlank(bean.getModifyDateTimeEnd())) { + DdlPreparedPack.timeBuilder(bean.getModifyDateTimeStart(), bean.getModifyDateTimeEnd(), "modifyDatetime", packBean, true); + } + pager = PagerHelper.getPager(pager, baseRDao.findByHqlWhereCount(packBean)); + + List resultList = baseRDao.findByHqlWherePage(packBean, pager); + if (!CollectionUtils.isEmpty(resultList)){ + for (MesPartInspection mesPartInspection : resultList) { + if (!StringUtils.isEmpty(mesPartInspection.getWorkCenterCode())){ + MesWorkCenter mesWorkCenter = mesWorkCenterRDao.getByProperty( + new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID, "workCenterCode"}, + new Object[]{bean.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), + CommonEnumUtil.IS_VAILD.VAILD.getValue(), mesPartInspection.getWorkCenterCode()}); + if (null != mesWorkCenter) { + mesPartInspection.setWorkCenterName(mesWorkCenter.getWorkCenterName()); + } + } + } + } + return new ListPager<>(resultList, pager); + } } diff --git a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/report/MesEquipmentLogDetailService.java b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/report/MesEquipmentLogDetailService.java index 21c9e0a..750a8b2 100644 --- a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/report/MesEquipmentLogDetailService.java +++ b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/report/MesEquipmentLogDetailService.java @@ -30,9 +30,15 @@ public class MesEquipmentLogDetailService extends BaseMesService 1) { + DdlPreparedPack.getInPackList(Arrays.asList(bean.getEquipVariableName().split(",")), MesExtConstWords.EQUIP_VARIABLE_NAME, packBean); + } else { + DdlPreparedPack.getStringLikerPack(bean.getEquipVariableName(), MesExtConstWords.EQUIP_VARIABLE_NAME, packBean); + } DdlPreparedPack.timeBuilder(bean.getCreateDateTimeStart(), bean.getCreateDateTimeEnd(), MesExtConstWords.CREATE_DATE_TIME, packBean, true); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{MesExtConstWords.CREATE_DATE_TIME}, packBean); }