Compare commits

...

8 Commits

@ -17,4 +17,8 @@ public class MoldTicketManagementBatchUpdateReqVO {
@Schema(description = "作业状态", example = "2")
@NotNull(message = "作业状态不能为空")
private Integer jobStatus ; // 默认值为2
@Schema(description = "取消原因")
@NotNull(message = "取消原因不能为空")
private String cancelReason;
}

@ -60,4 +60,7 @@ public class MoldTicketManagementPageReqVO extends PageParam {
*/
private String taskEndTime;
@Schema(description = "取消原因")
private String cancelReason;
}

@ -87,5 +87,8 @@ public class MoldTicketManagementRespVO extends BaseDO {
@ExcelProperty("作业人名称")
private String operatorName;
@Schema(description = "取消原因")
private String cancelReason;
}

@ -39,4 +39,7 @@ public class MoldTicketManagementSaveReqVO {
@Schema(description = "作业结果")
private Integer jobResult;
@Schema(description = "取消原因")
private String cancelReason;
}

@ -85,6 +85,11 @@ public class MoldTicketManagementDO extends BaseDO {
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime taskEndTime;
/**
*
*/
private String cancelReason;
}

@ -33,6 +33,7 @@ public interface MoldTicketManagementMapper extends BaseMapperX<MoldTicketManage
.likeIfPresent(MoldTicketManagementDO::getConfigName, reqVO.getConfigName())
.eqIfPresent(MoldTicketManagementDO::getJobStatus, reqVO.getJobStatus())
.eqIfPresent(MoldTicketManagementDO::getJobResult, reqVO.getJobResult())
.likeIfPresent(MoldTicketManagementDO::getCancelReason, reqVO.getCancelReason())
.orderByDesc(MoldTicketManagementDO::getCreateTime);
@ -58,6 +59,7 @@ public interface MoldTicketManagementMapper extends BaseMapperX<MoldTicketManage
* @return
*/
int batchUpdateJobStatus(@Param("idList") List<Long> idList,
@Param("jobStatus") Integer jobStatus);
@Param("jobStatus") Integer jobStatus,
@Param("cancelReason") String cancelReason);
}

@ -13,6 +13,7 @@
<update id="batchUpdateJobStatus">
UPDATE mes_mold_ticket_management
SET job_status = #{jobStatus},
cancel_reason = #{cancelReason},
update_time = NOW()
WHERE id IN
<foreach collection="idList" item="id" open="(" separator="," close=")">

@ -96,4 +96,11 @@ public class MoldController {
BeanUtils.toBean(list, MoldRespVO.class));
}
@GetMapping("/getInTransitMoldAllList")
@Operation(summary = "获得上下模模具列表(在途-3")
public CommonResult<List<MoldDO>> getInTransitMoldAllList() {
List<MoldDO> doList = moldService.getInTransitMoldAllList();
return success(doList);
}
}

@ -98,4 +98,6 @@ public interface MoldService {
}
List<MoldRespVO> buildMoldVOList(List<MoldDO> list);
List<MoldDO> getInTransitMoldAllList();
}

@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
@ -108,4 +109,9 @@ public class MoldServiceImpl implements MoldService {
}
return BeanUtils.toBean(list, MoldRespVO.class);
}
@Override
public List<MoldDO> getInTransitMoldAllList() {
return moldMapper.selectList(Wrappers.<MoldDO>lambdaQuery().eq(MoldDO::getStatus,3));
}
}

