mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
+6
-1
@@ -4,18 +4,23 @@ package com.cf.imes.module.executor.api.orderProcess;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.dal.dataobject.process.OrderProcessDO;
|
||||
import com.cf.imes.module.executor.service.process.OrderProcessService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
public class OrderProcessServiceImpl implements OrderProcessApi{
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class OrderProcessApiImpl implements OrderProcessApi{
|
||||
|
||||
@Resource
|
||||
private OrderProcessService orderProcessService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> getOrderProcessByProcessGroupId(Long id) {
|
||||
System.out.println(" Long id " + id);
|
||||
OrderProcessDO plateDO = orderProcessService.getOrderProcessByProcessGroupId(id);
|
||||
if (plateDO == null) {
|
||||
return success(false);
|
||||
+1
-1
@@ -13,7 +13,7 @@ import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("order_process")
|
||||
@TableName("imes_prod.order_process")
|
||||
@KeySequence("order_process_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
+22
-22
@@ -70,30 +70,30 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
// 插入
|
||||
OrderProcessDO orderProcess = BeanUtils.toBean(createReqVO, OrderProcessDO.class).setId((Long) identifierGenerator.nextId(null));
|
||||
|
||||
//
|
||||
// List<ProcessStepDO> processStepDOS = new ArrayList<>();
|
||||
// List<OrderProcessStepItemDO> orderProcessStepItemDOS = new ArrayList<>();
|
||||
// // 需要获取工序组的具体信息,以及工序组中工序的信息,然后将工序组中工序的信息插入到生产单工序步骤表中
|
||||
// ProcessListReqDTO processListReqDTO = processGroupApi.getProcessGroupDetail(createReqVO.getGroupId());
|
||||
// System.err.println(processListReqDTO);
|
||||
// processListReqDTO.getLists().forEach(processRespDTO -> {
|
||||
// ProcessStepDO processStepDO = BeanUtils.toBean(processRespDTO, ProcessStepDO.class).setOrderId(createReqVO.getOrderId())
|
||||
// .setStatus(false).setProcessinfoId(processRespDTO.getId()).setOrderProcessId(orderProcess.getId())
|
||||
// .setId((Long) identifierGenerator.nextId(null));// 计划日期没有填写
|
||||
// processStepDOS.add(processStepDO);
|
||||
// OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
// .name(processRespDTO.getName())
|
||||
// .processStepId(processRespDTO.getId())
|
||||
// .orderProcessId(orderProcess.getId())
|
||||
// .status(false)
|
||||
// .groupName(processListReqDTO.getName())
|
||||
// .build();// 查模块id,柜体id,加工组id
|
||||
// orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
// });
|
||||
|
||||
List<ProcessStepDO> processStepDOS = new ArrayList<>();
|
||||
List<OrderProcessStepItemDO> orderProcessStepItemDOS = new ArrayList<>();
|
||||
// 需要获取工序组的具体信息,以及工序组中工序的信息,然后将工序组中工序的信息插入到生产单工序步骤表中
|
||||
ProcessListReqDTO processListReqDTO = processGroupApi.getProcessGroupDetail(createReqVO.getGroupId());
|
||||
|
||||
processListReqDTO.getLists().forEach(processRespDTO -> {
|
||||
ProcessStepDO processStepDO = BeanUtils.toBean(processRespDTO, ProcessStepDO.class).setOrderId(createReqVO.getOrderId())
|
||||
.setStatus(false).setProcessinfoId(processRespDTO.getId()).setOrderProcessId(orderProcess.getId())
|
||||
.setId((Long) identifierGenerator.nextId(null));// 计划日期没有填写
|
||||
processStepDOS.add(processStepDO);
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(processRespDTO.getName())
|
||||
.processStepId(processRespDTO.getId())
|
||||
.orderProcessId(orderProcess.getId())
|
||||
.status(false)
|
||||
.groupName(processListReqDTO.getName())
|
||||
.build();// 查模块id,柜体id,加工组id
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
});
|
||||
// 批量插入
|
||||
orderProcessMapper.insert(orderProcess);
|
||||
// processStepMapper.insertBatch(processStepDOS);
|
||||
// processStepItemMapper.insertBatch(orderProcessStepItemDOS);
|
||||
processStepMapper.insertBatch(processStepDOS);
|
||||
processStepItemMapper.insertBatch(orderProcessStepItemDOS);
|
||||
// 返回
|
||||
return orderProcess.getId();
|
||||
}
|
||||
|
||||
+7
-7
@@ -22,19 +22,19 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
default PageResult<PlateDO> selectPage(PlatePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PlateDO>()
|
||||
.eqIfPresent(PlateDO::getOrganId, reqVO.getOrganId())
|
||||
.eqIfPresent(PlateDO::getGoodsId, reqVO.getGoodsId())
|
||||
.likeIfPresent(PlateDO::getGoodsName, reqVO.getGoodsName())
|
||||
.eqIfPresent(PlateDO::getMaterial, reqVO.getMaterial())
|
||||
.eqIfPresent(PlateDO::getColor, reqVO.getColor())
|
||||
.likeIfPresent(PlateDO::getMaterial, reqVO.getMaterial())
|
||||
.likeIfPresent(PlateDO::getColor, reqVO.getColor())
|
||||
.eqIfPresent(PlateDO::getWidth, reqVO.getWidth())
|
||||
.eqIfPresent(PlateDO::getHeight, reqVO.getHeight())
|
||||
.eqIfPresent(PlateDO::getThickness, reqVO.getThickness())
|
||||
.eqIfPresent(PlateDO::getOrganId, reqVO.getOrganId())
|
||||
.eqIfPresent(PlateDO::getBrand, reqVO.getBrand())
|
||||
.eqIfPresent(PlateDO::getSpec, reqVO.getSpec())
|
||||
.eqIfPresent(PlateDO::getRemark, reqVO.getRemark())
|
||||
.likeIfPresent(PlateDO::getBrand, reqVO.getBrand())
|
||||
.likeIfPresent(PlateDO::getSpec, reqVO.getSpec())
|
||||
.likeIfPresent(PlateDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(PlateDO::getPrice, reqVO.getPrice())
|
||||
.eqIfPresent(PlateDO::getOrganId, reqVO.getOrganId())
|
||||
.likeIfPresent(PlateDO::getTexture, reqVO.getTexture())
|
||||
.betweenIfPresent(PlateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PlateDO::getId));
|
||||
}
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ public interface ErrorCodeConstants {
|
||||
|
||||
//=========== 工序信息 1-002-028-000 ============
|
||||
ErrorCode PROCESS_NOT_EXISTS = new ErrorCode(1_002_028_000, "工序不存在");
|
||||
ErrorCode PROCESS_IS_ENABLED = new ErrorCode(1_002_028_000, "工序以启用,禁止关闭");
|
||||
ErrorCode PROCESS_IS_ENABLED = new ErrorCode(1_002_028_000, "工序已在工序组中启用,禁止关闭");
|
||||
ErrorCode PROCESS_ID_IS_NULL = new ErrorCode(1_002_028_000, "工序ID填写错误不存在");
|
||||
ErrorCode PROCESS_STATUS_DISABLE = new ErrorCode(1_002_028_000, "工序状态以已禁用");
|
||||
|
||||
|
||||
+8
-1
@@ -12,6 +12,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PROCESS_GROUP_NOT_EXISTS;
|
||||
|
||||
@@ -34,13 +37,17 @@ public class ProcessGroupApiImpl implements ProcessGroupApi {
|
||||
|
||||
@Override
|
||||
public ProcessListReqDTO getProcessGroupDetail(Long groupId) {
|
||||
|
||||
ProcessGroupDO processGroupDO = processGroupMapper.selectById(groupId);
|
||||
|
||||
if (processGroupDO == null)
|
||||
throw exception(PROCESS_GROUP_NOT_EXISTS);
|
||||
String[] items = processGroupDO.getItems().split(",");
|
||||
ProcessListReqDTO processListReqDTO = BeanUtils.toBean(processGroupDO, ProcessListReqDTO.class);
|
||||
List<ProcessRespDTO> lists = new ArrayList<>();
|
||||
ProcessListReqDTO processListReqDTO = BeanUtils.toBean(processGroupDO, ProcessListReqDTO.class).setLists(lists);
|
||||
for (String item : items) {
|
||||
ProcessDO processDO = processMapper.selectById(Long.parseLong(item));
|
||||
|
||||
processListReqDTO.getLists().add(BeanUtils.toBean(processDO, ProcessRespDTO.class));
|
||||
}
|
||||
return processListReqDTO;
|
||||
|
||||
+3
-3
@@ -33,18 +33,18 @@ public interface ProcessMapper extends BaseMapperX<ProcessDO> {
|
||||
.eqIfPresent(ProcessDO::getOrganId, reqVO.getOrganId())
|
||||
.eqIfPresent(ProcessDO::getIsEnabled, reqVO.getIsEnabled())
|
||||
.betweenIfPresent(ProcessDO::getPrepareTime, reqVO.getPrepareTime())
|
||||
.eqIfPresent(ProcessDO::getDescription, reqVO.getDescription())
|
||||
.likeIfPresent(ProcessDO::getDescription, reqVO.getDescription())
|
||||
.betweenIfPresent(ProcessDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ProcessDO::getId));
|
||||
}
|
||||
|
||||
IPage<ProcessDO> selectProcessPage(@Param("page") IPage<ProcessDO> page , @Param("page") ProcessPageReqVO reqVO);
|
||||
IPage<ProcessDO> selectProcessPage(@Param("page") IPage<ProcessDO> page , @Param("vo") ProcessPageReqVO reqVO);
|
||||
|
||||
ProcessDO selectOneById(@Param("id") Long id, @Param("organId") Long organId);
|
||||
|
||||
default List<ProcessDO> selectAll(Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<ProcessDO>()
|
||||
.orderByDesc(ProcessDO::getId)
|
||||
// .orderByDesc(ProcessDO::getId)
|
||||
.eqIfPresent(ProcessDO::getOrganId, organId)
|
||||
.eqIfPresent(ProcessDO::getIsEnabled, true));
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class ProcessGroupServiceImpl implements ProcessGroupService {
|
||||
// 校验存在
|
||||
validateProcessGroupExists(id);
|
||||
// 判断是否在生产中使用这个加工组,如果使用则不能删除
|
||||
// checkProcessGroupUsed(id);
|
||||
checkProcessGroupUsed(id);
|
||||
// 删除
|
||||
processGroupMapper.deleteById(id);
|
||||
}
|
||||
|
||||
+10
-9
@@ -24,6 +24,7 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.dal.mysql.process.ProcessMapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
@@ -87,7 +88,7 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
public void updateProcess(ProcessUserSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateProcessExists(updateReqVO.getId());
|
||||
if (updateReqVO.getIsEnabled()) {//为禁用
|
||||
if (!updateReqVO.getIsEnabled()) {//调为禁用
|
||||
if (isProcessUsed(String.valueOf(updateReqVO.getId()))){
|
||||
throw exception(PROCESS_IS_ENABLED);
|
||||
}
|
||||
@@ -117,14 +118,14 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
}
|
||||
processMapper.updateById(updateProcess);
|
||||
}
|
||||
|
||||
// 判断此工序是否已在工序组中使用
|
||||
public boolean isProcessUsed(String items) {
|
||||
System.out.println("processGroupMapper.selectListByItems(items) " + processGroupMapper.selectListByItems(items));
|
||||
System.out.println(processGroupMapper.selectListByItems(items) != null);
|
||||
System.out.println(processGroupMapper.selectListByItems(items).size());
|
||||
if (processGroupMapper.selectListByItems(items) != null)
|
||||
return true;
|
||||
return false;
|
||||
// System.out.println("processGroupMapper.selectListByItems(items) " + processGroupMapper.selectListByItems(items));
|
||||
// System.out.println(processGroupMapper.selectListByItems(items).size());
|
||||
if (processGroupMapper.selectListByItems(items).size() == 0) // 没有使用
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,13 +170,13 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
|
||||
@Override
|
||||
public PageResult<ProcessDO> getProcessPage(ProcessPageReqVO pageReqVO) {//分页加用户
|
||||
return processMapper.selectPage(pageReqVO);
|
||||
return processMapper.selectPage(pageReqVO.setOrganId(OrganContextHolder.getOrganId()).setIsDealer(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProcessRespVO> getProcessPageAll(ProcessPageReqVO pageReqVO) {
|
||||
PageDTO<ProcessDO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
IPage<ProcessDO> processRespVOPageResult = processMapper.selectProcessPage(page,BeanUtils.toBean(pageReqVO, ProcessPageReqVO.class));
|
||||
IPage<ProcessDO> processRespVOPageResult = processMapper.selectProcessPage(page,BeanUtils.toBean(pageReqVO, ProcessPageReqVO.class).setOrganId(OrganContextHolder.getOrganId()));
|
||||
return new PageResult<ProcessRespVO>(BeanUtils.toBean(processRespVOPageResult.getRecords(), ProcessRespVO.class), processRespVOPageResult.getTotal());
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -24,21 +24,21 @@
|
||||
p.deleted
|
||||
from process p
|
||||
<where>
|
||||
p.deleted = 0
|
||||
<if test="page.userId != null and page.userId != '' ">
|
||||
and p.id in (select process_id from process_user where user_id = #{page.userId})
|
||||
p.deleted = 0 and p.organ_id = #{vo.organId}
|
||||
<if test="vo.userId != null and vo.userId != '' ">
|
||||
and p.id in (select process_id from process_user where user_id = #{vo.userId})
|
||||
</if>
|
||||
<if test="page.name != null and page.name != '' ">
|
||||
and p.name like concat('%', #{page.name}, '%')
|
||||
<if test="vo.name != null and vo.name != '' ">
|
||||
and p.name like concat('%', #{vo.name}, '%')
|
||||
</if>
|
||||
<if test="page.isEnabled != null">
|
||||
and p.is_enabled = #{page.isEnabled}
|
||||
<if test="vo.isEnabled != null">
|
||||
and p.is_enabled = #{vo.isEnabled}
|
||||
</if>
|
||||
<if test="page.type != null">
|
||||
and p.type = #{page.type}
|
||||
<if test="vo.type != null">
|
||||
and p.type = #{vo.type}
|
||||
</if>
|
||||
<if test="page.pieceType != null">
|
||||
and p.piece_type = #{page.pieceType}
|
||||
<if test="vo.pieceType != null">
|
||||
and p.piece_type = #{vo.pieceType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user