|
|
|
@ -533,10 +533,32 @@ |
|
|
|
order by operation_no desc |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- |
|
|
|
从临时表保存BOM component到正式表 |
|
|
|
|
|
|
|
关键业务逻辑:operation_id映射 |
|
|
|
===================================== |
|
|
|
问题背景: |
|
|
|
1. 原BOM的operation_id指向旧routing_component的自增主键ID |
|
|
|
2. 复制BOM时,新routing_component会生成新的operation_id(自增主键) |
|
|
|
3. 需要将旧operation_id映射到新operation_id |
|
|
|
|
|
|
|
映射逻辑: |
|
|
|
1. plm_copy_temp_bom.operation_id = 原BOM的旧operation_id |
|
|
|
2. 通过plm_copy_temp_routing找到旧operation_id对应的operation_no(工序编码,如10、20、30) |
|
|
|
3. 在新创建的plm_routing_component中,通过operation_no找到新的operation_id |
|
|
|
4. 将新operation_id赋值给plm_bom_component |
|
|
|
|
|
|
|
关联条件: |
|
|
|
- temp_r.tree_id = a.tree_id:确保是同一个物料节点的routing |
|
|
|
- temp_r.operation_id = a.operation_id:通过旧operation_id关联 |
|
|
|
- temp_r.operation_no = new_rc.operation_no:通过工序编码找到新routing |
|
|
|
- 其他条件(site、bu_no、part_no等):精确匹配routing记录 |
|
|
|
--> |
|
|
|
<insert id="saveBomComponentFromTemp"> |
|
|
|
insert into plm_bom_component |
|
|
|
(site, bu_no, part_no, eng_chg_level, bom_type, alternative_no, component_part, print_unit, qty_per_assembly, |
|
|
|
component_scrap, issue_type, shrinkage_factor, line_item_no, issue_to_loc, note_text, create_date, create_by, |
|
|
|
component_scrap, issue_type, shrinkage_factor, line_item_no, operation_id, issue_to_loc, note_text, create_date, create_by, |
|
|
|
line_sequence, consumption_item, consumption_loss, production_data, material_data, finished_product_data, |
|
|
|
coating_length, glue_weight, material_width, width_conversion, material_length, material_thickness, |
|
|
|
area_conversion, density_conversion, material_weight, material_length2, unit_conversion) |
|
|
|
@ -554,6 +576,21 @@ |
|
|
|
a.issue_type, |
|
|
|
a.shrinkage_factor, |
|
|
|
a.line_item_no, |
|
|
|
(select top 1 new_rc.operation_id |
|
|
|
from plm_copy_temp_routing as temp_r |
|
|
|
inner join plm_routing_component as new_rc |
|
|
|
on temp_r.site = new_rc.site |
|
|
|
and temp_r.bu_no = new_rc.bu_no |
|
|
|
and temp_r.part_no = new_rc.part_no |
|
|
|
and temp_r.routing_type = new_rc.routing_type |
|
|
|
and temp_r.routing_revision = new_rc.routing_revision |
|
|
|
and temp_r.alternative_no = new_rc.alternative_no |
|
|
|
and temp_r.operation_no = new_rc.operation_no |
|
|
|
where temp_r.tree_id = a.tree_id |
|
|
|
and temp_r.operation_id = a.operation_id |
|
|
|
and temp_r.bom_id = a.bom_id |
|
|
|
and temp_r.create_by = a.create_by |
|
|
|
) as operation_id, |
|
|
|
a.issue_to_loc, |
|
|
|
a.note_text, |
|
|
|
getDate(), |
|
|
|
|