@ -38,9 +38,15 @@ public interface ErrorCodeConstants {
//======================================数据采集相关=================================================
ErrorCode DEVICE_MODEL_NOT_EXISTS = new ErrorCode(1_003_000_001, "采集设备模型不存在");
ErrorCode DEVICE_MODEL_CODE_EXISTS = new ErrorCode(1_003_000_002, "采集设备模型编码已存在");
ErrorCode DEVICE_CODE_ALREADY_EXISTS = new ErrorCode(1_003_000_002, "采集设备编码已存在");
ErrorCode DEVICE_ID_MODEL_NOT_EXISTS = new ErrorCode(1_003_000_003, "该设备模型ID不能为空");
ErrorCode POINT_ID_MODEL_NOT_EXISTS = new ErrorCode(1_003_000_004, "该点位参数ID不能为空");
ErrorCode DEVICE_MODEL_ATTRIBUTE_NOT_EXISTS = new ErrorCode(1_003_000_005, "采集设备模型点位不存在");
ErrorCode DEVICE_MODEL_POINT_CODE_EXISTS = new ErrorCode(1_003_000_005, "采集设备采集点位编码已存在");
ErrorCode DEVICE_MODEL_ATTRIBUTE_POTIN_CODE_EXISTS = new ErrorCode(1_003_000_005, "采集设备模型点位编码已存在");
ErrorCode DEVICE_ATTRIBUTE_NOT_EXISTS = new ErrorCode(1_003_000_006, "设备属性不存在");
ErrorCode DEVICE_ATTRIBUTE_TYPE_NOT_EXISTS = new ErrorCode(1_003_000_007, "采集点分类不存在");
ErrorCode DEVICE_CODE_EXISTS = new ErrorCode(1_003_000_000, "采集点编码已存在");

@ -30,7 +30,7 @@ public interface DeviceContactModelMapper extends BaseMapperX<DeviceContactModel
.eq(Objects.nonNull(device.getAttributeType()), DeviceContactModelDO::getAttributeType, device.getAttributeType())
// 必要的条件如deviceModelId保留直接eq条件
.eq(DeviceContactModelDO::getDeviceId, device.getDeviceId())
.orderByAsc(DeviceContactModelDO::getSort));
.orderByDesc(DeviceContactModelDO::getId));
}

