insert into core_spare_part(site,bu_no,part_no,part_desc,serial_number,status,arrival_time,remark,create_time,create_by) values(#{site},#{buNo},#{partNo},#{partDesc},#{serialNumber},#{status},#{arrivalTime},#{remark},GETDATE(),#{createBy}) delete from core_spare_part where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and serial_number = #{serialNumber} update inventory_stock set qty_of_po = isnull(qty_of_po,0) + #{qtyOfPo} where id = #{id} update inventory_stock set qty_on_hand = isnull(qty_on_hand,0) + #{qtyOfPo}, qty_of_po = isnull(qty_of_po,0) - #{qtyOfPo} where id = #{id} update inventory_stock set qty_of_po = isnull(qty_of_po,0) - #{qtyOfPo} where id = #{id} update core_spare_part set status = #{status}, arrival_time = #{arrivalTime}, remark = #{remark}, update_time = getdate(), update_by = #{updateBy} where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and serial_number = #{serialNumber}