update tld_ask_goods set num = (select num from tld_ask_goods where ask_goods_id = #{askGoodsId} and material_id = #{materialId}) where ask_goods_id = #{askGoodsId} and material_id = #{materialId} insert into tld_ask_goods(ask_goods_id,entry_number,production_code,material_id,wbs,measurement_id,num,out_num) values(#{askGoodsId},#{entryNumber},#{productionCode},#{materialId},#{wbs},#{measurementId},#{outNum}) insert into tld_ask_goods_log(ask_goods_id,entry_number,production_code,material_id,wbs,measurement_id,num,out_num,ask_goods_code,company_number,sqrq,department_id,source_type,move_type,ask_goods_type) values(#{askGoodsId},#{entryNumber},#{productionCode},#{materialId},#{wbs},#{measurementId},#{outNum},#{askGoodsCode},#{companyNumber},#{sqrq},#{departmentId},#{sourceType},#{moveType},#{askGoodsType}) insert into tld_ask_goods_f(ask_goods_id,ask_goods_code,company_number,sqrq,department,source_type,move_type,ask_goods_apply_type) values(#{askGoodsId},#{askGoodsCode},#{companyNumber},#{sqrq},#{department},#{sourceType},#{moveType},#{askGoodsApplyType}) insert into tld_ask_goods_vitrual(unique_code,supplier_id,serial,wllb_code,produc_date,ask_goods_id,type,storage_location_code,num,user_id,department,attribute) values(#{uniqueCode},#{supplierId},#{serial},#{wllbCode},#{producDate},#{askGoodsId},#{type},#{storageLocationCode},#{num},#{userId},#{department},#{attribute}) delete from tld_inventory where id = #{id} UPDATE tld_inventory SET amount = amount - #{amount} WHERE id = #{id} delete from tld_ask_goods_vitrual where id = #{id} insert into tld_removal(wllb_code,supplier_id,serial,num,type,user_id,storage_location_code,scrq,process,ask_goods_id,produc_date,department) values(#{wllbCode},#{supplierId},#{serial},#{num},#{type},#{userId},#{storageLocationCode},now(),#{process},#{askGoodsId},#{producDate},#{department}) insert into tld_return_gs_removal_z(material_id,wbs,num,entry_number,document_id,ask_id,storage_location_code) values(#{materialId},#{wbs},#{num},#{entryNumber},#{documentId},#{documentPointsId},#{storageLocationCode}) insert into tld_return_gs_removal(ask_goods_id,removal_code,source_type,move_type,scrq,delivery_type) values(#{documentId},#{removalCode},#{sourceType},#{moveType},now(),#{deliveryType}) delete from tld_ask_goods_vitrual where id = #{id} and type = #{type} update tld_ask_goods set out_num = out_num + #{num} where material_id = #{materialId} and ask_goods_id = #{askGoodsId}