INSERT INTO plm_request_header (site,bu,classification_no,classification_name,workflow_id,menu_id,status,create_date,create_by,remark)
values(#{site},#{bu},#{classificationNo},#{classificationName},#{workflowId},#{menuId},#{status},#{createDate},#{createBy},#{remark})
update plm_request_header
set classification_name = #{classificationName},
workflow_id = #{workflowId},
menu_id = #{menuId},
status = #{status},
remark = #{remark},
update_date = GETDATE(),
update_by = #{updateBy}
where classification_no = #{classificationNo}
delete from plm_request_header
where site = #{data.site} and classification_no = #{data.classificationNo}
delete from plm_request_node
where site = #{data.site} and classification_no = #{data.classificationNo}
delete from plm_request_node_detail
where site = #{data.site} and classification_no = #{data.classificationNo}
delete from plm_request_node_authority
where site = #{data.site} and classification_no = #{data.classificationNo}
INSERT INTO plm_request_node_detail (site, bu, classification_no, node_id, node_name,
create_date, create_by, remark, plm_field, oa_field, field_value,
order_ref1, order_ref2, order_ref3, order_ref4, field_desc, workflow_id, plm_table, field_type, review)
values
(#{data.site}, #{data.bu},#{data.classificationNo},#{data.nodeId},#{data.nodeName},
GETDATE(),#{data.createBy},#{data.remark},#{data.plmField},#{data.oaField},#{data.fieldValue}
,#{data.orderRef1},#{data.orderRef2},#{data.orderRef3},#{data.orderRef4},#{data.fieldDesc},#{data.workflowId}, #{data.plmTable}, #{data.fieldType}, #{data.review})
delete from plm_request_node_detail
where site = #{site} and workflow_id = #{workflowId}
and node_id = #{nodeId}
and classification_no = #{classificationNo}
INSERT INTO plm_request_node (site,bu,classification_no,node_id,node_name,node_type,create_date,create_by,remark,workflow_id, seq_no, step_id, is_reject)
values
(#{data.site}, #{data.bu},#{data.classificationNo},#{data.nodeId},#{data.nodeName},#{data.nodeType},#{data.createDate}
,#{data.createBy},#{data.remark},#{data.workflowId},#{data.seqNo}, #{data.stepId}, 'Y')
delete from plm_request_node_authority
where site = #{site} and bu = #{bu} and classification_no = #{classificationNo} and node_id = #{nodeId} and table_id = #{tableId}
INSERT INTO plm_request_node_authority
(site, bu, classification_no, node_id, node_name, field_id, update_flag, create_date, create_by, table_id, required)
values
(#{data.site}, #{data.bu}, #{data.classificationNo}, #{data.nodeId}, #{data.nodeName}, #{data.fieldId}, #{data.updateFlag}, getDate(), #{data.createBy}, #{data.tableId}, #{data.required})
update plm_request_node
set is_reject = #{isReject},
update_date = GETDATE(),
update_by = #{updateBy},
countersignature_item = #{countersignatureItem}
where classification_no = #{classificationNo} and site = #{site} and node_id = #{nodeId}
delete from plm_process_controll_value where site=#{site} and workflow_id=#{workflowId} and node_id=#{nodeId}
insert into plm_process_controll_value(site,workflow_id,node_id,role_id)
values (#{site},#{workflowId},#{nodeId},#{roleId})
update plm_technical_specification_sheet set stage='Mass Production' where site=#{site} and code_no=#{orderNo}
update plm_process_form
set process_intervention_flag = #{processInterventionFlag}
where site = #{site} and document_no = #{documentNo} and request_id = #{requestId} and node_id = #{nodeId} and is_remark = 0
update plm_process_form
set process_intervention_flag = #{processInterventionFlag},
is_remark = 1
where site = #{site} and document_no = #{documentNo} and request_id = #{requestId} and node_id = #{nodeId} and is_remark = 0
update plm_process_form
set is_remark = 0
where id = #{id}
update plm_process_form
set node_conclusion = #{nodeConclusion2}
where site = #{site} and document_no = #{documentNo} and is_remark = #{isRemark} and node_conclusion = #{nodeConclusion1}
update plm_process_form
set node_conclusion = #{nodeConclusion2},
update_date = getDate(),
update_by = #{userName}
where site = #{site} and document_no = #{documentNo} and is_remark = #{isRemark} and (node_conclusion = #{nodeConclusion1} or node_conclusion = '')