Merge remote-tracking branch 'origin/main'

plp
86158 2 months ago
commit 71eb752282

@ -35,12 +35,16 @@ public interface ErrorCodeConstants {
//======================================数据采集相关=================================================
ErrorCode DEVICE_MODEL_NOT_EXISTS = new ErrorCode(1_003_000_000, "采集设备模型不存在");
ErrorCode DEVICE_MODEL_CODE_EXISTS = new ErrorCode(1_003_000_000, "采集设备模型编码已存在");
ErrorCode DEVICE_ID_MODEL_NOT_EXISTS = new ErrorCode(1_003_000_000, "该设备模型ID不能为空");
ErrorCode POINT_ID_MODEL_NOT_EXISTS = new ErrorCode(1_003_000_000, "该点位参数ID不能为空");
ErrorCode DEVICE_MODEL_ATTRIBUTE_NOT_EXISTS = new ErrorCode(1_003_000_000, "采集设备模型点位不存在");
ErrorCode DEVICE_ATTRIBUTE_NOT_EXISTS = new ErrorCode(1_003_000_000, "设备属性不存在");
ErrorCode DEVICE_ATTRIBUTE_TYPE_NOT_EXISTS = new ErrorCode(1_003_000_000, "采集点分类不存在");
ErrorCode DEVICE_CODE_EXISTS = new ErrorCode(1_003_000_000, "采集点编码已存在");
ErrorCode ENDPOINT_DOES_NOT_EXIS = new ErrorCode(1_003_000_000, "暂未设置设备端点");
ErrorCode DEVICE_DOES_NOT_EXIST= new ErrorCode(1_003_000_000, "该采集设备不存在");
ErrorCode DEVICE_ID_DOES_NOT_EXIST= new ErrorCode(1_003_000_000, "该设备ID不能为空");

@ -1,8 +1,11 @@
package cn.iocoder.yudao.module.iot.service.deviceattributetype;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodelattribute.DeviceModelAttributeDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
@ -32,6 +35,14 @@ public class DeviceAttributeTypeServiceImpl implements DeviceAttributeTypeServic
@Override
public Long createDeviceAttributeType(DeviceAttributeTypeSaveReqVO createReqVO) {
// 重复判断
Long count = deviceAttributeTypeMapper.selectCount(new LambdaQueryWrapper<DeviceAttributeTypeDO>()
.eq(DeviceAttributeTypeDO::getCode, createReqVO.getCode())
);
if (count > 0) {
throw exception(DEVICE_CODE_EXISTS);
}
// 插入
DeviceAttributeTypeDO deviceAttributeType = BeanUtils.toBean(createReqVO, DeviceAttributeTypeDO.class);
deviceAttributeTypeMapper.insert(deviceAttributeType);
@ -41,6 +52,16 @@ public class DeviceAttributeTypeServiceImpl implements DeviceAttributeTypeServic
@Override
public void updateDeviceAttributeType(DeviceAttributeTypeSaveReqVO updateReqVO) {
// 重复判断
Long count = deviceAttributeTypeMapper.selectCount(new LambdaQueryWrapper<DeviceAttributeTypeDO>()
.eq(DeviceAttributeTypeDO::getCode, updateReqVO.getCode())
.ne(DeviceAttributeTypeDO::getId, updateReqVO.getId())
);
if (count > 0) {
throw exception(DEVICE_CODE_EXISTS);
}
// 校验存在
validateDeviceAttributeTypeExists(updateReqVO.getId());
// 更新

@ -45,6 +45,15 @@ public class DeviceModelServiceImpl implements DeviceModelService {
@Override
public Long createDeviceModel(DeviceModelSaveReqVO createReqVO) {
//编码重复判断
Long count = deviceModelMapper.selectCount(new LambdaQueryWrapper<DeviceModelDO>()
.eq(DeviceModelDO::getCode, createReqVO.getCode())
);
if (count > 0) {
throw exception(DEVICE_MODEL_CODE_EXISTS);
}
// 插入
DeviceModelDO deviceModel = BeanUtils.toBean(createReqVO, DeviceModelDO.class);
deviceModelMapper.insert(deviceModel);
@ -54,6 +63,16 @@ public class DeviceModelServiceImpl implements DeviceModelService {
@Override
public void updateDeviceModel(DeviceModelSaveReqVO updateReqVO) {
//编码重复判断
Long count = deviceModelMapper.selectCount(new LambdaQueryWrapper<DeviceModelDO>()
.eq(DeviceModelDO::getCode, updateReqVO.getCode())
.ne(DeviceModelDO::getId, updateReqVO.getId())
);
if (count > 0) {
throw exception(DEVICE_MODEL_CODE_EXISTS);
}
// 校验存在
validateDeviceModelExists(updateReqVO.getId());
// 更新

@ -78,14 +78,17 @@ public interface ErrorCodeConstants {
ErrorCode DV_CHECK_NOT_EXISTS = new ErrorCode(5_0087, "维保计划不存在");
ErrorCode DV_SUBJECT_NOT_EXISTS = new ErrorCode(5_0087, "维保项目不存在");
ErrorCode DV_REPAIR_NOT_EXISTS = new ErrorCode(5_0087, "设备维修记录不存在");
ErrorCode DV_REPAIR_CODE_EXISTS = new ErrorCode(5_0087, "设备维修记录编码已存在");
ErrorCode ZJ_TYPE_NOT_EXISTS = new ErrorCode(5_009, "检验类型不存在");
ErrorCode ZJ_ITEM_NOT_EXISTS = new ErrorCode(5_0091, "检验项目不存在");
ErrorCode ZJ_SCHEMA_NOT_EXISTS = new ErrorCode(5_0092, "检验方案不存在");
ErrorCode ZJ_PRODUCT_NOT_EXISTS = new ErrorCode(5_0093, "检验参数不存在");
ErrorCode ZJ_PRODUCT_RECORD_NOT_EXISTS = new ErrorCode(5_0093, "检验参数不存在");
//======================================设备台账相关 1002000000=================================================
//======================================设备管理相关 1002000000=================================================
ErrorCode DEVICE_TYPE_NOT_EXISTS = new ErrorCode(1002000000, "设备类型不存在");
ErrorCode DEVICE_TYPE_PARENT_NOT_EXISTS = new ErrorCode(1002000001, "父级设备类型不存在");
ErrorCode DEVICE_TYPE_PARENT_IS_SELF = new ErrorCode(1002000002, "不能设置自己为父级");
@ -102,5 +105,8 @@ public interface ErrorCodeConstants {
ErrorCode TICKET_MANAGEMENT_NOT_EXISTS = new ErrorCode(1002000012, "工单管理不存在");
ErrorCode TICKET_RESULTS_NOT_EXISTS = new ErrorCode(1002000013, "工单检验结果不存在");
ErrorCode TICKET_RESULTS_ID_NOT_NULL = new ErrorCode(1002000014, "工单检验结果Id不存在");
ErrorCode CRITICAL_COMPONENT_NOT_EXISTS = new ErrorCode(1002000015, "设备关键件不存在");
ErrorCode REPAIR_TEMS_NOT_EXISTS = new ErrorCode(1002000016, "维修项目不存在");
ErrorCode REPAIR_TEMS_CODE_EXISTS = new ErrorCode(1002000016, "维修项目编码已存在");
}

@ -3,9 +3,12 @@ package cn.iocoder.yudao.module.mes.controller.admin.baogongrecord;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.module.mes.controller.admin.itemrequisition.vo.ItemRequisitionRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.plan.vo.PlanRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.plan.vo.PlanSaveReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.itemrequisition.ItemRequisitionDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.plan.PlanDO;
import cn.iocoder.yudao.module.mes.service.plan.PlanService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.web.bind.annotation.*;
@ -19,6 +22,8 @@ import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.io.IOException;
@ -47,6 +52,9 @@ public class BaogongRecordController {
@Resource
private BaogongRecordService baogongRecordService;
@Resource
private PlanService planService;
@Resource
private AdminUserApi adminUserApi;
@ -54,6 +62,27 @@ public class BaogongRecordController {
@Operation(summary = "创建报工")
@PreAuthorize("@ss.hasPermission('mes:baogong-record:create')")
public CommonResult<Long> createBaogongRecord(@Valid @RequestBody BaogongRecordSaveReqVO createReqVO) {
PlanDO plan = planService.getPlan(createReqVO.getPlanId());
if (plan.getWangongNumber() == null) {
plan.setWangongNumber(0L);
}
if (plan.getPassNumber() == null) {
plan.setPassNumber(0L);
}
if (plan.getNoPassNumber() == null) {
plan.setNoPassNumber(0L);
}
plan.setWangongNumber(plan.getWangongNumber() + createReqVO.getNum() + createReqVO.getNoPassNum());
plan.setPassNumber(plan.getPassNumber() + createReqVO.getNum());
plan.setNoPassNumber(plan.getNoPassNumber() + createReqVO.getNoPassNum());
if (plan.getWangongNumber() <= 0) {
plan.setPassRate(BigDecimal.ZERO);
} else {
BigDecimal rate = new BigDecimal(plan.getPassNumber())
.divide(new BigDecimal(plan.getWangongNumber()), 4, RoundingMode.HALF_UP);
plan.setPassRate(rate.multiply(new BigDecimal("100")));
}
planService.updatePlan(BeanUtils.toBean(plan, PlanSaveReqVO.class));
return success(baogongRecordService.createBaogongRecord(createReqVO));
}

@ -32,4 +32,10 @@ public class BaogongRecordPageReqVO extends PageParam {
@Schema(description = "报工人", requiredMode = Schema.RequiredMode.REQUIRED)
private String creator;
@Schema(description = "不合格数量")
private Long noPassNum;
@Schema(description = "原因")
private String remark;
}

@ -20,8 +20,8 @@ public class BaogongRecordRespVO {
@ExcelProperty("关联计划id")
private Long planId;
@Schema(description = "工数量")
@ExcelProperty("工数量")
@Schema(description = "工数量")
@ExcelProperty("工数量")
private Long num;
@Schema(description = "派工时间")
@ -35,4 +35,12 @@ public class BaogongRecordRespVO {
@Schema(description = "报工人", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("报工人")
private String creator;
@Schema(description = "不合格数量")
@ExcelProperty("不合格数量")
private Long noPassNum;
@Schema(description = "原因")
@ExcelProperty("原因")
private String remark;
}

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.mes.controller.admin.baogongrecord.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@ -24,4 +25,10 @@ public class BaogongRecordSaveReqVO {
@Schema(description = "派工时间")
private LocalDateTime baogongTime;
@Schema(description = "不合格数量")
private Long noPassNum;
@Schema(description = "原因")
private String remark;
}

@ -0,0 +1,101 @@
package cn.iocoder.yudao.module.mes.controller.admin.criticalcomponent;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.mes.controller.admin.criticalcomponent.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
import cn.iocoder.yudao.module.mes.service.criticalcomponent.CriticalComponentService;
@Tag(name = "管理后台 - 设备关键件")
@RestController
@RequestMapping("/mes/critical-component")
@Validated
public class CriticalComponentController {
@Resource
private CriticalComponentService criticalComponentService;
@PostMapping("/create")
@Operation(summary = "创建设备关键件")
@PreAuthorize("@ss.hasPermission('mes:critical-component:create')")
public CommonResult<Long> createCriticalComponent(@Valid @RequestBody CriticalComponentSaveReqVO createReqVO) {
return success(criticalComponentService.createCriticalComponent(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新设备关键件")
@PreAuthorize("@ss.hasPermission('mes:critical-component:update')")
public CommonResult<Boolean> updateCriticalComponent(@Valid @RequestBody CriticalComponentSaveReqVO updateReqVO) {
criticalComponentService.updateCriticalComponent(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除设备关键件")
@Parameter(name = "ids", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('mes:critical-component:delete')")
public CommonResult<Boolean> deleteCriticalComponent(@RequestParam("ids") String ids) {
// 将逗号分隔的字符串转换为Long类型的List
List<Long> idList = Arrays.stream(ids.split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
criticalComponentService.deleteCriticalComponent(idList);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得设备关键件")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:critical-component:query')")
public CommonResult<CriticalComponentRespVO> getCriticalComponent(@RequestParam("id") Long id) {
CriticalComponentDO criticalComponent = criticalComponentService.getCriticalComponent(id);
return success(BeanUtils.toBean(criticalComponent, CriticalComponentRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得设备关键件分页")
@PreAuthorize("@ss.hasPermission('mes:critical-component:query')")
public CommonResult<PageResult<CriticalComponentRespVO>> getCriticalComponentPage(@Valid CriticalComponentPageReqVO pageReqVO) {
PageResult<CriticalComponentDO> pageResult = criticalComponentService.getCriticalComponentPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CriticalComponentRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出设备关键件 Excel")
@PreAuthorize("@ss.hasPermission('mes:critical-component:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCriticalComponentExcel(@Valid CriticalComponentPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CriticalComponentDO> list = criticalComponentService.getCriticalComponentPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "设备关键件.xls", "数据", CriticalComponentRespVO.class,
BeanUtils.toBean(list, CriticalComponentRespVO.class));
}
}

@ -0,0 +1,38 @@
package cn.iocoder.yudao.module.mes.controller.admin.criticalcomponent.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 设备关键件分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CriticalComponentPageReqVO extends PageParam {
@Schema(description = "编码(唯一标识)")
private String code;
@Schema(description = "名称", example = "张三")
private String name;
@Schema(description = "描述", example = "你说的对")
private String description;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "id集合导出用")
private String ids;
}

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.mes.controller.admin.criticalcomponent.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 设备关键件 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CriticalComponentRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14503")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "编码(唯一标识)", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("编码(唯一标识)")
private String code;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("名称")
private String name;
@Schema(description = "描述", example = "你说的对")
@ExcelProperty("描述")
private String description;
@Schema(description = "备注", example = "你说的对")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.mes.controller.admin.criticalcomponent.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 设备关键件新增/修改 Request VO")
@Data
public class CriticalComponentSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14503")
private Long id;
@Schema(description = "编码(唯一标识)", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "编码(唯一标识)不能为空")
private String code;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "名称不能为空")
private String name;
@Schema(description = "描述", example = "你说的对")
private String description;
@Schema(description = "备注", example = "你说的对")
private String remark;
}

@ -77,4 +77,7 @@ public class DeviceLedgerPageReqVO extends PageParam {
@Schema(description = "id集合导出用")
private String ids;
@Schema(description = "关键件id")
private String componentId;
}

@ -1,12 +1,16 @@
package cn.iocoder.yudao.module.mes.controller.admin.deviceledger.vo;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import com.alibaba.excel.annotation.*;
import org.springframework.format.annotation.DateTimeFormat;
@ -103,6 +107,16 @@ public class DeviceLedgerRespVO extends BaseDO {
@ExcelProperty("创建人名字")
private String creatorName;
@Schema(description = "点检结果列表")
private List<TicketResultsDO> inspectionList;
@Schema(description = "保养结果列表")
private List<TicketResultsDO> maintainList;
@Schema(description = "附件地址")
@ExcelProperty("附件地址")
private String fileUrl;
@Schema(description = "关键件id")
private String componentId;
}

@ -64,4 +64,9 @@ public class DeviceLedgerSaveReqVO {
@Schema(description = "排序")
private Integer sort;
@Schema(description = "附件下载")
private String fileUrl;
@Schema(description = "关键件ids集合")
private String componentId;
}

@ -10,8 +10,10 @@ import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.DvRepairPageReqV
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.DvRepairRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.DvRepairSaveReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepairline.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.service.dvrepair.DvRepairService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -23,7 +25,9 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -37,6 +41,9 @@ public class DvRepairController {
@Resource
private DvRepairService dvRepairService;
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create")
@Operation(summary = "创建设备维修记录")
@PreAuthorize("@ss.hasPermission('mes:dv-repair:create')")
@ -54,10 +61,16 @@ public class DvRepairController {
@DeleteMapping("/delete")
@Operation(summary = "删除设备维修记录")
@Parameter(name = "id", description = "编号", required = true)
@Parameter(name = "ids", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('mes:dv-repair:delete')")
public CommonResult<Boolean> deleteDvRepair(@RequestParam("id") Long id) {
dvRepairService.deleteDvRepair(id);
public CommonResult<Boolean> deleteDvRepair(@RequestParam("ids") String ids) {
// 将逗号分隔的字符串转换为Long类型的List
List<Long> idList = Arrays.stream(ids.split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
dvRepairService.deleteDvRepair(idList);
return success(true);
}
@ -75,7 +88,8 @@ public class DvRepairController {
@PreAuthorize("@ss.hasPermission('mes:dv-repair:query')")
public CommonResult<PageResult<DvRepairRespVO>> getDvRepairPage(@Valid DvRepairPageReqVO pageReqVO) {
PageResult<DvRepairDO> pageResult = dvRepairService.getDvRepairPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, DvRepairRespVO.class));
PageResult<DvRepairRespVO> dvRepairRespVOPageResult = BeanUtils.toBean(pageResult, DvRepairRespVO.class);
return success(buildCreatorName(dvRepairRespVOPageResult));
}
@GetMapping("/export-excel")
@ -101,4 +115,20 @@ public class DvRepairController {
return success(dvRepairService.getDvRepairLineListByRepairId(repairId));
}
private PageResult<DvRepairRespVO> buildCreatorName(PageResult<DvRepairRespVO> dvSubjectRespVOPageResult) {
for (DvRepairRespVO dvSubjectRespVO : dvSubjectRespVOPageResult.getList()) {
if (dvSubjectRespVO.getAcceptedBy() !=null) {
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(dvSubjectRespVO.getAcceptedBy()));
dvSubjectRespVO.setAcceptedBy("(" + user.getUsername() + ")" + user.getNickname());
}
if (dvSubjectRespVO.getConfirmBy() !=null) {
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(dvSubjectRespVO.getConfirmBy()));
dvSubjectRespVO.setConfirmBy("(" + user.getUsername() + ")" + user.getNickname());
}
}
return dvSubjectRespVOPageResult;
}
}

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.mes.controller.admin.dvrepair.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*/
@Getter
@AllArgsConstructor
public enum MoldRecordStatusEnum {
PENDING(0, "待完成"),
COMPLETED(1, "已完成"),
// 可以根据需要添加其他状态
CANCELED(2, "已取消");
@JsonValue
private final Integer code;
private final String name;
@JsonCreator
public static MoldRecordStatusEnum getByCode(Integer code) {
if (code == null) {
return null;
}
for (MoldRecordStatusEnum status : MoldRecordStatusEnum.values()) {
if (status.getCode().equals(code)) {
return status;
}
}
return null;
}
}

@ -60,14 +60,17 @@ public class DvRepairPageReqVO extends PageParam {
@Schema(description = "验收人员")
private String confirmBy;
@Schema(description = "单据状态", example = "1")
private String status;
@Schema(description = "单据状态0-待完成 1-已完成", example = "1")
private Integer status;
@Schema(description = "备注", example = "你猜")
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "ids集合导出用")
private String ids;
}

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo;
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.enums.MoldRecordStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@ -16,7 +17,7 @@ import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
public class DvRepairRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27809")
@ExcelProperty("ID")
// @ExcelProperty("ID")
private Long id;
@Schema(description = "维修单编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ -28,7 +29,7 @@ public class DvRepairRespVO {
private String repairName;
@Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6979")
@ExcelProperty("设备ID")
// @ExcelProperty("设备ID")
private Long machineryId;
@Schema(description = "设备编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ -48,7 +49,7 @@ public class DvRepairRespVO {
private String machinerySpec;
@Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1622")
@ExcelProperty(value = "设备类型", converter = DictConvert.class)
// @ExcelProperty(value = "设备类型", converter = DictConvert.class)
@DictFormat("mes_machine_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private Long machineryTypeId;
@ -77,9 +78,9 @@ public class DvRepairRespVO {
private String confirmBy;
@Schema(description = "单据状态", example = "1")
@ExcelProperty(value = "单据状态", converter = DictConvert.class)
@ExcelProperty(value = "单据状态 0-待完成 1-已完成", converter = DictConvert.class)
@DictFormat("mes_mold_record_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private String status;
private MoldRecordStatusEnum status;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
@ -89,4 +90,14 @@ public class DvRepairRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "设备类型 1-设备 2-关键件", example = "你猜")
private Integer deviceType;
@Schema(description = "设备Id", example = "你猜")
private Long deviceId;
@Schema(description = "关键件Id", example = "你猜")
private Long componentId;
}

@ -1,6 +1,6 @@
package cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepairline.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -24,15 +24,15 @@ public class DvRepairSaveReqVO {
private String repairName;
@Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6979")
@NotNull(message = "设备ID不能为空")
// @NotNull(message = "设备ID不能为空")
private Long machineryId;
@Schema(description = "设备编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "设备编码不能为空")
// @NotEmpty(message = "设备编码不能为空")
private String machineryCode;
@Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "设备名称不能为空")
// @NotEmpty(message = "设备名称不能为空")
private String machineryName;
@Schema(description = "品牌")
@ -41,8 +41,8 @@ public class DvRepairSaveReqVO {
@Schema(description = "规格型号")
private String machinerySpec;
@Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1622")
@NotNull(message = "设备类型不能为空")
@Schema(description = "设备类型-待用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1622")
// @NotNull(message = "设备类型不能为空")
private Long machineryTypeId;
@Schema(description = "报修日期")
@ -72,4 +72,13 @@ public class DvRepairSaveReqVO {
@Schema(description = "设备维修记录行列表")
private List<DvRepairLineDO> dvRepairLines;
@Schema(description = "设备类型 1-设备 2-关键件")
private Integer deviceType;
@Schema(description = "设备Id")
private Long deviceId;
@Schema(description = "关键件Id")
private Long componentId;
}

@ -24,11 +24,17 @@ public class FeedingRecordDetailRespVO {
@ExcelProperty("记录")
private String recordCode;
@Schema(description = "原料id", example = "19133")
private Long itemId;
@Schema(description = "原料", example = "19133")
// @Schema(description = "原料id", example = "19133")
// private Long itemId;
// @Schema(description = "原料", example = "19133")
// @ExcelProperty("原料")
// private String itemName;
@Schema(description = "物料id", example = "19133")
private Long productId;
@Schema(description = "物料", example = "19133")
@ExcelProperty("原料")
private String itemName;
private String productName;
@Schema(description = "重量")
@ExcelProperty("重量")

@ -13,17 +13,24 @@ import cn.iocoder.yudao.module.iot.framework.mqtt.utils.DateUtils;
import cn.iocoder.yudao.module.mes.controller.admin.itemrequisition.vo.ItemRequisitionRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.itemrequisition.vo.ItemRequisitionSaveReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.plan.vo.*;
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.ZjProductRecordRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.ZjProductRecordSaveReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.itemrequisition.ItemRequisitionDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.plan.PlanDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproduct.ZjProductDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord.ZjProductRecordDO;
import cn.iocoder.yudao.module.mes.dal.mysql.plan.PlanMapper;
import cn.iocoder.yudao.module.mes.service.itemrequisition.ItemAnalysisService;
import cn.iocoder.yudao.module.mes.service.itemrequisition.entity.ItemRequisitionAndStock;
import cn.iocoder.yudao.module.mes.service.organization.OrganizationService;
import cn.iocoder.yudao.module.mes.service.plan.PlanService;
import cn.iocoder.yudao.module.mes.service.zjproduct.ZjProductService;
import cn.iocoder.yudao.module.mes.service.zjproductrecord.ZjProductRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -31,6 +38,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -54,12 +62,37 @@ public class PlanController {
@Resource
private OrganizationService organizationService;
@Resource
private ZjProductService zjProductService;
@Resource
private ZjProductRecordService zjProductRecordService;
@PostMapping("/create")
@Operation(summary = "创建生产计划")
@Transactional(rollbackFor = Exception.class)
//@PreAuthorize("@ss.hasPermission('mes:plan:create')")
public CommonResult<Long> createPlan(@Valid @RequestBody PlanSaveReqVO createReqVO) {
return success(planService.createPlan(createReqVO));
public CommonResult<Boolean> createPlan(@Valid @RequestBody PlanSaveReqVO createReqVO) {
Long id = planService.createPlan(createReqVO);
if (createReqVO.getIsPreProduction() != null && createReqVO.getIsPreProduction().compareTo(new BigDecimal(1)) == 0) {
// 查对应产品的质检参数
List<ZjProductDO> zjProductDOList = zjProductService.getZjProductByProductId(createReqVO.getProductId());
for (ZjProductDO source : zjProductDOList) {
ZjProductRecordDO zjProductRecordDO = new ZjProductRecordDO();
// 属性映射
zjProductRecordDO.setType(source.getType());
zjProductRecordDO.setName(source.getName());
zjProductRecordDO.setUnit(source.getUnit());
zjProductRecordDO.setUpperVal(source.getUpperVal());
zjProductRecordDO.setLowerVal(source.getLowerVal());
zjProductRecordDO.setProductId(source.getProductId());
zjProductRecordDO.setPlanId(id);
zjProductRecordService.createZjProductRecord(BeanUtils.toBean(zjProductRecordDO, ZjProductRecordSaveReqVO.class));
}
}
return success(true);
}
@PutMapping("/update")

@ -83,4 +83,16 @@ public class PlanPageReqVO extends PageParam {
@Schema(description = "是否完成质检")
private BigDecimal isZj;
@Schema(description = "完工数量")
private Long wangongNumber;
@Schema(description = "合格数量")
private Long passNumber;
@Schema(description = "不合格数量")
private Long noPassNumber;
@Schema(description = "合格率")
private BigDecimal passRate;
}

@ -129,4 +129,20 @@ public class PlanRespVO {
@Schema(description = "是否完成质检")
@ExcelProperty("是否完成质检")
private BigDecimal isZj;
@Schema(description = "完工数量")
@ExcelProperty("完工数量")
private Long wangongNumber;
@Schema(description = "合格数量")
@ExcelProperty("合格数量")
private Long passNumber;
@Schema(description = "不合格数量")
@ExcelProperty("不合格数量")
private Long noPassNumber;
@Schema(description = "合格率")
@ExcelProperty("合格率")
private BigDecimal passRate;
}

@ -83,4 +83,16 @@ public class PlanSaveReqVO {
@Schema(description = "是否完成质检")
private BigDecimal isZj;
@Schema(description = "完工数量")
private Long wangongNumber;
@Schema(description = "合格数量")
private Long passNumber;
@Schema(description = "不合格数量")
private Long noPassNumber;
@Schema(description = "合格率")
private BigDecimal passRate;
}

@ -0,0 +1,120 @@
package cn.iocoder.yudao.module.mes.controller.admin.repairtems;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.repairtems.RepairTemsDO;
import cn.iocoder.yudao.module.mes.service.repairtems.RepairTemsService;
@Tag(name = "管理后台 - 维修项目")
@RestController
@RequestMapping("/mes/repair-tems")
@Validated
public class RepairTemsController {
@Resource
private RepairTemsService repairTemsService;
@PostMapping("/create")
@Operation(summary = "创建维修项目")
@PreAuthorize("@ss.hasPermission('mes:repair-tems:create')")
public CommonResult<Long> createRepairTems(@Valid @RequestBody RepairTemsSaveReqVO createReqVO) {
return success(repairTemsService.createRepairTems(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新维修项目")
@PreAuthorize("@ss.hasPermission('mes:repair-tems:update')")
public CommonResult<Boolean> updateRepairTems(@Valid @RequestBody RepairTemsSaveReqVO updateReqVO) {
repairTemsService.updateRepairTems(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除维修项目")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('mes:repair-tems:delete')")
public CommonResult<Boolean> deleteRepairTems(@RequestParam("ids") String ids) {
List<Long> idList = Arrays.stream(ids.split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
repairTemsService.deleteRepairTems(idList);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得维修项目")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:repair-tems:query')")
public CommonResult<RepairTemsRespVO> getRepairTems(@RequestParam("id") Long id) {
RepairTemsDO repairTems = repairTemsService.getRepairTems(id);
return success(BeanUtils.toBean(repairTems, RepairTemsRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得维修项目分页")
@PreAuthorize("@ss.hasPermission('mes:repair-tems:query')")
public CommonResult<PageResult<RepairTemsRespVO>> getRepairTemsPage(@Valid RepairTemsPageReqVO pageReqVO) {
PageResult<RepairTemsRespVO> pageResult = repairTemsService.getRepairTemsPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出维修项目 Excel")
@PreAuthorize("@ss.hasPermission('mes:repair-tems:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportRepairTemsExcel(@Valid RepairTemsPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<RepairTemsRespVO> list = repairTemsService.getRepairTemsPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "维修项目.xls", "数据", RepairTemsRespVO.class,list);
}
@GetMapping("/getDeviceOrComponent")
@Operation(summary = "获得设备/关键件")
@Parameter(name = "deviceType", description = "deviceType 1-设备 2-关键件", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:repair-tems:query')")
public CommonResult<List<RepairTemsRespVO>> getDeviceOrComponent(@RequestParam("deviceType") Integer deviceType) {
return success( repairTemsService.getDeviceOrComponent(deviceType));
}
@GetMapping("/getDeviceOrComponentList")
@Operation(summary = "获得设备/关键件列表")
@Parameter(name = "deviceType", description = "deviceType 1-设备 2-关键件", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:repair-tems:query')")
public CommonResult<List<RepairTemsRespVO>> getDeviceOrComponentList(
@Parameter(name = "deviceId", description = "设备Id", required = true, example = "123")
@RequestParam("deviceId") Long deviceId,
@Parameter(name = "componentId", description = "关键件Id", required = true, example = "123")
@RequestParam("componentId") Long componentId) {
return success(repairTemsService.getDeviceOrComponentList(deviceId,componentId));
}
}

@ -0,0 +1,53 @@
package cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 维修项目分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RepairTemsPageReqVO extends PageParam {
@Schema(description = "项目编码")
private String subjectCode;
@Schema(description = "项目名称", example = "芋艿")
private String subjectName;
@Schema(description = "设备类型", example = "1")
private Integer deviceType;
@Schema(description = "设备id", example = "11632")
private Long deviceId;
@Schema(description = "关键件id", example = "29557")
private Long componentId;
@Schema(description = "检验方式")
private String inspectionMethod;
@Schema(description = "值类型", example = "1")
private String valueType;
@Schema(description = "判定基准")
private String judgmentCriteria;
@Schema(description = "是否启用")
private Boolean isEnable;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "项目内容")
private String projectContent;
}

@ -0,0 +1,76 @@
package cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 维修项目 Response VO")
@Data
@ExcelIgnoreUnannotated
public class RepairTemsRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15428")
// @ExcelProperty("ID")
private Long id;
@Schema(description = "项目编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目编码")
private String subjectCode;
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@ExcelProperty("项目名称")
private String subjectName;
@Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("设备类型")
private Integer deviceType;
@Schema(description = "设备id", example = "11632")
@ExcelProperty("设备id")
private Long deviceId;
@Schema(description = "关键件id", example = "29557")
@ExcelProperty("关键件id")
private Long componentId;
@Schema(description = "检验方式")
@ExcelProperty("检验方式")
private String inspectionMethod;
@Schema(description = "值类型", example = "1")
@ExcelProperty("值类型")
private String valueType;
@Schema(description = "判定基准")
@ExcelProperty("判定基准")
private String judgmentCriteria;
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否启用")
private Boolean isEnable;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "设备名称")
@ExcelProperty("设备名称")
private String deviceName;
@Schema(description = "关键件名称")
@ExcelProperty("关键件名称")
private String componentName;
@Schema(description = "创建人名称")
@ExcelProperty("创建人名称")
private String creatroName;
@Schema(description = "项目内容")
@ExcelProperty("项目内容")
private String projectContent;
}

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 维修项目新增/修改 Request VO")
@Data
public class RepairTemsSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15428")
private Long id;
@Schema(description = "项目编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "项目编码不能为空")
private String subjectCode;
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotEmpty(message = "项目名称不能为空")
private String subjectName;
@Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "设备类型不能为空")
private Boolean deviceType;
@Schema(description = "设备id", example = "11632")
private Long deviceId;
@Schema(description = "关键件id", example = "29557")
private Long componentId;
@Schema(description = "检验方式")
private String inspectionMethod;
@Schema(description = "值类型", example = "1")
private String valueType;
@Schema(description = "判定基准")
private String judgmentCriteria;
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否启用不能为空")
private Boolean isEnable;
@Schema(description = "设备名称")
@ExcelProperty("设备名称")
private String deviceName;
@Schema(description = "关键件名称")
@ExcelProperty("关键件名称")
private String componentName;
@Schema(description = "创建人名称")
@ExcelProperty("创建人名称")
private String creatroName;
@Schema(description = "项目内容")
@ExcelProperty("项目内容")
private String projectContent;
}

@ -1,5 +1,8 @@
package cn.iocoder.yudao.module.mes.controller.admin.taskmanagement;
import cn.iocoder.yudao.module.mes.controller.admin.planmaintenance.vo.PlanMaintenanceRespVO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -38,6 +41,9 @@ public class TaskManagementController {
@Resource
private TaskManagementService taskManagementService;
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create")
@Operation(summary = "创建任务管理")
@ -82,7 +88,10 @@ public class TaskManagementController {
@PreAuthorize("@ss.hasPermission('mes:task-management:query')")
public CommonResult<PageResult<TaskManagementRespVO>> getTaskManagementPage(@Valid TaskManagementPageReqVO pageReqVO) {
PageResult<TaskManagementDO> pageResult = taskManagementService.getTaskManagementPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, TaskManagementRespVO.class));
PageResult<TaskManagementRespVO> taskManagementRespVOPageResult = BeanUtils.toBean(pageResult, TaskManagementRespVO.class);
buildPageCreatorName(taskManagementRespVOPageResult);
return success(taskManagementRespVOPageResult);
}
@GetMapping("/export-excel")
@ -93,9 +102,14 @@ public class TaskManagementController {
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<TaskManagementDO> list = taskManagementService.getTaskManagementPage(pageReqVO).getList();
List<TaskManagementRespVO> taskManagementRespVOList = BeanUtils.toBean(list, TaskManagementRespVO.class);
for (TaskManagementRespVO planMaintenanceRespVO : taskManagementRespVOList) {
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(planMaintenanceRespVO.getCreator()));
planMaintenanceRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
}
// 导出 Excel
ExcelUtils.write(response, "设备类型.xls", "数据", TaskManagementRespVO.class,
BeanUtils.toBean(list, TaskManagementRespVO.class));
ExcelUtils.write(response, "设备类型.xls", "数据", TaskManagementRespVO.class,taskManagementRespVOList);
}
@ -107,4 +121,16 @@ public class TaskManagementController {
return success(true);
}
private PageResult<TaskManagementRespVO> buildPageCreatorName(PageResult<TaskManagementRespVO> planMaintenanceRespVOPageResult) {
for (TaskManagementRespVO planMaintenanceRespVO : planMaintenanceRespVOPageResult.getList()) {
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(planMaintenanceRespVO.getCreator()));
planMaintenanceRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
}
return planMaintenanceRespVOPageResult;
}
}

@ -1,7 +1,15 @@
package cn.iocoder.yudao.module.mes.controller.admin.taskmanagement.vo;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@ -10,7 +18,7 @@ import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 设备类型 Response VO")
@Data
@ExcelIgnoreUnannotated
public class TaskManagementRespVO {
public class TaskManagementRespVO extends BaseDO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26348")
@ExcelProperty("id")
@ -34,11 +42,13 @@ public class TaskManagementRespVO {
@Schema(description = "起止开始日期")
@ExcelProperty("起止开始日期")
private LocalDateTime startDate;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate startDate;
@Schema(description = "起止结束日期")
@ExcelProperty("起止结束日期")
private LocalDateTime endDate;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate endDate;
@Schema(description = "cron表达式")
@ExcelProperty("cron表达式")
@ -56,4 +66,12 @@ public class TaskManagementRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "创建人名字")
@ExcelProperty("创建人名字")
private String creatorName;
@Schema(description = "项目表单名称")
@ExcelProperty("项目表单名称")
private String projectFormName;
}

@ -1,5 +1,10 @@
package cn.iocoder.yudao.module.mes.controller.admin.taskmanagement.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@ -28,10 +33,12 @@ public class TaskManagementSaveReqVO {
private Long projectForm;
@Schema(description = "起止开始日期")
private LocalDateTime startDate;
@JsonFormat(pattern = "yyyy-MM-dd")
private String startDate;
@Schema(description = "起止结束日期")
private LocalDateTime endDate;
@JsonFormat(pattern = "yyyy-MM-dd")
private String endDate;
@Schema(description = "cron表达式")
private String cronExpression;

@ -117,6 +117,10 @@ public class TicketManagementController {
for (TicketManagementRespVO ticketManagementRespVO : ticketManagementRespVOPageResult.getList()) {
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(ticketManagementRespVO.getCreator()));
ticketManagementRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
if (ticketManagementRespVO.getOperator()!=null){
AdminUserRespDTO operator = adminUserApi.getUser(Long.valueOf(ticketManagementRespVO.getOperator()));
ticketManagementRespVO.setOperatorName("(" + operator.getUsername()+ ")" + operator.getNickname());
}
}
return ticketManagementRespVOPageResult;
}

@ -0,0 +1,87 @@
package cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.enums;
import lombok.Getter;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
* 1- 2-
*/
@Getter
public enum PlanTypeEnum {
INSPECTION(1, "点检"),
MAINTENANCE(2, "保养");
private final Integer code;
private final String description;
PlanTypeEnum(Integer code, String description) {
this.code = code;
this.description = description;
}
/**
* code
*/
public static PlanTypeEnum getByCode(Integer code) {
if (code == null) {
return null;
}
for (PlanTypeEnum type : values()) {
if (type.getCode().equals(code)) {
return type;
}
}
return null;
}
/**
* code
*/
public static String getDescriptionByCode(Integer code) {
PlanTypeEnum type = getByCode(code);
return type != null ? type.getDescription() : "未知";
}
/**
* code
*/
public static boolean isValidCode(Integer code) {
return getByCode(code) != null;
}
/**
* code
*/
public static List<Integer> getAllCodes() {
return Arrays.stream(values())
.map(PlanTypeEnum::getCode)
.collect(Collectors.toList());
}
/**
*
*/
public static List<String> getAllDescriptions() {
return Arrays.stream(values())
.map(PlanTypeEnum::getDescription)
.collect(Collectors.toList());
}
/**
* code
*/
public static Map<Integer, String> getCodeDescriptionMap() {
Map<Integer, String> map = new LinkedHashMap<>();
for (PlanTypeEnum type : values()) {
map.put(type.getCode(), type.getDescription());
}
return map;
}
}

@ -21,7 +21,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
public class TicketManagementPageReqVO extends PageParam {
@Schema(description = "项目ID", example = "21368")
private String subjectId;
private Long taskId;
@Schema(description = "方案ID", example = "20459")
private Long planId;
@ -32,7 +32,7 @@ public class TicketManagementPageReqVO extends PageParam {
@Schema(description = "设备名称", example = "张三")
private String deviceName;
@Schema(description = "类型", example = "2")
@Schema(description = "类型(1-点检 2-保养)", example = "2")
private String planType;
@Schema(description = "计划配置名称", example = "赵六")

@ -23,11 +23,11 @@ public class TicketManagementRespVO extends BaseDO {
@ExcelProperty("id")
private Long id;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21368")
@Schema(description = "任务Id", example = "21368")
// @ExcelProperty("项目ID")
private Long subjectId;
private Long taskId;
@Schema(description = "方案ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20459")
@Schema(description = "方案ID", example = "20459")
// @ExcelProperty("方案ID")
private Long planId;
@ -82,7 +82,11 @@ public class TicketManagementRespVO extends BaseDO {
@ExcelProperty("创建人名字")
private String creatorName;
@Schema(description = "作业人")
private String operator;
@Schema(description = "作业人名称")
@ExcelProperty("作业人名称")
private String operatorName;
}

@ -51,4 +51,6 @@ public class TicketResultsRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "设备Id")
private Long deviceId;
}

@ -102,7 +102,7 @@ public class ZjProductController {
@Parameter(name = "productId", description = "产品ID")
@PreAuthorize("@ss.hasPermission('erp:product:query')")
public CommonResult<List<ZjProductRespVO>> getZjProductByPlanId(@RequestParam("productId") Long productId) {
List<ZjProductDO> pageResult = zjProductService.getZjProductByPlanId(productId);
List<ZjProductDO> pageResult = zjProductService.getZjProductByProductId(productId);
return success(BeanUtils.toBean(pageResult, ZjProductRespVO.class));
}
}

@ -0,0 +1,106 @@
package cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproduct.ZjProductDO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord.ZjProductRecordDO;
import cn.iocoder.yudao.module.mes.service.zjproductrecord.ZjProductRecordService;
@Tag(name = "管理后台 - 试产质检记录")
@RestController
@RequestMapping("/mes/zj-product-record")
@Validated
public class ZjProductRecordController {
@Resource
private ZjProductRecordService zjProductRecordService;
@PostMapping("/create")
@Operation(summary = "创建试产质检记录")
// @PreAuthorize("@ss.hasPermission('mes:zj-product-record:create')")
public CommonResult<Long> createZjProductRecord(@Valid @RequestBody ZjProductRecordSaveReqVO createReqVO) {
return success(zjProductRecordService.createZjProductRecord(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新试产质检记录")
// @PreAuthorize("@ss.hasPermission('mes:zj-product-record:update')")
public CommonResult<Boolean> updateZjProductRecord(@Valid @RequestBody ZjProductRecordSaveReqVO updateReqVO) {
zjProductRecordService.updateZjProductRecord(updateReqVO);
return success(true);
}
@PutMapping("/updateBatch")
@Operation(summary = "批量更新试产质检记录")
@PreAuthorize("@ss.hasPermission('erp:product:update')")
public CommonResult<Boolean> updateZjProductRecordBatch(@Valid @RequestBody List<ZjProductRecordSaveReqVO> updateReqVOList) {
for (ZjProductRecordSaveReqVO source : updateReqVOList) {
zjProductRecordService.updateZjProductRecord(source);
}
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除试产质检记录")
@Parameter(name = "id", description = "编号", required = true)
// @PreAuthorize("@ss.hasPermission('mes:zj-product-record:delete')")
public CommonResult<Boolean> deleteZjProductRecord(@RequestParam("id") Long id) {
zjProductRecordService.deleteZjProductRecord(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得试产质检记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:product:query')")
public CommonResult<ZjProductRecordRespVO> getZjProductRecord(@RequestParam("id") Long id) {
ZjProductRecordDO zjProductRecord = zjProductRecordService.getZjProductRecord(id);
return success(BeanUtils.toBean(zjProductRecord, ZjProductRecordRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得试产质检记录分页")
@PreAuthorize("@ss.hasPermission('erp:product:query')")
public CommonResult<PageResult<ZjProductRecordRespVO>> getZjProductRecordPage(@Valid ZjProductRecordPageReqVO pageReqVO) {
PageResult<ZjProductRecordDO> pageResult = zjProductRecordService.getZjProductRecordPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ZjProductRecordRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出试产质检记录 Excel")
// @PreAuthorize("@ss.hasPermission('mes:zj-product-record:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportZjProductRecordExcel(@Valid ZjProductRecordPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ZjProductRecordDO> list = zjProductRecordService.getZjProductRecordPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "试产质检记录.xls", "数据", ZjProductRecordRespVO.class,
BeanUtils.toBean(list, ZjProductRecordRespVO.class));
}
}

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 试产质检记录分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ZjProductRecordPageReqVO extends PageParam {
@Schema(description = "工序", example = "2")
private String type;
@Schema(description = "名称", example = "赵六")
private String name;
@Schema(description = "单位")
private String unit;
@Schema(description = "上限值")
private Double upperVal;
@Schema(description = "下限值")
private Double lowerVal;
@Schema(description = "关联产品id", example = "6649")
private Long productId;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "关联计划id", example = "13611")
private Long planId;
@Schema(description = "实际值", example = "你猜")
private String realVal;
}

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 试产质检记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ZjProductRecordRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5254")
@ExcelProperty("ID")
private Long id;
@Schema(description = "工序", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("工序")
private String type;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@ExcelProperty("名称")
private String name;
@Schema(description = "单位")
@ExcelProperty("单位")
private String unit;
@Schema(description = "上限值")
@ExcelProperty("上限值")
private Double upperVal;
@Schema(description = "下限值")
@ExcelProperty("下限值")
private Double lowerVal;
@Schema(description = "关联产品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6649")
@ExcelProperty("关联产品id")
private Long productId;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "关联计划id", example = "13611")
@ExcelProperty("关联计划id")
private Long planId;
@Schema(description = "实际值", example = "你猜")
@ExcelProperty("实际值")
private String realVal;
}

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 试产质检记录新增/修改 Request VO")
@Data
public class ZjProductRecordSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5254")
private Long id;
@Schema(description = "工序", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "工序不能为空")
private String type;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotEmpty(message = "名称不能为空")
private String name;
@Schema(description = "单位")
private String unit;
@Schema(description = "上限值")
private Double upperVal;
@Schema(description = "下限值")
private Double lowerVal;
@Schema(description = "关联产品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6649")
@NotNull(message = "关联产品id不能为空")
private Long productId;
@Schema(description = "实际值", example = "你猜")
private String realVal;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "关联计划id", example = "13611")
private Long planId;
}

@ -40,5 +40,14 @@ public class BaogongRecordDO extends BaseDO {
*
*/
private LocalDateTime baogongTime;
/**
*
*/
private Long noPassNum;
/**
*
*/
private String remark;
}

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("mes_critical_component")
@KeySequence("mes_critical_component_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CriticalComponentDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
*
*/
private String code;
/**
*
*/
private String name;
/**
*
*/
private String description;
/**
*
*/
private String remark;
}

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
import lombok.*;
import java.time.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@ -99,4 +98,32 @@ public class DeviceLedgerDO extends BaseDO {
*/
private Integer sort;
/**
*
*/
private String fileUrl;
/**
* id
*/
private String componentId;
/**
*
*/
@TableField(exist = false)
private List<TicketResultsDO> inspectionList;
/**
*
*/
@TableField(exist = false)
private List<TicketResultsDO> maintainList;
/**
*
*/
@TableField(exist = false)
private Map<String,List<DvRepairLineDO>> repairList;
}

@ -89,14 +89,29 @@ public class DvRepairDO extends BaseDO {
*/
private String confirmBy;
/**
*
* 0- 1-
*
* {@link TODO mes_mold_record_status }
*/
private String status;
private Integer status;
/**
*
*/
private String remark;
/**
* 1- 2-
*/
private Integer deviceType;
/**
* Id
*/
private Long deviceId;
/**
* Id
*/
private Long componentId;
}

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mes.dal.dataobject.dvrepairline;
package cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair;
import lombok.*;
import java.util.*;

@ -53,5 +53,8 @@ public class FeedingRecordDetailDO extends BaseDO {
*
*/
private LocalDateTime feedingTime;
/**
* id
*/
private Long productId;
}

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@ -121,4 +122,23 @@ public class PlanDO extends BaseDO {
*
*/
private Boolean isZj;
/**
*
*/
private Long wangongNumber;
/**
*
*/
private Long passNumber;
/**
*
*/
private Long noPassNumber;
/**
*
*/
private BigDecimal passRate;
}

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.mes.dal.dataobject.repairtems;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("mes_repair_tems")
@KeySequence("mes_repair_tems_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RepairTemsDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
*
*/
private String subjectCode;
/**
*
*/
private String subjectName;
/**
*
*/
private Integer deviceType;
/**
* id
*/
private Long deviceId;
/**
* id
*/
private Long componentId;
/**
*
*/
private String inspectionMethod;
/**
*
*/
private String valueType;
/**
*
*/
private String judgmentCriteria;
/**
*
*/
private Boolean isEnable;
/**
*
*/
private String projectContent;
}

@ -1,11 +1,17 @@
package cn.iocoder.yudao.module.mes.dal.dataobject.taskmanagement;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.*;
import java.time.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@ -48,11 +54,16 @@ public class TaskManagementDO extends BaseDO {
/**
*
*/
private LocalDateTime startDate;
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDate startDate;
/**
*
*/
private LocalDateTime endDate;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDate endDate;
/**
* cron
*/
@ -66,4 +77,8 @@ public class TaskManagementDO extends BaseDO {
*/
private Boolean enabled;
@TableField(exist = false)
private String projectFormName;
}

@ -35,9 +35,9 @@ public class TicketManagementDO extends BaseDO {
@TableId
private Long id;
/**
* ID
* ID
*/
private Long subjectId;
private Long taskId;
/**
* ID
*/
@ -51,7 +51,7 @@ public class TicketManagementDO extends BaseDO {
*/
private String deviceName;
/**
*
* (1- 2-)
*/
private int planType;
/**
@ -66,7 +66,10 @@ public class TicketManagementDO extends BaseDO {
* 0- 1- 2-
*/
private int jobResult;
/**
*
*/
private String operator;
/**
*
*/

@ -60,5 +60,9 @@ public class TicketResultsDO extends BaseDO {
*
*/
private Long managementId;
/**
* id
*/
private Long deviceId;
}

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("mes_zj_product_record")
@KeySequence("mes_zj_product_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ZjProductRecordDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
*
*/
private String type;
/**
*
*/
private String name;
/**
*
*/
private String unit;
/**
*
*/
private Double upperVal;
/**
*
*/
private Double lowerVal;
/**
* id
*/
private Long productId;
/**
*
*/
private String remark;
/**
* id
*/
private Long planId;
/**
*
*/
private String realVal;
}

@ -0,0 +1,46 @@
package cn.iocoder.yudao.module.mes.dal.mysql.criticalcomponent;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
import com.alibaba.excel.util.StringUtils;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.criticalcomponent.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface CriticalComponentMapper extends BaseMapperX<CriticalComponentDO> {
default PageResult<CriticalComponentDO> selectPage(CriticalComponentPageReqVO reqVO) {
LambdaQueryWrapperX<CriticalComponentDO> criticalComponentDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
criticalComponentDOLambdaQueryWrapperX
.eqIfPresent(CriticalComponentDO::getCode, reqVO.getCode())
.likeIfPresent(CriticalComponentDO::getName, reqVO.getName())
.eqIfPresent(CriticalComponentDO::getDescription, reqVO.getDescription())
.eqIfPresent(CriticalComponentDO::getRemark, reqVO.getRemark())
.betweenIfPresent(CriticalComponentDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CriticalComponentDO::getCreateTime);
// 单独处理 ids 条件
if (StringUtils.isNotBlank(reqVO.getIds())) {
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
.map(String::trim)
.map(Long::valueOf)
.collect(Collectors.toList());
criticalComponentDOLambdaQueryWrapperX.in(CriticalComponentDO::getId, idList);
}
return selectPage(reqVO, criticalComponentDOLambdaQueryWrapperX);
}
}

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mes.dal.mysql.dvrepairline;
package cn.iocoder.yudao.module.mes.dal.mysql.dvrepair;
import java.util.*;
@ -6,7 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepairline.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
import org.apache.ibatis.annotations.Mapper;
/**

@ -1,11 +1,14 @@
package cn.iocoder.yudao.module.mes.dal.mysql.dvrepair;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvsubject.DvSubjectDO;
import com.alibaba.excel.util.StringUtils;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.*;
@ -18,7 +21,10 @@ import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.*;
public interface DvRepairMapper extends BaseMapperX<DvRepairDO> {
default PageResult<DvRepairDO> selectPage(DvRepairPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DvRepairDO>()
LambdaQueryWrapperX<DvRepairDO> dvRepairDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
dvRepairDOLambdaQueryWrapperX
.eqIfPresent(DvRepairDO::getRepairCode, reqVO.getRepairCode())
.likeIfPresent(DvRepairDO::getRepairName, reqVO.getRepairName())
.eqIfPresent(DvRepairDO::getMachineryId, reqVO.getMachineryId())
@ -36,7 +42,18 @@ public interface DvRepairMapper extends BaseMapperX<DvRepairDO> {
.eqIfPresent(DvRepairDO::getStatus, reqVO.getStatus())
.eqIfPresent(DvRepairDO::getRemark, reqVO.getRemark())
.betweenIfPresent(DvRepairDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DvRepairDO::getId));
.orderByDesc(DvRepairDO::getCreateTime);
// 单独处理 ids 条件
if (StringUtils.isNotBlank(reqVO.getIds())) {
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
.map(String::trim)
.map(Long::valueOf)
.collect(Collectors.toList());
dvRepairDOLambdaQueryWrapperX.in(DvRepairDO::getId, idList);
}
return selectPage(reqVO,dvRepairDOLambdaQueryWrapperX );
}
}

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.mes.dal.mysql.repairtems;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.repairtems.RepairTemsDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author
*/
@Mapper
public interface RepairTemsMapper extends BaseMapperX<RepairTemsDO> {
default PageResult<RepairTemsDO> selectPage(RepairTemsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<RepairTemsDO>()
.eqIfPresent(RepairTemsDO::getSubjectCode, reqVO.getSubjectCode())
.likeIfPresent(RepairTemsDO::getSubjectName, reqVO.getSubjectName())
.eqIfPresent(RepairTemsDO::getDeviceType, reqVO.getDeviceType())
.eqIfPresent(RepairTemsDO::getDeviceId, reqVO.getDeviceId())
.eqIfPresent(RepairTemsDO::getComponentId, reqVO.getComponentId())
.eqIfPresent(RepairTemsDO::getInspectionMethod, reqVO.getInspectionMethod())
.eqIfPresent(RepairTemsDO::getValueType, reqVO.getValueType())
.eqIfPresent(RepairTemsDO::getJudgmentCriteria, reqVO.getJudgmentCriteria())
.eqIfPresent(RepairTemsDO::getIsEnable, reqVO.getIsEnable())
.betweenIfPresent(RepairTemsDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(RepairTemsDO::getId));
}
IPage<RepairTemsRespVO> getRepairTemsPage(Page<RepairTemsRespVO> page, @Param("pageReqVO") RepairTemsPageReqVO pageReqVO);
List<RepairTemsRespVO> getRepairTemsList( @Param("pageReqVO") RepairTemsPageReqVO pageReqVO);
}

@ -25,7 +25,7 @@ public interface TicketManagementMapper extends BaseMapperX<TicketManagementDO>
LambdaQueryWrapperX<TicketManagementDO> ticketManagementDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
ticketManagementDOLambdaQueryWrapperX
.eqIfPresent(TicketManagementDO::getSubjectId, reqVO.getSubjectId())
.eqIfPresent(TicketManagementDO::getTaskId, reqVO.getTaskId())
.eqIfPresent(TicketManagementDO::getPlanId, reqVO.getPlanId())
.eqIfPresent(TicketManagementDO::getPlanNo, reqVO.getPlanNo())
.likeIfPresent(TicketManagementDO::getDeviceName, reqVO.getDeviceName())

@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.ticketresults.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -31,4 +32,5 @@ public interface TicketResultsMapper extends BaseMapperX<TicketResultsDO> {
.orderByDesc(TicketResultsDO::getId));
}
List<TicketResultsDO> findByDeviceIdAndPlanType(@Param("deviceId") Long deviceId,@Param("planType") Integer planType);
}

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.mes.dal.mysql.zjproductrecord;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord.ZjProductRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface ZjProductRecordMapper extends BaseMapperX<ZjProductRecordDO> {
default PageResult<ZjProductRecordDO> selectPage(ZjProductRecordPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ZjProductRecordDO>()
.eqIfPresent(ZjProductRecordDO::getType, reqVO.getType())
.likeIfPresent(ZjProductRecordDO::getName, reqVO.getName())
.eqIfPresent(ZjProductRecordDO::getUnit, reqVO.getUnit())
.eqIfPresent(ZjProductRecordDO::getUpperVal, reqVO.getUpperVal())
.eqIfPresent(ZjProductRecordDO::getLowerVal, reqVO.getLowerVal())
.eqIfPresent(ZjProductRecordDO::getProductId, reqVO.getProductId())
.eqIfPresent(ZjProductRecordDO::getRemark, reqVO.getRemark())
.betweenIfPresent(ZjProductRecordDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ZjProductRecordDO::getPlanId, reqVO.getPlanId())
.orderByDesc(ZjProductRecordDO::getId));
}
}

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.mes.service.criticalcomponent;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.mes.controller.admin.criticalcomponent.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* Service
*
* @author
*/
public interface CriticalComponentService {
/**
*
*
* @param createReqVO
* @return
*/
Long createCriticalComponent(@Valid CriticalComponentSaveReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateCriticalComponent(@Valid CriticalComponentSaveReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteCriticalComponent(List<Long> idList);
/**
*
*
* @param id
* @return
*/
CriticalComponentDO getCriticalComponent(Long id);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<CriticalComponentDO> getCriticalComponentPage(CriticalComponentPageReqVO pageReqVO);
}

@ -0,0 +1,77 @@
package cn.iocoder.yudao.module.mes.service.criticalcomponent;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.mes.controller.admin.criticalcomponent.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.dal.mysql.criticalcomponent.CriticalComponentMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class CriticalComponentServiceImpl implements CriticalComponentService {
@Resource
private CriticalComponentMapper criticalComponentMapper;
@Override
public Long createCriticalComponent(CriticalComponentSaveReqVO createReqVO) {
// 插入
CriticalComponentDO criticalComponent = BeanUtils.toBean(createReqVO, CriticalComponentDO.class);
criticalComponentMapper.insert(criticalComponent);
// 返回
return criticalComponent.getId();
}
@Override
public void updateCriticalComponent(CriticalComponentSaveReqVO updateReqVO) {
// 校验存在
validateCriticalComponentExists(updateReqVO.getId());
// 更新
CriticalComponentDO updateObj = BeanUtils.toBean(updateReqVO, CriticalComponentDO.class);
criticalComponentMapper.updateById(updateObj);
}
@Override
public void deleteCriticalComponent(List<Long> idList) {
for (Long id : idList) {
// 校验存在
validateCriticalComponentExists(id);
}
// 删除
criticalComponentMapper.deleteByIds(idList);
}
private void validateCriticalComponentExists(Long id) {
if (criticalComponentMapper.selectById(id) == null) {
throw exception(CRITICAL_COMPONENT_NOT_EXISTS);
}
}
@Override
public CriticalComponentDO getCriticalComponent(Long id) {
return criticalComponentMapper.selectById(id);
}
@Override
public PageResult<CriticalComponentDO> getCriticalComponentPage(CriticalComponentPageReqVO pageReqVO) {
return criticalComponentMapper.selectPage(pageReqVO);
}
}

@ -1,6 +1,17 @@
package cn.iocoder.yudao.module.mes.service.deviceledger;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.enums.PlanTypeEnum;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairLineMapper;
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairMapper;
import cn.iocoder.yudao.module.mes.dal.mysql.ticketresults.TicketResultsMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -14,6 +25,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_CODE_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
/**
@ -28,6 +40,17 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
@Resource
private DeviceLedgerMapper deviceLedgerMapper;
@Resource
@Lazy
private TicketResultsMapper ticketResultsMapper;
@Resource
private DvRepairLineMapper dvRepairLineMapper;
@Resource
private DvRepairMapper dvRepairMapperRepair;
@Override
public Long createDeviceLedger(DeviceLedgerSaveReqVO createReqVO) {
@ -52,6 +75,18 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
public void updateDeviceLedger(DeviceLedgerSaveReqVO updateReqVO) {
// 校验存在
validateDeviceLedgerExists(updateReqVO.getId());
//编码重复判断
Long count = deviceLedgerMapper.selectCount(new LambdaQueryWrapper<DeviceLedgerDO>()
.eq(DeviceLedgerDO::getDeviceCode, updateReqVO.getDeviceCode())
.ne(DeviceLedgerDO::getId, updateReqVO.getId())
);
if (count > 0) {
throw exception(DEVICE_LEDGER_EXISTS);
}
// 更新
DeviceLedgerDO updateObj = BeanUtils.toBean(updateReqVO, DeviceLedgerDO.class);
deviceLedgerMapper.updateById(updateObj);
@ -77,7 +112,38 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
@Override
public DeviceLedgerDO getDeviceLedger(Long id) {
return deviceLedgerMapper.selectById(id);
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(id);
Map<String,List<DvRepairLineDO>> dvRepairDOMap=new HashMap<>();
List<TicketResultsDO> inspectionList = ticketResultsMapper.findByDeviceIdAndPlanType(id, PlanTypeEnum.INSPECTION.getCode());
if(CollectionUtils.isNotEmpty(inspectionList)){
deviceLedgerDO.setInspectionList(inspectionList);
}
List<TicketResultsDO> maintainList = ticketResultsMapper.findByDeviceIdAndPlanType(id, PlanTypeEnum.MAINTENANCE.getCode());
if(CollectionUtils.isNotEmpty(maintainList)){
deviceLedgerDO.setMaintainList(maintainList);
}
List<DvRepairDO> dvRepairDOS = dvRepairMapperRepair.selectList(
Wrappers.<DvRepairDO>lambdaQuery()
.eq(DvRepairDO::getDeviceId, id));
for (DvRepairDO dvRepairDO : dvRepairDOS) {
List<DvRepairLineDO> dvRepairLineDOS = dvRepairLineMapper.selectList(Wrappers.<DvRepairLineDO>lambdaQuery()
.eq(DvRepairLineDO::getRepairId, dvRepairDO.getId())
.orderByDesc(DvRepairLineDO::getCreateTime));
dvRepairDOMap.put(dvRepairDO.getRepairName(),dvRepairLineDOS);
}
if(CollectionUtils.isNotEmpty(dvRepairDOMap)){
deviceLedgerDO.setRepairList(dvRepairDOMap);
}
return deviceLedgerDO;
}
@Override

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mes.service.devicetype;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
import cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo.DeviceTypeTreeRespVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -24,6 +25,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.dal.mysql.devicetype.DeviceTypeMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_CODE_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
import static com.baomidou.mybatisplus.extension.toolkit.Db.list;
@ -78,6 +80,17 @@ public class DeviceTypeServiceImpl implements DeviceTypeService {
public void updateDeviceType(DeviceTypeSaveReqVO updateReqVO) {
// 1. 校验存在
validateDeviceTypeExists(updateReqVO.getId());
//编码重复判断
Long count = deviceTypeMapper.selectCount(new LambdaQueryWrapper<DeviceTypeDO>()
.eq(DeviceTypeDO::getCode, updateReqVO.getCode())
.ne(DeviceTypeDO::getId, updateReqVO.getId())
);
if (count > 0) {
throw exception(DEVICE_LEDGER_CODE_NOT_ONLY);
}
// 2. 验证父级设备类型是否存在且不能是自己的子节点
validateParentDeviceType(Long.valueOf(updateReqVO.getParentId()));

@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.DvRepairPageReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.DvRepairSaveReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepairline.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
import javax.validation.Valid;
import java.util.List;
@ -36,7 +36,7 @@ public interface DvRepairService {
*
* @param id
*/
void deleteDvRepair(Long id);
void deleteDvRepair(List<Long> idList);
/**
*

@ -2,12 +2,15 @@ package cn.iocoder.yudao.module.mes.service.dvrepair;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.DvRepairPageReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.dvrepair.vo.DvRepairSaveReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepairline.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairLineMapper;
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairMapper;
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepairline.DvRepairLineMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@ -16,7 +19,8 @@ import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.DV_REPAIR_NOT_EXISTS;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_CODE_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
/**
* Service
@ -35,6 +39,15 @@ public class DvRepairServiceImpl implements DvRepairService {
@Override
@Transactional(rollbackFor = Exception.class)
public Long createDvRepair(DvRepairSaveReqVO createReqVO) {
//编码重复判断
Long count = dvRepairMapper.selectCount(new LambdaQueryWrapper<DvRepairDO>()
.eq(DvRepairDO::getRepairCode, createReqVO.getRepairCode())
);
if (count > 0) {
throw exception(DV_REPAIR_CODE_EXISTS);
}
// 插入
DvRepairDO dvRepair = BeanUtils.toBean(createReqVO, DvRepairDO.class);
dvRepairMapper.insert(dvRepair);
@ -50,6 +63,18 @@ public class DvRepairServiceImpl implements DvRepairService {
public void updateDvRepair(DvRepairSaveReqVO updateReqVO) {
// 校验存在
validateDvRepairExists(updateReqVO.getId());
//编码重复判断
Long count = dvRepairMapper.selectCount(new LambdaQueryWrapper<DvRepairDO>()
.eq(DvRepairDO::getRepairCode, updateReqVO.getRepairCode())
.ne(DvRepairDO::getId, updateReqVO.getRepairCode())
);
if (count > 0) {
throw exception(DV_REPAIR_CODE_EXISTS);
}
// 更新
DvRepairDO updateObj = BeanUtils.toBean(updateReqVO, DvRepairDO.class);
dvRepairMapper.updateById(updateObj);
@ -60,14 +85,16 @@ public class DvRepairServiceImpl implements DvRepairService {
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteDvRepair(Long id) {
// 校验存在
validateDvRepairExists(id);
// 删除
dvRepairMapper.deleteById(id);
public void deleteDvRepair(List<Long> idList) {
for (Long id : idList) {
// 校验存在
validateDvRepairExists(id);
// 删除
dvRepairMapper.deleteById(id);
// 删除子表
deleteDvRepairLineByRepairId(id);
}
// 删除子表
deleteDvRepairLineByRepairId(id);
}
private void validateDvRepairExists(Long id) {

@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.mes.service.dvsubject;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
import cn.iocoder.yudao.module.mes.controller.admin.dvsubject.vo.DvSubjectPageReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.dvsubject.vo.DvSubjectSaveReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.dvsubject.DvSubjectDO;
import cn.iocoder.yudao.module.mes.dal.mysql.dvsubject.DvSubjectMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@ -16,6 +18,7 @@ import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_CODE_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
/**
@ -52,6 +55,15 @@ public class DvSubjectServiceImpl implements DvSubjectService {
public void updateDvSubject(DvSubjectSaveReqVO updateReqVO) {
// 校验存在
validateDvSubjectExists(updateReqVO.getId());
//编码重复判断
Long count = dvSubjectMapper.selectCount(new LambdaQueryWrapper<DvSubjectDO>()
.eq(DvSubjectDO::getSubjectCode, updateReqVO.getSubjectCode())
.ne(DvSubjectDO::getId, updateReqVO.getId())
);
if (count > 0) {
throw exception(SUBJECT_EXISTS);
}
// 更新
DvSubjectDO updateObj = BeanUtils.toBean(updateReqVO, DvSubjectDO.class);
dvSubjectMapper.updateById(updateObj);

@ -219,7 +219,7 @@ public class FeedingRecordServiceImpl implements FeedingRecordService {
return Collections.emptyList();
}
Map<Long, ErpProductDO> map = productService.getProductMap(
convertSet(list, FeedingRecordDetailDO::getItemId));
convertSet(list, FeedingRecordDetailDO::getProductId));
Map<Long, ErpProductUnitDO> unitMap = productUnitService.getProductUnitMap(
convertSet(list, FeedingRecordDetailDO::getUnitId));
// 1.4 管理员信息
@ -227,8 +227,8 @@ public class FeedingRecordServiceImpl implements FeedingRecordService {
convertSet(list, FeedingRecordDetailDO::getUserId));
return BeanUtils.toBean(list, FeedingRecordDetailRespVO.class, item -> {
MapUtils.findAndThen(map, item.getItemId(),
product -> item.setItemName(product.getName()));
MapUtils.findAndThen(map, item.getProductId(),
product -> item.setProductName(product.getName()));
MapUtils.findAndThen(unitMap, item.getUnitId(),
unit -> item.setUnitName(unit.getName()));
MapUtils.findAndThen(userMap, item.getUserId(),

@ -5,8 +5,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockOutService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
import cn.iocoder.yudao.module.mes.controller.admin.itemrequisition.vo.ItemRequisitionSaveReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.itemrequisition.vo.ItemRequisitionStatusEnum;
import cn.iocoder.yudao.module.mes.controller.admin.plan.vo.PlanPageReqVO;
@ -66,6 +69,9 @@ public class PlanServiceImpl implements PlanService {
@Resource
private ItemAnalysisService analysisService;
@Resource
private ErpStockOutService stockService;
@Override
@Transactional(rollbackFor = Exception.class)
public Long createPlan(PlanSaveReqVO createReqVO) {
@ -123,6 +129,20 @@ public class PlanServiceImpl implements PlanService {
saveReqVO.setPlanId(plan.getId());
saveReqVO.setId(id);
itemRequisitionService.updateItemRequisition(saveReqVO);
// 创建入领料出库单
ErpStockOutSaveReqVO stockOut = new ErpStockOutSaveReqVO();
List<ErpStockOutSaveReqVO.Item> itemList = new ArrayList<>();
stockOut.setOutTime(LocalDateTime.now());
stockOut.setOutType("领料出库");
for (ItemRequisitionAndStock requisition : list) {
ErpStockOutSaveReqVO.Item item = new ErpStockOutSaveReqVO.Item();
item.setWarehouseId(3L);
item.setProductId(requisition.getItemId());
item.setCount(requisition.getNumber());
itemList.add(item);
}
stockOut.setItems(itemList);
stockService.createStockOut(stockOut);
return plan.getId();
}

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.mes.service.repairtems;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.repairtems.RepairTemsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* Service
*
* @author
*/
public interface RepairTemsService {
/**
*
*
* @param createReqVO
* @return
*/
Long createRepairTems(@Valid RepairTemsSaveReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateRepairTems(@Valid RepairTemsSaveReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteRepairTems( List<Long> idList);
/**
*
*
* @param id
* @return
*/
RepairTemsDO getRepairTems(Long id);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<RepairTemsRespVO> getRepairTemsPage(RepairTemsPageReqVO pageReqVO);
List<RepairTemsRespVO> getDeviceOrComponent(Integer deviceType);
List<RepairTemsRespVO> getDeviceOrComponentList(Long deviceId, Long componentId);
}

@ -0,0 +1,118 @@
package cn.iocoder.yudao.module.mes.service.repairtems;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.LineDeviceRespVO;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.repairtems.RepairTemsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.dal.mysql.repairtems.RepairTemsMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_CODE_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class RepairTemsServiceImpl implements RepairTemsService {
@Resource
private RepairTemsMapper repairTemsMapper;
@Override
public Long createRepairTems(RepairTemsSaveReqVO createReqVO) {
//编码重复判断
Long count = repairTemsMapper.selectCount(new LambdaQueryWrapper<RepairTemsDO>()
.eq(RepairTemsDO::getSubjectCode, createReqVO.getSubjectCode())
);
if (count > 0) {
throw exception(REPAIR_TEMS_CODE_EXISTS);
}
// 插入
RepairTemsDO repairTems = BeanUtils.toBean(createReqVO, RepairTemsDO.class);
repairTemsMapper.insert(repairTems);
// 返回
return repairTems.getId();
}
@Override
public void updateRepairTems(RepairTemsSaveReqVO updateReqVO) {
// 校验存在
validateRepairTemsExists(updateReqVO.getId());
//编码重复判断
Long count = repairTemsMapper.selectCount(new LambdaQueryWrapper<RepairTemsDO>()
.eq(RepairTemsDO::getSubjectCode, updateReqVO.getSubjectCode())
.ne(RepairTemsDO::getId, updateReqVO.getId())
);
if (count > 0) {
throw exception(REPAIR_TEMS_CODE_EXISTS);
}
// 更新
RepairTemsDO updateObj = BeanUtils.toBean(updateReqVO, RepairTemsDO.class);
repairTemsMapper.updateById(updateObj);
}
@Override
public void deleteRepairTems( List<Long> idList) {
for (Long id : idList) {
// 校验存在
validateRepairTemsExists(id);
}
// 删除
repairTemsMapper.deleteByIds(idList);
}
private void validateRepairTemsExists(Long id) {
if (repairTemsMapper.selectById(id) == null) {
throw exception(REPAIR_TEMS_NOT_EXISTS);
}
}
@Override
public RepairTemsDO getRepairTems(Long id) {
return repairTemsMapper.selectById(id);
}
@Override
public PageResult<RepairTemsRespVO> getRepairTemsPage(RepairTemsPageReqVO pageReqVO) {
Page<RepairTemsRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
IPage<RepairTemsRespVO> repairTemsDOIPage = repairTemsMapper.getRepairTemsPage(page,pageReqVO);
PageResult<RepairTemsRespVO> repairTemsDOPageResult = new PageResult<>(repairTemsDOIPage.getRecords(), repairTemsDOIPage.getTotal());
return repairTemsDOPageResult;
}
@Override
public List<RepairTemsRespVO> getDeviceOrComponent(Integer deviceType) {
return repairTemsMapper.getRepairTemsList(new RepairTemsPageReqVO().setDeviceType(deviceType));
}
@Override
public List<RepairTemsRespVO> getDeviceOrComponentList(Long deviceId, Long componentId) {
return repairTemsMapper.getRepairTemsList(new RepairTemsPageReqVO().setDeviceId(deviceId).setComponentId(componentId));
}
}

@ -105,7 +105,15 @@ public class TaskManagementServiceImpl implements TaskManagementService {
@Override
public PageResult<TaskManagementDO> getTaskManagementPage(TaskManagementPageReqVO pageReqVO) {
return taskManagementMapper.selectPage(pageReqVO);
PageResult<TaskManagementDO> taskManagementDOPageResult = taskManagementMapper.selectPage(pageReqVO);
for (TaskManagementDO taskManagementDO : taskManagementDOPageResult.getList()) {
PlanMaintenanceDO planMaintenanceDO = planMaintenanceMapper.selectById(taskManagementDO.getProjectForm());
taskManagementDO.setProjectFormName(planMaintenanceDO.getPlanName());
}
return taskManagementDOPageResult;
}
@Override
@ -130,12 +138,13 @@ public class TaskManagementServiceImpl implements TaskManagementService {
for (Long deviceId : idList) {
TicketManagementDO ticketManagementDO = new TicketManagementDO();
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(deviceId);
ticketManagementDO.setTaskId(taskManagementDO.getId());
ticketManagementDO.setPlanNo(generatePrefixedOrderNo());
ticketManagementDO.setPlanId(taskManagementDO.getProjectForm());
ticketManagementDO.setDeviceName(deviceLedgerDO.getDeviceName());
ticketManagementDO.setPlanType(taskManagementDO.getTaskType());
ticketManagementDO.setConfigName(taskManagementDO.getName());
ticketManagementDO.setTaskEndTime(taskManagementDO.getEndDate());
ticketManagementDO.setTaskEndTime(taskManagementDO.getEndDate().atStartOfDay());
ticketManagementMapper.insert(ticketManagementDO);
List<DvSubjectDO> dvSubjectDOList = new ArrayList<>();
@ -148,6 +157,7 @@ public class TaskManagementServiceImpl implements TaskManagementService {
ticketResultsDO.setInspectionMethod(dvSubjectDO.getInspectionMethod());
ticketResultsDO.setJudgmentCriteria(dvSubjectDO.getJudgmentCriteria());
ticketResultsDO.setManagementId(ticketManagementDO.getId());
ticketResultsDO.setDeviceId(deviceId);
ticketResultsMapper.insert(ticketResultsDO);
}

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.mes.service.ticketresults;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.mes.controller.admin.ticketresults.enums.JobResultEnum;
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketmanagement.TicketManagementDO;
import cn.iocoder.yudao.module.mes.dal.mysql.ticketmanagement.TicketManagementMapper;
@ -108,6 +110,8 @@ public class TicketResultsServiceImpl implements TicketResultsService {
//4. 判断是否全部已检验
handleInspectionResult(updateReqVOList);
}
/**
@ -155,14 +159,21 @@ public class TicketResultsServiceImpl implements TicketResultsService {
if (ticketManagementDO == null ){
throw exception(TICKET_MANAGEMENT_NOT_EXISTS);
}
ticketManagementDO.setTaskTime(LocalDateTime.now());
//设置为已完成
ticketManagementDO.setJobStatus(1);
// 检查是否有不通过的
boolean hasFail = updateReqVOList.stream()
.anyMatch(vo -> vo.getInspectionResult() != null && vo.getInspectionResult().equals(JobResultEnum.FAIL.getCode()));
if (hasFail) {
ticketManagementDO.setJobResult(JobResultEnum.FAIL.getCode());
} else {
ticketManagementDO.setJobResult(JobResultEnum.PASS.getCode());
}
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
ticketManagementDO.setOperator(String.valueOf(loginUser.getId()));
ticketManagementMapper.updateById(ticketManagementDO);
}

@ -58,5 +58,5 @@ public interface ZjProductService {
* @param productId ID
* @return
*/
List<ZjProductDO> getZjProductByPlanId(Long productId);
List<ZjProductDO> getZjProductByProductId(Long productId);
}

@ -73,7 +73,7 @@ public class ZjProductServiceImpl implements ZjProductService {
}
@Override
public List<ZjProductDO> getZjProductByPlanId(Long productId) {
public List<ZjProductDO> getZjProductByProductId(Long productId) {
return zjProductMapper.selectListByProductId(productId);
}

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.mes.service.zjproductrecord;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord.ZjProductRecordDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* Service
*
* @author
*/
public interface ZjProductRecordService {
/**
*
*
* @param createReqVO
* @return
*/
Long createZjProductRecord(@Valid ZjProductRecordSaveReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateZjProductRecord(@Valid ZjProductRecordSaveReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteZjProductRecord(Long id);
/**
*
*
* @param id
* @return
*/
ZjProductRecordDO getZjProductRecord(Long id);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<ZjProductRecordDO> getZjProductRecordPage(ZjProductRecordPageReqVO pageReqVO);
}

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.mes.service.zjproductrecord;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord.ZjProductRecordDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.dal.mysql.zjproductrecord.ZjProductRecordMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class ZjProductRecordServiceImpl implements ZjProductRecordService {
@Resource
private ZjProductRecordMapper zjProductRecordMapper;
@Override
public Long createZjProductRecord(ZjProductRecordSaveReqVO createReqVO) {
// 插入
ZjProductRecordDO zjProductRecord = BeanUtils.toBean(createReqVO, ZjProductRecordDO.class);
zjProductRecordMapper.insert(zjProductRecord);
// 返回
return zjProductRecord.getId();
}
@Override
public void updateZjProductRecord(ZjProductRecordSaveReqVO updateReqVO) {
// 校验存在
validateZjProductRecordExists(updateReqVO.getId());
// 更新
ZjProductRecordDO updateObj = BeanUtils.toBean(updateReqVO, ZjProductRecordDO.class);
zjProductRecordMapper.updateById(updateObj);
}
@Override
public void deleteZjProductRecord(Long id) {
// 校验存在
validateZjProductRecordExists(id);
// 删除
zjProductRecordMapper.deleteById(id);
}
private void validateZjProductRecordExists(Long id) {
if (zjProductRecordMapper.selectById(id) == null) {
throw exception(ZJ_PRODUCT_RECORD_NOT_EXISTS);
}
}
@Override
public ZjProductRecordDO getZjProductRecord(Long id) {
return zjProductRecordMapper.selectById(id);
}
@Override
public PageResult<ZjProductRecordDO> getZjProductRecordPage(ZjProductRecordPageReqVO pageReqVO) {
return zjProductRecordMapper.selectPage(pageReqVO);
}
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.mes.dal.mysql.criticalcomponent.CriticalComponentMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.mes.dal.mysql.repairtems.RepairTemsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="getRepairTemsPage"
resultType="cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo.RepairTemsRespVO">
SELECT
mrt.id,
mrt.subject_code,
mrt.subject_name,
mrt.device_type,
mrt.device_id,
mrt.component_id,
mrt.inspection_method,
mrt.value_type,
mrt.judgment_criteria,
mrt.is_enable,
mrt.creator,
mrt.create_time,
mrt.updater,
mrt.update_time,
mrt.deleted,
mrt.tenant_id,
mds.subject_name as deviceName,
mcc.name as componentName,
CONCAT('(', su.username, ')', su.nickname) as creatorName
FROM besure.mes_repair_tems mrt
left join besure.mes_dv_subject mds on mds.id = mrt.device_id
left join besure.mes_critical_component mcc on mcc.id = mrt.component_id
left join besure.system_users su on su.id = mrt.creator
WHERE mrt.deleted = 0
order by mrt.create_time desc
<if test="pageReqVO.subjectCode != null and pageReqVO.subjectCode != ''">
AND mrt.subject_code = #{pageReqVO.subjectCode}
</if>
<if test="pageReqVO.subjectName != null and pageReqVO.subjectName != ''">
AND mrt.subject_name LIKE CONCAT('%', #{pageReqVO.subjectName}, '%')
</if>
<if test="pageReqVO.deviceType != null and pageReqVO.deviceType != ''">
AND mrt.device_type = #{pageReqVO.deviceType}
</if>
<if test="pageReqVO.deviceId != null">
AND mrt.device_id = #{pageReqVO.deviceId}
</if>
<if test="pageReqVO.componentId != null">
AND mrt.component_id = #{pageReqVO.componentId}
</if>
<if test="pageReqVO.inspectionMethod != null and pageReqVO.inspectionMethod != ''">
AND mrt.inspection_method = #{pageReqVO.inspectionMethod}
</if>
<if test="pageReqVO.valueType != null and pageReqVO.valueType != ''">
AND mrt.value_type = #{pageReqVO.valueType}
</if>
<if test="pageReqVO.judgmentCriteria != null and pageReqVO.judgmentCriteria != ''">
AND mrt.judgment_criteria = #{pageReqVO.judgmentCriteria}
</if>
<if test="pageReqVO.isEnable != null">
AND mrt.is_enable = #{pageReqVO.isEnable}
</if>
<if test="pageReqVO.projectContent != null and pageReqVO.projectContent != ''">
AND mrt.project_content LIKE CONCAT('%', #{pageReqVO.projectContent}, '%')
</if>
<!-- <if test="pageReqVO.createTime != null and pageReqVO.createTime.length == 2">-->
<!-- AND create_time BETWEEN #{pageReqVO.createTime[0]} AND #{pageReqVO.createTime[1]}-->
<!-- </if>-->
ORDER BY mrt.create_time DESC
</select>
<select id="getRepairTemsList"
resultType="cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo.RepairTemsRespVO">
SELECT
mrt.id,
mrt.subject_code,
mrt.subject_name,
mrt.device_type,
mrt.device_id,
mrt.component_id,
mrt.inspection_method,
mrt.value_type,
mrt.judgment_criteria,
mrt.is_enable,
mrt.creator,
mrt.create_time,
mrt.updater,
mrt.update_time,
mrt.deleted,
mrt.tenant_id,
mds.subject_name as deviceName,
mcc.name as componentName,
CONCAT('(', su.username, ')', su.nickname) as creatorName
FROM besure.mes_repair_tems mrt
left join besure.mes_dv_subject mds on mds.id = mrt.device_id
left join besure.mes_critical_component mcc on mcc.id = mrt.component_id
left join besure.system_users su on su.id = mrt.creator
WHERE mrt.deleted = 0
order by mrt.create_time desc
<if test="pageReqVO.subjectCode != null and pageReqVO.subjectCode != ''">
AND mrt.subject_code = #{pageReqVO.subjectCode}
</if>
<if test="pageReqVO.subjectName != null and pageReqVO.subjectName != ''">
AND mrt.subject_name LIKE CONCAT('%', #{pageReqVO.subjectName}, '%')
</if>
<if test="pageReqVO.deviceType != null and pageReqVO.deviceType != ''">
AND mrt.device_type = #{pageReqVO.deviceType}
</if>
<if test="pageReqVO.deviceId != null">
AND mrt.device_id = #{pageReqVO.deviceId}
</if>
<if test="pageReqVO.componentId != null">
AND mrt.component_id = #{pageReqVO.componentId}
</if>
<if test="pageReqVO.inspectionMethod != null and pageReqVO.inspectionMethod != ''">
AND mrt.inspection_method = #{pageReqVO.inspectionMethod}
</if>
<if test="pageReqVO.valueType != null and pageReqVO.valueType != ''">
AND mrt.value_type = #{pageReqVO.valueType}
</if>
<if test="pageReqVO.judgmentCriteria != null and pageReqVO.judgmentCriteria != ''">
AND mrt.judgment_criteria = #{pageReqVO.judgmentCriteria}
</if>
<if test="pageReqVO.isEnable != null">
AND mrt.is_enable = #{pageReqVO.isEnable}
</if>
<if test="pageReqVO.projectContent != null and pageReqVO.projectContent != ''">
AND mrt.project_content LIKE CONCAT('%', #{pageReqVO.projectContent}, '%')
</if>
<!-- <if test="pageReqVO.createTime != null and pageReqVO.createTime.length == 2">-->
<!-- AND create_time BETWEEN #{pageReqVO.createTime[0]} AND #{pageReqVO.createTime[1]}-->
<!-- </if>-->
ORDER BY mrt.create_time DESC
</select>
</mapper>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.mes.dal.mysql.ticketresults.TicketResultsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="findByDeviceIdAndPlanType"
resultType="cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO">
SELECT
mtr.*
from
besure.mes_ticket_results mtr
left join besure.mes_ticket_management mtm on mtm.id = mtr.management_id
WHERE 1=1
<!-- 必填条件 -->
<if test="deviceId != null and deviceId != ''">
and mtr.device_id = #{deviceId}
</if>
<if test="planType != null and planType != ''">
and mtm.plan_type= #{planType}
</if>
order by mtr.create_time desc
</select>
</mapper>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.mes.dal.mysql.zjproductrecord.ZjProductRecordMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -12,6 +12,8 @@ import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import java.util.Collections;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
@ -84,7 +86,7 @@ public class DvRepairServiceImplTest extends BaseDbUnitTest {
Long id = dbDvRepair.getId();
// 调用
dvRepairService.deleteDvRepair(id);
dvRepairService.deleteDvRepair(Collections.singletonList(id));
// 校验数据不存在了
assertNull(dvRepairMapper.selectById(id));
}
@ -95,7 +97,7 @@ public class DvRepairServiceImplTest extends BaseDbUnitTest {
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> dvRepairService.deleteDvRepair(id), DV_REPAIR_NOT_EXISTS);
assertServiceException(() -> dvRepairService.deleteDvRepair(Collections.singletonList(id)), DV_REPAIR_NOT_EXISTS);
}
@Test

@ -56,7 +56,7 @@ spring:
tdengine:
name: tdengine
url: jdbc:TAOS-RS://192.168.5.5:6042/besure?charset=UTF-8&locale=en_US.UTF-8
url: jdbc:TAOS-RS://ngsk.tech:16042/besure?charset=UTF-8&locale=en_US.UTF-8
username: root
password: taosdata
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver

Loading…
Cancel
Save