EXEC UpdateTransNo #{site}, #{transType} insert into ecss_CoDelNotifyHeader(site,bu_no,delNo,ready_date,customer_name,Destination,shipping_mode,erp_flag,notify_status, remark,createDate,createBy,cmc_invoice,overseasShipper,overseasAddress,cnative,localShipAddress,salesArea) values(#{site},#{buNo},#{delNo},#{readyDate},#{customerName},#{destination},#{shippingMode},'N',#{notifyStatus},#{remark},GetDate(), #{createBy},#{cmcInvoice},#{overseasShipper},#{overseasAddress},#{cnative},#{localShipAddress}, #{salesArea}) insert into ecss_CoDelNotifyDetail (site,bu_no,delNo,item_no,salesOrder,salesOrder_item_no,customerPO,line,version, status,family,part_no,part_description,qty,lt,cmc_comment,saleType, awb_bl,shipping_number,forwarder_info,currency,tp,ttl_amount,sum_price, so,upc,remark,pn) values (#{item.site},#{item.buNo},#{item.delNo},#{item.itemNo,jdbcType=INTEGER},#{item.salesOrder},#{item.salesOrderItemNo},#{item.customerPO},#{item.line},#{item.version}, #{item.status},#{item.family},#{item.partNo},#{item.partDescription},#{item.qty,jdbcType=DECIMAL},#{item.lt,jdbcType=DECIMAL},#{item.cmcComment},#{item.saleType}, #{item.awbBl},#{item.shippingNumber},#{item.forwarderInfo},#{item.currency},#{item.tp,jdbcType=DECIMAL},#{item.ttlAmount,jdbcType=DECIMAL},#{item.sumPrice,jdbcType=DECIMAL}, #{item.so},#{item.upc},#{item.remark},#{item.pn}) update ecss_CoDelNotifyHeader set ready_date=#{readyDate,jdbcType=TIMESTAMP} ,customer_name=#{customerName}, Destination=#{destination},shipping_mode=#{shippingMode}, remark=#{remark} ,cmc_invoice=#{cmcInvoice},overseasShipper=#{overseasShipper} ,overseasAddress=#{overseasAddress} where site=#{site} and delNo=#{delNo} delete from ecss_CoDelNotifyHeader where site=#{site} and delNo=#{delNo} update ecss_CoDelNotifyHeader set declaration_no=#{declarationNo} ,notify_status=#{status} where site=#{site} and delNo=#{delNo} update ecss_CoDelNotifyHeader set modifyFlag=#{modifyFlag} where site=#{site} and delNo=#{delNo} update ecss_CoDelNotifyDetail set modifyFlag=#{modifyFlag} where site=#{site} and delNo=#{delNo} update ecss_CoDelNotifyHeader set notify_status=#{notifyStatus},walMartOrderFlag=#{walMartOrderFlag} where site=#{site} and delNo=#{delNo} update ecss_CoDelNotifyDetail set status=#{notifyStatus} where site=#{site} and delNo=#{delNo} insert into ecss_CoDelNotifyDetail(site,bu_no,delNo,item_no,salesOrder,salesOrder_item_no,customerPO,line,version, status,family,part_no,part_description,qty,lt,cmc_comment,saleType, awb_bl,shipping_number,forwarder_info,currency,tp,ttl_amount,sum_price, so,upc,remark,pn,modifyFlag) values(#{site},#{buNo},#{delNo},#{itemNo,jdbcType=INTEGER},#{salesOrder},#{salesOrderItemNo},#{customerPO},#{line},#{version}, #{status},#{family},#{partNo},#{partDescription},#{qty,jdbcType=DECIMAL},#{lt,jdbcType=DECIMAL},#{cmcComment},#{saleType}, #{awbBl},#{shippingNumber},#{forwarderInfo},#{currency},#{tp,jdbcType=DECIMAL},#{ttlAmount,jdbcType=DECIMAL},#{sumPrice,jdbcType=DECIMAL}, #{so},#{upc},#{remark},#{pn},#{modifyFlag}) update ecss_CoDelNotifyDetail set salesOrder=#{salesOrder},customerPO=#{customerPO},line=#{line},version=#{version}, status=#{status},family=#{family},part_no=#{partNo},part_description=#{partDescription},qty=#{qty,jdbcType=DECIMAL}, lt=#{lt,jdbcType=DECIMAL},cmc_comment=#{cmcComment},saleType=#{saleType},pn=#{pn}, awb_bl=#{awbBl},shipping_number=#{shippingNumber},forwarder_info=#{forwarderInfo},currency=#{currency}, tp=#{tp,jdbcType=DECIMAL},ttl_amount=#{ttlAmount,jdbcType=DECIMAL},sum_price=#{sumPrice,jdbcType=DECIMAL}, so=#{so},upc=#{upc},remark=#{remark},modifyFlag=#{modifyFlag} where site=#{site} and delNo=#{delNo} and item_no=#{itemNo} delete from ecss_CoDelNotifyDetail where site=#{site} and delNo=#{delNo} and item_no=#{itemNo} delete from ecss_CoDelNotifyDetail where site=#{site} and delNo=#{delNo} update ecss_CoDelNotifyHeader set notify_status=#{notifyStatus} ,notifyDate=#{notifyDate,jdbcType=TIMESTAMP} where site=#{site} and delNo=#{delNo} update ecss_CoDelNotifyHeader set ready_date=#{readyDate,jdbcType=TIMESTAMP},notifyDate=#{notifyDate,jdbcType=TIMESTAMP} where site=#{site} and delNo=#{delNo} insert into ecss_hsCode (Site,BuNo,HsCode,Remark,CreateBy,CreateDate,codeNo,hsCodeDesc,hsCodeDescEn,unit) values(#{site},#{buNo},#{hsCode},#{remark},#{createBy},GetDate(),#{codeNo},#{hsCodeDesc},#{hsCodeDescEn},#{unit}) update ecss_hsCode set Remark=#{remark} ,codeNo=#{codeNo},HsCode=#{hsCode},unit=#{unit} ,UpdateDate=GetDate(),UpdateBy=#{updateBy},hsCodeDescEn=#{hsCodeDescEn} where site=#{site} and buNo=#{buNo} and hsCodeDesc=#{hsCodeDesc} update part_sub_properties_value set text_value=#{textValue}, num_value=#{numValue,jdbcType=DOUBLE} where Site = #{site} and code_no = #{codeNo} and part_no = #{partNo} and sub_code_seq_no = #{subCodeSeqNo} and item_no = #{itemNo} and bu_no=#{buNo} insert into part_sub_properties_value ( part_no, site, bu_no, code_no, sub_code_seq_no, sub_code_desc, item_no, properties_item_no, text_value, num_value, record_type) select #{partNo}, #{site}, #{buNo}, #{codeNo}, 1, d.code_desc, #{itemNo,jdbcType=DOUBLE}, c.item_no, case when c.value_type_db = 'T' then c.default_value else null end, case when c.value_type_db = 'N' and c.default_value != '' then c.default_value else null end, #{recordType} from plm_properties_item c left join plm_properties_model_header d on c.site=d.site and d.code_no=#{codeNo} where c.Item_No = #{propertiesItemNo} and c.site = #{site} and c.bu_no=#{buNo} and c.item_Type = #{recordType} delete from part_sub_properties_value where site = #{site} and record_type = #{recordType} and bu_no=#{buNo} and code_no = #{codeNo} AND part_no = #{partNo,jdbcType=VARCHAR} insert into ecss_CoDelPalletHeader (site,bu_no,delNo,seq_no,pallet_no,pallet_qty,[length],width,height,volume,gross_weight,net_weight,pallet_remark,create_by, create_date,pallet) values(#{site},#{buNo},#{delNo},#{seqNo},#{palletNo},#{palletQty},#{length},#{width},#{height},#{volume},#{grossWeight,jdbcType=DECIMAL},#{netWeight,jdbcType=DECIMAL},#{palletRemark},#{createBy}, GETDATE(),#{pallet}) insert into ecss_CoDelBoxList(site,bu_no,delNo,seq_no,item_no,gross_weight,net_weight,box_qty,create_by,create_date) values (#{site},#{buNo},#{delNo},#{seqNo},#{itemNo},#{grossWeight,jdbcType=DECIMAL},#{netWeight,jdbcType=DECIMAL},#{boxQty},#{createBy},GETDATE()) insert into ecss_CoDelPalletDetail(site,bu_no,delNo,seq_no,item_no,part_no,qty,po_no,box_qty,create_by,create_date,rolls,pn) values (#{site},#{buNo},#{delNo},#{seqNo},#{itemNo},#{partNo},#{qty,jdbcType=DECIMAL},#{poNo},#{boxQty},#{createBy},GETDATE(),#{rolls,jdbcType=DECIMAL},#{pn}) update ecss_CoDelPalletHeader set pallet_qty=#{palletQty,jdbcType=INTEGER},[length]=#{length,jdbcType=DECIMAL},width=#{width,jdbcType=DECIMAL},height=#{height,jdbcType=DECIMAL}, volume=#{volume,jdbcType=DECIMAL},gross_weight=#{grossWeight,jdbcType=DECIMAL},net_weight=#{netWeight,jdbcType=DECIMAL},pallet_remark=#{palletRemark}, update_by=#{updateBy},update_date=GetDate(),pallet=#{pallet} where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo} update ecss_CoDelPalletHeader set gross_weight=#{grossWeight,jdbcType=DECIMAL},net_weight=#{netWeight,jdbcType=DECIMAL}, update_by=#{updateBy},update_date=GetDate() where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo} update ecss_CoDelPalletDetail set part_no=#{partNo},qty=#{qty,jdbcType=DECIMAL},po_no=#{poNo}, box_qty=#{boxQty,jdbcType=DECIMAL},update_by=#{updateBy},update_date=GetDate(),rolls=#{rolls},pn=#{pn} where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo} and item_no=#{itemNo} delete from ecss_CoDelPalletHeader where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo} delete from ecss_CoDelBoxList where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo} delete from ecss_CoDelPalletDetail where site =#{site} and bu_no=#{buNo} and delNo=#{delNo} and seq_no=#{seqNo} and item_no=#{itemNo} insert into ecss_declaration_header (site,declaration_no,customs_office_code,input_code,local_shipper,local_ship_address,ship_type,ship_date,submit_date, filing_no,overseas_shipper,shipping_mode,shipping_data,deliver_no,sales_partner,regulatory_method,duty_status, permit_number,cmc_invoice,sales_area,receive_area,shipping_port,exit_port,documents,remark,package_type,package_qty, gross_weight,net_weight,payment_type,ship_price,premium,other_price,special_relationship_comfirm,price_influence_confirm, royalty_payments_confirm,create_by,create_date,delNo,overseas_address,box_qty) values(#{site},#{declarationNo},#{customsOfficeCode},#{inputCode},#{localShipper},#{localShipAddress},#{shipType},#{shipDate},#{submitDate}, #{filingNo},#{overseasShipper},#{shippingMode},#{shippingData},#{deliverNo},#{salesPartner},#{regulatoryMethod},#{dutyStatus}, #{permitNumber},#{cmcInvoice},#{salesArea},#{receiveArea},#{shippingPort},#{exitPort},#{documents},#{remark},#{packageType},#{packageQty,jdbcType=INTEGER}, #{grossWeight,jdbcType=DECIMAL},#{netWeight,jdbcType=DECIMAL},#{paymentType},#{shipPrice,jdbcType=DECIMAL},#{premium,jdbcType=DECIMAL},#{otherPrice,jdbcType=DECIMAL},#{specialRelationshipComfirm},#{priceInfluenceConfirm}, #{royaltyPaymentsConfirm},#{createBy},GETDATE(),#{delNo},#{overseasAddress},#{boxQty}) insert into ecss_declaration_detail(site,declaration_no,item_no,hs_code,hs_code_desc,qty,net_weight,unit_price,total_price,currency,made_area,destination, source_area,levy) values(#{site},#{declarationNo},#{itemNo,jdbcType=INTEGER},#{hsCode},#{hsCodeDesc},#{qty,jdbcType=DECIMAL},#{netWeight,jdbcType=DECIMAL},#{unitPrice,jdbcType=DECIMAL},#{totalPrice,jdbcType=DECIMAL},#{currency},#{madeArea},#{destination}, #{sourceArea},#{levy}) delete from ecss_declaration_header where site=#{site} and declaration_no=#{declarationNo} delete from ecss_declaration_detail where site=#{site} and declaration_no=#{declarationNo} insert into ecss_pallet (Site,BuNo,pallet_type,Remark,CreateBy,CreateDate,length,width, height,application_area,pallet_no) values(#{site},#{buNo},#{palletType},#{remark},#{createBy},GetDate(),#{length},#{width}, #{height},#{applicationArea},#{palletNo}) update ecss_pallet set Remark=#{remark} ,pallet_type=#{palletType} , length=#{length} ,width=#{width} , height=#{height} ,application_area=#{applicationArea} , pallet_no=#{palletNo}, UpdateDate=GetDate(),UpdateBy=#{updateBy} where site=#{site} and buNo=#{buNo} and id=#{id} insert into ecss_package (Site,BuNo,package_type,Remark,CreateBy,CreateDate,length,width, height,volume,weight,package_no) values(#{site},#{buNo},#{packageType},#{remark},#{createBy},GetDate(),#{length},#{width}, #{height},#{volume},#{weight},#{packageNo}) update ecss_package set Remark=#{remark} ,package_type=#{packageType} , length=#{length} ,width=#{width} ,volume=#{volume},weight=#{weight}, package_no=#{packageNo},height=#{height} , UpdateDate=GetDate(),UpdateBy=#{updateBy} where site=#{site} and buNo=#{buNo} and id=#{id} update ecss_declaration_header set upc=#{upc},so=#{so},origin=#{origin},pallet_weight=#{palletWeight},material=#{material}, hs_code=#{hsCode},packaging=#{packaging},kgs=#{kgs},shipping_mark=#{shippingMark},boxChange=#{boxChange}, hsCodeDesc=#{hsCodeDesc},contractFlag=#{contractFlag},hsCodeDescType=#{hsCodeDescType},goodsLabel=#{goodsLabel} where site=#{site} and declaration_no=#{declarationNo} update ecss_CoDelNotifydetail set lossratio=#{lossratio},ehundred=#{ehundred} where site=#{site} and delNo=#{delNo} and part_no=#{partNo} update ecss_CoDelNotifydetail set nocartons=#{nocartons} where site=#{site} and delNo=#{delNo} and part_no=#{partNo} insert into ecss_template (customName,site,buNo,name,type,upc,so,origin,palletWeight,material,hsCode,packaging,itemNo, kgs,shippingMark,boxChange,hsCodeDesc,contractFlag,hsCodeDescType,goodsLabel,hsCodeFlag,shippingMode,CreateBy,CreateDate, salesMethod,currency,madeArea,sendPort,shipper,voyage,deliveryGoodsDate,shippingDate,fscWeight, remark) values(#{customName},#{site},#{buNo},#{name},#{type},#{upc},#{so},#{origin},#{palletWeight},#{material},#{hsCode},#{packaging}, #{itemNo},#{kgs},#{shippingMark},#{boxChange}, #{hsCodeDesc},#{contractFlag},#{hsCodeDescType},#{goodsLabel},#{hsCodeFlag},#{shippingMode},#{createBy},GetDate(), #{salesMethod},#{currency},#{madeArea},#{sendPort},#{shipper},#{voyage},#{deliveryGoodsDate},#{shippingDate},#{fscWeight},#{remark}) update ecss_template set buNo=#{buNo},name=#{name},type=#{type},upc=#{upc},so=#{so},origin=#{origin},boxChange=#{boxChange}, palletWeight=#{palletWeight},material=#{material},hsCode=#{hsCode},itemNo=#{itemNo}, packaging=#{packaging},kgs=#{kgs},shippingMark=#{shippingMark},hsCodeDesc=#{hsCodeDesc}, contractFlag=#{contractFlag},hsCodeDescType=#{hsCodeDescType},goodsLabel=#{goodsLabel},hsCodeFlag=#{hsCodeFlag}, shippingMode=#{shippingMode},UpdateDate=GetDate(),UpdateBy=#{updateBy},customName=#{customName},salesMethod= #{salesMethod}, currency= #{currency},madeArea= #{madeArea},sendPort= #{sendPort},shipper= #{shipper},remark= #{remark}, voyage= #{voyage},deliveryGoodsDate= #{deliveryGoodsDate},shippingDate= #{shippingDate},fscWeight=#{fscWeight} where buNo=#{buNo} and name=#{nameNative} insert into ecss_walMartOrder (site,buNo,sku,so,qty,rolls,grossWeight,verificationSheet,CreateBy,CreateDate) values(#{site},#{buNo},#{sku},#{so},#{qty},#{rolls},#{grossWeight},#{verificationSheet},#{createBy},GetDate()) insert into ecss_walMartOrder (site,buNo,sku,so,qty,rolls,grossWeight,verificationSheet,CreateBy,CreateDate) values (#{item.site},#{item.buNo},#{item.sku},#{item.so},#{item.qty}, #{item.rolls},#{item.grossWeight},#{item.verificationSheet},#{item.createBy},GetDate()) update ecss_walMartOrder set buNo=#{buNo},sku=#{sku},so=#{so},qty=#{qty},rolls=#{rolls},grossWeight=#{grossWeight}, verificationSheet=#{verificationSheet},UpdateDate=GetDate(),UpdateBy=#{updateBy} where buNo=#{buNo} and sku=#{sku} and so=#{so} and qty=#{qty} update ecss_CoDelNotifyHeader set export_flag = #{exportFlag}, updateBy = #{updateBy}, updateDate = GetDate() where site = #{site} and bu_no = #{buNo} and delNo = #{delNo}