insert into plm_technical_specification_sheet(site,code_no,project_id,test_part_no,status,rev_no,ECN_flag,ECN_no,ECN_address,remark,
create_date,create_by,proofing_no,ori_code_no,bom_type,eng_chg_level,bom_alternative_no,routing_type,routing_revision,routing_alternative_no,stage,materialType,step_id
,cqcOperator,faiOperator,peOperater,csOperater,dccOperater,mpOperator)
values
(#{site},#{codeNo},#{projectId},#{testPartNo},#{status},#{revNo},#{ecnFlag},#{ecnNo},#{ecnAddress}
,#{remark},GetDate(),#{createBy},#{proofingNo},#{oriCodeNo},#{bomType},#{engChgLevel,jdbcType=INTEGER},#{bomAlternativeNo},#{routingType},#{routingRevision,jdbcType=INTEGER},#{routingAlternativeNo},'Sample','Label',10
,#{cqcOperator},#{faiOperator},#{peOperater},#{csOperater},#{dccOperater},#{mpOperator})
update plm_project_part set now_bm=#{codeNo} where site=#{site} and project_id=#{projectId} and test_part_no=#{testPartNo}
insert into plm_technicalSpecification_team (site,code_no,operator_id,type)
values (#{site},#{codeNo},#{operatorId},#{type})
update plm_technical_specification_sheet set project_id=#{projectId},test_part_no=#{testPartNo},status=#{status}
,rev_no=#{revNo},ECN_no=#{ecnNo},ECN_flag=#{ecnFlag},ECN_address=#{ecnAddress},remark=#{remark},update_date=GetDate(),update_by=#{updateBy}
,cqcOperator=#{cqcOperator},faiOperator=#{faiOperator},peOperater=#{peOperater},
csOperater=#{csOperater},dccOperater=#{dccOperater},mpOperator=#{mpOperator}
where id=#{id}
delete from plm_technicalSpecification_team where site=#{site} and code_no=#{codeNo} and type in ('quotationOfficer','engineer','technician')
delete from plm_technicalSpecification_team where site=#{site} and code_no=#{codeNo} and type in ('reviewEngineer','peEngineer','cqe')
delete from plm_technical_specification_sheet where id=#{id}
update plm_technical_specification_sheet set process=#{process},overPrintOperator=#{overPrintOperator},printOperator=#{printOperator} where site=#{site} and code_no=#{codeNo}
update plm_technical_specification_sheet set status=#{status},stage=#{stage},remarkPage=#{remarkPage}
,rev_no=#{revNo},ECN_no=#{ecnNo},ECN_flag=#{ecnFlag},ECN_address=#{ecnAddress},cqcOperator=#{cqcOperator},update_date=GetDate(),update_by=#{updateBy}
,faiOperator=#{faiOperator},peOperater=#{peOperater},csOperater=#{csOperater},dccOperater=#{dccOperater},pod=#{pod},mpOperator=#{mpOperator}
where site=#{site} and code_no=#{codeNo}
update plm_technical_specification_sheet set picture_Addess=#{pictureAddess},materialType=#{materialType},
customerPictureChangeRemark=#{customerPictureChangeRemark},productionFileComments
=#{productionFileComments},remark=#{remark},update_date=GetDate(),update_by=#{updateBy} where site=#{site} and code_no=#{codeNo}
update plm_bm_packageInfo set
matrixStripped=#{matrixStripped},appliedType=#{appliedType},finalFormat=#{finalFormat},[rowCount]=#{rowCount,jdbcType=INTEGER},columnCount=#{columnCount,jdbcType=INTEGER},
missingAllowedFlag=#{missingAllowedFlag},rollPerQty=#{rollPerQty,jdbcType=DECIMAL},addingFilmFlag=#{addingFilmFlag},
packageRequest=#{packageRequest},coreType=#{coreType},coreDiameter=#{coreDiameter},joinAllowedFlag=#{joinAllowedFlag},coreWidth=#{coreWidth,jdbcType=DECIMAL},
specialPositiorFlag=#{specialPositiorFlag},copyPosition=#{copyPosition},overprintingFlag=#{overprintingFlag},
otherRequirement=#{otherRequirement},update_date=GetDate(),update_by=#{updateBy} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_bom (Site,code_no,erp_part_no,quantity,remark,create_by,create_date)
values(#{site},#{codeNo},#{erpPartNo},#{quantity},#{remark},#{username},GetDate())
update plm_bm_bom set quantity=#{quantity,jdbcType=DECIMAL} ,remark=#{remark},update_by=#{username},
update_date=GetDate() where Site=#{site} and code_no=#{codeNo} and erp_part_no=#{erpPartNo}
delete from plm_bm_bom where code_no=#{codeNo} and site=#{site} and erp_part_no=#{erpPartNo}
insert into plm_bm_routing (Site,code_no,processDetail,supplyAdhesiveTape,routingDrawing,drawingRevison,drawingDate,workInfo,wiRevison,wiDate,
routingRemark,routingAction,update_by,update_date) values
(#{site},#{codeNo},#{processDetail},#{supplyAdhesiveTape},#{routingDrawing},#{drawingRevison},#{drawingDate},#{workInfo},#{wiRevison},#{wiDate},
#{routingRemark},#{routingAction},#{username},GetDate())
update plm_bm_routing set processDetail=#{processDetail},supplyAdhesiveTape=#{supplyAdhesiveTape},routingDrawing=#{routingDrawing},
drawingRevison=#{drawingRevison},drawingDate=#{drawingDate},workInfo=#{workInfo},wiRevison=#{wiRevison},wiDate=#{wiDate},
routingRemark=#{routingRemark},routingAction=#{routingAction},update_by=#{username},update_date=GetDate() where site=#{site} and code_no=#{codeNo}
insert into plm_bm_propertiesValueHeader(Site,bu_no,PartNo,CodeNo,SubCodeSeqNo,SubCodeDesc,RecordType )
select #{site},#{buNo},#{codeNo},#{type},1,code_desc,'BM' from plm_bm_model_header
where site=#{site} and bu_no=#{buNo} and function_type='BM' and code_no=#{type}
insert into plm_bm_propertiesValue(Site,bu_no,PartNo,CodeNo,SubCodeSeqNo,SubCodeDesc,ItemNo,PropertiesItemNo,TextValue,NumValue,RecordType,order_id)
select #{site},#{buNo},#{codeNo},#{type},1,b.code_desc,a.seq_no,a.properties_item_no,c.DefaultValue,null,'BM',a.order_id
from plm_bm_model_header b left join plm_properties_model_detail a on a.site=#{site} and a.function_type='BM'
and a.code_no=b.properties_code_no
left join plm_properties_item c on a.properties_item_no=c.ItemNo and a.site=c.site and a.function_type=c.ItemType
where b.site=#{site} and b.bu_no=#{buNo} and b.function_type='BM' and b.code_no=#{type} and a.code_no is not null
update plm_bm_propertiesValue set NumValue=#{numValue,jdbcType=DOUBLE} ,TextValue=#{textValue} where site=#{site} and bu_no=#{buNo} and PartNo=#{partNo} and RecordType=#{recordType}
and SubCodeSeqNo=#{subCodeSeqNo} and PropertiesItemNo=#{propertiesItemNo}
insert into plm_bm_routing_detail (site,code_no,item_no,OperationDesc,remark,create_date,create_by)
values(#{site},#{codeNo},#{itemNo},#{operationDesc},#{remark},GetDate(),#{username})
update plm_bm_routing_detail set item_no=#{itemNo},OperationDesc=#{operationDesc}
,remark=#{remark},update_date=GetDate(),update_by=#{username}
where id=#{id}
delete from plm_bm_routing_detail where id=#{id}
insert into plm_bm_tpInfoDetail (site,code_no,colourMatch,environment,eordValue,customerFile,laberSize,crossNumber,hp,rowNumber,vp,remark,update_date,update_by)
values(#{site},#{codeNo},#{colourMatch},#{environment},#{eordValue},#{customerFile},#{laberSize},#{crossNumber},#{hp},#{rowNumber},#{vp},#{remark},GetDate(),#{updateBy})
update plm_bm_tpInfoDetail set colourMatch=#{colourMatch},environment=#{environment},eordValue=#{eordValue},customerFile=#{customerFile},
laberSize=#{laberSize},crossNumber=#{crossNumber},hp=#{hp},rowNumber=#{rowNumber},vp=#{vp},
remark=#{remark},update_date=GetDate(),update_by=#{updateBy} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_tpInfoColor (site,code_no,[order],color,inkType,colorRet,colorMatch,remark,filmNo,stencilNo,update_by,update_date)
values(#{site},#{codeNo},#{order},#{color},#{inkType},#{colorRet},#{colorMatch},#{remark},#{filmNo},#{stencilNo},#{updateBy},GetDate())
update plm_bm_tpInfoColor set [order]=#{order},color=#{color},inkType=#{inkType},colorRet=#{colorRet},
colorMatch=#{colorMatch},remark=#{remark},filmNo=#{filmNo},stencilNo=#{stencilNo},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_tpInfoColor where id=#{id}
insert into plm_bm_tpInfoCut (site,code_no,[order],cuttingMachine,cuttingType,cutterTooling,cutterLayout,cutterCost,p2c,c2c,cutterNo,update_date,
update_by)
values(#{site},#{codeNo},#{order},#{cuttingMachine},#{cuttingType},#{cutterTooling},#{cutterLayout},#{cutterCost},#{p2c},#{c2c},#{cutterNo},GetDate(),#{updateBy})
update plm_bm_tpInfoCut set [order]=#{order},cuttingMachine=#{cuttingMachine},cuttingType=#{cuttingType},cutterTooling=#{cutterTooling},
cutterLayout=#{cutterLayout},cutterCost=#{cutterCost},p2c=#{p2c},c2c=#{c2c},cutterNo=#{cutterNo},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_tpInfoCut where id=#{id}
insert into plm_bm_prepress (Site,code_no,plateNo,cutterNumber,cutterLayout,[action],remark,feedback,update_by,update_date)
values(#{site},#{codeNo},#{plateNo},#{cutterNumber},#{cutterLayout},#{action},#{remark},#{feedback},#{updateBy},GetDate())
update plm_bm_prepress set plateNo=#{plateNo},cutterNumber=#{cutterNumber},cutterLayout=#{cutterLayout},[action]=#{action},
remark=#{remark},feedback=#{feedback},update_by=#{updateBy},update_date=GetDate() where site=#{site} and code_no=#{codeNo}
insert into plm_bm_PrepressColor (site,code_no,[order],meshModel,meshSize,angle,coatingType,filmNo,stencilNo,color,update_by,update_date)
values(#{site},#{codeNo},#{order},#{meshModel},#{meshSize},#{angle},#{coatingType},#{filmNo},#{stencilNo},#{color},#{updateBy},GetDate())
update plm_bm_PrepressColor set [order]=#{order},color=#{color},meshModel=#{meshModel},meshSize=#{meshSize},
angle=#{angle},coatingType=#{coatingType},filmNo=#{filmNo},stencilNo=#{stencilNo},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_PrepressColor where id=#{id}
insert into plm_bm_PrintOther (site,code_no,remark,[action],update_date,update_by)
values(#{site},#{codeNo},#{remark},#{action},GetDate(),#{updateBy})
update plm_bm_PrintOther set remark=#{remark},[action]=#{action} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_PrintOtherColor (site,code_no,[order],seqNo,ink,[type],otherRef,update_by,update_date)
values(#{site},#{codeNo},#{order},#{seqNo},#{ink},#{type},#{otherRef},#{updateBy},GetDate())
update plm_bm_PrintOtherColor set [order]=#{order},seqNo=#{seqNo},ink=#{ink},[type]=#{type},
otherRef=#{otherRef},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_PrintOtherColor where id=#{id}
update plm_bm_model_header set properties_code_no=#{propertiesCodeNo} ,active=#{active} where site=#{site}
and bu_no=#{buNo} and code_no=#{codeNo}
insert into plm_bm_InkMixing (site,code_no,colourMatch,visuallySetting,indicate,customerFile,remarks,[action],update_date,update_by)
values(#{site},#{codeNo},#{colourMatch},#{visuallySetting},#{indicate},#{customerFile},#{remarks},#{action},GetDate(),#{updateBy})
update plm_bm_InkMixing set colourMatch=#{colourMatch},visuallySetting=#{visuallySetting},indicate=#{indicate}
,customerFile=#{customerFile},[action]=#{action},remarks=#{remarks},update_date=GetDate(),update_by=#{updateBy} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_InkMixingColor (site,code_no,[order],color,[type],supplier,inkUsage,mixTime,standbyTime,Viscosity,RecycleTimes,update_by,update_date)
values(#{site},#{codeNo},#{order},#{color},#{type},#{supplier},#{inkUsage},#{mixTime},#{standbyTime},#{viscosity},#{recycleTimes},#{updateBy},GetDate())
update plm_bm_InkMixingColor set [order]=#{order},color=#{color},[type]=#{type},supplier=#{supplier},inkUsage=#{inkUsage},
mixTime=#{mixTime},standbyTime=#{standbyTime},Viscosity=#{viscosity},RecycleTimes=#{recycleTimes},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_InkMixingColor where id=#{id}
insert into plm_bm_InkFormulation (Site,code_no,remarks,label_size,qpa,[action],[cross],row,hp,vp,update_date,update_by)
values(#{site},#{codeNo},#{remarks},#{labelSize},#{qpa},#{action},#{cross},#{row},#{hp},#{vp},GetDate(),#{updateBy})
update plm_bm_InkFormulation set remarks=#{remarks},label_size=#{labelSize},qpa=#{qpa},[action]=#{action},[cross]=#{cross}
,row=#{row},[hp]=#{hp},vp=#{vp},update_date=GetDate(),update_by=#{updateBy} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_InkFormulationColor (site,code_no,[order],hardness,tartness,printingSide,energy,dry_speed,dry_time,dry_temp,dry_time2,update_date,update_by)
values(#{site},#{codeNo},#{order},#{hardness},#{tartness},#{printingSide},#{energy},#{drySpeed},#{dryTime},#{dryTemp},#{dryTime2},GetDate(),#{updateBy})
update plm_bm_InkFormulationColor set [order]=#{order},hardness=#{hardness},[tartness]=#{tartness},printingSide=#{printingSide},energy=#{energy},
dry_speed=#{drySpeed},dry_time=#{dryTime},dry_temp=#{dryTemp},dry_time2=#{dryTime2},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_InkFormulationColor where id=#{id}
insert into plm_bm_Lamination (site,code_no,[action],update_date,update_by,remark)
values(#{site},#{codeNo},#{action},GetDate(),#{updateBy},#{remark})
update plm_bm_Lamination set remark=#{remark},[action]=#{action},
update_date=GetDate(),update_by=#{updateBy} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_LaminationCut (site,code_no,[order],station,processStep,machine,laminationType,rm_partNo,rm_partNo2,film_partNo,lamination_side,remarks,
update_date,update_by)
values(#{site},#{codeNo},#{order},#{station},#{processStep},#{machine},#{laminationType},#{rmPartNo},#{rmPartNo2},#{filmPartNo},#{laminationSide},#{remarks},
GetDate(),#{updateBy})
update plm_bm_LaminationCut set [order]=#{order},station=#{station},[processStep]=#{processStep},machine=#{machine},laminationType=#{laminationType},
rm_partNo=#{rmPartNo},rm_partNo2=#{rmPartNo2},film_partNo=#{filmPartNo},lamination_side=#{laminationSide},remarks=#{remarks},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_LaminationCut where id=#{id}
insert into plm_bm_Cnc (site,code_no,[action],update_date,update_by)
values(#{site},#{codeNo},#{action},GetDate(),#{updateBy})
update plm_bm_Cnc set [action]=#{action},
update_date=GetDate(),update_by=#{updateBy} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_CncCut (site,code_no,[order],cutting_machine,program_name,cutting_speed,spec,p2c,c2c,remarks,update_date,update_by)
values(#{site},#{codeNo},#{order},#{cuttingMachine},#{programName},#{cuttingSpeed},#{spec},#{p2c},#{c2c},#{remarks},
GetDate(),#{updateBy})
update plm_bm_CncCut set [order]=#{order},cutting_machine=#{cuttingMachine},[program_name]=#{programName},cutting_speed=#{cuttingSpeed},spec=#{spec},
p2c=#{p2c},c2c=#{c2c},remarks=#{remarks},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_CncCut where id=#{id}
insert into plm_bm_Cut (site,code_no,[action],update_date,update_by,remarks)
values(#{site},#{codeNo},#{action},GetDate(),#{updateBy},#{remarks})
update plm_bm_Cut set [action]=#{action},remarks=#{remarks},
update_date=GetDate(),update_by=#{updateBy} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_CutCut (site,code_no,[order],cutting_machine,cutting_type,cutting_tooling,cutter_no,cutter_layout,cutter_cost,program_name,
program_path,p2c,c2c,update_by,update_date)
values(#{site},#{codeNo},#{order},#{cuttingMachine},#{cuttingType},#{cuttingTooling},#{cutterNo},#{cutterLayout},#{cutterCost},#{programName},
#{programPath},#{p2c},#{c2c},#{updateBy},GetDate())
update plm_bm_CutCut set [order]=#{order},cutting_machine=#{cuttingMachine},[cutting_type]=#{cuttingType},cutting_tooling=#{cuttingTooling},cutter_no=#{cutterNo},
cutter_layout=#{cutterLayout},cutter_cost=#{cutterCost},program_name=#{programName}, p2c=#{p2c},c2c=#{c2c},program_path=#{programPath},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_CutCut where id=#{id}
insert into plm_bm_Printing (site,code_no,colour_match,conditions,colour_indicat,customer_file,glossiness_requirement,comments,repeat,vp,label_size,
down,plate_distortion_rate,actual_number,print_position,goods_roll_width,update_date,update_by,printLayout)
values(#{site},#{codeNo},#{colourMatch},#{conditions},#{colourIndicat},#{customerFile},#{glossinessRequirement},#{comments},
#{repeat},#{vp},#{labelSize},#{down},#{plateDistortionRate},#{actualNumber},#{printPosition},#{goodsRollWidth},
GetDate(),#{updateBy},#{printLayout})
update plm_bm_Printing set printLayout=#{printLayout},colour_match=#{colourMatch},conditions=#{conditions},colour_indicat=#{colourIndicat},customer_file=#{customerFile},glossiness_requirement=#{glossinessRequirement},comments=#{comments},
repeat=#{repeat},vp=#{vp},label_size=#{labelSize},down=#{down},plate_distortion_rate=#{plateDistortionRate},actual_number=#{actualNumber},print_position=#{printPosition},goods_roll_width=#{goodsRollWidth},update_date=GetDate(),update_by=#{updateBy} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_PrintingColor (site,code_no,[order],ink_type,color_reference,color_match,bcm,speed,dry,gallus,mark_andy,lp,Hexiang,update_by,update_date)
values(#{site},#{codeNo},#{order},#{inkType},#{colorReference},#{colorMatch},#{bcm},#{speed},#{dry},#{gallus},#{markAndy},#{lp},#{hexiang},#{updateBy},GetDate())
update plm_bm_PrintingColor set [order]=#{order},ink_type=#{inkType},[color_reference]=#{colorReference},color_match=#{colorMatch},bcm=#{bcm},
speed=#{speed},dry=#{dry},gallus=#{gallus},mark_andy=#{markAndy},lp=#{lp},Hexiang=#{hexiang},
update_date=GetDate(),update_by=#{updateBy} where id=#{id}
delete from plm_bm_PrintingColor where id=#{id}
update plm_technical_specification_sheet set bom_type=#{bomType},eng_chg_level=#{engChgLevel,jdbcType=INTEGER},
bom_alternative_no=#{bomAlternativeNo} where site=#{site} and code_no=#{codeNo}
update plm_technical_specification_sheet set routing_type=#{routingType},routing_revision=#{routingRevision,jdbcType=INTEGER},
routing_alternative_no=#{routingAlternativeNo} where site=#{site} and code_no=#{codeNo}
update plm_technical_specification_sheet set remarkPage=#{remarkPage} where site=#{site} and code_no=#{codeNo}
insert into plm_bm_printFlexoColor(site,codeNo,printSide,[order],colorReference,inkCode,colorMatch,lpi,bcm,openFlag,gallus,markAndy,hexiang,temperature,
pressure,updateDate,updateBy,remark) values
(#{site},#{codeNo},#{printSide},#{order},#{colorReference},#{inkCode},#{colorMatch},#{lpi},#{bcm},#{openFlag},#{gallus},
#{markAndy},#{hexiang},#{temperature},#{pressure},GetDate(),#{updateBy},#{remark})
update plm_bm_printFlexoColor set printSide=#{printSide},[order]=#{order,jdbcType=INTEGER},colorReference=#{colorReference},inkCode=#{inkCode},
colorMatch=#{colorMatch},lpi=#{lpi},bcm=#{bcm},openFlag=#{openFlag},gallus=#{gallus},markAndy=#{markAndy},hexiang=#{hexiang},temperature=#{temperature},
pressure=#{pressure},updateDate=GetDate(),updateBy=#{updateBy},remark=#{remark} where id=#{id}
delete from plm_bm_printFlexoColor where id=#{id}
insert into plm_bm_printIndigoColor(site,code_no,[order],printSide,colorReference,inkCode,colorMatch,printMotion,opticalDensity,lut,lpi,screenAngle,printHits,
blanketTemperture,remark,updateBy,updateDate) values
(#{site},#{codeNo},#{order},#{printSide},#{colorReference},#{inkCode},#{colorMatch},#{printMotion},#{opticalDensity},#{lut},#{lpi},
#{screenAngle},#{printHits},#{blanketTemperture},#{remark},#{updateBy},GetDate())
update plm_bm_printIndigoColor set printSide=#{printSide},[order]=#{order,jdbcType=INTEGER},colorReference=#{colorReference},inkCode=#{inkCode},
colorMatch=#{colorMatch},printMotion=#{printMotion},opticalDensity=#{opticalDensity},lut=#{lut},lpi=#{lpi},screenAngle=#{screenAngle},printHits=#{printHits},blanketTemperture=#{blanketTemperture},
remark=#{remark},updateDate=GetDate(),updateBy=#{updateBy} where id=#{id}
delete from plm_bm_printIndigoColor where id=#{id}
update plm_technical_specification_sheet
set status = #{status},
update_date = getDate(),
update_by = #{userName}
where site = #{site} and code_no = #{codeNo}