@ -49,7 +49,7 @@ public interface DeviceModelAttributeMapper extends BaseMapperX<DeviceModelAttri
.eqIfPresent(DeviceModelAttributeDO::getRemark, reqVO.getRemark())
.eqIfPresent(DeviceModelAttributeDO::getDeviceModelId, reqVO.getId())
.betweenIfPresent(DeviceModelAttributeDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DeviceModelAttributeDO::getCreateTime);
.orderByDesc(DeviceModelAttributeDO::getId);
if(reqVO.getIds() !=null && StringUtils.isNotBlank(reqVO.getIds())){

@ -111,13 +111,23 @@ public class DeviceServiceImpl implements DeviceService {
@Override
@Transactional(rollbackFor = Exception.class)
public DeviceDO createDevice(DeviceSaveReqVO createReqVO) {
if(StringUtils.isNotBlank(createReqVO.getReadTopic())){
DeviceDO temp = deviceMapper.selectByTopic(createReqVO.getReadTopic());
if (temp!=null){
throw exception(DEVICE_EXISTS);
}
// if(StringUtils.isNotBlank(createReqVO.getReadTopic())){
// DeviceDO temp = deviceMapper.selectByTopic(createReqVO.getReadTopic());
// if (temp!=null){
// throw exception(DEVICE_EXISTS);
// }
// }
//判断编码是否唯一
boolean exists = deviceMapper.exists(
Wrappers.<DeviceDO>lambdaQuery()
.eq(DeviceDO::getDeviceCode, createReqVO.getDeviceCode()));
if (exists) {
throw exception(DEVICE_CODE_ALREADY_EXISTS);
}
DeviceModelDO deviceModelDO = deviceModelMapper.selectById(createReqVO.getDeviceModelId());
// 插入

@ -80,8 +80,8 @@ public class TDengineService {
public Map<String, Object> getLatestDeviceData(Long id) {
String tableName = "d_" + id;
// 修改SQL对每个列单独使用last_row函数并指定别名
String sql = "SELECT last_row(ts) as ts, last_row(query_data) as query_data FROM besure." + tableName;
String sql = "SELECT ts, query_data FROM besure." + tableName +
" ORDER BY ts DESC LIMIT 1";
try {
return jdbcTemplate.queryForObject(sql, new RowMapper<Map<String, Object>>() {

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.iot.service.devicecontactmodel;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicecontactmodel.DeviceContactModelDO;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodelattribute.DeviceModelAttributeDO;
import cn.iocoder.yudao.module.iot.dal.mysql.deviceattributetype.DeviceAttributeTypeMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
@ -17,6 +18,8 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.DEVICE_CONTACT_MODEL_NOT_EXISTS;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_ATTRIBUTE_POTIN_CODE_EXISTS;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_POINT_CODE_EXISTS;
/**
* - Service
@ -34,6 +37,18 @@ public class DeviceContactModelServiceImpl implements DeviceContactModelService
@Override
public Long createDeviceContactModel(DeviceContactModelSaveReqVO createReqVO) {
//判断编码是否唯一
boolean exists = deviceContactModelMapper.exists(
Wrappers.<DeviceContactModelDO>lambdaQuery()
.eq(DeviceContactModelDO::getDeviceId, createReqVO.getDeviceId())
.eq(DeviceContactModelDO::getAttributeCode, createReqVO.getAttributeCode()));
if (exists) {
throw exception(DEVICE_MODEL_POINT_CODE_EXISTS);
}
// 插入
DeviceContactModelDO deviceContactModel = BeanUtils.toBean(createReqVO, DeviceContactModelDO.class);
// deviceContactModel.setTypeName(deviceAttributeTypeMapper.selectById(createReqVO.getAttributeCode()).getName());

@ -50,7 +50,18 @@ public class DeviceModelAttributeServiceImpl implements DeviceModelAttributeServ
@Override
public Long createDeviceModelAttribute(DeviceModelAttributeSaveReqVO createReqVO) {
// 插入
//判断编码是否唯一
boolean exists = deviceModelAttributeMapper.exists(
Wrappers.<DeviceModelAttributeDO>lambdaQuery()
.eq(DeviceModelAttributeDO::getDeviceModelId, createReqVO.getDeviceModelId())
.eq(DeviceModelAttributeDO::getAttributeCode, createReqVO.getAttributeCode()));
if (exists) {
throw exception(DEVICE_MODEL_ATTRIBUTE_POTIN_CODE_EXISTS);
}
// 插入
DeviceModelAttributeDO deviceModelAttribute = BeanUtils.toBean(createReqVO, DeviceModelAttributeDO.class);
// deviceModelAttribute.setTypeName(deviceAttributeTypeMapper.selectById(createReqVO.getAttributeCode()).getName());
deviceModelAttributeMapper.insert(deviceModelAttribute);

@ -147,6 +147,8 @@ public interface ErrorCodeConstants {
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 CRITICAL_COMPONENT_CODE_EXISTS = new ErrorCode(1002000015, "设备关键件编码已存在");
ErrorCode CRITICAL_COMPONENT_REFERENCES= new ErrorCode(1002000015, "存在设备关键件已被引用,请先删除引用");
ErrorCode REPAIR_TEMS_NOT_EXISTS = new ErrorCode(1002000016, "维修项目不存在");

@ -49,4 +49,16 @@ public class DvSubjectPageReqVO extends PageParam {
@Schema(description = "id集合导出用")
private String ids;
/**
*
*/
@Schema(description = "上限值")
private Double upperVal;
/**
*
*/
@Schema(description = "下限值")
private Double lowerVal;
}

@ -72,4 +72,18 @@ public class DvSubjectRespVO{
@ExcelProperty("创建人名字")
private String creatorName;
/**
*
*/
@Schema(description = "上限值")
@ExcelProperty("上限值")
private Double upperVal;
/**
*
*/
@Schema(description = "下限值")
@ExcelProperty("下限值")
private Double lowerVal;
}

@ -43,8 +43,20 @@ public class DvSubjectSaveReqVO {
@NotEmpty(message = "值类型")
private String valueType;
@Schema(description = "判定基准", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "判定基准")
@Schema(description = "判定基准")
// @NotEmpty(message = "判定基准")
private String judgmentCriteria;
/**
*
*/
@Schema(description = "上限值")
private Double upperVal;
/**
*
*/
@Schema(description = "下限值")
private Double lowerVal;
}

@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
import cn.iocoder.yudao.module.mes.service.deviceledger.DeviceLedgerService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -25,6 +26,7 @@ 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;
@ -64,24 +66,41 @@ public class MoldOperateController {
@Operation(summary = "创建模具上下模")
@PreAuthorize("@ss.hasPermission('mes:mold-operate:create')")
public CommonResult<Long> createMoldOperate(@Valid @RequestBody MoldOperateSaveReqVO createReqVO) {
if (Objects.equals(createReqVO.getOperateType(), "1")) {
DeviceLedgerDO deviceLedger = deviceLedgerService.getDeviceLedger(createReqVO.getDeviceId());
MoldDO moldDO = moldService.getMold(createReqVO.getMoldId());
moldDO.setMachineId(createReqVO.getDeviceId());
moldDO.setMachineName(deviceLedger.getDeviceName());
moldDO.setStatus(0); // 在机 0 在库 1
moldService.updateMold(BeanUtils.toBean(moldDO, MoldSaveReqVO.class));
deviceLedger.setMoldId(Long.toString(createReqVO.getMoldId()));
List<Long> idList = Arrays.stream(createReqVO.getMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
for (Long id : idList) {
MoldDO moldDO = moldService.getMold(id);
moldDO.setMachineId(createReqVO.getDeviceId());
moldDO.setMachineName(deviceLedger.getDeviceName());
moldDO.setStatus(0); // 在机 0 在库 1
moldService.updateMold(BeanUtils.toBean(moldDO, MoldSaveReqVO.class));
}
deviceLedger.setMoldId(createReqVO.getMoldId());
deviceLedgerService.updateDeviceLedger(BeanUtils.toBean(deviceLedger, DeviceLedgerSaveReqVO.class));
} else {
List<Long> lowerMoldId = Arrays.stream(createReqVO.getLowerMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
//下模
for (Long id : lowerMoldId) {
MoldDO moldDO = moldService.getMold(id);
moldDO.setMachineId(0L);
moldDO.setMachineName("");
moldDO.setStatus(3); // 在机 0 在途 3
moldService.updateMold(BeanUtils.toBean(moldDO, MoldSaveReqVO.class));
}
DeviceLedgerDO deviceLedger = deviceLedgerService.getDeviceLedger(createReqVO.getDeviceId());
createReqVO.setMoldId(Long.parseLong(deviceLedger.getMoldId()));
MoldDO moldDO = moldService.getMold(Long.parseLong(deviceLedger.getMoldId()));
moldDO.setMachineId(0L);
moldDO.setMachineName("");
moldDO.setStatus(3); // 在机 0 在库 1
moldService.updateMold(BeanUtils.toBean(moldDO, MoldSaveReqVO.class));
deviceLedger.setMoldId("0");
deviceLedger.setMoldId(createReqVO.getMoldId());
deviceLedgerService.updateDeviceLedger(BeanUtils.toBean(deviceLedger, DeviceLedgerSaveReqVO.class));
}
return success(moldOperateService.createMoldOperate(createReqVO));
@ -121,17 +140,18 @@ public class MoldOperateController {
// 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), admin -> Long.parseLong(admin.getCreator())));
// 模具信息
Map<Long, MoldRespVO> moldMap = moldService.getMoldVOMap(
convertSet(pageResult.getList(), MoldOperateDO::getMoldId));
// // 模具信息
// Map<Long, MoldRespVO> moldMap = moldService.getMoldVOMap(
// convertSet(pageResult.getList(), MoldOperateDO::getMoldId));
// 设备台账
Map<Long, DeviceLedgerRespVO> deviceLedgerMap = deviceLedgerService.getDeviceLedgerVOMap(
convertSet(pageResult.getList(), MoldOperateDO::getDeviceId));
// Map<Long, DeviceLedgerRespVO> deviceLedgerMap = deviceLedgerService.getDeviceLedgerVOMap(
// convertSet(pageResult.getList(), MoldOperateDO::getDeviceId));
return success(BeanUtils.toBean(pageResult, MoldOperateRespVO.class,moldOperate -> {
MapUtils.findAndThen(userMap, Long.parseLong(moldOperate.getCreator()), user -> moldOperate.setCreatorName(user.getNickname()));
MapUtils.findAndThen(moldMap, moldOperate.getMoldId(), mold -> moldOperate.setMoldName(mold.getName()));
MapUtils.findAndThen(deviceLedgerMap, moldOperate.getDeviceId(), deviceLedger -> moldOperate.setDeviceName(deviceLedger.getDeviceName()));
// MapUtils.findAndThen(moldMap, moldOperate.getMoldId(), mold -> moldOperate.setMoldName(mold.getName()));
// MapUtils.findAndThen(deviceLedgerMap, moldOperate.getDeviceId(), deviceLedger -> moldOperate.setDeviceName(deviceLedger.getDeviceName()));
}));
}
@ -162,4 +182,13 @@ public class MoldOperateController {
}
@GetMapping("/getLowerMoldList")
@Operation(summary = "获得模具下模列表")
@Parameter(name = "id", description = "设备id", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:mold-operate:query')")
public CommonResult<List<MoldDO>> getLowerMoldList(@RequestParam("id") Long id) {
List<MoldDO> moldDO = moldOperateService.getLowerMoldList(id);
return success(moldDO);
}
}

@ -16,7 +16,7 @@ public class MoldOperateSaveReqVO {
private String operateType;
@Schema(description = "关联模具id", example = "23041")
private Long moldId;
private String moldId;
@Schema(description = "关联设备id", example = "5057")
private Long deviceId;
@ -24,4 +24,7 @@ public class MoldOperateSaveReqVO {
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "下模模具id", example = "23041")
private String lowerMoldId;
}

@ -17,4 +17,8 @@ public class TicketManagementBatchUpdateReqVO {
@Schema(description = "作业状态", example = "2")
@NotNull(message = "作业状态不能为空")
private Integer jobStatus ;
@Schema(description = "取消原因")
@NotNull(message = "取消原因不能为空")
private String cancelReason;
}

@ -10,6 +10,8 @@ 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 javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -57,4 +59,7 @@ public class TicketManagementPageReqVO extends PageParam {
@Schema(description = "作业结束时间")
private String taskEndTime;
@Schema(description = "取消原因")
private String cancelReason;
}

@ -110,6 +110,9 @@ public class TicketManagementRespVO extends BaseDO {
// @ExcelProperty("创建人名字")
private String creatorName;
@Schema(description = "取消原因")
private String cancelReason;
}

@ -39,4 +39,7 @@ public class TicketManagementSaveReqVO {
@Schema(description = "作业结果")
private Integer jobResult;
@Schema(description = "取消原因")
private String cancelReason;
}

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mes.controller.admin.zjtask;
import cn.iocoder.yudao.module.common.controller.admin.moldrepair.vo.MoldRepairRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo.TicketManagementBatchUpdateReqVO;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -111,4 +112,14 @@ public class ZjTaskController {
ExcelUtils.write(response, "质量管理-检验任务.xls", "数据", ZjTaskRespVO.class, zjTaskRespVOList);
}
@PutMapping("/batchUpdateStatus")
@Operation(summary = "批量取消工单")
@PreAuthorize("@ss.hasPermission('mes:zj-task:update')")
public CommonResult<Boolean> batchUpdateZjTaskStatus(@Valid @RequestBody ZjTaskBatchUpdateReqVO reqVO) {
zjTaskService.batchUpdateJobStatus(reqVO);
return success(true);
}
}

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.mes.controller.admin.zjtask.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
// 1. 新增请求VO
@Data
public class ZjTaskBatchUpdateReqVO {
@Schema(description = "检验任务ID列表用逗号分隔", example = "1,2,3")
@NotBlank(message = "检验任务ID不能为空")
private String ids;
@Schema(description = "作业状态", example = "2")
@NotNull(message = "作业状态不能为空")
private Integer Status ;
@Schema(description = "取消原因")
@NotNull(message = "取消原因不能为空")
private String cancelReason;
}

@ -68,4 +68,7 @@ public class ZjTaskPageReqVO extends PageParam {
@Schema(description = "ids集合导出用")
private String ids;
@Schema(description = "取消原因")
private String cancelReason;
}

@ -95,4 +95,8 @@ public class ZjTaskRespVO {
@ColumnWidth(20)
private LocalDateTime executeTime;
@Schema(description = "取消原因")
@ExcelProperty("取消原因")
private String cancelReason;
}

@ -65,4 +65,7 @@ public class ZjTaskSaveReqVO {
@Schema(description = "执行时间")
private LocalDateTime executeTime;
@Schema(description = "取消原因")
private String cancelReason;
}

@ -67,4 +67,13 @@ public class DvSubjectDO extends BaseDO {
*/
private String judgmentCriteria;
/**
*
*/
private Double upperVal;
/**
*
*/
private Double lowerVal;
}

@ -34,7 +34,7 @@ public class MoldOperateDO extends BaseDO {
/**
* id
*/
private Long moldId;
private String moldId;
/**
* id
*/
@ -44,4 +44,16 @@ public class MoldOperateDO extends BaseDO {
*/
private String remark;
/**
*
*/
private String moldName;
/**
*
*/
private String deviceName;
}

@ -85,6 +85,10 @@ public class TicketManagementDO extends BaseDO {
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime taskEndTime;
/**
*
*/
private String cancelReason;

@ -92,5 +92,9 @@ public class ZjTaskDO extends BaseDO {
*
*/
private LocalDateTime executeTime;
/**
*
*/
private String cancelReason;
}

@ -33,6 +33,7 @@ public interface TicketManagementMapper extends BaseMapperX<TicketManagementDO>
.likeIfPresent(TicketManagementDO::getConfigName, reqVO.getConfigName())
.eqIfPresent(TicketManagementDO::getJobStatus, reqVO.getJobStatus())
.eqIfPresent(TicketManagementDO::getJobResult, reqVO.getJobResult())
.likeIfPresent(TicketManagementDO::getCancelReason, reqVO.getCancelReason())
.orderByDesc(TicketManagementDO::getId);
@ -58,6 +59,7 @@ public interface TicketManagementMapper extends BaseMapperX<TicketManagementDO>
* @return
*/
int batchUpdateJobStatus(@Param("idList") List<Long> idList,
@Param("jobStatus") Integer jobStatus);
@Param("jobStatus") Integer jobStatus,
@Param("cancelReason") String cancelReason);
}

@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.zjtask.ZjTaskDO;
import com.alibaba.excel.util.StringUtils;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.zjtask.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* - Mapper
@ -51,4 +52,15 @@ public interface ZjTaskMapper extends BaseMapperX<ZjTaskDO> {
return selectPage(reqVO,zjTaskDOLambdaQueryWrapperX );
}
/**
*
*
* @param idList ID
* @param jobStatus
* @return
*/
int batchUpdateJobStatus(@Param("idList") List<Long> idList,
@Param("status") Integer status,
@Param("cancelReason") String cancelReason);
}

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.mes.service.criticalcomponent;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodelattribute.DeviceModelAttributeDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.repairtems.RepairTemsDO;
import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper;
@ -22,6 +23,7 @@ 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.iot.enums.ErrorCodeConstants.DEVICE_MODEL_ATTRIBUTE_POTIN_CODE_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
/**
@ -45,6 +47,18 @@ public class CriticalComponentServiceImpl implements CriticalComponentService {
@Override
public Long createCriticalComponent(CriticalComponentSaveReqVO createReqVO) {
//判断编码是否唯一
boolean exists = criticalComponentMapper.exists(
Wrappers.<CriticalComponentDO>lambdaQuery()
.eq(CriticalComponentDO::getCode, createReqVO.getCode()));
if (exists) {
throw exception(CRITICAL_COMPONENT_CODE_EXISTS);
}
// 插入
CriticalComponentDO criticalComponent = BeanUtils.toBean(createReqVO, CriticalComponentDO.class);
criticalComponentMapper.insert(criticalComponent);

@ -56,11 +56,12 @@ public class DvRepairServiceImpl implements DvRepairService {
createReqVO.setRepairCode(autoCodeUtil.genSerialCode("DVR_CODE",null));
} else {
//编码重复判断
Long count = dvRepairMapper.selectCount(new LambdaQueryWrapper<DvRepairDO>()
boolean exists = dvRepairMapper.exists(
Wrappers.<DvRepairDO>lambdaQuery()
.eq(DvRepairDO::getRepairCode, createReqVO.getRepairCode())
);
if (count > 0) {
if (exists) {
throw exception(DV_REPAIR_CODE_EXISTS);
}
}

@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.mes.service.moldoperate;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.mes.controller.admin.moldoperate.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.moldoperate.MoldOperateDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -52,4 +54,7 @@ public interface MoldOperateService {
*/
PageResult<MoldOperateDO> getMoldOperatePage(MoldOperatePageReqVO pageReqVO);
List<MoldDO> getLowerMoldList(Long id);
}

@ -1,11 +1,19 @@
package cn.iocoder.yudao.module.mes.service.moldoperate;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldMapper;
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper;
import jodd.util.StringUtil;
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 java.util.stream.Collectors;
import cn.iocoder.yudao.module.mes.controller.admin.moldoperate.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.moldoperate.MoldOperateDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -29,10 +37,40 @@ public class MoldOperateServiceImpl implements MoldOperateService {
@Resource
private MoldOperateMapper moldOperateMapper;
@Resource
private DeviceLedgerMapper deviceLedgerMapper;
@Resource
private MoldMapper moldMapper;
@Override
public Long createMoldOperate(MoldOperateSaveReqVO createReqVO) {
// 插入
MoldOperateDO moldOperate = BeanUtils.toBean(createReqVO, MoldOperateDO.class);
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(createReqVO.getDeviceId());
moldOperate.setDeviceName(deviceLedgerDO.getDeviceName());
List<Long> idList = Arrays.stream(createReqVO.getMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
if (!idList.isEmpty()) {
StringBuilder moldNameBuilder = new StringBuilder();
for (Long id : idList) {
MoldDO moldDO = moldMapper.selectById(id);
if (moldDO != null && StringUtil.isNotBlank(moldDO.getName())) {
if (moldNameBuilder.length() > 0) {
moldNameBuilder.append(",");
}
moldNameBuilder.append(moldDO.getName());
}
}
moldOperate.setMoldName(moldNameBuilder.toString());
} else {
moldOperate.setMoldName("");
}
moldOperateMapper.insert(moldOperate);
// 返回
return moldOperate.getId();
@ -42,8 +80,34 @@ public class MoldOperateServiceImpl implements MoldOperateService {
public void updateMoldOperate(MoldOperateSaveReqVO updateReqVO) {
// 校验存在
validateMoldOperateExists(updateReqVO.getId());
// 更新
MoldOperateDO updateObj = BeanUtils.toBean(updateReqVO, MoldOperateDO.class);
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(updateReqVO.getDeviceId());
updateObj.setDeviceName(deviceLedgerDO.getDeviceName());
List<Long> idList = Arrays.stream(updateReqVO.getMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
if (!idList.isEmpty()) {
StringBuilder moldNameBuilder = new StringBuilder();
for (Long id : idList) {
MoldDO moldDO = moldMapper.selectById(id);
if (moldDO != null && StringUtil.isNotBlank(moldDO.getName())) {
if (moldNameBuilder.length() > 0) {
moldNameBuilder.append(",");
}
moldNameBuilder.append(moldDO.getName());
}
}
updateObj.setMoldName(moldNameBuilder.toString());
} else {
updateObj.setMoldName("");
}
moldOperateMapper.updateById(updateObj);
}
@ -71,4 +135,29 @@ public class MoldOperateServiceImpl implements MoldOperateService {
return moldOperateMapper.selectPage(pageReqVO);
}
@Override
public List<MoldDO> getLowerMoldList(Long id) {
List<MoldDO> moldDOList = new ArrayList<>();
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(id);
if (StringUtil.isBlank(deviceLedgerDO.getMoldId())){
return new ArrayList<>();
}
List<Long> idList = Arrays.stream(deviceLedgerDO.getMoldId().split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
for (Long moldId : idList) {
MoldDO moldDO = moldMapper.selectById(moldId);
if (moldDO != null){
moldDOList.add(moldDO);
}
}
return moldDOList;
}
}

@ -101,7 +101,7 @@ public class MoldTicketManagementServiceImpl implements MoldTicketManagementServ
}
// 2. 批量更新
moldTicketManagementMapper.batchUpdateJobStatus(idList, reqVO.getJobStatus());
moldTicketManagementMapper.batchUpdateJobStatus(idList, reqVO.getJobStatus(),reqVO.getCancelReason());
}

@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -52,11 +53,11 @@ public class RepairTemsServiceImpl implements RepairTemsService {
@Override
public Long createRepairTems(RepairTemsSaveReqVO createReqVO) {
//编码重复判断
Long count = repairTemsMapper.selectCount(new LambdaQueryWrapper<RepairTemsDO>()
boolean exists = repairTemsMapper.exists(Wrappers.<RepairTemsDO>lambdaQuery()
.eq(RepairTemsDO::getSubjectCode, createReqVO.getSubjectCode())
);
if (count > 0) {
if (exists) {
throw exception(REPAIR_TEMS_CODE_EXISTS);
}

@ -103,7 +103,7 @@ public class TicketManagementServiceImpl implements TicketManagementService {
}
// 2. 批量更新
ticketManagementMapper.batchUpdateJobStatus(idList, reqVO.getJobStatus());
ticketManagementMapper.batchUpdateJobStatus(idList, reqVO.getJobStatus(),reqVO.getCancelReason());
}
@Override

@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.mes.service.zjtask;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo.TicketManagementBatchUpdateReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.zjtask.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjtask.ZjTaskDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -59,4 +61,6 @@ public interface ZjTaskService {
*/
void updateZjTaskResultOnly(Long id, String result);
void batchUpdateJobStatus(@Valid ZjTaskBatchUpdateReqVO reqVO);
}

@ -5,8 +5,10 @@ import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
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.feedingrecord.vo.FeedingRecordRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo.TicketManagementBatchUpdateReqVO;
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.ticketmanagement.TicketManagementDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjitem.ZjItemDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjschema.ZjSchemaDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjtaskresults.ZjTaskResultsDO;
@ -23,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.module.mes.controller.admin.zjtask.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.zjtask.ZjTaskDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -175,4 +179,33 @@ public class ZjTaskServiceImpl implements ZjTaskService {
zjTaskMapper.updateById(updateDO);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void batchUpdateJobStatus(ZjTaskBatchUpdateReqVO reqVO) {
// 1. 解析ID列表
List<Long> idList = parseIds(reqVO.getIds());
if (idList.isEmpty()) {
throw exception(ZJ_TASK_NOT_EXISTS);
}
// 2. 批量更新
zjTaskMapper.batchUpdateJobStatus(idList, reqVO.getStatus(),reqVO.getCancelReason());
}
/**
* ID
*/
private List<Long> parseIds(String ids) {
if (com.alibaba.excel.util.StringUtils.isBlank(ids)) {
return Collections.emptyList();
}
return Arrays.stream(ids.split(","))
.map(String::trim)
.filter(com.alibaba.excel.util.StringUtils::isNotBlank)
.map(Long::valueOf)
.distinct()
.collect(Collectors.toList());
}
}

@ -13,6 +13,7 @@
<update id="batchUpdateJobStatus">
UPDATE mes_ticket_management
SET job_status = #{jobStatus},
cancel_reason = #{cancelReason},
update_time = NOW()
WHERE id IN
<foreach collection="idList" item="id" open="(" separator="," close=")">

@ -8,5 +8,15 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<!-- 批量更新作业状态 -->
<update id="batchUpdateJobStatus">
UPDATE mes_zj_task
SET status = #{status},
cancel_reason = #{cancelReason},
update_time = NOW()
WHERE id IN
<foreach collection="idList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>
Loading…
Cancel
Save