insert into mm.finished_glass_shelf_information(glass_shelf_number,glass_shelf_name,price,unit,max_weight,max_width,max_height,remarks,create_time) values ( #{inventoryAreaNumber},#{finishedGlassShelfInformation.glassShelfName} ,#{finishedGlassShelfInformation.price},#{finishedGlassShelfInformation.unit},#{finishedGlassShelfInformation.maxWeight} ,#{finishedGlassShelfInformation.maxWidth},#{finishedGlassShelfInformation.maxHeight},#{finishedGlassShelfInformation.remarks},now() ) insert into mm.finished_glass_shelf_log(type,glass_shelf_name,quantity,price,unit, max_weight,max_width,max_height,remarks,create_time) values ( 3,#{finishedGlassShelfInformation.glassShelfName},#{quantity} ,#{finishedGlassShelfInformation.price},#{finishedGlassShelfInformation.unit},#{finishedGlassShelfInformation.maxWeight} ,#{finishedGlassShelfInformation.maxWidth},#{finishedGlassShelfInformation.maxHeight},#{finishedGlassShelfInformation.remarks},now() ) update mm.finished_glass_shelf_information set available_quantity=available_quantity+ #{quantity}, total_quantity=total_quantity+#{quantity} where id=#{id} update mm.finished_glass_shelf_information set glass_shelf_name=#{finishedGlassShelfInformation.glassShelfName}, price=#{finishedGlassShelfInformation.price}, unit=#{finishedGlassShelfInformation.unit}, max_weight=#{finishedGlassShelfInformation.maxWeight}, max_width=#{finishedGlassShelfInformation.maxWidth}, max_height=#{finishedGlassShelfInformation.maxHeight}, remarks=#{finishedGlassShelfInformation.remarks}, create_time=now() where id=#{id} delete from mm.finished_glass_shelf_information where id=#{id} insert into mm.finished_glass_shelf_emit(emit_id,create_time,withdraw_time,customer_name,project,operator,state,remarks) values ( #{emitId},now(),#{finishedGlassShelfEmit.withdrawTime},#{finishedGlassShelfEmit.customerName} ,#{finishedGlassShelfEmit.project},#{finishedGlassShelfEmit.operator},0,#{finishedGlassShelfEmit.remarks} ) insert into mm.finished_glass_shelf_emit_details(emit_id,emit_number,max_weight,max_width,max_height, withdraw_quantity,quantity,price,unit,money,remarks,glass_shelf_name) values ( #{emitId},#{emitNumber},#{finishedGlassShelfEmitDetails.maxWeight}, #{finishedGlassShelfEmitDetails.maxWidth},#{finishedGlassShelfEmitDetails.maxHeight} ,0,#{finishedGlassShelfEmitDetails.quantity},#{finishedGlassShelfEmitDetails.price},#{finishedGlassShelfEmitDetails.unit}, #{finishedGlassShelfEmitDetails.money},#{finishedGlassShelfEmitDetails.remarks},#{finishedGlassShelfEmitDetails.glassShelfName} ) insert into mm.finished_glass_shelf_log(document_id,document_number,type,quantity,price,money,unit, remarks,create_time,max_weight,max_width,max_height,glass_shelf_name,operator) values ( #{emitId},#{emitNumber},#{type},#{quantity},#{price},#{money},#{unit}, #{remarks},now(),#{maxWeight},#{maxWidth},#{maxHeight},#{glassShelfName},#{operator} ) update finished_glass_shelf_information set state=1 where state=0 and max_weight=#{maxWeight} and max_width=#{maxWidth} and max_height=#{maxHeight} and price=#{price} and unit=#{unit} and glass_shelf_name=#{glassShelfName} order by id limit #{quantity} update finished_glass_shelf_information set state=0 where state=1 and max_weight=#{maxWeight} and max_width=#{maxWidth} and max_height=#{maxHeight} and price=#{price} and unit=#{unit} and glass_shelf_name=#{glassShelfName} order by id limit #{quantity} update mm.finished_glass_shelf_emit set create_time=now(), withdraw_time=#{finishedGlassShelfEmit.withdrawTime}, customer_name=#{finishedGlassShelfEmit.customerName}, project=#{finishedGlassShelfEmit.project}, operator=#{finishedGlassShelfEmit.operator}, remarks=#{finishedGlassShelfEmit.remarks} where emit_id=#{emitId} delete from mm.finished_glass_shelf_emit_details where emit_id=#{emitId} delete from mm.finished_glass_shelf_emit where emit_id=#{emitId} delete from mm.finished_glass_shelf_log where document_id=#{emitId} update mm.finished_glass_shelf_log set state=1 where document_id=#{emitId} update mm.finished_glass_shelf_emit_details set withdraw_quantity=withdraw_quantity+#{finishedGlassShelfWithdrawDetails.quantity} where emit_id=#{finishedGlassShelfWithdrawDetails.emitId} and emit_number=#{finishedGlassShelfWithdrawDetails.emitNumber} update mm.finished_glass_shelf_emit_details set withdraw_quantity=withdraw_quantity-#{finishedGlassShelfWithdrawDetails.quantity} where emit_id=#{finishedGlassShelfWithdrawDetails.emitId} and emit_number=#{finishedGlassShelfWithdrawDetails.emitNumber} delete from mm.finished_glass_shelf_withdraw_details where withdraw_id=#{withdrawId} delete from mm.finished_glass_shelf_withdraw where withdraw_id=#{withdrawId} update mm.finished_glass_shelf_withdraw set create_time=now() where withdraw_id=#{withdrawId} insert into mm.finished_glass_shelf_withdraw(withdraw_id,create_time,customer_name,project,operator,remarks) values ( #{withdrawId},now(),#{finishedGlassShelfWithdraw.customerName} ,#{finishedGlassShelfWithdraw.project},#{finishedGlassShelfWithdraw.operator},#{finishedGlassShelfWithdraw.remarks} ) insert into mm.finished_glass_shelf_withdraw_details(withdraw_id,withdraw_number,max_weight,emit_id,emit_number,max_width,max_height, quantity,price,unit,money,remarks,glass_shelf_name) values ( #{withdrawId},#{withdrawNumber},#{finishedGlassShelfWithdrawDetails.maxWeight},#{finishedGlassShelfWithdrawDetails.emitId},#{finishedGlassShelfWithdrawDetails.emitNumber}, #{finishedGlassShelfWithdrawDetails.maxWidth},#{finishedGlassShelfWithdrawDetails.maxHeight} ,#{finishedGlassShelfWithdrawDetails.quantity},#{finishedGlassShelfWithdrawDetails.price},#{finishedGlassShelfWithdrawDetails.unit}, #{finishedGlassShelfWithdrawDetails.money},#{finishedGlassShelfWithdrawDetails.remarks},#{finishedGlassShelfWithdrawDetails.glassShelfName} ) update mm.finished_glass_shelf_emit set state=#{state} where emit_id=#{emitId}