update mes工艺路线步骤添加字段

master
yinq 3 weeks ago
parent ec3fcef018
commit ddea4c447f

@ -100,5 +100,5 @@ public class ProdBaseRoute extends TenantEntity {
private Long batchSize;
@TableField(exist = false)
List<ProdBaseRouteProcess> prodBaseRouteProcess;//映射字段
List<ProdBaseRouteProcess> prodBaseRouteProcessList;//映射字段
}

@ -24,6 +24,7 @@ public class ProdBaseRouteMaterial extends TenantEntity {
/**
* ID
*/
@TableId(value = "route_material_id", type = IdType.AUTO)
private Long routeMaterialId;
/**
@ -46,5 +47,6 @@ public class ProdBaseRouteMaterial extends TenantEntity {
*/
private String remark;
@TableField(exist = false)
private String materialName;
}

@ -47,7 +47,126 @@ public class ProdBaseRouteProcess extends BaseEntity {
*/
private String remark;
/**
* 0 2
*/
@TableLogic
private String delFlag;
/**
* 1 2
*/
private String outsourcingFlag;
/**
* 1 2 3
*/
private String operationType;
/**
* 0 1
*/
private String needFeeding;
/**
* 0 1
*/
private String needEquipmentCheck;
/**
* (%)
*/
private Long actualYieldRate;
/**
* 1 2 3
*/
private String materialIssuance;
/**
* ()
*/
private Long outsourcingLeadTime;
/**
* ()
*/
private Long setupTime;
/**
* ()
*/
private Long processingTime;
/**
* ()
*/
private Long teardownTime;
/**
* (/)
*/
private Long productionTakt;
/**
* 1 2 3
*/
private String inspectionMethod;
/**
* ID
*/
private Long qualityRuleId;
/**
* 0 1
*/
private String isKeyOperation;
/**
* 0 1 2
*/
private String nextStepRequirement;
/**
* 0 1
*/
private String isFinalStep;
/**
* 0 1
*/
private String generatePrepareTask;
/**
* 0 1
*/
private String bottleneckFlag;
/**
* 0 1
*/
private String bottleneckSetting;
/**
* ES SS
*/
private String successorRelation;
/**
* ()
*/
private Long offsetTime;
/**
*
*/
private String techAttachments;
/**
*
*/
private String inspectors;
/**
*

@ -1,6 +1,7 @@
package org.dromara.mes.domain.bo;
import org.dromara.mes.domain.ProdBaseRoute;
import org.dromara.mes.domain.ProdBaseRouteMaterial;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
@ -95,6 +96,8 @@ public class ProdBaseRouteBo extends BaseEntity {
*/
private Long batchSize;
private List<ProdBaseRouteProcessBo> routeProcessBoList;
private List<ProdBaseRouteProcessBo> routeProcessList;
private List<ProdBaseRouteMaterial> prodBaseRouteMaterialList;
}

@ -47,5 +47,118 @@ public class ProdBaseRouteProcessBo extends BaseEntity {
*/
private String remark;
/**
* 1 2
*/
private String outsourcingFlag;
/**
* 1 2 3
*/
private String operationType;
/**
* 0 1
*/
private String needFeeding;
/**
* 0 1
*/
private String needEquipmentCheck;
/**
* (%)
*/
private Long actualYieldRate;
/**
* 1 2 3
*/
private String materialIssuance;
/**
* ()
*/
private Long outsourcingLeadTime;
/**
* ()
*/
private Long setupTime;
/**
* ()
*/
private Long processingTime;
/**
* ()
*/
private Long teardownTime;
/**
* (/)
*/
private Long productionTakt;
/**
* 1 2 3
*/
private String inspectionMethod;
/**
* ID
*/
private Long qualityRuleId;
/**
* 0 1
*/
private String isKeyOperation;
/**
* 0 1 2
*/
private String nextStepRequirement;
/**
* 0 1
*/
private String isFinalStep;
/**
* 0 1
*/
private String generatePrepareTask;
/**
* 0 1
*/
private String bottleneckFlag;
/**
* 0 1
*/
private String bottleneckSetting;
/**
* ES SS
*/
private String successorRelation;
/**
* ()
*/
private Long offsetTime;
/**
*
*/
private String techAttachments;
/**
*
*/
private String inspectors;
}

