mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
自定义板编号手动复位功能实现
This commit is contained in:
+4
-1
@@ -349,5 +349,8 @@ public class ErrorCodeConstants {
|
||||
//=========== 系统配置 1-002-040-000 ============
|
||||
public static final ErrorCode SYSTEM_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_001, "系统配置不存在");
|
||||
public static final ErrorCode SYSTEM_CONFIG_TYPE_NOT_SUPPORT = new ErrorCode(1_002_040_002, "不支持的系统配置类型");
|
||||
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_SAVE_CHECK_ERROR = new ErrorCode(1_002_040_003, "系统配置:自定义板编号保存解析失败,请检查配置规则或联系客服");
|
||||
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_SAVE_CHECK_ERROR = new ErrorCode(1_002_040_003, "自定义板编号配置:自定义板编号保存解析失败,请检查配置规则或联系客服");
|
||||
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_RESET_NOT_SUPPORT = new ErrorCode(1_002_040_004, "自定义板编号配置:该规则不支持手动复位/清零");
|
||||
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_FIND = new ErrorCode(1_002_040_005, "自定义板编号配置:找不到对应的规则项进行手动复位/清零");
|
||||
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR = new ErrorCode(1_002_040_006, "自定义板编号配置:手动复位/清零生产单下序号失败,请联系客服");
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.api.systemconfig;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.api.systemconfig.dto.SystemConfigRespDTO;
|
||||
import com.cf.imes.module.system.service.config.SystemConfigService;
|
||||
import com.cf.imes.module.system.service.systemconfig.SystemConfigService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.cf.imes.module.system.controller.admin.customplateno;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.system.controller.admin.customplateno.vo.CustomPlateNoRuleResetModeReqVO;
|
||||
import com.cf.imes.module.system.service.customplateno.CustomPlateNoSeqService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 自定义板编号管理控制器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/11/7 16:36
|
||||
*/
|
||||
@Tag(name = "管理后台 - 系统配置 - 自定义板编号")
|
||||
@RestController
|
||||
@RequestMapping("/system/config/customplateno")
|
||||
@Validated
|
||||
public class CustomPlateNoController {
|
||||
@Resource
|
||||
private CustomPlateNoSeqService customPlateNoSeqService;
|
||||
|
||||
@PostMapping("/initValue")
|
||||
@Operation(summary = "手动复位/清零")
|
||||
@PreAuthorize("@ss.hasPermission('system:base-setting:setting')")
|
||||
public CommonResult<Boolean> updateRuleResetMode(@Valid @RequestBody CustomPlateNoRuleResetModeReqVO reqVO) {
|
||||
customPlateNoSeqService.updateRuleResetMode(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.cf.imes.module.system.controller.admin.customplateno.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/11/28 15:56
|
||||
*/
|
||||
@Schema(description = "管理后台 - 系统配置 - 自定义板编号规则复位 Request VO")
|
||||
@Data
|
||||
public class CustomPlateNoRuleResetModeReqVO {
|
||||
@Schema(description = "系统配置编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "系统配置编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "规则编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产单流水号")
|
||||
@NotEmpty(message = "规则编号不能为空")
|
||||
private String ruleCode;
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@ import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.service.config.SystemConfigService;
|
||||
import com.cf.imes.module.system.service.systemconfig.SystemConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.framework.rpc.config;
|
||||
|
||||
import com.cf.imes.module.executor.api.customplateno.OrderCustomPlateNoApi;
|
||||
import com.cf.imes.module.executor.api.orderProcess.OrderProcessApi;
|
||||
import com.cf.imes.module.executor.api.plan.OrderPlanApi;
|
||||
import com.cf.imes.module.infra.api.file.FileApi;
|
||||
@@ -8,6 +9,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, OrderProcessApi.class, OrderPlanApi.class})
|
||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, OrderProcessApi.class, OrderPlanApi.class, OrderCustomPlateNoApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
+8
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.service.customplateno;
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.customplateno.vo.CustomPlateNoRuleResetModeReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.customplateno.CustomPlateNoSeqDO;
|
||||
|
||||
/**
|
||||
@@ -22,4 +23,11 @@ public interface CustomPlateNoSeqService {
|
||||
* @param seqDO
|
||||
*/
|
||||
Boolean modifyOrgCustomPlateNoSeq(CustomPlateNoSeqDO seqDO);
|
||||
|
||||
/**
|
||||
* 规则手动复位/清零
|
||||
*
|
||||
* @param reqVO
|
||||
*/
|
||||
void updateRuleResetMode(CustomPlateNoRuleResetModeReqVO reqVO);
|
||||
}
|
||||
|
||||
+61
-1
@@ -1,13 +1,31 @@
|
||||
package com.cf.imes.module.system.service.customplateno;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||
import com.cf.imes.module.system.controller.admin.customplateno.vo.CustomPlateNoRuleResetModeReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.customplateno.CustomPlateNoSeqDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.customplateno.CustomPlateNoSeqMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.CustomPlateNoResetModeServiceFactory;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.AbstractCustomPlateNoResetServiceHandler;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_FIND;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 自定义板编号序号服务实现类
|
||||
*
|
||||
@@ -17,7 +35,13 @@ import javax.annotation.Resource;
|
||||
@Service
|
||||
public class CustomPlateNoSeqServiceImpl implements CustomPlateNoSeqService {
|
||||
@Resource
|
||||
CustomPlateNoSeqMapper customPlateNoSeqMapper;
|
||||
private CustomPlateNoSeqMapper customPlateNoSeqMapper;
|
||||
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
|
||||
@Resource
|
||||
private CustomPlateNoResetModeServiceFactory resetModeServiceFactory;
|
||||
|
||||
@Override
|
||||
public CustomPlateNoSeqDO getOrgCustomPlateNoSeq() {
|
||||
@@ -30,5 +54,41 @@ public class CustomPlateNoSeqServiceImpl implements CustomPlateNoSeqService {
|
||||
return customPlateNoSeqMapper.insertOrUpdate(seqDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateRuleResetMode(CustomPlateNoRuleResetModeReqVO reqVO) {
|
||||
// 校验配置是否存在
|
||||
Long configId = reqVO.getId();
|
||||
SystemConfigDO systemConfigDO = validateCustomPlateNoConfigExists(configId);
|
||||
// 解析规则列表,获取对应的规则项
|
||||
List<CustomPlateNoRuleDTO> customPlateNoRuleDTOS = JSON.parseArray(systemConfigDO.getSetting(), CustomPlateNoRuleDTO.class);
|
||||
Optional<CustomPlateNoRuleDTO> ruleVOOptional = customPlateNoRuleDTOS.stream().filter(r -> reqVO.getRuleCode().equals(r.getRuleCode())).findFirst();
|
||||
if (ruleVOOptional.isPresent()) {
|
||||
CustomPlateNoRuleDTO customPlateNoRuleDTO = ruleVOOptional.get();
|
||||
// 根据规则编码获取对应的复位处理器
|
||||
AbstractCustomPlateNoResetServiceHandler resetServiceHandler = resetModeServiceFactory.getResetServiceHandler(customPlateNoRuleDTO.getRuleCode());
|
||||
// 复位
|
||||
customPlateNoRuleDTO.setConfigId(systemConfigDO.getId());
|
||||
resetServiceHandler.reset(customPlateNoRuleDTO);
|
||||
} else {
|
||||
throw new ServiceException(SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_FIND);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验基础配置是否存在
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private SystemConfigDO validateCustomPlateNoConfigExists(Long id) {
|
||||
SystemConfigDO systemConfigDO = systemConfigMapper.selectOne(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getId, id)
|
||||
.eq(SystemConfigDO::getType, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
return systemConfigDO;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.cf.imes.module.system.service.customplateno.factory;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.cf.imes.module.system.enums.customplateno.CustomPlateNoRuleCodeEnum;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.AbstractCustomPlateNoResetServiceHandler;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.impl.BodyNoRuleResetServiceHandler;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.impl.OrderNoRuleResetServiceHandler;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.impl.PlateNoRuleResetServiceHandler;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.impl.RoomNoRuleResetServiceHandler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 自定义板编号规则复位处理器工厂类
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/11/28 16:21
|
||||
*/
|
||||
@Component
|
||||
public class CustomPlateNoResetModeServiceFactory {
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
public CustomPlateNoResetModeServiceFactory(ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据复位模式获取对应的处理器
|
||||
*
|
||||
* @param roleCode
|
||||
* @return
|
||||
*/
|
||||
public AbstractCustomPlateNoResetServiceHandler getResetServiceHandler(String roleCode) {
|
||||
CustomPlateNoRuleCodeEnum ruleCodeEnum = CustomPlateNoRuleCodeEnum.match(roleCode);
|
||||
switch (ruleCodeEnum) {
|
||||
case ORDERNO:
|
||||
return applicationContext.getBean(OrderNoRuleResetServiceHandler.class);
|
||||
case ROOMNO:
|
||||
return applicationContext.getBean(RoomNoRuleResetServiceHandler.class);
|
||||
case BODYNO:
|
||||
return applicationContext.getBean(BodyNoRuleResetServiceHandler.class);
|
||||
case PLATENO:
|
||||
return applicationContext.getBean(PlateNoRuleResetServiceHandler.class);
|
||||
default:
|
||||
throw new ServiceException(ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_RESET_NOT_SUPPORT);
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.cf.imes.module.system.service.customplateno.factory.service;
|
||||
|
||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||
|
||||
/**
|
||||
* 自定义板编号规则复位处理器抽象类
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/11/8 16:45
|
||||
*/
|
||||
public abstract class AbstractCustomPlateNoResetServiceHandler {
|
||||
|
||||
/**
|
||||
* 复位
|
||||
*
|
||||
* @param ruleDTO
|
||||
* @return
|
||||
*/
|
||||
public abstract void reset(CustomPlateNoRuleDTO ruleDTO);
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.cf.imes.module.system.service.customplateno.factory.service.impl;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.api.customplateno.OrderCustomPlateNoApi;
|
||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.AbstractCustomPlateNoResetServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR;
|
||||
|
||||
/**
|
||||
* 自定义板编号柜体序号规则复位处理器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/11/28 19:01
|
||||
*/
|
||||
@Service("bodyNoRuleResetServiceHandler")
|
||||
@Slf4j
|
||||
public class BodyNoRuleResetServiceHandler extends AbstractCustomPlateNoResetServiceHandler {
|
||||
|
||||
@Resource
|
||||
private OrderCustomPlateNoApi orderCustomPlateNoApi;
|
||||
|
||||
@Override
|
||||
public void reset(CustomPlateNoRuleDTO ruleDTO) {
|
||||
// 更新使用该配置的生产单中的orderNoSeq
|
||||
CommonResult<Boolean> orderResetResult = orderCustomPlateNoApi.resetOrderSeq(ruleDTO);
|
||||
if(orderResetResult.isError()) {
|
||||
ServiceException serviceException = new ServiceException(SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR);
|
||||
log.error(orderResetResult.getMsg(), serviceException);
|
||||
throw serviceException;
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.cf.imes.module.system.service.customplateno.factory.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.api.customplateno.OrderCustomPlateNoApi;
|
||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||
import com.cf.imes.module.system.dal.dataobject.customplateno.CustomPlateNoSeqDO;
|
||||
import com.cf.imes.module.system.dal.mysql.customplateno.CustomPlateNoSeqMapper;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.AbstractCustomPlateNoResetServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR;
|
||||
|
||||
/**
|
||||
* 自定义板编号生产单序号规则复位处理器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/11/28 16:45
|
||||
*/
|
||||
@Service("orderNoRuleResetServiceHandler")
|
||||
@Slf4j
|
||||
public class OrderNoRuleResetServiceHandler extends AbstractCustomPlateNoResetServiceHandler {
|
||||
|
||||
@Resource
|
||||
private CustomPlateNoSeqMapper customPlateNoSeqMapper;
|
||||
|
||||
@Resource
|
||||
private OrderCustomPlateNoApi orderCustomPlateNoApi;
|
||||
|
||||
@Override
|
||||
public void reset(CustomPlateNoRuleDTO ruleDTO) {
|
||||
// 更新机构下全局序号中的生产单前序值
|
||||
LambdaUpdateWrapper<CustomPlateNoSeqDO> seqLambdaUpdateWrapper = new LambdaUpdateWrapper<CustomPlateNoSeqDO>()
|
||||
.eq(CustomPlateNoSeqDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.set(CustomPlateNoSeqDO::getOrderNoSeq, ruleDTO.getInitValue());
|
||||
customPlateNoSeqMapper.update(seqLambdaUpdateWrapper);
|
||||
|
||||
// 更新使用该配置的生产单中的orderNoSeq
|
||||
CommonResult<Boolean> orderResetResult = orderCustomPlateNoApi.resetOrderSeq(ruleDTO);
|
||||
if(orderResetResult.isError()) {
|
||||
ServiceException serviceException = new ServiceException(SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR);
|
||||
log.error(orderResetResult.getMsg(), serviceException);
|
||||
throw serviceException;
|
||||
}
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.cf.imes.module.system.service.customplateno.factory.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.api.customplateno.OrderCustomPlateNoApi;
|
||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||
import com.cf.imes.module.system.dal.dataobject.customplateno.CustomPlateNoSeqDO;
|
||||
import com.cf.imes.module.system.dal.mysql.customplateno.CustomPlateNoSeqMapper;
|
||||
import com.cf.imes.module.system.enums.customplateno.ResetModeEnum;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.AbstractCustomPlateNoResetServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR;
|
||||
|
||||
/**
|
||||
* 自定义板编号板件序号规则复位处理器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/11/28 19:01
|
||||
*/
|
||||
@Service("plateNoRuleResetServiceHandler")
|
||||
@Slf4j
|
||||
public class PlateNoRuleResetServiceHandler extends AbstractCustomPlateNoResetServiceHandler {
|
||||
|
||||
@Resource
|
||||
private CustomPlateNoSeqMapper customPlateNoSeqMapper;
|
||||
|
||||
@Resource
|
||||
private OrderCustomPlateNoApi orderCustomPlateNoApi;
|
||||
|
||||
@Override
|
||||
public void reset(CustomPlateNoRuleDTO ruleDTO) {
|
||||
ResetModeEnum resetModeEnum = ResetModeEnum.getByMode(ruleDTO.getResetMode());
|
||||
if (ObjectUtil.equal(resetModeEnum, ResetModeEnum.ORDER) || ObjectUtil.equal(resetModeEnum, ResetModeEnum.YEAR)
|
||||
|| ObjectUtil.equal(resetModeEnum, ResetModeEnum.MONTH) || ObjectUtil.equal(resetModeEnum, ResetModeEnum.DAY)) {
|
||||
// 更新机构下全局序号中的板件序号前序值
|
||||
LambdaUpdateWrapper<CustomPlateNoSeqDO> seqLambdaUpdateWrapper = new LambdaUpdateWrapper<CustomPlateNoSeqDO>()
|
||||
.eq(CustomPlateNoSeqDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.set(CustomPlateNoSeqDO::getPlateNoSeq, ruleDTO.getInitValue());
|
||||
customPlateNoSeqMapper.update(seqLambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
// 更新使用该配置的生产单中的orderNoSeq
|
||||
CommonResult<Boolean> orderResetResult = orderCustomPlateNoApi.resetOrderSeq(ruleDTO);
|
||||
if(orderResetResult.isError()) {
|
||||
ServiceException serviceException = new ServiceException(SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR);
|
||||
log.error(orderResetResult.getMsg(), serviceException);
|
||||
throw serviceException;
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.cf.imes.module.system.service.customplateno.factory.service.impl;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.api.customplateno.OrderCustomPlateNoApi;
|
||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||
import com.cf.imes.module.system.service.customplateno.factory.service.AbstractCustomPlateNoResetServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR;
|
||||
|
||||
/**
|
||||
* 自定义板编号房间序号规则复位处理器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/11/28 19:01
|
||||
*/
|
||||
@Service("roomNoRuleResetServiceHandler")
|
||||
@Slf4j
|
||||
public class RoomNoRuleResetServiceHandler extends AbstractCustomPlateNoResetServiceHandler {
|
||||
|
||||
@Resource
|
||||
private OrderCustomPlateNoApi orderCustomPlateNoApi;
|
||||
|
||||
@Override
|
||||
public void reset(CustomPlateNoRuleDTO ruleDTO) {
|
||||
// 更新使用该配置的生产单中的orderNoSeq
|
||||
CommonResult<Boolean> orderResetResult = orderCustomPlateNoApi.resetOrderSeq(ruleDTO);
|
||||
if(orderResetResult.isError()) {
|
||||
ServiceException serviceException = new ServiceException(SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR);
|
||||
log.error(orderResetResult.getMsg(), serviceException);
|
||||
throw serviceException;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.service.config;
|
||||
package com.cf.imes.module.system.service.systemconfig;
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.service.config;
|
||||
package com.cf.imes.module.system.service.systemconfig;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -14,8 +14,8 @@ import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.config.factory.SystemConfigServiceFactory;
|
||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.SystemConfigServiceFactory;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
+5
-5
@@ -1,13 +1,13 @@
|
||||
package com.cf.imes.module.system.service.config.factory;
|
||||
package com.cf.imes.module.system.service.systemconfig.factory;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.config.factory.service.impl.CustomPlateNoServiceHandler;
|
||||
import com.cf.imes.module.system.service.config.factory.service.impl.DefaultSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.config.factory.service.impl.IntellectBranchingService;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.impl.CustomPlateNoServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.impl.DefaultSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.impl.IntellectBranchingService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.service.config.factory.service;
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service;
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.service.config.factory.service.impl;
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -24,7 +24,7 @@ import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.cf.imes.module.system.enums.customplateno.CustomPlateNoRuleCodeEnum;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.enums.customplateno.ResetModeEnum;
|
||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.customplateno.CustomPlateNoSeqService;
|
||||
import com.cf.imes.module.system.service.dict.DictDataService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.service.config.factory.service.impl;
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
@@ -11,7 +11,7 @@ import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateSt
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.service.config.factory.service.impl;
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -15,7 +15,7 @@ import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqV
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.service.config.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
Reference in New Issue
Block a user