From 529edd19d6bce15000604bf18d0cc766b66d376c Mon Sep 17 00:00:00 2001 From: gsz Date: Tue, 28 May 2024 19:35:39 +0800 Subject: [PATCH] =?UTF-8?q?MES-PCN=E8=AE=BE=E5=A4=87=E5=81=9C=E6=9C=BA?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B+=E5=BC=80=E5=85=B3=E7=8F=AD=E8=AE=B0?= =?UTF-8?q?=E5=BD=95+=E4=BA=A7=E7=BA=BF=E4=B8=8E=E7=8F=AD=E7=BB=84+?= =?UTF-8?q?=E4=BA=A7=E7=BA=BF=E4=B8=8E=E7=8F=AD=E6=AC=A1=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/base/IMesBasDowntimeReasonTypeService.java | 24 +++++++ .../pcn/api/base/IMesProdShiftRecordService.java | 23 ++++++ .../api/base/IMesShiftGroupCenterCfgService.java | 20 ++++++ .../ext/mes/pcn/api/base/IMesShiftService.java | 21 ++++++ .../busi/MesDowntimeReasonTypeController.java | 51 ++++++++++++++ .../busi/MesProdShiftRecordController.java | 82 ++++++++++++++++++++++ .../controller/busi/MesShiftController.java | 44 ++++++++++++ .../busi/MesShiftGroupCenterCfgController.java | 41 +++++++++++ .../base/MesBasDowntimeReasonTypeServiceImpl.java | 70 ++++++++++++++++++ .../base/MesProdShiftRecordServiceImpl.java | 79 +++++++++++++++++++++ .../base/MesShiftGroupCenterCfgServiceImpl.java | 46 ++++++++++++ .../serviceimpl/base/MesShiftServiceImpl.java | 46 ++++++++++++ 12 files changed, 547 insertions(+) create mode 100644 modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesBasDowntimeReasonTypeService.java create mode 100644 modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdShiftRecordService.java create mode 100644 modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesShiftGroupCenterCfgService.java create mode 100644 modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesShiftService.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesDowntimeReasonTypeController.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesProdShiftRecordController.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShiftController.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShiftGroupCenterCfgController.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesBasDowntimeReasonTypeServiceImpl.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftGroupCenterCfgServiceImpl.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftServiceImpl.java diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesBasDowntimeReasonTypeService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesBasDowntimeReasonTypeService.java new file mode 100644 index 0000000..c8e9d8d --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesBasDowntimeReasonTypeService.java @@ -0,0 +1,24 @@ +package cn.estsh.i3plus.ext.mes.pcn.api.base; + +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.mes.bean.MesDowntimeReasonType; + +import java.util.List; + +/** + * @Description :设备停机类型 + * @Reference : + * @Author : gsz + * @CreateDate 2024/5/17 14:06 + * @Modify: + **/ +public interface IMesBasDowntimeReasonTypeService { + + /** + * 查询设备停机类型和原因 + * @param downtimeReasonType + * @param pager + * @return + */ + List findMesDowntimeTypeReason(MesDowntimeReasonType downtimeReasonType, Pager pager); +} diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdShiftRecordService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdShiftRecordService.java new file mode 100644 index 0000000..b099b1a --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdShiftRecordService.java @@ -0,0 +1,23 @@ +package cn.estsh.i3plus.ext.mes.pcn.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.MesProdShiftRecord; +import io.swagger.annotations.ApiOperation; + +/** + * @Description: 开关班记录 + * @Author: gsz + * @Date: 2024/5/25 18:16 + * @Modify: + */ +public interface IMesProdShiftRecordService { + + @ApiOperation(value = "查询开关班记录") + public ListPager queryMesProdShiftRecordByPager(MesProdShiftRecord partInspection, Pager pager); + + void insertMesProdShiftRecord(MesProdShiftRecord item, String organizeCode); + + void saveMesProdShiftRecord(MesProdShiftRecord item, String organizeCode); +} diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesShiftGroupCenterCfgService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesShiftGroupCenterCfgService.java new file mode 100644 index 0000000..64266bb --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesShiftGroupCenterCfgService.java @@ -0,0 +1,20 @@ +package cn.estsh.i3plus.ext.mes.pcn.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.MesShiftGroupCenterCfg; +import io.swagger.annotations.ApiOperation; + +/** + * @Description: 产线与班组的对应关系 + * @Author: gsz + * @Date: 2024/5/25 18:16 + * @Modify: + */ +public interface IMesShiftGroupCenterCfgService { + + @ApiOperation(value = "查询产线与班组的对应关系") + public ListPager queryMesShiftGroupCenterCfgByPager(MesShiftGroupCenterCfg mesShiftGroupCenterCfg, Pager pager); + +} diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesShiftService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesShiftService.java new file mode 100644 index 0000000..66ba5b4 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesShiftService.java @@ -0,0 +1,21 @@ +package cn.estsh.i3plus.ext.mes.pcn.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.MesShift; +import io.swagger.annotations.ApiOperation; + +/** + * @Description: 产线与班次的对应关系 + * @Author: gsz + * @Date: 2024/5/25 18:16 + * @Modify: + */ +public interface IMesShiftService { + + + @ApiOperation(value = "查询产线与班次的对应关系") + public ListPager queryMesShiftByPager(MesShift mesShift, Pager pager); + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesDowntimeReasonTypeController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesDowntimeReasonTypeController.java new file mode 100644 index 0000000..f434f8e --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesDowntimeReasonTypeController.java @@ -0,0 +1,51 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesBasDowntimeReasonTypeService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesDowntimeReasonType; +import cn.estsh.impp.framework.boot.auth.AuthUtil; +import cn.estsh.impp.framework.boot.exception.ImppBusiException; +import cn.estsh.impp.framework.boot.util.ResultBean; +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; + +import java.util.List; + +/** + * @Description :设备停机类型 + * @Reference : + * @Author : gsz + * @CreateDate : 2024-05-17 14:16 + * @Modify: + **/ +@RestController +@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesDowntimeReasonType") +public class MesDowntimeReasonTypeController { + + @Autowired + private IMesBasDowntimeReasonTypeService downtimeReasonTypeService; + + @GetMapping(value = "/find-downtime-type-reason") + @ApiOperation(value = "查询设备停机类型和原因") + public ResultBean findMesDowntimeTypeReason(MesDowntimeReasonType mesDowntimeReasontype, Pager pager) { + try { + mesDowntimeReasontype.setOrganizeCode(AuthUtil.getOrganizeCode()); + //查询汇总工单数量 + List mesDowntimeReasonTypes = downtimeReasonTypeService.findMesDowntimeTypeReason(mesDowntimeReasontype, pager); + + return ResultBean.success("查询成功") + .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()) + .setListPager(new ListPager<>(mesDowntimeReasonTypes, pager)); + } catch (ImppBusiException e) { + return ResultBean.fail(e).build(); + } catch (Exception e) { + return ResultBean.fail(e); + } + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesProdShiftRecordController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesProdShiftRecordController.java new file mode 100644 index 0000000..e90a77c --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesProdShiftRecordController.java @@ -0,0 +1,82 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord; +import cn.estsh.impp.framework.boot.auth.AuthUtil; +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 io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +/** + * @Description: 开关班记录 + * @Author: gsz + * @Date: 2024/5/25 18:16 + * @Modify: + */ +@RestController +@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesProdShiftRecord") +public class MesProdShiftRecordController { + + private IMesProdShiftRecordService mesProdShiftRecordService; + + @GetMapping("/query-pager") + @ApiOperation(value = "查询开关班记录") + public ResultBean queryMesProdShiftRecordByPager(MesProdShiftRecord mesProdShiftRecord, Pager pager) { + try { + mesProdShiftRecord.setOrganizeCode(AuthUtil.getOrganizeCode()); + ListPager partInspectionListPager = mesProdShiftRecordService.queryMesProdShiftRecordByPager(mesProdShiftRecord, pager); + return ResultBean.success("查询成功").setListPager(partInspectionListPager); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + + @PostMapping("/insert") + @ApiOperation(value = "保存开关班记录") + public ResultBean insertMesProdShiftRecord(@RequestBody MesProdShiftRecord item) { + + try { + // 数据校验 + ValidatorBean.checkNotNull(item.getOrganizeCode(), "工厂号不能为空"); + ValidatorBean.checkNotNull(item.getWorkCenterCode(), "workCenterCode不能为空" ); + ValidatorBean.checkNotNull(item.getShiftGroup(), "shiftGroup不能为空"); + ValidatorBean.checkNotNull(item.getShiftCode(), "shiftCode不能为空"); + + + mesProdShiftRecordService.insertMesProdShiftRecord(item, AuthUtil.getOrganizeCode()); + return ResultBean.success("NC处理成功"); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + + @PostMapping("/update") + @ApiOperation(value = "保存开关班记录") + public ResultBean updateMesProdShiftRecord(@RequestBody MesProdShiftRecord item) { + + try { + // 数据校验 + ValidatorBean.checkNotNull(item.getOrganizeCode(), "工厂号不能为空"); + ValidatorBean.checkNotNull(item.getWorkCenterCode(), "workCenterCode不能为空" ); + ValidatorBean.checkNotNull(item.getShiftGroup(), "shiftGroup不能为空"); + ValidatorBean.checkNotNull(item.getShiftCode(), "shiftCode不能为空"); + + mesProdShiftRecordService.saveMesProdShiftRecord(item, AuthUtil.getOrganizeCode()); + return ResultBean.success("NC处理成功"); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShiftController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShiftController.java new file mode 100644 index 0000000..782fce7 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShiftController.java @@ -0,0 +1,44 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.mes.bean.MesShift; +import cn.estsh.impp.framework.boot.auth.AuthUtil; +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.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Description: 产线与班次的对应关系 + * @Author: gsz + * @Date: 2024/5/25 18:16 + * @Modify: + */ +@RestController +@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesShift") +public class MesShiftController { + + private IMesShiftService mesShiftService; + + @GetMapping("/query-pager") + @ApiOperation(value = "产线与班次的对应关系") + public ResultBean queryMesShiftByPager(MesShift mesShift, Pager pager) { + try { + mesShift.setOrganizeCode(AuthUtil.getOrganizeCode()); + ListPager partInspectionListPager = mesShiftService.queryMesShiftByPager(mesShift, pager); + return ResultBean.success("查询成功").setListPager(partInspectionListPager); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShiftGroupCenterCfgController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShiftGroupCenterCfgController.java new file mode 100644 index 0000000..ea2a099 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShiftGroupCenterCfgController.java @@ -0,0 +1,41 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftGroupCenterCfgService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.mes.bean.MesShiftGroupCenterCfg; +import cn.estsh.impp.framework.boot.auth.AuthUtil; +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.ApiOperation; +import org.springframework.web.bind.annotation.*; + +/** + * @Description: 产线与班组的对应关系 + * @Author: gsz + * @Date: 2024/5/25 18:16 + * @Modify: + */ +@RestController +@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesShiftGroupCenterCfg") +public class MesShiftGroupCenterCfgController { + + private IMesShiftGroupCenterCfgService mesShiftGroupCenterCfgService; + + @GetMapping("/query-pager") + @ApiOperation(value = "产线与班组的对应关系") + public ResultBean queryMesShiftGroupCenterCfgByPager(MesShiftGroupCenterCfg mesShiftGroupCenterCfg, Pager pager) { + try { + mesShiftGroupCenterCfg.setOrganizeCode(AuthUtil.getOrganizeCode()); + ListPager partInspectionListPager = mesShiftGroupCenterCfgService.queryMesShiftGroupCenterCfgByPager(mesShiftGroupCenterCfg, pager); + return ResultBean.success("查询成功").setListPager(partInspectionListPager); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesBasDowntimeReasonTypeServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesBasDowntimeReasonTypeServiceImpl.java new file mode 100644 index 0000000..02ec227 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesBasDowntimeReasonTypeServiceImpl.java @@ -0,0 +1,70 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesBasDowntimeReasonTypeService; +import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +import cn.estsh.i3plus.pojo.base.util.StringUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesDowntimeReason; +import cn.estsh.i3plus.pojo.mes.bean.MesDowntimeReasonType; +import cn.estsh.i3plus.pojo.mes.repository.IMesBasDowntimeReasonRepository; +import cn.estsh.i3plus.pojo.mes.repository.IMesBasDowntimeReasonTypeRepository; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +/** + * @Description : 设备停机类型 + * @Reference : + * @Author : gsz + * @CreateDate 2024/5/17 14:06 + * @Modify: + **/ +@Service +@Slf4j +public class MesBasDowntimeReasonTypeServiceImpl implements IMesBasDowntimeReasonTypeService { + + @Autowired + private IMesBasDowntimeReasonRepository downtimeReasonRDao; + @Autowired + private IMesBasDowntimeReasonTypeRepository downtimeReasonTypeRDao; + + + /** + * 查询设备停机类型和原因 + * + * @param downtimeReasonType + * @param pager + * @return + */ + @Override + public List findMesDowntimeTypeReason(MesDowntimeReasonType downtimeReasonType, Pager pager) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(downtimeReasonType.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(downtimeReasonType.getReasonTypeCode(), "reasonTypeCode", packBean); + List downtimeReasonTypeList = downtimeReasonTypeRDao.findByHqlPage(packBean, pager); + + if (!CollectionUtils.isEmpty(downtimeReasonTypeList)) { + //查对应原因 + List mesDowntimeReasonList = downtimeReasonRDao.findByProperty( + new String[]{"organizeCode", "isDeleted", "isValid"}, + new Object[]{downtimeReasonType.getOrganizeCode(), + CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue()}); + + Map> reasonMap = mesDowntimeReasonList.stream().collect(Collectors.groupingBy(MesDowntimeReason::getReasonTypeCode)); + + for (MesDowntimeReasonType mesDowntimeReasonType : downtimeReasonTypeList) { + if (!StringUtil.isEmpty(reasonMap.get(mesDowntimeReasonType.getReasonTypeCode()))) { + mesDowntimeReasonType.setDowntimeReasonList(reasonMap.get(mesDowntimeReasonType.getReasonTypeCode())); + } + } + } + return downtimeReasonTypeList; + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java new file mode 100644 index 0000000..3681bff --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java @@ -0,0 +1,79 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum; +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.base.util.StringUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord; +import cn.estsh.i3plus.pojo.mes.repository.MesProdShiftRecordRepository; +import cn.estsh.impp.framework.boot.auth.AuthUtil; +import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * @Description: 开关班记录表 + * @Author: gsz + * @Date: 2024/5/21 14:16 + * @Modify: + */ +@Service +@Slf4j +public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService { + + @Autowired + private MesProdShiftRecordRepository mesProdShiftRecordRDao; + + @Override + public ListPager queryMesProdShiftRecordByPager(MesProdShiftRecord bean, Pager pager) { + + DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(bean.getShiftGroup(), "shiftGroup", packBean); + DdlPreparedPack.getStringEqualPack(bean.getShiftCode(), "shiftCode", packBean); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); + pager = PagerHelper.getPager(pager, mesProdShiftRecordRDao.findByHqlWhereCount(packBean)); + + List resultList = mesProdShiftRecordRDao.findByHqlWherePage(packBean, pager); + + return new ListPager<>(resultList, pager); + } + + @Override + public void insertMesProdShiftRecord(MesProdShiftRecord item, String organizeCode) { + + ConvertBean.serviceModelInitialize(item, AuthUtil.getSessionUser().getUserName()); + mesProdShiftRecordRDao.save(item); + } + @Override + public void saveMesProdShiftRecord(MesProdShiftRecord item, String organizeCode) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(item.getWorkCenterCode(), "workCenterCode", packBean); +// DdlPreparedPack.getStringEqualPack(item.getShiftGroup(), "shiftGroup", packBean); +// DdlPreparedPack.getStringEqualPack(item.getShiftCode(), "shiftCode", packBean); + + MesProdShiftRecord mesProdShiftRecord = mesProdShiftRecordRDao.getByProperty(packBean); + if (StringUtil.isEmpty(mesProdShiftRecord)) { + throw ImppExceptionBuilder.newInstance() + .setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode()) + .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode()) + .setErrorDetail("开关班记录产线【%s】班组代码【%s】班次代码【%s】不存在,请检查数据", + item.getWorkCenterCode(),item.getShiftGroup(),item.getShiftCode()) + .build(); + } + mesProdShiftRecord.setShiftGroup(item.getShiftGroup()); + mesProdShiftRecord.setShiftCode(item.getShiftCode()); + ConvertBean.serviceModelUpdate(item, AuthUtil.getSessionUser().getUserName()); + mesProdShiftRecordRDao.save(item); + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftGroupCenterCfgServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftGroupCenterCfgServiceImpl.java new file mode 100644 index 0000000..3d183a5 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftGroupCenterCfgServiceImpl.java @@ -0,0 +1,46 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftGroupCenterCfgService; +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.MesShiftGroupCenterCfg; +import cn.estsh.i3plus.pojo.mes.repository.MesShiftGroupCenterCfgRepository; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * @Description: 产线与班组的对应关系 + * @Author: gsz + * @Date: 2024/5/21 14:16 + * @Modify: + */ +@Service +@Slf4j +public class MesShiftGroupCenterCfgServiceImpl implements IMesShiftGroupCenterCfgService { + + @Autowired + private MesShiftGroupCenterCfgRepository mesShiftGroupCenterCfgRDao; + + @Override + public ListPager queryMesShiftGroupCenterCfgByPager(MesShiftGroupCenterCfg bean, Pager pager) { + + DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(bean.getShiftGroup(), "shiftGroup", packBean); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); + pager = PagerHelper.getPager(pager, mesShiftGroupCenterCfgRDao.findByHqlWhereCount(packBean)); + + List resultList = mesShiftGroupCenterCfgRDao.findByHqlWherePage(packBean, pager); + + return new ListPager<>(resultList, pager); + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftServiceImpl.java new file mode 100644 index 0000000..b8ea6e8 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesShiftServiceImpl.java @@ -0,0 +1,46 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftService; +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.MesShift; +import cn.estsh.i3plus.pojo.mes.repository.MesShiftRepository; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * @Description: 产线与班次的对应关系 + * @Author: gsz + * @Date: 2024/5/21 14:16 + * @Modify: + */ +@Service +@Slf4j +public class MesShiftServiceImpl implements IMesShiftService { + + @Autowired + private MesShiftRepository mesShiftRepository; + + @Override + public ListPager queryMesShiftByPager(MesShift bean, Pager pager) { + + DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(bean.getShiftCode(), "shiftCode", packBean); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); + pager = PagerHelper.getPager(pager, mesShiftRepository.findByHqlWhereCount(packBean)); + + List resultList = mesShiftRepository.findByHqlWherePage(packBean, pager); + + return new ListPager<>(resultList, pager); + } + +}