优化混炼示方日志记录逻辑,直接从入参构建快照以减少数据库查询,提高性能与效率。
This commit is contained in:
@@ -41,6 +41,7 @@ import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecTcuMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslFormulaSpecEditLogService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -98,10 +99,9 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
||||
saveChildren(main.getId(), materialList, stepList, downStepList, tcuList, trace);
|
||||
trace.finish();
|
||||
//update-begin---author:cursor ---date:20260526 for:【配方日志查询】混炼示方新增落库修改日志-----------
|
||||
MesXslMixingSpecPage saved = queryPageById(main.getId());
|
||||
if (saved != null) {
|
||||
mesXslFormulaSpecEditLogService.recordMixingCreate(saved);
|
||||
}
|
||||
// 直接用已落库的入参构建快照,避免二次全量 queryPageById() 查询
|
||||
mesXslFormulaSpecEditLogService.recordMixingCreate(
|
||||
buildPageFromInput(main, materialList, stepList, downStepList, tcuList));
|
||||
//update-end---author:cursor ---date:20260526 for:【配方日志查询】混炼示方新增落库修改日志-----------
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子表新增保存-----------
|
||||
}
|
||||
@@ -130,10 +130,9 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
||||
saveChildren(main.getId(), materialList, stepList, downStepList, tcuList, trace);
|
||||
trace.finish();
|
||||
//update-begin---author:cursor ---date:20260526 for:【配方日志查询】混炼示方编辑落库修改日志-----------
|
||||
MesXslMixingSpecPage after = queryPageById(main.getId());
|
||||
if (after != null) {
|
||||
mesXslFormulaSpecEditLogService.recordMixingUpdate(before, after);
|
||||
}
|
||||
// 直接用已落库的入参构建 after 快照,避免二次全量 queryPageById() 查询(节省 5 次 SELECT)
|
||||
mesXslFormulaSpecEditLogService.recordMixingUpdate(before,
|
||||
buildPageFromInput(main, materialList, stepList, downStepList, tcuList));
|
||||
//update-end---author:cursor ---date:20260526 for:【配方日志查询】混炼示方编辑落库修改日志-----------
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子表编辑保存-----------
|
||||
}
|
||||
@@ -841,4 +840,21 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
||||
this.update(wrapper);
|
||||
}
|
||||
//update-end---author:cursor ---date:20260526 for:【XSLMES-20260526-A61】混炼示方密炼PS审批联动同步审批人-----------
|
||||
|
||||
//update-begin---author:cursor ---date:20260527 for:【配方日志查询】从入参直接构建快照,避免二次查库-----------
|
||||
private MesXslMixingSpecPage buildPageFromInput(
|
||||
MesXslMixingSpec main,
|
||||
List<MesXslMixingSpecMaterial> materialList,
|
||||
List<MesXslMixingSpecStep> stepList,
|
||||
List<MesXslMixingSpecDownStep> downStepList,
|
||||
List<MesXslMixingSpecTcu> tcuList) {
|
||||
MesXslMixingSpecPage page = new MesXslMixingSpecPage();
|
||||
BeanUtils.copyProperties(main, page);
|
||||
page.setMaterialList(materialList != null ? materialList : new ArrayList<>());
|
||||
page.setStepList(stepList != null ? stepList : new ArrayList<>());
|
||||
page.setDownStepList(downStepList != null ? downStepList : new ArrayList<>());
|
||||
page.setTcuList(tcuList != null ? tcuList : new ArrayList<>());
|
||||
return page;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260527 for:【配方日志查询】从入参直接构建快照,避免二次查库-----------
|
||||
}
|
||||
|
||||
@@ -157,6 +157,7 @@ spring:
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://xsl.qdxsl.top:50768/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
# url: jdbc:mysql://localhost:3307/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: 123456
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
@@ -103,6 +103,14 @@ export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
|
||||
sectionDivider('基本信息', 'dividerBasic'),
|
||||
{
|
||||
label: '标题',
|
||||
field: 'title',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
componentProps: { placeholder: '请输入标题', allowClear: true },
|
||||
dynamicRules: () => [{ required: true, message: '请输入标题' }],
|
||||
},
|
||||
{
|
||||
label: 'PS编码',
|
||||
field: 'psCode',
|
||||
@@ -136,6 +144,7 @@ export const formSchema: FormSchema[] = [
|
||||
field: 'status',
|
||||
component: 'JDictSelectTag',
|
||||
defaultValue: 'compile',
|
||||
show: false,
|
||||
componentProps: { dictCode: 'xslmes_mixer_ps_status', disabled: true },
|
||||
colProps: colHalf,
|
||||
},
|
||||
@@ -143,6 +152,7 @@ export const formSchema: FormSchema[] = [
|
||||
label: '编制人',
|
||||
field: 'compileBy',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
componentProps: { disabled: true, bordered: false, placeholder: '保存后按创建人显示' },
|
||||
colProps: colHalf,
|
||||
},
|
||||
@@ -153,14 +163,6 @@ export const formSchema: FormSchema[] = [
|
||||
colProps: colHalf,
|
||||
componentProps: { placeholder: '请输入担当', allowClear: true },
|
||||
},
|
||||
{
|
||||
label: '标题',
|
||||
field: 'title',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
componentProps: { placeholder: '请输入标题', allowClear: true },
|
||||
dynamicRules: () => [{ required: true, message: '请输入标题' }],
|
||||
},
|
||||
|
||||
sectionDivider('组织与部门', 'dividerDept'),
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
const statusDictCode = ref('xslmes_mixer_ps_status');
|
||||
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField, updateSchema }] = useForm({
|
||||
labelWidth: 96,
|
||||
labelWidth: 88,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
@@ -166,7 +166,25 @@
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
:deep(#MesXslMixerPsCompileForm_compileBy),
|
||||
:deep(.ant-form-item-label) {
|
||||
flex: 0 0 88px !important;
|
||||
min-width: 88px !important;
|
||||
max-width: 88px !important;
|
||||
width: 88px !important;
|
||||
padding-right: 8px !important;
|
||||
box-sizing: border-box !important;
|
||||
text-align: right;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
:deep(.ant-form-item-control) {
|
||||
flex: 1 1 0% !important;
|
||||
min-width: 0 !important;
|
||||
max-width: 100% !important;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
:deep(#MesXslMixerPsCompileForm_proofreadBy),
|
||||
:deep(#MesXslMixerPsCompileForm_proofreadTime),
|
||||
:deep(#MesXslMixerPsCompileForm_auditBy),
|
||||
|
||||
@@ -1039,8 +1039,7 @@ async function applyMixingSpecPageData(row: Recordable, mode: 'edit' | 'referenc
|
||||
} else {
|
||||
refreshSignDisplay(pageData || {});
|
||||
}
|
||||
await loadMachineEffectiveVolume(sheetForm.machineId);
|
||||
await loadMixerStepOptions(sheetForm.machineId);
|
||||
await Promise.all([loadMachineEffectiveVolume(sheetForm.machineId), loadMixerStepOptions(sheetForm.machineId)]);
|
||||
await syncSheetToForm();
|
||||
materialData.value = ensureMixingDetailRows(pageData?.materialList || [], DEFAULT_MIXING_MATERIAL_ROW_COUNT);
|
||||
convertFactorApplying.value = true;
|
||||
|
||||
Reference in New Issue
Block a user