@ -58,9 +58,6 @@ public class ProdBaseRouteProcessVo implements Serializable {
@ExcelProperty(value = "备注")
private String remark;
/**
*
*/
@ -73,5 +70,154 @@ public class ProdBaseRouteProcessVo implements Serializable {
@ExcelProperty(value = "工序类别", converter = ExcelDictConvert.class)
private String processType;
/**
* 1 2
*/
@ExcelProperty(value = "委外标识", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_outsourcing_flag")
private String outsourcingFlag;
/**
* 1 2 3
*/
@ExcelProperty(value = "工序类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "process_type")
private String operationType;
/**
* 0 1
*/
@ExcelProperty(value = "是否需要上料", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_need_feeding")
private String needFeeding;
/**
* 0 1
*/
@ExcelProperty(value = "设备点检", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_need_equipment_check")
private String needEquipmentCheck;
/**
* (%)
*/
@ExcelProperty(value = "实际产出率(%)")
private Long actualYieldRate;
/**
* 1 2 3
*/
@ExcelProperty(value = "领料方式", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_material_method")
private String materialIssuance;
/**
* ()
*/
@ExcelProperty(value = "委外提前期(秒)")
private Long outsourcingLeadTime;
/**
* ()
*/
@ExcelProperty(value = "准备时间(秒)")
private Long setupTime;
/**
* ()
*/
@ExcelProperty(value = "加工时间(秒)")
private Long processingTime;
/**
* ()
*/
@ExcelProperty(value = "拆卸时间(秒)")
private Long teardownTime;
/**
* (/)
*/
@ExcelProperty(value = "生产节拍(秒/件)")
private Long productionTakt;
/**
* 1 2 3
*/
@ExcelProperty(value = "质检方式", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_inspection_method")
private String inspectionMethod;
/**
* ID
*/
@ExcelProperty(value = "质量检验规则ID")
private Long qualityRuleId;
/**
* 0 1
*/
@ExcelProperty(value = "关键工序", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_is_key_operation")
private String isKeyOperation;
/**
* 0 1 2
*/
@ExcelProperty(value = "下工序要求", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_next_step_requirement")
private String nextStepRequirement;
/**
* 0 1
*/
@ExcelProperty(value = "最后工序", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_is_final_step")
private String isFinalStep;
/**
* 0 1
*/
@ExcelProperty(value = "生成流转卡任务", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "generate_prepare_task")
private String generatePrepareTask;
/**
* 0 1
*/
@ExcelProperty(value = "瓶颈工序", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_bottleneck_flag")
private String bottleneckFlag;
/**
* 0 1
*/
@ExcelProperty(value = "瓶颈设置", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_bottleneck_setting")
private String bottleneckSetting;
/**
* ES SS
*/
@ExcelProperty(value = "接续关系", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_successor_relation")
private String successorRelation;
/**
* ()
*/
@ExcelProperty(value = "偏置时间(秒)")
private Long offsetTime;
/**
*
*/
@ExcelProperty(value = "技术附件")
private String techAttachments;
/**
*
*/
@ExcelProperty(value = "质检员")
private String inspectors;
}

@ -8,6 +8,7 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.mes.domain.ProdBaseRouteMaterial;
import java.io.Serial;
import java.io.Serializable;
@ -158,7 +159,9 @@ public class ProdBaseRouteVo implements Serializable {
* 线
*/
@ExcelIgnore
private List<ProdBaseRouteProcessVo> routeProcessVoList;
private List<ProdBaseRouteProcessVo> routeProcessList;
@ExcelIgnore
private List<ProdBaseRouteMaterial> prodBaseRouteMaterialList;
}

@ -1,7 +1,6 @@
package org.dromara.mes.service.impl;
import cn.hutool.core.util.ObjectUtil;
import org.dromara.common.core.utils.DateUtils;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -9,22 +8,22 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.mes.domain.ProdBaseRouteProcess;
import org.dromara.mes.domain.*;
import org.dromara.mes.domain.bo.ProdBaseRouteProcessBo;
import org.dromara.mes.domain.vo.ProdBaseRouteProcessVo;
import org.dromara.mes.mapper.ProdBaseRouteMaterialMapper;
import org.dromara.mes.service.IProdBaseRouteProcessService;
import org.springframework.stereotype.Service;
import org.dromara.mes.domain.bo.ProdBaseRouteBo;
import org.dromara.mes.domain.vo.ProdBaseRouteVo;
import org.dromara.mes.domain.ProdBaseRoute;
import org.dromara.mes.mapper.ProdBaseRouteMapper;
import org.dromara.mes.service.IProdBaseRouteService;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* 线Service
@ -40,6 +39,8 @@ public class ProdBaseRouteServiceImpl implements IProdBaseRouteService {
private final IProdBaseRouteProcessService routeProcessService;
private final ProdBaseRouteMaterialMapper routeMaterialMapper;
/**
* 线
*
@ -47,13 +48,22 @@ public class ProdBaseRouteServiceImpl implements IProdBaseRouteService {
* @return 线
*/
@Override
public ProdBaseRouteVo queryById(Long routeId){
public ProdBaseRouteVo queryById(Long routeId) {
ProdBaseRouteVo prodBaseRouteVo = routeMapper.selectVoById(routeId);
// queryList方法查询工艺路线组(工艺步骤)
// queryList方法查询工艺路线组(工艺步骤)
ProdBaseRouteProcessBo prodBaseRouteProcessBo = new ProdBaseRouteProcessBo();
prodBaseRouteProcessBo.setRouteId(routeId);
List<ProdBaseRouteProcessVo> routeProcessVoList = routeProcessService.queryList(prodBaseRouteProcessBo);
prodBaseRouteVo.setRouteProcessVoList(routeProcessVoList);
prodBaseRouteVo.setRouteProcessList(routeProcessVoList);
// 关联物料
MPJLambdaWrapper<ProdBaseRouteMaterial> lqw = JoinWrappers.lambda(ProdBaseRouteMaterial.class);
lqw.selectAll(ProdBaseRouteMaterial.class)
.select(BaseMaterialInfo::getMaterialName)
.leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, ProdBaseRouteMaterial::getMaterialId)
.eq(ProdBaseRouteMaterial::getRouteId, routeId);
List<ProdBaseRouteMaterial> prodBaseRouteMaterialList = routeMaterialMapper.selectList(lqw);
prodBaseRouteVo.setProdBaseRouteMaterialList(prodBaseRouteMaterialList);
return prodBaseRouteVo;
}
@ -87,12 +97,12 @@ public class ProdBaseRouteServiceImpl implements IProdBaseRouteService {
private MPJLambdaWrapper<ProdBaseRoute> buildQueryWrapper(ProdBaseRouteBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<ProdBaseRoute> lqw = JoinWrappers.lambda(ProdBaseRoute.class)
.selectAll(ProdBaseRoute.class)
.eq(bo.getRouteId() != null, ProdBaseRoute::getRouteId, bo.getRouteId())
.like(StringUtils.isNotBlank(bo.getRouteName()), ProdBaseRoute::getRouteName, bo.getRouteName())
.eq(StringUtils.isNotBlank(bo.getRouteDesc()), ProdBaseRoute::getRouteDesc, bo.getRouteDesc())
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdBaseRoute::getActiveFlag, bo.getActiveFlag())
.orderByAsc(ProdBaseRoute::getCreateTime);
.selectAll(ProdBaseRoute.class)
.eq(bo.getRouteId() != null, ProdBaseRoute::getRouteId, bo.getRouteId())
.like(StringUtils.isNotBlank(bo.getRouteName()), ProdBaseRoute::getRouteName, bo.getRouteName())
.eq(StringUtils.isNotBlank(bo.getRouteDesc()), ProdBaseRoute::getRouteDesc, bo.getRouteDesc())
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdBaseRoute::getActiveFlag, bo.getActiveFlag())
.orderByAsc(ProdBaseRoute::getCreateTime);
return lqw;
}
@ -111,7 +121,16 @@ public class ProdBaseRouteServiceImpl implements IProdBaseRouteService {
insertProdBaseRouteProcess(bo);
boolean flag = routeMapper.insert(add) > 0;
if (flag) {
assert add != null;
bo.setRouteId(add.getRouteId());
// 插入关联物料
List<ProdBaseRouteMaterial> materialList = bo.getProdBaseRouteMaterialList();
if (materialList != null && !materialList.isEmpty()) {
for (ProdBaseRouteMaterial material : materialList) {
material.setRouteId(add.getRouteId());
routeMaterialMapper.insert(material);
}
}
}
return flag;
}
@ -130,14 +149,44 @@ public class ProdBaseRouteServiceImpl implements IProdBaseRouteService {
Long routeId = bo.getRouteId();
routeMapper.deleteProdBaseRouteProcessByRouteId(routeId);
insertProdBaseRouteProcess(bo);
// 更新工艺路线关联物料
List<ProdBaseRouteMaterial> materialList = bo.getProdBaseRouteMaterialList();
MPJLambdaWrapper<ProdBaseRouteMaterial> lqwMaterial = JoinWrappers.lambda(ProdBaseRouteMaterial.class);
lqwMaterial.eq(ProdBaseRouteMaterial::getRouteId, bo.getRouteId());
List<ProdBaseRouteMaterial> dbMaterialList = routeMaterialMapper.selectList(lqwMaterial);
if (materialList != null && !materialList.isEmpty()) {
for (ProdBaseRouteMaterial material : materialList) {
material.setRouteId(bo.getRouteId());
if (material.getRouteMaterialId() == null) {
routeMaterialMapper.insert(material);
} else {
routeMaterialMapper.updateById(material);
}
}
Set<Long> existingIds = materialList.stream()
.filter(m -> m.getRouteMaterialId() != null)
.map(ProdBaseRouteMaterial::getRouteMaterialId)
.collect(Collectors.toSet());
List<ProdBaseRouteMaterial> filteredIds = dbMaterialList.stream()
.filter(field -> !existingIds.contains(field.getRouteMaterialId()))
.toList();
for (ProdBaseRouteMaterial material : filteredIds) {
routeMaterialMapper.deleteById(material.getRouteMaterialId());
}
} else if (dbMaterialList != null && !dbMaterialList.isEmpty()) {
// 如果前端传空,全部删除
for (ProdBaseRouteMaterial material : dbMaterialList) {
routeMaterialMapper.deleteById(material.getRouteMaterialId());
}
}
validEntityBeforeSave(update);
return updateResult > 0;
return updateResult > 0;
}
/**
*
*/
private void validEntityBeforeSave(ProdBaseRoute entity){
private void validEntityBeforeSave(ProdBaseRoute entity) {
//TODO 做一些数据校验,如唯一约束
}
@ -151,7 +200,7 @@ public class ProdBaseRouteServiceImpl implements IProdBaseRouteService {
@Transactional
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
routeProcessService.deleteWithValidByIds(ids, isValid);
@ -160,31 +209,28 @@ public class ProdBaseRouteServiceImpl implements IProdBaseRouteService {
/**
* 线
*
* @param bo 线
*/
public void insertProdBaseRouteProcess(ProdBaseRouteBo bo)
{
public void insertProdBaseRouteProcess(ProdBaseRouteBo bo) {
// 获取工艺路线中的工艺步骤列表
List<ProdBaseRouteProcessBo> prodBaseRouteProcessList = bo.getRouteProcessBoList();
List<ProdBaseRouteProcessBo> prodBaseRouteProcessList = bo.getRouteProcessList();
// 获取工艺路线ID
Long routeId = bo.getRouteId();
// 如果工艺步骤列表不为空
if (ObjectUtil.isNotNull(prodBaseRouteProcessList))
{
if (ObjectUtil.isNotNull(prodBaseRouteProcessList)) {
// 创建一个新的工艺步骤列表
List<ProdBaseRouteProcessBo> list = new ArrayList<ProdBaseRouteProcessBo>();
// 遍历每一个工艺步骤
for (ProdBaseRouteProcessBo prodBaseRouteProcess : prodBaseRouteProcessList)
{
for (ProdBaseRouteProcessBo prodBaseRouteProcess : prodBaseRouteProcessList) {
// 设置工艺步骤的工艺路线ID
prodBaseRouteProcess.setRouteId(routeId);
// 将工艺步骤添加到新的列表中
list.add(prodBaseRouteProcess);
}
// 如果新的工艺步骤列表不为空
if (!list.isEmpty())
{
if (!list.isEmpty()) {
// 批量插入工艺步骤到数据库
routeMapper.batchProdBaseRouteProcess(list);
}
@ -193,6 +239,7 @@ public class ProdBaseRouteServiceImpl implements IProdBaseRouteService {
/**
* 线ID
*
* @param routeId
* @return
*/
@ -208,8 +255,7 @@ public class ProdBaseRouteServiceImpl implements IProdBaseRouteService {
* @return 线
*/
@Override
public ProdBaseRouteVo selectProdBaseRouteByRouteId(Long routeId)
{
public ProdBaseRouteVo selectProdBaseRouteByRouteId(Long routeId) {
return routeMapper.selectProdBaseRouteByRouteId(routeId);
}
}

Loading…
Cancel
Save