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(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) values(#{askGoodsId},#{entryNumber},#{productionCode},#{materialId},#{wbs},#{measurementId},#{outNum},#{askGoodsCode},#{companyNumber},#{sqrq},#{departmentId},#{sourceType},#{moveType}) insert into tld_ask_goods_f(ask_goods_id,ask_goods_code,company_number,sqrq,department,source_type,move_type) values(#{askGoodsId},#{askGoodsCode},#{companyNumber},#{sqrq},#{department},#{sourceType},#{moveType}) 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) values(#{uniqueCode},#{supplierId},#{serial},#{wllbCode},#{producDate},#{askGoodsId},#{type},#{storageLocationCode},#{num},#{userId},#{department}) delete from tld_inventory where id = #{id} UPDATE tld_inventory SET amount = ( SELECT a.amount FROM (select (amount - ${amount}) as amount from tld_inventory WHERE id = #{id}) as a ) 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(#{materialCode},#{supplierId},#{serial},#{num},#{type},#{userId},#{storageLocationCode},now(),#{process},#{askGoodsId},#{producDate},#{department}) insert into tld_return_gs_removal_z(material_id,wbs,num,entry_number,ask_goods_id,ask_id,storage_location_code) values(#{materialId},#{wbs},#{num},#{entryNumber},#{askGoodsId},#{askId},#{storageLocationCode}) insert into tld_ask_goods_f(ask_goods_id,removal_code,source_type,move_type,scrq) values(#{askGoodsId},#{removalCode},#{sourceType},#{movetype},now())